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

Please show your output. Introduction: In this lab, you will convert a C program

ID: 3837375 • Letter: P

Question

Please show your output.

Introduction: In this lab, you will convert a C program with functions into a MIPS program while following all of the function calling, register management and activation record conventions that we have discussed. Feel free to do this lab (and all assembly programming labs) in Windows. You must use MARS. Getting started: 1. In MARS, create a new assembly file with the name lab11.asm 2. Use the following code to get started: Description: Data segment data our data will go here Code segments text globl MAIN MAIN: your code will go here EXIT: #End of file 3. Assemble the file (F3). You should receive no warnings or errors.

Explanation / Answer

Code:-

    .data

x:   .word 1

   .text

.global MAIN

main:

   lw $s0,0(x)

   slt $t5,$zer0,$s0

   beq $5,$0,ELSE

   li $s1,5

   #3

   j DONE

   ELSE

   #4

   li $a0,6

   jl f

   #5

DONE:

   li $v0,10

   syscall

f:

   add $t0,$zero,$a0

   addi $t0,$t0,1

   jl g

   li $t1,4

   #2

   j $ra

g:

   #1

   j $ra

The code is written according to the required format . It will run but won't give any output and I have commented as per the question as required