// File: /workspace/github_cpp_makefile_star2_O3/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 0x396b6(%rip), %rsi     # 0x6f3c0
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 0x3b7fc(%rip), %rsi     # 0x71541
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 0x3b7d3(%rip), %rsi     # 0x71553
movl $0x14, %edx
movq %rbx, %rdi
callq 0x8330
movq %r14, (%rsp)
movq 0x28(%r14), %rbp
movq 0x10(%rbp), %r14
addq $0x10, %rbp
cmpq %rbp, %r14
je 0x35e0c
leaq 0x58817(%rip), %r15     # 0x8e5c0
leaq 0x58618(%rip), %r12     # 0x8e3c8
leaq 0x385fb(%rip), %r13     # 0x6e3b2
movq 0x10(%r14), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x35fb8
movq %r15, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x8320
testq %rax, %rax
je 0x35fb8
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 %r13, %rsi
callq 0x8330
movq (%r14), %r14
cmpq %rbp, %r14
jne 0x35db7
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 0x3b72e(%rip), %rsi     # 0x71568
movl $0xf, %edx
movq %rbx, %rdi
callq 0x8330
movq (%rsp), %r12
movq 0x58(%r12), %r14
testq %r14, %r14
je 0x35e87
leaq 0x38556(%rip), %r15     # 0x6e3b2
movq 0x8(%r14), %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 (%r14), %r14
testq %r14, %r14
jne 0x35e5c
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 0x3b6c3(%rip), %rsi     # 0x71578
movl $0x15, %edx
movq %rbx, %rdi
callq 0x8330
movq 0x90(%r12), %r14
testq %r14, %r14
je 0x35f02
leaq 0x384dc(%rip), %r15     # 0x6e3b2
movq 0x8(%r14), %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 (%r14), %r14
testq %r14, %r14
jne 0x35ed6
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(%r12), %r14
addq $0x30, %r12
cmpq %r12, %r14
je 0x35f6f
movq 0x10(%r14), %rdi
movq %rbx, %rsi
callq 0x36008
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 (%r14), %r14
jmp 0x35f32
leaq 0x3b618(%rip), %rsi     # 0x7158e
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 0x59029(%rip), %rdi     # 0x8efe8
leaq 0x381a2(%rip), %rsi     # 0x6e168
callq 0x8280
leaq 0x3b55c(%rip), %rsi     # 0x7152e
movq %rax, %rdi
callq 0x8280
leaq 0x393df(%rip), %rsi     # 0x6f3c0
movq %rax, %rdi
callq 0x8280
movq %rax, %rdi
movl $0xa7, %esi
callq 0x8520
movq %rax, %rdi
callq 0x8180
movl $0xff, %edi
callq 0x8380