Background
To find out if a register holds a zero, the naïve technique is to do this:
cmp eax, 0
But if you look at the opcode for this, you get this:
83 F8 00 cmp eax, 0
Use test
test eax, eax ; Equal to zero?
Examine the opcode you get:
85 c0 test ea...