// File: /workspace/github_cpp_makefile_star2_O2/rfotino[P]consolite-compiler/src/syntax.cpp
// Function: DoWhileStatement::parse(Tokenizer*, std::vector<std::shared_ptr<FunctionToken>, std::allocator<std::shared_ptr<FunctionToken>>> const&, std::vector<std::shared_ptr<GlobalVarToken>, std::allocator<std::shared_ptr<GlobalVarToken>>> const&, std::vector<std::shared_ptr<ParamToken>, std::allocator<std::shared_ptr<ParamToken>>> const&, std::vector<std::shared_ptr<LocalVarToken>, std::allocator<std::shared_ptr<LocalVarToken>>> const&, std::vector<std::shared_ptr<LabelStatement>, std::allocator<std::shared_ptr<LabelStatement>>>&, std::vector<std::shared_ptr<GotoStatement>, std::allocator<std::shared_ptr<GotoStatement>>>&, std::shared_ptr<FunctionToken> const&)
bool DoWhileStatement::parse(
      Tokenizer *tokenizer,
      const std::vector<std::shared_ptr<FunctionToken>>& functions,
      const std::vector<std::shared_ptr<GlobalVarToken>>& globals,
      const std::vector<std::shared_ptr<ParamToken>>& parameters,
      const std::vector<std::shared_ptr<LocalVarToken>>& localVars,
      std::vector<std::shared_ptr<LabelStatement>>& labels,
      std::vector<std::shared_ptr<GotoStatement>>& gotos,
      const std::shared_ptr<FunctionToken>& currentFunc) {
  _lineNum = tokenizer->peekNext().line();
  // Make sure the first token is the "do" keyword.
  if (!_expect(tokenizer, "do")) {
    return false;
  }
  // Make sure the body exists and is valid.
  _body = StatementToken::parse(tokenizer, functions, globals,
                                parameters, localVars, labels, gotos,
                                currentFunc, true);
  if (!_body) {
    return false;
  }
  // Next token should be the "while" keyword.
  if (!_expect(tokenizer, "while")) {
    return false;
  }
  // Next token should be an opening parenthesis.
  if (!_expect(tokenizer, "(")) {
    return false;
  }
  // Next we should be able to parse the expression.
  _condExpr = std::shared_ptr<ExprToken>(new ExprToken());
  if (!_condExpr->parse(tokenizer, functions, globals,
                        parameters, localVars)) {
    return false;
  }
  // Next two tokens should be a closing parenthesis followed by
  // a semicolon.
  if (!_expect(tokenizer, ")")) {
    return false;
  }
  if (!_expect(tokenizer, ";")) {
    return false;
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, 0x40(%rsp)
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %rbp
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x279a6
movl 0x8(%r14), %eax
movl %eax, 0x8(%rbp)
movq %r14, %rdi
callq 0x7b20
leaq 0x14478(%rip), %rsi     # 0x29dbf
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x9502
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x286c3
movl %eax, %r14d
leaq 0x10(%rsp), %rdi
callq 0x75c8
testb %r14b, %r14b
je 0x15b22
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %r15, %r8
movq 0x40(%rsp), %r9
pushq $0x1
pushq 0x98(%rsp)
pushq 0x98(%rsp)
pushq 0x98(%rsp)
callq 0x136f2
addq $0x20, %rsp
leaq 0x20(%rbp), %rdi
movq %r14, %rsi
callq 0x275d2
leaq 0x18(%rsp), %rdi
callq 0x7a34
cmpq $0x0, 0x20(%rbp)
je 0x15b22
leaq 0x143dc(%rip), %rsi     # 0x29db9
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x9502
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x286c3
movl %eax, %r14d
leaq 0x10(%rsp), %rdi
callq 0x75c8
testb %r14b, %r14b
je 0x15b22
leaq 0x13690(%rip), %rsi     # 0x290a9
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x9502
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x286c3
movl %eax, %r14d
leaq 0x10(%rsp), %rdi
callq 0x75c8
testb %r14b, %r14b
je 0x15b22
pushq $0x28
popq %rdi
callq 0x72b0
orl $-0x1, 0x8(%rax)
leaq 0x285e7(%rip), %rcx     # 0x3e048
movq %rcx, (%rax)
movb $0x1, 0xc(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0xe(%rax)
movups %xmm0, 0x18(%rax)
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x25cd0
leaq 0x10(%rbp), %rdi
movq %r14, %rsi
callq 0x27600
leaq 0x18(%rsp), %rdi
callq 0x7a34
movq 0x10(%rbp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %r15, %r8
movq 0x40(%rsp), %r9
callq 0xe5a8
testb %al, %al
je 0x15b22
leaq 0x14e20(%rip), %rsi     # 0x2a8de
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x9502
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x286c3
movl %eax, %ebp
leaq 0x10(%rsp), %rdi
callq 0x75c8
testb %bpl, %bpl
je 0x15b22
leaq 0x140cc(%rip), %rsi     # 0x29bc1
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x9502
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x286c3
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
callq 0x75c8
jmp 0x15b24
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x15b45
jmp 0x15b54
jmp 0x15b45
jmp 0x15b54
jmp 0x15b45
jmp 0x15b54
jmp 0x15b45
jmp 0x15b54
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x75c8
jmp 0x15b57
movq %rax, %rbx
movq %rbx, %rdi
callq 0x7510
nop