// File: /workspace/github_cpp_makefile_star2_O2/Eronana[P]strawberry/src/ast_codegen.cpp
// Function: AST_ForStatement::codeGen(Symbol*)
DEF_AST_METHOD(ForStatement,AST_CODEGEN)
{
    int beginLabel=nextLabel();
    int endLabel=nextLabel();
    int continueLabel=nextLabel();
    continueStack.push(continueLabel);
    breakStack.push(endLabel);
    GET_SCOPE();
    PRINTF("; for statement\n");
    PRINTF("; init\n");
    CODEGEN(init);
    PRINTF("label_%d:\n",beginLabel);
    PRINTF("; check expression\n");
    CODEGEN(expr);
    PRINTF("istrue\n");
    PRINTF("jmp label_%d\n",endLabel);
    PRINTF("; statement\n");
    CODEGEN(statement);
    PRINTF("label_%d:\n",continueLabel);
    PRINTF("; loop expression\n");
    CODEGEN(loopExpr);
    PRINTF("pop\n");
    PRINTF("jmp label_%d\n",beginLabel);
    PRINTF("label_%d:\n",endLabel);
    continueStack.pop();
    breakStack.pop();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r12
callq 0xc83c
movl %eax, %ebp
callq 0xc83c
leaq 0x8(%rsp), %rbx
movl %eax, (%rbx)
callq 0xc83c
leaq 0xc(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x1434f(%rip), %rdi     # 0x2f6c8
callq 0x1bfea
leaq 0x14393(%rip), %rdi     # 0x2f718
movq %rbx, %rsi
callq 0x1bfea
leaq 0x10(%rsp), %rsi
movq %r12, (%rsi)
leaq 0x142fc(%rip), %rdi     # 0x2f698
callq 0xed1e
movq (%rax), %r15
incl 0x14796(%rip)           # 0x2fb40
leaq 0x14467(%rip), %r14     # 0x2f818
movq (%r14), %rcx
leaq 0x335e(%rip), %rdi      # 0x1e719
pushq $0x10
popq %rsi
pushq $0x1
popq %r13
movq %r13, %rdx
callq 0x64c0
incl 0x14770(%rip)           # 0x2fb40
movq (%r14), %rcx
leaq 0x3350(%rip), %rdi      # 0x1e72a
pushq $0x7
popq %rbx
movq %rbx, %rsi
movq %r13, %rdx
callq 0x64c0
movq 0x8(%r12), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x18(%rax)
incl 0x14744(%rip)           # 0x2fb40
movq (%r14), %rdi
leaq 0x32b0(%rip), %rsi      # 0x1e6b6
movl %ebp, %edx
xorl %eax, %eax
callq 0x6390
incl 0x1472b(%rip)           # 0x2fb40
movq (%r14), %rcx
leaq 0x3313(%rip), %rdi      # 0x1e732
pushq $0x13
popq %rsi
movq %r13, %rdx
callq 0x64c0
movq 0x10(%r12), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x18(%rax)
incl 0x14702(%rip)           # 0x2fb40
movq (%r14), %rcx
leaq 0x3205(%rip), %rdi      # 0x1e64d
movq %rbx, %rsi
movq %r13, %rdx
callq 0x64c0
incl 0x146e7(%rip)           # 0x2fb40
movq (%r14), %rdi
leaq 0x8(%rsp), %rax
movl (%rax), %edx
leaq 0x31eb(%rip), %rbx      # 0x1e655
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6390
incl 0x146c6(%rip)           # 0x2fb40
movq (%r14), %rcx
leaq 0x32c2(%rip), %rdi      # 0x1e746
pushq $0xc
popq %rsi
movq %r13, %rdx
callq 0x64c0
movq 0x20(%r12), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x18(%rax)
incl 0x1469d(%rip)           # 0x2fb40
movq (%r14), %rdi
leaq 0xc(%rsp), %rax
movl (%rax), %edx
leaq 0x3202(%rip), %rsi      # 0x1e6b6
xorl %eax, %eax
callq 0x6390
incl 0x1467f(%rip)           # 0x2fb40
movq (%r14), %rcx
leaq 0x3288(%rip), %rdi      # 0x1e753
pushq $0x12
popq %rsi
movq %r13, %rdx
callq 0x64c0
movq 0x18(%r12), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x18(%rax)
incl 0x14656(%rip)           # 0x2fb40
movq (%r14), %rcx
leaq 0x30c3(%rip), %rdi      # 0x1e5b7
pushq $0x4
popq %rsi
movq %r13, %rdx
callq 0x64c0
incl 0x1463b(%rip)           # 0x2fb40
movq (%r14), %rdi
movq %rbx, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x6390
incl 0x14626(%rip)           # 0x2fb40
movq (%r14), %rdi
leaq 0x8(%rsp), %rax
movl (%rax), %edx
leaq 0x318b(%rip), %rsi      # 0x1e6b6
xorl %eax, %eax
callq 0x6390
leaq 0x1418f(%rip), %rdi     # 0x2f6c8
callq 0x1c21e
leaq 0x141d3(%rip), %rdi     # 0x2f718
callq 0x1c21e
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop