.text main: # Locals # $t0 a # $t1 b # $t2 tmp li $v0, 4 # syscall 4: print_string la $a0, prompt1_msg # syscall # printf("Enter a number: "); li $v0, 5 # syscall 5: read int syscall move $t0, $v0 # scanf("%d", &a); li $v0, 4 # syscall 4: print_string la $a0, prompt2_msg # syscall # printf("Enter another number: "); li $v0, 5 # syscall 5: read int syscall move $t1, $v0 # scanf("%d", &b); li $v0, 4 # syscall 4: print_string la $a0, result1_msg # syscall # printf("The average is: "); add $t2, $t0, $t1 # int tmp = a + b; div $t2, $t2, 2 # tmp = tmp/2; li $v0, 1 # syscall 4: print_int move $a0, $t2 # syscall # printf("%d", tmp); li $v0, 11 # syscall 11: print_character li $a0, '\n' # syscall # printf("%c", '\n'); li $v0, 0 jr $ra # return 0; .data prompt1_msg: .asciiz "Enter a number: \n" prompt2_msg: .asciiz "Enter another number: \n" result1_msg: .asciiz "The average is "