// File: /workspace/github_cpp_makefile_star2_O1/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 (%rdi), %rsi
movq 0x8(%rdi), %rdx
movq %rbx, %rdi
callq 0x8330
movq %rax, %r15
leaq 0x3a816(%rip), %rsi     # 0x703c0
movl $0x1, %edx
movq %rax, %rdi
callq 0x8330
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x8270
movsbl %al, %esi
movq %r15, %rdi
callq 0x8030
movq %rax, %rdi
callq 0x81f0
leaq 0x3c95c(%rip), %rsi     # 0x72541
movl $0x11, %edx
movq %rbx, %rdi
callq 0x8330
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8270
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8030
movq %rax, %rdi
callq 0x81f0
leaq 0x3c933(%rip), %rsi     # 0x72553
movl $0x14, %edx
movq %rbx, %rdi
callq 0x8330
movq 0x28(%r14), %rbp
movq 0x10(%rbp), %r12
addq $0x10, %rbp
cmpq %rbp, %r12
je 0x35ca7
leaq 0x3976d(%rip), %r15     # 0x6f3b2
leaq 0x597ac(%rip), %r13     # 0x8f3f8
movq 0x10(%r12), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x35c6d
leaq 0x5998f(%rip), %rsi     # 0x8f5f0
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x8320
jmp 0x35c6f
xorl %eax, %eax
testq %rax, %rax
je 0x35e50
movq 0x60(%rax), %rax
movq (%rax), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x8330
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x8330
movq (%r12), %r12
cmpq %rbp, %r12
jne 0x35c4c
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8270
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8030
movq %rax, %rdi
callq 0x81f0
leaq 0x3c893(%rip), %rsi     # 0x72568
movl $0xf, %edx
movq %rbx, %rdi
callq 0x8330
movq 0x58(%r14), %r12
testq %r12, %r12
je 0x35d1f
leaq 0x396c0(%rip), %r15     # 0x6f3b2
movq 0x8(%r12), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x8330
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x8330
movq (%r12), %r12
testq %r12, %r12
jne 0x35cf2
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8270
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8030
movq %rax, %rdi
callq 0x81f0
leaq 0x3c82b(%rip), %rsi     # 0x72578
movl $0x15, %edx
movq %rbx, %rdi
callq 0x8330
movq 0x90(%r14), %r12
testq %r12, %r12
je 0x35d9b
leaq 0x39645(%rip), %r15     # 0x6f3b2
movq 0x8(%r12), %rax
movq 0x28(%rax), %rsi
movq 0x30(%rax), %rdx
movq %rbx, %rdi
callq 0x8330
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x8330
movq (%r12), %r12
testq %r12, %r12
jne 0x35d6d
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8270
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8030
movq %rax, %rdi
callq 0x81f0
movq 0x30(%r14), %r15
addq $0x30, %r14
cmpq %r14, %r15
je 0x35e07
movq 0x10(%r15), %rdi
movq %rbx, %rsi
callq 0x35ea0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8270
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8030
movq %rax, %rdi
callq 0x81f0
movq (%r15), %r15
jmp 0x35dca
leaq 0x3c780(%rip), %rsi     # 0x7258e
movl $0xf, %edx
movq %rbx, %rdi
callq 0x8330
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8270
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8030
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x81f0
movq 0x5a199(%rip), %rdi     # 0x8fff0
leaq 0x3930a(%rip), %rsi     # 0x6f168
callq 0x8280
leaq 0x3c6c4(%rip), %rsi     # 0x7252e
movq %rax, %rdi
callq 0x8280
leaq 0x3a547(%rip), %rsi     # 0x703c0
movq %rax, %rdi
callq 0x8280
movq %rax, %rdi
movl $0xa7, %esi
callq 0x8520
movq %rax, %rdi
callq 0x8180
movl $0xff, %edi
callq 0x8380