I'm currently studying for an exam and I don't understand the answer to this assembly question: This asm is GCC's output from the C source, except for the jge
instruction. What instruction should be there?
The correct answer is apparently jle
, but to me it seems it should be jge
.
For example, if you set a=4 in the C code, you should get 1. Based on my reading of the assembly, this is true for it as well. My logic is as follows:
If (2>=4)
return 0
else
return 1.
I think I am misunderstanding some basic aspect of machine code but I've read references on cmp and jge/jle and I still am confused.