Question: For a C function having the general structure A. What value does rfun store in the callee-saved register %rbx? B. Fill in the missing expressions

For a C function having the general structure

long rfun (unsigned long x) { if ( ) } return 1 2 3 4 5 6 7 8 9 10 11 12 unsigned long nx = long rv = rfun

A. What value does rfun store in the callee-saved register %rbx?

B. Fill in the missing expressions in the C code shown above.

long rfun (unsigned long x) { if ( ) } return 1 2 3 4 5 6 7 8 9 10 11 12 unsigned long nx = long rv = rfun (nx); return ; GCC generates the following assembly code: long rfun (unsigned long x) x in %rdi rfun: pushq movq movl testq je shrq call addq .L2: popq ret %rbx %rdi, %rbx $0, %eax %rdi, %rdi .L2 $2, %rdi rfun rbx, rax %rbx

Step by Step Solution

3.40 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This problem provides a chance to examine the code for ... View full answer

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 Computer Systems A Programmers Perspective Questions!