# Determine min and max in the array using mips assembly language

I am trying to write a program that determines the minimum and the maximum element in the array when numbers are given . this is what I have so far: a second opinion is much appreciated.

``````.text
.globl main

main :
ori \$3 , \$0 , 1       # \$3 is the count , initialized to be 1
lui \$4 , 0 x1000      # \$4 holds the address of the size
lw \$5 , 0( \$4 )       # \$5 holds the size of the array
addiu \$4 , \$4 , 4     # \$4 holds the address of the first array element
lw \$6 , 0( \$4 )       # load the first element in \$6
sll \$0 , \$0 , 0       # load delay
or \$11 , \$6 , \$0      # \$11 holds the max , initialized to be the 1 st element

loop :
beq \$3 , \$5 , endlp    # if the count == size , terminate the loop
sll \$0 , \$0 , 0        # branch delay
addiu \$4 , \$4 , 4      # \$4 holds the address of the next element
lw \$7 , 0( \$4 )        # load the next element in \$7
sll \$0 , \$0 , 0        # load delay
slt \$8 , \$11 , \$7      # \$8 holds 1 if \$11 < \$7 , and holds 0 otherwise
beq \$8 , \$0 , incCount # if \$8 ==0 , jump to incCount ,
sll \$0 , \$0 , 0        # branch delay
or \$11 , \$7 , \$0       # update the value in \$11

incCount :
addiu \$3 , \$3 , 1      # increment the count by 1
j loop
endlp : sll \$0 , \$0 , 0
. data
size :   . word 8
array :  . word 24 , -19 , 44 , -32 , 52 , -47 , 7 , 11
``````