// File: luooofan[P]hblzbd_compiler/src/Pass/loop_unroll.cpp
// Function: find_max_label(IRModule*)
int find_max_label(IRModule* irmodule) {
  int mx = 0;
  for (auto& func : irmodule->func_list_) {
    for (auto& bb : func->bb_list_) {
      for (auto& ir : bb->ir_list_) {
        if (ir->op_ == ir::IR::OpKind::LABEL) {
          string tmp = ir->opn1_.name_;
          if (*tmp.begin() == '.') {
            for (int i = 0; i < 6; i++) tmp.erase(tmp.begin());
            if (*tmp.begin() == '-') continue;  // 说明是循环不变量外提写的
            mx = max(mx, stoi(tmp));            // find_max_label在add_scope_id前
          }
        }
      }
    }
  }
  return mx;
}

// Assembly:
subq $0xf8, %rsp
movq %rdi, 0xf0(%rsp)
movl $0x0, 0xec(%rsp)
movq 0xf0(%rsp), %rax
addq $0x28, %rax
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rdi
callq 0x1d3c0
movq %rax, 0xd8(%rsp)
movq 0xe0(%rsp), %rdi
callq 0x1d240
movq %rax, 0xd0(%rsp)
leaq 0xd8(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x49210
testb $0x1, %al
jne 0xe2d16
jmp 0xe2fb2
leaq 0xd8(%rsp), %rdi
callq 0x49250
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rax
movq (%rax), %rax
addq $0x30, %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x1cc40
movq %rax, 0xb8(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x1cac0
movq %rax, 0xb0(%rsp)
leaq 0xb8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x492e0
testb $0x1, %al
jne 0xe2d8a
jmp 0xe2f9e
leaq 0xb8(%rsp), %rdi
callq 0x49320
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
movq (%rax), %rax
addq $0x8, %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x1b070
movq %rax, 0x98(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x1aeb0
movq %rax, 0x90(%rsp)
leaq 0x98(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x493c0
testb $0x1, %al
jne 0xe2dfe
jmp 0xe2f8a
leaq 0x98(%rsp), %rdi
callq 0x1b4d0
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rax
movq (%rax), %rax
cmpl $0x7, (%rax)
jne 0xe2f76
movq 0x88(%rsp), %rax
movq (%rax), %rsi
addq $0x8, %rsi
addq $0x8, %rsi
leaq 0x68(%rsp), %rdi
callq 0x81a0
leaq 0x68(%rsp), %rdi
callq 0x82f0
movq %rax, 0x60(%rsp)
leaq 0x60(%rsp), %rdi
callq 0xe9960
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0xe2f56
movl $0x0, 0x5c(%rsp)
cmpl $0x6, 0x5c(%rsp)
jge 0xe2ee5
leaq 0x68(%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 0xe2eb1
movq 0x18(%rsp), %rax
movq %rax, 0x30(%rsp)
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0xe2e71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x8728
jmp 0xe2fc1
leaq 0x68(%rsp), %rdi
callq 0x82f0
movq %rax, 0x28(%rsp)
leaq 0x28(%rsp), %rdi
callq 0xe9960
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0xe2f10
movl $0x7, 0x24(%rsp)
jmp 0xe2f5e
xorl %eax, %eax
movl %eax, %esi
leaq 0x68(%rsp), %rdi
movl $0xa, %edx
callq 0x8f640
movl %eax, 0xc(%rsp)
jmp 0xe2f29
movl 0xc(%rsp), %eax
movl %eax, 0x20(%rsp)
leaq 0xec(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0xe99b0
movq %rax, (%rsp)
jmp 0xe2f49
movq (%rsp), %rax
movl (%rax), %eax
movl %eax, 0xec(%rsp)
movl $0x0, 0x24(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x8728
movl 0x24(%rsp), %eax
testl %eax, %eax
je 0xe2f74
jmp 0xe2f72
jmp 0xe2f78
jmp 0xe2f76
jmp 0xe2f78
leaq 0x98(%rsp), %rdi
callq 0x49460
jmp 0xe2de0
jmp 0xe2f8c
leaq 0xb8(%rsp), %rdi
callq 0x49330
jmp 0xe2d6c
jmp 0xe2fa0
leaq 0xd8(%rsp), %rdi
callq 0x49260
jmp 0xe2cf8
movl 0xec(%rsp), %eax
addq $0xf8, %rsp
retq
movq 0x40(%rsp), %rdi
callq 0x8670
nopl (%rax,%rax)