// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/analyze.cpp
// Function: insertNode(TreeNode*)
static void insertNode(TreeNode *t) {
    if (t->nodekind == "FunDecl") {
        // 新的函数, 新的作用域
        newSymtabs();
        fun_names.push_back(t->child[1]->name);
        if (t->child[0]->nodekind == "int") {
            t->type                              = "Integer";
            fun_name2ret_type[t->child[1]->name] = "Integer";
        } else if (t->child[0]->nodekind == "void") {
            t->type                              = "Void";
            fun_name2ret_type[t->child[1]->name] = "Void";
        }
    }
    // 调用类型. 需要查符号表来赋值
    if (t->nodekind == "Call") {
        // t->nodekind =
        t->type = fun_name2ret_type[t->child[0]->name];
    }
    if (t->nodekind == "LocVarDecl") {  // 局部变量声明
        // 声明地时候只在符号表中添加, 检测到Id地时候才添加行号
        if (st_lookup(t->child[1]->name) == -1) {  // 符号表里没有
            st_insert(t->child[1]->name, -1, location++, 2);
        } else {
            // 符号表里有
            error("line " + to_string(t->child[1]->line) + " : 局部变量声明错误...");
            isError++;
        }
    } else if (t->nodekind == "ParamId") {
        // 作为参数地Id
        if (st_lookup(t->name) == -1) {  // 符号表里没有
            st_insert(t->name, t->line, location++, 1);
        } else {
            // 符号表里有
            error("line " + to_string(t->line) + " : 参数变量声明错误...");
            isError++;
        }
    } else if (t->nodekind == "Id") {
        if (st_lookup(t->name) == -1) {  // 符号表里没有
            st_insert(t->name, t->line, location++, 3);
        } else {
            // 符号表里有
            st_insert(t->name, t->line, -1, 3);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x160, %rsp            # imm = 0x160
movq %rdi, %rbx
leaq 0x30(%rdi), %r14
leaq 0x7fc0(%rip), %rsi      # 0xf2b1
movq %r14, %rdi
callq 0x368e
testb %al, %al
je 0x7387
callq 0x81f0
movl $0xc0, %r15d
movq 0x8(%rbx), %rsi
addq %r15, %rsi
leaq 0xf606(%rip), %rdi      # 0x16920
callq 0x3662
movq (%rbx), %rdi
addq $0x30, %rdi
leaq 0x7e47(%rip), %rsi      # 0xf174
callq 0x368e
testb %al, %al
je 0x733f
leaq 0x8168(%rip), %r12      # 0xf4a5
jmp 0x735d
movq (%rbx), %rdi
addq $0x30, %rdi
leaq 0x7e2b(%rip), %rsi      # 0xf178
callq 0x368e
testb %al, %al
je 0x7387
leaq 0x8150(%rip), %r12      # 0xf4ad
leaq 0x78(%rbx), %rdi
movq %r12, %rsi
callq 0x2330
addq 0x8(%rbx), %r15
leaq 0xf5c4(%rip), %rdi      # 0x16938
movq %r15, %rsi
callq 0x7c16
movq %rax, %rdi
movq %r12, %rsi
callq 0x2330
leaq 0x7ec8(%rip), %rsi      # 0xf256
movq %r14, %rdi
callq 0x368e
testb %al, %al
je 0x73ba
movl $0xc0, %esi
addq (%rbx), %rsi
leaq 0xf58f(%rip), %rdi      # 0x16938
callq 0x7c16
leaq 0x78(%rbx), %rdi
movq %rax, %rsi
callq 0x2110
leaq 0x7e71(%rip), %rsi      # 0xf232
movq %r14, %rdi
callq 0x368e
testb %al, %al
je 0x7458
movl $0xc0, %esi
addq 0x8(%rbx), %rsi
leaq 0x140(%rsp), %r14
movq %r14, %rdi
callq 0x2250
movq %r14, %rdi
callq 0x821e
movl %eax, %ebp
leaq 0x140(%rsp), %rdi
callq 0x2358
cmpl $-0x1, %ebp
je 0x7592
movq 0x8(%rbx), %rax
movl 0x50(%rax), %esi
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x7cbf
leaq 0x808d(%rip), %rsi      # 0xf4b2
movq %rsp, %rdi
movq %rbx, %rdx
callq 0x7c9b
leaq 0x8081(%rip), %rdx      # 0xf4b8
leaq 0x60(%rsp), %rdi
movq %rsp, %rsi
callq 0x7c7c
leaq 0x60(%rsp), %rdi
callq 0x85ae
leaq 0x60(%rsp), %rdi
jmp 0x74ee
leaq 0x7dc4(%rip), %rsi      # 0xf223
movq %r14, %rdi
callq 0x368e
testb %al, %al
je 0x7510
leaq 0xc0(%rbx), %r14
leaq 0x100(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x2250
movq %r15, %rdi
callq 0x821e
movl %eax, %ebp
leaq 0x100(%rsp), %rdi
callq 0x2358
cmpl $-0x1, %ebp
je 0x75d2
movl 0x50(%rbx), %esi
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x7cbf
leaq 0x7ff2(%rip), %rsi      # 0xf4b2
movq %rsp, %rdi
movq %rbx, %rdx
callq 0x7c9b
leaq 0x8005(%rip), %rdx      # 0xf4d7
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x7c7c
leaq 0x40(%rsp), %rdi
callq 0x85ae
leaq 0x40(%rsp), %rdi
callq 0x2358
movq %rsp, %rdi
callq 0x2358
leaq 0x20(%rsp), %rdi
callq 0x2358
incl 0xf40d(%rip)            # 0x16918
jmp 0x7649
leaq 0x7d11(%rip), %rsi      # 0xf228
movq %r14, %rdi
callq 0x368e
testb %al, %al
je 0x7649
leaq 0xc0(%rbx), %r14
leaq 0xc0(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x2250
movq %r15, %rdi
callq 0x821e
movl %eax, %ebp
leaq 0xc0(%rsp), %rdi
callq 0x2358
cmpl $-0x1, %ebp
je 0x760c
leaq 0x80(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x2250
movl 0x50(%rbx), %esi
pushq $-0x1
popq %rdx
pushq $0x3
popq %rcx
movq %r15, %rdi
callq 0x824f
leaq 0x80(%rsp), %rdi
jmp 0x7644
movl $0xc0, %esi
addq 0x8(%rbx), %rsi
leaq 0x120(%rsp), %rbx
movq %rbx, %rdi
callq 0x2250
movl 0xf3b7(%rip), %edx      # 0x16968
leal 0x1(%rdx), %eax
movl %eax, 0xf3ae(%rip)      # 0x16968
pushq $-0x1
popq %rsi
pushq $0x2
popq %rcx
movq %rbx, %rdi
callq 0x824f
leaq 0x120(%rsp), %rdi
jmp 0x7644
leaq 0xe0(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x2250
movl 0x50(%rbx), %esi
movl 0xf37a(%rip), %edx      # 0x16968
leal 0x1(%rdx), %eax
movl %eax, 0xf371(%rip)      # 0x16968
pushq $0x1
popq %rcx
movq %r15, %rdi
callq 0x824f
leaq 0xe0(%rsp), %rdi
jmp 0x7644
leaq 0xa0(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x2250
movl 0x50(%rbx), %esi
movl 0xf340(%rip), %edx      # 0x16968
leal 0x1(%rdx), %eax
movl %eax, 0xf337(%rip)      # 0x16968
pushq $0x3
popq %rcx
movq %r15, %rdi
callq 0x824f
leaq 0xa0(%rsp), %rdi
callq 0x2358
addq $0x160, %rsp            # imm = 0x160
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
jmp 0x76e9
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
jmp 0x76e9
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
jmp 0x76e9
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
jmp 0x76e9
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0x76c0
jmp 0x76c7
jmp 0x76d4
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
jmp 0x76e9
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
jmp 0x76e9
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2358
jmp 0x76ca
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2358
jmp 0x76d7
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0x76e9
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0x2358
movq %rbx, %rdi
callq 0x2300