// File: /workspace/github_cpp_makefile_star2_O2/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 $0xd8, %rsp
movq %rsi, %rbx
leaq -0x88(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, -0x30(%rbp)
movb $0x0, (%rax)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
andq $0x0, -0x40(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x2210
movq %rbx, -0x58(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0xe0(%rbp), %rdx
callq 0x2d8e
leaq -0x50(%rbp), %r15
leaq -0x78(%rbp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3e70
movq %rbx, %rdi
callq 0x3a4a
leaq -0xe0(%rbp), %rdi
callq 0x20c0
xorl %ebx, %ebx
movq (%r15), %rax
leaq -0x100(%rbp), %r14
leaq 0x8080(%rip), %r12      # 0xb310
leaq -0xa0(%rbp), %r13
xorl %ecx, %ecx
movq -0x48(%rbp), %rsi
subq %rax, %rsi
sarq $0x3, %rsi
movslq %ecx, %rdx
cmpq %rbx, %rsi
jbe 0x3364
movl (%rax,%rbx,8), %esi
subl %ecx, %esi
jle 0x3312
movq %r14, %r12
movslq %esi, %rcx
leaq -0x78(%rbp), %r15
movq %r15, %rdi
movq -0x58(%rbp), %rsi
callq 0x21a0
movq %r12, %r14
movq %r12, %rdi
movq %r15, %rsi
callq 0x2210
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x3008
movl %eax, %r15d
movq %r14, %rdi
callq 0x20c0
testb %r15b, %r15b
je 0x33dc
leaq -0x78(%rbp), %rdi
callq 0x20c0
movq -0x50(%rbp), %rax
movq %r12, %r14
leaq 0x7ffe(%rip), %r12      # 0xb310
movslq 0x4(%rax,%rbx,8), %rsi
shlq $0x5, %rsi
addq %r12, %rsi
leaq -0x98(%rbp), %rdi
callq 0x20f0
movq -0x50(%rbp), %rax
movl 0x4(%rax,%rbx,8), %eax
addl $0xc, %eax
movl %eax, -0xa0(%rbp)
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0x3918
movq -0x50(%rbp), %rax
movl (%rax,%rbx,8), %ecx
movslq 0x4(%rax,%rbx,8), %rdx
shlq $0x5, %rdx
addl 0x8(%rdx,%r12), %ecx
incq %rbx
jmp 0x3299
movq -0x58(%rbp), %rsi
movq 0x8(%rsi), %rcx
subq %rdx, %rcx
jbe 0x33b5
leaq -0x78(%rbp), %rdi
callq 0x21a0
leaq -0xc0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x2210
leaq -0xc0(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x3008
movl %eax, %ebx
leaq -0xc0(%rbp), %rdi
callq 0x20c0
testb %bl, %bl
je 0x33fe
leaq -0x78(%rbp), %rdi
callq 0x20c0
leaq -0x50(%rbp), %rdi
callq 0x3a4a
leaq -0x98(%rbp), %rdi
callq 0x20c0
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x7bf5(%rip), %rdi      # 0xafd8
leaq 0x3d5c(%rip), %rsi      # 0x7146
callq 0x2170
movq %rax, %rdi
callq 0x20d0
xorl %edi, %edi
callq 0x21d0
movq 0x7bd3(%rip), %rdi      # 0xafd8
leaq 0x3d3a(%rip), %rsi      # 0x7146
callq 0x2170
movq %rax, %rdi
callq 0x20d0
jmp 0x33f7
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
jmp 0x344a
jmp 0x345c
jmp 0x343b
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
jmp 0x3453
jmp 0x345c
jmp 0x343b
movq %rax, %rbx
jmp 0x344f
movq %rax, %rbx
leaq -0x100(%rbp), %rdi
callq 0x20c0
leaq -0x78(%rbp), %rdi
callq 0x20c0
jmp 0x345f
jmp 0x345c
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x3a4a
leaq -0x98(%rbp), %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x2290