// File: /workspace/github_cpp_makefile_star2_O1/CHEN-Zhihan[P]Compiler/Node.cpp
// Function: ExprNode::ex(std::vector<int, std::allocator<int>>&, int, int, int) const
void ExprNode::ex(vector<int>& sList, int functionID, int blbl, int clbl) const {
    unordered_set<int> uniOp{INTEGER, CHARACTER, STRING, BOOL, VAR, CALL};
    if (uniOp.count(oper) != 0) {
        op[0]->ex(sList, functionID, blbl, clbl);
        return;
    }
    switch (oper) {
        case '=': {
            op[1]->ex(sList, functionID, blbl, clbl);
            auto v = dynamic_pointer_cast<VarNode>(op[0]);
            v->pop(sList, functionID);
            if (!inStatement) {
                v->push(sList, functionID);
            }
            break;
        } case NOT: {
            printf("\tpush\t1\n");
            op[0]->ex(sList, functionID, blbl, clbl);
            printf("\tsub\n");
            break;

        } case UMINUS: {
            op[0]->ex(sList, functionID, blbl, clbl);
            printf("\tneg\n");
            break;
        } case POSINC: {
            if (!inStatement) {
                op[0]->ex(sList, functionID, blbl, clbl);
            }
            incdec(dynamic_pointer_cast<VarNode>(op[0]), blbl, clbl, sList, functionID, true);
            break;
        } case PREINC: {
            incdec(dynamic_pointer_cast<VarNode>(op[0]), blbl, clbl, sList, functionID, true);
            if (!inStatement) {
                op[0]->ex(sList, functionID, blbl, clbl);
            }
            break;
        } case POSDEC: {
            if (!inStatement) {
                op[0]->ex(sList, functionID, blbl, clbl);
            }
            incdec(dynamic_pointer_cast<VarNode>(op[0]), blbl, clbl, sList, functionID, false);
            break;
        } case PREDEC: {
            incdec(dynamic_pointer_cast<VarNode>(op[0]), blbl, clbl, sList, functionID, false);
            if (!inStatement) {
                op[0]->ex(sList, functionID, blbl, clbl);
            }
            break;
        } default: {
            op[0]->ex(sList, functionID, blbl, clbl);
            op[1]->ex(sList, functionID, blbl, clbl);
            if (operatorInstruction.count(oper) != 0) {
                cout << "\t" << operatorInstruction[oper] << "\n";
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %r8d, %r15d
movl %ecx, %r12d
movl %edx, -0x2c(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdi, %r13
movups 0x7a47(%rip), %xmm0     # 0x14744
leaq -0x88(%rbp), %rdx
movaps %xmm0, -0x18(%rdx)
movabsq $-0x200000005, %rax     # imm = 0xFFFFFFFDFFFFFFFB
movq %rax, -0x8(%rdx)
leaq -0x39(%rbp), %rax
movq %rax, (%rsp)
leaq -0xd8(%rbp), %r14
leaq -0xa0(%rbp), %rsi
leaq -0x3b(%rbp), %r8
leaq -0x3a(%rbp), %r9
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x11f30
leaq 0x8(%r13), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x12038
testq %rax, %rax
je 0xcd8a
addq $0x18, %r13
movq (%r13), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
leaq -0xd8(%rbp), %rdi
callq 0xb170
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl (%rbx), %eax
cmpl $0x11f, %eax            # imm = 0x11F
jg 0xcdf6
leal -0x112(%rax), %ecx
cmpl $0x3, %ecx
ja 0xce36
leaq 0x78e3(%rip), %rax      # 0x1468c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
cmpb $0x0, 0xc(%r13)
jne 0xcdcf
movq 0x18(%r13), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
movq 0x18(%r13), %rdi
testq %rdi, %rdi
je 0xd04b
leaq 0xeb6d(%rip), %rsi      # 0x1b950
leaq 0xeefe(%rip), %rdx      # 0x1bce8
xorl %ecx, %ecx
callq 0x4250
jmp 0xd04d
cmpl $0x120, %eax            # imm = 0x120
je 0xcf39
cmpl $0x121, %eax            # imm = 0x121
jne 0xce7b
leaq 0x7d10(%rip), %rdi      # 0x14b1f
callq 0x4330
movq 0x18(%r13), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
leaq 0x7cf6(%rip), %rdi      # 0x14b27
jmp 0xcf56
cmpl $0x3d, %eax
jne 0xce7b
movq 0x28(%r13), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
movq 0x18(%r13), %rdi
testq %rdi, %rdi
je 0xd0cb
leaq 0xeaeb(%rip), %rsi      # 0x1b950
leaq 0xee7c(%rip), %rdx      # 0x1bce8
xorl %ecx, %ecx
callq 0x4250
movq %rax, %rbx
jmp 0xd0cd
movq 0x18(%r13), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
movq 0x28(%r13), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
leaq 0xf52a(%rip), %rdi      # 0x1c3d8
movq %rbx, %rsi
callq 0x12076
testq %rax, %rax
je 0xcd6c
movq 0xf102(%rip), %rdi      # 0x1bfc8
leaq 0x793c(%rip), %rsi      # 0x14809
movl $0x1, %edx
callq 0x4260
leaq 0xf4fa(%rip), %rdi      # 0x1c3d8
movq %rbx, %rsi
callq 0x120b4
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0xf0d4(%rip), %rdi      # 0x1bfc8
callq 0x4260
leaq 0x7315(%rip), %rsi      # 0x14215
movl $0x1, %edx
movq %rax, %rdi
callq 0x4260
jmp 0xcd6c
movq 0x18(%r13), %rdi
testq %rdi, %rdi
je 0xcfcb
leaq 0xea2a(%rip), %rsi      # 0x1b950
leaq 0xedbb(%rip), %rdx      # 0x1bce8
xorl %ecx, %ecx
callq 0x4250
jmp 0xcfcd
movq 0x18(%r13), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
leaq 0x7bc4(%rip), %rdi      # 0x14b1a
callq 0x4330
jmp 0xcd6c
movq 0x18(%r13), %rdi
testq %rdi, %rdi
je 0xd00b
leaq 0xe9dc(%rip), %rsi      # 0x1b950
leaq 0xed6d(%rip), %rdx      # 0x1bce8
xorl %ecx, %ecx
callq 0x4250
jmp 0xd00d
cmpb $0x0, 0xc(%r13)
jne 0xcfa4
movq 0x18(%r13), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
movq 0x18(%r13), %rdi
testq %rdi, %rdi
je 0xd07f
leaq 0xe998(%rip), %rsi      # 0x1b950
leaq 0xed29(%rip), %rdx      # 0x1bce8
xorl %ecx, %ecx
callq 0x4250
jmp 0xd081
xorl %eax, %eax
testq %rax, %rax
je 0xcfff
movq %rax, -0x70(%rbp)
movq 0x20(%r13), %rax
movq %rax, -0x68(%rbp)
testq %rax, %rax
je 0xd106
movq 0xefd2(%rip), %rcx      # 0x1bfc0
cmpb $0x0, (%rcx)
je 0xd102
incl 0x8(%rax)
jmp 0xd106
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
jmp 0xd106
xorl %eax, %eax
testq %rax, %rax
je 0xd03f
movq %rax, -0x50(%rbp)
movq 0x20(%r13), %rax
movq %rax, -0x48(%rbp)
testq %rax, %rax
je 0xd12d
movq 0xef92(%rip), %rcx      # 0x1bfc0
cmpb $0x0, (%rcx)
je 0xd129
incl 0x8(%rax)
jmp 0xd12d
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
jmp 0xd12d
xorl %eax, %eax
testq %rax, %rax
je 0xd0b3
movq %rax, -0x80(%rbp)
movq 0x20(%r13), %rax
movq %rax, -0x78(%rbp)
testq %rax, %rax
je 0xd169
movq 0xef52(%rip), %rcx      # 0x1bfc0
cmpb $0x0, (%rcx)
je 0xd165
incl 0x8(%rax)
jmp 0xd169
xorl %eax, %eax
testq %rax, %rax
je 0xd0bf
movq %rax, -0x60(%rbp)
movq 0x20(%r13), %rax
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0xd190
movq 0xef1e(%rip), %rcx      # 0x1bfc0
cmpb $0x0, (%rcx)
je 0xd18c
incl 0x8(%rax)
jmp 0xd190
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
jmp 0xd169
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
jmp 0xd190
xorl %ebx, %ebx
testq %rbx, %rbx
je 0xd0f8
movq 0x20(%r13), %r15
testq %r15, %r15
je 0xd1bd
movq 0xeeda(%rip), %rax      # 0x1bfc0
cmpb $0x0, (%rax)
je 0xd1b8
incl 0x8(%r15)
jmp 0xd1bd
xorl %ebx, %ebx
xorl %r15d, %r15d
jmp 0xd1bd
lock
incl 0x8(%rax)
leaq -0x70(%rbp), %rdi
movl %r12d, %esi
movl %r15d, %edx
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movl $0x1, %r9d
callq 0xcb8b
movq -0x68(%rbp), %rdi
jmp 0xd14b
lock
incl 0x8(%rax)
leaq -0x50(%rbp), %rdi
movl %r12d, %esi
movl %r15d, %edx
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r8d
xorl %r9d, %r9d
callq 0xcb8b
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xd155
callq 0x896e
cmpb $0x0, 0xc(%r13)
je 0xcd52
jmp 0xcd6c
lock
incl 0x8(%rax)
leaq -0x80(%rbp), %rdi
movl %r12d, %esi
movl %r15d, %edx
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movl $0x1, %r9d
callq 0xcb8b
movq -0x78(%rbp), %rdi
jmp 0xd1ae
lock
incl 0x8(%rax)
leaq -0x60(%rbp), %rdi
movl %r12d, %esi
movl %r15d, %edx
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r8d
xorl %r9d, %r9d
callq 0xcb8b
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
jne 0xd1f5
jmp 0xcd6c
lock
incl 0x8(%r15)
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
xorl %ecx, %ecx
callq 0xf91c
cmpb $0x0, 0xc(%r13)
jne 0xd1e9
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl $0x1, %ecx
callq 0xf91c
testq %r15, %r15
je 0xcd6c
movq %r15, %rdi
callq 0x896e
jmp 0xcd6c
movq %rax, %rbx
movq -0x58(%rbp), %rdi
jmp 0xd221
movq %rax, %rbx
movq -0x78(%rbp), %rdi
jmp 0xd221
movq %rax, %rbx
movq -0x48(%rbp), %rdi
jmp 0xd221
movq %rax, %rbx
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
jne 0xd233
jmp 0xd23d
movq %rax, %rbx
testq %r15, %r15
je 0xd23d
movq %r15, %rdi
callq 0x896e
jmp 0xd23d
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
callq 0xb170
movq %rbx, %rdi
callq 0x43b0
nop