Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Translate from Assembly to C) Rewrite the main function in C. Write the function's prototype and all code contained within. Don't forget about arguments and

(Translate from Assembly to C) Rewrite the main function in C. Write the function's prototype and all code contained within. Don't forget about arguments and local variable definitions:

push rbp mov rbp,rsp sub rsp,0x20 mov DWORD PTR [rbp-0x14],edi mov QWORD PTR [rbp-0x20],rsi mov DWORD PTR [rbp-0xc],0x1a2b3c4d lea rax,[rbp-0xc] mov QWORD PTR [rbp-0x8],rax mov DWORD PTR [rbp-0x10],0x0 mov rax,QWORD PTR [rbp-0x8] movzx eax,BYTE PTR [rax] movsx eax,al shl eax,0x18 mov edx,eax mov rax,QWORD PTR [rbp-0x8] add rax,0x1 movzx eax,BYTE PTR [rax] movsx eax,al shl eax,0x10 or edx,eax mov rax,QWORD PTR [rbp-0x8] add rax,0x2 movzx eax,BYTE PTR [rax] movsx eax,al shl eax,0x8 or edx,eax mov rax,QWORD PTR [rbp-0x8] add rax,0x3 movzx eax,BYTE PTR [rax] movsx eax,al or eax,edx mov DWORD PTR [rbp-0x10],eax mov edx,DWORD PTR [rbp-0x10] mov eax,DWORD PTR [rbp-0xc] mov esi,eax mov edi,0x400644 ; "a = %#x b = %#x " mov eax,0x0 call 400400 mov eax,0x0 leave ret nop WORD PTR cs:[rax+rax*1+0x0] nop DWORD PTR [rax+rax*1+0x0]

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

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago