// File: /workspace/github_cpp_makefile_star2_O2/johan-bjareholt[P]lua-compiler/src/ir.cc
// Function: BBlock::dumpDot(std::ostream&)
void BBlock::dumpDot(std::ostream& ss){
    traversed_blocks.insert(this);
    // Def self
    ss  << '"' << this << '"' << std::endl;
    // Set self string
    if (this->label.empty())
        ss  << "[" << "label=\"" << this << "" << std::endl;
    else
        ss  << "[" << "label=\"" << this->label << "" << std::endl;
    std::stringstream ss_code;
    for(auto i : instructions){
        i.dump(ss_code);
    }
    // Handle " in the code so it doesn't escape
    std::string code_s = ss_code.str();
    for (int i = 0; i < code_s.length(); i++) {
        //std::cout << i << std::endl;
        if (code_s[i] == '"'){
            code_s[i] = '\'';
        }
    }
    ss << code_s;
    // Close self def
    ss << "\"];" << std::endl;
    // Connect to subs
    if (trueExit)
        ss  << "    \"" << this << "\" -> \"" << trueExit << "\";" << std::endl;
    if (falseExit)
        ss  << "    \"" << this << "\" -> \"" << falseExit << "\";"<< std::endl;
    // Dumpdot subs
    bool trueExitFound = traversed_blocks.find(trueExit) != traversed_blocks.end();
    if (trueExit && !trueExitFound)
        trueExit->dumpDot(ss);
    bool falseExitFound = traversed_blocks.find(falseExit) != traversed_blocks.end();
    if (falseExit && !falseExitFound)
        falseExit->dumpDot(ss);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x218(%rbp), %rsi
movq %rdi, (%rsi)
leaq 0x17817(%rip), %rdi     # 0x1c320
callq 0x6ec2
pushq $0x22
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
callq 0x3270
movq %rax, %rdi
movq %r14, %rsi
callq 0x31a0
movq %rax, %rdi
movl %r15d, %esi
callq 0x3270
movq %rax, %rdi
callq 0x3100
cmpq $0x0, 0x30(%r14)
je 0x4b71
leaq 0x28(%r14), %r15
leaq 0xd9e5(%rip), %rsi      # 0x12532
movq %rbx, %rdi
callq 0x31f0
leaq 0xd59d(%rip), %rsi      # 0x120f9
movq %rax, %rdi
callq 0x31f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x31d0
jmp 0x4b9a
leaq 0xd9ba(%rip), %rsi      # 0x12532
movq %rbx, %rdi
callq 0x31f0
leaq 0xd572(%rip), %rsi      # 0x120f9
movq %rax, %rdi
callq 0x31f0
movq %rax, %rdi
movq %r14, %rsi
callq 0x31a0
leaq 0xd775(%rip), %rsi      # 0x12316
movq %rax, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3100
leaq -0x218(%rbp), %rdi
callq 0x3180
leaq -0x208(%rbp), %r15
leaq -0x90(%rbp), %r12
movq %r14, %r13
movq (%r13), %r13
cmpq %r14, %r13
je 0x4bf8
leaq 0x10(%r13), %rsi
movq %r12, %rdi
callq 0x68fe
movq %r12, %rdi
movq %r15, %rsi
callq 0x488c
movq %r12, %rdi
callq 0x6970
jmp 0x4bce
leaq -0x200(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x3380
xorl %eax, %eax
cmpq %rax, -0x88(%rbp)
jbe 0x4c2c
movq -0x90(%rbp), %rcx
cmpb $0x22, (%rcx,%rax)
jne 0x4c27
movb $0x27, (%rcx,%rax)
incq %rax
jmp 0x4c0d
leaq -0x90(%rbp), %rsi
movq %rbx, %rdi
callq 0x31d0
leaq 0xd4bf(%rip), %rsi      # 0x12101
movq %rbx, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3100
leaq 0x18(%r14), %r15
cmpq $0x0, 0x18(%r14)
je 0x4ca8
leaq 0xd4a1(%rip), %rsi      # 0x12105
movq %rbx, %rdi
callq 0x31f0
movq %rax, %rdi
movq %r14, %rsi
callq 0x31a0
leaq 0xd48d(%rip), %rsi      # 0x1210b
movq %rax, %rdi
callq 0x31f0
movq (%r15), %rsi
movq %rax, %rdi
callq 0x31a0
leaq 0xd438(%rip), %rsi      # 0x120d0
movq %rax, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3100
leaq 0x20(%r14), %r12
cmpq $0x0, 0x20(%r14)
je 0x4cff
leaq 0xd44b(%rip), %rsi      # 0x12105
movq %rbx, %rdi
callq 0x31f0
movq %rax, %rdi
movq %r14, %rsi
callq 0x31a0
leaq 0xd437(%rip), %rsi      # 0x1210b
movq %rax, %rdi
callq 0x31f0
movq (%r12), %rsi
movq %rax, %rdi
callq 0x31a0
leaq 0xd3e1(%rip), %rsi      # 0x120d0
movq %rax, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3100
leaq 0x1761a(%rip), %rdi     # 0x1c320
movq %r15, %rsi
callq 0x7054
leaq 0x17613(%rip), %r14     # 0x1c328
cmpq %r14, %rax
setne %al
movq (%r15), %rdi
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x4d30
movq %rbx, %rsi
callq 0x4ade
leaq 0x175e9(%rip), %rdi     # 0x1c320
movq %r12, %rsi
callq 0x7054
cmpq %r14, %rax
setne %al
movq (%r12), %rdi
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x4d5b
movq %rbx, %rsi
callq 0x4ade
leaq -0x90(%rbp), %rdi
callq 0x3448
leaq -0x218(%rbp), %rdi
callq 0x3190
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4d8f
jmp 0x4d8f
jmp 0x4d8f
jmp 0x4d8f
jmp 0x4da0
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x3448
jmp 0x4db4
movq %rax, %rbx
jmp 0x4db4
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x6970
leaq -0x218(%rbp), %rdi
callq 0x3190
movq %rbx, %rdi
callq 0x33f0