// File: /workspace/github_cpp_makefile_star2_O3/JameyWoo[P]csmile/analyze.cpp
// Function: checkNode(TreeNode*)
static void checkNode(TreeNode *t) {
    // symtabOut << t->nodekind << endl;
    // 添加对函数类型的生成
    // 由于是后序遍历, 函数的类型是最后检查的...
    if (t->nodekind == "FunDecl") {
        // error("func...");
        if (t->child[0]->nodekind == "int")
            t->type = "Integer";
        else if (t->child[0]->nodekind == "void")
            t->type = "Void";
    } else if (t->nodekind == "Id") {
        t->type = "Integer";
    } else if (t->nodekind == "CompareOp") {
        t->type = "Boolean";
    } else if (t->nodekind == "Const") {
        t->type = "Integer";
    } else if (t->nodekind == "MDOp") {
        if (t->child[0]->type == "Integer" && t->child[1]->type == "Integer") {
            t->type = "Integer";
        } else {
            typeError++;
            error("乘除类型错误");
        }
    } else if (t->nodekind == "PMOp") {
        if (t->child[0]->type == "Integer" && t->child[1]->type == "Integer") {
            t->type = "Integer";
        } else {
            typeError++;
            error("加减类型错误");
        }
    } else if (t->nodekind == "Input") {
        t->type = "Integer";
    }

    // 语句的类型判断
    if (t->nodekind == "Selection") {
        // if 选择
        if (t->child[0]->type != "Boolean") {
            typeError++;
            error("if 类型错误");
        } else {
            // symtabOut << "match" << endl;
        }
    } else if (t->nodekind == "Iteration") {
        // while 迭代
        if (t->child[0]->type != "Boolean") {
            typeError++;
            error("while 类型错误");
        }
    } else if (t->nodekind == "Assign") {
        if (t->child[1]->type != "Integer") {
            error("t->child[1]->nodekind" + t->child[1]->nodekind);
            if (t->child[1]->nodekind != "FunDecl") {
                typeError++;
                error("line " + to_string(t->line) + ": 赋值类型错误");
            }
        } else {
            t->type = "Integer";
        }
    }
    // symtabOut << "t->type = " << t->type << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rdi, %rbx
leaq 0x30(%rdi), %r14
leaq 0xae05(%rip), %rsi      # 0x152b1
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa54b
leaq 0xad5d(%rip), %rsi      # 0x15220
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa593
leaq 0xac33(%rip), %rsi      # 0x1510d
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa5a7
leaq 0xad74(%rip), %rsi      # 0x15265
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa593
leaq 0xad63(%rip), %rsi      # 0x1526b
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa7ce
leaq 0xad51(%rip), %rsi      # 0x15270
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa87f
leaq 0xad3f(%rip), %rsi      # 0x15275
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
jne 0xa5c6
jmp 0xa90d
movq (%rbx), %rdi
addq $0x30, %rdi
leaq 0xac1b(%rip), %rsi      # 0x15174
callq 0x2090
testl %eax, %eax
je 0xa593
movq (%rbx), %rdi
addq $0x30, %rdi
leaq 0xaca6(%rip), %rsi      # 0x15216
callq 0x2090
testl %eax, %eax
jne 0xa5c6
leaq 0x78(%rbx), %rdi
movq 0x80(%rbx), %rdx
leaq 0xaf22(%rip), %rcx      # 0x154ad
movl $0x4, %r8d
jmp 0xa5bf
leaq 0x78(%rbx), %rdi
movq 0x80(%rbx), %rdx
leaq 0xaf00(%rip), %rcx      # 0x154a5
jmp 0xa5b9
leaq 0x78(%rbx), %rdi
movq 0x80(%rbx), %rdx
leaq 0xaf3d(%rip), %rcx      # 0x154f6
movl $0x7, %r8d
xorl %esi, %esi
callq 0x22b0
leaq 0xac68(%rip), %rsi      # 0x15235
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa6f8
leaq 0xac63(%rip), %rsi      # 0x15247
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa769
leaq 0xacaf(%rip), %rsi      # 0x152aa
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
jne 0xaa5d
movq 0x8(%rbx), %rdi
addq $0x78, %rdi
leaq 0xae8b(%rip), %rsi      # 0x154a5
callq 0x2090
testl %eax, %eax
je 0xa858
movq 0x8(%rbx), %rdx
addq $0x30, %rdx
leaq 0xaf11(%rip), %rsi      # 0x15547
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
callq 0xb052
movq %r14, %rdi
callq 0xb641
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa66f
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
leaq 0xac33(%rip), %rsi      # 0x152b1
callq 0x2090
testl %eax, %eax
je 0xaa5d
incl 0x1128b(%rip)           # 0x1b91c
movl 0x50(%rbx), %r12d
movl %r12d, %ebx
negl %ebx
cmovsl %r12d, %ebx
movl $0x1, %ebp
cmpl $0xa, %ebx
jb 0xa929
movl $0x4, %ebp
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebx, %ecx
cmpl $0x63, %ecx
jbe 0xa922
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xa927
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xa929
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %ebp
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xa6b8
addl $-0x3, %ebp
jmp 0xa929
movq (%rbx), %rdi
addq $0x78, %rdi
leaq 0xadf0(%rip), %rsi      # 0x154f6
callq 0x2090
testl %eax, %eax
je 0xaa5d
incl 0x11203(%rip)           # 0x1b91c
leaq 0x90(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xadf8(%rip), %rsi      # 0x15524
leaq 0xae00(%rip), %rdx      # 0x15533
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
callq 0x312c
movq %rbx, %rdi
callq 0xb641
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0xaa5d
movq 0x90(%rsp), %rsi
jmp 0xaa55
movq (%rbx), %rdi
addq $0x78, %rdi
leaq 0xad7f(%rip), %rsi      # 0x154f6
callq 0x2090
testl %eax, %eax
je 0xaa5d
incl 0x11192(%rip)           # 0x1b91c
leaq 0x70(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xad9a(%rip), %rsi      # 0x15534
leaq 0xada5(%rip), %rdx      # 0x15546
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x312c
movq %rbx, %rdi
callq 0xb641
movq 0x60(%rsp), %rdi
cmpq %r14, %rdi
je 0xaa5d
movq 0x70(%rsp), %rsi
jmp 0xaa55
movq (%rbx), %rdi
addq $0x78, %rdi
leaq 0xacc9(%rip), %rsi      # 0x154a5
callq 0x2090
testl %eax, %eax
jne 0xa801
movq 0x8(%rbx), %rdi
addq $0x78, %rdi
leaq 0xacb1(%rip), %rsi      # 0x154a5
callq 0x2090
testl %eax, %eax
je 0xa90d
incl 0x11115(%rip)           # 0x1b91c
leaq 0xd0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xace3(%rip), %rsi      # 0x154fe
leaq 0xacee(%rip), %rdx      # 0x15510
leaq 0xc0(%rsp), %r15
movq %r15, %rdi
callq 0x312c
movq %r15, %rdi
callq 0xb641
movq 0xc0(%rsp), %rdi
cmpq %r12, %rdi
je 0xa5c6
movq 0xd0(%rsp), %rsi
jmp 0xa900
movq 0x80(%rbx), %rdx
addq $0x78, %rbx
leaq 0xac3b(%rip), %rcx      # 0x154a5
movl $0x7, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x22b0
jmp 0xaa5d
movq (%rbx), %rdi
addq $0x78, %rdi
leaq 0xac18(%rip), %rsi      # 0x154a5
callq 0x2090
testl %eax, %eax
jne 0xa8ae
movq 0x8(%rbx), %rdi
addq $0x78, %rdi
leaq 0xac00(%rip), %rsi      # 0x154a5
callq 0x2090
testl %eax, %eax
je 0xa90d
incl 0x11068(%rip)           # 0x1b91c
leaq 0xb0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xac49(%rip), %rsi      # 0x15511
leaq 0xac54(%rip), %rdx      # 0x15523
leaq 0xa0(%rsp), %r15
movq %r15, %rdi
callq 0x312c
movq %r15, %rdi
callq 0xb641
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0xa5c6
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xa5c6
leaq 0x78(%rbx), %rdi
leaq 0xab8d(%rip), %rsi      # 0x154a5
callq 0x2250
jmp 0xa5c6
addl $-0x2, %ebp
jmp 0xa929
decl %ebp
shrl $0x1f, %r12d
movl %r12d, %esi
addl %ebp, %esi
leaq 0x50(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x40(%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 0xab4f(%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 0xa99b
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0xa9a2
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 0xab9a(%rip), %rsi      # 0x1555d
callq 0x2340
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xa9f0
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0xa9f8
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x20(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0xb641
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0xaa30
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21c0
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0xaa46
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0xaa5d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21c0
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0xab4c
movq 0xb0(%rsp), %rsi
jmp 0xab44
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
cmpq %r12, %rdi
je 0xab4c
movq 0xd0(%rsp), %rsi
jmp 0xab44
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0xaace
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xaace
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0xaae9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xaae9
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0xab4c
movq 0x50(%rsp), %rsi
jmp 0xab44
movq %rax, %rbx
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xab4c
movq 0xf0(%rsp), %rsi
jmp 0xab44
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r14, %rdi
je 0xab4c
movq 0x70(%rsp), %rsi
jmp 0xab44
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0xab4c
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2310