Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Given the following C program and its corresponding Assembly code, match the corresponding C statements with the appropriate Assembly instructions. Hint: You can try to
Given the following C program and its corresponding Assembly code, match the corresponding C statements with the appropriate Assembly instructions. Hint: You can try to get on taz, make a copy of the C code, run gcc c filename.c to generate the Assembly code, and then setup two vertical tmux windows to compare C Code #include void arith int x ; int y ; int t mallocsizeofint; t ; t t x; t y; End C Code Assembly Code push rbp mov rsprbp sub $xrsp movl $xxrbp movl $xcxcrbp mov $xedi callq mov rax,xrbp mov xrbprax add $xrax movl $xrax mov xrbprax add $xrax mov raxecx mov xrbprax add $xrax mov xrbpedx add ecx,edx mov edx,rax mov xrbprax lea xraxrdx mov xcrbpeax mov eax,rdx nop leaveq retq End Assembly Code Question options: mov xrbprax add $xrax mov raxecx mov xrbprax add $xrax mov xrbpedx add ecx,edx mov edx,rax movl $xxrbp mov $xedi callq mov rax,xrbp movl $xcxcrbp mov xrbprax add $xrax movl $xrax mov xrbprax lea xraxrdx mov xcrbpeax mov eax,rdx int t mallocsizeofint; int x ; int y ; t ; t t x; t y;
Given the following C program and its corresponding Assembly code, match the corresponding C statements with the appropriate Assembly instructions.
Hint: You can try to get on taz, make a copy of the C code, run gcc c filename.c to generate the Assembly code, and then setup two vertical tmux windows to compare
C Code
#include
void arith
int x ;
int y ;
int t mallocsizeofint;
t ;
t t x;
t y;
End C Code
Assembly Code
push rbp
mov rsprbp
sub $xrsp
movl $xxrbp
movl $xcxcrbp
mov $xedi
callq
mov rax,xrbp
mov xrbprax
add $xrax
movl $xrax
mov xrbprax
add $xrax
mov raxecx
mov xrbprax
add $xrax
mov xrbpedx
add ecx,edx
mov edx,rax
mov xrbprax
lea xraxrdx
mov xcrbpeax
mov eax,rdx
nop
leaveq
retq
End Assembly Code
Question options:
mov xrbprax
add $xrax
mov raxecx
mov xrbprax
add $xrax
mov xrbpedx
add ecx,edx
mov edx,rax
movl $xxrbp
mov $xedi
callq
mov rax,xrbp
movl $xcxcrbp
mov xrbprax
add $xrax
movl $xrax
mov xrbprax
lea xraxrdx
mov xcrbpeax
mov eax,rdx
int t mallocsizeofint;
int x ;
int y ;
t ;
t t x;
t y;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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