// File: /workspace/github_cpp_makefile_star2_O3/luooofan[P]hblzbd_compiler/src/Pass/convert_ssa.cpp
// Function: ConvertSSA::FillPhiInst(IRFunction*, SSAFunction*, std::unordered_map<IRBasicBlock*, SSABasicBlock*, std::hash<IRBasicBlock*>, std::equal_to<IRBasicBlock*>, std::allocator<std::pair<IRBasicBlock* const, SSABasicBlock*>>>&)
void ConvertSSA::FillPhiInst(IRFunction* irfunc, SSAFunction* ssafunc,
                             std::unordered_map<IRBasicBlock*, SSABasicBlock*>& bb_map) {
  // 遍历每个irbb 如果bb开头有phi结点 就填充对应的ssabb中的phi结点
  for (auto bb : irfunc->bb_list_) {
    auto ssabb = bb_map[bb];
    int i = 0;
    for (auto ssa_inst : ssabb->GetInstList()) {
      if (auto phi_inst = dynamic_cast<PhiInst*>(ssa_inst)) {
        auto ir = *(bb->ir_list_[i]);
        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());
        }
        ++i;
      } else {
        break;
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rcx, 0x10(%rsp)
movq %rdi, 0x40(%rsp)
movq 0x30(%rsi), %rax
movq 0x38(%rsi), %rcx
movq %rcx, 0x18(%rsp)
cmpq %rcx, %rax
je 0x439e1
movq %rax, 0x20(%rsp)
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x46ac4
movq (%rax), %rbx
leaq 0x28(%rbx), %rax
movq 0x28(%rbx), %r14
movq %rax, 0x28(%rsp)
cmpq %rax, %r14
je 0x439cd
xorl %r15d, %r15d
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x439cd
leaq 0x4ab43(%rip), %rsi     # 0x8e3c8
leaq 0x4afb4(%rip), %rdx     # 0x8e840
xorl %ecx, %ecx
callq 0x8320
testq %rax, %rax
je 0x439cd
movq %rax, %r12
movq %r14, 0x38(%rsp)
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq %r15, 0x30(%rsp)
movq (%rax,%r15,8), %rsi
leaq 0x48(%rsp), %rdi
callq 0x44118
movq 0x110(%rsp), %rsi
cmpq %rsi, 0x118(%rsp)
je 0x4393f
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %ebp, %ebp
addq %r14, %rsi
movq 0x40(%rsp), %rdi
movq %rbx, %rdx
callq 0x4091a
movq %rax, %r15
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rsi
addq %r13, %rsi
movq 0x10(%rsp), %rdi
callq 0x46ac4
movq (%rax), %rax
movq 0xc8(%rax), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x450d6
incq %rbp
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rax
subq %rsi, %rax
sarq $0x6, %rax
addq $0x8, %r13
addq $0x40, %r14
cmpq %rbp, %rax
ja 0x438da
leaq 0x110(%rsp), %rdi
callq 0x2b81c
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x43971
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
movq 0x38(%rsp), %r14
je 0x4399b
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
movq 0x30(%rsp), %r15
je 0x439bc
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x82a0
incq %r15
movq (%r14), %r14
cmpq 0x28(%rsp), %r14
jne 0x43871
movq 0x20(%rsp), %rax
addq $0x8, %rax
cmpq 0x18(%rsp), %rax
jne 0x43839
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x2b81c
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x43a28
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x82a0
leaq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x58(%rsp), %rdx
leaq 0x68(%rsp), %rcx
callq 0x8b3b
movq %rbx, %rdi
callq 0x8540