Question: B) (15 Points) Consider the following 5 x86-64 assembly code snippets. Each of those snippets is generated by a particular version of GCC with particular

 B) (15 Points) Consider the following 5 x86-64 assembly code snippets.

B) (15 Points) Consider the following 5 x86-64 assembly code snippets. Each of those snippets is generated by a particular version of GCC with particular settings of the command-line options. For each part: (1) Briefly explain each assembly instruction inside the snippet and its effect. (2) What is the content of the rax register (in hexadecimal) right after this entire code snippet is executed? Assume that the initial value stored in rax prior to executing each of the following code snippets is 0 . (3) This assembly code snippet was part of assembly code that was generated by compiling C code with the following form: foo( {var1=var2=(:// the numerical value assigned to var1 here must be in decimal Assuming this is the only code inside the dummy function foo, fill in all missing parts of the C code inside this function. 1) movb $16,5(%rbp) movzbl 5(%rbp),%eax movl \%eax, 4(%rbp) 2) movb $088,3(%rbp) movsbw 3(%rbp),%ax movw \%ax, 2(%rbp) 3) movw $07FFF,6(%rbp) movswl -6(\%rbp), \%eax movl \%eax, 4(%rbp) 4) movb $09C,9(%rbp) movsbq 9(%rbp),%rax movq %rax,8(%rbp) 5) movl $2,8(%rbp) movl 8(%rbp),%eax movl \%eax, 4(%rbp)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!