// File: smallsimple[P]CoreInterpreter-CSE5341/Id.cpp
// Function: Id::ParseId()
Id* Id::ParseId(){
  Tokenizer *tokensId;
  tokensId = Tokenizer::getInstance();
  string tokenTemp = tokensId->getToken();
  int tokenType = tokensId->getTokenType();
  if (tokenType != tokensId->idNum) {
    cout << "Error: " << tokenTemp << " is not a legal identifier!" << endl;
    cout << "program stopped." << endl;
    exit(0);
  }

  for (int k = 0; k < idCount; k++){
    if (tokenTemp.compare(eIds[k]->name) == 0){
      tokensId->skipToken();
      return eIds[k];
    }
  }
  // if not found
  Id *nId = new Id(tokenTemp);
  eIds[idCount] = nId;
  idCount++;
  tokensId->skipToken();
  return nId;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
callq 0x48d0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x4940
movq -0x10(%rbp), %rdi
callq 0x4ba0
movl %eax, -0x80(%rbp)
jmp 0x784f
movl -0x80(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
leaq 0x4aad(%rip), %rcx      # 0xc30c
cmpl (%rcx), %eax
je 0x7916
movq 0x976a(%rip), %rdi      # 0x10fd8
leaq 0x4bcd(%rip), %rsi      # 0xc442
callq 0x21d0
movq %rax, -0x88(%rbp)
jmp 0x7883
movq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x21b0
movq %rax, -0x90(%rbp)
jmp 0x789c
movq -0x90(%rbp), %rdi
leaq 0x4ba0(%rip), %rsi      # 0xc44a
callq 0x21d0
movq %rax, -0x98(%rbp)
jmp 0x78b8
movq -0x98(%rbp), %rdi
movq 0x9702(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0x78cd
movq 0x9704(%rip), %rdi      # 0x10fd8
leaq 0x486b(%rip), %rsi      # 0xc146
callq 0x21d0
movq %rax, -0xa0(%rbp)
jmp 0x78e9
movq -0xa0(%rbp), %rdi
movq 0x96d1(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0x78fe
xorl %edi, %edi
callq 0x2280
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x7a6e
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl 0x9d9a(%rip), %eax      # 0x116c0
jge 0x798a
movslq -0x48(%rbp), %rcx
leaq 0x9ced(%rip), %rax      # 0x11620
movq (%rax,%rcx,8), %rsi
leaq -0x30(%rbp), %rdi
callq 0x2030
movl %eax, -0xa4(%rbp)
jmp 0x7948
movl -0xa4(%rbp), %eax
cmpl $0x0, %eax
jne 0x797d
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0x795e
movslq -0x48(%rbp), %rcx
leaq 0x9cb7(%rip), %rax      # 0x11620
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x4c(%rbp)
jmp 0x7a58
jmp 0x797f
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x791d
movl $0x28, %edi
callq 0x21e0
movq %rax, -0xb0(%rbp)
jmp 0x799d
movb $0x1, -0x79(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x20d0
jmp 0x79b0
movq -0xb0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x77b0
jmp 0x79c2
movb $0x0, -0x79(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x2110
movq -0xb0(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdx
movslq 0x9cdb(%rip), %rcx      # 0x116c0
leaq 0x9c34(%rip), %rax      # 0x11620
movq %rdx, (%rax,%rcx,8)
movl 0x9cca(%rip), %eax      # 0x116c0
incl %eax
movl %eax, 0x9cc2(%rip)      # 0x116c0
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0x7a09
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x4c(%rbp)
jmp 0x7a58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x7a3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x2110
testb $0x1, -0x79(%rbp)
jne 0x7a45
jmp 0x7a56
movq -0xb0(%rbp), %rdi
movl $0x28, %esi
callq 0x21f0
jmp 0x7a6e
leaq -0x30(%rbp), %rdi
callq 0x2110
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x2110
movq -0x40(%rbp), %rdi
callq 0x2370