Question: Problem 2. A C function declared as: long foo(long x, long y); compiles into the following assembly code: foo: imulq %rsi, Erdi leaq 1(rsi,rdi,2), %rax


Problem 2. A C function declared as: long foo(long x, long y); compiles into the following assembly code: foo: imulq %rsi, Erdi leaq 1(rsi,rdi,2), %rax reta a. What does foo (3,11) return? b. What does foo(100,100) return? c. What does foo (1234,5678) return? d. What does foo ( compute? Give your answer in the form of a mathematical expression in and y. Problem 5. The diagram below shows the contents of a region of memory (each beste represents quadword, i.e., 8 bytes) plus certain registers at the start of a program. Contents Addr Oxff0060 Oxf0058 Oxff0050 Oxff0048 Oxff0040 Oxff0038 Oxff0030 Oxf10028 Oxf10020 Oxff0018 Oxff0010 %rsp Zubx 0 99 44 Oxff0058 1 37 Oxff0038 Oxf1111175432010 0 Ox12345678 Oxff0028 0x21 Give the contents of each memory quadword and each of the three registers after the code below is executed: pushq %rbx movq 0x8rsp), %rbx movg (%bx), %rcx mova Ox8C%rbx). %rbx mova %rex, (%bx) Pop Wbx
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
