// File: /workspace/github_cpp_makefile_star2_O2/luooofan[P]hblzbd_compiler/src/ssa_struct.cpp
// Function: SSAFunction::EmitCode(std::ostream&)
void SSAFunction::EmitCode(std::ostream& out) {
  out << func_name_ << ":" << std::endl;
  out << "; Function Begin:" << std::endl;
  out << "  ; called by func: ";
  for (auto called_func_use : value_->GetUses()) {
    // called_func_use->Get()->Print();
    auto inst = dynamic_cast<SSAInstruction*>(called_func_use->GetUser());
    MyAssert(nullptr != inst);
    out << inst->GetParent()->GetFunction()->GetFuncName() << " ";
  }
  out << std::endl;
  out << "  ; call func: ";
  for (auto call_func : call_func_list_) {
    out << call_func->GetFuncName() << " ";
  }
  out << std::endl;
  out << "  ; used global var: ";
  for (auto glob_var : used_glob_var_list_) {
    out << glob_var->GetName() << " ";
  }
  out << std::endl;
  for (auto bb : bb_list_) {
    bb->EmitCode(out);
    out << std::endl;
  }
  out << "; Function End." << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movq %r14, %rsi
callq 0x8230
leaq 0x2ecfb(%rip), %rsi     # 0x57320
movq %rax, %rdi
callq 0x8240
movq %rax, %rdi
callq 0x8170
leaq 0x30e63(%rip), %rsi     # 0x5949f
movq %rbx, %rdi
callq 0x8240
movq %rax, %rdi
callq 0x8170
leaq 0x30e5e(%rip), %rsi     # 0x594b1
movq %rbx, %rdi
callq 0x8240
movq %r14, (%rsp)
movq 0x28(%r14), %r14
addq $0x10, %r14
leaq 0x57f52(%rip), %r15     # 0x805c0
leaq 0x57d53(%rip), %r12     # 0x803c8
leaq 0x2dcb6(%rip), %r13     # 0x56332
movq %r14, %rbp
movq (%rbp), %rbp
cmpq %r14, %rbp
je 0x286cb
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x287b0
movq %r15, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x82c0
testq %rax, %rax
je 0x287b0
movq 0x60(%rax), %rax
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x8230
movq %rax, %rdi
movq %r13, %rsi
callq 0x8240
jmp 0x2867f
movq %rbx, %rdi
callq 0x8170
leaq 0x30dec(%rip), %rsi     # 0x594c6
movq %rbx, %rdi
callq 0x8240
movq (%rsp), %r12
leaq 0x58(%r12), %r14
leaq 0x2dc40(%rip), %r15     # 0x56332
movq (%r14), %r14
testq %r14, %r14
je 0x28713
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x8230
movq %rax, %rdi
movq %r15, %rsi
callq 0x8240
jmp 0x286f2
movq %rbx, %rdi
callq 0x8170
leaq 0x30db4(%rip), %rsi     # 0x594d6
movq %rbx, %rdi
callq 0x8240
leaq 0x90(%r12), %r14
leaq 0x2dbf9(%rip), %r15     # 0x56332
movq (%r14), %r14
testq %r14, %r14
je 0x2875e
movq 0x8(%r14), %rsi
addq $0x28, %rsi
movq %rbx, %rdi
callq 0x8230
movq %rax, %rdi
movq %r15, %rsi
callq 0x8240
jmp 0x28739
movq %rbx, %rdi
callq 0x8170
addq $0x30, %r12
movq %r12, %r14
movq (%r14), %r14
cmpq %r12, %r14
je 0x2878b
movq 0x10(%r14), %rdi
movq %rbx, %rsi
callq 0x28800
movq %rbx, %rdi
callq 0x8170
jmp 0x2876d
leaq 0x30d5a(%rip), %rsi     # 0x594ec
movq %rbx, %rdi
callq 0x8240
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8170
movq 0x58831(%rip), %rdi     # 0x80fe8
leaq 0x2d92a(%rip), %rsi     # 0x560e8
callq 0x8240
leaq 0x30cc2(%rip), %rsi     # 0x5948c
movq %rax, %rdi
callq 0x8240
leaq 0x2eb47(%rip), %rsi     # 0x57320
movq %rax, %rdi
callq 0x8240
movq %rax, %rdi
movl $0xa7, %esi
callq 0x84b0
movq %rax, %rdi
callq 0x8170
movl $0xff, %edi
callq 0x8300