Lab2-1 Examine the below assembly and manually translate it into the approximate C code that produced it

Lab2-1 Examine the below assembly and manually translate it into the approximate C code that produced it.

.file “lab2-1.c”
.intel_syntax noprefix
.text
.globl main
.type main, @function
main:
push ebp
mov ebp, esp
sub esp, 16
mov DWORD PTR [ebp-12], 32
mov DWORD PTR [ebp-8], 46
mov DWORD PTR [ebp-4], 55
mov edx, DWORD PTR [ebp-12]
mov eax, DWORD PTR [ebp-8]
add eax, edx
add DWORD PTR [ebp-4], eax
mov eax, DWORD PTR [ebp-4]
leave
ret
.size main, .-main
.ident “GCC: (Ubuntu 4.9.2-10ubuntu13) 4.9.2″
.section .note.GNU-stack,””,@progbits

Lab2-2 Examine the below assembly and manually translate it into the approximate C code that produced it.

.file “lab2-2.c”
.intel_syntax noprefix
.text
.globl main
.type main, @function
main:
push ebp
mov ebp, esp
sub esp, 16
mov DWORD PTR [ebp-8], 10
mov DWORD PTR [ebp-4], 14
mov eax, DWORD PTR [ebp-8]
cmp eax, DWORD PTR [ebp-4]
jge .L2
mov eax, 1
jmp .L3
.L2:
mov eax, 2
.L3:
leave
ret
.size main, .-main
.ident “GCC: (Ubuntu 4.9.2-10ubuntu13) 4.9.2″
.section .note.GNU-stack,””,@progbits

Complete Answer:

Get Instant Help in Homework Asap
Get Instant Help in Homework Asap
Calculate your paper price
Pages (550 words)
Approximate price: -
Open chat
1
Hello 👋
Thank you for choosing our assignment help service!
How can I help you?