// File: /workspace/github_c_makefile_star2_O0/taeguk[P]Compiler-Proj-Cminus/src/analyze.c
// Function: insertNode
static void insertNode( TreeNode * t, int flags)
{
  for (; t; t = t->sibling)
    {
      SymbolInfo * symbolInfo = NULL;
      int registerSuccess = 0;

      switch (t->nodeKind)
        {
          /* Declaration Kinds */
        case VariableDeclarationK:
          symbolInfo = setSymbolInfo(t);
          if(symbolInfo)
            registerSuccess = registerSymbol(t, t->attr.varDecl._var, symbolInfo);
          if(!registerSuccess || !symbolInfo) 
            t->nodeType = ErrorT;
          break;
        case ArrayDeclarationK:
          symbolInfo = setSymbolInfo(t);
          if(symbolInfo)
            registerSuccess = registerSymbol(t, t->attr.arrDecl._var, symbolInfo);
          if(!registerSuccess || !symbolInfo) 
            t->nodeType = ErrorT;
          break;
        case FunctionDeclarationK:
          symbolInfo = setSymbolInfo(t);
          if(symbolInfo)
            registerSuccess = registerSymbol(t, t->attr.funcDecl._var, symbolInfo);
          if(!registerSuccess || !symbolInfo)
            {
              t->nodeType = ErrorT;
              //break; // TODO: review
            }
          st_push_scope();
          insertNode(t->attr.funcDecl.params, 0);
          insertNode(t->attr.funcDecl.cmpd_stmt, AlreadyPushedScope);
          break;

          /* Parameter Kinds */
        case VariableParameterK:
          symbolInfo = setSymbolInfo(t);
          if(symbolInfo)
            registerSuccess = registerSymbol(t, t->attr.varParam._var, symbolInfo);
          if(!registerSuccess || !symbolInfo)
            t->nodeType = ErrorT;
          break;
        case ArrayParameterK:
          symbolInfo = setSymbolInfo(t);
          if(symbolInfo)
            registerSuccess = registerSymbol(t, t->attr.arrParam._var, symbolInfo);
          if(!registerSuccess || !symbolInfo)
            t->nodeType = ErrorT;
          break;

          /* Statement Kinds */
        case CompoundStatementK:
          if (!(flags & AlreadyPushedScope))
            st_push_scope();
          insertNode(t->attr.cmpdStmt.local_decl, 0);
          insertNode(t->attr.cmpdStmt.stmt_list, 0);
          printSymTab(listing);
          st_pop_scope();
          break;
        case ExpressionStatementK:
          insertNode(t->attr.exprStmt.expr, 0);
          break;
        case SelectionStatementK:
          insertNode(t->attr.selectStmt.expr, 0);
          insertNode(t->attr.selectStmt.if_stmt, 0);
          insertNode(t->attr.selectStmt.else_stmt, 0);
          break;
        case IterationStatementK:
          insertNode(t->attr.iterStmt.expr, 0);
          insertNode(t->attr.iterStmt.loop_stmt, 0);
          break;
        case ReturnStatementK:
          insertNode(t->attr.retStmt.expr, 0);
          break;

          /* Expression Kinds */
        case AssignExpressionK:
          insertNode(t->attr.assignStmt.expr, 0);
          insertNode(t->attr.assignStmt._var, 0);
          break;
        case ComparisonExpressionK:
          insertNode(t->attr.cmpExpr.lexpr, 0);
          insertNode(t->attr.cmpExpr.op, 0);
          insertNode(t->attr.cmpExpr.rexpr, 0);
          break;
        case AdditiveExpressionK:
          insertNode(t->attr.addExpr.lexpr, 0);
          insertNode(t->attr.addExpr.op, 0);
          insertNode(t->attr.addExpr.rexpr, 0);
          break;
        case MultiplicativeExpressionK:
          insertNode(t->attr.multExpr.lexpr, 0);
          insertNode(t->attr.multExpr.op, 0);
          insertNode(t->attr.multExpr.rexpr, 0);
          break;

        case VariableK:
          referSymbol(t);
          break;
        case ArrayK:
          insertNode(t->attr.arr._var, 0);
          insertNode(t->attr.arr.arr_expr, 0);
          break;
        case CallK:
          insertNode(t->attr.call._var, 0);
          insertNode(t->attr.call.expr_list, 0);
          break;

          /* Leaf Nodes */
          /* Cannot be reached here!! */
        case ConstantK:
          /* nothing to do */
          break;
        case TokenTypeK:
          /* nothing to do */
          break;
        case ErrorK:
          DONT_OCCUR_PRINT;
          break;
        default:
          DONT_OCCUR_PRINT;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1904
movq $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movq %rax, -0x28(%rbp)
subq $0x13, %rax
ja 0x18f0
movq -0x28(%rbp), %rax
leaq 0x7a7b(%rip), %rcx      # 0x9004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
callq 0x22d0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x15be
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x26e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x15cb
cmpq $0x0, -0x18(%rbp)
jne 0x15d6
movq -0x8(%rbp), %rax
movl $0x1, 0x10(%rax)
jmp 0x18f2
movq -0x8(%rbp), %rdi
callq 0x22d0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1607
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x26e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1614
cmpq $0x0, -0x18(%rbp)
jne 0x161f
movq -0x8(%rbp), %rax
movl $0x1, 0x10(%rax)
jmp 0x18f2
movq -0x8(%rbp), %rdi
callq 0x22d0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1650
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x26e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x165d
cmpq $0x0, -0x18(%rbp)
jne 0x1668
movq -0x8(%rbp), %rax
movl $0x1, 0x10(%rax)
callq 0x6950
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movl $0x2, %esi
callq 0x1540
jmp 0x18f2
movq -0x8(%rbp), %rdi
callq 0x22d0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x16bf
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x26e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x16cc
cmpq $0x0, -0x18(%rbp)
jne 0x16d7
movq -0x8(%rbp), %rax
movl $0x1, 0x10(%rax)
jmp 0x18f2
movq -0x8(%rbp), %rdi
callq 0x22d0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1708
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x26e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1715
cmpq $0x0, -0x18(%rbp)
jne 0x1720
movq -0x8(%rbp), %rax
movl $0x1, 0x10(%rax)
jmp 0x18f2
movl -0xc(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x1735
callq 0x6950
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
callq 0x1540
leaq 0xcab6(%rip), %rax      # 0xe210
movq (%rax), %rdi
callq 0x6ff0
callq 0x69a0
jmp 0x18f2
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x1540
jmp 0x18f2
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
xorl %esi, %esi
callq 0x1540
jmp 0x18f2
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
callq 0x1540
jmp 0x18f2
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x1540
jmp 0x18f2
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
callq 0x1540
jmp 0x18f2
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
xorl %esi, %esi
callq 0x1540
jmp 0x18f2
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
xorl %esi, %esi
callq 0x1540
jmp 0x18f2
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
xorl %esi, %esi
callq 0x1540
jmp 0x18f2
movq -0x8(%rbp), %rdi
callq 0x27d0
jmp 0x18f2
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
callq 0x1540
jmp 0x18f2
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x1540
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
callq 0x1540
jmp 0x18f2
jmp 0x18f2
jmp 0x18f2
jmp 0x18f2
jmp 0x18f2
jmp 0x18f4
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x154f
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)