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

Consider the following function written in C. The function will be translated 1p 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. 1 int f1( int a, int b ) { 2. int c = a + 1; 3 int d = a * b; 4 a = c + d; 5 return a; 6 } } NMON 1 SUBI $SP, $SP, 28 2 SW $50, 0( $SP ) 3 SW $51, 4( $SP) 4 SW $S2, 8( $SP) 5 SW $53, 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 SUBI $SP, $SP, 16 2 SW $50, 0( $SP) 3 SW $S1, 4( $SP) 4 SW $S2, 8( $SP ) 5 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 $S3, 12( $SP ) 6 SW $RA, 16( $SP) O 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
