Question: Consider the following function written in C. The function will be translated 1 poin to MIPS assembly. Assuming variables a,b,c,d are stored in SAVED registers,

Consider the following function written in C. The function will be translated 1 poin to MIPS assembly. Assuming variables a,b,c,d are stored in SAVED registers, which MIPS code snippet will correctly handle the stack manipulation that occurs at the BEGINNING of the function? Assume the conventions outlined in the slides. NMON 1 int fi( int a, int b ) { 2 int c = a + 1; 3 int d = a * b; 4 f2( c, d ); 5 a = c + d; 6 return a; 7 } 1 SUBI $SP, $SP, 28 2 SW $50, 0( $SP) 3 SW $S1, 4( $SP ) 4 SW $S2, 8( $SP) 5 SW $S3, 12( $SP ) 6 SW $RA, 16( $SP) 7 SW $20, 12( $SP ) 8 SW $41, 16( $SP) 1 SUBI $SP, $SP, 20 2 SW $50, 0($SP) 3 SW $S1, 4( $SP) 4 SW $S2, 8( $SP ) 5 SW $53, 12( $SP) 6 SW $RA, 16( $SP ) Option 1 Option 2 1 N 3 4 5 SUBI $SP, $SP, 16 SW $50, OG $SP) SW $S1, 4( $SP) SW $S2, 8( $SP ) SW $53, 12( $SP ) 1 SUBI $SP, $SP, 28 2 SW $50, 0( $SP ) 3 SW $S1, 4( $SP ) 4 SW $S2, 8( $SP ) 5 SW $53, 12( $SP) SW $RA, 16( $SP ) Option 3 Option 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
