#-------------------------------------------
# Loops - While Loops
# Ported by: Noah Gergel
# Last updated: May 28 2020
#-------------------------------------------

.text

# Approach with a guard branch.
foo:

    # Before while loop code.
    # ...

    bge   t0, t1, _JoinPoint      # If count >= total is not < 7 then skip loop entirely
_doubleCount:
    add   t0, t0, t0              # count = count + count
    blt   t0, t1, _doubleCount    # If count < total go back to double count
_JoinPoint:
    # Code after the while loop

# Approach without a guard branch.
bar:

    # Before while loop code.
    # ...

_checkCount:
    bge   t0, t1, _JoinPoint  # If count >= total is not < 7 then skip loop entirely
    add   t0, t0, t0          # count = count + count
    j     _checkCount         # If count < total go back to double count
_JoinPoint:
    # Code after the while loop
