News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Can you Figure out the Syntax?

Started by why06, February 02, 2010, 11:10:54 PM

Previous topic - Next topic

Slugsnack

Quote from: MichaelW on February 03, 2010, 04:57:45 AM
FWIW the C source would look something like this:

int __fastcall MyFunction ( int x, int y )
{
    return x*2+y*3;
}


The posted code would be the result of compiling with no optimizations. Using /O2 /G6 the compiler would reduce the procedure to just three instructions:

    lea eax, DWORD PTR [edx+edx*2]
    lea eax, DWORD PTR [eax+ecx*2]
    ret 0


Not bad ^_^
int MyFunction(int x, int y)
{
return (x * 2) + (y * 3);
}


http://en.wikibooks.org/wiki/X86_Disassembly/Calling_Convention_Examples