I understand the assembly properly. I am just confused about variable 'b' and 'c'. It looks like b is stored at 12(%ebp). I conclude this from cmp 12(%ebp), %eax. If you look at func_8048516, it is adding -0x4(%ebp) which is 'i' and 12(%ebp) which is b. It should translate into a=b+i in the source code but it's a=c+i. Can anyone explain this?

Assembly code

Source code

  • 1
    What created the C/decompiled code? Are you sure that this is the result of the compilation? Sep 6, 2020 at 7:13
  • @macro-controller this is a problem from picoCTF 2013. There might be a case of a small typo in the assembly from their side. Sep 6, 2020 at 19:15

1 Answer 1


compiling this code in godbolt.org the c code assembles to mov 16(%ebp),%edx

which is variable c not b as in your screenshot

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.