TransWikia.com

Need help to understand this assembly for fibonacci seq

Reverse Engineering Asked by Neon_lights on December 11, 2020

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

One 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

enter image description here

Correct answer by blabb on December 11, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP