23.03.2013 Views

Quick introduction to reverse engineering for beginners

Quick introduction to reverse engineering for beginners

Quick introduction to reverse engineering for beginners

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

mov [ebp+var_4], eax<br />

fld [ebp+var_4]<br />

leave<br />

retn<br />

_Z1ff endp<br />

public main<br />

main proc near<br />

push ebp<br />

mov ebp, esp<br />

and esp, 0FFFFFFF0h<br />

sub esp, 10h<br />

fld ds:dword_8048614 ; -4.936<br />

fstp qword ptr [esp+8]<br />

mov dword ptr [esp+4], offset asc_8048610 ; "%f\n"<br />

mov dword ptr [esp], 1<br />

call ___printf_chk<br />

xor eax, eax<br />

leave<br />

retn<br />

main endp<br />

The f() function is almost understandable. However, what is interesting, GCC was able <strong>to</strong> calculate<br />

f(1.234) result during compilation stage despite all this hodge-podge with structure fields and prepared<br />

this argument <strong>to</strong> printf() as precalculated!<br />

78

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!