// File: /workspace/github_cpp_makefile_star2_O1/luooofan[P]hblzbd_compiler/src/Pass/convert_ssa.cpp
// Function: ConvertSSA::ConstructSSA4BB(IRBasicBlock*, SSAFunction*, std::unordered_map<IRBasicBlock*, SSABasicBlock*, std::hash<IRBasicBlock*>, std::equal_to<IRBasicBlock*>, std::allocator<std::pair<IRBasicBlock* const, SSABasicBlock*>>>&)
void ConvertSSA::ConstructSSA4BB(IRBasicBlock* bb, SSAFunction* ssafunc,
                                 std::unordered_map<IRBasicBlock*, SSABasicBlock*>& bb_map) {
  if (nullptr == bb) return;
#ifdef DEBUG_CONSTRUCT_SSA_PROCESS
  std::cout << "---Process BB:" << std::endl;
#endif

  auto ssabb = bb_map[bb];
  MyAssert(nullptr != ssabb);

  // for every ir
  for (auto ir_iter = bb->ir_list_.begin(); ir_iter != bb->ir_list_.end(); ++ir_iter) {
    auto ir = **ir_iter;
#ifdef DEBUG_CONSTRUCT_SSA_PROCESS
    // std::cout << "----Process IR:" << std::endl;
    ir.PrintIR(std::cout);
#endif
    switch (ir.op_) {
      // NOTE: assign和param可能传递i32 pointer 其他传递i32或者void arraytype只在alloca中不会传递
      // 从数组中取元素值只会出现在assign offset ir中 给数组元素赋值只会出现在assign ir中
      case ir::IR::OpKind::ADD:
      case ir::IR::OpKind::SUB:
      case ir::IR::OpKind::MUL:
      case ir::IR::OpKind::DIV:
      case ir::IR::OpKind::MOD: {
        auto lhs = ResolveOpn2Value(&(ir.opn1_), ssabb);
        auto rhs = ResolveOpn2Value(&(ir.opn2_), ssabb);
        auto res_comp_name = ir.res_.GetCompName();
        auto res =
            new BinaryOperator(new Type(Type::IntegerTyID), static_cast<BinaryOperator::OpKind>(GetOpKind(ir.op_)),
                               res_comp_name, lhs, rhs, ssabb);
        ProcessResValue(res_comp_name, &(ir.res_), res, ssabb);
        break;
      }
      case ir::IR::OpKind::NOT:
      case ir::IR::OpKind::NEG: {
        auto lhs = ResolveOpn2Value(&(ir.opn1_), ssabb);
        auto res_comp_name = ir.res_.GetCompName();
        auto res = new UnaryOperator(new Type(Type::IntegerTyID), static_cast<UnaryOperator::OpKind>(GetOpKind(ir.op_)),
                                     res_comp_name, lhs, ssabb);
        ProcessResValue(res_comp_name, &(ir.res_), res, ssabb);
        break;
      }
      case ir::IR::OpKind::LABEL: {  // label ir已经全被删了 执行流不会到这里
        MyAssert(0);
        break;
      }
      case ir::IR::OpKind::PARAM: {  // param ir全部跳过 等call的时候处理
        break;
      }
      case ir::IR::OpKind::CALL: {
        auto func_value = dynamic_cast<FunctionValue*>(glob_map[ir.opn1_.GetCompName()]);
        MyAssert(nullptr != func_value);
        // maintain call_func
        ssafunc->AddCallFunc(func_value);

        CallInst* call_inst = nullptr;
        if (ir.res_.type_ == Opn::Type::Null) {
          call_inst = new CallInst(func_value, ssabb);
        } else {
          auto res_comp_name = ir.res_.GetCompName();
          call_inst = new CallInst(new Type(Type::IntegerTyID), res_comp_name, func_value, ssabb);
          ProcessResValue(res_comp_name, &(ir.res_), call_inst, ssabb);
        }

        // 添加参数
        MyAssert(ir.opn2_.type_ == Opn::Type::Imm);
        // NOTE: a[10][10][10]  func(a[10]) many_params1|2 chaos_token
        static int temp_for_array_address_compute = 1;
        int arg_num = ir.opn2_.imm_num_;
        for (int i = 1; i <= arg_num; ++i) {
          auto param_ir = **(ir_iter - i);
          auto val = ResolveOpn2Value(&(param_ir.opn1_), ssabb);
          if (param_ir.opn1_.type_ == Opn::Type::Array) {
            // 先把基址+偏移算到一个temp value里 再把temp value加到arg里 不必记录
            // param_ir.PrintIR(std::cout);
            auto offset_val = ResolveOpn2Value(param_ir.opn1_.offset_, ssabb) /*一定找得到 不会新加指令*/;
            auto final_address = new BinaryOperator(val->GetType(), BinaryOperator::ADD,
                                                    std::to_string(temp_for_array_address_compute++) + "-temp", val,
                                                    offset_val, call_inst);
            call_inst->AddArg(final_address);
          } else {
            call_inst->AddArg(val);
          }
        }
        break;
      }
      case ir::IR::OpKind::RET: {
        if (ir.opn1_.type_ != ir::Opn::Type::Null) {  // return int;
          auto ret_val = ResolveOpn2Value(&(ir.opn1_), ssabb);
          new ReturnInst(ret_val, ssabb);
        } else {  // return void;
          new ReturnInst(ssabb);
        }
        break;
      }
      case ir::IR::OpKind::GOTO: {
        auto bb_val = dynamic_cast<BasicBlockValue*>(ResolveOpn2Value(&(ir.opn1_), ssabb));
        MyAssert(nullptr != bb_val);
        new BranchInst(bb_val, ssabb);
        break;
      }
      case ir::IR::OpKind::ASSIGN: {
        auto val = ResolveOpn2Value(&(ir.opn1_), ssabb);
        auto res_comp_name = ir.res_.GetCompName();
        Value* res = nullptr;
        if (ir.res_.type_ != ir::Opn::Type::Array) {  // NOTE: consider array address
          if (0 == ir.res_.scope_id_) {
            auto glob_var = glob_map[res_comp_name];
            new StoreInst(val, glob_var, ssabb);

            // maintain used_glob_var
            ssafunc->AddUsedGlobVar(dynamic_cast<GlobalVariable*>(glob_var));
          } else {
            res = new MovInst(val->GetType(), res_comp_name, val, ssabb);
            work_map[res_comp_name] = res;
          }
        } else {
          auto arr_base_ptr = ResolveOpn2Value(&(ir.res_), ssabb);
          MyAssert(arr_base_ptr->GetType()->IsPointer());
          auto offset = ResolveOpn2Value(ir.res_.offset_, ssabb);
          new StoreInst(val, arr_base_ptr, offset, ssabb);
        }
        break;
      }
      case ir::IR::OpKind::ASSIGN_OFFSET: {
        MyAssert(ir.opn1_.type_ == ir::Opn::Type::Array);
        auto arr_base_ptr = ResolveOpn2Value(&(ir.opn1_), ssabb);
        MyAssert(arr_base_ptr->GetType()->IsPointer());
        auto offset = ResolveOpn2Value(ir.opn1_.offset_, ssabb);

        auto res_comp_name = ir.res_.GetCompName();
        auto res = new LoadInst(new Type(Type::IntegerTyID), res_comp_name, arr_base_ptr, offset, ssabb);
        ProcessResValue(res_comp_name, &(ir.res_), res, ssabb);
        break;
      }
      case ir::IR::OpKind::JEQ:
      case ir::IR::OpKind::JNE:
      case ir::IR::OpKind::JLT:
      case ir::IR::OpKind::JLE:
      case ir::IR::OpKind::JGT:
      case ir::IR::OpKind::JGE: {
        auto lhs = ResolveOpn2Value(&(ir.opn1_), ssabb);
        auto rhs = ResolveOpn2Value(&(ir.opn2_), ssabb);
        auto bb_val = dynamic_cast<BasicBlockValue*>(ResolveOpn2Value(&(ir.res_), ssabb));
        MyAssert(nullptr != bb_val);
        new BranchInst(static_cast<BranchInst::Cond>(GetOpKind(ir.op_)), lhs, rhs, bb_val, ssabb);
        break;
      }
      case ir::IR::OpKind::VOID: {
        MyAssert(0);
        break;
      }
      case ir::IR::OpKind::PHI: {
        MyAssert(0 != ir.res_.scope_id_);  // 不会出现全局变量的phi结点
        auto res_comp_name = ir.res_.GetCompName();
        auto phi_inst = new PhiInst(new Type(Type::IntegerTyID), res_comp_name, ssabb);
        // 此时有的变量还未定义 不能在现在填
        // for (int i = 0; i < ir.phi_args_.size(); ++i) {
        //   auto arg_val = ResolveOpn2Value(&ir.phi_args_[i], ssabb);
        //   phi_inst->AddParam(arg_val, bb_map[bb->pred_[i]]->GetValue());
        // }
        ProcessResValue(res_comp_name, &(ir.res_), phi_inst, ssabb);
        break;
      }
      case ir::IR::OpKind::ALLOCA: {
        // alloca opn - imm : alloca quad-ir only for array. regard opn as one dimensional array
        MyAssert(ir.res_.type_ == ir::Opn::Type::Imm);

        // create a value which owns i32 pointer type
        auto ptr_type = new Type(Type::PointerTyID);
        const auto& array_name = ir.opn1_.GetCompName();
        auto value = new Value(ptr_type, array_name);
        work_map[array_name] = value;

        // auto type = new ArrayType(ir.res_.imm_num_);
        // new AllocaInst(type, ssabb);
        new AllocaInst(new ConstantInt(ir.res_.imm_num_), value, ssabb);

        break;
      }
      case ir::IR::OpKind::DECLARE: {
        // 生成argument 记录映射 以防函数参数被认为是未定义变量
        auto arg_comp_name = ir.opn1_.GetCompName();
        if (ir.opn1_.type_ == Opn::Type::Var) {
          work_map[arg_comp_name] =
              new Argument(new Type(Type::IntegerTyID), arg_comp_name, ir.res_.imm_num_, ssafunc->GetValue());
        } else {
          work_map[arg_comp_name] =
              new Argument(new Type(Type::PointerTyID), arg_comp_name, ir.res_.imm_num_, ssafunc->GetValue());
        }
        break;
      }
      default: {
        MyAssert(0);
        break;
      }
    }  // end of ir_op switch
  }    // end of ir for loop
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdx, 0x20(%rsp)
movq %rsi, 0x38(%rsp)
testq %rsi, %rsi
je 0x437ec
movq %rdi, %rbp
leaq 0x38(%rsp), %rsi
movq %rcx, %rdi
callq 0x47296
movq (%rax), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x43861
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rbx
cmpq 0x10(%rax), %rbx
je 0x437ec
leaq 0xa8(%rbp), %rax
movq %rax, 0x18(%rsp)
leaq 0xe0(%rbp), %rax
movq %rax, 0x120(%rsp)
movl $0xc8, %eax
leaq 0x40(%rsp), %rcx
leaq (%rcx,%rax), %rdx
movq %rdx, 0x1e0(%rsp)
movl $0xa0, %edx
addq %rdx, %rcx
movq %rcx, 0x1d8(%rsp)
leaq 0x1f8(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x1f0(%rsp)
addq %rcx, %rdx
movq %rdx, 0x1e8(%rsp)
leaq 0x4cd48(%rip), %rax     # 0x8f848
addq $0x10, %rax
movq %rax, 0x1b0(%rsp)
movq %rbp, 0x28(%rsp)
movq %rbx, 0x128(%rsp)
movq (%rbx), %rsi
leaq 0x1f8(%rsp), %rdi
callq 0x448ac
movl 0x1f8(%rsp), %eax
cmpq $0x17, %rax
ja 0x43c44
leaq 0x2fba7(%rip), %rcx     # 0x726e8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbp, %rdi
leaq 0x200(%rsp), %rsi
movq 0x10(%rsp), %r15
movq %r15, %rdx
callq 0x4108c
movq %rax, %rbx
movq %rbp, %rdi
leaq 0x240(%rsp), %rsi
movq %r15, %rdx
callq 0x4108c
movq %rax, %r14
movq %rbp, %rdi
leaq 0x280(%rsp), %rsi
movq %r15, %rdx
callq 0x4108c
testq %rax, %rax
je 0x42cce
movq %rax, %rdi
leaq 0x4c90f(%rip), %rsi     # 0x8f4b0
leaq 0x4c948(%rip), %rdx     # 0x8f4f0
xorl %ecx, %ecx
callq 0x8320
movq %rax, %r15
jmp 0x42cd1
movq %rbp, %rdi
leaq 0x200(%rsp), %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x4108c
movq %rax, %r14
movq %rbp, %rdi
leaq 0x240(%rsp), %rsi
movq %rbx, %rdx
callq 0x4108c
movq %rax, %r15
leaq 0x40(%rsp), %rdi
leaq 0x280(%rsp), %rsi
callq 0x283ba
movl $0x70, %edi
callq 0x8290
movq %rax, %rbx
movl $0x10, %edi
callq 0x8290
leaq 0x190(%rsp), %r13
movq %rax, %r12
leaq 0x4cc9d(%rip), %rax     # 0x8f8c0
movq %rax, (%r12)
movl $0x2, 0x8(%r12)
movl 0x1f8(%rsp), %ebp
leaq 0x1a0(%rsp), %rax
movq %rax, 0x190(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0xca10
movl %ebp, %edi
callq 0x4155b
movq 0x10(%rsp), %rcx
movq %rcx, (%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movl %eax, %edx
movq %r13, %rcx
movq %r14, %r8
movq %r15, %r9
callq 0x44964
movq 0x190(%rsp), %rdi
leaq 0x1a0(%rsp), %rax
cmpq %rax, %rdi
movq 0x28(%rsp), %rbp
je 0x42cac
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x82a0
movq %rbp, %rdi
leaq 0x40(%rsp), %rsi
leaq 0x280(%rsp), %rdx
movq %rbx, %rcx
movq 0x10(%rsp), %r8
callq 0x40f80
jmp 0x432c0
xorl %r15d, %r15d
testq %r15, %r15
je 0x437fe
movl $0x70, %edi
callq 0x8290
movq %rax, %r12
movl 0x1f8(%rsp), %edi
callq 0x4155b
movq %r12, %rdi
movl %eax, %esi
movq %rbx, %rdx
movq %r14, %rcx
movq %r15, %r8
movq 0x10(%rsp), %r9
callq 0x454dc
jmp 0x432dc
movq %rbp, %rdi
leaq 0x200(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x4108c
movq %rax, %r14
leaq 0x40(%rsp), %rdi
leaq 0x280(%rsp), %rsi
callq 0x283ba
movl $0x70, %edi
callq 0x8290
movq %rax, %rbx
movl $0x10, %edi
callq 0x8290
leaq 0x170(%rsp), %r12
movq %rax, %r15
leaq 0x4cb5d(%rip), %rax     # 0x8f8c0
movq %rax, (%r15)
movl $0x2, 0x8(%r15)
movl 0x1f8(%rsp), %ebp
leaq 0x180(%rsp), %rax
movq %rax, 0x170(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0xca10
movl %ebp, %edi
callq 0x4155b
movq %rbx, %rdi
movq %r15, %rsi
movl %eax, %edx
movq %r12, %rcx
movq %r14, %r8
movq 0x10(%rsp), %r9
callq 0x44a5a
movq 0x170(%rsp), %rdi
leaq 0x180(%rsp), %rax
cmpq %rax, %rdi
movq 0x28(%rsp), %rbp
je 0x42de3
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x82a0
movq %rbp, %rdi
leaq 0x40(%rsp), %rsi
leaq 0x280(%rsp), %rdx
movq %rbx, %rcx
movq 0x10(%rsp), %r8
callq 0x40f80
jmp 0x432c0
leaq 0x40(%rsp), %rdi
leaq 0x200(%rsp), %rsi
callq 0x283ba
cmpl $0x0, 0x200(%rsp)
je 0x43265
movl $0x50, %edi
callq 0x8290
movq %rax, %rbx
movl $0x10, %edi
callq 0x8290
leaq 0x40(%rsp), %r14
leaq 0x4ca78(%rip), %rcx     # 0x8f8c0
movq %rcx, (%rax)
movl $0x4, 0x8(%rax)
movl 0x284(%rsp), %ecx
movq 0x20(%rsp), %rdx
movq 0x28(%rdx), %r8
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x45810
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x46b20
jmp 0x432bd
movq %rbp, %rdi
leaq 0x200(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x4108c
testq %rax, %rax
je 0x43375
movq %rax, %rdi
leaq 0x4c606(%rip), %rsi     # 0x8f4b0
leaq 0x4c63f(%rip), %rdx     # 0x8f4f0
xorl %ecx, %ecx
callq 0x8320
movq %rax, %rbx
jmp 0x43377
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
leaq 0x200(%rsp), %rsi
callq 0x283ba
movq 0x120(%rsp), %rdi
movq %rbx, %rsi
callq 0x46e8a
movq (%rax), %rdi
testq %rdi, %rdi
je 0x433a2
leaq 0x4c5b8(%rip), %rsi     # 0x8f4b0
leaq 0x4c609(%rip), %rdx     # 0x8f508
xorl %ecx, %ecx
callq 0x8320
movq %rax, %rbx
jmp 0x433a4
movq %rbp, %rdi
leaq 0x200(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x4108c
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
leaq 0x280(%rsp), %rsi
callq 0x283ba
cmpl $0x5, 0x280(%rsp)
jne 0x4321c
movq %rbp, %rdi
leaq 0x280(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x4108c
movq %rax, %r14
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
testb %al, %al
je 0x43caa
movq 0x2b0(%rsp), %rsi
movq %rbp, %rdi
movq 0x10(%rsp), %rdx
callq 0x4108c
movq %rax, %r12
movl $0x68, %edi
callq 0x8290
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r12, %rcx
movq 0x10(%rsp), %r8
callq 0x45236
jmp 0x432c0
cmpl $0x4, 0x200(%rsp)
jne 0x431e2
movl $0x68, %edi
callq 0x8290
movq %rax, %rbx
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x44fb2
jmp 0x432dc
cmpl $0x1, 0x280(%rsp)
jne 0x439e0
movl $0x10, %edi
callq 0x8290
movq %rax, %r14
leaq 0x4c8c1(%rip), %rax     # 0x8f8c0
movq %rax, (%r14)
movl $0x4, 0x8(%r14)
leaq 0x40(%rsp), %rdi
leaq 0x200(%rsp), %rsi
callq 0x283ba
movl $0x48, %edi
callq 0x8290
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
leaq 0x40(%rsp), %r14
movq %r14, %rdx
callq 0x34990
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x46b20
movq %rbx, (%rax)
movl $0x68, %edi
callq 0x8290
movq %rax, %r15
movl $0x50, %edi
callq 0x8290
movq %rax, %r12
movl 0x284(%rsp), %esi
movq %rax, %rdi
callq 0x4454c
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x456a6
jmp 0x432c0
cmpl $0x5, 0x200(%rsp)
jne 0x43aac
movq %rbp, %rdi
leaq 0x200(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x4108c
movq %rax, %rbx
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
testb %al, %al
je 0x43b12
movq 0x230(%rsp), %rsi
movq %rbp, %rdi
movq 0x10(%rsp), %rdx
callq 0x4108c
movq %rax, %r14
leaq 0x40(%rsp), %rdi
leaq 0x280(%rsp), %rsi
callq 0x283ba
movl $0x68, %edi
callq 0x8290
movq %rax, %r15
movl $0x10, %edi
callq 0x8290
leaq 0x40(%rsp), %r12
movq 0x10(%rsp), %r13
leaq 0x4c7a9(%rip), %rcx     # 0x8f8c0
movq %rcx, (%rax)
movl $0x2, 0x8(%rax)
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
movq %rbx, %rcx
movq %r14, %r8
movq %r13, %r9
callq 0x45400
movq %rbp, %rdi
movq %r12, %rsi
leaq 0x280(%rsp), %rdx
movq %r15, %rcx
movq %r13, %r8
callq 0x40f80
jmp 0x432c0
cmpl $0x0, 0x2a8(%rsp)
je 0x43a46
leaq 0x40(%rsp), %rdi
leaq 0x280(%rsp), %rsi
callq 0x283ba
movl $0x68, %edi
callq 0x8290
movq %rax, %rbx
movl $0x10, %edi
callq 0x8290
leaq 0x40(%rsp), %r14
movq 0x10(%rsp), %r15
leaq 0x4c722(%rip), %rcx     # 0x8f8c0
movq %rcx, (%rax)
movl $0x2, 0x8(%rax)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x33568
movq 0x1b0(%rsp), %rax
movq %rax, (%rbx)
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x280(%rsp), %rdx
movq %rbx, %rcx
movq %r15, %r8
callq 0x40f80
jmp 0x432c0
movq %rbp, %rdi
leaq 0x200(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x4108c
movq %rax, %r14
movl $0x68, %edi
callq 0x8290
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq 0x10(%rsp), %rdx
callq 0x44e88
jmp 0x432dc
cmpl $0x0, 0x2a8(%rsp)
je 0x43784
movl $0x68, %edi
callq 0x8290
movq %rax, %r15
movq 0x8(%rbx), %rsi
movq %rax, %rdi
leaq 0x40(%rsp), %r14
movq %r14, %rdx
movq %rbx, %rcx
movq 0x10(%rsp), %r8
callq 0x45198
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x46b20
movq %r15, (%rax)
jmp 0x432c0
movl $0x50, %edi
callq 0x8290
movq %rax, %rbx
movl $0x10, %edi
callq 0x8290
leaq 0x40(%rsp), %r14
leaq 0x4c638(%rip), %rcx     # 0x8f8c0
movq %rcx, (%rax)
movl $0x2, 0x8(%rax)
movl 0x284(%rsp), %ecx
movq 0x20(%rsp), %rdx
movq 0x28(%rdx), %r8
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x45810
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x46b20
movq %rbx, (%rax)
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x432dc
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x1f0(%rsp), %rdi
callq 0x2b2f6
movq 0x288(%rsp), %rdi
cmpq 0x1e8(%rsp), %rdi
je 0x4330b
movq 0x298(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x248(%rsp), %rdi
leaq 0x258(%rsp), %rax
cmpq %rax, %rdi
movq 0x128(%rsp), %rbx
je 0x43338
movq 0x258(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x208(%rsp), %rdi
leaq 0x218(%rsp), %rax
cmpq %rax, %rdi
je 0x4335d
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x82a0
addq $0x8, %rbx
movq 0x38(%rsp), %rax
cmpq 0x10(%rax), %rbx
jne 0x42b11
jmp 0x437ec
xorl %ebx, %ebx
testq %rbx, %rbx
je 0x43b78
movl $0x70, %edi
callq 0x8290
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
movq 0x10(%rsp), %rdx
callq 0x45066
jmp 0x432dc
xorl %ebx, %ebx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x433c0
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x82a0
testq %rbx, %rbx
je 0x43914
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x35600
cmpl $0x4, 0x280(%rsp)
jne 0x43402
movl $0x68, %edi
callq 0x8290
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movq 0x10(%rsp), %rdx
callq 0x44afc
jmp 0x4348f
leaq 0x40(%rsp), %rdi
leaq 0x280(%rsp), %rsi
callq 0x283ba
movl $0x68, %edi
callq 0x8290
movq %rax, %r12
movl $0x10, %edi
callq 0x8290
leaq 0x40(%rsp), %r14
movq 0x10(%rsp), %r15
leaq 0x4c484(%rip), %rcx     # 0x8f8c0
movq %rcx, (%rax)
movl $0x2, 0x8(%rax)
movq %r12, %rdi
movq %rax, %rsi
movq %r14, %rdx
movq %rbx, %rcx
movq %r15, %r8
callq 0x44c26
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x280(%rsp), %rdx
movq %r12, %rcx
movq %r15, %r8
callq 0x40f80
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x4348f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x82a0
cmpl $0x1, 0x240(%rsp)
jne 0x43bde
movl 0x244(%rsp), %r14d
testl %r14d, %r14d
jle 0x432dc
incq %r14
movl $0x1, %ebx
movq %r14, 0x1b8(%rsp)
leaq (,%rbx,8), %rax
movq 0x128(%rsp), %rcx
subq %rax, %rcx
movq (%rcx), %rsi
leaq 0x40(%rsp), %rdi
callq 0x448ac
movq %rbp, %rdi
leaq 0x48(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x4108c
movq %rax, %r15
cmpl $0x5, 0x48(%rsp)
jne 0x43596
movq 0x78(%rsp), %rsi
movq %rbp, %rdi
movq 0x10(%rsp), %rdx
callq 0x4108c
movq %rax, %r13
movl $0x70, %edi
callq 0x8290
movq %r15, 0x1d0(%rsp)
movq 0x8(%r15), %rcx
movq %rcx, 0x1c0(%rsp)
movl 0x4cdcc(%rip), %r15d    # 0x90304
leal 0x1(%r15), %ecx
movl %ecx, 0x4cdc2(%rip)     # 0x90304
movl %r15d, %ebp
negl %ebp
cmovsl %r15d, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0x435af
movl $0x4, %r14d
movl %ebp, %esi
cmpl $0x63, %esi
jbe 0x435a6
cmpl $0x3e7, %esi            # imm = 0x3E7
jbe 0x435ac
cmpl $0x2710, %esi           # imm = 0x2710
jb 0x435af
movl %esi, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r14d
cmpl $0x1869f, %esi          # imm = 0x1869F
movl %ecx, %esi
ja 0x4355e
addl $-0x3, %r14d
jmp 0x435af
movq %r12, %rdi
movq %r15, %rsi
callq 0x44dba
jmp 0x43703
addl $-0x2, %r14d
jmp 0x435af
decl %r14d
movq %rbx, 0x1c8(%rsp)
movq %r13, %rbx
movq %rax, 0x30(%rsp)
movq %r12, %r13
shrl $0x1f, %r15d
leal (%r14,%r15), %esi
leaq 0x160(%rsp), %rax
movq %rax, 0x150(%rsp)
leaq 0x150(%rsp), %r12
movq %r12, %rdi
movl $0x2d, %edx
callq 0x8350
addq 0x150(%rsp), %r15
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0xc65b
movq %r12, %rdi
leaq 0x2f1bc(%rip), %rsi     # 0x727ca
callq 0x8590
leaq 0x140(%rsp), %rsi
movq %rsi, 0x130(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
movq 0x28(%rsp), %rbp
movq %r13, %r12
movq 0x1b8(%rsp), %r14
je 0x43657
movq %rdx, 0x130(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x140(%rsp)
jmp 0x4365d
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x30(%rsp), %r15
movq 0x8(%rax), %rdx
movq %rdx, 0x138(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r12, (%rsp)
movq %r15, %rdi
movq 0x1c0(%rsp), %rsi
xorl %edx, %edx
leaq 0x130(%rsp), %rcx
movq 0x1d0(%rsp), %r8
movq %rbx, %r9
callq 0x44cc4
movq 0x1c8(%rsp), %rbx
movq 0x130(%rsp), %rdi
leaq 0x140(%rsp), %rax
cmpq %rax, %rdi
je 0x436d3
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x150(%rsp), %rdi
leaq 0x160(%rsp), %rax
cmpq %rax, %rdi
je 0x436f8
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x82a0
movq %r12, %rdi
movq %r15, %rsi
callq 0x44dba
movq 0x1e0(%rsp), %rdi
callq 0x2b2f6
movq 0xd0(%rsp), %rdi
cmpq 0x1d8(%rsp), %rdi
je 0x43732
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x43757
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x43773
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x82a0
incq %rbx
cmpq %r14, %rbx
jne 0x434be
jmp 0x432dc
movq 0x120(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x46b20
movq (%rax), %r14
movl $0x68, %edi
callq 0x8290
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq 0x10(%rsp), %rcx
callq 0x443e2
testq %r14, %r14
je 0x437db
movq %r14, %rdi
leaq 0x4bce8(%rip), %rsi     # 0x8f4b0
leaq 0x4bcf1(%rip), %rdx     # 0x8f4c0
xorl %ecx, %ecx
callq 0x8320
movq %rax, %rsi
jmp 0x437dd
xorl %esi, %esi
movq 0x20(%rsp), %rdi
callq 0x3567c
jmp 0x432c0
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4c7eb(%rip), %rdi     # 0x8fff0
leaq 0x2b95c(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x4c7d3(%rip), %rdi     # 0x8fff0
leaq 0x2ef80(%rip), %rsi     # 0x727a4
movl $0x18, %edx
callq 0x8330
movq 0x4c7bb(%rip), %rdi     # 0x8fff0
leaq 0x2cb84(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x4c7a3(%rip), %rdi     # 0x8fff0
movl $0x19c, %esi            # imm = 0x19C
callq 0x8520
movq %rax, %rdi
callq 0x8180
jmp 0x438a7
movq 0x4c788(%rip), %rdi     # 0x8fff0
leaq 0x2b8f9(%rip), %rsi     # 0x6f168
callq 0x8280
leaq 0x2ef29(%rip), %rsi     # 0x727a4
movq %rax, %rdi
callq 0x8280
leaq 0x2cb36(%rip), %rsi     # 0x703c0
movq %rax, %rdi
callq 0x8280
movq %rax, %rdi
movl $0x113, %esi            # imm = 0x113
callq 0x8520
movq %rax, %rdi
callq 0x8180
movl $0xff, %edi
callq 0x8380
movq 0x4c738(%rip), %rdi     # 0x8fff0
leaq 0x2b8a9(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x4c720(%rip), %rdi     # 0x8fff0
leaq 0x2eecd(%rip), %rsi     # 0x727a4
movl $0x18, %edx
callq 0x8330
movq 0x4c708(%rip), %rdi     # 0x8fff0
leaq 0x2cad1(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x4c6f0(%rip), %rdi     # 0x8fff0
movl $0x1a1, %esi            # imm = 0x1A1
callq 0x8520
movq %rax, %rdi
callq 0x8180
jmp 0x438a7
movq 0x4c6d5(%rip), %rdi     # 0x8fff0
leaq 0x2b846(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x4c6bd(%rip), %rdi     # 0x8fff0
leaq 0x2ee6a(%rip), %rsi     # 0x727a4
movl $0x18, %edx
callq 0x8330
movq 0x4c6a5(%rip), %rdi     # 0x8fff0
leaq 0x2ca6e(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x4c68d(%rip), %rdi     # 0x8fff0
movl $0x13f, %esi            # imm = 0x13F
callq 0x8520
movq %rax, %rdi
callq 0x8180
jmp 0x438a7
movq 0x4c66f(%rip), %rdi     # 0x8fff0
leaq 0x2b7e0(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x4c657(%rip), %rdi     # 0x8fff0
leaq 0x2ee04(%rip), %rsi     # 0x727a4
movl $0x18, %edx
callq 0x8330
movq 0x4c63f(%rip), %rdi     # 0x8fff0
leaq 0x2ca08(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x4c627(%rip), %rdi     # 0x8fff0
movl $0x137, %esi            # imm = 0x137
callq 0x8520
movq %rax, %rdi
callq 0x8180
jmp 0x438a7
movq 0x4c609(%rip), %rdi     # 0x8fff0
leaq 0x2b77a(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x4c5f1(%rip), %rdi     # 0x8fff0
leaq 0x2ed9e(%rip), %rsi     # 0x727a4
movl $0x18, %edx
callq 0x8330
movq 0x4c5d9(%rip), %rdi     # 0x8fff0
leaq 0x2c9a2(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x4c5c1(%rip), %rdi     # 0x8fff0
movl $0x1b2, %esi            # imm = 0x1B2
callq 0x8520
movq %rax, %rdi
callq 0x8180
jmp 0x438a7
movq 0x4c5a3(%rip), %rdi     # 0x8fff0
leaq 0x2b714(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x4c58b(%rip), %rdi     # 0x8fff0
leaq 0x2ed38(%rip), %rsi     # 0x727a4
movl $0x18, %edx
callq 0x8330
movq 0x4c573(%rip), %rdi     # 0x8fff0
leaq 0x2c93c(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x4c55b(%rip), %rdi     # 0x8fff0
movl $0x1a5, %esi            # imm = 0x1A5
callq 0x8520
movq %rax, %rdi
callq 0x8180
jmp 0x438a7
movq 0x4c53d(%rip), %rdi     # 0x8fff0
leaq 0x2b6ae(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x4c525(%rip), %rdi     # 0x8fff0
leaq 0x2ecd2(%rip), %rsi     # 0x727a4
movl $0x18, %edx
callq 0x8330
movq 0x4c50d(%rip), %rdi     # 0x8fff0
leaq 0x2c8d6(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x4c4f5(%rip), %rdi     # 0x8fff0
movl $0x189, %esi            # imm = 0x189
callq 0x8520
movq %rax, %rdi
callq 0x8180
jmp 0x438a7
movq 0x4c4d7(%rip), %rdi     # 0x8fff0
leaq 0x2b648(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x4c4bf(%rip), %rdi     # 0x8fff0
leaq 0x2ec6c(%rip), %rsi     # 0x727a4
movl $0x18, %edx
callq 0x8330
movq 0x4c4a7(%rip), %rdi     # 0x8fff0
leaq 0x2c870(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x4c48f(%rip), %rdi     # 0x8fff0
movl $0x18b, %esi            # imm = 0x18B
callq 0x8520
movq %rax, %rdi
callq 0x8180
jmp 0x438a7
movq 0x4c471(%rip), %rdi     # 0x8fff0
leaq 0x2b5e2(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x4c459(%rip), %rdi     # 0x8fff0
leaq 0x2ec06(%rip), %rsi     # 0x727a4
movl $0x18, %edx
callq 0x8330
movq 0x4c441(%rip), %rdi     # 0x8fff0
leaq 0x2c80a(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x4c429(%rip), %rdi     # 0x8fff0
movl $0x16d, %esi            # imm = 0x16D
callq 0x8520
movq %rax, %rdi
callq 0x8180
jmp 0x438a7
movq 0x4c40b(%rip), %rdi     # 0x8fff0
leaq 0x2b57c(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x4c3f3(%rip), %rdi     # 0x8fff0
leaq 0x2eba0(%rip), %rsi     # 0x727a4
movl $0x18, %edx
callq 0x8330
movq 0x4c3db(%rip), %rdi     # 0x8fff0
leaq 0x2c7a4(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x4c3c3(%rip), %rdi     # 0x8fff0
movl $0x14d, %esi            # imm = 0x14D
callq 0x8520
movq %rax, %rdi
callq 0x8180
jmp 0x438a7
movq 0x4c3a5(%rip), %rdi     # 0x8fff0
leaq 0x2b516(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x4c38d(%rip), %rdi     # 0x8fff0
leaq 0x2eb3a(%rip), %rsi     # 0x727a4
movl $0x18, %edx
callq 0x8330
movq 0x4c375(%rip), %rdi     # 0x8fff0
leaq 0x2c73e(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x4c35d(%rip), %rdi     # 0x8fff0
movl $0x1cd, %esi            # imm = 0x1CD
callq 0x8520
movq %rax, %rdi
callq 0x8180
jmp 0x438a7
movq 0x4c33f(%rip), %rdi     # 0x8fff0
leaq 0x2b4b0(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x4c327(%rip), %rdi     # 0x8fff0
leaq 0x2ead4(%rip), %rsi     # 0x727a4
movl $0x18, %edx
callq 0x8330
movq 0x4c30f(%rip), %rdi     # 0x8fff0
leaq 0x2c6d8(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x4c2f7(%rip), %rdi     # 0x8fff0
movl $0x182, %esi            # imm = 0x182
callq 0x8520
movq %rax, %rdi
callq 0x8180
jmp 0x438a7
jmp 0x43e2a
jmp 0x43e2a
jmp 0x43f66
movq %rax, %r14
movl $0x68, %esi
jmp 0x43ed5
jmp 0x43f8b
jmp 0x43f8b
jmp 0x43d3d
jmp 0x43f8b
movq %rax, %r14
movl $0x68, %esi
movq %rbx, %rdi
jmp 0x43f80
jmp 0x43e2a
jmp 0x43f66
jmp 0x43f66
jmp 0x43dff
jmp 0x43f8b
jmp 0x43f8b
jmp 0x43f8b
jmp 0x43f8b
jmp 0x43f66
movq %rax, %r14
movl $0x68, %esi
movq %r12, %rdi
jmp 0x43f5f
jmp 0x43f8b
jmp 0x43f66
jmp 0x43f8b
jmp 0x43f8b
movq %rax, %r14
movl $0x70, %esi
movq %r15, %rdi
jmp 0x43f80
jmp 0x43f66
jmp 0x43f66
jmp 0x43f8b
jmp 0x43f8b
jmp 0x43f8b
jmp 0x43f8b
jmp 0x43f8b
movq %rax, %r14
movl $0x50, %esi
movq %r12, %rdi
callq 0x82a0
jmp 0x43e2d
movq %rax, %r14
movl $0x48, %esi
jmp 0x43f5c
jmp 0x43f8b
jmp 0x43f8b
jmp 0x43f8b
movq %rax, %r14
movl $0x50, %esi
jmp 0x43f5c
jmp 0x43f66
jmp 0x43e2a
jmp 0x43f8b
jmp 0x43f66
movq %rax, %r14
movl $0x68, %esi
jmp 0x43f5c
movq %rax, %r14
movl $0x68, %esi
movq %r15, %rdi
jmp 0x43f5f
jmp 0x43f66
movq %rax, %r14
movq 0x170(%rsp), %rdi
leaq 0x180(%rsp), %rax
cmpq %rax, %rdi
je 0x43f57
movq 0x180(%rsp), %rsi
jmp 0x43eb1
jmp 0x43f8b
jmp 0x43f8b
jmp 0x43f8b
jmp 0x43f66
jmp 0x43f66
jmp 0x43f54
jmp 0x43f8b
jmp 0x43f8b
movq %rax, %r14
movq 0x190(%rsp), %rdi
leaq 0x1a0(%rsp), %rax
cmpq %rax, %rdi
je 0x43f57
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x82a0
jmp 0x43f57
jmp 0x43f8b
jmp 0x43f8b
jmp 0x43f8b
movq %rax, %r14
movl $0x70, %esi
movq %r12, %rdi
jmp 0x43f80
jmp 0x43f8b
jmp 0x43f8b
jmp 0x43f90
movq %rax, %r14
jmp 0x43f1e
movq %rax, %r14
jmp 0x43f43
movq %rax, %r14
movq 0x130(%rsp), %rdi
leaq 0x140(%rsp), %rax
cmpq %rax, %rdi
je 0x43f1e
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x150(%rsp), %rdi
leaq 0x160(%rsp), %rax
cmpq %rax, %rdi
je 0x43f43
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x82a0
movl $0x70, %esi
movq 0x30(%rsp), %rdi
callq 0x82a0
jmp 0x43f93
movq %rax, %r14
movl $0x70, %esi
movq %rbx, %rdi
callq 0x82a0
jmp 0x43f69
movq %rax, %r14
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x43f9d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x82a0
jmp 0x43f9d
jmp 0x43f8b
jmp 0x43f90
movq %rax, %r14
jmp 0x43f9d
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x44e26
leaq 0x1f8(%rsp), %rdi
callq 0x44e26
movq %r14, %rdi
callq 0x8540