Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 2 -Convert Assembly into C code 1. Run and analyze the assembly code provided below and convert it to equivalent C language. 2. There
Problem 2 -Convert Assembly into C code 1. Run and analyze the assembly code provided below and convert it to equivalent C language. 2. There is an error in the code. It could be extra instruction or missing instruction. Provide a report/explantaion of the discovered error. 3. The program should print: My answer is > > Dec: 70 Hex: 0x46 4. In the assembly code a. identify and comment the lines that initialize the variables with the respective values in decimal b. Identify and comment the lines that are used to pass the parameters to additup function 5. DO NOT hard code the output string. 1 global _start 3 extern printf 4 extern exit 5 6 section . text 8 additup: 9 push rbp 10 mov rbp, rsp 11 sub rsp, 0x20 12 mov DWORD [rbp-0x14], edi 13 mov DWORD [rbp-0x18], esi 14 mov DWORD [rbp-0x1c], edx 15 mov eax, DWORD [rbp-0x14] 16 and eax, Oxa 17 mov edx, eax 18 mov eax, DWORD [rbp-0x18] 19 and eax, 0x14 20 or edx, eax 21 mov eax, DWORD [rbp-0x1c] 22 and eax, 0x28 23 add eax, edx 24 mov DWORD [rbp-0x4], eax 25 mov eax, DWORD [rbp-0x4] 26 leave 27 28 _start: 29 push rbp 30 mov rbp, rsp 31 sub rsp, 0x10 32 33 34 mov DWORD [rbp-0x4], 0x3c 35 mov DWORD [rbp-0x8], 0xaa 36 mov DWORD [rbp-0xc], 0x36 37 mov DWORD [rbp-0x10], 0*C8 38 mov edx, DWORD [rbp-0x4] 39 mov ecx, DWORD [rbp-0xc] 40 mov eax, DWORD [rbp-0x8] 41 mov esi, ecx 42 mov edi, eax 43 call additup 44 mov DWORD [rbp-0x10], eax 45 mov edx, DWORD [rbp-0x10] 46 mov esi, eax 47 mov rdi, format1 48 mov eax, 0x0 49 call printf 50 mov edi, Oxa 51 call exit 52 section . data 53 format1 db "My answer is >> Dec: %d Hex: %#x", Oxa, 0x0
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