Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. Homework No. 5 Analyze the following MIPS code and give line-by-line explanations of the instructions. After making that, guess (write) the C program it

.
image text in transcribed

Homework No. 5 Analyze the following MIPS code and give line-by-line explanations of the instructions. After making that, guess (write) the C program it has been translated from. function: main: addiu $sp, $sp, -40 addiu $sp, $sp, -32 SW SW $ra, 36($sp) $fp, 32($sp) SW $ra, 28($sp) SW $fp, 24($sp) move $fp, $sp move $fp, $sp SW $4, 28($fp) SW $zero, 20($fp) SW $5, 24($fp) addiu $4, $zero, 7 lw $2, 28($fp) addiu $5, $zero, 3 lw $1, 24($fp) jal function slt $1, $1, $2 beqz $1, $B_2 nop addiu $2, $zero, 0 nop j move $sp, $fp $B 1 lw $fp, 24($sp) nop lw $ra, 28($sp) $B_1: addiu $sp, $sp, 32 lw $1, 28($fp) jr $ra SW $1, 16($fp) nop lw $1, 24($fp) $.str: SW $1, 28($fp) .asciz "%3d" lw $1, 16($fp) j SW $1, 24($fp) $B_2 nop $B_2: lw $1, 28($fp) SW j $1, 20($fp) $B_3 nop $B_3: $2, 20($fp) $1, 24($fp) slt $1, $1, $2 bnez $1, $B_6 nop j $B_4 nop $B_4: lw $5, 20($fp) lui $1, %hi($.str) addiu jal $4, $1, %10 ($.str) printf nop j $B_5 nop $B_5: $1, 20($fp) addiu $1, $1, 1 SW $1, 20($fp) $B_3 $B_6: addiu jr $ra nop $sp, $fp $fp, 32($sp) $ra, 36($sp) $sp, $sp, 40

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What attracts you about this role?

Answered: 1 week ago

Question

How many states in India?

Answered: 1 week ago

Question

HOW IS MARKETING CHANGING WITH ARTIFITIAL INTELIGENCE

Answered: 1 week ago