Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 ret

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions