I am working on reverse-engineering and need to write a C translation of the NAS
ID: 3817706 • Letter: I
Question
I am working on reverse-engineering and need to write a C translation of the NASM code below
and this is what I've got so far but not sure whether correct or not:
int a = 3;
int b = 4;
int main() {
f(a, b)
}
int f(int x, int y){
int z;
if(g == 3) {
return
}
}
And the output should be 4 when the code runs.
nclude asm io. inc segment data dd dd segment bss resd 1 segment text global asm main asm main enter 0,0 pusha push dword [b] push dword [a] call add esp, 8 add eax, [b] call print int call print nu popa eax, 0 mOV Leave ret push ebp ebp, esp lmov sub esp 4 mov dword [ebp-4], 1 cmp dword [ebp-121, 3 jz endf mov ebx, Cebp+81 dec ebx push ebx push dword [ebp-12] call f add esp, 8 mov ebx, [ebp+8] sub ebx, eax mov [ebp-41, ebx endf mov eax, [ebp-4] mov esp, ebp pop ebp retExplanation / Answer
Don't worry what ever you got from C translation of the NASM code is purely correct.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.