Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your code should be well documented with high-level comments. Also, your codes include a synopsis of the algorithm you used to perform the multiplication,please. Thanks!
Your code should be well documented with high-level comments. Also, your codes include a synopsis of the algorithm you used to perform the multiplication,please. Thanks!
The code provided:
a) mul.s
.globl times times: mov %edi, %eax # remove these two lines before imull %esi, %eax # you start writing your code
ret
b)main.c
#include
unsigned times(unsigned, unsigned);
void main () { unsigned a = 6; unsigned b = 7; printf("The product of %u and %u is %u. ", a, b, times(a,b)); return; }
You will modify the subroutine in mul.s, replacing the two instructions that reside there with your solution The Specification . The register %edi will contain the argurnent a. The register %esi will contain the argument b. . The register %eax will carry the return value, the product of a and b. . You may use registers %rax, %rcx, %rax, %rsi, %rdi, %r8, %r9, %r10 and %r 11 as scratch registers. i.e., you may modify their values without penalty. Plan your register usage accordingly! You may not modify the values of registers %rbx, %rbp, %rsp, %r12, %r13, %r14 and %r15. You may not modify the values of any external memory locationsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started