// File: rfotino[P]consolite-compiler/src/syntax.cpp
// Function: WhileStatement::output(Parser*, std::shared_ptr<FunctionToken> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void WhileStatement::output(Parser *parser,
                            const std::shared_ptr<FunctionToken>& function,
                            const std::string& returnLabel,
                            const std::string&,
                            const std::string&) {
  // Create the break and continue labels.
  std::string breakLabel =
    parser->getUnusedLabel(function->name() + "_while_break");
  std::string continueLabel =
    parser->getUnusedLabel(function->name() + "_while_continue");
  // Output the continue label and test the condition.
  parser->writeln(continueLabel + ":");
  _condExpr->output(parser, VarLocation("L"));
  parser->writeInst("TST L L");
  parser->writeInst("JEQ " + breakLabel);
  // Output the loop body and then jump to the start again.
  _body->output(parser, function, returnLabel, breakLabel, continueLabel);
  parser->writeInst("JMPI " + continueLabel);
  // Output the break label.
  parser->writeln(breakLabel + ":");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd780
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0xdbe0
movq -0x200(%rbp), %rsi
leaq 0x3eb79(%rip), %rdx     # 0x6ff9f
leaq -0x70(%rbp), %rdi
callq 0xe020
jmp 0x31431
movq -0x208(%rbp), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0xc3c0
jmp 0x31447
leaq -0x70(%rbp), %rdi
callq 0x8848
leaq -0x90(%rbp), %rdi
callq 0x8848
movq -0x10(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd780
movq %rax, %rsi
leaq -0x100(%rbp), %rdi
callq 0xdbe0
jmp 0x31481
leaq 0x3eb27(%rip), %rdx     # 0x6ffaf
leaq -0xe0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0xe020
jmp 0x3149d
movq -0x218(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
leaq -0xe0(%rbp), %rdx
callq 0xc3c0
jmp 0x314b9
leaq -0xe0(%rbp), %rdi
callq 0x8848
leaq -0x100(%rbp), %rdi
callq 0x8848
movq -0x10(%rbp), %rax
movq %rax, -0x220(%rbp)
leaq 0x40165(%rip), %rdx     # 0x71648
leaq -0x120(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xdd40
jmp 0x314f8
movq -0x220(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0xcc30
jmp 0x3150d
leaq -0x120(%rbp), %rdi
callq 0x8848
movq -0x210(%rbp), %rdi
addq $0x10, %rdi
callq 0x33ae0
movq %rax, -0x238(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x230(%rbp)
leaq -0x169(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x8760
movq -0x228(%rbp), %rdx
leaq 0x3e60c(%rip), %rsi     # 0x6fb68
leaq -0x168(%rbp), %rdi
callq 0xced0
jmp 0x3156a
leaq -0x148(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x33d80
jmp 0x3157f
movq -0x230(%rbp), %rsi
movq -0x238(%rbp), %rdi
leaq -0x148(%rbp), %rdx
callq 0x22390
jmp 0x3159b
leaq -0x148(%rbp), %rdi
callq 0xe4c0
leaq -0x168(%rbp), %rdi
callq 0x8848
leaq -0x169(%rbp), %rdi
callq 0x8460
movq -0x10(%rbp), %rax
movq %rax, -0x248(%rbp)
leaq -0x191(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x8760
movq -0x240(%rbp), %rdx
leaq 0x3e985(%rip), %rsi     # 0x6ff70
leaq -0x190(%rbp), %rdi
callq 0xced0
jmp 0x315f9
movq -0x248(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0xc600
jmp 0x3160e
leaq -0x190(%rbp), %rdi
callq 0x8848
leaq -0x191(%rbp), %rdi
callq 0x8460
movq -0x10(%rbp), %rax
movq %rax, -0x250(%rbp)
leaq 0x3e28b(%rip), %rsi     # 0x6f8c3
leaq -0x1b8(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0xdc30
jmp 0x3164a
movq -0x250(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0xc600
jmp 0x3165f
leaq -0x1b8(%rbp), %rdi
callq 0x8848
movq -0x210(%rbp), %rdi
addq $0x20, %rdi
callq 0x341f0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq (%rdi), %rax
movq 0x8(%rax), %rax
leaq -0x50(%rbp), %r8
leaq -0xc0(%rbp), %r9
callq *%rax
jmp 0x316a0
movq -0x10(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq 0x3da67(%rip), %rsi     # 0x6f119
leaq -0x1d8(%rbp), %rdi
leaq -0xc0(%rbp), %rdx
callq 0xdc30
jmp 0x316c7
movq -0x258(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0xc600
jmp 0x316dc
leaq -0x1d8(%rbp), %rdi
callq 0x8848
movq -0x10(%rbp), %rax
movq %rax, -0x260(%rbp)
leaq 0x3ff4e(%rip), %rdx     # 0x71648
leaq -0x1f8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xdd40
jmp 0x3170c
movq -0x260(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0xcc30
jmp 0x31721
leaq -0x1f8(%rbp), %rdi
callq 0x8848
leaq -0xc0(%rbp), %rdi
callq 0x8848
leaq -0x50(%rbp), %rdi
callq 0x8848
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3177a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x8848
leaq -0x90(%rbp), %rdi
callq 0x8848
jmp 0x31935
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3192c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x317d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x8848
leaq -0x100(%rbp), %rdi
callq 0x8848
jmp 0x3192c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x31920
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x8848
jmp 0x31920
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x31871
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x31865
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x148(%rbp), %rdi
callq 0xe4c0
leaq -0x168(%rbp), %rdi
callq 0x8848
leaq -0x169(%rbp), %rdi
callq 0x8460
jmp 0x31920
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x318b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x8848
leaq -0x191(%rbp), %rdi
callq 0x8460
jmp 0x31920
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x8848
jmp 0x31920
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x8848
jmp 0x31920
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x8848
leaq -0xc0(%rbp), %rdi
callq 0x8848
leaq -0x50(%rbp), %rdi
callq 0x8848
movq -0x98(%rbp), %rdi
callq 0x8750
nopw %cs:(%rax,%rax)