// File: /workspace/github_cpp_makefile_star2_O3/kiudee[P]VAHD-Projekt/Supervisor.cpp
// Function: Supervisor::printGraph(bool)
void Supervisor::printGraph(bool lastPass)
{
    std::string graphname("gfx/graph");
    std::ostringstream s;
    s << printcount;
    graphname += s.str();
    graphname += ".gdl";
    std::ofstream out(graphname);
    out << "graph: {\n";

    // Colors:
    out << "colorentry 32: 60 236 93\n"; //left edges: bright green
    out << "colorentry 33: 31 130 13\n"; //right edges: darker green
    out << "colorentry 34: 56 89 255\n"; //edge 0: bright blue
    out << "colorentry 35: 30 48 138\n"; //edge 1: darker blue
    out << "colorentry 36: 114 165 255\n"; //node real: light purple
    out << "colorentry 37: 255 210 114\n"; //node virtual: light sepia

    // Graph Options:
    out << "layoutalgorithm: maxdepthslow\n"; //Use slow algorithm which yields good quality
    out << "manhattan_edges: yes\n"; //Orthogonal lines
    out << "splines: yes\n"; //Slightly bended lines
    out << "orientation: bottom_to_top\n"; //Edges above nodes
    out << "yspace: 30\n"; //Edges above nodes

    std::unordered_map<int, int> alreadyLinked;

    // Print all nodes:
    for (int i = 0; i < (total * 3); i++) {
        auto node = dynamic_cast<Node *>(Subjects[i]);
        out << Node2GDL(Subjects[i]->_debugID, node->num, node->isReal);
    }

    // Print all edges, but no LEFT edges:
    for (int i = 0; i < (total * 3); i++) {
        auto node = dynamic_cast<Node *>(Subjects[i]);
        auto subject = Subjects[i];
        if (node->right != NULL) {
            if (lastPass) {
                out << Edge2GDL(subject->_debugID, node->right->debugID, LEFTRIGHT);
                alreadyLinked[subject->_debugID] = node->right->debugID;
            } else {
                out << Edge2GDL(subject->_debugID, node->right->debugID, RIGHT);
            }
        }
        if (node->node0 != NULL) {
            out << Edge2GDL(subject->_debugID, node->node0->debugID, EDGE0);
        }
        if (node->node1 != NULL) {
            out << Edge2GDL(subject->_debugID, node->node1->debugID, EDGE1);
        }
    }

    // Print LEFT edges, if nodes are not connected by a RIGHT edge:
    for (int i = 0; i < (total * 3); i++) {
        auto node = dynamic_cast<Node *>(Subjects[i]);
        auto subject = Subjects[i];
        if (node->left != NULL) {
            if (!lastPass || alreadyLinked[node->left->debugID] != static_cast<int>(subject->_debugID)) {
                out << Edge2GDL(subject->_debugID, node->left->debugID, LEFT);
            }
        }
    }
    out << "}\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f8, %rsp            # imm = 0x3F8
movl %esi, 0x24(%rsp)
movq %rdi, %r14
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x8bf0(%rip), %rsi      # 0xc0ee
leaq 0x8bf2(%rip), %rdx      # 0xc0f7
leaq 0x28(%rsp), %rdi
callq 0x5268
leaq 0x280(%rsp), %rdi
callq 0x21c0
movl 0xf8(%r14), %esi
leaq 0x280(%rsp), %rdi
callq 0x2270
leaq 0x288(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x2220
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
leaq 0x28(%rsp), %rdi
callq 0x2060
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3580
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2170
leaq 0x8b71(%rip), %rsi      # 0xc0f8
leaq 0x28(%rsp), %rdi
callq 0x22a0
leaq 0x80(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movl $0x10, %edx
callq 0x22b0
leaq 0x8b4e(%rip), %rsi      # 0xc0fd
leaq 0x80(%rsp), %rdi
movl $0x9, %edx
callq 0x21a0
leaq 0x8b3f(%rip), %rsi      # 0xc107
leaq 0x80(%rsp), %rdi
movl $0x19, %edx
callq 0x21a0
leaq 0x8b40(%rip), %rsi      # 0xc121
leaq 0x80(%rsp), %rdi
movl $0x19, %edx
callq 0x21a0
leaq 0x8b41(%rip), %rsi      # 0xc13b
leaq 0x80(%rsp), %rdi
movl $0x19, %edx
callq 0x21a0
leaq 0x8b42(%rip), %rsi      # 0xc155
leaq 0x80(%rsp), %rdi
movl $0x19, %edx
callq 0x21a0
leaq 0x8b43(%rip), %rsi      # 0xc16f
leaq 0x80(%rsp), %rdi
movl $0x1b, %edx
callq 0x21a0
leaq 0x8b46(%rip), %rsi      # 0xc18b
leaq 0x80(%rsp), %rdi
movl $0x1b, %edx
callq 0x21a0
leaq 0x8b49(%rip), %rsi      # 0xc1a7
leaq 0x80(%rsp), %rdi
movl $0x1e, %edx
callq 0x21a0
leaq 0x8b4f(%rip), %rsi      # 0xc1c6
leaq 0x80(%rsp), %rdi
movl $0x15, %edx
callq 0x21a0
leaq 0x8b4c(%rip), %rsi      # 0xc1dc
leaq 0x80(%rsp), %rdi
movl $0xd, %edx
callq 0x21a0
leaq 0x8b41(%rip), %rsi      # 0xc1ea
leaq 0x80(%rsp), %rdi
movl $0x1b, %edx
callq 0x21a0
leaq 0x8b44(%rip), %rsi      # 0xc206
leaq 0x80(%rsp), %rdi
movl $0xb, %edx
callq 0x21a0
leaq 0x78(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
cmpl $0x0, 0x64(%r14)
jle 0x39fc
xorl %r15d, %r15d
leaq 0xd424(%rip), %r12      # 0x10b30
movq %rsp, %r13
leaq 0x80(%rsp), %rbp
movq 0xe0(%r14), %rax
movq (%rax,%r15,8), %rbx
movq %rbx, %rdi
leaq 0xd3f4(%rip), %rsi      # 0x10b20
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x2190
movl 0x8(%rbx), %edx
movsd 0xb0(%rax), %xmm0
movzbl 0xb8(%rax), %ecx
movq %r13, %rdi
callq 0x2fae
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbp, %rdi
callq 0x21a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x377c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
incq %r15
movslq 0x64(%r14), %rax
leaq (%rax,%rax,2), %rcx
cmpq %rcx, %r15
jl 0x3717
testl %eax, %eax
jle 0x39fc
xorl %ebx, %ebx
movq %rsp, %r15
leaq 0x80(%rsp), %r12
movq 0xe0(%r14), %rax
movq (%rax,%rbx,8), %rbp
testq %rbp, %rbp
je 0x37ce
movq %rbp, %rdi
leaq 0xd365(%rip), %rsi      # 0x10b20
leaq 0xd36e(%rip), %rdx      # 0x10b30
xorl %ecx, %ecx
callq 0x2190
movq %rax, %r13
jmp 0x37d1
xorl %r13d, %r13d
movq 0xd0(%r13), %rax
testq %rax, %rax
je 0x3893
cmpb $0x0, 0x24(%rsp)
je 0x3853
movl 0x8(%rbp), %edx
movl 0x30(%rax), %ecx
movq %r15, %rdi
movl $0x4, %r8d
callq 0x3204
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x21a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3828
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0xd0(%r13), %rax
movl 0x30(%rax), %r12d
movl 0x8(%rbp), %eax
movl %eax, (%rsp)
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x5c22
movl %r12d, (%rax)
leaq 0x80(%rsp), %r12
jmp 0x3893
movl 0x8(%rbp), %edx
movl 0x30(%rax), %ecx
movq %r15, %rdi
movl $0x1, %r8d
callq 0x3204
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x21a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3893
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0xd8(%r13), %rax
testq %rax, %rax
je 0x38df
movl 0x8(%rbp), %edx
movl 0x30(%rax), %ecx
movq %r15, %rdi
movl $0x3, %r8d
callq 0x3204
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x21a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x38df
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0xe0(%r13), %rax
testq %rax, %rax
je 0x392b
movl 0x8(%rbp), %edx
movl 0x30(%rax), %ecx
movq %r15, %rdi
movl $0x2, %r8d
callq 0x3204
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x21a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x392b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
incq %rbx
movslq 0x64(%r14), %rax
leaq (%rax,%rax,2), %rcx
cmpq %rcx, %rbx
jl 0x37a1
testl %eax, %eax
jle 0x39fc
xorl %ebx, %ebx
leaq 0xd1d0(%rip), %r15      # 0x10b20
leaq 0xd1d9(%rip), %r12      # 0x10b30
movq 0xe0(%r14), %rax
movq (%rax,%rbx,8), %rbp
movq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x2190
movq 0xc8(%rax), %rsi
testq %rsi, %rsi
je 0x39e8
cmpb $0x0, 0x24(%rsp)
je 0x39a6
movq %rax, %r13
addq $0x30, %rsi
leaq 0x48(%rsp), %rdi
callq 0x5eb8
movl 0x8(%rbp), %edx
cmpl %edx, (%rax)
je 0x39e8
movq 0xc8(%r13), %rsi
jmp 0x39a9
movl 0x8(%rbp), %edx
movl 0x30(%rsi), %ecx
movq %rsp, %rdi
xorl %r8d, %r8d
callq 0x3204
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x80(%rsp), %rdi
callq 0x21a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x39e8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
incq %rbx
movslq 0x64(%r14), %rax
leaq (%rax,%rax,2), %rax
cmpq %rax, %rbx
jl 0x3957
leaq 0x866e(%rip), %rsi      # 0xc071
leaq 0x80(%rsp), %rdi
movl $0x2, %edx
callq 0x21a0
leaq 0x48(%rsp), %rdi
callq 0x51f8
movq 0xd592(%rip), %rax      # 0x10fb8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x88(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x80(%rsp,%rcx)
callq 0x2140
leaq 0x178(%rsp), %rdi
callq 0x2070
movq 0xd562(%rip), %rsi      # 0x10fc0
leaq 0x280(%rsp), %rdi
callq 0x20b0
leaq 0x2f0(%rsp), %rdi
callq 0x2070
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x3a94
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2170
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3af9
jmp 0x3ad7
movq %rax, %rbx
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3b33
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2170
jmp 0x3b33
jmp 0x3ad7
movq %rax, %rbx
jmp 0x3b54
movq %rax, %rbx
jmp 0x3b33
jmp 0x3af9
jmp 0x3af9
jmp 0x3afe
jmp 0x3af9
jmp 0x3afe
jmp 0x3af9
jmp 0x3afe
jmp 0x3af9
jmp 0x3afe
jmp 0x3af9
jmp 0x3afe
jmp 0x3af9
movq %rax, %rbx
jmp 0x3b26
movq %rax, %rbx
jmp 0x3b1c
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3b1c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
leaq 0x48(%rsp), %rdi
callq 0x51f8
leaq 0x80(%rsp), %rdi
callq 0x2200
movq 0xd486(%rip), %rsi      # 0x10fc0
leaq 0x280(%rsp), %rdi
callq 0x20b0
leaq 0x2f0(%rsp), %rdi
callq 0x2070
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x3b70
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2280