Consider the following program, this program has two functions, the main functio
ID: 3705206 • Letter: C
Question
Consider the following program, this program has two functions, the main function and one subroutine function called multiplication. Write an equivalent program, using the MARIE assembly language. Please write a comment next to each instruction so that I can get a better understanding of how to do this on my own. An explanation on how to even do this type of problem would also be extremely helpful and greatly appreciated.
runcion and one subroutine function called multiplication. Write an equivalent progra, MARIE assembly language. the following program, this program has two functions, the main using the void main0 int multiplication (int x, int y) int producti, productz producti- multiplication (3, 5) print _int(proudcti) product2- multiplicationl-4,-6) print_int(proudct2) int i, tempprod -0, num -y for (iOic numi++ tempprod - tempprod+ else tempprod tempprod-x return tempprod;Explanation / Answer
ORG 100
Input X /first input
Store X /store the first input
Input Y /second input which is used as dependency inorder to control loop
Store Y /store second input
Load Y /reload second input inorder to check it is not zero
Skipcond 800 /check if the second input is greater than zero
Jump End /skip the operation if second input is zero because the product will be zero
Loop, Load Y /reload second input
Subt One /subtract the input by 1 after each loop operation
Store Y /store the resultant second input
Load Final /load the Final of addition operation; initially zero
Add X /add first input to sum
Store Final /store final
Load Y /load second input for checking whether it is more than zero or not
Skipcond 400 /stop the loop if the second factor is equal to zero
Jump Loop /run the loop if the second factor is not equal to zero
Load Final /load Final for output
End, Output /output final "product"
Halt /Exit the program program
X, Dec 0 /first factor
Y, Dec 0 /second factor
Final, Dec 0 /sum of repeated addition
One, Dec 1 /used to decrement the second factor