#### Test program for conditionals

section data
different:
string "%d is different from %d\n\x00"

equal:
string "%d is equal to %d\n\x00"

greater:
string "%d is greater than %d\n\x00"

greater_or_equal:
string "%d is greater than or equal to %d\n\x00"

less:
string "%d is less than %d\n\x00"

less_or_equal:
string "%d is less than or equal to %d\n\x00"

nonzero:
string "%d is nonzero\n\x00"

zero:
string "%d is zero\n\x00"

section functions
import printf
export main

main:
function argc argv
  let x 0
  let y 1

  ifeq x 0
    call printf zero x
  else
    call printf nonzero x
  end if

  ifeq y 0
    call printf zero y
  else
    call printf nonzero y
  end if

  ifgt x y
    call printf greater x y
  else
    call printf less_or_equal x y
  end if

  ifgt y x
    call printf greater y x
  else
    call printf less_or_equal y x
  end if

  iflt x y
    call printf less x y
  else
    call printf greater_or_equal x y
  end if

  iflt y x
    call printf less y x
  else
    call printf greater_or_equal y x
  end if

  set y -1

  ifne y 0
    call printf nonzero y
  else
    call printf zero y
  end if

  ifne x 0
    call printf nonzero x
  else
    call printf zero x
  end if

  ifle y x
    call printf less_or_equal y x
  else
    call printf greater y x
  end if

  ifle x y
    call printf less_or_equal x y
  else
    call printf greater x y
  end if

  ifge x y
    call printf greater_or_equal x y
  else
    call printf less x y
  end if

  ifge y x
    call printf greater_or_equal y x
  else
    call printf less y x
  end if

  return 0
end function
