// File: /workspace/github_c_makefile_star2_O1/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, 0x19945(%rip)     # 0x1f2c8
testq %rdi, %rdi
je 0x5f26
movq %rdi, %rbx
leaq 0x586a(%rip), %r12      # 0xb200
leaq 0x2147(%rip), %r13      # 0x7ae4
leaq 0x26d6(%rip), %r15      # 0x807a
movl 0xc(%rbx), %r14d
callq 0x5f61
movq (%r12), %rcx
cmpq $0x13, %r14
ja 0x5cf3
movslq (%r13,%r14,4), %rax
addq %r13, %rax
jmpq *%rax
movl $0x1c, %esi
movl $0x1, %edx
leaq 0x22e8(%rip), %rdi      # 0x7cbe
jmp 0x5d04
movl $0x6, %esi
movl $0x1, %edx
leaq 0x262e(%rip), %rdi      # 0x801a
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x22, %esi
movl $0x1, %edx
leaq 0x260d(%rip), %rdi      # 0x8021
jmp 0x5df0
movl $0x1a, %esi
movl $0x1, %edx
leaq 0x256e(%rip), %rdi      # 0x7f98
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x29, %esi
movl $0x1, %edx
leaq 0x2561(%rip), %rdi      # 0x7fb3
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x2a, %esi
movl $0x1, %edx
leaq 0x2563(%rip), %rdi      # 0x7fdd
jmp 0x5ed5
movl $0x16, %esi
movl $0x1, %edx
leaq 0x23fc(%rip), %rdi      # 0x7e8c
callq 0x11c0
callq 0x5f61
movq (%r12), %rcx
movl $0x26, %esi
movl $0x1, %edx
leaq 0x23f4(%rip), %rdi      # 0x7ea3
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x13, %esi
movl $0x1, %edx
leaq 0x23f3(%rip), %rdi      # 0x7eca
jmp 0x5e47
movl $0x15, %esi
movl $0x1, %edx
leaq 0x2251(%rip), %rdi      # 0x7d3e
jmp 0x5d1f
movl $0x16, %esi
movl $0x1, %edx
leaq 0x23db(%rip), %rdi      # 0x7ede
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x1d, %esi
movl $0x1, %edx
leaq 0x23ca(%rip), %rdi      # 0x7ef5
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x1e, %esi
movl $0x1, %edx
leaq 0x23c0(%rip), %rdi      # 0x7f13
jmp 0x5ed5
movl $0x14, %esi
movl $0x1, %edx
leaq 0xd58(%rip), %rdi       # 0x68c1
callq 0x11c0
callq 0x5f61
movq (%r12), %rcx
movl $0x1f, %esi
movl $0x1, %edx
leaq 0x2294(%rip), %rdi      # 0x7e1c
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x23, %esi
movl $0x1, %edx
leaq 0x228c(%rip), %rdi      # 0x7e3c
jmp 0x5df0
movl $0x12, %esi
movl $0x1, %edx
leaq 0x212b(%rip), %rdi      # 0x7cf1
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x596e
movq 0x28(%rbx), %rdi
callq 0x596e
jmp 0x5eda
movq 0x20(%rbx), %rdx
movq %rcx, %rdi
leaq 0x2418(%rip), %rsi      # 0x8008
jmp 0x5f1d
movl $0x15, %esi
movl $0x1, %edx
leaq 0x20fe(%rip), %rdi      # 0x7d04
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x596e
movq 0x28(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0xf, %esi
movl $0x1, %edx
leaq 0x20e3(%rip), %rdi      # 0x7d1a
callq 0x11c0
movq 0x30(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x13, %esi
movl $0x1, %edx
leaq 0x20cb(%rip), %rdi      # 0x7d2a
callq 0x11c0
movq 0x38(%rbx), %rdi
jmp 0x5ede
movl $0x15, %esi
movl $0x1, %edx
leaq 0x2117(%rip), %rdi      # 0x7d95
callq 0x11c0
callq 0x5f61
movq (%r12), %rcx
movl $0xf, %esi
movl $0x1, %edx
leaq 0x210e(%rip), %rdi      # 0x7dab
jmp 0x5e47
movl $0x15, %esi
movl $0x1, %edx
leaq 0x2028(%rip), %rdi      # 0x7cdb
jmp 0x5d1f
movl $0xe, %esi
movl $0x1, %edx
leaq 0x237e(%rip), %rdi      # 0x8044
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x17, %esi
movl $0x1, %edx
leaq 0x2365(%rip), %rdi      # 0x8053
jmp 0x5df0
movl $0x19, %esi
movl $0x1, %edx
leaq 0x2382(%rip), %rdi      # 0x8086
callq 0x11c0
jmp 0x5ee3
movl $0x12, %esi
movl $0x1, %edx
leaq 0x2035(%rip), %rdi      # 0x7d54
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x596e
jmp 0x5df5
movl $0x14, %esi
movl $0x1, %edx
leaq 0x21ef(%rip), %rdi      # 0x7f32
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x27, %esi
movl $0x1, %edx
leaq 0x21dc(%rip), %rdi      # 0x7f47
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x28, %esi
movl $0x1, %edx
leaq 0x21dc(%rip), %rdi      # 0x7f6f
jmp 0x5ed5
movl $0x13, %esi
movl $0x1, %edx
leaq 0xa4f(%rip), %rdi       # 0x67f8
callq 0x11c0
callq 0x5f61
movq (%r12), %rcx
movl $0x17, %esi
movl $0x1, %edx
leaq 0x1f9f(%rip), %rdi      # 0x7d67
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x15, %esi
movl $0x1, %edx
leaq 0x1f8f(%rip), %rdi      # 0x7d7f
callq 0x11c0
movq 0x28(%rbx), %rdi
jmp 0x5ede
movl 0x20(%rbx), %edx
movq %rcx, %rdi
leaq 0x2260(%rip), %rsi      # 0x806b
xorl %eax, %eax
callq 0x1120
jmp 0x5ee3
movl $0x11, %esi
movl $0x1, %edx
leaq 0x2038(%rip), %rdi      # 0x7e60
callq 0x11c0
callq 0x5f61
movq (%r12), %rcx
movl $0x19, %esi
movl $0x1, %edx
leaq 0x202b(%rip), %rdi      # 0x7e72
callq 0x11c0
movq 0x20(%rbx), %rdi
jmp 0x5ede
movl $0x14, %esi
movl $0x1, %edx
leaq 0x9c1(%rip), %rdi       # 0x6827
callq 0x11c0
callq 0x5f61
movq (%r12), %rcx
movl $0x1c, %esi
movl $0x1, %edx
leaq 0x1f36(%rip), %rdi      # 0x7dbb
callq 0x11c0
movq 0x20(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x20, %esi
movl $0x1, %edx
leaq 0x1f2b(%rip), %rdi      # 0x7dd8
callq 0x11c0
movq 0x28(%rbx), %rdi
callq 0x596e
callq 0x5f61
movq (%r12), %rcx
movl $0x22, %esi
movl $0x1, %edx
leaq 0x1f24(%rip), %rdi      # 0x7df9
callq 0x11c0
movq 0x30(%rbx), %rdi
callq 0x596e
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x59a4
jmp 0x5f4b
movl 0x20(%rbx), %eax
movl $0xfffffef9, %edx       # imm = 0xFFFFFEF9
addl %edx, %eax
leaq 0x1324(%rip), %rdx      # 0x7226
cmpl $0xd, %eax
ja 0x5f17
movl %eax, %eax
leaq 0x1c24(%rip), %rsi      # 0x7b34
movslq (%rsi,%rax,4), %rdx
addq %rsi, %rdx
movq %rcx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1120
jmp 0x5ee3
callq 0x5f61
leaq 0x52ce(%rip), %rax      # 0xb200
movq (%rax), %rcx
leaq 0x1d7a(%rip), %rdi      # 0x7cb6
movl $0x7, %esi
movl $0x1, %edx
callq 0x11c0
addl $-0x2, 0x19376(%rip)    # 0x1f2c8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq