Reverse Engineering for Beginners

(avery) #1

CHAPTER 14. LOOPS CHAPTER 14. LOOPS


cmp ebx, 64h ; i==100?
jnz short loc_80484D0 ; if not, continue
add esp, 1Ch
xor eax, eax ; return 0
pop ebx
mov esp, ebp
pop ebp
retn
main endp


It is quite similar to what MSVC 2010 with optimization (/Ox) produce, with the exception that theEBXregister is allocated
for theivariable. GCC is sure this register will not be modified inside of thef()function, and if it will, it will be saved at
the function prologue and restored at epilogue, just like here in themain()function.

Free download pdf