// File: /workspace/github_cpp_makefile_star2_O2/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, %r13d
movq %rsi, %rbx
movq %rdi, %r14
movl $0xfffffef9, %eax       # imm = 0xFFFFFEF9
addl 0x8(%rdi), %eax
cmpl $0x8, %eax
ja 0xc79a
leaq 0x715c(%rip), %rcx      # 0x136dc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x10f51(%rip), %eax     # 0x1d4e0
movq %rax, -0x30(%rbp)
leal 0x1(%rax), %ecx
movl %ecx, -0x38(%rbp)
leal 0x2(%rax), %ecx
movl %ecx, -0x40(%rbp)
addl $0x3, %eax
movl %eax, 0x10f38(%rip)     # 0x1d4e0
movq 0x18(%r14), %rsi
addq $-0x4, %rsi
movq %rbx, %rdi
callq 0xee54
movq 0x28(%r14), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r13d, %edx
movl %r12d, %ecx
movl %r15d, -0x44(%rbp)
movl %r15d, %r8d
callq *(%rax)
leaq 0x701f(%rip), %rdi      # 0x135fa
movq -0x30(%rbp), %rsi
xorl %eax, %eax
callq 0x3040
movq 0x28(%r14), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r13d, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
leaq 0x725d(%rip), %rdi      # 0x13863
movl -0x38(%rbp), %r15d
movl %r15d, %esi
xorl %eax, %eax
callq 0x3040
movq 0x28(%r14), %rax
movq 0x30(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r13d, %edx
movl %r15d, %ecx
movl -0x40(%rbp), %r15d
movl %r15d, %r8d
callq *(%rax)
leaq 0x6fc2(%rip), %rdi      # 0x135fa
movl %r15d, %esi
xorl %eax, %eax
callq 0x3040
movq 0x28(%r14), %rax
movq 0x20(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r13d, %edx
movl %r12d, %ecx
movl -0x44(%rbp), %r8d
callq *(%rax)
addq $-0x4, 0x8(%rbx)
leaq 0x71ef(%rip), %rdi      # 0x13857
movq -0x30(%rbp), %rsi
xorl %eax, %eax
callq 0x3040
leaq 0x6f80(%rip), %rdi      # 0x135fa
movl -0x38(%rbp), %esi
jmp 0xc8d1
movq 0x28(%r14), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r13d, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
movq %r14, %rax
movq 0x30(%r14), %r14
movq %rax, -0x38(%rbp)
subq 0x28(%rax), %r14
movl 0x10e31(%rip), %esi     # 0x1d4e0
leal 0x1(%rsi), %eax
movl %eax, 0x10e28(%rip)     # 0x1d4e0
leaq 0x71a4(%rip), %rdi      # 0x13863
movq %rsi, -0x30(%rbp)
xorl %eax, %eax
callq 0x3040
cmpq $0x21, %r14
jb 0xc894
movq -0x38(%rbp), %r14
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0xee54
movq 0x28(%r14), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r13d, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
addq $-0x4, 0x8(%rbx)
movl 0x10dd8(%rip), %esi     # 0x1d4e0
movq %rsi, -0x40(%rbp)
leal 0x1(%rsi), %eax
movl %eax, 0x10dcb(%rip)     # 0x1d4e0
leaq 0x713b(%rip), %rdi      # 0x13857
xorl %eax, %eax
callq 0x3040
leaq 0x6ed0(%rip), %rdi      # 0x135fa
movq -0x30(%rbp), %rsi
xorl %eax, %eax
callq 0x3040
movq 0x10(%r14), %rsi
addq $0x4, %rsi
movq %rbx, %rdi
callq 0xee54
movq 0x28(%r14), %rax
movq 0x20(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r13d, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
addq $-0x4, 0x8(%rbx)
leaq 0x6e90(%rip), %rdi      # 0x135fa
movq -0x40(%rbp), %rsi
jmp 0xc8d1
movq 0x28(%r14), %rax
cmpq %rax, 0x30(%r14)
je 0xc8e6
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r13d, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
jmp 0xc8f2
movq %rbx, -0x30(%rbp)
movl %r15d, %ebx
movl %r13d, %r15d
movq 0x28(%r14), %r13
movq 0x30(%r14), %r14
cmpq %r14, %r13
je 0xc7cd
movq (%r13), %rdi
movq (%rdi), %rax
movq -0x30(%rbp), %rsi
movl %r15d, %edx
movl %r12d, %ecx
movl %ebx, %r8d
callq *(%rax)
addq $0x10, %r13
jmp 0xc7ac
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x10cfe(%rip), %esi     # 0x1d4e0
movq %rsi, -0x30(%rbp)
leal 0x1(%rsi), %eax
movl %eax, -0x38(%rbp)
leal 0x2(%rsi), %eax
movl %eax, 0x10ceb(%rip)     # 0x1d4e0
leaq 0x6dfe(%rip), %rdi      # 0x135fa
xorl %eax, %eax
callq 0x3040
movq 0x28(%r14), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r13d, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
leaq 0x7041(%rip), %rdi      # 0x13863
movl -0x38(%rbp), %r15d
movl %r15d, %esi
xorl %eax, %eax
callq 0x3040
movq 0x18(%r14), %rsi
addq $-0x4, %rsi
movq %rbx, %rdi
callq 0xee54
movq 0x28(%r14), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r13d, %edx
movl %r15d, %ecx
movq -0x30(%rbp), %r14
movl %r14d, %r8d
callq *(%rax)
addq $-0x4, 0x8(%rbx)
leaq 0x6fee(%rip), %rdi      # 0x13857
movl %r14d, %esi
xorl %eax, %eax
callq 0x3040
leaq 0x6d80(%rip), %rdi      # 0x135fa
jmp 0xc88f
leaq 0x6fd4(%rip), %rdi      # 0x13857
movl %r12d, %esi
jmp 0xc8d1
leaq 0x6fc8(%rip), %rdi      # 0x13857
movl %r15d, %esi
jmp 0xc8d1
movq -0x38(%rbp), %r14
movq 0x18(%r14), %rsi
addq $-0x4, %rsi
movq %rbx, %rdi
callq 0xee54
movq 0x28(%r14), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl %r13d, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq *(%rax)
addq $-0x4, 0x8(%rbx)
leaq 0x6d2d(%rip), %rdi      # 0x135fa
movq -0x30(%rbp), %rsi
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3040
leaq 0x6d55(%rip), %rdi      # 0x13642
callq 0x3310
leaq 0x6d51(%rip), %rdi      # 0x1364a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3310