// File: /workspace/github_cpp_makefile_star2_O1/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), %r15
movq %r15, -0x10(%r15)
leaq 0x8be0(%rip), %rsi      # 0xd0ee
leaq 0x8be2(%rip), %rdx      # 0xd0f7
leaq 0x28(%rsp), %rdi
callq 0x6328
leaq 0x280(%rsp), %rdi
callq 0x31c0
movl 0xf8(%r14), %esi
leaq 0x280(%rsp), %rdi
callq 0x3270
leaq 0x288(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x3220
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
leaq 0x28(%rsp), %rdi
callq 0x3060
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4590
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3170
leaq 0x8b61(%rip), %rsi      # 0xd0f8
leaq 0x28(%rsp), %rdi
callq 0x32a0
leaq 0x80(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movl $0x10, %edx
callq 0x32b0
leaq 0x8b3e(%rip), %rsi      # 0xd0fd
leaq 0x80(%rsp), %rdi
movl $0x9, %edx
callq 0x31a0
leaq 0x8b2f(%rip), %rsi      # 0xd107
leaq 0x80(%rsp), %rdi
movl $0x19, %edx
callq 0x31a0
leaq 0x8b30(%rip), %rsi      # 0xd121
leaq 0x80(%rsp), %rdi
movl $0x19, %edx
callq 0x31a0
leaq 0x8b31(%rip), %rsi      # 0xd13b
leaq 0x80(%rsp), %rdi
movl $0x19, %edx
callq 0x31a0
leaq 0x8b32(%rip), %rsi      # 0xd155
leaq 0x80(%rsp), %rdi
movl $0x19, %edx
callq 0x31a0
leaq 0x8b33(%rip), %rsi      # 0xd16f
leaq 0x80(%rsp), %rdi
movl $0x1b, %edx
callq 0x31a0
leaq 0x8b36(%rip), %rsi      # 0xd18b
leaq 0x80(%rsp), %rdi
movl $0x1b, %edx
callq 0x31a0
leaq 0x8b39(%rip), %rsi      # 0xd1a7
leaq 0x80(%rsp), %rdi
movl $0x1e, %edx
callq 0x31a0
leaq 0x8b3f(%rip), %rsi      # 0xd1c6
leaq 0x80(%rsp), %rdi
movl $0x15, %edx
callq 0x31a0
leaq 0x8b3c(%rip), %rsi      # 0xd1dc
leaq 0x80(%rsp), %rdi
movl $0xd, %edx
callq 0x31a0
leaq 0x8b31(%rip), %rsi      # 0xd1ea
leaq 0x80(%rsp), %rdi
movl $0x1b, %edx
callq 0x31a0
leaq 0x8b34(%rip), %rsi      # 0xd206
leaq 0x80(%rsp), %rdi
movl $0xb, %edx
callq 0x31a0
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 0x479c
xorl %ebx, %ebx
leaq 0xd3dd(%rip), %r12      # 0x11af8
movq %rsp, %r13
leaq 0x80(%rsp), %rbp
movq 0xe0(%r14), %r15
movq (%r15,%rbx,8), %rdi
leaq 0xd3b0(%rip), %rsi      # 0x11ae8
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x3190
movq (%r15,%rbx,8), %rcx
movl 0x8(%rcx), %edx
movsd 0xb0(%rax), %xmm0
movzbl 0xb8(%rax), %ecx
movq %r13, %rdi
callq 0x3fbe
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbp, %rdi
callq 0x31a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x478c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3170
incq %rbx
movslq 0x64(%r14), %rax
leaq (%rax,%rax,2), %rax
cmpq %rax, %rbx
jl 0x4726
cmpl $0x0, 0x64(%r14)
jle 0x4952
xorl %ebx, %ebx
movq %rsp, %r15
leaq 0x80(%rsp), %r12
movq 0xe0(%r14), %rax
movq (%rax,%rbx,8), %rbp
testq %rbp, %rbp
je 0x47e1
movq %rbp, %rdi
leaq 0xd31a(%rip), %rsi      # 0x11ae8
leaq 0xd323(%rip), %rdx      # 0x11af8
xorl %ecx, %ecx
callq 0x3190
movq %rax, %r13
jmp 0x47e4
xorl %r13d, %r13d
movq 0xd0(%r13), %rax
testq %rax, %rax
je 0x48a6
cmpb $0x0, 0x24(%rsp)
je 0x4866
movl 0x8(%rbp), %edx
movl 0x30(%rax), %ecx
movq %r15, %rdi
movl $0x4, %r8d
callq 0x4214
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x31a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x483b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3170
movq 0xd0(%r13), %rax
movl 0x30(%rax), %r12d
movl 0x8(%rbp), %eax
movl %eax, (%rsp)
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x6ce0
movl %r12d, (%rax)
leaq 0x80(%rsp), %r12
jmp 0x48a6
movl 0x8(%rbp), %edx
movl 0x30(%rax), %ecx
movq %r15, %rdi
movl $0x1, %r8d
callq 0x4214
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x31a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x48a6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3170
movq 0xd8(%r13), %rax
testq %rax, %rax
je 0x48f2
movl 0x8(%rbp), %edx
movl 0x30(%rax), %ecx
movq %r15, %rdi
movl $0x3, %r8d
callq 0x4214
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x31a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x48f2
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3170
movq 0xe0(%r13), %rax
testq %rax, %rax
je 0x493e
movl 0x8(%rbp), %edx
movl 0x30(%rax), %ecx
movq %r15, %rdi
movl $0x2, %r8d
callq 0x4214
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x31a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x493e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3170
incq %rbx
movslq 0x64(%r14), %rax
leaq (%rax,%rax,2), %rax
cmpq %rax, %rbx
jl 0x47b4
cmpl $0x0, 0x64(%r14)
jle 0x4a11
xorl %r13d, %r13d
leaq 0xd181(%rip), %r15      # 0x11ae8
leaq 0xd18a(%rip), %r12      # 0x11af8
movq 0xe0(%r14), %rax
movq (%rax,%r13,8), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x3190
movq 0xc8(%rax), %rsi
testq %rsi, %rsi
je 0x49fd
movq %rax, %rbp
cmpb $0x0, 0x24(%rsp)
je 0x49b4
addq $0x30, %rsi
leaq 0x48(%rsp), %rdi
callq 0x6fa8
movl (%rax), %eax
cmpl 0x8(%rbx), %eax
je 0x49fd
movl 0x8(%rbx), %edx
movq 0xc8(%rbp), %rax
movl 0x30(%rax), %ecx
movq %rsp, %rdi
xorl %r8d, %r8d
callq 0x4214
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x80(%rsp), %rdi
callq 0x31a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x49fd
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3170
incq %r13
movslq 0x64(%r14), %rax
leaq (%rax,%rax,2), %rax
cmpq %rax, %r13
jl 0x496e
leaq 0x8659(%rip), %rsi      # 0xd071
leaq 0x80(%rsp), %rdi
movl $0x2, %edx
callq 0x31a0
leaq 0x48(%rsp), %rdi
callq 0x62b8
movq 0xd57d(%rip), %rax      # 0x11fb8
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 0x3140
leaq 0x178(%rsp), %rdi
callq 0x3070
movq 0xd54d(%rip), %rsi      # 0x11fc0
leaq 0x280(%rsp), %rdi
callq 0x30b0
leaq 0x2f0(%rsp), %rdi
callq 0x3070
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x4aa9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3170
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4b11
jmp 0x4aef
movq %rax, %rbx
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4b50
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3170
jmp 0x4b50
jmp 0x4aef
movq %rax, %rbx
jmp 0x4b71
movq %rax, %rbx
jmp 0x4b50
jmp 0x4b11
jmp 0x4b11
jmp 0x4b16
jmp 0x4b11
jmp 0x4b16
jmp 0x4b11
jmp 0x4b11
jmp 0x4b16
movq %rax, %rbx
jmp 0x4b43
jmp 0x4b16
jmp 0x4b11
jmp 0x4b16
jmp 0x4b11
movq %rax, %rbx
jmp 0x4b34
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4b34
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3170
leaq 0x38(%rsp), %r15
leaq 0x48(%rsp), %rdi
callq 0x62b8
leaq 0x80(%rsp), %rdi
callq 0x3200
movq 0xd469(%rip), %rsi      # 0x11fc0
leaq 0x280(%rsp), %rdi
callq 0x30b0
leaq 0x2f0(%rsp), %rdi
callq 0x3070
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x4b88
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3170
movq %rbx, %rdi
callq 0x3280