// File: /workspace/github_c_makefile_star2_O2/taeguk[P]Compiler-Proj-Cminus/src/util.c
// Function: printTree
void
printTree(TreeNode* tree)
{
  INDENT;
  if (tree == NULL) PRINTDESC("(null)\n");
  for (; tree != NULL; tree = tree->sibling)
    {
      switch (tree->nodeKind)
        {
        case ErrorK:
          PRINTDESC("[DEBUG] ErrorK at printTree\n");
          break;

        case VariableDeclarationK:
          PRINTDESC("Variable Declaration\n");
          printTree(tree->attr.varDecl.type_spec);
          printTree(tree->attr.varDecl._var);
          break;

        case ArrayDeclarationK:
          PRINTDESC("Array Declaration\n");
          printTree(tree->attr.arrDecl.type_spec);
          printTree(tree->attr.arrDecl._var);
          printTree(tree->attr.arrDecl._num);
          break;

        case FunctionDeclarationK:
          PRINTDESC("Function Declaration\n");
          printTree(tree->attr.funcDecl.type_spec);
          printTree(tree->attr.funcDecl._var);
          PRINTDESC("> Parameters :\n");
          printTree(tree->attr.funcDecl.params);
          PRINTDESC("> Function Block :\n");
          printTree(tree->attr.funcDecl.cmpd_stmt);
          break;

        case VariableParameterK:
          PRINTDESC("Parameter (Variable)\n");
          printTree(tree->attr.varParam.type_spec);
          printTree(tree->attr.varParam._var);
          break;

        case ArrayParameterK:
          PRINTDESC("Parameter (Array)\n");
          printTree(tree->attr.arrParam.type_spec);
          printTree(tree->attr.arrParam._var);
          break;

        case CompoundStatementK:
          PRINTDESC("Compound Statement\n");
          PRINTDESC("> Local Declarations :\n");
          printTree(tree->attr.cmpdStmt.local_decl);
          PRINTDESC("> Local Statements :\n");
          printTree(tree->attr.cmpdStmt.stmt_list);
          break;

        case ExpressionStatementK:
          PRINTDESC("Expression Statement\n");
          PRINTDESC("> Expression :\n");
          printTree(tree->attr.exprStmt.expr);
          break;

        case SelectionStatementK:
          PRINTDESC("Selection Statement\n");
          PRINTDESC("> Expression inside if(*) :\n");
          printTree(tree->attr.selectStmt.expr);
          PRINTDESC("> Statements inside if clause :\n");
          printTree(tree->attr.selectStmt.if_stmt);
          PRINTDESC("> Statements inside else clause :\n");
          printTree(tree->attr.selectStmt.else_stmt);
          break;

        case IterationStatementK:
          PRINTDESC("Iteration Statement\n");
          PRINTDESC("> Expression inside while(*) :\n");
          printTree(tree->attr.iterStmt.expr);
          PRINTDESC("> Statements inside while clause :\n");
          printTree(tree->attr.iterStmt.loop_stmt);
          break;

        case ReturnStatementK:
          PRINTDESC("Return Statement\n");
          PRINTDESC("> Returning expression :\n");
          printTree(tree->attr.retStmt.expr);
          break;

        case AssignExpressionK:
          PRINTDESC("Assignment Expression\n");
          PRINTDESC("> Variable associated to assignment :\n");
          printTree(tree->attr.assignStmt._var);
          PRINTDESC("> Value assigned :\n");
          printTree(tree->attr.assignStmt.expr);
          break;

        case ComparisonExpressionK:
          PRINTDESC("Comparison Expression\n");
          printTree(tree->attr.cmpExpr.op);
          PRINTDESC("> Left expression compared :\n");
          printTree(tree->attr.cmpExpr.lexpr);
          PRINTDESC("> Right expression compared :\n");
          printTree(tree->attr.cmpExpr.rexpr);
          break;

        case AdditiveExpressionK:
          PRINTDESC("Additive Expression\n");
          printTree(tree->attr.addExpr.op);
          PRINTDESC("> Left expression added / subtracted :\n");
          printTree(tree->attr.addExpr.lexpr);
          PRINTDESC("> Right expression added / subtracted :\n");
          printTree(tree->attr.addExpr.rexpr);
          break;

        case MultiplicativeExpressionK:
          PRINTDESC("Multiplicative Expression\n");
          printTree(tree->attr.multExpr.op);
          PRINTDESC("> Left expression multiplied / divided :\n");
          printTree(tree->attr.multExpr.lexpr);
          PRINTDESC("> Right expression multiplied / divided :\n");
          printTree(tree->attr.multExpr.rexpr);
          break;

        case VariableK:
          PRINTDESC("Variable Id : %s\n", tree->attr.ID);
          break;

        case ArrayK:
          PRINTDESC("Array\n");
          printTree(tree->attr.arr._var);
          PRINTDESC("> Expression inside subscript [*]\n");
          printTree(tree->attr.arr.arr_expr);
          break;

        case CallK:
          PRINTDESC("Function Call\n");
          printTree(tree->attr.call._var);
          PRINTDESC("> Function arguments :\n");
          printTree(tree->attr.call.expr_list);
          break;

        case ConstantK:
          PRINTDESC("Constant : %d\n", tree->attr.NUM);
          break;

        case TokenTypeK:
          PRINTDESC("Token : %s\n", operatorString(tree->attr.TOK));
          break;

        default:
          PRINTDESC("[DEBUG] No such nodeKind\n");
        }
    }
  UNINDENT;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
addl $0x2, 0x19fa7(%rip)     # 0x1f2c8
testq %rdi, %rdi
jne 0x5347
callq 0x5814
leaq 0x5ece(%rip), %rax      # 0xb200
movq (%rax), %rcx
leaq 0x297a(%rip), %rdi      # 0x7cb6
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x11c0
leaq 0x5eb2(%rip), %r15      # 0xb200
pushq $0x1
popq %r12
leaq 0x278b(%rip), %r14      # 0x7ae4
testq %rbx, %rbx
je 0x57fe
movl 0xc(%rbx), %r13d
callq 0x5814
movq (%r15), %rcx
cmpq $0x13, %r13
ja 0x5614
movslq (%r14,%r13,4), %rax
addq %r14, %rax
jmpq *%rax
leaq 0x2936(%rip), %rdi      # 0x7cbe
pushq $0x1c
jmp 0x561d
leaq 0x2c84(%rip), %rdi      # 0x801a
pushq $0x6
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x2c68(%rip), %rdi      # 0x8021
pushq $0x22
jmp 0x56e5
leaq 0x2bd1(%rip), %rdi      # 0x7f98
pushq $0x1a
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x2bc9(%rip), %rdi      # 0x7fb3
pushq $0x29
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x2bd0(%rip), %rdi      # 0x7fdd
pushq $0x2a
jmp 0x57ab
leaq 0x2a71(%rip), %rdi      # 0x7e8c
pushq $0x16
popq %rsi
movq %r12, %rdx
callq 0x11c0
callq 0x5814
movq (%r15), %rcx
leaq 0x2a6e(%rip), %rdi      # 0x7ea3
pushq $0x26
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x2a72(%rip), %rdi      # 0x7eca
pushq $0x13
jmp 0x5733
leaq 0x28d8(%rip), %rdi      # 0x7d3e
jmp 0x55df
leaq 0x2a6c(%rip), %rdi      # 0x7ede
pushq $0x16
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x2a60(%rip), %rdi      # 0x7ef5
pushq $0x1d
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x2a5b(%rip), %rdi      # 0x7f13
pushq $0x1e
jmp 0x57ab
leaq 0x13fb(%rip), %rdi      # 0x68c1
pushq $0x14
popq %rsi
movq %r12, %rdx
callq 0x11c0
callq 0x5814
movq (%r15), %rcx
leaq 0x293c(%rip), %rdi      # 0x7e1c
pushq $0x1f
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x2939(%rip), %rdi      # 0x7e3c
pushq $0x23
jmp 0x56e5
leaq 0x27e0(%rip), %rdi      # 0x7cf1
pushq $0x12
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x5309
movq 0x28(%rbx), %rdi
callq 0x5309
jmp 0x57b4
movq 0x20(%rbx), %rdx
movq %rcx, %rdi
leaq 0x2ac7(%rip), %rsi      # 0x8008
jmp 0x57f5
leaq 0x27b7(%rip), %rdi      # 0x7d04
pushq $0x15
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x5309
movq 0x28(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x27a1(%rip), %rdi      # 0x7d1a
pushq $0xf
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x30(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x278e(%rip), %rdi      # 0x7d2a
pushq $0x13
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x38(%rbx), %rdi
jmp 0x57b8
leaq 0x27de(%rip), %rdi      # 0x7d95
pushq $0x15
popq %rsi
movq %r12, %rdx
callq 0x11c0
callq 0x5814
movq (%r15), %rcx
leaq 0x27da(%rip), %rdi      # 0x7dab
pushq $0xf
jmp 0x5733
leaq 0x26fc(%rip), %rdi      # 0x7cdb
pushq $0x15
jmp 0x5634
leaq 0x2a5a(%rip), %rdi      # 0x8044
pushq $0xe
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x2a46(%rip), %rdi      # 0x8053
pushq $0x17
jmp 0x56e5
leaq 0x2a6b(%rip), %rdi      # 0x8086
pushq $0x19
popq %rsi
movq %r12, %rdx
callq 0x11c0
jmp 0x57bd
leaq 0x2722(%rip), %rdi      # 0x7d54
pushq $0x12
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x5309
jmp 0x56ee
leaq 0x28e0(%rip), %rdi      # 0x7f32
pushq $0x14
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x28d2(%rip), %rdi      # 0x7f47
pushq $0x27
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x28d7(%rip), %rdi      # 0x7f6f
pushq $0x28
jmp 0x57ab
leaq 0x1152(%rip), %rdi      # 0x67f8
pushq $0x13
popq %rsi
movq %r12, %rdx
callq 0x11c0
callq 0x5814
movq (%r15), %rcx
leaq 0x26a7(%rip), %rdi      # 0x7d67
pushq $0x17
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x269c(%rip), %rdi      # 0x7d7f
pushq $0x15
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x28(%rbx), %rdi
jmp 0x57b8
movl 0x20(%rbx), %edx
movq %rcx, %rdi
leaq 0x2967(%rip), %rsi      # 0x806b
xorl %eax, %eax
callq 0x1120
jmp 0x57bd
leaq 0x2749(%rip), %rdi      # 0x7e60
pushq $0x11
popq %rsi
movq %r12, %rdx
callq 0x11c0
callq 0x5814
movq (%r15), %rcx
leaq 0x2741(%rip), %rdi      # 0x7e72
pushq $0x19
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x20(%rbx), %rdi
jmp 0x57b8
leaq 0x10de(%rip), %rdi      # 0x6827
pushq $0x14
popq %rsi
movq %r12, %rdx
callq 0x11c0
callq 0x5814
movq (%r15), %rcx
leaq 0x2658(%rip), %rdi      # 0x7dbb
pushq $0x1c
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x2652(%rip), %rdi      # 0x7dd8
pushq $0x20
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x5309
callq 0x5814
movq (%r15), %rcx
leaq 0x2650(%rip), %rdi      # 0x7df9
pushq $0x22
popq %rsi
movq %r12, %rdx
callq 0x11c0
movq 0x30(%rbx), %rdi
callq 0x5309
movq (%rbx), %rbx
jmp 0x5359
movl 0x20(%rbx), %eax
movl $0xfffffef9, %edx       # imm = 0xFFFFFEF9
addl %edx, %eax
leaq 0x1a50(%rip), %rdx      # 0x7226
cmpl $0xd, %eax
ja 0x57eb
movl %eax, %eax
leaq 0x2350(%rip), %rsi      # 0x7b34
movslq (%rsi,%rax,4), %rdx
addq %rsi, %rdx
movq %rcx, %rdi
leaq 0x2885(%rip), %rsi      # 0x807a
xorl %eax, %eax
callq 0x1120
jmp 0x57bd
addl $-0x2, 0x19ac3(%rip)    # 0x1f2c8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq