Question: Consider the following function written in C. The function will be translated to MIPS assembly. Assuming variables a,b,c,d are stored in SAVED registers, which MIPS
Consider the following function written in C. The function will be translated 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?

Option 1:

Option 2:

Option 3:

Option 4:

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 } = Nm 00 1 2 3 4 5 6 7 8 SUBI $SP, $SP, 28 SW $50,0 $SP) SW $S1, 4( $SP ) SW $S2, 8( $SP) SW $S3, 12( $SP SW $RA, 16( $SP) SW $A0, 12( SSP SW $21, 16( $SP ) au AWNA 1 2 3 4 5 6 SUBI $SP, $SP, 20 SW $50, 0( $SP) SW $S1, 4( $SP) SW $S2, 8( $SP) SW $53, 12( $SP) SW $RA, 16( $SP ) w N = SUBI $SP, $SP, 16 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 $53, 12( $SP) 6 SW $RA, 16( $SP)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
