// File: navrajsaini[P]PL_Compiler_design_project/symboltable.cpp
// Function: Symtable::insertNum(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Symtable::insertNum(string s)
{
   int hashval;
   int val = Symtable::search(s);//check if the word is in the table already
   //if not and the table is not full insert it based on if the word is a
   //keyword or special char or a user input ID
   if (val == -1 && Symtable::full() != true)
   {
      hashval = hashfn(s);
      //if and else if statements to create the token for the
      //keywords or the special chars which are then inserted.
      if (spellS (htable[hashval].getSymbol()) == "NONAME")//if the location is empty
      {
	 Token NUM(Symbol::NUM, hashval, s);
	 htable.insert (htable.begin()+hashval, NUM);
	 occupied++;
	 return hashval;
      }
      else//increment the hashval and insert the token into a free loc
      {
	 while ( spellS(htable[hashval].getSymbol()) != "NONAME")
	    //keep looking for a free location
	 {
	    hashval += 1;
	 }
	 Token NUM(Symbol::NUM, hashval, s);
	 htable.insert (htable.begin()+hashval, NUM);
	 occupied++;
	 return hashval;
      }
   }
   else if (val != -1)
   {
      return val;
   }
   else
      return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x210, %rsp            # imm = 0x210
movq %rsi, -0x1b0(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1a8(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
callq 0x20d0
movq -0x1a8(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
callq 0x106f0
movl %eax, -0x194(%rbp)
jmp 0x10a40
leaq -0x40(%rbp), %rdi
callq 0x2130
movl -0x194(%rbp), %eax
movl %eax, -0x20(%rbp)
cmpl $-0x1, -0x20(%rbp)
jne 0x10e06
movq -0x1a8(%rbp), %rdi
callq 0x10e80
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
je 0x10e06
movq -0x1b0(%rbp), %rsi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x20d0
movq -0x1c8(%rbp), %rsi
movq -0x1a8(%rbp), %rdi
callq 0x108a0
movq -0x1c8(%rbp), %rdi
movl %eax, -0x1c(%rbp)
callq 0x2130
movq -0x1a8(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x10ed0
movq %rax, %rdi
callq 0x6d70
movl %eax, %esi
leaq -0x90(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x5c50
movq -0x1c0(%rbp), %rdi
leaq 0xe81b(%rip), %rsi      # 0x1f305
callq 0x10ea0
movb %al, -0x1b1(%rbp)
jmp 0x10af7
leaq -0x90(%rbp), %rdi
callq 0x2130
movb -0x1b1(%rbp), %al
testb $0x1, %al
jne 0x10b12
jmp 0x10c67
movq -0x1b0(%rbp), %rsi
movl -0x1c(%rbp), %eax
movl %eax, -0x1d4(%rbp)
leaq -0xe0(%rbp), %rdi
movq %rdi, -0x1d0(%rbp)
callq 0x20d0
movl -0x1d4(%rbp), %edx
movq -0x1d0(%rbp), %rcx
leaq -0xc0(%rbp), %rdi
movl $0x101, %esi            # imm = 0x101
callq 0x10ef0
jmp 0x10b55
leaq -0xe0(%rbp), %rdi
callq 0x2130
movq -0x1a8(%rbp), %rdi
callq 0x11190
movq %rax, -0xf8(%rbp)
movslq -0x1c(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x111c0
movq %rax, -0xf0(%rbp)
leaq -0xe8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x11200
movq -0x1a8(%rbp), %rdi
movq -0xe8(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x10f80
movq %rax, -0x1e0(%rbp)
jmp 0x10bc1
movq -0x1a8(%rbp), %rax
movq -0x1e0(%rbp), %rcx
movq %rcx, -0x100(%rbp)
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x5b20
jmp 0x10e1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x2130
jmp 0x10e27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x2130
jmp 0x10e27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x2130
jmp 0x10e27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x5b20
jmp 0x10e27
jmp 0x10c69
movq -0x1a8(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x10ed0
movq %rax, %rdi
callq 0x6d70
movl %eax, %esi
leaq -0x120(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x5c50
movq -0x1f0(%rbp), %rdi
leaq 0xe661(%rip), %rsi      # 0x1f305
callq 0x11240
movb %al, -0x1e1(%rbp)
jmp 0x10cb1
leaq -0x120(%rbp), %rdi
callq 0x2130
movb -0x1e1(%rbp), %al
testb $0x1, %al
jne 0x10cc9
jmp 0x10cf1
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x10c69
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x2130
jmp 0x10e27
movq -0x1b0(%rbp), %rsi
movl -0x1c(%rbp), %eax
movl %eax, -0x1fc(%rbp)
leaq -0x170(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x20d0
movl -0x1fc(%rbp), %edx
movq -0x1f8(%rbp), %rcx
leaq -0x150(%rbp), %rdi
movl $0x101, %esi            # imm = 0x101
callq 0x10ef0
jmp 0x10d34
leaq -0x170(%rbp), %rdi
callq 0x2130
movq -0x1a8(%rbp), %rdi
callq 0x11190
movq %rax, -0x188(%rbp)
movslq -0x1c(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x111c0
movq %rax, -0x180(%rbp)
leaq -0x178(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x11200
movq -0x1a8(%rbp), %rdi
movq -0x178(%rbp), %rsi
leaq -0x150(%rbp), %rdx
callq 0x10f80
movq %rax, -0x208(%rbp)
jmp 0x10da0
movq -0x1a8(%rbp), %rax
movq -0x208(%rbp), %rcx
movq %rcx, -0x190(%rbp)
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x5b20
jmp 0x10e1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x2130
jmp 0x10e27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x5b20
jmp 0x10e27
cmpl $-0x1, -0x20(%rbp)
je 0x10e14
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x10e1b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x210, %rsp            # imm = 0x210
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x2340