// File: Eronana[P]strawberry/src/ast_codegen.cpp
// Function: AST_DoStatement::codeGen(Symbol*)
DEF_AST_METHOD(DoStatement,AST_CODEGEN)
{
    int beginLabel=nextLabel();
    int endLabel=nextLabel();
    int continueLabel=nextLabel();
    continueStack.push(continueLabel);
    breakStack.push(endLabel);
    GET_SCOPE();
    PRINTF("; do statement\n");
    PRINTF("label_%d:\n",beginLabel);
    PRINTF("; statement\n");
    CODEGEN(statement);
    PRINTF("label_%d:\n",continueLabel);
    PRINTF("; check expression\n");
    CODEGEN(expr);
    PRINTF("isfalse\n");
    PRINTF("jmp label_%d\n",beginLabel);
    PRINTF("label_%d:\n",endLabel);
    continueStack.pop();
    breakStack.pop();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
callq 0x1a000
movl %eax, -0x14(%rbp)
callq 0x1a000
movl %eax, -0x18(%rbp)
callq 0x1a000
movl %eax, -0x1c(%rbp)
leaq 0x36181(%rip), %rdi     # 0x8a798
leaq -0x1c(%rbp), %rsi
callq 0x55580
leaq 0x361c1(%rip), %rdi     # 0x8a7e8
leaq -0x18(%rbp), %rsi
callq 0x55580
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq 0x36129(%rip), %rdi     # 0x8a768
leaq -0x28(%rbp), %rsi
callq 0x20310
movq %rax, %rdi
callq 0x203f0
movq %rax, -0x10(%rbp)
movl 0x365b6(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x365ad(%rip)     # 0x8ac10
leaq 0x3627e(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
leaq 0x5312(%rip), %rsi      # 0x59986
movb $0x0, %al
callq 0x74c0
movl 0x3658f(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x36586(%rip)     # 0x8ac10
leaq 0x36257(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
movl -0x14(%rbp), %edx
leaq 0x5238(%rip), %rsi      # 0x598d6
movb $0x0, %al
callq 0x74c0
movl 0x36565(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x3655c(%rip)     # 0x8ac10
leaq 0x3622d(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
leaq 0x52a1(%rip), %rsi      # 0x59966
movb $0x0, %al
callq 0x74c0
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
callq 0x8f60
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movq (%rdi), %rax
callq *0x18(%rax)
movl 0x36524(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x3651b(%rip)     # 0x8ac10
leaq 0x361ec(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
movl -0x1c(%rbp), %edx
leaq 0x51cd(%rip), %rsi      # 0x598d6
movb $0x0, %al
callq 0x74c0
movl 0x364fa(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x364f1(%rip)     # 0x8ac10
leaq 0x361c2(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
leaq 0x5222(%rip), %rsi      # 0x59952
movb $0x0, %al
callq 0x74c0
movq -0x30(%rbp), %rdi
addq $0x10, %rdi
callq 0x8f60
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movq (%rdi), %rax
callq *0x18(%rax)
movl 0x364b9(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x364b0(%rip)     # 0x8ac10
leaq 0x36181(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
leaq 0x5112(%rip), %rsi      # 0x59883
movb $0x0, %al
callq 0x74c0
movl 0x36492(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x36489(%rip)     # 0x8ac10
leaq 0x3615a(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
movl -0x14(%rbp), %edx
leaq 0x50da(%rip), %rsi      # 0x59875
movb $0x0, %al
callq 0x74c0
movl 0x36468(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x3645f(%rip)     # 0x8ac10
leaq 0x36130(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
movl -0x18(%rbp), %edx
leaq 0x5111(%rip), %rsi      # 0x598d6
movb $0x0, %al
callq 0x74c0
leaq 0x35fc5(%rip), %rdi     # 0x8a798
callq 0x555b0
leaq 0x36009(%rip), %rdi     # 0x8a7e8
callq 0x555b0
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)