// Selection example

// Step 1: Start program and set variables
ADDSP 3	   // adjust SP to account for rv, x, and flag
PUSHIMM 3   // push value of 3
STOREOFF 1  // store the value 3 in address 1 for x
PUSHIMM 0   // push the value of 0 (false)
STOREOFF 2  // store the value 0 in address 2 for flag

// Step 2: Check if 2 < x
PUSHIMM 2   // push the value 2 to compare with x (Vbot)
PUSHOFF 1   // push the value of x (Vtop)
LESS	   // Push result of (Vbot < Vtop) to top of stack

// Step 3: Process if statement
JUMPC correct  // check if result of GREATER is true (1) or false (0)
               // false:
               //    if you had an else in Bali, you would handle it here
JUMP continue  //    continue with remaining program
correct:       // true:
PUSHIMM 1      //    push the value 1 (true)
STOREOFF 2     //    store the value true for flag
JUMP continue  //    continue with remaining program
continue:      // continue with program:
PUSHOFF 2      //    push the value of flag
STOREOFF 0     //    store the value of flag in rv
ADDSP -2       //    reset the SP
STOP           //    done with the program