// File: /workspace/github_cpp_makefile_star2_O3/rfotino[P]consolite-assembler/src/tokenizer.cpp
// Function: Tokenizer::_addToken(std::vector<Token, std::allocator<Token>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Tokenizer::_addToken(std::vector<Token>& tokens,
                          const std::string& text) {
  // Find the type of token
  if (opcodes.find(text) != opcodes.end()) {
    // The token is an opcode
    Token t(OPCODE, text);
    tokens.push_back(t);
  } else if (registers.find(text) != registers.end()) {
    // The token is a register
    Token t(REGISTER, text);
    tokens.push_back(t);
  } else if (_isValidData(text)) {
    // The token is data
    std::string data;
    _getData(text, data);
    Token t(DATA, data);
    tokens.push_back(t);
  } else if (':' == text[text.size() - 1] &&
             _isValidLabel(text.substr(0, text.size() - 1))) {
    // The token ends in :, it is a label declaration
    std::string label = text.substr(0, text.size() - 1);
    Token t(LABELDECL, label);
    tokens.push_back(t);
  } else if (_isValidLabel(text)) {
    // The token is a label reference
    Token t(LABELREF, text);
    tokens.push_back(t);
  } else {
    // The token is of an unknown type
    Token t(UNKNOWN, text);
    tokens.push_back(t);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movq %rsi, %rbx
leaq 0x6c2b(%rip), %rdi      # 0xb190
movq %rdx, %rsi
callq 0x5242
leaq 0x6c24(%rip), %rcx      # 0xb198
cmpq %rcx, %rax
je 0x45aa
leaq 0x8(%rsp), %rdi
movl $0x0, -0x8(%rdi)
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
callq 0x4c28
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x4af6
jmp 0x45f4
leaq 0x6c0f(%rip), %rdi      # 0xb1c0
movq %r14, %rsi
callq 0x5528
leaq 0x6c08(%rip), %rcx      # 0xb1c8
cmpq %rcx, %rax
je 0x4616
leaq 0x8(%rsp), %rdi
movl $0x1, -0x8(%rdi)
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
callq 0x4c28
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x4af6
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x460b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rsi
callq 0x439c
testb %al, %al
je 0x46a0
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
leaq 0x28(%rsp), %rdx
movq %r14, %rsi
callq 0x4414
leaq 0x8(%rsp), %rdi
movl $0x2, -0x8(%rdi)
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
callq 0x4c28
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x4af6
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x468d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
jne 0x475f
jmp 0x460b
movq (%r14), %rax
movq 0x8(%r14), %rcx
cmpb $0x3a, -0x1(%rax,%rcx)
jne 0x4769
decq %rcx
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x21d0
movq %r15, %rsi
callq 0x4354
movl %eax, %ebp
movq (%r15), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x46e9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21b0
testb %bpl, %bpl
je 0x4769
movq 0x8(%r14), %rcx
decq %rcx
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x21d0
leaq 0x8(%rsp), %rdi
movl $0x3, -0x8(%rdi)
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
callq 0x4c28
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x4af6
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x474d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x460b
movq 0x38(%rsp), %rsi
jmp 0x4603
movq %r14, %rsi
callq 0x4354
leaq 0x8(%rsp), %rdi
testb %al, %al
je 0x47a9
movl $0x4, -0x8(%rdi)
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
callq 0x4c28
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x4af6
jmp 0x45f4
movl $0x5, -0x8(%rdi)
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
callq 0x4c28
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x4af6
jmp 0x45f4
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x47f7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x47f7
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x4836
jmp 0x4859
jmp 0x483f
jmp 0x483f
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x482c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x482c
jmp 0x4829
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x4859
movq 0x38(%rsp), %rsi
jmp 0x4851
jmp 0x483f
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4859
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2290
nop