// File: /workspace/github_cpp_makefile_star2_O1/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 0xb70d(%rip), %rsi      # 0x152b1
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
jne 0x9c9b
callq 0xb164
movl $0xc0, %r15d
movq 0x8(%rbx), %rsi
addq %r15, %rsi
leaq 0x11d53(%rip), %rdi     # 0x1b920
callq 0x3bea
movq (%rbx), %rdi
addq $0x30, %rdi
leaq 0xb594(%rip), %rsi      # 0x15174
callq 0x2090
testl %eax, %eax
je 0x9c4f
movq (%rbx), %rdi
addq $0x30, %rdi
leaq 0xb61f(%rip), %rsi      # 0x15216
callq 0x2090
testl %eax, %eax
jne 0x9c9b
leaq 0x78(%rbx), %rdi
movq 0x80(%rbx), %rdx
leaq 0xb897(%rip), %r15      # 0x154ad
movl $0x4, %r8d
xorl %esi, %esi
movq %r15, %rcx
callq 0x22b0
movl $0xc0, %esi
addq 0x8(%rbx), %rsi
leaq 0x11d02(%rip), %rdi     # 0x1b938
callq 0xac76
movq 0x8(%rax), %rdx
movl $0x4, %r8d
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rcx
jmp 0x9c96
leaq 0x78(%rbx), %rdi
movq 0x80(%rbx), %rdx
leaq 0xb844(%rip), %r12      # 0x154a5
movl $0x7, %r8d
xorl %esi, %esi
movq %r12, %rcx
callq 0x22b0
addq 0x8(%rbx), %r15
leaq 0x11cbc(%rip), %rdi     # 0x1b938
movq %r15, %rsi
callq 0xac76
movq 0x8(%rax), %rdx
movl $0x7, %r8d
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rcx
callq 0x22b0
leaq 0xb5b4(%rip), %rsi      # 0x15256
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
jne 0x9cce
movl $0xc0, %esi
addq (%rbx), %rsi
leaq 0x11c7b(%rip), %rdi     # 0x1b938
callq 0xac76
leaq 0x78(%rbx), %rdi
movq %rax, %rsi
callq 0x2100
leaq 0xb555(%rip), %rsi      # 0x1522a
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0x9dd0
leaq 0xb52f(%rip), %rsi      # 0x1521b
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0x9e9c
leaq 0xb51d(%rip), %rsi      # 0x15220
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
jne 0xa2f9
leaq 0xd0(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0xc0(%rbx), %rsi
movq 0xc8(%rbx), %rdx
addq %rsi, %rdx
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
callq 0x3c5c
movq %r14, %rdi
callq 0xb192
movl %eax, %ebp
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0x9d67
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpl $-0x1, %ebp
je 0xa037
leaq 0x90(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0xc0(%rbx), %rsi
movq 0xc8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %r14
movq %r14, %rdi
callq 0x3c5c
movl 0x50(%rbx), %esi
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x3, %ecx
callq 0xb1cc
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0xa2f9
movq 0x90(%rsp), %rsi
jmp 0xa09c
movq 0x8(%rbx), %rax
leaq 0x150(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0xc0(%rax), %rsi
movq 0xc8(%rax), %rdx
addq %rsi, %rdx
leaq 0x140(%rsp), %r14
movq %r14, %rdi
callq 0x3c5c
movq %r14, %rdi
callq 0xb192
movl %eax, %ebp
movq 0x140(%rsp), %rdi
cmpq %r15, %rdi
je 0x9e28
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpl $-0x1, %ebp
je 0x9f60
movq 0x8(%rbx), %rax
movl 0x50(%rax), %r12d
movl %r12d, %ebx
negl %ebx
cmovsl %r12d, %ebx
movl $0x1, %ebp
cmpl $0xa, %ebx
jb 0xa0b0
movl $0x4, %ebp
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebx, %ecx
cmpl $0x63, %ecx
jbe 0xa0a9
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xa0ae
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xa0b0
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %ebp
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x9e5c
addl $-0x3, %ebp
jmp 0xa0b0
leaq 0x110(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0xc0(%rbx), %rsi
movq 0xc8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x100(%rsp), %r14
movq %r14, %rdi
callq 0x3c5c
movq %r14, %rdi
callq 0xb192
movl %eax, %ebp
movq 0x100(%rsp), %rdi
cmpq %r15, %rdi
je 0x9ef0
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpl $-0x1, %ebp
je 0x9fd0
movl 0x50(%rbx), %r12d
movl %r12d, %ebx
negl %ebx
cmovsl %r12d, %ebx
movl $0x1, %ebp
cmpl $0xa, %ebx
jb 0xa1bf
movl $0x4, %ebp
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebx, %ecx
cmpl $0x63, %ecx
jbe 0xa1b8
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xa1bd
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xa1bf
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %ebp
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x9f20
addl $-0x3, %ebp
jmp 0xa1bf
movq 0x8(%rbx), %rax
leaq 0x130(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0xc0(%rax), %rsi
movq 0xc8(%rax), %rdx
addq %rsi, %rdx
leaq 0x120(%rsp), %rbx
movq %rbx, %rdi
callq 0x3c5c
movl 0x119d1(%rip), %edx     # 0x1b968
leal 0x1(%rdx), %eax
movl %eax, 0x119c8(%rip)     # 0x1b968
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x2, %ecx
callq 0xb1cc
movq 0x120(%rsp), %rdi
cmpq %r14, %rdi
je 0xa2f9
movq 0x130(%rsp), %rsi
jmp 0xa09c
leaq 0xf0(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0xc0(%rbx), %rsi
movq 0xc8(%rbx), %rdx
addq %rsi, %rdx
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
callq 0x3c5c
movl 0x50(%rbx), %esi
movl 0x11962(%rip), %edx     # 0x1b968
leal 0x1(%rdx), %eax
movl %eax, 0x11959(%rip)     # 0x1b968
movq %r14, %rdi
movl $0x1, %ecx
callq 0xb1cc
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0xa2f9
movq 0xf0(%rsp), %rsi
jmp 0xa09c
leaq 0xb0(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0xc0(%rbx), %rsi
movq 0xc8(%rbx), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
callq 0x3c5c
movl 0x50(%rbx), %esi
movl 0x118fb(%rip), %edx     # 0x1b968
leal 0x1(%rdx), %eax
movl %eax, 0x118f2(%rip)     # 0x1b968
movq %r14, %rdi
movl $0x3, %ecx
callq 0xb1cc
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0xa2f9
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xa2f9
addl $-0x2, %ebp
jmp 0xa0b0
decl %ebp
shrl $0x1f, %r12d
movl %r12d, %esi
addl %ebp, %esi
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl $0x2d, %edx
callq 0x2230
movq (%r14), %rdi
addq %r12, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0xb06f
leaq 0xb3c8(%rip), %rcx      # 0x154b2
movl $0x5, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2200
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xa122
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0xa129
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rsp, %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xb36e(%rip), %rsi      # 0x154b8
callq 0x2340
leaq 0x70(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xa177
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0xa17f
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x60(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0xb6c2
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0xa2c6
movq 0x70(%rsp), %rsi
jmp 0xa2be
addl $-0x2, %ebp
jmp 0xa1bf
decl %ebp
shrl $0x1f, %r12d
movl %r12d, %esi
addl %ebp, %esi
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl $0x2d, %edx
callq 0x2230
movq (%r14), %rdi
addq %r12, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0xb06f
leaq 0xb2b9(%rip), %rcx      # 0x154b2
movl $0x5, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2200
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xa231
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0xa238
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rsp, %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xb27e(%rip), %rsi      # 0x154d7
callq 0x2340
leaq 0x50(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xa286
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0xa28e
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x40(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0xb6c2
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0xa2c6
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21c0
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0xa2dc
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xa2f3
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21c0
incl 0x1161f(%rip)           # 0x1b918
addq $0x160, %rsp            # imm = 0x160
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0xa448
movq 0xb0(%rsp), %rsi
jmp 0xa440
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0xa448
movq 0xf0(%rsp), %rsi
jmp 0xa440
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0xa448
movq 0x90(%rsp), %rsi
jmp 0xa440
movq %rax, %rbx
movq 0x120(%rsp), %rdi
cmpq %r14, %rdi
je 0xa448
movq 0x130(%rsp), %rsi
jmp 0xa440
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0xa3e2
movq 0x50(%rsp), %rsi
jmp 0xa3d5
jmp 0xa3df
jmp 0xa3fa
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0xa448
movq 0xd0(%rsp), %rsi
jmp 0xa440
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0xa3e2
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xa3e2
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0xa3fd
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xa3fd
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xa448
movq 0x30(%rsp), %rsi
jmp 0xa440
movq %rax, %rbx
movq 0x100(%rsp), %rdi
cmpq %r15, %rdi
je 0xa448
movq 0x110(%rsp), %rsi
jmp 0xa440
movq %rax, %rbx
movq 0x140(%rsp), %rdi
cmpq %r15, %rdi
je 0xa448
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2310