I have the following function in assembly, but I need it in C. The code is:
push ebp
mov ebp, esp
mov eax, DWORD PTR [ebp+8]
add eax, 1667940388
pop ebp
ret
Could anybody translate this into C for me. Thanks.
I have the following function in assembly, but I need it in C. The code is:
push ebp
mov ebp, esp
mov eax, DWORD PTR [ebp+8]
add eax, 1667940388
pop ebp
ret
Could anybody translate this into C for me. Thanks.
Sorry for the silly mistake on the eax return value ... its' fixed now ... my assembly is a little rusty :)
int function(int value)
{
return value + 1667940388;
}
eax is return register. it return a value.ebp on the stack then sets ebp to the current stack pointer. By that point, ebp+8 points to the function's argument (ebp+0 is the saved ebp value, ebp+4 is the return address) - this being 32-bit code of course.