See this is why I felt I was obsessing over something very small.
Loop inversion, unrolling, and splitting. The compiler can do so much with a loop to make it run faster on 'this machine' to optimize for speed, memory use, or binary size.
Sorry, I didn't copy the assembler output for brevity but Clang generates `decl %esi` (or `addl $-1,%ebx` depending on the version) in the first case.
Do you know of any cases where it changes the sequence of seen values? I'm assuming it can in this case, because the i is never used?