// File: rfotino[P]consolite-compiler/src/syntax.cpp
// Function: IfStatement::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 IfStatement::output(Parser *parser,
                         const std::shared_ptr<FunctionToken>& function,
                         const std::string& returnLabel,
                         const std::string& breakLabel,
                         const std::string& continueLabel) {
  std::string falseLabel = parser->getUnusedLabel(function->name() + "_if_false");
  std::string endLabel = parser->getUnusedLabel(function->name() + "_if_end");
  // Test the condition and jump to the false label if it is false.
  _condExpr.output(parser, VarLocation("L"));
  parser->writeInst("TST L L");
  parser->writeInst("JEQ " + falseLabel);
  // Output the true statement and jump to the end.
  _trueStatement->output(parser, function, returnLabel, breakLabel,
                         continueLabel);
  parser->writeInst("JMPI " + endLabel);
  // Output the false statement label and the false statement.
  parser->writeln(falseLabel + ":");
  if (nullptr != _falseStatement) {
    _falseStatement->output(parser, function, returnLabel, breakLabel,
                            continueLabel);
  }
  // Output the end label that the true statement uses to jump over the
  // false statement.
  parser->writeln(endLabel + ":");
}

// 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 0x3fb28(%rip), %rdx     # 0x6ff5e
leaq -0x70(%rbp), %rdi
callq 0xe020
jmp 0x30441
movq -0x208(%rbp), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0xc3c0
jmp 0x30457
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 0x30491
leaq 0x3fad0(%rip), %rdx     # 0x6ff68
leaq -0xe0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0xe020
jmp 0x304ad
movq -0x218(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
leaq -0xe0(%rbp), %rdx
callq 0xc3c0
jmp 0x304c9
leaq -0xe0(%rbp), %rdi
callq 0x8848
leaq -0x100(%rbp), %rdi
callq 0x8848
movq -0x210(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x230(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x228(%rbp)
leaq -0x149(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x8760
movq -0x220(%rbp), %rdx
leaq 0x3f649(%rip), %rsi     # 0x6fb68
leaq -0x148(%rbp), %rdi
callq 0xced0
jmp 0x3052d
leaq -0x128(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x33d80
jmp 0x30542
movq -0x228(%rbp), %rsi
movq -0x230(%rbp), %rdi
leaq -0x128(%rbp), %rdx
callq 0x22390
jmp 0x3055e
leaq -0x128(%rbp), %rdi
callq 0xe4c0
leaq -0x148(%rbp), %rdi
callq 0x8848
leaq -0x149(%rbp), %rdi
callq 0x8460
movq -0x10(%rbp), %rax
movq %rax, -0x240(%rbp)
leaq -0x171(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x8760
movq -0x238(%rbp), %rdx
leaq 0x3f9c2(%rip), %rsi     # 0x6ff70
leaq -0x170(%rbp), %rdi
callq 0xced0
jmp 0x305bc
movq -0x240(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0xc600
jmp 0x305d1
leaq -0x170(%rbp), %rdi
callq 0x8848
leaq -0x171(%rbp), %rdi
callq 0x8460
movq -0x10(%rbp), %rax
movq %rax, -0x248(%rbp)
leaq 0x3f2c8(%rip), %rsi     # 0x6f8c3
leaq -0x198(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0xdc30
jmp 0x3060d
movq -0x248(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0xc600
jmp 0x30622
leaq -0x198(%rbp), %rdi
callq 0x8848
movq -0x210(%rbp), %rdi
addq $0x38, %rdi
callq 0x341f0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
movq (%rdi), %rax
movq 0x8(%rax), %rax
callq *%rax
jmp 0x30660
movq -0x10(%rbp), %rax
movq %rax, -0x250(%rbp)
leaq 0x3eaa7(%rip), %rsi     # 0x6f119
leaq -0x1b8(%rbp), %rdi
leaq -0xc0(%rbp), %rdx
callq 0xdc30
jmp 0x30687
movq -0x250(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0xc600
jmp 0x3069c
leaq -0x1b8(%rbp), %rdi
callq 0x8848
movq -0x10(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq 0x40f8e(%rip), %rdx     # 0x71648
leaq -0x1d8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xdd40
jmp 0x306cc
movq -0x258(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0xcc30
jmp 0x306e1
leaq -0x1d8(%rbp), %rdi
callq 0x8848
movq -0x210(%rbp), %rsi
addq $0x48, %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x357e0
testb $0x1, %al
jne 0x3070a
jmp 0x30901
movq -0x210(%rbp), %rdi
addq $0x48, %rdi
callq 0x341f0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
movq (%rdi), %rax
movq 0x8(%rax), %rax
callq *%rax
jmp 0x3073c
jmp 0x30901
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x30770
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 0x3099a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x30991
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x307ca
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 0x30991
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3082d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x30821
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x128(%rbp), %rdi
callq 0xe4c0
leaq -0x148(%rbp), %rdi
callq 0x8848
leaq -0x149(%rbp), %rdi
callq 0x8460
jmp 0x30985
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x30870
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x8848
leaq -0x171(%rbp), %rdi
callq 0x8460
jmp 0x30985
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x30985
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x8848
jmp 0x30985
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x8848
jmp 0x30985
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x8848
jmp 0x30985
movq -0x10(%rbp), %rax
movq %rax, -0x260(%rbp)
leaq 0x40d35(%rip), %rdx     # 0x71648
leaq -0x1f8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xdd40
jmp 0x30928
movq -0x260(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0xcc30
jmp 0x3093d
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)
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)