// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r12
movq (%rdx), %rsi
addq $0x58, %rsi
leaq 0x50(%rsp), %r13
movq %r13, %rdi
callq 0x73e0
leaq 0x1242a(%rip), %rdx     # 0x29f0f
leaq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x9ad4
leaq 0x70(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rbx, %rsi
callq 0x901a
leaq 0x8(%rsp), %rdi
callq 0x75c8
leaq 0x50(%rsp), %rdi
callq 0x75c8
movq (%r15), %rsi
addq $0x58, %rsi
leaq 0x30(%rsp), %rdi
callq 0x73e0
leaq 0x123ef(%rip), %rdx     # 0x29f1f
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x9ad4
leaq 0x50(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rbx, %rsi
callq 0x901a
leaq 0x8(%rsp), %rdi
callq 0x75c8
leaq 0x30(%rsp), %rdi
callq 0x75c8
leaq 0x13ac4(%rip), %rdx     # 0x2b630
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x99f6
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x93f2
leaq 0x8(%rsp), %rdi
callq 0x75c8
movq 0x10(%r12), %r13
leaq 0x11f3a(%rip), %rsi     # 0x29ad8
leaq 0x30(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x9502
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x73e0
leaq 0x8(%rsp), %rdx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x10ca6
leaq 0x8(%rsp), %rdi
callq 0x75c8
leaq 0x30(%rsp), %rdi
callq 0x75c8
leaq 0x122f9(%rip), %rsi     # 0x29ee0
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x9502
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x914a
leaq 0x8(%rsp), %rdi
callq 0x75c8
leaq 0x11c1f(%rip), %rsi     # 0x29833
leaq 0x8(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x9980
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x914a
leaq 0x8(%rsp), %rdi
callq 0x75c8
movq 0x20(%r12), %rdi
movq (%rdi), %rax
leaq 0x70(%rsp), %r8
leaq 0x50(%rsp), %r9
movq %rbx, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq *0x8(%rax)
leaq 0x114b6(%rip), %rsi     # 0x29115
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x9980
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x914a
leaq 0x8(%rsp), %rdi
callq 0x75c8
leaq 0x139a4(%rip), %rdx     # 0x2b630
leaq 0x8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x99f6
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x93f2
leaq 0x8(%rsp), %rdi
callq 0x75c8
leaq 0x50(%rsp), %rdi
callq 0x75c8
leaq 0x70(%rsp), %rdi
callq 0x75c8
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x17d04
jmp 0x17d13
jmp 0x17d04
jmp 0x17d13
jmp 0x17d13
jmp 0x17d04
jmp 0x17d13
jmp 0x17d04
jmp 0x17d13
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x75c8
jmp 0x17cfb
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x17d0c
jmp 0x17d13
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x75c8
jmp 0x17d16
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x75c8
leaq 0x70(%rsp), %rdi
callq 0x75c8
movq %rbx, %rdi
callq 0x7510
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x75c8
jmp 0x17d44
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x17d1b
movq %rax, %rbx
jmp 0x17d20
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x75c8
jmp 0x17d62
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
jmp 0x17d25
nop