X86 cmpl and jne

I am tracking some x86 code for assignment, and I was wondering what exactly cmpl does and how to predict whether jne will execute.

80484bf:    83 7d f0 07             cmpl   $0x7,-0x10(%ebp)
80484c3:    75 16                   jne    80484db

In addition, Intel syntax is used for this.

Thank.

+5
source share
1 answer

cmpl subtracts -0x10 (% ebp) from $ 0x7 and changes the flags: AF CF OF PF SF ZF .

  • if -0x10 (% ebp), which is one of your function arguments, is 0x7, then the ZF flag is set .
  • jne 80484db means that if the two numbers being compared are different (ZF = 0), go to 80484db

To summerize, your code is equivalent:

compare A to B
jump into 80484db if they are different.
+7
source

All Articles