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

Binary Operations

Input

int main() {

  int i = 0;
  int j = 0;
  int k = 0;

  i = i + 10; print_int(i); print_char('\n'); // prints 10
  i = i - 2;  print_int(i); print_char('\n'); // prints 8
  i = i * 2;  print_int(i); print_char('\n'); // prints 16
  i = i / 4;  print_int(i); print_char('\n'); // prints 4
  i = i % 3;  print_int(i); print_char('\n'); // prints 1
  print_char('\n');

  j = i++;
  // prints 1 and 2
  print_int(j); print_char(' '); print_int(i); print_char('\n');

  j = ++i;
  // prints 3 and 3
  print_int(j); print_char(' '); print_int(i); print_char('\n');
  print_char('\n');

  j = i--;
  // prints 3 and 2
  print_int(j); print_char(' '); print_int(i); print_char('\n');

  j = --i;
  // prints 1 and 1
  print_int(j); print_char(' '); print_int(i); print_char('\n');
  print_char('\n');

  j += i;
  // prints 2
  print_int(j); print_char('\n');

  j -= i;
  // prints 1
  print_int(j); print_char('\n');
  print_char('\n');

  k = i = j;
  // prints 1 1 1
  print_int(k); print_char(' '); print_int(i); print_char(' '); print_int(j);
  print_char('\n');
  print_char('\n');

  i = i && 0;
  print_int(i); print_char('\n'); // prints 0

  i = 1 && 1;
  print_int(i); print_char('\n'); // prints 1
  print_char('\n');

  j = i || 5;
  print_int(j); print_char('\n'); // prints 1

  j = 0 || 1;
  print_int(j); print_char('\n'); // prints 1

  j = 0 ^ 1;
  print_int(j); print_char('\n'); // prints 1

  j = 3 & 2;
  print_int(j); print_char('\n'); // prints 2

  j = 2 | 1;
  print_int(j); print_char('\n'); // prints 3

  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

  .macro __LAND (%lhs, %rhs)
  beqz        %lhs, __LAND_FALSE
  beqz        %rhs, __LAND_FALSE
  li           $a2,        1
  j       __LAND_END

  __LAND_FALSE:
  li           $a2,        0

  __LAND_END:
  .end_macro

  .macro __LOR (%lhs, %rhs)
  beqz        %lhs, __LOR_TRUE
  beqz        %rhs, __LOR_TRUE
  li           $a2,        0
  j       __LOR_END

  __LOR_TRUE:
  li           $a2,        1

  __LOR_END:
  .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(3)
  la           $t0,    ($fp)
  li           $t1,        0
  sw           $t1,    ($t0)
  la           $t0,  -4($fp)
  li           $t1,        0
  sw           $t1,    ($t0)
  la           $t0,  -8($fp)
  li           $t1,        0
  sw           $t1,    ($t0)
  la           $t0,    ($fp)
  lw           $t1,    ($fp)
  li           $t2,       10
  add          $t3,      $t1,      $t2
  sw           $t3,    ($t0)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t3,    ($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
  la           $t3,    ($fp)
  lw           $t0,    ($fp)
  li           $t2,        2
  sub          $t1,      $t0,      $t2
  sw           $t1,    ($t3)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t1,    ($fp)
  sw           $t1,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t1,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t1,       10
  sw           $t1,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t1,      $v0,    $zero
  la           $t1,    ($fp)
  lw           $t3,    ($fp)
  li           $t2,        2
  mul          $t0,      $t3,      $t2
  sw           $t0,    ($t1)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t0,    ($fp)
  sw           $t0,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t0,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t0,       10
  sw           $t0,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t0,      $v0,    $zero
  la           $t0,    ($fp)
  lw           $t1,    ($fp)
  li           $t2,        4
  div          $t1,      $t2
  MFLO         $t3
  sw           $t3,    ($t0)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t3,    ($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
  la           $t3,    ($fp)
  lw           $t0,    ($fp)
  li           $t2,        3
  DIV          $t0,$t2
  MFHI         $t1
  sw           $t1,    ($t3)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t1,    ($fp)
  sw           $t1,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t1,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t1,       10
  sw           $t1,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t1,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t1,       10
  sw           $t1,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t1,      $v0,    $zero
  la           $t1,  -4($fp)
  la           $t3,    ($fp)
  lw           $t2,    ($t3)
  add          $t0,      $t2,    $zero
  addiu        $t2,      $t2,        1
  sw           $t2,    ($t3)
  sw           $t0,    ($t1)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t0,  -4($fp)
  sw           $t0,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t0,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t0,       32
  sw           $t0,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t0,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  lw           $t0,    ($fp)
  sw           $t0,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t0,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t0,       10
  sw           $t0,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t0,      $v0,    $zero
  la           $t0,  -4($fp)
  la           $t1,    ($fp)
  lw           $t2,    ($t1)
  addiu        $t2,      $t2,        1
  sw           $t2,    ($t1)
  sw           $t2,    ($t0)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t2,  -4($fp)
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t2,       32
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  lw           $t2,    ($fp)
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t2,       10
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t2,       10
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  la           $t2,  -4($fp)
  la           $t0,    ($fp)
  lw           $t1,    ($t0)
  add          $t3,      $t1,    $zero
  sub          $t1,      $t1,        1
  sw           $t1,    ($t0)
  sw           $t3,    ($t2)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t3,  -4($fp)
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  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()
  lw           $t3,    ($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
  la           $t3,  -4($fp)
  la           $t2,    ($fp)
  lw           $t1,    ($t2)
  sub          $t1,      $t1,        1
  sw           $t1,    ($t2)
  sw           $t1,    ($t3)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t1,  -4($fp)
  sw           $t1,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t1,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t1,       32
  sw           $t1,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t1,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  lw           $t1,    ($fp)
  sw           $t1,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t1,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t1,       10
  sw           $t1,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t1,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t1,       10
  sw           $t1,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t1,      $v0,    $zero
  la           $t1,  -4($fp)
  lw           $t3,  -4($fp)
  lw           $t2,    ($fp)
  add          $t0,      $t3,      $t2
  sw           $t0,    ($t1)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t0,  -4($fp)
  sw           $t0,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t0,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t0,       10
  sw           $t0,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t0,      $v0,    $zero
  la           $t0,  -4($fp)
  lw           $t1,  -4($fp)
  lw           $t2,    ($fp)
  sub          $t3,      $t1,      $t2
  sw           $t3,    ($t0)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t3,  -4($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
  CALLER_FUNCTION_PROLOGUE()
  li           $t3,       10
  sw           $t3,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t3,      $v0,    $zero
  la           $t3,  -8($fp)
  la           $t0,    ($fp)
  lw           $t2,  -4($fp)
  sw           $t2,    ($t0)
  sw           $t2,    ($t3)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t2,  -8($fp)
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t2,       32
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  lw           $t2,    ($fp)
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t2,       32
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  lw           $t2,  -4($fp)
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t2,       10
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t2,       10
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  la           $t2,    ($fp)
  lw           $t3,    ($fp)
  li           $t0,        0
  and          $t1,      $t3,      $t0
  sne          $t1,      $t1,    $zero
  sw           $t1,    ($t2)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t1,    ($fp)
  sw           $t1,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t1,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t1,       10
  sw           $t1,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t1,      $v0,    $zero
  la           $t1,    ($fp)
  li           $t2,        1
  sw           $t2,    ($t1)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t2,    ($fp)
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t2,       10
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t2,       10
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  la           $t2,  -4($fp)
  lw           $t1,    ($fp)
  li           $t0,        5
  or           $t3,      $t1,      $t0
  sne          $t3,      $t3,    $zero
  sw           $t3,    ($t2)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t3,  -4($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
  la           $t3,  -4($fp)
  li           $t2,        1
  sw           $t2,    ($t3)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t2,  -4($fp)
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t2,       10
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  la           $t2,  -4($fp)
  li           $t3,        1
  sw           $t3,    ($t2)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t3,  -4($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
  la           $t3,  -4($fp)
  li           $t2,        2
  sw           $t2,    ($t3)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t2,  -4($fp)
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_int
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  CALLER_FUNCTION_PROLOGUE()
  li           $t2,       10
  sw           $t2,    ($sp)
  sub          $sp,      $sp,        4
  jal     print_char
  CALLER_FUNCTION_EPILOGUE()
  add          $t2,      $v0,    $zero
  la           $t2,  -4($fp)
  li           $t3,        3
  sw           $t3,    ($t2)
  CALLER_FUNCTION_PROLOGUE()
  lw           $t3,  -4($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
  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,        4
  # the first (and only) argument is the base address of the null terminated ascii string
  la           $a0,    ($fp)
  syscall
  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

10
8
16
4
1

1 2
3 3

3 2
1 1

2
1

1 1 1

0
1

1
1
1
2
3

3AC (Three-Address Code)


  .data
  .text
  JAL            , main           , -              , -
  BR             , PROG_END       , -              , -
  main:
  PROCENTRY      , 12             , -              , -
  LA             , ireg_00000     , ($FP)          , -
  LI             , ireg_00001     , 0              , -
  STORE          , ireg_00001     , (ireg_00000)   , 4
  KICK           , ireg_00001     , -              , -
  KICK           , ireg_00000     , -              , -
  LA             , ireg_00002     , -4($FP)        , -
  LI             , ireg_00003     , 0              , -
  STORE          , ireg_00003     , (ireg_00002)   , 4
  KICK           , ireg_00003     , -              , -
  KICK           , ireg_00002     , -              , -
  LA             , ireg_00004     , -8($FP)        , -
  LI             , ireg_00005     , 0              , -
  STORE          , ireg_00005     , (ireg_00004)   , 4
  KICK           , ireg_00005     , -              , -
  KICK           , ireg_00004     , -              , -
  LA             , ireg_00006     , ($FP)          , -
  LOAD           , ireg_00007     , ($FP)          , 4
  LI             , ireg_00008     , 10             , -
  ADD            , ireg_00009     , ireg_00007     , ireg_00008
  KICK           , ireg_00007     , -              , -
  KICK           , ireg_00008     , -              , -
  STORE          , ireg_00009     , (ireg_00006)   , 4
  KICK           , ireg_00006     , -              , -
  KICK           , ireg_00009     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00011     , ($FP)          , 4
  STORE          , ireg_00011     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00011     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00010     , $RV            , $ZERO
  KICK           , ireg_00010     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00013     , 10             , -
  STORE          , ireg_00013     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00013     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00012     , $RV            , $ZERO
  KICK           , ireg_00012     , -              , -
  LA             , ireg_00014     , ($FP)          , -
  LOAD           , ireg_00015     , ($FP)          , 4
  LI             , ireg_00016     , 2              , -
  SUB            , ireg_00017     , ireg_00015     , ireg_00016
  KICK           , ireg_00015     , -              , -
  KICK           , ireg_00016     , -              , -
  STORE          , ireg_00017     , (ireg_00014)   , 4
  KICK           , ireg_00014     , -              , -
  KICK           , ireg_00017     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00019     , ($FP)          , 4
  STORE          , ireg_00019     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00019     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00018     , $RV            , $ZERO
  KICK           , ireg_00018     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00021     , 10             , -
  STORE          , ireg_00021     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00021     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00020     , $RV            , $ZERO
  KICK           , ireg_00020     , -              , -
  LA             , ireg_00022     , ($FP)          , -
  LOAD           , ireg_00023     , ($FP)          , 4
  LI             , ireg_00024     , 2              , -
  MUL            , ireg_00025     , ireg_00023     , ireg_00024
  KICK           , ireg_00023     , -              , -
  KICK           , ireg_00024     , -              , -
  STORE          , ireg_00025     , (ireg_00022)   , 4
  KICK           , ireg_00022     , -              , -
  KICK           , ireg_00025     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00027     , ($FP)          , 4
  STORE          , ireg_00027     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00027     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00026     , $RV            , $ZERO
  KICK           , ireg_00026     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00029     , 10             , -
  STORE          , ireg_00029     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00029     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00028     , $RV            , $ZERO
  KICK           , ireg_00028     , -              , -
  LA             , ireg_00030     , ($FP)          , -
  LOAD           , ireg_00031     , ($FP)          , 4
  LI             , ireg_00032     , 4              , -
  DIV            , ireg_00033     , ireg_00031     , ireg_00032
  KICK           , ireg_00031     , -              , -
  KICK           , ireg_00032     , -              , -
  STORE          , ireg_00033     , (ireg_00030)   , 4
  KICK           , ireg_00030     , -              , -
  KICK           , ireg_00033     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00035     , ($FP)          , 4
  STORE          , ireg_00035     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00035     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00034     , $RV            , $ZERO
  KICK           , ireg_00034     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00037     , 10             , -
  STORE          , ireg_00037     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00037     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00036     , $RV            , $ZERO
  KICK           , ireg_00036     , -              , -
  LA             , ireg_00038     , ($FP)          , -
  LOAD           , ireg_00039     , ($FP)          , 4
  LI             , ireg_00040     , 3              , -
  MOD            , ireg_00041     , ireg_00039     , ireg_00040
  KICK           , ireg_00039     , -              , -
  KICK           , ireg_00040     , -              , -
  STORE          , ireg_00041     , (ireg_00038)   , 4
  KICK           , ireg_00038     , -              , -
  KICK           , ireg_00041     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00043     , ($FP)          , 4
  STORE          , ireg_00043     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00043     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00042     , $RV            , $ZERO
  KICK           , ireg_00042     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00045     , 10             , -
  STORE          , ireg_00045     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00045     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00044     , $RV            , $ZERO
  KICK           , ireg_00044     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00047     , 10             , -
  STORE          , ireg_00047     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00047     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00046     , $RV            , $ZERO
  KICK           , ireg_00046     , -              , -
  LA             , ireg_00048     , -4($FP)        , -
  LA             , ireg_00049     , ($FP)          , -
  LOAD           , ireg_00050     , (ireg_00049)   , 4
  ADD            , ireg_00051     , ireg_00050     , $ZERO
  ADDIU          , ireg_00050     , ireg_00050     , 1
  STORE          , ireg_00050     , (ireg_00049)   , 4
  KICK           , ireg_00049     , -              , -
  KICK           , ireg_00050     , -              , -
  STORE          , ireg_00051     , (ireg_00048)   , 4
  KICK           , ireg_00048     , -              , -
  KICK           , ireg_00051     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00053     , -4($FP)        , 4
  STORE          , ireg_00053     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00053     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00052     , $RV            , $ZERO
  KICK           , ireg_00052     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00055     , 32             , -
  STORE          , ireg_00055     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00055     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00054     , $RV            , $ZERO
  KICK           , ireg_00054     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00057     , ($FP)          , 4
  STORE          , ireg_00057     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00057     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00056     , $RV            , $ZERO
  KICK           , ireg_00056     , -              , -
  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     , -              , -
  LA             , ireg_00060     , -4($FP)        , -
  LA             , ireg_00061     , ($FP)          , -
  LOAD           , ireg_00062     , (ireg_00061)   , 4
  ADDIU          , ireg_00062     , ireg_00062     , 1
  STORE          , ireg_00062     , (ireg_00061)   , 4
  KICK           , ireg_00061     , -              , -
  STORE          , ireg_00062     , (ireg_00060)   , 4
  KICK           , ireg_00060     , -              , -
  KICK           , ireg_00062     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00064     , -4($FP)        , 4
  STORE          , ireg_00064     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00064     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00063     , $RV            , $ZERO
  KICK           , ireg_00063     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00066     , 32             , -
  STORE          , ireg_00066     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00066     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00065     , $RV            , $ZERO
  KICK           , ireg_00065     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00068     , ($FP)          , 4
  STORE          , ireg_00068     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00068     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00067     , $RV            , $ZERO
  KICK           , ireg_00067     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00070     , 10             , -
  STORE          , ireg_00070     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00070     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00069     , $RV            , $ZERO
  KICK           , ireg_00069     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00072     , 10             , -
  STORE          , ireg_00072     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00072     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00071     , $RV            , $ZERO
  KICK           , ireg_00071     , -              , -
  LA             , ireg_00073     , -4($FP)        , -
  LA             , ireg_00074     , ($FP)          , -
  LOAD           , ireg_00075     , (ireg_00074)   , 4
  ADD            , ireg_00076     , ireg_00075     , $ZERO
  SUBI           , ireg_00075     , ireg_00075     , 1
  STORE          , ireg_00075     , (ireg_00074)   , 4
  KICK           , ireg_00074     , -              , -
  KICK           , ireg_00075     , -              , -
  STORE          , ireg_00076     , (ireg_00073)   , 4
  KICK           , ireg_00073     , -              , -
  KICK           , ireg_00076     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00078     , -4($FP)        , 4
  STORE          , ireg_00078     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00078     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00077     , $RV            , $ZERO
  KICK           , ireg_00077     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00080     , 32             , -
  STORE          , ireg_00080     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00080     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00079     , $RV            , $ZERO
  KICK           , ireg_00079     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00082     , ($FP)          , 4
  STORE          , ireg_00082     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00082     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00081     , $RV            , $ZERO
  KICK           , ireg_00081     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00084     , 10             , -
  STORE          , ireg_00084     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00084     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00083     , $RV            , $ZERO
  KICK           , ireg_00083     , -              , -
  LA             , ireg_00085     , -4($FP)        , -
  LA             , ireg_00086     , ($FP)          , -
  LOAD           , ireg_00087     , (ireg_00086)   , 4
  SUBI           , ireg_00087     , ireg_00087     , 1
  STORE          , ireg_00087     , (ireg_00086)   , 4
  KICK           , ireg_00086     , -              , -
  STORE          , ireg_00087     , (ireg_00085)   , 4
  KICK           , ireg_00085     , -              , -
  KICK           , ireg_00087     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00089     , -4($FP)        , 4
  STORE          , ireg_00089     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00089     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00088     , $RV            , $ZERO
  KICK           , ireg_00088     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00091     , 32             , -
  STORE          , ireg_00091     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00091     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00090     , $RV            , $ZERO
  KICK           , ireg_00090     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00093     , ($FP)          , 4
  STORE          , ireg_00093     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00093     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00092     , $RV            , $ZERO
  KICK           , ireg_00092     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00095     , 10             , -
  STORE          , ireg_00095     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00095     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00094     , $RV            , $ZERO
  KICK           , ireg_00094     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00097     , 10             , -
  STORE          , ireg_00097     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00097     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00096     , $RV            , $ZERO
  KICK           , ireg_00096     , -              , -
  LA             , ireg_00098     , -4($FP)        , -
  LOAD           , ireg_00099     , -4($FP)        , 4
  LOAD           , ireg_00100     , ($FP)          , 4
  ADD            , ireg_00101     , ireg_00099     , ireg_00100
  KICK           , ireg_00099     , -              , -
  KICK           , ireg_00100     , -              , -
  STORE          , ireg_00101     , (ireg_00098)   , 4
  KICK           , ireg_00098     , -              , -
  KICK           , ireg_00101     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00103     , -4($FP)        , 4
  STORE          , ireg_00103     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00103     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00102     , $RV            , $ZERO
  KICK           , ireg_00102     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00105     , 10             , -
  STORE          , ireg_00105     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00105     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00104     , $RV            , $ZERO
  KICK           , ireg_00104     , -              , -
  LA             , ireg_00106     , -4($FP)        , -
  LOAD           , ireg_00107     , -4($FP)        , 4
  LOAD           , ireg_00108     , ($FP)          , 4
  SUB            , ireg_00109     , ireg_00107     , ireg_00108
  KICK           , ireg_00107     , -              , -
  KICK           , ireg_00108     , -              , -
  STORE          , ireg_00109     , (ireg_00106)   , 4
  KICK           , ireg_00106     , -              , -
  KICK           , ireg_00109     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00111     , -4($FP)        , 4
  STORE          , ireg_00111     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00111     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00110     , $RV            , $ZERO
  KICK           , ireg_00110     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00113     , 10             , -
  STORE          , ireg_00113     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00113     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00112     , $RV            , $ZERO
  KICK           , ireg_00112     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00115     , 10             , -
  STORE          , ireg_00115     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00115     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00114     , $RV            , $ZERO
  KICK           , ireg_00114     , -              , -
  LA             , ireg_00116     , -8($FP)        , -
  LA             , ireg_00117     , ($FP)          , -
  LOAD           , ireg_00118     , -4($FP)        , 4
  STORE          , ireg_00118     , (ireg_00117)   , 4
  KICK           , ireg_00117     , -              , -
  STORE          , ireg_00118     , (ireg_00116)   , 4
  KICK           , ireg_00116     , -              , -
  KICK           , ireg_00118     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00120     , -8($FP)        , 4
  STORE          , ireg_00120     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00120     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00119     , $RV            , $ZERO
  KICK           , ireg_00119     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00122     , 32             , -
  STORE          , ireg_00122     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00122     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00121     , $RV            , $ZERO
  KICK           , ireg_00121     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00124     , ($FP)          , 4
  STORE          , ireg_00124     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00124     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00123     , $RV            , $ZERO
  KICK           , ireg_00123     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00126     , 32             , -
  STORE          , ireg_00126     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00126     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00125     , $RV            , $ZERO
  KICK           , ireg_00125     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00128     , -4($FP)        , 4
  STORE          , ireg_00128     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00128     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00127     , $RV            , $ZERO
  KICK           , ireg_00127     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00130     , 10             , -
  STORE          , ireg_00130     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00130     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00129     , $RV            , $ZERO
  KICK           , ireg_00129     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00132     , 10             , -
  STORE          , ireg_00132     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00132     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00131     , $RV            , $ZERO
  KICK           , ireg_00131     , -              , -
  LA             , ireg_00133     , ($FP)          , -
  LOAD           , ireg_00134     , ($FP)          , 4
  LI             , ireg_00135     , 0              , -
  AND            , ireg_00136     , ireg_00134     , ireg_00135
  SNE            , ireg_00136     , ireg_00136     , $ZERO
  KICK           , ireg_00134     , -              , -
  KICK           , ireg_00135     , -              , -
  STORE          , ireg_00136     , (ireg_00133)   , 4
  KICK           , ireg_00133     , -              , -
  KICK           , ireg_00136     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00138     , ($FP)          , 4
  STORE          , ireg_00138     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00138     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00137     , $RV            , $ZERO
  KICK           , ireg_00137     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00140     , 10             , -
  STORE          , ireg_00140     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00140     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00139     , $RV            , $ZERO
  KICK           , ireg_00139     , -              , -
  LA             , ireg_00141     , ($FP)          , -
  LI             , ireg_00142     , 1              , -
  STORE          , ireg_00142     , (ireg_00141)   , 4
  KICK           , ireg_00141     , -              , -
  KICK           , ireg_00142     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00144     , ($FP)          , 4
  STORE          , ireg_00144     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00144     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00143     , $RV            , $ZERO
  KICK           , ireg_00143     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00146     , 10             , -
  STORE          , ireg_00146     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00146     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00145     , $RV            , $ZERO
  KICK           , ireg_00145     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00148     , 10             , -
  STORE          , ireg_00148     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00148     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00147     , $RV            , $ZERO
  KICK           , ireg_00147     , -              , -
  LA             , ireg_00149     , -4($FP)        , -
  LOAD           , ireg_00150     , ($FP)          , 4
  LI             , ireg_00151     , 5              , -
  OR             , ireg_00152     , ireg_00150     , ireg_00151
  SNE            , ireg_00152     , ireg_00152     , $ZERO
  KICK           , ireg_00150     , -              , -
  KICK           , ireg_00151     , -              , -
  STORE          , ireg_00152     , (ireg_00149)   , 4
  KICK           , ireg_00149     , -              , -
  KICK           , ireg_00152     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00154     , -4($FP)        , 4
  STORE          , ireg_00154     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00154     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00153     , $RV            , $ZERO
  KICK           , ireg_00153     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00156     , 10             , -
  STORE          , ireg_00156     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00156     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00155     , $RV            , $ZERO
  KICK           , ireg_00155     , -              , -
  LA             , ireg_00157     , -4($FP)        , -
  LI             , ireg_00158     , 1              , -
  STORE          , ireg_00158     , (ireg_00157)   , 4
  KICK           , ireg_00157     , -              , -
  KICK           , ireg_00158     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00160     , -4($FP)        , 4
  STORE          , ireg_00160     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00160     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00159     , $RV            , $ZERO
  KICK           , ireg_00159     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00162     , 10             , -
  STORE          , ireg_00162     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00162     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00161     , $RV            , $ZERO
  KICK           , ireg_00161     , -              , -
  LA             , ireg_00163     , -4($FP)        , -
  LI             , ireg_00164     , 1              , -
  STORE          , ireg_00164     , (ireg_00163)   , 4
  KICK           , ireg_00163     , -              , -
  KICK           , ireg_00164     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00166     , -4($FP)        , 4
  STORE          , ireg_00166     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00166     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00165     , $RV            , $ZERO
  KICK           , ireg_00165     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00168     , 10             , -
  STORE          , ireg_00168     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00168     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00167     , $RV            , $ZERO
  KICK           , ireg_00167     , -              , -
  LA             , ireg_00169     , -4($FP)        , -
  LI             , ireg_00170     , 2              , -
  STORE          , ireg_00170     , (ireg_00169)   , 4
  KICK           , ireg_00169     , -              , -
  KICK           , ireg_00170     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00172     , -4($FP)        , 4
  STORE          , ireg_00172     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00172     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00171     , $RV            , $ZERO
  KICK           , ireg_00171     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00174     , 10             , -
  STORE          , ireg_00174     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00174     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00173     , $RV            , $ZERO
  KICK           , ireg_00173     , -              , -
  LA             , ireg_00175     , -4($FP)        , -
  LI             , ireg_00176     , 3              , -
  STORE          , ireg_00176     , (ireg_00175)   , 4
  KICK           , ireg_00175     , -              , -
  KICK           , ireg_00176     , -              , -
  CALL_PROC      , print_int      , 0              , -
  LOAD           , ireg_00178     , -4($FP)        , 4
  STORE          , ireg_00178     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00178     , -              , -
  JAL            , print_int      , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00177     , $RV            , $ZERO
  KICK           , ireg_00177     , -              , -
  CALL_PROC      , print_char     , 0              , -
  LI             , ireg_00180     , 10             , -
  STORE          , ireg_00180     , ($SP)          , 4
  SUB            , $SP            , $SP            , 4
  KICK           , ireg_00180     , -              , -
  JAL            , print_char     , -              , -
  END_PROC       , 0              , -              , -
  ADD            , ireg_00179     , $RV            , $ZERO
  KICK           , ireg_00179     , -              , -
  LI             , ireg_00181     , 0              , -
  RETURN         , ireg_00181     , -              , -
  ENDPROC        , -              , -              , -
  PROG_END: