Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(50 points) Consider the following assembly code for long loop_for (long x, long n ) ;. The first argument x is in %rdi and second
(50 points) Consider the following assembly code for long loop_for (long x, long n ) ;. The first argument x is in \%rdi and second argument n is in \%rsi. The return value of loop_for is returned through \%rax. \( \begin{array}{cl}\text { loop_for: } & \\ \text { movq } & \% r \mathrm{rsi}, \% \mathrm{rcx} \\ \text { movq } & \$ 1, \% r d x \\ \text { movq } & \$ 0, \% \mathrm{rax} \\ \text { jmp } & . \text { L6 } \\ \text {.L5: } & \\ \text { movq } & \% r d i, \% r 8 \\ \text { andq } & \% r d x, \% r 8 \\ \text { orq } & \% r 8, \% r a x \\ \text { salq } & \% r c x, \% r d x \\ \text {.L6: } & \\ \text { testq } & \% r d x, \% r d x \\ \text { jne } & . \text { L5 } \\ \text { ret } & \end{array} \) Fill in the C code for loop_for that will have an effect equivalent to the assembly code shown
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started