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?
-
1What created the C/decompiled code? Are you sure that this is the result of the compilation?– macro_controllerSep 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.– Neon_lightsSep 6, 2020 at 19:15
1 Answer
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