Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
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:
int a = 3;
int b = 4;
int main() {
f(a, b)
}
int f(int x, int y){
int z;
if(g == 3) {
return
}
}
Help is needed on translating the NASM code into C.
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 ret 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 ret
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started