Industrial Nim

There are n ranges [l, r]. For each range, a pile is created with size equal to the XOR of all integers from l to r inclusive. Two players play standard Nim on these piles. Determine if the first player has a winning strategy.

Each pile is not supplied directly. Instead a range [l, r] defines a pile whose size is the XOR of every integer in that range. Standard Nim theory says the first player wins exactly when the XOR of all pile sizes is non-zero, so the real work is computing the XOR of many integer ranges.

The prefix XOR of 1..x repeats with period four: x, 1, x + 1, and 0 for x congruent to 0, 1, 2, and 3 modulo four. XOR is its own inverse, so the XOR of [l, r] is xorUpTo(r) ^ xorUpTo(l - 1). Fold those range values together with XOR and compare the total against zero. Leading zeros of a range are irrelevant, so even an empty-looking high range reduces cleanly to a single value.

Examples
Input: [2,[[1,3],[4,6]]]
Output: true
Hints

Industrial Nim

There are `n` ranges `[l, r]`. For each range, a pile is created with size equal to the XOR of all integers from `l` to `r` inclusive. Two players play standard Nim on these piles. Determine if the first player has a winning strategy.