•if (a ==
0) if (a != 0)
•{ {
• ++a; ++a;
•} }
•else else
•{ {
• --a; --a;
•} }
•
•CPU fetches
instructions sequentially, so we must tell CPU that we want to skip some
instructions if some
condition is (not) met, for example if a != 0
•JNZ (jump if not zero) and
JZ (jump if zero) test ZF flag and if not set (set) changes EIP
•
• CMP [A], 0 MOV EAX, [A]
• JNZ label1 TEST EAX, EAX
• INC [A] JZ label1
• JMP label2 INC EAX
•label1: DEC [A] JMP label2
•label2: … label1: DEC EAX
• label2: …