// File: /workspace/github_cpp_makefile_star2_O1/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, 0x18(%rsp)
movq %rdi, 0x40(%rsp)
movq 0x30(%rsi), %rax
movq 0x38(%rsi), %rcx
movq %rcx, 0x20(%rsp)
cmpq %rcx, %rax
je 0x4418a
movq %rax, 0x28(%rsp)
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x47296
movq (%rax), %r15
leaq 0x28(%r15), %rax
movq %rax, 0x30(%rsp)
movq %rax, %rbx
xorl %ebp, %ebp
movq (%rbx), %rbx
cmpq 0x30(%rsp), %rbx
je 0x44176
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x44041
leaq 0x4b3ca(%rip), %rsi     # 0x8f3f8
leaq 0x4b83b(%rip), %rdx     # 0x8f870
xorl %ecx, %ecx
callq 0x8320
movq %rax, %r13
jmp 0x44044
xorl %r13d, %r13d
testq %r13, %r13
je 0x4416d
movq %rbx, 0x38(%rsp)
movq 0x8(%rsp), %rax
movl %ebp, 0x14(%rsp)
movslq %ebp, %rcx
movq 0x8(%rax), %rax
movq (%rax,%rcx,8), %rsi
leaq 0x48(%rsp), %rdi
callq 0x448ac
movq 0x110(%rsp), %rsi
cmpq %rsi, 0x118(%rsp)
je 0x440ef
xorl %r12d, %r12d
xorl %ebx, %ebx
xorl %r14d, %r14d
addq %r12, %rsi
movq 0x40(%rsp), %rdi
movq %r15, %rdx
callq 0x4108c
movq %rax, %rbp
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rsi
addq %rbx, %rsi
movq 0x18(%rsp), %rdi
callq 0x47296
movq (%rax), %rax
movq 0xc8(%rax), %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4586a
incq %r14
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rax
subq %rsi, %rax
sarq $0x6, %rax
addq $0x8, %rbx
addq $0x40, %r12
cmpq %r14, %rax
ja 0x4408a
leaq 0x110(%rsp), %rdi
callq 0x2b2f6
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x44121
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
movq 0x38(%rsp), %rbx
je 0x4414b
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
movl 0x14(%rsp), %ebp
je 0x4416b
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x82a0
incl %ebp
testq %r13, %r13
jne 0x44010
movq 0x28(%rsp), %rax
addq $0x8, %rax
cmpq 0x20(%rsp), %rax
jne 0x43fe3
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x110(%rsp), %r14
movq %r14, %rdi
callq 0x2b2f6
movq -0x38(%r14), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x441d0
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x82a0
leaq 0x48(%rsp), %rdi
callq 0x8cfb
movq %rbx, %rdi
callq 0x8540