Question: 3.58 For a function with prototype long decode2(long x, long y, long z); ace generates the'tollowing assembly code: 1 decode2: 2 subq %rdx , %rsi
3.58
For a function with prototype
long decode2(long x, long y, long z);
ace generates the'tollowing assembly code:
1 decode2:
2 subq %rdx , %rsi
3 imulq %rsi, %rdi
4 movq %rsi, %rax
5 salq $63, %rax
6 sarq $63, %rax
7 xorq %rdi, %rax
8 ret
Parameters x, y, and z are passed in registers %rdi, %rsi, and %rdx. The code stores the return value in register %rax. Write C code for decode2 that will have an effect equivalent to the assembly code shown.
Please submit decode2.c file that includes your C code and also decode2.s file that was the assembly code generated by gcc command.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
