// File: /workspace/github_cpp_makefile_star2_O2/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 0x5d2c
movq %rdx, %rbx
testq %rdx, %rdx
je 0x5d45
movq %rsi, %r14
movq %rdi, %r15
leaq 0x4416(%rip), %r13      # 0x9f0e
leaq 0x3e49(%rip), %r12      # 0x9948
movl (%r14), %esi
cmpq $0xf, %rsi
ja 0x5d0d
movslq (%r12,%rsi,4), %rax
addq %r12, %rax
jmpq *%rax
movq %rbx, %rdi
leaq 0x3f75(%rip), %rsi      # 0x9a94
movq %r14, %rdx
leaq 0x3fa8(%rip), %rcx      # 0x9ad1
xorl %eax, %eax
callq 0x2180
cmpb $0x1, 0x8(%r14)
jne 0x5b4c
leaq 0x3f98(%rip), %rdi      # 0x9ad6
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x21f0
leaq 0x434d(%rip), %rdi      # 0x9ea0
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x21f0
jmp 0x5cbf
movl 0x8(%r14), %edi
callq 0x594c
movq %rbx, %rdi
leaq 0x42a6(%rip), %rsi      # 0x9e1f
movq %r14, %rdx
movq %rax, %rcx
jmp 0x5cb8
movq %rbx, %rdi
leaq 0x41bf(%rip), %rsi      # 0x9d4d
jmp 0x5c40
movq 0x8(%r14), %rcx
movq %rbx, %rdi
leaq 0x3fc5(%rip), %rsi      # 0x9b66
movq %r14, %rdx
jmp 0x5cb8
movq %rbx, %rdi
leaq 0x41dc(%rip), %rsi      # 0x9d8f
movq %r14, %rdx
leaq 0x4214(%rip), %rcx      # 0x9dd1
jmp 0x5cb8
movq %rbx, %rdi
leaq 0x40ef(%rip), %rsi      # 0x9cbb
movq %r14, %rdx
leaq 0x4127(%rip), %rcx      # 0x9cfd
jmp 0x5cb8
movq %rbx, %rdi
leaq 0x3f3b(%rip), %rsi      # 0x9b20
jmp 0x5c0e
movl 0x8(%r14), %ecx
movq %rbx, %rdi
leaq 0x426c(%rip), %rsi      # 0x9e61
movq %r14, %rdx
xorl %eax, %eax
callq 0x2180
jmp 0x5cbf
movq %rbx, %rdi
leaq 0x4295(%rip), %rsi      # 0x9ea3
movq %r14, %rdx
leaq 0x3f4b(%rip), %rcx      # 0x9b63
jmp 0x5cb8
movq %rbx, %rdi
leaq 0x400b(%rip), %rsi      # 0x9c32
movq %r14, %rdx
leaq 0x4043(%rip), %rcx      # 0x9c74
jmp 0x5cb8
movq %rbx, %rdi
leaq 0x3e9e(%rip), %rsi      # 0x9ade
movq %r14, %rdx
leaq 0x3c26(%rip), %rcx      # 0x9870
jmp 0x5cb8
movq %rbx, %rdi
leaq 0x3f50(%rip), %rsi      # 0x9ba6
movq %r14, %rdx
leaq 0x3f87(%rip), %rcx      # 0x9be7
jmp 0x5cb8
movq %rbx, %rdi
leaq 0x416a(%rip), %rsi      # 0x9dd6
movq %r14, %rdx
leaq 0x41a2(%rip), %rcx      # 0x9e18
jmp 0x5cb8
movq %rbx, %rdi
leaq 0x3f69(%rip), %rsi      # 0x9beb
movq %r14, %rdx
leaq 0x3fa1(%rip), %rcx      # 0x9c2d
jmp 0x5cb8
movq %rbx, %rdi
leaq 0x406d(%rip), %rsi      # 0x9d05
movq %r14, %rdx
leaq 0x40a5(%rip), %rcx      # 0x9d47
jmp 0x5cb8
movq %rbx, %rdi
leaq 0x3fc8(%rip), %rsi      # 0x9c76
movq %r14, %rdx
leaq 0x4000(%rip), %rcx      # 0x9cb8
xorl %eax, %eax
callq 0x2180
movq 0x18(%r14), %rcx
testq %rcx, %rcx
je 0x5ceb
movq %rbx, %rdi
leaq 0x422c(%rip), %rsi      # 0x9efe
movq %r14, %rdx
xorl %eax, %eax
callq 0x2180
movq 0x18(%r14), %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x5ac8
movq 0x20(%r14), %rcx
testq %rcx, %rcx
je 0x5d1d
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2180
movq 0x20(%r14), %r14
jmp 0x5aff
leaq 0x41d7(%rip), %rdi      # 0x9eeb
xorl %eax, %eax
callq 0x2040
jmp 0x5cbf
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2f27(%rip), %rdi      # 0x8c5a
leaq 0x3ce4(%rip), %rsi      # 0x9a1e
leaq 0x3d21(%rip), %rcx      # 0x9a62
pushq $0x42
jmp 0x5d5c
leaq 0x3d3e(%rip), %rdi      # 0x9a8a
leaq 0x3ccb(%rip), %rsi      # 0x9a1e
leaq 0x3d08(%rip), %rcx      # 0x9a62
pushq $0x43
popq %rdx
callq 0x20b0