// File: luooofan[P]hblzbd_compiler/src/generate_ir.cpp
// Function: ast::Root::GenerateIR(ir::ContextInfo&, std::vector<ir::IR*, std::allocator<ir::IR*>>&)
void Root::GenerateIR(ir::ContextInfo &ctx, std::vector<ir::IR *> &gIRList) {
  // 把系统库中的函数添加到函数表中
  // NOTE: 库函数size为0
  ir::gFuncTable.insert({"getint", {INT, -1}});
  ir::gFuncTable.insert({"getch", {INT, -1}});
  ir::FuncTableItem func_item = {INT, -1};
  func_item.shape_list_.push_back({-1});
  ir::gFuncTable.insert({"getarray", func_item});
  ir::FuncTableItem func_item_void = {VOID, -1};
  func_item_void.shape_list_.push_back({});
  ir::gFuncTable.insert({"putint", func_item_void});
  ir::gFuncTable.insert({"putch", func_item_void});
  ir::gFuncTable.insert({"_sysy_starttime", func_item_void});
  ir::gFuncTable.insert({"_sysy_stoptime", func_item_void});
  func_item_void.shape_list_.push_back({-1});
  ir::gFuncTable.insert({"putarray", func_item_void});
  ir::FuncTableItem memset_func_item = {VOID, -1};
  memset_func_item.shape_list_.push_back({-1});
  memset_func_item.shape_list_.push_back({});
  memset_func_item.shape_list_.push_back({});
  ir::gFuncTable.insert({"memset", memset_func_item});
  // TODO: string type and putf function
  // ir::gFuncTable.insert({"putf", {VOID}});

  // 创建一张全局符号表 全局作用域id为0 父作用域id为-1
  ir::gScopes.push_back({0, -1});
  // auto &extern_glo_symtab = ir::gScopes[0].symbol_table_;
  // extern_glo_symtab.insert({"_sysy_idx", {false, false, 0}});
  // auto general_extern_array = ir::SymbolTableItem(true, false, 0);
  // general_extern_array.shape_.push_back(1024);
  // general_extern_array.width_.push_back(1024 * 4);
  // general_extern_array.width_.push_back(4);
  // general_extern_array.initval_ = std::vector<int>(1024, 0);
  // extern_glo_symtab.insert({"_sysy_l1", general_extern_array});
  // extern_glo_symtab.insert({"_sysy_l2", general_extern_array});
  // extern_glo_symtab.insert({"_sysy_h", general_extern_array});
  // extern_glo_symtab.insert({"_sysy_m", general_extern_array});
  // extern_glo_symtab.insert({"_sysy_s", general_extern_array});
  // extern_glo_symtab.insert({"_sysy_us", general_extern_array});

  // 初始化上下文信息中的当前作用域id
  ctx.scope_id_ = 0;
  ctx.is_assigned_ = false;

#ifdef GENIR_TIME_CONTROL
  clock_t begin, end;
  double cost;
  begin = clock();
#endif

  // 对每个compunit语义分析并生成IR
  int i = 1;
  for (const auto &ele : this->compunit_list_) {
    if (auto func_def = dynamic_cast<FunctionDefine *>(ele)) {
      if (dead_func_set.count(func_def->name_.name_)) continue;
    }
    ele->GenerateIR(ctx, gIRList);
  }

#ifdef GENIR_TIME_CONTROL
  end = clock();
  cost = (double)(end - begin) / CLOCKS_PER_SEC;
  std::cout << "GenIrRoot cost: " << cost << "s" << std::endl;
  if (cost > 3) exit(233);
#endif

  // 检查是否有main函数 main函数的返回值是否是int
  auto func_iter = ir::gFuncTable.find("main");
  if (func_iter == ir::gFuncTable.end()) {
    ir::SemanticError(this->line_no_, "no main() function");
  } else if ((*func_iter).second.ret_type_ == VOID) {
    ir::SemanticError(this->line_no_, "main() return type not int");
  }
}

// Assembly:
subq $0x6d8, %rsp            # imm = 0x6D8
movq %rdi, 0x6d0(%rsp)
movq %rsi, 0x6c8(%rsp)
movq %rdx, 0x6c0(%rsp)
movq 0x6d0(%rsp), %rax
movq %rax, 0x148(%rsp)
leaq 0x660(%rsp), %rdi
movq %rdi, 0x150(%rsp)
movl $0x121, %esi            # imm = 0x121
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x35980
movq 0x150(%rsp), %rdx
leaq 0xd96b3(%rip), %rsi     # 0xfa8e0
leaq 0x680(%rsp), %rdi
callq 0x359c0
jmp 0x2123c
leaq 0x12b3fd(%rip), %rdi    # 0x14c640
leaq 0x680(%rsp), %rsi
callq 0x35930
movb %dl, 0x13f(%rsp)
movq %rax, 0x140(%rsp)
jmp 0x21261
movb 0x13f(%rsp), %al
movq 0x140(%rsp), %rcx
movq %rcx, 0x640(%rsp)
movb %al, 0x648(%rsp)
leaq 0x680(%rsp), %rdi
callq 0x35a80
leaq 0x660(%rsp), %rdi
callq 0x35ab0
leaq 0x5e0(%rsp), %rdi
movq %rdi, 0x130(%rsp)
movl $0x121, %esi            # imm = 0x121
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x35980
movq 0x130(%rsp), %rdx
leaq 0xd9620(%rip), %rsi     # 0xfa8e7
leaq 0x600(%rsp), %rdi
callq 0x35ad0
jmp 0x212d6
leaq 0x12b363(%rip), %rdi    # 0x14c640
leaq 0x600(%rsp), %rsi
callq 0x35930
movb %dl, 0x127(%rsp)
movq %rax, 0x128(%rsp)
jmp 0x212fb
movb 0x127(%rsp), %al
movq 0x128(%rsp), %rcx
movq %rcx, 0x5d0(%rsp)
movb %al, 0x5d8(%rsp)
leaq 0x600(%rsp), %rdi
callq 0x35a80
leaq 0x5e0(%rsp), %rdi
callq 0x35ab0
leaq 0x5b0(%rsp), %rdi
movl $0x121, %esi            # imm = 0x121
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x35980
leaq 0x5b8(%rsp), %rax
movq %rax, 0x110(%rsp)
movl $0xffffffff, 0x584(%rsp) # imm = 0xFFFFFFFF
leaq 0x584(%rsp), %rax
movq %rax, 0x588(%rsp)
movq $0x1, 0x590(%rsp)
leaq 0x583(%rsp), %rdi
movq %rdi, 0x118(%rsp)
callq 0x35bc0
movq 0x118(%rsp), %rcx
movq 0x588(%rsp), %rsi
movq 0x590(%rsp), %rdx
leaq 0x598(%rsp), %rdi
callq 0x35bd0
jmp 0x213bd
movq 0x110(%rsp), %rdi
leaq 0x598(%rsp), %rsi
callq 0x35b90
jmp 0x213d4
leaq 0x598(%rsp), %rdi
callq 0x35c60
leaq 0x583(%rsp), %rdi
callq 0x35cc0
leaq 0xd94f8(%rip), %rsi     # 0xfa8ed
leaq 0x540(%rsp), %rdi
leaq 0x5b0(%rsp), %rdx
callq 0x35cd0
jmp 0x2140c
leaq 0x12b22d(%rip), %rdi    # 0x14c640
leaq 0x540(%rsp), %rsi
callq 0x35930
movb %dl, 0x107(%rsp)
movq %rax, 0x108(%rsp)
jmp 0x21431
movb 0x107(%rsp), %al
movq 0x108(%rsp), %rcx
movq %rcx, 0x530(%rsp)
movb %al, 0x538(%rsp)
leaq 0x540(%rsp), %rdi
callq 0x35a80
leaq 0x510(%rsp), %rdi
movl $0x122, %esi            # imm = 0x122
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x35980
jmp 0x21475
leaq 0x518(%rsp), %rax
movq %rax, 0xf0(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x4f0(%rsp)
movq $0x0, 0x500(%rsp)
leaq 0x4f0(%rsp), %rdi
movq %rdi, 0xf8(%rsp)
callq 0x35d90
movq 0xf0(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x35b90
jmp 0x214c8
leaq 0x4f0(%rsp), %rdi
callq 0x35c60
leaq 0xd941a(%rip), %rsi     # 0xfa8f6
leaq 0x4b0(%rsp), %rdi
leaq 0x510(%rsp), %rdx
callq 0x35da0
jmp 0x214f3
leaq 0x12b146(%rip), %rdi    # 0x14c640
leaq 0x4b0(%rsp), %rsi
callq 0x35930
movb %dl, 0xe7(%rsp)
movq %rax, 0xe8(%rsp)
jmp 0x21518
movb 0xe7(%rsp), %al
movq 0xe8(%rsp), %rcx
movq %rcx, 0x4a0(%rsp)
movb %al, 0x4a8(%rsp)
leaq 0x4b0(%rsp), %rdi
callq 0x35a80
leaq 0xd93b3(%rip), %rsi     # 0xfa8fd
leaq 0x460(%rsp), %rdi
leaq 0x510(%rsp), %rdx
callq 0x35e60
jmp 0x21561
leaq 0x12b0d8(%rip), %rdi    # 0x14c640
leaq 0x460(%rsp), %rsi
callq 0x35930
movb %dl, 0xd7(%rsp)
movq %rax, 0xd8(%rsp)
jmp 0x21586
movb 0xd7(%rsp), %al
movq 0xd8(%rsp), %rcx
movq %rcx, 0x450(%rsp)
movb %al, 0x458(%rsp)
leaq 0x460(%rsp), %rdi
callq 0x35a80
leaq 0xd9354(%rip), %rsi     # 0xfa90c
leaq 0x410(%rsp), %rdi
leaq 0x510(%rsp), %rdx
callq 0x35f20
jmp 0x215cf
leaq 0x12b06a(%rip), %rdi    # 0x14c640
leaq 0x410(%rsp), %rsi
callq 0x35930
movb %dl, 0xc7(%rsp)
movq %rax, 0xc8(%rsp)
jmp 0x215f4
movb 0xc7(%rsp), %al
movq 0xc8(%rsp), %rcx
movq %rcx, 0x400(%rsp)
movb %al, 0x408(%rsp)
leaq 0x410(%rsp), %rdi
callq 0x35a80
leaq 0xd92f6(%rip), %rsi     # 0xfa91c
leaq 0x3c0(%rsp), %rdi
leaq 0x510(%rsp), %rdx
callq 0x35fe0
jmp 0x2163d
leaq 0x12affc(%rip), %rdi    # 0x14c640
leaq 0x3c0(%rsp), %rsi
callq 0x35930
movb %dl, 0xb7(%rsp)
movq %rax, 0xb8(%rsp)
jmp 0x21662
movb 0xb7(%rsp), %al
movq 0xb8(%rsp), %rcx
movq %rcx, 0x3b0(%rsp)
movb %al, 0x3b8(%rsp)
leaq 0x3c0(%rsp), %rdi
callq 0x35a80
leaq 0x518(%rsp), %rax
movq %rax, 0xa0(%rsp)
movl $0xffffffff, 0x384(%rsp) # imm = 0xFFFFFFFF
leaq 0x384(%rsp), %rax
movq %rax, 0x388(%rsp)
movq $0x1, 0x390(%rsp)
leaq 0x383(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0x35bc0
movq 0xa8(%rsp), %rcx
movq 0x388(%rsp), %rsi
movq 0x390(%rsp), %rdx
leaq 0x398(%rsp), %rdi
callq 0x35bd0
jmp 0x21700
movq 0xa0(%rsp), %rdi
leaq 0x398(%rsp), %rsi
callq 0x35b90
jmp 0x21717
leaq 0x398(%rsp), %rdi
callq 0x35c60
leaq 0x383(%rsp), %rdi
callq 0x35cc0
leaq 0xd91cb(%rip), %rsi     # 0xfa903
leaq 0x340(%rsp), %rdi
leaq 0x510(%rsp), %rdx
callq 0x35cd0
jmp 0x2174f
leaq 0x12aeea(%rip), %rdi    # 0x14c640
leaq 0x340(%rsp), %rsi
callq 0x35930
movb %dl, 0x97(%rsp)
movq %rax, 0x98(%rsp)
jmp 0x21774
movb 0x97(%rsp), %al
movq 0x98(%rsp), %rcx
movq %rcx, 0x330(%rsp)
movb %al, 0x338(%rsp)
leaq 0x340(%rsp), %rdi
callq 0x35a80
leaq 0x310(%rsp), %rdi
movl $0x122, %esi            # imm = 0x122
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x35980
jmp 0x217b8
leaq 0x318(%rsp), %rax
movq %rax, 0x80(%rsp)
movl $0xffffffff, 0x2e4(%rsp) # imm = 0xFFFFFFFF
leaq 0x2e4(%rsp), %rax
movq %rax, 0x2e8(%rsp)
movq $0x1, 0x2f0(%rsp)
leaq 0x2e3(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x35bc0
movq 0x88(%rsp), %rcx
movq 0x2e8(%rsp), %rsi
movq 0x2f0(%rsp), %rdx
leaq 0x2f8(%rsp), %rdi
callq 0x35bd0
jmp 0x2182b
movq 0x80(%rsp), %rdi
leaq 0x2f8(%rsp), %rsi
callq 0x35b90
jmp 0x21842
leaq 0x2f8(%rsp), %rdi
callq 0x35c60
leaq 0x2e3(%rsp), %rdi
callq 0x35cc0
leaq 0x318(%rsp), %rax
movq %rax, 0x70(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x2c0(%rsp)
movq $0x0, 0x2d0(%rsp)
leaq 0x2c0(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x35d90
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x35b90
jmp 0x218a3
leaq 0x2c0(%rsp), %rdi
callq 0x35c60
leaq 0x318(%rsp), %rax
movq %rax, 0x60(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x2a0(%rsp)
movq $0x0, 0x2b0(%rsp)
leaq 0x2a0(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x35d90
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x35b90
jmp 0x218f7
leaq 0x2a0(%rsp), %rdi
callq 0x35c60
leaq 0xd9020(%rip), %rsi     # 0xfa92b
leaq 0x260(%rsp), %rdi
leaq 0x310(%rsp), %rdx
callq 0x35da0
jmp 0x21922
leaq 0x12ad17(%rip), %rdi    # 0x14c640
leaq 0x260(%rsp), %rsi
callq 0x35930
movb %dl, 0x57(%rsp)
movq %rax, 0x58(%rsp)
jmp 0x21941
movb 0x57(%rsp), %al
movq 0x58(%rsp), %rcx
movq %rcx, 0x250(%rsp)
movb %al, 0x258(%rsp)
leaq 0x260(%rsp), %rdi
callq 0x35a80
leaq 0x210(%rsp), %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x360d0
jmp 0x2197c
leaq 0x12aca5(%rip), %rdi    # 0x14c628
leaq 0x210(%rsp), %rsi
callq 0x360a0
jmp 0x21992
leaq 0x210(%rsp), %rdi
callq 0x36110
movq 0x148(%rsp), %rax
movq 0x6c8(%rsp), %rcx
movl $0x0, (%rcx)
movq 0x6c8(%rsp), %rcx
movb $0x0, 0x209(%rcx)
movl $0x1, 0x20c(%rsp)
addq $0x10, %rax
movq %rax, 0x200(%rsp)
movq 0x200(%rsp), %rdi
callq 0x14a20
movq %rax, 0x1f8(%rsp)
movq 0x200(%rsp), %rdi
callq 0x14a50
movq %rax, 0x1f0(%rsp)
leaq 0x1f8(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x14a80
testb $0x1, %al
jne 0x21a23
jmp 0x21e5f
leaq 0x1f8(%rsp), %rdi
callq 0x14ac0
movq %rax, 0x1e8(%rsp)
movq 0x1e8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x48(%rsp)
cmpq $0x0, %rax
je 0x21dd2
movq 0x48(%rsp), %rdi
leaq 0x1293c2(%rip), %rsi    # 0x14ae20
leaq 0x129183(%rip), %rdx    # 0x14abe8
xorl %eax, %eax
movl %eax, %ecx
callq 0x8410
movq %rax, 0x40(%rsp)
jmp 0x21ddb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
jmp 0x21aaf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x680(%rsp), %rdi
callq 0x35a80
leaq 0x660(%rsp), %rdi
callq 0x35ab0
jmp 0x22123
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
jmp 0x21af8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x600(%rsp), %rdi
callq 0x35a80
leaq 0x5e0(%rsp), %rdi
callq 0x35ab0
jmp 0x22123
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
jmp 0x21b41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x598(%rsp), %rdi
callq 0x35c60
leaq 0x583(%rsp), %rdi
callq 0x35cc0
jmp 0x22116
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
jmp 0x22116
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x540(%rsp), %rdi
callq 0x35a80
jmp 0x22116
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x4f0(%rsp), %rdi
callq 0x35c60
jmp 0x22109
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
jmp 0x22109
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x4b0(%rsp), %rdi
callq 0x35a80
jmp 0x22109
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x460(%rsp), %rdi
callq 0x35a80
jmp 0x22109
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x410(%rsp), %rdi
callq 0x35a80
jmp 0x22109
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x3c0(%rsp), %rdi
callq 0x35a80
jmp 0x22109
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
jmp 0x21ca0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x398(%rsp), %rdi
callq 0x35c60
leaq 0x383(%rsp), %rdi
callq 0x35cc0
jmp 0x22109
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x340(%rsp), %rdi
callq 0x35a80
jmp 0x22109
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
jmp 0x21d0f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x2f8(%rsp), %rdi
callq 0x35c60
leaq 0x2e3(%rsp), %rdi
callq 0x35cc0
jmp 0x220fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x2c0(%rsp), %rdi
callq 0x35c60
jmp 0x220fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x2a0(%rsp), %rdi
callq 0x35c60
jmp 0x220fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
jmp 0x220fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x260(%rsp), %rdi
callq 0x35a80
jmp 0x220fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x210(%rsp), %rdi
callq 0x36110
jmp 0x220fc
xorl %eax, %eax
movq %rax, 0x40(%rsp)
jmp 0x21ddb
movq 0x40(%rsp), %rax
movq %rax, 0x1e0(%rsp)
cmpq $0x0, 0x1e0(%rsp)
je 0x21e25
movq 0x1e0(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rsi
leaq 0x12a7a6(%rip), %rdi    # 0x14c5b0
callq 0x36120
movq %rax, 0x38(%rsp)
jmp 0x21e16
movq 0x38(%rsp), %rax
cmpq $0x0, %rax
je 0x21e23
jmp 0x21e4d
jmp 0x21e25
movq 0x1e8(%rsp), %rax
movq (%rax), %rdi
movq 0x6c8(%rsp), %rsi
movq 0x6c0(%rsp), %rdx
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
jmp 0x21e4b
jmp 0x21e4d
leaq 0x1f8(%rsp), %rdi
callq 0x14ad0
jmp 0x21a05
leaq 0x1b7(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x8680
movq 0x30(%rsp), %rdx
leaq 0xd8c5a(%rip), %rsi     # 0xfaad7
leaq 0x1b8(%rsp), %rdi
callq 0xc570
jmp 0x21e8c
leaq 0x12a7ad(%rip), %rdi    # 0x14c640
leaq 0x1b8(%rsp), %rsi
callq 0x18680
movq %rax, 0x28(%rsp)
jmp 0x21ea7
movq 0x28(%rsp), %rax
movq %rax, 0x1d8(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x8728
leaq 0x1b7(%rsp), %rdi
callq 0x83c0
leaq 0x12a76b(%rip), %rdi    # 0x14c640
callq 0x36170
movq %rax, 0x1a8(%rsp)
leaq 0x1d8(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x36150
testb $0x1, %al
jne 0x21f00
jmp 0x22000
movq 0x148(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x1c(%rsp)
leaq 0x187(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x8680
movq 0x20(%rsp), %rdx
leaq 0xd8baf(%rip), %rsi     # 0xfaadc
leaq 0x188(%rsp), %rdi
callq 0xc570
jmp 0x21f3c
movl 0x1c(%rsp), %edi
leaq 0x188(%rsp), %rsi
callq 0x47ce0
jmp 0x21f4f
leaq 0x188(%rsp), %rdi
callq 0x8728
leaq 0x187(%rsp), %rdi
callq 0x83c0
jmp 0x220cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
jmp 0x21fa5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x8728
leaq 0x1b7(%rsp), %rdi
callq 0x83c0
jmp 0x220fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
jmp 0x21fee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x188(%rsp), %rdi
callq 0x8728
leaq 0x187(%rsp), %rdi
callq 0x83c0
jmp 0x220fc
leaq 0x1d8(%rsp), %rdi
callq 0x186b0
cmpl $0x122, 0x20(%rax)      # imm = 0x122
jne 0x220cb
movq 0x148(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0xc(%rsp)
leaq 0x15f(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x8680
movq 0x10(%rsp), %rdx
leaq 0xd8aa8(%rip), %rsi     # 0xfaaef
leaq 0x160(%rsp), %rdi
callq 0xc570
jmp 0x22056
movl 0xc(%rsp), %edi
leaq 0x160(%rsp), %rsi
callq 0x47ce0
jmp 0x22069
leaq 0x160(%rsp), %rdi
callq 0x8728
leaq 0x15f(%rsp), %rdi
callq 0x83c0
jmp 0x220cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
jmp 0x220bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x658(%rsp)
movl %eax, 0x654(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x8728
leaq 0x15f(%rsp), %rdi
callq 0x83c0
jmp 0x220fc
jmp 0x220cd
leaq 0x310(%rsp), %rdi
callq 0x35ab0
leaq 0x510(%rsp), %rdi
callq 0x35ab0
leaq 0x5b0(%rsp), %rdi
callq 0x35ab0
addq $0x6d8, %rsp            # imm = 0x6D8
retq
leaq 0x310(%rsp), %rdi
callq 0x35ab0
leaq 0x510(%rsp), %rdi
callq 0x35ab0
leaq 0x5b0(%rsp), %rdi
callq 0x35ab0
movq 0x658(%rsp), %rdi
callq 0x8670