// File: /workspace/github_c_makefile_star2_O3/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
addl $0x2, 0x19b10(%rip)     # 0x1f2c8
testq %rdi, %rdi
je 0x5d5b
movq %rdi, %rbx
leaq 0x5a35(%rip), %r12      # 0xb200
leaq 0x2312(%rip), %r13      # 0x7ae4
leaq 0x28a1(%rip), %r15      # 0x807a
movl 0xc(%rbx), %r14d
callq 0x5d96
movq (%r12), %rcx
cmpq $0x13, %r14
ja 0x5b28
movslq (%r13,%r14,4), %rax
addq %r13, %rax
jmpq *%rax
movl $0x1c, %esi
movl $0x1, %edx
leaq 0x24b3(%rip), %rdi      # 0x7cbe
jmp 0x5b39
movl $0x6, %esi
movl $0x1, %edx
leaq 0x27f9(%rip), %rdi      # 0x801a
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x22, %esi
movl $0x1, %edx
leaq 0x27d8(%rip), %rdi      # 0x8021
jmp 0x5c25
movl $0x1a, %esi
movl $0x1, %edx
leaq 0x2739(%rip), %rdi      # 0x7f98
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x29, %esi
movl $0x1, %edx
leaq 0x272c(%rip), %rdi      # 0x7fb3
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x2a, %esi
movl $0x1, %edx
leaq 0x272e(%rip), %rdi      # 0x7fdd
jmp 0x5d0a
movl $0x16, %esi
movl $0x1, %edx
leaq 0x25c7(%rip), %rdi      # 0x7e8c
callq 0x11c0
callq 0x5d96
movq (%r12), %rcx
movl $0x26, %esi
movl $0x1, %edx
leaq 0x25bf(%rip), %rdi      # 0x7ea3
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x13, %esi
movl $0x1, %edx
leaq 0x25be(%rip), %rdi      # 0x7eca
jmp 0x5c7c
movl $0x15, %esi
movl $0x1, %edx
leaq 0x241c(%rip), %rdi      # 0x7d3e
jmp 0x5b54
movl $0x16, %esi
movl $0x1, %edx
leaq 0x25a6(%rip), %rdi      # 0x7ede
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x1d, %esi
movl $0x1, %edx
leaq 0x2595(%rip), %rdi      # 0x7ef5
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x1e, %esi
movl $0x1, %edx
leaq 0x258b(%rip), %rdi      # 0x7f13
jmp 0x5d0a
movl $0x14, %esi
movl $0x1, %edx
leaq 0xf23(%rip), %rdi       # 0x68c1
callq 0x11c0
callq 0x5d96
movq (%r12), %rcx
movl $0x1f, %esi
movl $0x1, %edx
leaq 0x245f(%rip), %rdi      # 0x7e1c
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x23, %esi
movl $0x1, %edx
leaq 0x2457(%rip), %rdi      # 0x7e3c
jmp 0x5c25
movl $0x12, %esi
movl $0x1, %edx
leaq 0x22f6(%rip), %rdi      # 0x7cf1
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x57a3
movq 0x28(%rbx), %rdi
callq 0x57a3
jmp 0x5d0f
movq 0x20(%rbx), %rdx
movq %rcx, %rdi
leaq 0x25e3(%rip), %rsi      # 0x8008
jmp 0x5d52
movl $0x15, %esi
movl $0x1, %edx
leaq 0x22c9(%rip), %rdi      # 0x7d04
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x57a3
movq 0x28(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0xf, %esi
movl $0x1, %edx
leaq 0x22ae(%rip), %rdi      # 0x7d1a
callq 0x11c0
movq 0x30(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x13, %esi
movl $0x1, %edx
leaq 0x2296(%rip), %rdi      # 0x7d2a
callq 0x11c0
movq 0x38(%rbx), %rdi
jmp 0x5d13
movl $0x15, %esi
movl $0x1, %edx
leaq 0x22e2(%rip), %rdi      # 0x7d95
callq 0x11c0
callq 0x5d96
movq (%r12), %rcx
movl $0xf, %esi
movl $0x1, %edx
leaq 0x22d9(%rip), %rdi      # 0x7dab
jmp 0x5c7c
movl $0x15, %esi
movl $0x1, %edx
leaq 0x21f3(%rip), %rdi      # 0x7cdb
jmp 0x5b54
movl $0xe, %esi
movl $0x1, %edx
leaq 0x2549(%rip), %rdi      # 0x8044
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x17, %esi
movl $0x1, %edx
leaq 0x2530(%rip), %rdi      # 0x8053
jmp 0x5c25
movl $0x19, %esi
movl $0x1, %edx
leaq 0x254d(%rip), %rdi      # 0x8086
callq 0x11c0
jmp 0x5d18
movl $0x12, %esi
movl $0x1, %edx
leaq 0x2200(%rip), %rdi      # 0x7d54
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x57a3
jmp 0x5c2a
movl $0x14, %esi
movl $0x1, %edx
leaq 0x23ba(%rip), %rdi      # 0x7f32
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x27, %esi
movl $0x1, %edx
leaq 0x23a7(%rip), %rdi      # 0x7f47
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x28, %esi
movl $0x1, %edx
leaq 0x23a7(%rip), %rdi      # 0x7f6f
jmp 0x5d0a
movl $0x13, %esi
movl $0x1, %edx
leaq 0xc1a(%rip), %rdi       # 0x67f8
callq 0x11c0
callq 0x5d96
movq (%r12), %rcx
movl $0x17, %esi
movl $0x1, %edx
leaq 0x216a(%rip), %rdi      # 0x7d67
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x15, %esi
movl $0x1, %edx
leaq 0x215a(%rip), %rdi      # 0x7d7f
callq 0x11c0
movq 0x28(%rbx), %rdi
jmp 0x5d13
movl 0x20(%rbx), %edx
movq %rcx, %rdi
leaq 0x242b(%rip), %rsi      # 0x806b
xorl %eax, %eax
callq 0x1120
jmp 0x5d18
movl $0x11, %esi
movl $0x1, %edx
leaq 0x2203(%rip), %rdi      # 0x7e60
callq 0x11c0
callq 0x5d96
movq (%r12), %rcx
movl $0x19, %esi
movl $0x1, %edx
leaq 0x21f6(%rip), %rdi      # 0x7e72
callq 0x11c0
movq 0x20(%rbx), %rdi
jmp 0x5d13
movl $0x14, %esi
movl $0x1, %edx
leaq 0xb8c(%rip), %rdi       # 0x6827
callq 0x11c0
callq 0x5d96
movq (%r12), %rcx
movl $0x1c, %esi
movl $0x1, %edx
leaq 0x2101(%rip), %rdi      # 0x7dbb
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x20, %esi
movl $0x1, %edx
leaq 0x20f6(%rip), %rdi      # 0x7dd8
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x57a3
callq 0x5d96
movq (%r12), %rcx
movl $0x22, %esi
movl $0x1, %edx
leaq 0x20ef(%rip), %rdi      # 0x7df9
callq 0x11c0
movq 0x30(%rbx), %rdi
callq 0x57a3
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x57d9
jmp 0x5d80
movl 0x20(%rbx), %eax
movl $0xfffffef9, %edx       # imm = 0xFFFFFEF9
addl %edx, %eax
leaq 0x14ef(%rip), %rdx      # 0x7226
cmpl $0xd, %eax
ja 0x5d4c
movl %eax, %eax
leaq 0x1def(%rip), %rsi      # 0x7b34
movslq (%rsi,%rax,4), %rdx
addq %rsi, %rdx
movq %rcx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1120
jmp 0x5d18
callq 0x5d96
leaq 0x5499(%rip), %rax      # 0xb200
movq (%rax), %rcx
leaq 0x1f45(%rip), %rdi      # 0x7cb6
movl $0x7, %esi
movl $0x1, %edx
callq 0x11c0
addl $-0x2, 0x19541(%rip)    # 0x1f2c8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq