Question: 1.(50pts) Convert the following recursive Greatest-Common-Factor function into MIPS assembly language. gcf (a, b r = a % b; # r is the Remainder of

 1.(50pts) Convert the following recursive Greatest-Common-Factor function into MIPS assembly language.

1.(50pts) Convert the following recursive Greatest-Common-Factor function into MIPS assembly language. gcf (a, b r = a % b; # r is the Remainder of a / b (see rem) if ( r ) return b; else return gcf (b, r ); 1.a [20pts] Based on the given template (gcfr_example.s), rewrite the above function so that it uses an iterative loop instead of recursion. This will be enough to express the entire procedure as a Leaf procedure, which should therefore no longer use the stack. However, your answer must still contairn all the other aspects of a procedure. 1.b [15pts] Estimate the number of instructions executed for each of the above implementations (gcfr & gcf), as a function of the number of times the remainder must be calculated before an answer is found. (This should be a linear function in both cases.) 1.c (15pts] How much of a difference does not recursing make? (Answers will certainly depend on how you count your instructions, and how elegant your code is.) Instructions: Add your implementation under corresponding assembly labels (gcf Use the following sample dataset to finish your implementation. list: .word 13, 13, 37, 6ee, 20, 10e, 624129, 2061517

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!