// File: /workspace/github_cpp_makefile_star2_O1/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 0xad7c(%rip), %rsi      # 0x152b1
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa5d4
leaq 0xacd4(%rip), %rsi      # 0x15220
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa61c
leaq 0xabaa(%rip), %rsi      # 0x1510d
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa630
leaq 0xaceb(%rip), %rsi      # 0x15265
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa61c
leaq 0xacda(%rip), %rsi      # 0x1526b
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa857
leaq 0xacc8(%rip), %rsi      # 0x15270
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa908
leaq 0xacb6(%rip), %rsi      # 0x15275
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
jne 0xa64f
jmp 0xa996
movq (%rbx), %rdi
addq $0x30, %rdi
leaq 0xab92(%rip), %rsi      # 0x15174
callq 0x2090
testl %eax, %eax
je 0xa61c
movq (%rbx), %rdi
addq $0x30, %rdi
leaq 0xac1d(%rip), %rsi      # 0x15216
callq 0x2090
testl %eax, %eax
jne 0xa64f
leaq 0x78(%rbx), %rdi
movq 0x80(%rbx), %rdx
leaq 0xae99(%rip), %rcx      # 0x154ad
movl $0x4, %r8d
jmp 0xa648
leaq 0x78(%rbx), %rdi
movq 0x80(%rbx), %rdx
leaq 0xae77(%rip), %rcx      # 0x154a5
jmp 0xa642
leaq 0x78(%rbx), %rdi
movq 0x80(%rbx), %rdx
leaq 0xaeb4(%rip), %rcx      # 0x154f6
movl $0x7, %r8d
xorl %esi, %esi
callq 0x22b0
leaq 0xabdf(%rip), %rsi      # 0x15235
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa781
leaq 0xabda(%rip), %rsi      # 0x15247
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0xa7f2
leaq 0xac26(%rip), %rsi      # 0x152aa
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
jne 0xaae6
movq 0x8(%rbx), %rdi
addq $0x78, %rdi
leaq 0xae02(%rip), %rsi      # 0x154a5
callq 0x2090
testl %eax, %eax
je 0xa8e1
movq 0x8(%rbx), %rdx
addq $0x30, %rdx
leaq 0xae88(%rip), %rsi      # 0x15547
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
callq 0xb0dc
movq %r14, %rdi
callq 0xb6c2
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa6f8
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
leaq 0xabaa(%rip), %rsi      # 0x152b1
callq 0x2090
testl %eax, %eax
je 0xaae6
incl 0x11202(%rip)           # 0x1b91c
movl 0x50(%rbx), %r12d
movl %r12d, %ebx
negl %ebx
cmovsl %r12d, %ebx
movl $0x1, %ebp
cmpl $0xa, %ebx
jb 0xa9b2
movl $0x4, %ebp
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebx, %ecx
cmpl $0x63, %ecx
jbe 0xa9ab
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xa9b0
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xa9b2
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %ebp
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xa741
addl $-0x3, %ebp
jmp 0xa9b2
movq (%rbx), %rdi
addq $0x78, %rdi
leaq 0xad67(%rip), %rsi      # 0x154f6
callq 0x2090
testl %eax, %eax
je 0xaae6
incl 0x1117a(%rip)           # 0x1b91c
leaq 0x90(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xad6f(%rip), %rsi      # 0x15524
leaq 0xad77(%rip), %rdx      # 0x15533
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
callq 0x312c
movq %rbx, %rdi
callq 0xb6c2
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0xaae6
movq 0x90(%rsp), %rsi
jmp 0xaade
movq (%rbx), %rdi
addq $0x78, %rdi
leaq 0xacf6(%rip), %rsi      # 0x154f6
callq 0x2090
testl %eax, %eax
je 0xaae6
incl 0x11109(%rip)           # 0x1b91c
leaq 0x70(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xad11(%rip), %rsi      # 0x15534
leaq 0xad1c(%rip), %rdx      # 0x15546
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x312c
movq %rbx, %rdi
callq 0xb6c2
movq 0x60(%rsp), %rdi
cmpq %r14, %rdi
je 0xaae6
movq 0x70(%rsp), %rsi
jmp 0xaade
movq (%rbx), %rdi
addq $0x78, %rdi
leaq 0xac40(%rip), %rsi      # 0x154a5
callq 0x2090
testl %eax, %eax
jne 0xa88a
movq 0x8(%rbx), %rdi
addq $0x78, %rdi
leaq 0xac28(%rip), %rsi      # 0x154a5
callq 0x2090
testl %eax, %eax
je 0xa996
incl 0x1108c(%rip)           # 0x1b91c
leaq 0xd0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xac5a(%rip), %rsi      # 0x154fe
leaq 0xac65(%rip), %rdx      # 0x15510
leaq 0xc0(%rsp), %r15
movq %r15, %rdi
callq 0x312c
movq %r15, %rdi
callq 0xb6c2
movq 0xc0(%rsp), %rdi
cmpq %r12, %rdi
je 0xa64f
movq 0xd0(%rsp), %rsi
jmp 0xa989
movq 0x80(%rbx), %rdx
addq $0x78, %rbx
leaq 0xabb2(%rip), %rcx      # 0x154a5
movl $0x7, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x22b0
jmp 0xaae6
movq (%rbx), %rdi
addq $0x78, %rdi
leaq 0xab8f(%rip), %rsi      # 0x154a5
callq 0x2090
testl %eax, %eax
jne 0xa937
movq 0x8(%rbx), %rdi
addq $0x78, %rdi
leaq 0xab77(%rip), %rsi      # 0x154a5
callq 0x2090
testl %eax, %eax
je 0xa996
incl 0x10fdf(%rip)           # 0x1b91c
leaq 0xb0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xabc0(%rip), %rsi      # 0x15511
leaq 0xabcb(%rip), %rdx      # 0x15523
leaq 0xa0(%rsp), %r15
movq %r15, %rdi
callq 0x312c
movq %r15, %rdi
callq 0xb6c2
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0xa64f
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xa64f
leaq 0x78(%rbx), %rdi
leaq 0xab04(%rip), %rsi      # 0x154a5
callq 0x2250
jmp 0xa64f
addl $-0x2, %ebp
jmp 0xa9b2
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 0xb06f
leaq 0xaac6(%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 0xaa24
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0xaa2b
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 0xab11(%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 0xaa79
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0xaa81
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 0xb6c2
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0xaab9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21c0
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0xaacf
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0xaae6
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 0xabd5
movq 0xb0(%rsp), %rsi
jmp 0xabcd
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
cmpq %r12, %rdi
je 0xabd5
movq 0xd0(%rsp), %rsi
jmp 0xabcd
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0xab57
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xab57
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0xab72
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xab72
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0xabd5
movq 0x50(%rsp), %rsi
jmp 0xabcd
movq %rax, %rbx
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xabd5
movq 0xf0(%rsp), %rsi
jmp 0xabcd
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r14, %rdi
je 0xabd5
movq 0x70(%rsp), %rsi
jmp 0xabcd
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0xabd5
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2310
nop