// File: CHEN-Zhihan[P]Compiler/Node.cpp
// Function: StmtNode::check(std::vector<int, std::allocator<int>>&, int)
void StmtNode::check(vector<int>& sList, int functionID) {
    switch (oper) {
        case RETURN: {
            if (functionID == GLOBAL) {
                cerr << "return occurs in the global scope" << endl;
                exit(-1);
            }
            if (op.size() != 0) {
                op[0]->check(sList, functionID);
            }
            break;
        } case FOR: {
            scopes.push_back(--scopeCounter);
            sList.push_back(scopes[0]);
            variableTable[scopeCounter] = unordered_set<int>();
            addressTable[functionID].second[scopeCounter] = unordered_map<int, int>();
            op[0]->check(sList, functionID);
            op[1]->check(sList, functionID);
            op[3]->check(sList, functionID);
            op[2]->check(sList, functionID);
            releaseSpace(functionID, sList.back());
            sList.pop_back();
            break;
        } case WHILE: {
            op[0]->check(sList, functionID);
            ADDSCOPE(op[1]);
            break;
        } case IF: {
            op[0]->check(sList, functionID);
            ADDSCOPE(op[1]);
            if (op.size() > 2) {
                ADDSCOPE(op[2]);
            }
            break;
        } default: {
            for (const auto & i: op) {
                i->check(sList, functionID);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x350, %rsp            # imm = 0x350
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x250(%rbp)
movl 0x8(%rax), %eax
addl $0xfffffef9, %eax       # imm = 0xFFFFFEF9
movl %eax, %ecx
movq %rcx, -0x248(%rbp)
subl $0x8, %eax
ja 0x25518
movq -0x248(%rbp), %rax
leaq 0x11ac3(%rip), %rcx     # 0x366fc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x14(%rbp), %eax
cmpl 0x2c891(%rip), %eax     # 0x514dc
jne 0x24c79
movq 0x2c39c(%rip), %rdi     # 0x50ff0
leaq 0x11c24(%rip), %rsi     # 0x3687f
callq 0x4210
movq %rax, %rdi
movq 0x2c336(%rip), %rsi     # 0x50fa0
callq 0x4240
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x42c0
movq -0x250(%rbp), %rdi
addq $0x28, %rdi
callq 0x294c0
cmpq $0x0, %rax
je 0x24cbb
movq -0x250(%rbp), %rdi
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29ce0
movq %rax, %rdi
callq 0x17630
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x255a8
movq -0x250(%rbp), %rdi
addq $0x10, %rdi
movq %rdi, -0x270(%rbp)
leaq 0x2c7f7(%rip), %rsi     # 0x514d0
movq %rsi, -0x260(%rbp)
movl (%rsi), %eax
decl %eax
movl %eax, (%rsi)
callq 0x29b00
movq -0x270(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x268(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0x29d00
movq -0x268(%rbp), %rdi
movq %rax, %rsi
callq 0x29b00
xorps %xmm0, %xmm0
movaps %xmm0, -0x30(%rbp)
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x20(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x173e0
movq -0x260(%rbp), %rsi
leaq 0x2c675(%rip), %rdi     # 0x513b8
callq 0x17400
movq %rax, -0x258(%rbp)
jmp 0x24d51
movq -0x258(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movq %rsi, -0x280(%rbp)
callq 0x17430
movq -0x280(%rbp), %rdi
callq 0x17460
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
movaps %xmm0, -0xa0(%rbp)
movq $0x0, -0x70(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x16d40
leaq 0x2c6f4(%rip), %rdi     # 0x51498
leaq -0x14(%rbp), %rsi
callq 0x16ef0
movq %rax, -0x278(%rbp)
jmp 0x24db6
movq -0x278(%rbp), %rdi
addq $0x8, %rdi
leaq 0x2c708(%rip), %rsi     # 0x514d0
callq 0x28f40
movq %rax, -0x288(%rbp)
jmp 0x24dd6
movq -0x288(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x29d20
leaq -0xa0(%rbp), %rdi
callq 0x16d60
movq -0x250(%rbp), %rdi
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29ce0
movq %rax, %rdi
callq 0x17630
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x250(%rbp), %rdi
addq $0x28, %rdi
movl $0x1, %esi
callq 0x29ce0
movq %rax, %rdi
callq 0x17630
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x250(%rbp), %rdi
addq $0x28, %rdi
movl $0x3, %esi
callq 0x29ce0
movq %rax, %rdi
callq 0x17630
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x250(%rbp), %rdi
addq $0x28, %rdi
movl $0x2, %esi
callq 0x29ce0
movq %rax, %rdi
callq 0x17630
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
callq *0x8(%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x28c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x29d50
movl -0x28c(%rbp), %edi
movl (%rax), %esi
callq 0x22000
movq -0x10(%rbp), %rdi
callq 0x29bb0
jmp 0x255a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x17460
jmp 0x255b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x16d60
jmp 0x255b1
movq -0x250(%rbp), %rdi
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29ce0
movq %rax, %rdi
callq 0x17630
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
movq 0x8(%rax), %rax
callq *%rax
movq -0x250(%rbp), %rdi
addq $0x10, %rdi
movq %rdi, -0x2b0(%rbp)
leaq 0x2c57c(%rip), %rsi     # 0x514d0
movq %rsi, -0x2a0(%rbp)
movl (%rsi), %eax
decl %eax
movl %eax, (%rsi)
callq 0x29b00
movq -0x2b0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x2a8(%rbp)
callq 0x29d50
movq -0x2a8(%rbp), %rdi
movq %rax, %rsi
callq 0x29b00
xorps %xmm0, %xmm0
movaps %xmm0, -0xc0(%rbp)
movaps %xmm0, -0xd0(%rbp)
movaps %xmm0, -0xe0(%rbp)
movq $0x0, -0xb0(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x173e0
movq -0x2a0(%rbp), %rsi
leaq 0x2c3ef(%rip), %rdi     # 0x513b8
callq 0x17400
movq %rax, -0x298(%rbp)
jmp 0x24fd7
movq -0x298(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
movq %rsi, -0x2c0(%rbp)
callq 0x17430
movq -0x2c0(%rbp), %rdi
callq 0x17460
xorps %xmm0, %xmm0
movaps %xmm0, -0x100(%rbp)
movaps %xmm0, -0x110(%rbp)
movaps %xmm0, -0x120(%rbp)
movq $0x0, -0xf0(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x16d40
leaq 0x2c465(%rip), %rdi     # 0x51498
leaq -0x14(%rbp), %rsi
callq 0x16ef0
movq %rax, -0x2b8(%rbp)
jmp 0x25045
movq -0x2b8(%rbp), %rdi
addq $0x8, %rdi
leaq 0x2c479(%rip), %rsi     # 0x514d0
callq 0x28f40
movq %rax, -0x2c8(%rbp)
jmp 0x25065
movq -0x2c8(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x29d20
leaq -0x120(%rbp), %rdi
callq 0x16d60
movq -0x250(%rbp), %rdi
addq $0x28, %rdi
movl $0x1, %esi
callq 0x29ce0
movq %rax, %rdi
callq 0x17630
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
callq *0x8(%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x2cc(%rbp)
movq -0x10(%rbp), %rdi
callq 0x29d50
movl -0x2cc(%rbp), %edi
movl (%rax), %esi
callq 0x22000
movq -0x10(%rbp), %rdi
callq 0x29bb0
jmp 0x255a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x17460
jmp 0x255b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x16d60
jmp 0x255b1
movq -0x250(%rbp), %rdi
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29ce0
movq %rax, %rdi
callq 0x17630
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
movq 0x8(%rax), %rax
callq *%rax
movq -0x250(%rbp), %rdi
addq $0x10, %rdi
movq %rdi, -0x2f0(%rbp)
leaq 0x2c370(%rip), %rsi     # 0x514d0
movq %rsi, -0x2e0(%rbp)
movl (%rsi), %eax
decl %eax
movl %eax, (%rsi)
callq 0x29b00
movq -0x2f0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x2e8(%rbp)
callq 0x29d50
movq -0x2e8(%rbp), %rdi
movq %rax, %rsi
callq 0x29b00
xorps %xmm0, %xmm0
movaps %xmm0, -0x140(%rbp)
movaps %xmm0, -0x150(%rbp)
movaps %xmm0, -0x160(%rbp)
movq $0x0, -0x130(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x173e0
movq -0x2e0(%rbp), %rsi
leaq 0x2c1e3(%rip), %rdi     # 0x513b8
callq 0x17400
movq %rax, -0x2d8(%rbp)
jmp 0x251e3
movq -0x2d8(%rbp), %rdi
leaq -0x160(%rbp), %rsi
movq %rsi, -0x300(%rbp)
callq 0x17430
movq -0x300(%rbp), %rdi
callq 0x17460
xorps %xmm0, %xmm0
movaps %xmm0, -0x180(%rbp)
movaps %xmm0, -0x190(%rbp)
movaps %xmm0, -0x1a0(%rbp)
movq $0x0, -0x170(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x16d40
leaq 0x2c259(%rip), %rdi     # 0x51498
leaq -0x14(%rbp), %rsi
callq 0x16ef0
movq %rax, -0x2f8(%rbp)
jmp 0x25251
movq -0x2f8(%rbp), %rdi
addq $0x8, %rdi
leaq 0x2c26d(%rip), %rsi     # 0x514d0
callq 0x28f40
movq %rax, -0x308(%rbp)
jmp 0x25271
movq -0x308(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x29d20
leaq -0x1a0(%rbp), %rdi
callq 0x16d60
movq -0x250(%rbp), %rdi
addq $0x28, %rdi
movl $0x1, %esi
callq 0x29ce0
movq %rax, %rdi
callq 0x17630
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
callq *0x8(%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x30c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x29d50
movl -0x30c(%rbp), %edi
movl (%rax), %esi
callq 0x22000
movq -0x10(%rbp), %rdi
callq 0x29bb0
movq -0x250(%rbp), %rdi
addq $0x28, %rdi
callq 0x294c0
cmpq $0x2, %rax
jbe 0x25513
movq -0x250(%rbp), %rdi
addq $0x10, %rdi
movq %rdi, -0x330(%rbp)
leaq 0x2c1b8(%rip), %rsi     # 0x514d0
movq %rsi, -0x320(%rbp)
movl (%rsi), %eax
decl %eax
movl %eax, (%rsi)
callq 0x29b00
movq -0x330(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x328(%rbp)
callq 0x29d50
movq -0x328(%rbp), %rdi
movq %rax, %rsi
callq 0x29b00
xorps %xmm0, %xmm0
movaps %xmm0, -0x1c0(%rbp)
movaps %xmm0, -0x1d0(%rbp)
movaps %xmm0, -0x1e0(%rbp)
movq $0x0, -0x1b0(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x173e0
movq -0x320(%rbp), %rsi
leaq 0x2c02b(%rip), %rdi     # 0x513b8
callq 0x17400
movq %rax, -0x318(%rbp)
jmp 0x2539b
movq -0x318(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
movq %rsi, -0x340(%rbp)
callq 0x17430
movq -0x340(%rbp), %rdi
callq 0x17460
xorps %xmm0, %xmm0
movaps %xmm0, -0x200(%rbp)
movaps %xmm0, -0x210(%rbp)
movaps %xmm0, -0x220(%rbp)
movq $0x0, -0x1f0(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x16d40
leaq 0x2c0a1(%rip), %rdi     # 0x51498
leaq -0x14(%rbp), %rsi
callq 0x16ef0
movq %rax, -0x338(%rbp)
jmp 0x25409
movq -0x338(%rbp), %rdi
addq $0x8, %rdi
leaq 0x2c0b5(%rip), %rsi     # 0x514d0
callq 0x28f40
movq %rax, -0x348(%rbp)
jmp 0x25429
movq -0x348(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x29d20
leaq -0x220(%rbp), %rdi
callq 0x16d60
movq -0x250(%rbp), %rdi
addq $0x28, %rdi
movl $0x2, %esi
callq 0x29ce0
movq %rax, %rdi
callq 0x17630
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
callq *0x8(%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x34c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x29d50
movl -0x34c(%rbp), %edi
movl (%rax), %esi
callq 0x22000
movq -0x10(%rbp), %rdi
callq 0x29bb0
jmp 0x25513
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x17460
jmp 0x255b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x16d60
jmp 0x255b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x17460
jmp 0x255b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x16d60
jmp 0x255b1
jmp 0x255a8
movq -0x250(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x228(%rbp)
movq -0x228(%rbp), %rdi
callq 0x29d90
movq %rax, -0x230(%rbp)
movq -0x228(%rbp), %rdi
callq 0x29dc0
movq %rax, -0x238(%rbp)
leaq -0x230(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x29df0
testb $0x1, %al
jne 0x25569
jmp 0x255a6
leaq -0x230(%rbp), %rdi
callq 0x29e30
movq %rax, -0x240(%rbp)
movq -0x240(%rbp), %rdi
callq 0x17630
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x230(%rbp), %rdi
callq 0x29e50
jmp 0x25550
jmp 0x255a8
addq $0x350, %rsp            # imm = 0x350
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x43d0
nopw (%rax,%rax)