// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x40bf(%rip), %r13      # 0x9ed2
leaq 0x3b2e(%rip), %r12      # 0x9948
testq %r15, %r15
je 0x606b
testq %rbx, %rbx
je 0x608a
movl (%r14), %esi
cmpq $0xf, %rsi
ja 0x604c
movslq (%r12,%rsi,4), %rax
addq %r12, %rax
jmpq *%rax
movq %rbx, %rdi
leaq 0x3c0c(%rip), %rsi      # 0x9a58
movq %r14, %rdx
leaq 0x3c3f(%rip), %rcx      # 0x9a95
xorl %eax, %eax
callq 0x2180
cmpb $0x1, 0x8(%r14)
jne 0x5e7d
movl $0x7, %esi
movl $0x1, %edx
leaq 0x3c25(%rip), %rdi      # 0x9a9a
movq %rbx, %rcx
callq 0x21f0
movl $0x2, %esi
movl $0x1, %edx
leaq 0x3fd6(%rip), %rdi      # 0x9e64
movq %rbx, %rcx
callq 0x21f0
jmp 0x5ffe
movl 0x8(%r14), %eax
leaq 0x3b27(%rip), %rcx      # 0x99cd
cmpq $0x9, %rax
ja 0x5eb7
leaq 0x7ebd(%rip), %rcx      # 0xdd70
movq (%rcx,%rax,8), %rcx
movq %rbx, %rdi
leaq 0x3f22(%rip), %rsi      # 0x9de3
jmp 0x5ee0
movq %rbx, %rdi
leaq 0x3e44(%rip), %rsi      # 0x9d11
jmp 0x5f7f
movq 0x8(%r14), %rcx
movq %rbx, %rdi
leaq 0x3c4a(%rip), %rsi      # 0x9b2a
movq %r14, %rdx
jmp 0x5ff7
movq %rbx, %rdi
leaq 0x3e61(%rip), %rsi      # 0x9d53
movq %r14, %rdx
leaq 0x3e99(%rip), %rcx      # 0x9d95
jmp 0x5ff7
movq %rbx, %rdi
leaq 0x3d74(%rip), %rsi      # 0x9c7f
movq %r14, %rdx
leaq 0x3dac(%rip), %rcx      # 0x9cc1
jmp 0x5ff7
movq %rbx, %rdi
leaq 0x3bc0(%rip), %rsi      # 0x9ae4
jmp 0x5f4d
movl 0x8(%r14), %ecx
movq %rbx, %rdi
leaq 0x3ef1(%rip), %rsi      # 0x9e25
movq %r14, %rdx
xorl %eax, %eax
callq 0x2180
jmp 0x5ffe
movq %rbx, %rdi
leaq 0x3f1a(%rip), %rsi      # 0x9e67
movq %r14, %rdx
leaq 0x3bd0(%rip), %rcx      # 0x9b27
jmp 0x5ff7
movq %rbx, %rdi
leaq 0x3c90(%rip), %rsi      # 0x9bf6
movq %r14, %rdx
leaq 0x3cc8(%rip), %rcx      # 0x9c38
jmp 0x5ff7
movq %rbx, %rdi
leaq 0x3b23(%rip), %rsi      # 0x9aa2
movq %r14, %rdx
leaq 0x38e7(%rip), %rcx      # 0x9870
jmp 0x5ff7
movq %rbx, %rdi
leaq 0x3bd5(%rip), %rsi      # 0x9b6a
movq %r14, %rdx
leaq 0x3c0c(%rip), %rcx      # 0x9bab
jmp 0x5ff7
movq %rbx, %rdi
leaq 0x3def(%rip), %rsi      # 0x9d9a
movq %r14, %rdx
leaq 0x3e27(%rip), %rcx      # 0x9ddc
jmp 0x5ff7
movq %rbx, %rdi
leaq 0x3bee(%rip), %rsi      # 0x9baf
movq %r14, %rdx
leaq 0x3c26(%rip), %rcx      # 0x9bf1
jmp 0x5ff7
movq %rbx, %rdi
leaq 0x3cf2(%rip), %rsi      # 0x9cc9
movq %r14, %rdx
leaq 0x3d2a(%rip), %rcx      # 0x9d0b
jmp 0x5ff7
movq %rbx, %rdi
leaq 0x3c4d(%rip), %rsi      # 0x9c3a
movq %r14, %rdx
leaq 0x3c85(%rip), %rcx      # 0x9c7c
xorl %eax, %eax
callq 0x2180
movq 0x18(%r14), %rcx
testq %rcx, %rcx
je 0x602a
movq %rbx, %rdi
leaq 0x3eb1(%rip), %rsi      # 0x9ec2
movq %r14, %rdx
xorl %eax, %eax
callq 0x2180
movq 0x18(%r14), %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x5df5
movq 0x20(%r14), %rcx
testq %rcx, %rcx
je 0x605c
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2180
movq 0x20(%r14), %r14
jmp 0x5e1a
leaq 0x3e5c(%rip), %rdi      # 0x9eaf
xorl %eax, %eax
callq 0x2040
jmp 0x5ffe
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2be8(%rip), %rdi      # 0x8c5a
leaq 0x3969(%rip), %rsi      # 0x99e2
leaq 0x39a6(%rip), %rcx      # 0x9a26
movl $0x42, %edx
callq 0x20b0
leaq 0x39bd(%rip), %rdi      # 0x9a4e
leaq 0x394a(%rip), %rsi      # 0x99e2
leaq 0x3987(%rip), %rcx      # 0x9a26
movl $0x43, %edx
callq 0x20b0