// File: /workspace/github_cpp_makefile_star2_O1/smallsimple[P]CoreInterpreter-CSE5341/Tokenizer.cpp
// Function: Tokenizer::dealToken(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Tokenizer::dealToken(string str){
  int start = 0;
  int flag = 0; 
  Token tok;
  vector<SpecMarker> sMarker1;
  sMarker1 = this->searchSpec(str);
  for (int i = 0; i < sMarker1.size(); i++){
    // deal with string before special symbol if any
    if (start < sMarker1[i].start){
      int len = sMarker1[i].start - start;
      int ID;
      string temp = str.substr(start, len);
      if(!isLegalToken(temp)) {
	cout << "program stopped." << endl;
	exit(0);
      }
    }
    // deal with speical symbol
    tok.name = specSymbols[sMarker1[i].id];
    tok.num = sMarker1[i].id + 12;
    tokens.push_back(tok);
    // move start to end of next speical symbol
    start = sMarker1[i].start + specSymbols[sMarker1[i].id].size();
  }
  
  // if there is token after the last special symbols
  if (start < str.size()){
    string temp = str.substr(start, str.size()-start);
    if(!isLegalToken(temp)) {
      cout << "program stopped." << endl;
      exit(0);
    }
    else{
    }
    
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %r15
movq %rdi, %r13
leaq -0x90(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0xd8(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rsi), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0xe8(%rbp), %rdi
callq 0x4146
leaq -0x50(%rbp), %rdi
leaq -0xe8(%rbp), %rdx
callq 0x2fb6
movq -0x50(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x48(%rbp), %rbx
movq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq -0xe8(%rbp), %rdi
cmpq %r12, %rdi
je 0x3744
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x21a0
xorl %edx, %edx
subq -0x30(%rbp), %rbx
je 0x3865
movq %r15, -0x60(%rbp)
sarq $0x3, %rbx
cmpq $0x1, %rbx
adcq $0x0, %rbx
leaq -0x80(%rbp), %r12
xorl %r15d, %r15d
movq -0x30(%rbp), %r14
movl (%r14,%r15,8), %eax
subl %edx, %eax
jle 0x37fa
movslq %edx, %rdx
movslq %eax, %rcx
leaq -0x50(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x21b0
leaq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x4146
movq %r12, %rsi
movq %r13, %r12
movq %r13, %rdi
movq %rsi, %r14
callq 0x329e
movl %eax, %r13d
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x37d2
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x21a0
testb %r13b, %r13b
je 0x3938
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
movq %r12, %r13
je 0x37f7
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21a0
movq %r14, %r12
movq -0x30(%rbp), %r14
movslq 0x4(%r14,%r15,8), %rsi
shlq $0x5, %rsi
leaq 0x8b02(%rip), %rax      # 0xc310
addq %rax, %rsi
leaq -0xa0(%rbp), %rdi
callq 0x20e0
movl 0x4(%r14,%r15,8), %eax
addl $0xc, %eax
movl %eax, -0xa8(%rbp)
movq %r13, %rdi
leaq -0xa8(%rbp), %rsi
callq 0x407e
movl (%r14,%r15,8), %edx
movslq 0x4(%r14,%r15,8), %rax
shlq $0x5, %rax
leaq 0x8ac2(%rip), %rcx      # 0xc310
addl 0x8(%rax,%rcx), %edx
incq %r15
cmpq %r15, %rbx
jne 0x376b
movslq %edx, %rdx
movq -0x60(%rbp), %r15
movq 0x8(%r15), %rcx
subq %rdx, %rcx
movq -0x30(%rbp), %rbx
jbe 0x38f0
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x21b0
leaq -0xb8(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %rdi
callq 0x4146
leaq -0xc8(%rbp), %rsi
movq %r13, %rdi
callq 0x329e
movl %eax, %r14d
movq -0xc8(%rbp), %rdi
cmpq %r12, %rdi
je 0x38ce
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21a0
testb %r14b, %r14b
je 0x3963
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x38f0
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21a0
testq %rbx, %rbx
je 0x3904
movq -0x58(%rbp), %rsi
subq %rbx, %rsi
movq %rbx, %rdi
callq 0x21a0
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x3926
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x21a0
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8699(%rip), %rdi      # 0xbfd8
leaq 0x47d4(%rip), %rsi      # 0x811a
movl $0x10, %edx
callq 0x21d0
movq 0x8681(%rip), %rdi      # 0xbfd8
callq 0x20c0
xorl %edi, %edi
callq 0x21f0
movq 0x866e(%rip), %rdi      # 0xbfd8
leaq 0x47a9(%rip), %rsi      # 0x811a
movl $0x10, %edx
callq 0x21d0
movq 0x8656(%rip), %rdi      # 0xbfd8
callq 0x20c0
jmp 0x395c
movq %rax, %r15
movq -0xc8(%rbp), %rdi
cmpq %r12, %rdi
je 0x39b1
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21a0
jmp 0x39b1
jmp 0x3a30
movq %rax, %r15
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
jmp 0x3a1d
movq %rax, %r15
movq -0xe8(%rbp), %rdi
cmpq %r12, %rdi
je 0x39de
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x21a0
jmp 0x39de
movq %rax, %r15
movq $0x0, -0x30(%rbp)
movq $0x0, -0x58(%rbp)
jmp 0x3a33
jmp 0x3a12
jmp 0x3a30
movq %rax, %r15
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x3a15
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x21a0
jmp 0x3a15
movq %rax, %r15
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x3a33
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21a0
jmp 0x3a33
movq %rax, %r15
cmpq $0x0, -0x30(%rbp)
je 0x3a4a
movq -0x58(%rbp), %rsi
movq -0x30(%rbp), %rdi
subq %rdi, %rsi
callq 0x21a0
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x3a6c
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x21a0
movq %r15, %rdi
callq 0x22b0