Some Dark Corners of C
docs.google.com
docs.google.com
You can actually see that in the x86 assembly code examples in the slides: When counting up there is a cmpl instruction to perform the comparison with the end value before the conditional jump (jne). When counting down, the subl instruction will set the zero flag when the counter register reaches zero so that there no need for comparison and you can directly execute jne/jnz based on that flag. That also saves a register since you only need to keep track of the counter.