Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

image text in transcribed

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; \} leal (\%rdi, \%rdi), \%edx movl \$0,\%eax cmpl \%esi, \%edx jle . L6 addl \%edx, \%eax subl \$4,\%edx cmpl \%edx,\%esi jl .L9 addl \%edi, \%eax ret loop_var =0 loop_var =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 \} leal (\%rdi,\%rdi), \%edx movl \$0, \%eax cmpl \%esi, \%edx jle .L6 addl \%edx, \%eax subl \$4, \%edx cmpl \%edx, \%esi jl .L9 addl \%edi, \%eax ret loop_var x loop_var y 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, 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 update 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; leal (\%rdi,\%rdi), \%edx movl \$0, \%eax cmpl \%esi, \%edx jle . L6 addl \%edx, \%eax subl \$4,\%edx cmpl \%edx, \%esi jl.L9 addl \%edi, \%eax ret

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions

Question

Th e last time I complained, nothing happened.

Answered: 1 week ago

Question

=+Where do you want to live and work?

Answered: 1 week ago