Question: Don't copy and paste the wrong thing for me. if you do not know the answer, please ignore. Problem 0. (4 points. Consider the following

 Don't copy and paste the wrong thing for me. if you

do not know the answer, please ignore. Problem 0. (4 points. Consider

Don't copy and paste the wrong thing for me. if you do not know the answer, please ignore.

Problem 0. (4 points. Consider the following C function: long func1(long x, long y, long z) { long ti = 100 - x; long t2 = 4*y + t1; long t3 = 2 * (z - 3); long t4 = t2 + t3; return } t4; Show that the following assembly code: func1: movl subg leaq leaq ret $100, %eax %rdi, %rax %rax,%rsi, 4), %rax -6%rax,%rdx, 2), %rax is a correct translation of this program, by (a) giving an expression for the value func() returns and (b) filling in the table below, showing the contents of each register in terms of the parameters I. y, and z after each instruction is executed. The first row shows register contents before the first instruction. Remember that the sequence of assembly instructions may not correspond exactly to the C code, as the compiler may rearrange things to minimize the number of instructions and registers used. Fill in each spot in the table, even where it does not change. %rdi %rsi %rdx %rax Z Problem 1. (4 points) Repeat the above process for the following C code and assembly: long func2(long x, long y, long z) { long t1 = 10*x; long t2 = z + t1; long t3 = y - 8; long t4 = t3 + t2; long t5 = 4 * t4; long rval = ti + t5; return rval; } 3 func2: leaq (%rdi, %rdi, 4), %rax addq %rax %rax addq %rax, %rdx leaq -8C%rdx,%rsi), %rdx leaq %rax, %rdx, 4), %rax ret %rdi %rsi %rdx %rax X Z

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!