// File: CHEN-Zhihan[P]Compiler/Node.cpp
// Function: ExprNode::check(std::vector<int, std::allocator<int>>&, int)
void ExprNode::check(vector<int>& sList, int functionID) {
    if (oper != '=') {
        op[0]->check(sList, functionID);
    } else {
        op[1]->check(sList, functionID);
        dynamic_pointer_cast<VarNode>(op[0])->assign(sList, functionID);
        return;
    }
    checkArray(sList, functionID, op[0]);
    unordered_set<int> uniOp{NOT, INTEGER, STRING, CHARACTER, BOOL, VAR, UMINUS, CALL, POSINC, POSDEC, PREINC, PREDEC, CALL};
    if (uniOp.count(oper) == 0) {
        checkArray(sList, functionID, op[1]);
        op[1]->check(sList, functionID);
    }
    if (oper == POSINC or oper == POSDEC or oper == PREINC or oper == PREDEC) {
        if (dynamic_pointer_cast<VarNode>(op[0]) == nullptr) {
            cerr << "Invalid increment/decrement operation" << endl;
            exit(-1);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xe0(%rbp)
cmpl $0x3d, 0x8(%rax)
je 0x23238
movq -0xe0(%rbp), %rdi
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29460
movq %rax, %rdi
callq 0x17630
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x232d7
movq -0xe0(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0xf0(%rbp)
movl $0x1, %esi
callq 0x29460
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 -0xf0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29460
movq %rax, %rsi
leaq -0x28(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0xbb80
movq -0xe8(%rbp), %rdi
callq 0x292f0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x23590
jmp 0x232af
leaq -0x28(%rbp), %rdi
callq 0xbc50
jmp 0x23578
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xbc50
jmp 0x23581
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x110(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x104(%rbp)
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
movq %rsi, -0xf8(%rbp)
callq 0x29460
movq -0xe0(%rbp), %rdi
movq -0x110(%rbp), %rsi
movl -0x104(%rbp), %edx
movq %rax, %rcx
callq 0x22ef0
movups 0x1342f(%rip), %xmm0    # 0x36758
movaps %xmm0, -0xa0(%rbp)
movups 0x13411(%rip), %xmm0    # 0x36748
movaps %xmm0, -0xb0(%rbp)
movups 0x133f3(%rip), %xmm0    # 0x36738
movaps %xmm0, -0xc0(%rbp)
movl $0xfffffffd, -0x90(%rbp) # imm = 0xFFFFFFFD
leaq -0xc0(%rbp), %rax
movq %rax, -0x80(%rbp)
movq $0xd, -0x78(%rbp)
leaq -0xc3(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x16f20
movq -0x100(%rbp), %rdi
movq -0xf8(%rbp), %rcx
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq %rsp, %rax
movq %rdi, (%rax)
leaq -0x70(%rbp), %rdi
leaq -0xc1(%rbp), %r8
leaq -0xc2(%rbp), %r9
callq 0x294e0
jmp 0x233b1
leaq -0xc3(%rbp), %rdi
callq 0x16fc0
movq -0xe0(%rbp), %rsi
addq $0x8, %rsi
leaq -0x70(%rbp), %rdi
callq 0x29540
movq %rax, -0x118(%rbp)
jmp 0x233da
movq -0x118(%rbp), %rax
cmpq $0x0, %rax
jne 0x2349d
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x128(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x11c(%rbp)
addq $0x18, %rdi
movl $0x1, %esi
callq 0x29460
movq -0xe0(%rbp), %rdi
movq -0x128(%rbp), %rsi
movl -0x11c(%rbp), %edx
movq %rax, %rcx
callq 0x22ef0
jmp 0x23432
movq -0xe0(%rbp), %rdi
addq $0x18, %rdi
movl $0x1, %esi
callq 0x29460
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
jmp 0x23464
jmp 0x2349d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xc3(%rbp), %rdi
callq 0x16fc0
jmp 0x23581
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x17460
jmp 0x23581
movq -0xe0(%rbp), %rax
cmpl $0x112, 0x8(%rax)       # imm = 0x112
je 0x234e1
movq -0xe0(%rbp), %rax
cmpl $0x113, 0x8(%rax)       # imm = 0x113
je 0x234e1
movq -0xe0(%rbp), %rax
cmpl $0x114, 0x8(%rax)       # imm = 0x114
je 0x234e1
movq -0xe0(%rbp), %rax
cmpl $0x115, 0x8(%rax)       # imm = 0x115
jne 0x2356f
movq -0xe0(%rbp), %rdi
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29460
movq %rax, %rsi
leaq -0xd8(%rbp), %rdi
callq 0xbb80
leaq -0xd8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29600
movb %al, -0x129(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0xbc50
movb -0x129(%rbp), %al
testb $0x1, %al
jne 0x23532
jmp 0x2356d
movq 0x2dab7(%rip), %rdi     # 0x50ff0
leaq 0x132d8(%rip), %rsi     # 0x36818
callq 0x4210
movq %rax, -0x138(%rbp)
jmp 0x2354e
movq -0x138(%rbp), %rdi
movq 0x2da44(%rip), %rsi     # 0x50fa0
callq 0x4240
jmp 0x23563
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x42c0
jmp 0x2356f
leaq -0x70(%rbp), %rdi
callq 0x17460
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x43d0
nopw (%rax,%rax)