// File: 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
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x18(%rbp), %rsi
leaq 0x10703(%rip), %rdi     # 0x16230
callq 0x6890
movq %rax, -0x20(%rbp)
leaq 0x106f3(%rip), %rdi     # 0x16230
callq 0x68c0
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x6860
testb $0x1, %al
jne 0x5b59
jmp 0x5ba9
movq -0x18(%rbp), %rdx
leaq -0x50(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
xorl %esi, %esi
callq 0x68f0
movq -0x1b0(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x6920
jmp 0x5b81
leaq -0x50(%rbp), %rdi
callq 0x6990
jmp 0x5f45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x6990
jmp 0x5f4e
movq -0x18(%rbp), %rsi
leaq 0x106ac(%rip), %rdi     # 0x16260
callq 0x69e0
movq %rax, -0x68(%rbp)
leaq 0x1069c(%rip), %rdi     # 0x16260
callq 0x6a10
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x69b0
testb $0x1, %al
jne 0x5be0
jmp 0x5c3c
movq -0x18(%rbp), %rdx
leaq -0x98(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
movl $0x1, %esi
callq 0x68f0
movq -0x1b8(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x6920
jmp 0x5c0e
leaq -0x98(%rbp), %rdi
callq 0x6990
jmp 0x5f43
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x6990
jmp 0x5f4e
movq -0x1a8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5830
testb $0x1, %al
jne 0x5c55
jmp 0x5d01
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x22e0
movq -0x1a8(%rbp), %rdi
movq -0x1c0(%rbp), %rdx
movq -0x18(%rbp), %rsi
callq 0x59a0
jmp 0x5c81
leaq -0xe0(%rbp), %rdi
movl $0x2, %esi
leaq -0xb8(%rbp), %rdx
callq 0x68f0
jmp 0x5c9b
movq -0x10(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x6920
jmp 0x5cad
leaq -0xe0(%rbp), %rdi
callq 0x6990
leaq -0xb8(%rbp), %rdi
callq 0x2120
jmp 0x5f41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x5cf0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x6990
leaq -0xb8(%rbp), %rdi
callq 0x2120
jmp 0x5f4e
movq -0x18(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2150
movq -0x1d0(%rbp), %rdi
movq %rax, %rsi
subq $0x1, %rsi
callq 0x2280
movsbl (%rax), %edx
movb $0x0, -0x101(%rbp)
xorl %eax, %eax
movl $0x3a, %ecx
cmpl %edx, %ecx
movb %al, -0x1c1(%rbp)
jne 0x5d95
movq -0x18(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2150
movq -0x1d8(%rbp), %rsi
movq %rax, %rcx
subq $0x1, %rcx
leaq -0x100(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x2220
movq -0x1a8(%rbp), %rdi
movb $0x1, -0x101(%rbp)
leaq -0x100(%rbp), %rsi
callq 0x5770
movb %al, -0x1c1(%rbp)
movb -0x1c1(%rbp), %al
movb %al, -0x1d9(%rbp)
testb $0x1, -0x101(%rbp)
jne 0x5dac
jmp 0x5db8
leaq -0x100(%rbp), %rdi
callq 0x2120
movb -0x1d9(%rbp), %al
testb $0x1, %al
jne 0x5dc7
jmp 0x5e7b
movq -0x18(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x2150
movq -0x1f0(%rbp), %rsi
movq %rax, %rcx
decq %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x128(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0x2220
movq -0x1e8(%rbp), %rdx
leaq -0x150(%rbp), %rdi
movl $0x3, %esi
callq 0x68f0
jmp 0x5e15
movq -0x10(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x6920
jmp 0x5e27
leaq -0x150(%rbp), %rdi
callq 0x6990
leaq -0x128(%rbp), %rdi
callq 0x2120
jmp 0x5f3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x5e6a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x6990
leaq -0x128(%rbp), %rdi
callq 0x2120
jmp 0x5f4e
movq -0x1a8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5770
testb $0x1, %al
jne 0x5e91
jmp 0x5ee7
movq -0x18(%rbp), %rdx
leaq -0x178(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
movl $0x4, %esi
callq 0x68f0
movq -0x1f8(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x6920
jmp 0x5ebf
leaq -0x178(%rbp), %rdi
callq 0x6990
jmp 0x5f3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x6990
jmp 0x5f4e
movq -0x18(%rbp), %rdx
leaq -0x1a0(%rbp), %rdi
movq %rdi, -0x200(%rbp)
movl $0x5, %esi
callq 0x68f0
movq -0x200(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x6920
jmp 0x5f15
leaq -0x1a0(%rbp), %rdi
callq 0x6990
jmp 0x5f3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x6990
jmp 0x5f4e
jmp 0x5f3f
jmp 0x5f41
jmp 0x5f43
jmp 0x5f45
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x23a0
nopw (%rax,%rax)