// File: /workspace/github_cpp_makefile_star2_O3/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 0x7f9d(%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 0x1195c
leaq 0x8(%r13), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x11a64
testq %rax, %rax
je 0xc834
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 0xad94
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 0xc8d5
leal -0x112(%rax), %ecx
cmpl $0x3, %ecx
ja 0xc919
leaq 0x7e35(%rip), %rax      # 0x1468c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
cmpb $0x0, 0xc(%r13)
jne 0xc87d
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 0xcbd9
leaq 0xf0b7(%rip), %rsi      # 0x1b948
leaq 0xf448(%rip), %rdx      # 0x1bce0
xorl %ecx, %ecx
callq 0x4250
testq %rax, %rax
je 0xcbd9
movq %rax, -0x80(%rbp)
movq 0x20(%r13), %rax
movq %rax, -0x78(%rbp)
testq %rax, %rax
je 0xcbe0
movq 0xf6f4(%rip), %rcx      # 0x1bfb8
cmpb $0x0, (%rcx)
je 0xcc50
incl 0x8(%rax)
jmp 0xcbe0
cmpl $0x120, %eax            # imm = 0x120
je 0xca7c
cmpl $0x121, %eax            # imm = 0x121
jne 0xc98d
leaq 0x822d(%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 0x8213(%rip), %rdi      # 0x14b27
jmp 0xca99
cmpl $0x3d, %eax
jne 0xc98d
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 0xcc32
leaq 0xf000(%rip), %rsi      # 0x1b948
leaq 0xf391(%rip), %rdx      # 0x1bce0
xorl %ebx, %ebx
xorl %ecx, %ecx
callq 0x4250
movl $0x0, %r15d
testq %rax, %rax
je 0xcc64
movq 0x20(%r13), %r15
testq %r15, %r15
je 0xcc39
movq 0xf63d(%rip), %rcx      # 0x1bfb8
cmpb $0x0, (%rcx)
je 0xcc5c
incl 0x8(%r15)
jmp 0xcc61
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 0xfa18(%rip), %rdi      # 0x1c3d8
movq %rbx, %rsi
callq 0x11ac6
testq %rax, %rax
je 0xc816
movq 0xf5e8(%rip), %rdi      # 0x1bfc0
leaq 0x7e2a(%rip), %rsi      # 0x14809
movl $0x1, %edx
callq 0x4260
leaq 0xf9e8(%rip), %rdi      # 0x1c3d8
movq %rbx, %rsi
callq 0x11b28
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0xf5ba(%rip), %rdi      # 0x1bfc0
callq 0x4260
leaq 0x7803(%rip), %rsi      # 0x14215
movl $0x1, %edx
movq %rax, %rdi
callq 0x4260
jmp 0xc816
movq 0x18(%r13), %rdi
testq %rdi, %rdi
je 0xcb70
leaq 0xef10(%rip), %rsi      # 0x1b948
leaq 0xf2a1(%rip), %rdx      # 0x1bce0
xorl %ecx, %ecx
callq 0x4250
testq %rax, %rax
je 0xcb70
movq %rax, -0x70(%rbp)
movq 0x20(%r13), %rax
movq %rax, -0x68(%rbp)
testq %rax, %rax
je 0xcb77
movq 0xf54d(%rip), %rcx      # 0x1bfb8
cmpb $0x0, (%rcx)
je 0xcc3e
incl 0x8(%rax)
jmp 0xcb77
movq 0x18(%r13), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
leaq 0x8081(%rip), %rdi      # 0x14b1a
callq 0x4330
jmp 0xc816
movq 0x18(%r13), %rdi
testq %rdi, %rdi
je 0xcb9a
leaq 0xee91(%rip), %rsi      # 0x1b948
leaq 0xf222(%rip), %rdx      # 0x1bce0
xorl %ecx, %ecx
callq 0x4250
testq %rax, %rax
je 0xcb9a
movq %rax, -0x50(%rbp)
movq 0x20(%r13), %rax
movq %rax, -0x48(%rbp)
testq %rax, %rax
je 0xcba1
movq 0xf4ce(%rip), %rcx      # 0x1bfb8
cmpb $0x0, (%rcx)
je 0xcc47
incl 0x8(%rax)
jmp 0xcba1
cmpb $0x0, 0xc(%r13)
jne 0xcb18
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 0xcc03
leaq 0xee1c(%rip), %rsi      # 0x1b948
leaq 0xf1ad(%rip), %rdx      # 0x1bce0
xorl %ecx, %ecx
callq 0x4250
testq %rax, %rax
je 0xcc03
movq %rax, -0x60(%rbp)
movq 0x20(%r13), %rax
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0xcc0a
movq 0xf459(%rip), %rcx      # 0x1bfb8
cmpb $0x0, (%rcx)
je 0xcc56
incl 0x8(%rax)
jmp 0xcc0a
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
leaq -0x70(%rbp), %rdi
movl %r12d, %esi
movl %r15d, %edx
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movl $0x1, %r9d
callq 0xc635
movq -0x68(%rbp), %rdi
jmp 0xcbbf
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
leaq -0x50(%rbp), %rdi
movl %r12d, %esi
movl %r15d, %edx
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r8d
xorl %r9d, %r9d
callq 0xc635
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xcbc9
callq 0x864c
cmpb $0x0, 0xc(%r13)
je 0xc7fc
jmp 0xc816
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
leaq -0x80(%rbp), %rdi
movl %r12d, %esi
movl %r15d, %edx
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movl $0x1, %r9d
callq 0xc635
movq -0x78(%rbp), %rdi
jmp 0xcc28
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
leaq -0x60(%rbp), %rdi
movl %r12d, %esi
movl %r15d, %edx
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r8d
xorl %r9d, %r9d
callq 0xc635
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
jne 0xcc9c
jmp 0xc816
xorl %ebx, %ebx
xorl %r15d, %r15d
jmp 0xcc64
xorl %r15d, %r15d
jmp 0xcc61
lock
incl 0x8(%rax)
jmp 0xcb77
lock
incl 0x8(%rax)
jmp 0xcba1
lock
incl 0x8(%rax)
jmp 0xcbe0
lock
incl 0x8(%rax)
jmp 0xcc0a
lock
incl 0x8(%r15)
movq %rax, %rbx
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
xorl %ecx, %ecx
callq 0xf3f6
cmpb $0x0, 0xc(%r13)
jne 0xcc90
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl $0x1, %ecx
callq 0xf3f6
testq %r15, %r15
je 0xc816
movq %r15, %rdi
callq 0x864c
jmp 0xc816
movq %rax, %rbx
movq -0x58(%rbp), %rdi
jmp 0xccc8
movq %rax, %rbx
movq -0x78(%rbp), %rdi
jmp 0xccc8
movq %rax, %rbx
movq -0x48(%rbp), %rdi
jmp 0xccc8
movq %rax, %rbx
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
jne 0xccda
jmp 0xcce4
movq %rax, %rbx
testq %r15, %r15
je 0xcce4
movq %r15, %rdi
callq 0x864c
jmp 0xcce4
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
callq 0xad94
movq %rbx, %rdi
callq 0x43b0