Loops and branches: labels, FLAGS and conditional jumps

The same loop written two ways. Keep an eye on the flags register: every arithmetic instruction leaves a "fingerprint" in it, and a conditional jump reads it to decide — jump or not.

r0q
?
FLAGS:untouched
assembly

          
C equivalent

          
Jump mnemonics — click the rows
MnemonicJump if…FLAGS
Click a mnemonic — I'll explain when it fires and what it is usually paired with.