// File: rfotino[P]consolite-compiler/src/syntax.cpp
// Function: ForStatement::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 ForStatement::output(Parser *parser,
                          const std::shared_ptr<FunctionToken>& function,
                          const std::string& returnLabel,
                          const std::string&,
                          const std::string&) {
  // Evaluate the initial expressions and discard the result.
  for (auto expr : _initExprs) {
    expr->output(parser, VarLocation("L"));
  }
  // Create the start, break, and continue labels.
  std::string startLabel =
    parser->getUnusedLabel(function->name() + "_for_start");
  std::string breakLabel =
    parser->getUnusedLabel(function->name() + "_for_break");
  std::string continueLabel =
    parser->getUnusedLabel(function->name() + "_for_continue");
  // Output the start label and test the condition.
  parser->writeln(startLabel + ":");
  _condExpr->output(parser, VarLocation("L"));
  parser->writeInst("TST L L");
  parser->writeInst("JEQ " + breakLabel);
  // Output the function body followed by the continue label.
  _body->output(parser, function, returnLabel, breakLabel, continueLabel);
  parser->writeln(continueLabel + ":");
  // Output the loop expressions and jump to the start of the loop.
  for (auto expr : _loopExprs) {
    expr->output(parser, VarLocation("L"));
  }
  parser->writeInst("JMPI " + startLabel);
  // Output the break label.
  parser->writeln(breakLabel + ":");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x420, %rsp            # imm = 0x420
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, -0x370(%rbp)
addq $0x30, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x35840
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0x35870
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x358a0
testb $0x1, %al
jne 0x30a16
jmp 0x30b4b
leaq -0x40(%rbp), %rdi
callq 0x358e0
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x35900
movq -0x390(%rbp), %rdi
callq 0x33ae0
movq %rax, -0x388(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x380(%rbp)
leaq -0xa1(%rbp), %rdi
movq %rdi, -0x378(%rbp)
callq 0x8760
movq -0x378(%rbp), %rdx
leaq 0x3f0f7(%rip), %rsi     # 0x6fb68
leaq -0xa0(%rbp), %rdi
callq 0xced0
jmp 0x30a7f
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x33d80
jmp 0x30a91
movq -0x380(%rbp), %rsi
movq -0x388(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x22390
jmp 0x30aaa
leaq -0x80(%rbp), %rdi
callq 0xe4c0
leaq -0xa0(%rbp), %rdi
callq 0x8848
leaq -0xa1(%rbp), %rdi
callq 0x8460
leaq -0x58(%rbp), %rdi
callq 0x33b70
leaq -0x40(%rbp), %rdi
callq 0x35930
jmp 0x30a00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x30b31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x30b25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xe4c0
leaq -0xa0(%rbp), %rdi
callq 0x8848
leaq -0xa1(%rbp), %rdi
callq 0x8460
leaq -0x58(%rbp), %rdi
callq 0x33b70
jmp 0x313ac
movq -0x10(%rbp), %rax
movq %rax, -0x3a0(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd780
movq %rax, %rsi
leaq -0x118(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0xdbe0
movq -0x398(%rbp), %rsi
leaq 0x3f3f5(%rip), %rdx     # 0x6ff78
leaq -0xf8(%rbp), %rdi
callq 0xe020
jmp 0x30b91
movq -0x3a0(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
leaq -0xf8(%rbp), %rdx
callq 0xc3c0
jmp 0x30bad
leaq -0xf8(%rbp), %rdi
callq 0x8848
leaq -0x118(%rbp), %rdi
callq 0x8848
movq -0x10(%rbp), %rax
movq %rax, -0x3a8(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd780
movq %rax, %rsi
leaq -0x178(%rbp), %rdi
callq 0xdbe0
jmp 0x30bea
leaq 0x3f392(%rip), %rdx     # 0x6ff83
leaq -0x158(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0xe020
jmp 0x30c06
movq -0x3a8(%rbp), %rsi
leaq -0x138(%rbp), %rdi
leaq -0x158(%rbp), %rdx
callq 0xc3c0
jmp 0x30c22
leaq -0x158(%rbp), %rdi
callq 0x8848
leaq -0x178(%rbp), %rdi
callq 0x8848
movq -0x10(%rbp), %rax
movq %rax, -0x3b0(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd780
movq %rax, %rsi
leaq -0x1d8(%rbp), %rdi
callq 0xdbe0
jmp 0x30c5f
leaq 0x3f328(%rip), %rdx     # 0x6ff8e
leaq -0x1b8(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0xe020
jmp 0x30c7b
movq -0x3b0(%rbp), %rsi
leaq -0x198(%rbp), %rdi
leaq -0x1b8(%rbp), %rdx
callq 0xc3c0
jmp 0x30c97
leaq -0x1b8(%rbp), %rdi
callq 0x8848
leaq -0x1d8(%rbp), %rdi
callq 0x8848
movq -0x10(%rbp), %rax
movq %rax, -0x3b8(%rbp)
leaq 0x40987(%rip), %rdx     # 0x71648
leaq -0x1f8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0xdd40
jmp 0x30cd6
movq -0x3b8(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0xcc30
jmp 0x30ceb
leaq -0x1f8(%rbp), %rdi
callq 0x8848
movq -0x370(%rbp), %rdi
addq $0x10, %rdi
callq 0x33ae0
movq %rax, -0x3d0(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x3c8(%rbp)
leaq -0x241(%rbp), %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x8760
movq -0x3c0(%rbp), %rdx
leaq 0x3ee2e(%rip), %rsi     # 0x6fb68
leaq -0x240(%rbp), %rdi
callq 0xced0
jmp 0x30d48
leaq -0x220(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x33d80
jmp 0x30d5d
movq -0x3c8(%rbp), %rsi
movq -0x3d0(%rbp), %rdi
leaq -0x220(%rbp), %rdx
callq 0x22390
jmp 0x30d79
leaq -0x220(%rbp), %rdi
callq 0xe4c0
leaq -0x240(%rbp), %rdi
callq 0x8848
leaq -0x241(%rbp), %rdi
callq 0x8460
movq -0x10(%rbp), %rax
movq %rax, -0x3e0(%rbp)
leaq -0x269(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
callq 0x8760
movq -0x3d8(%rbp), %rdx
leaq 0x3f1a7(%rip), %rsi     # 0x6ff70
leaq -0x268(%rbp), %rdi
callq 0xced0
jmp 0x30dd7
movq -0x3e0(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0xc600
jmp 0x30dec
leaq -0x268(%rbp), %rdi
callq 0x8848
leaq -0x269(%rbp), %rdi
callq 0x8460
movq -0x10(%rbp), %rax
movq %rax, -0x3e8(%rbp)
leaq 0x3eaad(%rip), %rsi     # 0x6f8c3
leaq -0x290(%rbp), %rdi
leaq -0x138(%rbp), %rdx
callq 0xdc30
jmp 0x30e2b
movq -0x3e8(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0xc600
jmp 0x30e40
leaq -0x290(%rbp), %rdi
callq 0x8848
movq -0x370(%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 -0x138(%rbp), %r8
leaq -0x198(%rbp), %r9
callq *%rax
jmp 0x30e84
movq -0x10(%rbp), %rax
movq %rax, -0x3f0(%rbp)
leaq 0x407b2(%rip), %rdx     # 0x71648
leaq -0x2b0(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0xdd40
jmp 0x30eab
movq -0x3f0(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0xcc30
jmp 0x30ec0
leaq -0x2b0(%rbp), %rdi
callq 0x8848
movq -0x370(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x2b8(%rbp)
movq -0x2b8(%rbp), %rdi
callq 0x35840
movq %rax, -0x2c0(%rbp)
movq -0x2b8(%rbp), %rdi
callq 0x35870
movq %rax, -0x2c8(%rbp)
leaq -0x2c0(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x358a0
testb $0x1, %al
jne 0x30f20
jmp 0x3128d
leaq -0x2c0(%rbp), %rdi
callq 0x358e0
movq %rax, %rsi
leaq -0x2d8(%rbp), %rdi
movq %rdi, -0x410(%rbp)
callq 0x35900
movq -0x410(%rbp), %rdi
callq 0x33ae0
movq %rax, -0x408(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x400(%rbp)
leaq -0x321(%rbp), %rdi
movq %rdi, -0x3f8(%rbp)
callq 0x8760
movq -0x3f8(%rbp), %rdx
leaq 0x3ebe7(%rip), %rsi     # 0x6fb68
leaq -0x320(%rbp), %rdi
callq 0xced0
jmp 0x30f8f
leaq -0x300(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x33d80
jmp 0x30fa4
movq -0x400(%rbp), %rsi
movq -0x408(%rbp), %rdi
leaq -0x300(%rbp), %rdx
callq 0x22390
jmp 0x30fc0
leaq -0x300(%rbp), %rdi
callq 0xe4c0
leaq -0x320(%rbp), %rdi
callq 0x8848
leaq -0x321(%rbp), %rdi
callq 0x8460
leaq -0x2d8(%rbp), %rdi
callq 0x33b70
leaq -0x2c0(%rbp), %rdi
callq 0x35930
jmp 0x30f04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x31033
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x8848
leaq -0x118(%rbp), %rdi
callq 0x8848
jmp 0x313ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x313a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x3108d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x8848
leaq -0x178(%rbp), %rdi
callq 0x8848
jmp 0x313a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x31394
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x310e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x8848
leaq -0x1d8(%rbp), %rdi
callq 0x8848
jmp 0x31394
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x31388
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x8848
jmp 0x31388
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x31184
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x31178
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x220(%rbp), %rdi
callq 0xe4c0
leaq -0x240(%rbp), %rdi
callq 0x8848
leaq -0x241(%rbp), %rdi
callq 0x8460
jmp 0x31388
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x311c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x8848
leaq -0x269(%rbp), %rdi
callq 0x8460
jmp 0x31388
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x8848
jmp 0x31388
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x8848
jmp 0x31388
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x31270
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x31264
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x300(%rbp), %rdi
callq 0xe4c0
leaq -0x320(%rbp), %rdi
callq 0x8848
leaq -0x321(%rbp), %rdi
callq 0x8460
leaq -0x2d8(%rbp), %rdi
callq 0x33b70
jmp 0x31388
movq -0x10(%rbp), %rax
movq %rax, -0x418(%rbp)
leaq 0x3de7a(%rip), %rsi     # 0x6f119
leaq -0x348(%rbp), %rdi
leaq -0xd8(%rbp), %rdx
callq 0xdc30
jmp 0x312b4
movq -0x418(%rbp), %rdi
leaq -0x348(%rbp), %rsi
callq 0xc600
jmp 0x312c9
leaq -0x348(%rbp), %rdi
callq 0x8848
movq -0x10(%rbp), %rax
movq %rax, -0x420(%rbp)
leaq 0x40361(%rip), %rdx     # 0x71648
leaq -0x368(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0xdd40
jmp 0x312fc
movq -0x420(%rbp), %rdi
leaq -0x368(%rbp), %rsi
callq 0xcc30
jmp 0x31311
leaq -0x368(%rbp), %rdi
callq 0x8848
leaq -0x198(%rbp), %rdi
callq 0x8848
leaq -0x138(%rbp), %rdi
callq 0x8848
leaq -0xd8(%rbp), %rdi
callq 0x8848
addq $0x420, %rsp            # imm = 0x420
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x348(%rbp), %rdi
callq 0x8848
jmp 0x31388
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x368(%rbp), %rdi
callq 0x8848
leaq -0x198(%rbp), %rdi
callq 0x8848
leaq -0x138(%rbp), %rdi
callq 0x8848
leaq -0xd8(%rbp), %rdi
callq 0x8848
movq -0xb0(%rbp), %rdi
callq 0x8750
nopl (%rax,%rax)