	.data
g:	.word 10
h:	.word 11
i:	.word -6
j:	.word 0xf

	.text
	
	li $s0, 20
	li $t0, 30
	li $t1, 40

	# guarda argumentos
	lw $a0, g
	lw $a1, h
	lw $a2, i
	lw $a3, j
	
	jal suma
	
	move $t0, $v0
	
	# imprime el resultado
	li $v0, 1
	move $a0, $t0
	syscall
	
	# stop
	li $v0, 10
	syscall
	
suma:
	addi $sp, $sp, -12	# El frame ocupa 12 bytes
	sw $t1, 8($sp)		# Guarda $t1
	sw $t0, 4($sp) 		# Guarda $t0
	sw $s0, 0($sp) 		# Guarda $s0

	add $t0, $a0, $a1	# $t0 = g + h
	add $t1, $a2, $a3	# $t1 = i + j
	sub $s0, $t0, $t1	# $s0 = $t0 - $t1
	add $v0, $s0, $zero	# El valor se regresa en $v0

	lw $s0, 0($sp)		# Restaura $s0
	lw $t0, 4($sp)		# Restaura $t0
	lw $t1, 8($sp)		# Restaura $t1
	addi $sp, $sp, 12	# Ajusta la pila
	jr $ra			# Brinca al llamador
