// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/ir.c
// Function: show_ir
char* show_ir(IR* ir) {
  switch (ir->op) {
  case IIMM:
    return format("%s = %d", show_ireg(ir->r0), ir->imm_int);
  case ILABEL:
    return format("%s = %s", show_ireg(ir->r0), ir->label);
  case IADD:
    return format("%s = %s + %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case ISUB:
    return format("%s = %s - %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case IMUL:
    return format("%s = %s * %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case IDIV:
    return format("%s = %s / %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case IMOD:
    return format("%s = %s %% %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case ILT:
    return format("%s = %s < %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case ILE:
    return format("%s = %s <= %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case IGT:
    return format("%s = %s > %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case IGE:
    return format("%s = %s >= %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case IEQ:
    return format("%s = %s == %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case INE:
    return format("%s = %s != %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case IAND:
    return format("%s = %s & %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case IOR:
    return format("%s = %s | %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case IXOR:
    return format("%s = %s ^ %s", show_ireg(ir->r0), show_ireg(ir->r1), show_ireg(ir->r2));
  case INOT:
    return format("%s = not %s", show_ireg(ir->r0), show_ireg(ir->r1));
  case IADDRESS: 
    return format("%s = address %d", show_ireg(ir->r0), ir->imm_int);
  case IALLOC:
    return format("alloc %d", ir->imm_int);
  case ILOAD:
    return format("%s = load %s", show_ireg(ir->r0), show_ireg(ir->r1));
  case ISTOREARG:
    return format("storearg %s <- %d(%zu)", show_ireg(ir->r1), ir->imm_int, ir->size);
  case ISTORE:
    return format("store %s <- %s", show_ireg(ir->r1), show_ireg(ir->r2));
  case IMOV:
    return format("mov %s <- %s", show_ireg(ir->r0), show_ireg(ir->r1));
  case ICALL:
    return format("%s = call %s %s", show_ireg(ir->r0), ir->func_name, show_args(ir->args));
  case IBR:
    return format("br %s %s %s", show_ireg(ir->r1), ir->then, ir->els);
  case IJMP:
    return format("jmp %s", ir->jump_to);
  case IRET:
    if (ir->r1) {
      return format("ret %s", show_ireg(ir->r1));
    } else {
      return format("ret");
    }
  }
  error("unreachable\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl (%rdi), %eax
cmpq $0x1a, %rax
ja 0x71de
movq %rdi, %rbx
leaq 0x629d(%rip), %rcx      # 0xcf9c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x10(%rbx), %rdi
callq 0x6cbf
movl 0x4(%rbx), %edx
leaq 0x6300(%rip), %rdi      # 0xd01b
jmp 0x6f35
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
leaq 0x63aa(%rip), %rdi      # 0xd0e6
jmp 0x70d7
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x6363(%rip), %rdi      # 0xd0cc
jmp 0x7177
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x630d(%rip), %rdi      # 0xd0a3
jmp 0x7177
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x6282(%rip), %rdi      # 0xd045
jmp 0x7177
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x62c1(%rip), %rdi      # 0xd0b1
jmp 0x7177
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x626b(%rip), %rdi      # 0xd088
jmp 0x7177
movq 0x30(%rbx), %rsi
leaq 0x585b(%rip), %rdi      # 0xc688
jmp 0x71ad
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq 0x38(%rbx), %rdx
movq 0x40(%rbx), %rcx
leaq 0x6311(%rip), %rdi      # 0xd15b
movq %rax, %rsi
jmp 0x7180
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x61b1(%rip), %rdi      # 0xd02b
jmp 0x7177
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x6232(%rip), %rdi      # 0xd0d9
jmp 0x7177
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x6164(%rip), %rdi      # 0xd038
jmp 0x7177
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x616c(%rip), %rdi      # 0xd06d
jmp 0x7177
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq 0x28(%rbx), %rdx
leaq 0x6109(%rip), %rdi      # 0xd023
movq %rax, %rsi
jmp 0x70dd
movq 0x10(%rbx), %rdi
callq 0x6cbf
movl 0x4(%rbx), %edx
leaq 0x61bd(%rip), %rdi      # 0xd0f2
movq %rax, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa84a
movq 0x18(%rbx), %rdi
callq 0x6cbf
movl 0x4(%rbx), %edx
movq 0x8(%rbx), %rcx
leaq 0x61b4(%rip), %rdi      # 0xd118
movq %rax, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa84a
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x60ae(%rip), %rdi      # 0xd052
jmp 0x7177
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x616a(%rip), %rdi      # 0xd12f
jmp 0x70d7
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x60cd(%rip), %rdi      # 0xd0bf
jmp 0x7177
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x6040(%rip), %rdi      # 0xd05f
jmp 0x7177
movl 0x4(%rbx), %esi
leaq 0x60d4(%rip), %rdi      # 0xd102
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa84a
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x602a(%rip), %rdi      # 0xd095
jmp 0x7177
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
movq %rax, %r15
movq 0x20(%rbx), %rdi
callq 0x6cbf
leaq 0x5fe2(%rip), %rdi      # 0xd07a
jmp 0x7177
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
leaq 0x6085(%rip), %rdi      # 0xd13e
jmp 0x70d7
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x6cbf
leaq 0x6034(%rip), %rdi      # 0xd10b
movq %r14, %rsi
movq %rax, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa84a
movq 0x10(%rbx), %rdi
callq 0x6cbf
movq %rax, %r14
movq 0x48(%rbx), %r15
movq 0x50(%rbx), %r13
callq 0xaa4f
movq %rax, %rbx
leaq 0x673d(%rip), %rsi      # 0xd852
movq %rax, %rdi
callq 0xaac1
xorl %ebp, %ebp
leaq 0x5127(%rip), %r12      # 0xc24d
cmpq %rbp, 0x10(%r13)
jbe 0x7159
testq %rbp, %rbp
je 0x713c
movq %rbx, %rdi
movq %r12, %rsi
callq 0xaac1
movq (%r13), %rax
movq (%rax,%rbp,8), %rdi
callq 0x6cbf
movq %rbx, %rdi
movq %rax, %rsi
callq 0xaac1
incq %rbp
jmp 0x7126
leaq 0x6192(%rip), %rsi      # 0xd2f2
movq %rbx, %rdi
callq 0xaac1
movq %rbx, %rdi
callq 0xaaf4
leaq 0x5fd4(%rip), %rdi      # 0xd14b
movq %r14, %rsi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa84a
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x71c2
callq 0x6cbf
leaq 0x5fbd(%rip), %rdi      # 0xd167
movq %rax, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa84a
leaq 0x507f(%rip), %rdi      # 0xc248
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa84a
leaq 0x5f89(%rip), %rdi      # 0xd16e
xorl %eax, %eax
callq 0xa90e