Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

onvert the following C code to appropriate MIPS assembly, you are encouraged to

ID: 3876748 • Letter: O

Question

onvert the following C code to appropriate MIPS assembly, you are encouraged to test in SPIM Do not use any pseudoinstructions (i.e., use slt and an appropriate branch instead of bge, blt, etc.). // Do not worry about initializing transactions. // Assume register $a0 contains the address of this array // at the start of your code. int transactions[101; int i; int debits 0; int credits = 0; int transaction; for (1-0 ; 1 10 ; i++) { transaction = transactions [1]; if (transaction > 0) [ credits + transaction; else debits -- transaction;// NOTE THE MINUS! printf ("Total Credits: %d ", credits); printf("Total Debits: %d ", debits);

Explanation / Answer

The converted code in MIPS assembly is as follows :-

.file 1 ""