lea    (%edx,%eax,1),%eax

should be in intel "lea eax,

is this right?

i know that [1 + eax + edx] is addressing mode BASE RELATIVE-PLUS-INDEX or Based Indexed Plus Displacement Addressing Mode

also what is the 1 for?

heres is my code in c

int sum(int x, int y)

int t;

t = x + y;

return 0;


heres is the code in assembly

push ebp ; store the current value of EBP on the stack
mov ebp, esp ;Make EBP point to top of stack
sub esp, 10
mov eax, ;
mov eax,
lea eax, [1 + eax + ebx]
mov eax ,
mov eax, 0
mov esp, ebp ;Restore the old value of ESP
pop ebp ;Restore the old value of EBP
ret ;change EIP to start the next instruction

Posted on 2010-02-20 08:18:18 by snoopyromeo
This is an multiplier (specifies array element size), should be decoded as .
Posted on 2010-02-20 09:36:06 by sapero
As Sapero says, the '1' is the "scale" - a multiplier. If you remove that, the "lea" does your "sum".

lea eax, [1 + eax + ebx]
mov eax ,
mov eax, 0

What are the two lines after that for? Mmmm... your C code *does* specify "return 0". Makes no sense to me, but that's what it says...


Posted on 2010-02-20 23:13:05 by fbkotler