// File: luooofan[P]hblzbd_compiler/src/Pass/loop_unroll.cpp
// Function: find_max_temp(IRModule*)
int find_max_temp(IRModule* irmodule) {
  int mx = 0;
  for (auto& func : irmodule->func_list_) {
    for (auto& bb : func->bb_list_) {
      for (auto& ir : bb->ir_list_) {
        vector<ir::Opn*> tmp;
        tmp.push_back(&ir->opn1_);
        tmp.push_back(&ir->opn2_);
        tmp.push_back(&ir->res_);
        for (auto opn : tmp) {
          if (opn->type_ == ir::Opn::Type::Var && find(opn->name_.begin(), opn->name_.end(), '-') != opn->name_.end()) {
            string name = opn->name_;
            for (int i = 0; i <= 4; i++) name.erase(name.begin());
            mx = max(mx, stoi(name));
          }
        }
      }
    }
  }
  return mx;
}

// Assembly:
subq $0x178, %rsp            # imm = 0x178
movq %rdi, 0x170(%rsp)
movl $0x0, 0x16c(%rsp)
movq 0x170(%rsp), %rax
addq $0x28, %rax
movq %rax, 0x160(%rsp)
movq 0x160(%rsp), %rdi
callq 0x1d3c0
movq %rax, 0x158(%rsp)
movq 0x160(%rsp), %rdi
callq 0x1d240
movq %rax, 0x150(%rsp)
leaq 0x158(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x49210
testb $0x1, %al
jne 0xe3046
jmp 0xe3480
leaq 0x158(%rsp), %rdi
callq 0x49250
movq %rax, 0x148(%rsp)
movq 0x148(%rsp), %rax
movq (%rax), %rax
addq $0x30, %rax
movq %rax, 0x140(%rsp)
movq 0x140(%rsp), %rdi
callq 0x1cc40
movq %rax, 0x138(%rsp)
movq 0x140(%rsp), %rdi
callq 0x1cac0
movq %rax, 0x130(%rsp)
leaq 0x138(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x492e0
testb $0x1, %al
jne 0xe30ba
jmp 0xe346c
leaq 0x138(%rsp), %rdi
callq 0x49320
movq %rax, 0x128(%rsp)
movq 0x128(%rsp), %rax
movq (%rax), %rax
addq $0x8, %rax
movq %rax, 0x120(%rsp)
movq 0x120(%rsp), %rdi
callq 0x1b070
movq %rax, 0x118(%rsp)
movq 0x120(%rsp), %rdi
callq 0x1aeb0
movq %rax, 0x110(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x493c0
testb $0x1, %al
jne 0xe312e
jmp 0xe3458
leaq 0x118(%rsp), %rdi
callq 0x1b4d0
movq %rax, 0x108(%rsp)
leaq 0xf0(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0xc9eb0
movq 0x30(%rsp), %rdi
movq 0x108(%rsp), %rax
movq (%rax), %rax
addq $0x8, %rax
movq %rax, 0xe8(%rsp)
leaq 0xe8(%rsp), %rsi
callq 0xe99f0
jmp 0xe3180
movq 0x108(%rsp), %rax
movq (%rax), %rax
addq $0x48, %rax
movq %rax, 0xd0(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0xe99f0
jmp 0xe31ae
movq 0x108(%rsp), %rax
movq (%rax), %rax
addq $0x88, %rax
movq %rax, 0xc8(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xe99f0
jmp 0xe31de
leaq 0xf0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rdi
callq 0xca5a0
movq %rax, 0xb8(%rsp)
movq 0xc0(%rsp), %rdi
callq 0xca420
movq %rax, 0xb0(%rsp)
leaq 0xb8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0xe9a20
testb $0x1, %al
jne 0xe3236
jmp 0xe342a
leaq 0xb8(%rsp), %rdi
callq 0xe9a60
movq (%rax), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rcx
xorl %eax, %eax
cmpl $0x0, (%rcx)
movb %al, 0x2f(%rsp)
jne 0xe3302
movq 0xa8(%rsp), %rdi
addq $0x8, %rdi
callq 0x82f0
movq %rax, 0x98(%rsp)
movq 0xa8(%rsp), %rdi
addq $0x8, %rdi
callq 0x8230
movq %rax, 0x90(%rsp)
movb $0x2d, 0x8f(%rsp)
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %rsi
leaq 0x8f(%rsp), %rdx
callq 0xe9ab0
movq %rax, 0x20(%rsp)
jmp 0xe32c3
movq 0x20(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xa8(%rsp), %rdi
addq $0x8, %rdi
callq 0x8230
movq %rax, 0x80(%rsp)
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0xe9a70
movb %al, 0x2f(%rsp)
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0xe330f
jmp 0xe3416
movq 0xa8(%rsp), %rsi
addq $0x8, %rsi
leaq 0x60(%rsp), %rdi
callq 0x81a0
jmp 0xe3327
movl $0x0, 0x5c(%rsp)
cmpl $0x4, 0x5c(%rsp)
jg 0xe33c6
leaq 0x60(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x82f0
movq %rax, 0x48(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0xe9970
movq 0x10(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x8490
movq %rax, 0x18(%rsp)
jmp 0xe3373
movq 0x18(%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0xe332f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
jmp 0xe3449
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x8728
jmp 0xe3449
xorl %eax, %eax
movl %eax, %esi
leaq 0x60(%rsp), %rdi
movl $0xa, %edx
callq 0x8f640
movl %eax, 0xc(%rsp)
jmp 0xe33df
movl 0xc(%rsp), %eax
movl %eax, 0x3c(%rsp)
leaq 0x16c(%rsp), %rdi
leaq 0x3c(%rsp), %rsi
callq 0xe99b0
movq %rax, (%rsp)
jmp 0xe33ff
movq (%rsp), %rax
movl (%rax), %eax
movl %eax, 0x16c(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x8728
jmp 0xe3418
leaq 0xb8(%rsp), %rdi
callq 0xe9b10
jmp 0xe3218
leaq 0xf0(%rsp), %rdi
callq 0x92a70
leaq 0x118(%rsp), %rdi
callq 0x49460
jmp 0xe3110
leaq 0xf0(%rsp), %rdi
callq 0x92a70
jmp 0xe348f
jmp 0xe345a
leaq 0x138(%rsp), %rdi
callq 0x49330
jmp 0xe309c
jmp 0xe346e
leaq 0x158(%rsp), %rdi
callq 0x49260
jmp 0xe3028
movl 0x16c(%rsp), %eax
addq $0x178, %rsp            # imm = 0x178
retq
movq 0xe0(%rsp), %rdi
callq 0x8670
nopl (%rax)