Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Convert this x86-64 code shown above to Y86-64 code. Function arithEx() long int

ID: 3850219 • Letter: C

Question

Convert this x86-64 code shown above to Y86-64 code.

Function arithEx() long int arithEx(long int x, long int y, long int z, long w, long m, long n, long o, long p) { return (x + y + z + w + m + n + o + p): } Compilation command: gcc -O1 -S arithex.c arithEx: leaq (%rsi, %rdi), %rdi: %rdi leftarrow y + x leaq (%rdi, %rdx), %rdx: %rax leftarrow y + x + z addq %rcx, %rdx: %rdx leftarrow y + x + z + w addq %r8, %rdx: %rdx leftarrow y + x + z + w + m addq %r9, %rdx: %rdx leftarrow y + x + z + w + m + n movq %rdx, %rax: %rax leftarrow y + x + z + w + m + n addq 8 (%rsp), %rax: %rax leftarrow y + x + z + w + m + n + o addq 16(%rsp), %rax: %rax leftarrow y + x + z + w + m + n + o + p ret

Explanation / Answer

arithex :

pushl %rax # save rax which used as temporary for adding the offset