// File: /workspace/github_cpp_makefile_star2_O3/CHEN-Zhihan[P]Compiler/Node.cpp
// Function: StmtNode::ex(std::vector<int, std::allocator<int>>&, int, int, int) const
void StmtNode::ex(vector<int>& sList, int functionID, int blbl, int clbl) const {
    int lblx, lbly, lblz;
    switch (oper) {
        case BREAK: {
            printf("\tjmp\tL%03d\n", blbl);
            break;
        } case CONTINUE: {
            printf("\tjmp\tL%03d\n", clbl);
            break;
        } case FOR: {
            lblx = lbl++;
            lbly = lbl++;
            lblz = lbl++;
            sList.push_back(scopes.back());
            op[0]->ex(sList, functionID, blbl, clbl);
            printf("L%03d:\n", lblx);
            op[1]->ex(sList, functionID, blbl, clbl);
            printf("\tj0\tL%03d\n", lbly);
            op[3]->ex(sList, functionID, lbly, lblz);
            printf("L%03d:\n", lblz);
            op[2]->ex(sList, functionID, blbl, clbl);
            sList.pop_back();
            printf("\tjmp\tL%03d\n", lblx);
            printf("L%03d:\n", lbly);
            break;
        } case WHILE: {
            lblx = lbl++;
            lbly = lbl++;
            printf("L%03d:\n", lblx);
            op[0]->ex(sList, functionID, blbl, clbl);
            printf("\tj0\tL%03d\n", lbly);
            sList.push_back(scopes.back());
            op[1]->ex(sList, functionID, lbly, lblx);
            sList.pop_back();
            printf("\tjmp\tL%03d\n", lblx);
            printf("L%03d:\n", lbly);
            break;
        } case IF: {
            op[0]->ex(sList, functionID, blbl, clbl);
            if (op.size() > 2) {
                /* if else */
                printf("\tj0\tL%03d\n", lblx = lbl++);
                sList.push_back(scopes[0]); // if has 2 scopes;
                op[1]->ex(sList, functionID, blbl, clbl);
                sList.pop_back();
                printf("\tjmp\tL%03d\n", lbly = lbl++);
                printf("L%03d:\n", lblx);
                sList.push_back(scopes[1]);
                op[2]->ex(sList, functionID, blbl, clbl);
                sList.pop_back();
                printf("L%03d:\n", lbly);
            } else {
                /* if */
                printf("\tj0\tL%03d\n", lblx = lbl++);
                sList.push_back(scopes.back());
                op[1]->ex(sList, functionID, blbl, clbl);
                sList.pop_back();
                printf("L%03d:\n", lblx);
            }
            break;
        } case RETURN: {
            if (op.size() == 0) {
                printf("\tpush\t0\n");
            } else {
                op[0]->ex(sList, functionID, blbl, clbl);
            }
            printf("\tret\n");
            break;
        } default: {
            for (const auto & i : op) {
                i->ex(sList, functionID, blbl, clbl);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %r15d
movl %ecx, %r12d
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %r13
movl $0xfffffef9, %eax       # imm = 0xFFFFFEF9
addl 0x8(%rdi), %eax
cmpl $0x8, %eax
ja 0xd9d7
leaq 0x6e10(%rip), %rcx      # 0x146fc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0xebfd(%rip), %ecx      # 0x1c4f8
leal 0x1(%rcx), %eax
movl %eax, -0x30(%rbp)
leal 0x2(%rcx), %eax
movl %eax, -0x40(%rbp)
movq %rcx, -0x38(%rbp)
leal 0x3(%rcx), %eax
movl %eax, 0xebe4(%rip)      # 0x1c4f8
movq 0x18(%r13), %rdx
addq $-0x4, %rdx
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xdb0b
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xdb13
movq 0x28(%r13), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r15d, %r8d
movl %r14d, %r15d
movl %r14d, %edx
movl %r12d, %ecx
movl %r8d, -0x30(%rbp)
callq *(%rax)
movq 0x30(%r13), %r14
subq 0x28(%r13), %r14
movl 0xeb90(%rip), %esi      # 0x1c4f8
leal 0x1(%rsi), %eax
movl %eax, 0xeb87(%rip)      # 0x1c4f8
leaq 0x6f0b(%rip), %rdi      # 0x14883
movq %rsi, -0x38(%rbp)
xorl %eax, %eax
callq 0x4050
cmpq $0x21, %r14
jb 0xdabe
movq 0x10(%r13), %rdx
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xdc26
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xdc2e
movq 0x28(%r13), %rax
cmpq %rax, 0x30(%r13)
je 0xdae5
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r14d, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
jmp 0xdaf1
movl %r12d, %ecx
movl %r14d, %r12d
movq 0x28(%r13), %r14
movq 0x30(%r13), %rax
cmpq %rax, %r14
je 0xda19
movq %rbx, %rdx
movq %rax, -0x30(%rbp)
movq (%r14), %rdi
movq (%rdi), %rax
movq %rdx, %r13
movq %rdx, %rsi
movl %r12d, %edx
movl %ecx, %ebx
movl %r15d, %r8d
callq *(%rax)
movq -0x30(%rbp), %rax
movq %r13, %rdx
movl %ebx, %ecx
addq $0x10, %r14
cmpq %rax, %r14
jne 0xd9f1
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0xeaca(%rip), %esi      # 0x1c4f8
leal 0x1(%rsi), %eax
movl %eax, -0x38(%rbp)
leal 0x2(%rsi), %eax
movl %eax, 0xeabb(%rip)      # 0x1c4f8
leaq 0x6bd6(%rip), %rdi      # 0x1461a
movq %rsi, -0x30(%rbp)
xorl %eax, %eax
callq 0x4050
movq 0x28(%r13), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r14d, %edx
movl %r12d, %ecx
movl %r15d, %r8d
movl -0x38(%rbp), %r15d
callq *(%rax)
leaq 0x6e11(%rip), %rdi      # 0x14883
movl %r15d, %esi
xorl %eax, %eax
callq 0x4050
movq 0x18(%r13), %rdx
addq $-0x4, %rdx
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xdbdc
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xdbe4
leaq 0x6dcd(%rip), %rdi      # 0x14877
movl %r12d, %esi
jmp 0xdd0b
leaq 0x6dbe(%rip), %rdi      # 0x14877
jmp 0xdc1e
movq 0x18(%r13), %rdx
addq $-0x4, %rdx
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xdca6
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xdcae
leaq 0x6b76(%rip), %rdi      # 0x14662
callq 0x4330
leaq 0x6b72(%rip), %rdi      # 0x1466a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4330
movq %rbx, %rdi
callq 0x11c0a
movq 0x28(%r13), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r14d, %edx
movl %r12d, %ecx
movl %r12d, -0x44(%rbp)
movl %r15d, %r8d
callq *(%rax)
leaq 0x6ae4(%rip), %rdi      # 0x1461a
movq -0x38(%rbp), %rsi
xorl %eax, %eax
callq 0x4050
movq 0x28(%r13), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r14d, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
leaq 0x6d22(%rip), %rdi      # 0x14883
movl -0x30(%rbp), %r12d
movl %r12d, %esi
xorl %eax, %eax
callq 0x4050
movq 0x28(%r13), %rax
movq 0x30(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r14d, %edx
movl %r12d, %ecx
movl -0x40(%rbp), %r12d
movl %r12d, %r8d
callq *(%rax)
leaq 0x6a87(%rip), %rdi      # 0x1461a
movl %r12d, %esi
xorl %eax, %eax
callq 0x4050
movq 0x28(%r13), %rax
movq 0x20(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r14d, %edx
movl -0x44(%rbp), %ecx
movl %r15d, %r8d
callq *(%rax)
addq $-0x4, 0x8(%rbx)
leaq 0x6cb5(%rip), %rdi      # 0x14877
movq -0x38(%rbp), %rsi
xorl %eax, %eax
callq 0x4050
leaq 0x6a46(%rip), %rdi      # 0x1461a
movl -0x30(%rbp), %esi
jmp 0xdd0b
movq %rbx, %rdi
callq 0x11c0a
movq 0x28(%r13), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r14d, %edx
movl %r15d, %ecx
movq -0x30(%rbp), %r14
movl %r14d, %r8d
callq *(%rax)
addq $-0x4, 0x8(%rbx)
leaq 0x6c6a(%rip), %rdi      # 0x14877
movl %r14d, %esi
xorl %eax, %eax
callq 0x4050
leaq 0x69fc(%rip), %rdi      # 0x1461a
movl %r15d, %esi
jmp 0xdd0b
movq %rbx, %rdi
callq 0x11c0a
movl %r15d, %r14d
movq 0x28(%r13), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r15d, %edx
movl %r12d, %ecx
movl -0x30(%rbp), %r15d
movl %r15d, %r8d
callq *(%rax)
addq $-0x4, 0x8(%rbx)
movl 0xe89f(%rip), %esi      # 0x1c4f8
leal 0x1(%rsi), %eax
movl %eax, 0xe896(%rip)      # 0x1c4f8
leaq 0x6c0e(%rip), %rdi      # 0x14877
movq %rsi, -0x40(%rbp)
xorl %eax, %eax
callq 0x4050
leaq 0x699f(%rip), %rdi      # 0x1461a
movq -0x38(%rbp), %rsi
xorl %eax, %eax
callq 0x4050
movq 0x10(%r13), %rdx
addq $0x4, %rdx
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xdcda
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xdce2
movq %rbx, %rdi
callq 0x11c0a
movl %r15d, %edx
movq 0x28(%r13), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r12d, %ecx
movl -0x30(%rbp), %r8d
callq *(%rax)
addq $-0x4, 0x8(%rbx)
leaq 0x6946(%rip), %rdi      # 0x1461a
movq -0x38(%rbp), %rsi
jmp 0xdd0b
movq %rbx, %rdi
callq 0x11c0a
movq 0x28(%r13), %rax
movq 0x20(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r14d, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
addq $-0x4, 0x8(%rbx)
leaq 0x6913(%rip), %rdi      # 0x1461a
movq -0x40(%rbp), %rsi
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4050