// File: /workspace/github_cpp_makefile_star2_O3/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 0xb796(%rip), %rsi      # 0x152b1
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
jne 0x9c12
callq 0xb0dc
movl $0xc0, %r15d
movq 0x8(%rbx), %rsi
addq %r15, %rsi
leaq 0x11ddc(%rip), %rdi     # 0x1b920
callq 0x3b9e
movq (%rbx), %rdi
addq $0x30, %rdi
leaq 0xb61d(%rip), %rsi      # 0x15174
callq 0x2090
testl %eax, %eax
je 0x9bc6
movq (%rbx), %rdi
addq $0x30, %rdi
leaq 0xb6a8(%rip), %rsi      # 0x15216
callq 0x2090
testl %eax, %eax
jne 0x9c12
leaq 0x78(%rbx), %rdi
movq 0x80(%rbx), %rdx
leaq 0xb920(%rip), %r15      # 0x154ad
movl $0x4, %r8d
xorl %esi, %esi
movq %r15, %rcx
callq 0x22b0
movl $0xc0, %esi
addq 0x8(%rbx), %rsi
leaq 0x11d8b(%rip), %rdi     # 0x1b938
callq 0xabec
movq 0x8(%rax), %rdx
movl $0x4, %r8d
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rcx
jmp 0x9c0d
leaq 0x78(%rbx), %rdi
movq 0x80(%rbx), %rdx
leaq 0xb8cd(%rip), %r12      # 0x154a5
movl $0x7, %r8d
xorl %esi, %esi
movq %r12, %rcx
callq 0x22b0
addq 0x8(%rbx), %r15
leaq 0x11d45(%rip), %rdi     # 0x1b938
movq %r15, %rsi
callq 0xabec
movq 0x8(%rax), %rdx
movl $0x7, %r8d
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rcx
callq 0x22b0
leaq 0xb63d(%rip), %rsi      # 0x15256
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
jne 0x9c45
movl $0xc0, %esi
addq (%rbx), %rsi
leaq 0x11d04(%rip), %rdi     # 0x1b938
callq 0xabec
leaq 0x78(%rbx), %rdi
movq %rax, %rsi
callq 0x2100
leaq 0xb5de(%rip), %rsi      # 0x1522a
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0x9d47
leaq 0xb5b8(%rip), %rsi      # 0x1521b
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0x9e13
leaq 0xb5a6(%rip), %rsi      # 0x15220
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
jne 0xa270
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 0x3c10
movq %r14, %rdi
callq 0xb10a
movl %eax, %ebp
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0x9cde
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpl $-0x1, %ebp
je 0x9fae
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 0x3c10
movl 0x50(%rbx), %esi
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x3, %ecx
callq 0xb144
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0xa270
movq 0x90(%rsp), %rsi
jmp 0xa013
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 0x3c10
movq %r14, %rdi
callq 0xb10a
movl %eax, %ebp
movq 0x140(%rsp), %rdi
cmpq %r15, %rdi
je 0x9d9f
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpl $-0x1, %ebp
je 0x9ed7
movq 0x8(%rbx), %rax
movl 0x50(%rax), %r12d
movl %r12d, %ebx
negl %ebx
cmovsl %r12d, %ebx
movl $0x1, %ebp
cmpl $0xa, %ebx
jb 0xa027
movl $0x4, %ebp
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebx, %ecx
cmpl $0x63, %ecx
jbe 0xa020
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xa025
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xa027
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %ebp
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x9dd3
addl $-0x3, %ebp
jmp 0xa027
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 0x3c10
movq %r14, %rdi
callq 0xb10a
movl %eax, %ebp
movq 0x100(%rsp), %rdi
cmpq %r15, %rdi
je 0x9e67
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpl $-0x1, %ebp
je 0x9f47
movl 0x50(%rbx), %r12d
movl %r12d, %ebx
negl %ebx
cmovsl %r12d, %ebx
movl $0x1, %ebp
cmpl $0xa, %ebx
jb 0xa136
movl $0x4, %ebp
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebx, %ecx
cmpl $0x63, %ecx
jbe 0xa12f
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xa134
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xa136
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %ebp
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x9e97
addl $-0x3, %ebp
jmp 0xa136
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 0x3c10
movl 0x11a5a(%rip), %edx     # 0x1b968
leal 0x1(%rdx), %eax
movl %eax, 0x11a51(%rip)     # 0x1b968
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x2, %ecx
callq 0xb144
movq 0x120(%rsp), %rdi
cmpq %r14, %rdi
je 0xa270
movq 0x130(%rsp), %rsi
jmp 0xa013
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 0x3c10
movl 0x50(%rbx), %esi
movl 0x119eb(%rip), %edx     # 0x1b968
leal 0x1(%rdx), %eax
movl %eax, 0x119e2(%rip)     # 0x1b968
movq %r14, %rdi
movl $0x1, %ecx
callq 0xb144
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0xa270
movq 0xf0(%rsp), %rsi
jmp 0xa013
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 0x3c10
movl 0x50(%rbx), %esi
movl 0x11984(%rip), %edx     # 0x1b968
leal 0x1(%rdx), %eax
movl %eax, 0x1197b(%rip)     # 0x1b968
movq %r14, %rdi
movl $0x3, %ecx
callq 0xb144
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0xa270
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xa270
addl $-0x2, %ebp
jmp 0xa027
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 0xafe5
leaq 0xb451(%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 0xa099
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0xa0a0
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 0xb3f7(%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 0xa0ee
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0xa0f6
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 0xb641
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0xa23d
movq 0x70(%rsp), %rsi
jmp 0xa235
addl $-0x2, %ebp
jmp 0xa136
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 0xafe5
leaq 0xb342(%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 0xa1a8
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0xa1af
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 0xb307(%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 0xa1fd
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0xa205
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 0xb641
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0xa23d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21c0
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0xa253
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xa26a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21c0
incl 0x116a8(%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 0xa3bf
movq 0xb0(%rsp), %rsi
jmp 0xa3b7
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0xa3bf
movq 0xf0(%rsp), %rsi
jmp 0xa3b7
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0xa3bf
movq 0x90(%rsp), %rsi
jmp 0xa3b7
movq %rax, %rbx
movq 0x120(%rsp), %rdi
cmpq %r14, %rdi
je 0xa3bf
movq 0x130(%rsp), %rsi
jmp 0xa3b7
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0xa359
movq 0x50(%rsp), %rsi
jmp 0xa34c
jmp 0xa356
jmp 0xa371
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0xa3bf
movq 0xd0(%rsp), %rsi
jmp 0xa3b7
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0xa359
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xa359
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0xa374
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xa374
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xa3bf
movq 0x30(%rsp), %rsi
jmp 0xa3b7
movq %rax, %rbx
movq 0x100(%rsp), %rdi
cmpq %r15, %rdi
je 0xa3bf
movq 0x110(%rsp), %rsi
jmp 0xa3b7
movq %rax, %rbx
movq 0x140(%rsp), %rdi
cmpq %r15, %rdi
je 0xa3bf
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2310