Well, you could easily swap the registers $a0
and $a1
if the second input item is greater than the first one.
E.g.:
move $a1, $v0 # store input in $a1 -> this is your code
# Here goes the test & swap code, just before your original base label
bge $a0, $a1, noswap
move $a1, $a0 # Swap $a0 and $a1
move $a0, $v0 # if the second item is greater than the first one
noswap:
# Here continues your code
base: