Technomancer
June 5th, 2006, 05:40
I was trying to understand the deadlisting of a program yesterday and i saw something like this :
After analysing it, i realise this can be emulated to something as simple as :
Why did the compiler went through so much trouble to assign the value in al, cx and dx in consecutive address/memory location in the stack when it could be optimised to a much easier solution like mine. I thought ... compilers are supposed to be perfect ?!!
Code:
:423864 88442404 mov byte ptr [esp+04], al
:423868 8D442404 lea eax, dword ptr [esp+04]
:42386C 50 push eax //first argument
:42386D BB05000000 mov ebx, 00000005 //second argument
:423872 66894C2409 mov word ptr [esp+09], cx
:423877 668954240B mov word ptr [esp+0B], dx
:42387C E81CCF0000 call 43079D
After analysing it, i realise this can be emulated to something as simple as :
Code:
mov eax, someptr ;where someptr is an addy pointing to whats in al,cx & dx
push eax //first argument
mov ebx,00000005 //second argument
call 43079D
Why did the compiler went through so much trouble to assign the value in al, cx and dx in consecutive address/memory location in the stack when it could be optimised to a much easier solution like mine. I thought ... compilers are supposed to be perfect ?!!