Question: I need the answer for question 4 (3 and 5 are correct) Question 3 20/20 points NOTE: This is part 1 of a 3 part
I need the answer for question 4 (3 and 5 are correct)



Question 3 20/20 points NOTE: This is part 1 of a 3 part problem. All the while loop questions refer to the same C code and the same assembly code, but ask you to determine a different missing expression. It is probably easiest if you try to determine all 3 expressions first, and then go back and select the best answer in each of the 3 quiz questions. Below is a function written in C with three missing expressions (init, test, and update) Below that is the result of compiling the original function (before I removed the expressions). Which of the choices below is the missing init expression that would lead to the assembly below? int g( int x, int y){ int loop_var =/ init /; int answer =0; while (/ test /){ answer += loop_var; loop_var =/ update /; \} return answer +x; g : leal (\%rdi,\%rdi), \%edx movl $0, \%eax cmpl \%esi, \%edx jle .L6 .L9 addl \%edx, \%eax subl $4, \%edx cmpl \%edx, \%esi jl.L9 .L6: addl \%edi, \%eax ret loop_var =0 loop_var =4 loop_var =x+y loop_var =2x Question 4 NOTE: This is part 2 of a 3 part problem. All the while loop questions refer to the same C code and the same assembly code, but ask you to determine a different missing expression. It is probably easiest if you try to determine all 3 expressions first, and then go back and select the best answer in each of the 3 quiz questions. Below is a function written in C with three missing expressions (init, test, and update) Below that is the result of compiling the original function (before I removed the expressions). Which of the choices below is the missing test expression that would lead to the assembly below? int g( int x, int y){ int loop_var =/ init /; int answer =0; while (/ test /){ answer += loop_var; loop_var =// update /; \} return answer +x \} g : leal (\%rdi,\%rdi), \%edx movl \$0, \%eax cmpl \%esi, \%edx jle. .L6 .L9: addl \%edx , \%eax subl $4,%%x cmpl \%edx, \%esi jl. L9 . L6: addl \%edi, \%eax ret \[ \begin{array}{l} \text { loop_var }x \\ \text { loop_var }y \end{array} \] Question 5 20/20 poi NOTE: This is part 3 of a 3 part problem. All the while loop questions refer to the same C code and the same assembly code, bu ask you to determine a different missing expression. It is probably easiest if you try to determine all 3 expressions first, and then back and select the best answer in each of the 3 quiz questions. Below is a function written in C with three missing expressions (init, test, and update) Below that is the result of compiling the original function (before I removed the expressions). Which of the choices below is the missing update expression that would lea to the assembly below? int g( int x, int y){ int loop_var =/ init /; int answer =0; while (/ test /){ answer += loop_var; loop_var =/ update /; \} return answer +x; g : leal (\%rdi,\%rdi), \%edx movl \$0, \%eax cmpl \%esi, \%edx jle .L6 .L9: addl \%edx, \%eax subl $4, \%edx cmpl \%edx, \%esi jl .L9 .L6: addl \%edi, \%eax ret loop_var - y loop_var - 4 loop_var
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
