// File: /workspace/github_cpp_makefile_star2_O3/Falldog[P]dcinja/src/include/inja/inja.hpp
// Function: inja::Lexer::scan()
Token scan() {
    tok_start = pos;

  again:
    if (tok_start >= m_in.size()) {
      return make_token(Token::Kind::Eof);
    }

    switch (state) {
    default:
    case State::Text: {
      // fast-scan to first open character
      size_t open_start = m_in.substr(pos).find_first_of(config.open_chars);
      if (open_start == nonstd::string_view::npos) {
        // didn't find open, return remaining text as text token
        pos = m_in.size();
        return make_token(Token::Kind::Text);
      }
      pos += open_start;

      // try to match one of the opening sequences, and get the close
      nonstd::string_view open_str = m_in.substr(pos);
      bool must_lstrip = false;
      if (inja::string_view::starts_with(open_str, config.expression_open)) {
        if (inja::string_view::starts_with(open_str, config.expression_open_force_lstrip)) {
          state = State::ExpressionStartForceLstrip;
          must_lstrip = true;
        } else {
          state = State::ExpressionStart;
        }
      } else if (inja::string_view::starts_with(open_str, config.statement_open)) {
        if (inja::string_view::starts_with(open_str, config.statement_open_no_lstrip)) {
          state = State::StatementStartNoLstrip;
        } else if (inja::string_view::starts_with(open_str, config.statement_open_force_lstrip )) {
          state = State::StatementStartForceLstrip;
          must_lstrip = true;
        } else {
          state = State::StatementStart;
          must_lstrip = config.lstrip_blocks;
        }
      } else if (inja::string_view::starts_with(open_str, config.comment_open)) {
        state = State::CommentStart;
        must_lstrip = config.lstrip_blocks;
      } else if ((pos == 0 || m_in[pos - 1] == '\n') && inja::string_view::starts_with(open_str, config.line_statement)) {
        state = State::LineStart;
      } else {
        pos += 1; // wasn't actually an opening sequence
        goto again;
      }

      nonstd::string_view text = string_view::slice(m_in, tok_start, pos);
      if (must_lstrip) {
        text = clear_final_line_if_whitespace(text);
      }

      if (text.empty()) {
        goto again; // don't generate empty token
      }
      return Token(Token::Kind::Text, text);
    }
    case State::ExpressionStart: {
      state = State::ExpressionBody;
      pos += config.expression_open.size();
      return make_token(Token::Kind::ExpressionOpen);
    }
    case State::ExpressionStartForceLstrip: {
      state = State::ExpressionBody;
      pos += config.expression_open_force_lstrip.size();
      return make_token(Token::Kind::ExpressionOpen);
    }
    case State::LineStart: {
      state = State::LineBody;
      pos += config.line_statement.size();
      return make_token(Token::Kind::LineStatementOpen);
    }
    case State::StatementStart: {
      state = State::StatementBody;
      pos += config.statement_open.size();
      return make_token(Token::Kind::StatementOpen);
    }
    case State::StatementStartNoLstrip: {
      state = State::StatementBody;
      pos += config.statement_open_no_lstrip.size();
      return make_token(Token::Kind::StatementOpen);
    }
    case State::StatementStartForceLstrip: {
      state = State::StatementBody;
      pos += config.statement_open_force_lstrip.size();
      return make_token(Token::Kind::StatementOpen);
    }
    case State::CommentStart: {
      state = State::CommentBody;
      pos += config.comment_open.size();
      return make_token(Token::Kind::CommentOpen);
    }
    case State::ExpressionBody:
      return scan_body(config.expression_close, Token::Kind::ExpressionClose, config.expression_close_force_rstrip);
    case State::LineBody:
      return scan_body("\n", Token::Kind::LineStatementClose);
    case State::StatementBody:
      return scan_body(config.statement_close, Token::Kind::StatementClose, config.statement_close_force_rstrip, config.trim_blocks);
    case State::CommentBody: {
      // fast-scan to comment close
      size_t end = m_in.substr(pos).find(config.comment_close);
      if (end == nonstd::string_view::npos) {
        pos = m_in.size();
        return make_token(Token::Kind::Eof);
      }
      // return the entire comment in the close token
      state = State::Text;
      pos += end + config.comment_close.size();
      Token tok = make_token(Token::Kind::CommentClose);
      if (config.trim_blocks) {
        skip_whitespaces_and_first_newline();
      }
      return tok;
    }
    }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbp
movq %rdi, %r15
movq 0x10(%rsi), %r12
movq 0x28(%rsi), %rdx
movq %rdx, 0x20(%rsi)
cmpq %r12, %rdx
jae 0x1ef28
movq %r15, 0x18(%rsp)
movl 0x8(%rbp), %eax
decl %eax
cmpl $0xa, %eax
jbe 0x1ef6c
movq %rdx, 0x38(%rsp)
movq 0x28(%rbp), %r13
cmpq %r13, %r12
jb 0x1f287
movq %rbp, %rbx
movq 0x18(%rbp), %r14
je 0x1ef44
movq (%rbx), %rax
movq %rax, 0x30(%rsp)
movq 0x188(%rax), %rbp
testq %rbp, %rbp
je 0x1ef44
movq 0x30(%rsp), %rax
movq 0x180(%rax), %r15
movsbl (%r14,%r13), %esi
movq %r15, %rdi
movq %rbp, %rdx
callq 0x9450
testq %rax, %rax
jne 0x1ecaf
incq %r13
cmpq %r13, %r12
jne 0x1ec8d
jmp 0x1ef44
movq %r13, 0x28(%rbx)
movq %r12, %r15
subq %r13, %r15
jb 0x1f287
movq %rbx, %rbp
addq %r13, %r14
movq 0x30(%rsp), %rdx
movq 0xc0(%rdx), %r8
movq 0xc8(%rdx), %rcx
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
cmpq %rcx, %r15
leaq 0x20(%rsp), %rbx
jb 0x1ed05
movq %rbx, %rdi
xorl %esi, %esi
movq %rcx, %rdx
callq 0x1eb9a
movq (%rbp), %rdx
testl %eax, %eax
je 0x1eda2
movq (%rdx), %r8
movq 0x8(%rdx), %rcx
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
cmpq %rcx, %r15
jb 0x1ed34
movq %rbx, %rdi
xorl %esi, %esi
movq %rcx, %rdx
callq 0x1eb9a
movq (%rbp), %rdx
testl %eax, %eax
je 0x1edf7
movq 0x140(%rdx), %r8
movq 0x148(%rdx), %rcx
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
cmpq %rcx, %r15
jb 0x1ed66
movq %rbx, %rdi
xorl %esi, %esi
movq %rcx, %rdx
callq 0x1eb9a
testl %eax, %eax
je 0x1ee45
movq 0x28(%rbp), %rax
testq %rax, %rax
je 0x1ed7a
movq 0x18(%rbp), %rcx
cmpb $0xa, -0x1(%rcx,%rax)
jne 0x1ed9b
movq (%rbp), %rcx
movq 0xa0(%rcx), %r8
movq 0xa8(%rcx), %rcx
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
cmpq %rcx, %r15
jae 0x1edcd
movq 0x18(%rsp), %r15
jmp 0x1edeb
movq 0xe0(%rdx), %r8
movq 0xe8(%rdx), %rcx
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
cmpq %rcx, %r15
jae 0x1ee5d
movq 0x18(%rsp), %r15
jmp 0x1ee73
movq %rbx, %rdi
xorl %esi, %esi
movq %rcx, %rdx
callq 0x1eb9a
testl %eax, %eax
movq 0x18(%rsp), %r15
je 0x1ee7c
movq 0x28(%rbp), %rax
incq %rax
movq %rax, 0x28(%rbp)
jmp 0x1ef17
movq 0x20(%rdx), %r8
movq 0x28(%rdx), %rcx
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
cmpq %rcx, %r15
jb 0x1ee27
movq %rbx, %rdi
xorl %esi, %esi
movq %rcx, %rdx
callq 0x1eb9a
testl %eax, %eax
je 0x1eeb9
movq (%rbp), %rdx
movq 0x40(%rdx), %r8
movq 0x48(%rdx), %rcx
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
cmpq %rcx, %r15
jae 0x1ee87
movq 0x18(%rsp), %r15
jmp 0x1eea1
movl $0xa, 0x8(%rbp)
movq (%rbp), %rax
movb 0x1a1(%rax), %cl
movq 0x18(%rsp), %r15
jmp 0x1eecd
movq %rbx, %rdi
xorl %esi, %esi
movq %rcx, %rdx
callq 0x1eb9a
testl %eax, %eax
movq 0x18(%rsp), %r15
je 0x1eeb0
movl $0x1, 0x8(%rbp)
jmp 0x1ee83
movl $0x4, 0x8(%rbp)
xorl %ecx, %ecx
jmp 0x1eecd
movq %rbx, %rdi
xorl %esi, %esi
movq %rcx, %rdx
callq 0x1eb9a
testl %eax, %eax
movq 0x18(%rsp), %r15
je 0x1eec4
movq (%rbp), %rdx
movl $0x6, 0x8(%rbp)
movb 0x1a1(%rdx), %cl
jmp 0x1eecd
movl $0x2, 0x8(%rbp)
jmp 0x1eecb
movl $0x7, 0x8(%rbp)
xorl %ecx, %ecx
jmp 0x1ee56
movl $0x8, 0x8(%rbp)
movb $0x1, %cl
movq 0x10(%rbp), %rax
movq 0x20(%rbp), %rdx
movq 0x28(%rbp), %rsi
cmpq %rdx, %rax
cmovbq %rax, %rdx
cmpq %rsi, %rdx
cmovaq %rdx, %rsi
cmpq %rax, %rsi
cmovaeq %rax, %rsi
subq %rdx, %rsi
subq %rdx, %rax
cmpq %rsi, %rax
cmovaeq %rsi, %rax
addq 0x18(%rbp), %rdx
testb %cl, %cl
je 0x1ef0e
movq %rax, %rdi
movq %rdx, %rsi
callq 0x1f2b2
testq %rax, %rax
jne 0x1f277
movq 0x10(%rbp), %r12
movq 0x20(%rbp), %rdx
cmpq %r12, %rdx
jb 0x1ec3c
addq 0x18(%rbp), %r12
movl $0x22, (%r15)
movq $0x0, 0x8(%r15)
movq %r12, 0x10(%r15)
jmp 0x1f23a
movq %r12, 0x28(%rbx)
movq 0x38(%rsp), %rax
subq %rax, %r12
addq %rax, %r14
movq 0x18(%rsp), %r15
movl $0x0, (%r15)
movq %r12, 0x8(%r15)
movq %r14, 0x10(%r15)
jmp 0x1f23a
leaq 0x352d5(%rip), %rcx     # 0x54248
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x3, 0x8(%rbp)
movq (%rbp), %rax
movq 0x28(%rbp), %rcx
addq 0xc8(%rax), %rcx
jmp 0x1f0bc
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movups %xmm0, (%rsp)
leaq 0x369c8(%rip), %rcx     # 0x55972
movl $0x1, %edx
movq %r15, %rdi
movq %rbp, %rsi
movl $0x4, %r8d
jmp 0x1f044
movl $0xb, 0x8(%rbp)
movq (%rbp), %rax
movq 0x28(%rbp), %rcx
addq 0x148(%rax), %rcx
movq %rcx, 0x28(%rbp)
cmpq %rcx, %rdx
cmovaq %rdx, %rcx
cmpq %r12, %rcx
cmovaeq %r12, %rcx
subq %rdx, %rcx
subq %rdx, %r12
cmpq %rcx, %r12
cmovaeq %rcx, %r12
addq 0x18(%rbp), %rdx
movl $0x7, (%r15)
jmp 0x1f13a
movq (%rbp), %rax
movq 0x100(%rax), %rcx
movq 0x108(%rax), %rdx
movq 0x120(%rax), %rsi
movq 0x128(%rax), %rax
movq %rax, 0x50(%rsp)
movq %rsi, 0x58(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movl $0x2, %r8d
xorl %r9d, %r9d
jmp 0x1f235
movl $0x5, 0x8(%rbp)
movq (%rbp), %rax
movq 0x28(%rbp), %rcx
addq 0xa8(%rax), %rcx
movq %rcx, 0x28(%rbp)
cmpq %rcx, %rdx
cmovaq %rdx, %rcx
cmpq %r12, %rcx
cmovaeq %r12, %rcx
subq %rdx, %rcx
subq %rdx, %r12
cmpq %rcx, %r12
cmovaeq %rcx, %r12
addq 0x18(%rbp), %rdx
movl $0x3, (%r15)
jmp 0x1f13a
movl $0x9, 0x8(%rbp)
movq (%rbp), %rax
movq 0x28(%rbp), %rcx
addq 0x48(%rax), %rcx
jmp 0x1f110
movl $0x3, 0x8(%rbp)
movq (%rbp), %rax
movq 0x28(%rbp), %rcx
addq 0xe8(%rax), %rcx
movq %rcx, 0x28(%rbp)
cmpq %rcx, %rdx
cmovaq %rdx, %rcx
cmpq %r12, %rcx
cmovaeq %r12, %rcx
subq %rdx, %rcx
subq %rdx, %r12
cmpq %rcx, %r12
cmovaeq %rcx, %r12
addq 0x18(%rbp), %rdx
movl $0x1, (%r15)
jmp 0x1f13a
movl $0x9, 0x8(%rbp)
movq (%rbp), %rax
movq 0x28(%rbp), %rcx
addq 0x8(%rax), %rcx
jmp 0x1f110
movl $0x9, 0x8(%rbp)
movq (%rbp), %rax
movq 0x28(%rbp), %rcx
addq 0x28(%rax), %rcx
movq %rcx, 0x28(%rbp)
cmpq %rcx, %rdx
cmovaq %rdx, %rcx
cmpq %r12, %rcx
cmovaeq %r12, %rcx
subq %rdx, %rcx
subq %rdx, %r12
cmpq %rcx, %r12
cmovaeq %rcx, %r12
addq 0x18(%rbp), %rdx
movl $0x5, (%r15)
movq %r12, 0x8(%r15)
movq %rdx, 0x10(%r15)
jmp 0x1f23a
movq 0x28(%rbp), %rdx
movq %r12, %rax
subq %rdx, %rax
jb 0x1f2a2
addq 0x18(%rbp), %rdx
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
movq %rdx, 0x8(%rdi)
movq (%rbp), %rax
movq 0x160(%rax), %rsi
movq 0x168(%rax), %rcx
xorl %edx, %edx
callq 0x1fd78
cmpq $-0x1, %rax
je 0x1f24c
movl $0x0, 0x8(%rbp)
movq (%rbp), %rcx
addq 0x168(%rcx), %rax
movq 0x10(%rbp), %rdx
addq 0x28(%rbp), %rax
movq %rax, 0x28(%rbp)
movq 0x20(%rbp), %rsi
cmpq %rsi, %rdx
cmovbq %rdx, %rsi
cmpq %rax, %rsi
cmovaq %rsi, %rax
cmpq %rdx, %rax
cmovaeq %rdx, %rax
subq %rsi, %rax
subq %rsi, %rdx
cmpq %rax, %rdx
cmovaeq %rax, %rdx
addq 0x18(%rbp), %rsi
movl $0x8, (%r15)
movq %rdx, 0x8(%r15)
movq %rsi, 0x10(%r15)
cmpb $0x1, 0x1a0(%rcx)
jne 0x1f23a
movq %rbp, %rdi
callq 0x1fb5e
jmp 0x1f23a
movq (%rbp), %rax
movq 0x60(%rax), %rcx
movq 0x68(%rax), %rdx
movq 0x80(%rax), %rsi
movq 0x88(%rax), %rdi
movq %rdi, 0x40(%rsp)
movq %rsi, 0x48(%rsp)
movzbl 0x1a0(%rax), %r9d
movups 0x40(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movl $0x6, %r8d
callq 0x1f2ee
movq %r15, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rbp), %rax
movq 0x20(%rbp), %rcx
cmpq %rcx, %rax
cmovbq %rax, %rcx
movq %rax, 0x28(%rbp)
subq %rcx, %rax
addq 0x18(%rbp), %rcx
movl $0x22, (%r15)
movq %rax, 0x8(%r15)
movq %rcx, 0x10(%r15)
jmp 0x1f23a
movl $0x0, (%r15)
movq %rax, 0x8(%r15)
jmp 0x1f13e
leaq 0x368dd(%rip), %rdi     # 0x55b6b
leaq 0x368bc(%rip), %rsi     # 0x55b51
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x9670
leaq 0x368c2(%rip), %rdi     # 0x55b6b
leaq 0x368a1(%rip), %rsi     # 0x55b51
jmp 0x1f298