// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rdi, %r15
leaq 0x6ec6(%rip), %rdi      # 0xb198
movq %rdx, %rsi
callq 0x4f3c
leaq 0x6ebf(%rip), %rcx      # 0xb1a0
cmpq %rcx, %rax
je 0x4308
leaq 0x8(%rsp), %r15
andl $0x0, -0x8(%r15)
movq %r15, %rdi
movq %r14, %rsi
callq 0x2210
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x478c
jmp 0x4346
leaq 0x6eb9(%rip), %rdi      # 0xb1c8
movq %r14, %rsi
callq 0x5216
leaq 0x6eb2(%rip), %rcx      # 0xb1d0
cmpq %rcx, %rax
je 0x4359
leaq 0x8(%rsp), %r15
movl $0x1, -0x8(%r15)
movq %r15, %rdi
movq %r14, %rsi
callq 0x2210
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x478c
movq %r15, %rdi
callq 0x20c0
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movq %r14, %rsi
callq 0x41b8
testb %al, %al
je 0x43ad
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x28(%rsp), %rdx
movq %r14, %rsi
callq 0x422a
leaq 0x8(%rsp), %r14
movl $0x2, -0x8(%r14)
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x2210
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x478c
jmp 0x4421
movq (%r14), %rax
movq 0x8(%r14), %rcx
cmpb $0x3a, -0x1(%rax,%rcx)
jne 0x4433
decq %rcx
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x21c0
movq %r15, %rsi
callq 0x4164
movl %eax, %ebp
movq %r15, %rdi
callq 0x20c0
testb %bpl, %bpl
je 0x4433
movq 0x8(%r14), %rcx
decq %rcx
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x21c0
leaq 0x8(%rsp), %r14
movl $0x3, -0x8(%r14)
movq %r14, %rdi
movq %r15, %rsi
callq 0x2210
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x478c
movq %r14, %rdi
callq 0x20c0
leaq 0x28(%rsp), %rdi
jmp 0x4349
movq %r14, %rsi
callq 0x4164
leaq 0x8(%rsp), %r15
testb %al, %al
je 0x4467
movl $0x4, -0x8(%r15)
movq %r15, %rdi
movq %r14, %rsi
callq 0x2210
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x478c
jmp 0x4346
movl $0x5, -0x8(%r15)
movq %r15, %rdi
movq %r14, %rsi
callq 0x2210
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x478c
jmp 0x4346
jmp 0x4492
jmp 0x44a1
jmp 0x44ad
jmp 0x44ad
movq %rax, %rbx
movq %r14, %rdi
callq 0x20c0
jmp 0x44a4
jmp 0x44a1
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x44b3
jmp 0x44ad
movq %rax, %rbx
movq %r15, %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x22b0