View on GitHub

JST

By Janelle Blankenburg, Shubham Gogna, and Terence Henriod
UNR CS 660: Compiler Construction

Download this project as a .zip file Download this project as a tar.gz file

Fizz Buzz

Input

int main() {
    char fizz[] = "Fizz";
    char buzz[] = "Buzz";

    int i = 0;

    // FizzBuzz
    for( i = 1; i <= 30; i++) {
       //FizzBuzz
       if( i % 3 == 0){

            //FizzBuzz
            if( i % 5 == 0 ){
                // expect to see this at 15 and 30
                print_int(i); print_char(':'); print_char(' ');
                print_string(fizz);
                print_string(buzz);
                print_char('\n');
            }

            //Fizz
            else {
               // expect to see this at 3,6,9,12,18,21,24,27
               print_int(i); print_char(':'); print_char(' ');
               print_string(fizz);
               print_char('\n');
            }

       }
       // Buzz
       else if( i % 5 == 0) {
           // expect to see this at 5,10,15,20,25
           print_int(i); print_char(':'); print_char(' ');
           print_string(buzz);
           print_char('\n');
       }
       // Number
       else {
           // expect to see all other numbers except those mentioned above
           print_int(i); print_char('\\n');
       }
    }

    return 0;
}

MIPS


  .macro SAVE_T_REGISTERS
  # brace yourself for a long, unrolled loop...
  sw           $t0,    ($sp)
  subiu        $sp,      $sp,        4
  sw           $t1,    ($sp)
  subiu        $sp,      $sp,        4
  sw           $t2,    ($sp)
  subiu        $sp,      $sp,        4
  sw           $t3,    ($sp)
  subiu        $sp,      $sp,        4
  sw           $t4,    ($sp)
  subiu        $sp,      $sp,        4
  sw           $t5,    ($sp)
  subiu        $sp,      $sp,        4
  sw           $t6,    ($sp)
  subiu        $sp,      $sp,        4
  sw           $t7,    ($sp)
  subiu        $sp,      $sp,        4
  sw           $t8,    ($sp)
  subiu        $sp,      $sp,        4
  sw           $t9,    ($sp)
  subiu        $sp,      $sp,        4
  .end_macro

  .macro RESTORE_T_REGISTERS
  # brace yourself for a long, unrolled loop...
  addiu        $sp,      $sp,        4
  lw           $t9,    ($sp)
  addiu        $sp,      $sp,        4
  lw           $t8,    ($sp)
  addiu        $sp,      $sp,        4
  lw           $t7,    ($sp)
  addiu        $sp,      $sp,        4
  lw           $t6,    ($sp)
  addiu        $sp,      $sp,        4
  lw           $t5,    ($sp)
  addiu        $sp,      $sp,        4
  lw           $t4,    ($sp)
  addiu        $sp,      $sp,        4
  lw           $t3,    ($sp)
  addiu        $sp,      $sp,        4
  lw           $t2,    ($sp)
  addiu        $sp,      $sp,        4
  lw           $t1,    ($sp)
  addiu        $sp,      $sp,        4
  lw           $t0,    ($sp)
  .end_macro

  .macro SAVE_SPILL_MEM
  # brace yourself for a long, unrolled loop...
  lw           $a3, SPILL_MEMORY
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 4
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 8
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 12
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 16
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 20
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 24
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 28
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 32
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 36
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 40
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 44
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 48
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 52
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 56
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  lw           $a3, SPILL_MEMORY + 60
  sw           $a3,    ($sp)
  subiu        $sp,      $sp,        4
  .end_macro

  .macro RESTORE_SPILL_MEM
  # brace yourself for a long, unrolled loop...
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 60
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 56
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 52
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 48
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 44
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 40
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 36
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 32
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 28
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 24
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 20
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 16
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 12
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 8
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY + 4
  addiu        $sp,      $sp,        4
  lw           $a3,    ($sp)
  sw           $a3, SPILL_MEMORY
  .end_macro

  .macro CALLEE_FUNCTION_PROLOGUE (%variable_size)
  # set $fp to the proper spot by recovering the value from $a0
  add          $fp,      $a0,    $zero
  # allocate stack space for variables ($sp = $sp - space for variables)
  li           $a0,        4
  mulu         $a1,      $a0, %variable_size
  sub          $sp,      $sp,      $a1
  .end_macro

  .macro CALLEE_FUNCTION_EPILOGUE
  # de-allocate the memory used for local variables and parameters
  add          $sp,      $fp,    $zero
  # jump back to the caller
  jr           $ra
  .end_macro

  .macro CALLER_FUNCTION_PROLOGUE
  # caller should save it's own $ra, $fp, and registers
  sw           $ra,    ($sp)
  subiu        $sp,      $sp,        4
  sw           $fp,    ($sp)
  subiu        $sp,      $sp,        4
  # caller pushes registers and spill memory onto the stack as well
  SAVE_T_REGISTERS()
  SAVE_SPILL_MEM()
  # save the value of $sp here into $a0 as temporary storage until the arguments are moved
  # $fp needs to stay where it's at while the arguments are copied after this macro
  add          $a0,      $sp,    $zero
  .end_macro

  .macro CALLER_FUNCTION_EPILOGUE
  # recover the spill memory and the stored registers
  RESTORE_SPILL_MEM()
  RESTORE_T_REGISTERS()
  # recover the caller's $fp and $ra
  addiu        $sp,      $sp,        4
  lw           $fp,    ($sp)
  addiu        $sp,      $sp,        4
  lw           $ra,    ($sp)
  .end_macro


  .data
  SPILL_MEMORY: .space 64

  .text
  add          $fp,      $sp,    $zero
  add          $a0,      $fp,    $zero
  jal         main
  j       PROG_END

  main:
  CALLEE_FUNCTION_PROLOGUE(5)
  la           $t0,    ($fp)
  li           $t1,       70
  sb           $t1,    ($t0)
  addi         $t0,      $t0,       -1
  li           $t1,      105
  sb           $t1,    ($t0)
  addi         $t0,      $t0,       -1
  li           $t1,      122
  sb           $t1,    ($t0)
  addi         $t0,      $t0,       -1
  li           $t1,      122
  sb           $t1,    ($t0)
  addi         $t0,      $t0,       -1
  li           $t1,        0
  sb           $t1,    ($t0)
  addi         $t0,      $t0,       -1
  la           $t0,  -8($fp)
  li           $t1,       66
  sb           $t1,    ($t0)
  addi         $t0,      $t0,       -1
  li           $t1,      117
  sb           $t1,    ($t0)
  addi         $t0,      $t0,       -1
  li           $t1,      122
  sb           $t1,    ($t0)
  addi         $t0,      $t0,       -1
  li           $t1,      122
  sb           $t1,    ($t0)
  addi         $t0,      $t0,       -1
  li           $t1,        0
  sb           $t1,    ($t0)
  addi         $t0,      $t0,       -1
  la           $t0, -16($fp)
  li           $t1,        0
  sw           $t1,    ($t0)
  la           $t0, -16($fp)
  li           $t1,        1
  sw           $t1,    ($t0)

  LOOP_CONDITION_00000:
  lw           $t1, -16($fp)
  li           $t0,       30
  sle          $t2,      $t1,      $t0
  bne          $t2,    $zero, LOOP_BODY_00000
  j       LOOP_EXIT_00000

  LOOP_BODY_00000:
  lw           $t0, -16($fp)
  li           $t1,        3
  DIV          $t0,$t1
  MFHI         $t3
  li           $t1,        0
  seq          $t0,      $t3,      $t1
  bne          $t0,    $zero, IF_TRUE_00000

  IF_FALSE_00000:
  lw           $t1, -16($fp)
  li           $t3,        5
  DIV          $t1,$t3
  MFHI         $t4
  li           $t3,        0
  seq          $t1,      $t4,      $t3
  bne          $t1,    $zero, IF_TRUE_00001

  IF_FALSE_00001:
  CALLER_FUNCTION_PROLOGUE()
  lw           $t3, -16($fp)
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t3,       10
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  j       ENDIF_00001

  IF_TRUE_00001:
  CALLER_FUNCTION_PROLOGUE()
  lw           $t3, -16($fp)
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t3,       58
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t3,       32
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  lb           $t3,  -8($fp)
  la           $t3,  -8($fp)
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  li           $t3,        5
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  li           $t3,        5
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_string
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t3,       10
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero

  ENDIF_00001:
  j       ENDIF_00000

  IF_TRUE_00000:
  lw           $t1, -16($fp)
  li           $t3,        5
  DIV          $t1,$t3
  MFHI         $t4
  li           $t3,        0
  seq          $t1,      $t4,      $t3
  bne          $t1,    $zero, IF_TRUE_00002

  IF_FALSE_00002:
  CALLER_FUNCTION_PROLOGUE()
  lw           $t3, -16($fp)
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t3,       58
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t3,       32
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  lb           $t3,    ($fp)
  la           $t3,    ($fp)
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  li           $t3,        5
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  li           $t3,        5
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_string
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t3,       10
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  j       ENDIF_00002

  IF_TRUE_00002:
  CALLER_FUNCTION_PROLOGUE()
  lw           $t3, -16($fp)
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t3,       58
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t3,       32
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  lb           $t3,    ($fp)
  la           $t3,    ($fp)
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  li           $t3,        5
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  li           $t3,        5
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_string
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  lb           $t3,  -8($fp)
  la           $t3,  -8($fp)
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  li           $t3,        5
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  li           $t3,        5
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_string
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t3,       10
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero

  ENDIF_00002:

  ENDIF_00000:
  la           $t0, -16($fp)
  lw           $t1,    ($t0)
  add          $t3,      $t1,    $zero
  addiu        $t1,      $t1,        1
  sw           $t1,    ($t0)
  j       LOOP_CONDITION_00000

  LOOP_EXIT_00000:
  li           $t3,        0
  add          $v0,      $t3,    $zero
  CALLEE_FUNCTION_EPILOGUE()
  CALLEE_FUNCTION_EPILOGUE()

  print_char:
  CALLEE_FUNCTION_PROLOGUE(0)
  # load $v0 with the value for the print char syscall
  li           $v0,       11
  # the first (and only) argument is the value to print
  lw           $a0,    ($fp)
  syscall
  CALLEE_FUNCTION_EPILOGUE()

  print_int:
  CALLEE_FUNCTION_PROLOGUE(0)
  # load $v0 with the value for the print int syscall
  li           $v0,        1
  # the first (and only) argument is the value to print
  lw           $a0,    ($fp)
  syscall
  CALLEE_FUNCTION_EPILOGUE()

  print_string:
  CALLEE_FUNCTION_PROLOGUE(0)
  # load $v0 with the value for the print string syscall
  li           $v0,       11
  # the first (and only) argument is the base address of the null terminated ascii string
  lw           $s0,    ($fp)
  lb           $a0,   0($s0)

  print_string_loop_start:
  beqz         $a0, print_string_loop_end
  syscall
  addi         $s0,      $s0,       -1
  lb           $a0,   0($s0)
  j       print_string_loop_start

  print_string_loop_end:
  CALLEE_FUNCTION_EPILOGUE()

  print_float:
  CALLEE_FUNCTION_PROLOGUE(0)
  # load $v0 with the value for the print float syscall
  li           $v0,        2
  # the first (and only) argument is the base address of the null terminated ascii string
  lwc1        $f12,    ($fp)
  syscall
  CALLEE_FUNCTION_EPILOGUE()

  PROG_END:
  add          $a0,      $v0,    $zero
  li           $v0,       17
  syscall

Output

1
2
3: Fizz
4
5: Buzz
6: Fizz
7
8
9: Fizz
10: Buzz
11
12: Fizz
13
14
15: FizzBuzz
16
17
18: Fizz
19
20: Buzz
21: Fizz
22
23
24: Fizz
25: Buzz
26
27: Fizz
28
29
30: FizzBuzz

3AC (Three-Address Code)


  .data
  .text
  JAL            , main           , -              , -
  BR             , PROG_END       , -              , -
  main:
  PROCENTRY      , 20             , -              , -
  LA             , ireg_00000     , ($FP)          , -
  LI             , ireg_00001     , 70             , -
  STORE          , ireg_00001     , (ireg_00000)   , 1
  KICK           , ireg_00001     , -              , -
  ADDI           , ireg_00000     , ireg_00000     , -1
  LI             , ireg_00002     , 105            , -
  STORE          , ireg_00002     , (ireg_00000)   , 1
  KICK           , ireg_00002     , -              , -
  ADDI           , ireg_00000     , ireg_00000     , -1
  LI             , ireg_00003     , 122            , -
  STORE          , ireg_00003     , (ireg_00000)   , 1
  KICK           , ireg_00003     , -              , -
  ADDI           , ireg_00000     , ireg_00000     , -1
  LI             , ireg_00004     , 122            , -
  STORE          , ireg_00004     , (ireg_00000)   , 1
  KICK           , ireg_00004     , -              , -
  ADDI           , ireg_00000     , ireg_00000     , -1
  LI             , ireg_00005     , 0              , -
  STORE          , ireg_00005     , (ireg_00000)   , 1
  KICK           , ireg_00005     , -              , -
  ADDI           , ireg_00000     , ireg_00000     , -1
  KICK           , ireg_00000     , -              , -
  LA             , ireg_00006     , -8($FP)        , -
  LI             , ireg_00007     , 66             , -
  STORE          , ireg_00007     , (ireg_00006)   , 1
  KICK           , ireg_00007     , -              , -
  ADDI           , ireg_00006     , ireg_00006     , -1
  LI             , ireg_00008     , 117            , -
  STORE          , ireg_00008     , (ireg_00006)   , 1
  KICK           , ireg_00008     , -              , -
  ADDI           , ireg_00006     , ireg_00006     , -1
  LI             , ireg_00009     , 122            , -
  STORE          , ireg_00009     , (ireg_00006)   , 1
  KICK           , ireg_00009     , -              , -
  ADDI           , ireg_00006     , ireg_00006     , -1
  LI             , ireg_00010     , 122            , -
  STORE          , ireg_00010     , (ireg_00006)   , 1
  KICK           , ireg_00010     , -              , -
  ADDI           , ireg_00006     , ireg_00006     , -1
  LI             , ireg_00011     , 0              , -
  STORE          , ireg_00011     , (ireg_00006)   , 1
  KICK           , ireg_00011     , -              , -
  ADDI           , ireg_00006     , ireg_00006     , -1
  KICK           , ireg_00006     , -              , -
  LA             , ireg_00012     , -16($FP)       , -
  LI             , ireg_00013     , 0              , -
  STORE          , ireg_00013     , (ireg_00012)   , 4
  KICK           , ireg_00013     , -              , -
  KICK           , ireg_00012     , -              , -
  LA             , ireg_00014     , -16($FP)       , -
  LI             , ireg_00015     , 1              , -
  STORE          , ireg_00015     , (ireg_00014)   , 4
  KICK           , ireg_00014     , -              , -
  KICK           , ireg_00015     , -              , -
  LOOP_CONDITION_00000:
  LOAD           , ireg_00016     , -16($FP)       , 4
  LI             , ireg_00017     , 30             , -
  LE             , ireg_00018     , ireg_00016     , ireg_00017
  KICK           , ireg_00016     , -              , -
  KICK           , ireg_00017     , -              , -
  BRNE           , LOOP_BODY_00000, ireg_00018     , $ZERO
  BR             , LOOP_EXIT_00000, -              , -
  LOOP_BODY_00000:
  LOAD           , ireg_00019     , -16($FP)       , 4
  LI             , ireg_00020     , 3              , -
  MOD            , ireg_00021     , ireg_00019     , ireg_00020
  KICK           , ireg_00019     , -              , -
  KICK           , ireg_00020     , -              , -
  LI             , ireg_00022     , 0              , -
  EQ             , ireg_00023     , ireg_00021     , ireg_00022
  KICK           , ireg_00021     , -              , -
  KICK           , ireg_00022     , -              , -
  BRNE           , IF_TRUE_00000  , ireg_00023     , $ZERO
  IF_FALSE_00000:
  LOAD           , ireg_00024     , -16($FP)       , 4
  LI             , ireg_00025     , 5              , -
  MOD            , ireg_00026     , ireg_00024     , ireg_00025
  KICK           , ireg_00024     , -              , -
  KICK           , ireg_00025     , -              , -
  LI             , ireg_00027     , 0              , -
  EQ             , ireg_00028     , ireg_00026     , ireg_00027
  KICK           , ireg_00026     , -              , -
  KICK           , ireg_00027     , -              , -
  BRNE           , IF_TRUE_00001  , ireg_00028     , $ZERO
  IF_FALSE_00001:
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00030     , -16($FP)       , 4
  STORE          , ireg_00030     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00030     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00029     , $RV            , $ZERO
  KICK           , ireg_00029     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00032     , 10             , -
  STORE          , ireg_00032     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00032     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00031     , $RV            , $ZERO
  KICK           , ireg_00031     , -              , -
  BR             , ENDIF_00001    , -              , -
  IF_TRUE_00001:
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00034     , -16($FP)       , 4
  STORE          , ireg_00034     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00034     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00033     , $RV            , $ZERO
  KICK           , ireg_00033     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00036     , 58             , -
  STORE          , ireg_00036     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00036     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00035     , $RV            , $ZERO
  KICK           , ireg_00035     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00038     , 32             , -
  STORE          , ireg_00038     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00038     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00037     , $RV            , $ZERO
  KICK           , ireg_00037     , -              , -
  CALL_PROC      , print_string   , 0              , -
  LOAD           , ireg_00040     , -8($FP)        , 1
  KICK           , ireg_00040     , -              , -
  LA             , ireg_00041     , -8($FP)        , -
  STORE          , ireg_00041     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  LI             , ireg_00041     , 5              , -
  STORE          , ireg_00041     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  LI             , ireg_00041     , 5              , -
  STORE          , ireg_00041     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00041     , -              , -
  JAL            , print_string   , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00039     , $RV            , $ZERO
  KICK           , ireg_00039     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00043     , 10             , -
  STORE          , ireg_00043     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00043     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00042     , $RV            , $ZERO
  KICK           , ireg_00042     , -              , -
  ENDIF_00001:
  KICK           , ireg_00028     , -              , -
  BR             , ENDIF_00000    , -              , -
  IF_TRUE_00000:
  LOAD           , ireg_00044     , -16($FP)       , 4
  LI             , ireg_00045     , 5              , -
  MOD            , ireg_00046     , ireg_00044     , ireg_00045
  KICK           , ireg_00044     , -              , -
  KICK           , ireg_00045     , -              , -
  LI             , ireg_00047     , 0              , -
  EQ             , ireg_00048     , ireg_00046     , ireg_00047
  KICK           , ireg_00046     , -              , -
  KICK           , ireg_00047     , -              , -
  BRNE           , IF_TRUE_00002  , ireg_00048     , $ZERO
  IF_FALSE_00002:
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00050     , -16($FP)       , 4
  STORE          , ireg_00050     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00050     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00049     , $RV            , $ZERO
  KICK           , ireg_00049     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00052     , 58             , -
  STORE          , ireg_00052     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00052     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00051     , $RV            , $ZERO
  KICK           , ireg_00051     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00054     , 32             , -
  STORE          , ireg_00054     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00054     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00053     , $RV            , $ZERO
  KICK           , ireg_00053     , -              , -
  CALL_PROC      , print_string   , 0              , -
  LOAD           , ireg_00056     , ($FP)          , 1
  KICK           , ireg_00056     , -              , -
  LA             , ireg_00057     , ($FP)          , -
  STORE          , ireg_00057     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  LI             , ireg_00057     , 5              , -
  STORE          , ireg_00057     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  LI             , ireg_00057     , 5              , -
  STORE          , ireg_00057     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00057     , -              , -
  JAL            , print_string   , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00055     , $RV            , $ZERO
  KICK           , ireg_00055     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00059     , 10             , -
  STORE          , ireg_00059     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00059     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00058     , $RV            , $ZERO
  KICK           , ireg_00058     , -              , -
  BR             , ENDIF_00002    , -              , -
  IF_TRUE_00002:
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00061     , -16($FP)       , 4
  STORE          , ireg_00061     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00061     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00060     , $RV            , $ZERO
  KICK           , ireg_00060     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00063     , 58             , -
  STORE          , ireg_00063     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00063     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00062     , $RV            , $ZERO
  KICK           , ireg_00062     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00065     , 32             , -
  STORE          , ireg_00065     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00065     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00064     , $RV            , $ZERO
  KICK           , ireg_00064     , -              , -
  CALL_PROC      , print_string   , 0              , -
  LOAD           , ireg_00067     , ($FP)          , 1
  KICK           , ireg_00067     , -              , -
  LA             , ireg_00068     , ($FP)          , -
  STORE          , ireg_00068     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  LI             , ireg_00068     , 5              , -
  STORE          , ireg_00068     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  LI             , ireg_00068     , 5              , -
  STORE          , ireg_00068     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00068     , -              , -
  JAL            , print_string   , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00066     , $RV            , $ZERO
  KICK           , ireg_00066     , -              , -
  CALL_PROC      , print_string   , 0              , -
  LOAD           , ireg_00070     , -8($FP)        , 1
  KICK           , ireg_00070     , -              , -
  LA             , ireg_00071     , -8($FP)        , -
  STORE          , ireg_00071     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  LI             , ireg_00071     , 5              , -
  STORE          , ireg_00071     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  LI             , ireg_00071     , 5              , -
  STORE          , ireg_00071     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00071     , -              , -
  JAL            , print_string   , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00069     , $RV            , $ZERO
  KICK           , ireg_00069     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00073     , 10             , -
  STORE          , ireg_00073     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00073     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00072     , $RV            , $ZERO
  KICK           , ireg_00072     , -              , -
  ENDIF_00002:
  KICK           , ireg_00048     , -              , -
  ENDIF_00000:
  KICK           , ireg_00023     , -              , -
  LA             , ireg_00074     , -16($FP)       , -
  LOAD           , ireg_00075     , (ireg_00074)   , 4
  ADD            , ireg_00076     , ireg_00075     , $ZERO
  ADDIU          , ireg_00075     , ireg_00075     , 1
  STORE          , ireg_00075     , (ireg_00074)   , 4
  KICK           , ireg_00074     , -              , -
  KICK           , ireg_00075     , -              , -
  KICK           , ireg_00076     , -              , -
  BR             , LOOP_CONDITION_00000, -              , -
  LOOP_EXIT_00000:
  LI             , ireg_00077     , 0              , -
  RETURN         , ireg_00077     , -              , -
  ENDPROC        , -              , -              , -
  PROG_END: