Question: Reading Assembly Code Before we write assembly, we will practice reading assembly code. Given each of the following initial register contents, if we call the

 Reading Assembly Code Before we write assembly, we will practice reading

Reading Assembly Code Before we write assembly, we will practice reading assembly code. Given each of the following initial register contents, if we call the indicated function, what is the answer? Fill in %rax in the chart as your answer. What do you think each function is computing? Func 1 Register %rdi %rax Value 8 funci: movq Xrdi, %rax shlq $3, %rax addq Xrdi, %rax ret Func 1 Register %rdi %rax Value 50 Func 2 Register %rdi %rsi %rdx %rcx %rax Value 10 8 3 5 func2: imulq %rsi, Erdi adda %rdx, xrcx movq %rex, Xrax adda %rdi, Xrax ret Func 2 Value 1000 Register %rdi %rsi %rdx %rcx rax 100 1 Memory Location M[@x180) M(@x108) Initial Value x 10 @x99 Func 3 Register Value %rdi0 x100 %rsi Ox108 %rdx 2 %rax func3: movq (Xrdi), %rcx mova (Xrsi), Xrax adda $1, %rax movq Xrax, (%rdi) imulq $4, Xrex adda %rdx, Xrex movq Xrex, Xrax movq Xrax, (Xrsi) ret Func 3 Register Value %rdi @x108 %rsi @x100 %rdx %rax How do the contents of the two memory locations change? Reading Assembly Code Before we write assembly, we will practice reading assembly code. Given each of the following initial register contents, if we call the indicated function, what is the answer? Fill in %rax in the chart as your answer. What do you think each function is computing? Func 1 Register %rdi %rax Value 8 funci: movq Xrdi, %rax shlq $3, %rax addq Xrdi, %rax ret Func 1 Register %rdi %rax Value 50 Func 2 Register %rdi %rsi %rdx %rcx %rax Value 10 8 3 5 func2: imulq %rsi, Erdi adda %rdx, xrcx movq %rex, Xrax adda %rdi, Xrax ret Func 2 Value 1000 Register %rdi %rsi %rdx %rcx rax 100 1 Memory Location M[@x180) M(@x108) Initial Value x 10 @x99 Func 3 Register Value %rdi0 x100 %rsi Ox108 %rdx 2 %rax func3: movq (Xrdi), %rcx mova (Xrsi), Xrax adda $1, %rax movq Xrax, (%rdi) imulq $4, Xrex adda %rdx, Xrex movq Xrex, Xrax movq Xrax, (Xrsi) ret Func 3 Register Value %rdi @x108 %rsi @x100 %rdx %rax How do the contents of the two memory locations change

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!