Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q4: your task is to fill in the missing part of the C code to get a program equivalent to the generated assembly code. Recall

image text in transcribed

Q4: your task is to fill in the missing part of the C code to get a program equivalent to the generated assembly code. Recall that the result of the function is returned in register %rax. You will find it helpful to examine the assembly code before, during, and after the loop to form a consistent mapping between the registers and the program variables. A. Which registers hold program values x, n, result, and mask? B. What are the initial values of result and mask? C. What is the test condition for mask? D. How does mask get updated? E. How does result get updated? F. Fill in all the missing parts of the C code. (Problem 3.60 in textbook) loop: movl movl movl jmp .L3: mova anda %esi, %ecx $1, %edx $0, %eax .L2 long loop(long x, long n) long result = _ ; long mask; for (mask = _; mask_; mask = result = ___; %rdi, %r8 %ordx. %r8 %r8, %rax %cl, %rdx ) org return result; salg .L2: testq %rdx, %rdx .L3 rep; 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

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

Discuss selection in a global environment.

Answered: 1 week ago