// File: /workspace/github_cpp_makefile_star2_O3/vssense[P]Compiler/src/front-end/dot_dump.h
// Function: PrintNodes(Tree*, Node*, _IO_FILE*)
void PrintNodes(Tree* tree, Node* node, FILE* dump_file)
{
    assert(tree);
    assert(dump_file);

    switch (node->type)
    {
        case D_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#EBF7F7\", label=\"D_TYPE | %s",
                    node, "fict");
    
            if (node->value.is_void)
            {
                fprintf(dump_file, " | void");
            }

            fprintf(dump_file, "\"]");

            break;
        }
        case DECL_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#C0F5F1\", label=\"DECL_TYPE | %s\"]",
                    node, "=");
            break;
        }
        case ADECL_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#BC8E27\", label=\"ADECL_TYPE | %s\"]",
                    node, "[]");
            break;
        }
        case ID_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#C0F5F1\", label=\"ID_TYPE | %s\"]",
                    node, node->value.name);

            break;
        }
        case ARG_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#F0F5F1\", label=\"ARG_TYPE | %s\"]",
                    node, "arg");
            break;
        }
        case COMP_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#C0F5F1\", label=\"COMP_TYPE | %s\"]",
                    node, "comp");
            break;
        }
        case STAT_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#A2F39D\", label=\"STAT_TYPE | %s\"]",
                    node, "S");
            break;
        }
        case COND_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#F3DF9D\", label=\"COND_TYPE | %s\"]",
                    node, "if");
            break;
        }
        case IFEL_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#F3DF9D\", label=\"IFEL_TYPE | %s\"]",
                    node, "if-else");
            break;
        }
        case LOOP_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#AEDEE8\", label=\"LOOP_TYPE | %s\"]",
                    node, "while");
            break;
        }
        case ASSG_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#C0F5F1\", label=\"ASSG_TYPE | %s\"]",
                    node, "=");
            break;
        }
        case CALL_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#AEE8C5\", label=\"CALL_TYPE | %s\"]",
                    node, "call");
            break;
        }
        case JUMP_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#BC8ED7\", label=\"JUMP_TYPE | %s\"]",
                    node, "return");
            break;
        }
        case MATH_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#C0F5F1\", label=\"MATH_TYPE | %s\"]",
                    node, MathToString(node->value.op));
            break;
        }
        case NUMB_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#C0F5F1\", label=\"NUMB_TYPE | %d\"]",
                    node, node->value.number);
            break;
        }
        case MEM_ACCESS_TYPE :
        {
            fprintf(dump_file, "\"%p\"[style=\"filled\", fillcolor=\"#BC8E27\", label=\"MEM_ACCESS_TYPE | %s\"]",
                    node, "[]");
            break;
        }
        default : 
        {
            printf("Unknown type = %d\n", node->type);
            break;
        }
    }

    if (node->left != nullptr)
    {
        fprintf(dump_file, "\"%p\":sw->\"%p\";\n", node, node->left);
        PrintNodes(tree, node->left, dump_file);
    }
    
    if (node->right != nullptr)
    {
        fprintf(dump_file, "\"%p\":se->\"%p\";\n", node, node->right);
        PrintNodes(tree, node->right, dump_file);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x5fdb
movq %rdx, %rbx
testq %rdx, %rdx
je 0x5ffa
movq %rsi, %r14
movq %rdi, %r15
leaq 0x4151(%rip), %r13      # 0x9ee6
leaq 0x3bac(%rip), %r12      # 0x9948
movl (%r14), %esi
cmpq $0xf, %rsi
ja 0x5fbc
movslq (%r12,%rsi,4), %rax
addq %r12, %rax
jmpq *%rax
movq %rbx, %rdi
leaq 0x3cb0(%rip), %rsi      # 0x9a6c
movq %r14, %rdx
leaq 0x3ce3(%rip), %rcx      # 0x9aa9
xorl %eax, %eax
callq 0x2180
cmpb $0x1, 0x8(%r14)
jne 0x5ded
movl $0x7, %esi
movl $0x1, %edx
leaq 0x3cc9(%rip), %rdi      # 0x9aae
movq %rbx, %rcx
callq 0x21f0
movl $0x2, %esi
movl $0x1, %edx
leaq 0x407a(%rip), %rdi      # 0x9e78
movq %rbx, %rcx
callq 0x21f0
jmp 0x5f6e
movl 0x8(%r14), %eax
leaq 0x3bcb(%rip), %rcx      # 0x99e1
cmpq $0x9, %rax
ja 0x5e27
leaq 0x7f4d(%rip), %rcx      # 0xdd70
movq (%rcx,%rax,8), %rcx
movq %rbx, %rdi
leaq 0x3fc6(%rip), %rsi      # 0x9df7
jmp 0x5e50
movq %rbx, %rdi
leaq 0x3ee8(%rip), %rsi      # 0x9d25
jmp 0x5eef
movq 0x8(%r14), %rcx
movq %rbx, %rdi
leaq 0x3cee(%rip), %rsi      # 0x9b3e
movq %r14, %rdx
jmp 0x5f67
movq %rbx, %rdi
leaq 0x3f05(%rip), %rsi      # 0x9d67
movq %r14, %rdx
leaq 0x3f3d(%rip), %rcx      # 0x9da9
jmp 0x5f67
movq %rbx, %rdi
leaq 0x3e18(%rip), %rsi      # 0x9c93
movq %r14, %rdx
leaq 0x3e50(%rip), %rcx      # 0x9cd5
jmp 0x5f67
movq %rbx, %rdi
leaq 0x3c64(%rip), %rsi      # 0x9af8
jmp 0x5ebd
movl 0x8(%r14), %ecx
movq %rbx, %rdi
leaq 0x3f95(%rip), %rsi      # 0x9e39
movq %r14, %rdx
xorl %eax, %eax
callq 0x2180
jmp 0x5f6e
movq %rbx, %rdi
leaq 0x3fbe(%rip), %rsi      # 0x9e7b
movq %r14, %rdx
leaq 0x3c74(%rip), %rcx      # 0x9b3b
jmp 0x5f67
movq %rbx, %rdi
leaq 0x3d34(%rip), %rsi      # 0x9c0a
movq %r14, %rdx
leaq 0x3d6c(%rip), %rcx      # 0x9c4c
jmp 0x5f67
movq %rbx, %rdi
leaq 0x3bc7(%rip), %rsi      # 0x9ab6
movq %r14, %rdx
leaq 0x3977(%rip), %rcx      # 0x9870
jmp 0x5f67
movq %rbx, %rdi
leaq 0x3c79(%rip), %rsi      # 0x9b7e
movq %r14, %rdx
leaq 0x3cb0(%rip), %rcx      # 0x9bbf
jmp 0x5f67
movq %rbx, %rdi
leaq 0x3e93(%rip), %rsi      # 0x9dae
movq %r14, %rdx
leaq 0x3ecb(%rip), %rcx      # 0x9df0
jmp 0x5f67
movq %rbx, %rdi
leaq 0x3c92(%rip), %rsi      # 0x9bc3
movq %r14, %rdx
leaq 0x3cca(%rip), %rcx      # 0x9c05
jmp 0x5f67
movq %rbx, %rdi
leaq 0x3d96(%rip), %rsi      # 0x9cdd
movq %r14, %rdx
leaq 0x3dce(%rip), %rcx      # 0x9d1f
jmp 0x5f67
movq %rbx, %rdi
leaq 0x3cf1(%rip), %rsi      # 0x9c4e
movq %r14, %rdx
leaq 0x3d29(%rip), %rcx      # 0x9c90
xorl %eax, %eax
callq 0x2180
movq 0x18(%r14), %rcx
testq %rcx, %rcx
je 0x5f9a
movq %rbx, %rdi
leaq 0x3f55(%rip), %rsi      # 0x9ed6
movq %r14, %rdx
xorl %eax, %eax
callq 0x2180
movq 0x18(%r14), %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x5d65
movq 0x20(%r14), %rcx
testq %rcx, %rcx
je 0x5fcc
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2180
movq 0x20(%r14), %r14
jmp 0x5d9c
leaq 0x3f00(%rip), %rdi      # 0x9ec3
xorl %eax, %eax
callq 0x2040
jmp 0x5f6e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2c78(%rip), %rdi      # 0x8c5a
leaq 0x3a0d(%rip), %rsi      # 0x99f6
leaq 0x3a4a(%rip), %rcx      # 0x9a3a
movl $0x42, %edx
callq 0x20b0
leaq 0x3a61(%rip), %rdi      # 0x9a62
leaq 0x39ee(%rip), %rsi      # 0x99f6
leaq 0x3a2b(%rip), %rcx      # 0x9a3a
movl $0x43, %edx
callq 0x20b0