# # using integer variables # read two ints and store in num1 and num2 # add them (from the variables) and store result in num3 # print the sum (from the variable) # .data num1: .word 0 num2: .word 0 num3: .word 0 inlabel: .asciiz "\nA number: " outlabel: .asciiz "\nThe result: " .globl main .text main: # read two ints, store in variables li $v0, 4 # syscall code to print string la $a0, inlabel # $a0 <- addr of prompt syscall # print prompt li $v0, 5 # code to read int syscall # read first int sw $v0, num1 # store first int in num1 li $v0, 4 # syscall code to print string syscall # print prompt li $v0, 5 # syscall code to read int syscall # read next int (stored in $v0) sw $v0, num2 # store first int in num2 # add the ints and store sum in var lw $t1, num1 # $t1 <- num1 lw $t2, num2 # $t2 <- num2 add $t3, $t1, $t2 # $t3 <- num1 + num2 sw $t3, num3 # store the sum in num3 # print the sum li $v0, 4 # syscall code to print string la $a0, outlabel # $a0 <- addr of result msg syscall # print result msg lw $a0, num3 # $a0 <- num3 li $v0, 1 # syscall code to print an int syscall # print num3 li $v0, 10 # syscall code to exit program syscall # return