// File: /workspace/github_cpp_makefile_star2_O3/CoinXu[P]reviser-compiler/src/tokenizer.cpp
// Function: reviser::compiler::Tokenizer::Next()
bool Tokenizer::Next() {
  previous = current;

  if (pos >= input.size()) {
    current.type = TOKEN_CODE_END;
    current.text = "";
    return false;
  }

  ConsumeCharacters<Whitespace>();
  ConsumeComment();

  current.text = peek;

  int start_line = line;
  int start_column = column;
  int start_pos = pos;

  switch (peek) {
    case EOF:
      current.type = TOKEN_CODE_END;
      current.text = "";
      break;

    case TOKEN_ASSIGN:
    case TOKEN_LEFT_BRACE:
    case TOKEN_RIGHT_BRACE:
    case TOKEN_SEMICOLON:
    case TOKEN_COMMA:
    case TOKEN_CONNECTION:
    case TOKEN_LEFT_BRACKET:
    case TOKEN_RIGHT_BRACKET:
      current.type = (TokenType)peek;
      NextChar();
      break;

    case TOKEN_QUOTE:
      current.type = TOKEN_LETTER;
      NextChar();
      TryConsumeCharacters<CharQuote>();
      NextChar();
      current.text = input.substr(start_pos, pos - start_pos - 2);
      break;

    case TOKEN_PLUS:
    case TOKEN_HYPHEN:
      current.type = TOKEN_DIGIT;
      NextChar();
      ConsumeNumber();
      current.text = input.substr(start_pos - 1, pos - start_pos);
      break;

    default:
      if (InCharacters<CharDigit>()) {
        current.type = TOKEN_DIGIT;
        ConsumeNumber();
        current.text = input.substr(start_pos - 1, pos - start_pos);
      } else if (InCharacters<Identifier>()) {
        ConsumeCharacters<Identifier>();
        current.text = input.substr(start_pos - 1, pos - start_pos);

        if (TypeIdentifier(current.text)) {
          current.type = TOKEN_DATA_TYPE;
        } else if (DecoraterIdentifier(current.text)) {
          current.type = TOKEN_DECORATER;
        } else if (current.text == ReservedWordMap[RESERVED_STRUCT]) {
          current.type = TOKEN_STRUCT;
        } else if (current.text == ReservedWordMap[RESERVED_ENUM]) {
          current.type = TOKEN_ENUM;
        } else {
          current.type = TOKEN_ID;
        }
      } else {
        TryConsumeCharacters<NewLine>();
        const string content = input.substr(start_pos - 1,  pos - start_pos);
        message.Runtime("unkown token error: \n  " + content + "\n  ^");
      }
  }

  current.start_line = start_line;
  current.end_line = line;
  current.column_start = start_column;
  current.column_end = column - 1;
  current.pos_start = start_pos;
  current.pos_end = pos;

  return current.type != TOKEN_CODE_END;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
movl 0x78(%rdi), %eax
movl %eax, 0xb8(%rdi)
addq $0xc0, %rdi
leaq 0x80(%rbx), %r14
movq %r14, %rsi
callq 0x24210
movq 0xb0(%rbx), %rax
movq %rax, 0xf0(%rbx)
movups 0xa0(%rbx), %xmm0
movups %xmm0, 0xe0(%rbx)
movslq 0xfc(%rbx), %rax
cmpq %rax, 0x8(%rbx)
jbe 0x2f7a7
movzbl 0xf8(%rbx), %eax
leal -0x9(%rax), %ecx
cmpl $0x5, %ecx
jae 0x2f728
movq %rbx, %rdi
callq 0x2ef1a
jmp 0x2f70f
cmpl $0x20, %eax
je 0x2f71e
movq %rbx, %rdi
callq 0x2f06c
movsbl 0xf8(%rbx), %r8d
movq 0x88(%rbx), %rdx
movl $0x1, %ecx
movq %r14, %rdi
xorl %esi, %esi
callq 0x24620
movl 0xfc(%rbx), %r13d
movl 0x100(%rbx), %ecx
movl 0x104(%rbx), %r12d
movslq %r13d, %r15
movzbl 0xf8(%rbx), %eax
cmpl $0x3a, %eax
movl %ecx, -0x2c(%rbp)
jle 0x2f7d0
cmpl $0x7a, %eax
jg 0x2f819
leal -0x3b(%rax), %ecx
cmpl $0x22, %ecx
ja 0x2f928
movabsq $0x500000005, %rdx      # imm = 0x500000005
btq %rcx, %rdx
jb 0x2f852
jmp 0x2f928
movl $0x9, 0x78(%rbx)
movq 0x88(%rbx), %rdx
leaq 0x21398(%rip), %rcx     # 0x50b54
xorl %ebx, %ebx
movq %r14, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x24530
jmp 0x2f914
leal -0x2b(%rax), %ecx
cmpl $0x3, %ecx
ja 0x2f85f
leaq 0x1ffa5(%rip), %rdx     # 0x4f788
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl %r12d, -0x30(%rbp)
movl $0x6, 0x78(%rbx)
movq %rbx, %rdi
callq 0x2ef1a
movq %rbx, %rdi
callq 0x2f134
movslq 0xfc(%rbx), %rcx
subq %r15, %rcx
decq %r15
jmp 0x2f89b
cmpl $0x7b, %eax
je 0x2f852
cmpl $0x7d, %eax
je 0x2f852
cmpl $0xff, %eax
jne 0x2f928
movl $0x9, 0x78(%rbx)
movq 0x88(%rbx), %rdx
leaq 0x21311(%rip), %rcx     # 0x50b54
movq %r14, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x24530
jmp 0x2f8ce
movl %eax, 0x78(%rbx)
movq %rbx, %rdi
callq 0x2ef1a
jmp 0x2f8ce
cmpl $0x22, %eax
jne 0x2f928
movl %r12d, -0x30(%rbp)
movl $0x5, 0x78(%rbx)
movq %rbx, %rdi
callq 0x2ef1a
cmpb $0x22, 0xf8(%rbx)
jne 0x2f873
movq %rbx, %rdi
callq 0x2ef1a
movl 0xfc(%rbx), %eax
subl %r15d, %eax
addl $-0x2, %eax
movslq %eax, %rcx
leaq -0x50(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x24370
movq %r14, %rdi
movq %r12, %rsi
callq 0x24420
movq (%r12), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2f8ca
callq 0x24320
movl -0x30(%rbp), %r12d
movl -0x2c(%rbp), %eax
movl %eax, 0xa0(%rbx)
movl 0x100(%rbx), %eax
movl %eax, 0xa4(%rbx)
movl %r12d, 0xa8(%rbx)
movl 0x104(%rbx), %eax
decl %eax
movl %eax, 0xac(%rbx)
movl %r13d, 0xb0(%rbx)
movl 0x78(%rbx), %eax
movl 0xfc(%rbx), %ecx
movl %ecx, 0xb4(%rbx)
cmpl $0x9, %eax
setne %bl
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0x2f940
movl %r12d, -0x30(%rbp)
movl $0x6, 0x78(%rbx)
jmp 0x2f7ff
cmpl $0x5f, %eax
je 0x2f9ea
movl %eax, %ecx
andb $-0x21, %cl
addb $-0x41, %cl
cmpb $0x19, %cl
jbe 0x2f9ea
movl %r13d, %ecx
cmpl $0xa, %eax
je 0x2f979
movq %rbx, %rdi
callq 0x2ef1a
cmpb $0xa, 0xf8(%rbx)
jne 0x2f962
movl 0xfc(%rbx), %ecx
leaq -0x1(%r15), %rdx
subl %r15d, %ecx
movslq %ecx, %rcx
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x24370
leaq 0x1fed7(%rip), %rsi     # 0x4f870
leaq -0xd0(%rbp), %rdi
movq %r14, %rdx
callq 0x2b4b3
leaq 0x1fed9(%rip), %rsi     # 0x4f888
leaq -0xd0(%rbp), %rdi
callq 0x24650
leaq 0x50(%rbx), %rdi
leaq -0x60(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2fb02
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x2fb09
movl %r12d, -0x30(%rbp)
movq %rbx, %rdi
callq 0x2fec8
movslq 0xfc(%rbx), %rcx
subq %r15, %rcx
decq %r15
leaq -0x50(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x24370
movq %r14, %rdi
movq %r12, %rsi
callq 0x24420
movq (%r12), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2fa32
callq 0x24320
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
movq 0x80(%rbx), %rsi
movq 0x88(%rbx), %rdx
addq %rsi, %rdx
leaq -0xb0(%rbp), %r15
movq %r15, %rdi
callq 0x290da
movq 0x20(%rbx), %rdi
movq 0x28(%rbx), %rsi
movq %r15, %rdx
callq 0x30861
movq %rax, %r15
movq 0x28(%rbx), %r12
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x2fa8c
callq 0x24320
cmpq %r12, %r15
je 0x2fa9d
movl $0x0, 0x78(%rbx)
jmp 0x2f8ca
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
movq 0x80(%rbx), %rsi
movq 0x88(%rbx), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %r15
movq %r15, %rdi
callq 0x290da
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
movq %r15, %rdx
callq 0x30861
movq %rax, %r15
movq 0x40(%rbx), %r12
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x2faf1
callq 0x24320
cmpq %r12, %r15
je 0x2fb67
movl $0x1, 0x78(%rbx)
jmp 0x2f8ca
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq -0x70(%rbp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0x2b2fc
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x2fb37
callq 0x24320
leaq -0xc0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2fb4c
callq 0x24320
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2f8ce
callq 0x24320
jmp 0x2f8ce
leaq -0x50(%rbp), %rsi
movl $0x0, (%rsi)
leaq 0x30d78(%rip), %rdi     # 0x608f0
callq 0x2a05c
movq %r14, %rdi
movq %rax, %rsi
callq 0x2ff14
testb %al, %al
movl -0x30(%rbp), %r12d
je 0x2fb9c
movl $0x2, 0x78(%rbx)
jmp 0x2f8ce
leaq -0x50(%rbp), %rsi
movl $0x1, (%rsi)
leaq 0x30d43(%rip), %rdi     # 0x608f0
callq 0x2a05c
movq %r14, %rdi
movq %rax, %rsi
callq 0x2ff14
testb %al, %al
je 0x2fbcd
movl $0x3, 0x78(%rbx)
jmp 0x2f8ce
movl $0x4, 0x78(%rbx)
jmp 0x2f8ce
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
jmp 0x2fc34
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x2fbff
callq 0x24320
jmp 0x2fbff
movq %rax, %rbx
leaq -0xc0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2fc2c
callq 0x24320
jmp 0x2fc2c
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
jmp 0x2fc34
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2fc3e
callq 0x24320
movq %rbx, %rdi
callq 0x245f0