translate ia32 into C
Posted
by David Lee
on Stack Overflow
See other posts from Stack Overflow
or by David Lee
Published on 2010-05-08T14:48:20Z
Indexed on
2010/05/08
14:58 UTC
Read the original article
Hit count: 279
I am trying to translate the following:
Action:
push %ebp #function prolog
mov %esp, %ebp
sub $0x10, %esp
mov 0x8(%ebp), %eax #first line compiles to these 4 lines
imul 0x8(%ebp), %eax
sub $0x7, %eax
mov %eax, -0x4(%ebp)
addl $0x8, 0xc(%ebp) #second line
mov -0x4(%ebp), %eax #third line
mov 0xc(%ebp), %edx
mov (%edx, %eax, 4), %eax
add $0x3, %eax
movb $0x41, (%eax)
leave
ret
So far I have the following:
//What am I missing?
void Action(int x, char **y)
{
int z = x * x - 7;
y+=8;
//missing third line
}
What is the best way to translate this?
© Stack Overflow or respective owner