// File: smallsimple[P]CoreInterpreter-CSE5341/Id.cpp
// Function: Id::ReadId(std::basic_ifstream<char, std::char_traits<char>>*)
void Id::ReadId(ifstream* inputfile){
  if(inputfile != NULL){
    if(inputfile->is_open() && !inputfile->eof()){
      int integer;
      string num;
      *inputfile >> num;
      if (!isdigit(num.at(0))) {
	if (strcmp("-", num.substr(0,1).c_str()) != 0){
	  cout << "Error: input is not a number" << endl;
	  cout << "program stopped." << endl;
	  exit(0);
	}
      }
      for (int i=1; i< num.size(); i++){
	if (!isdigit (num.at(i))){
	  cout << "Error: input is not a number" << endl;
	  cout << "program stopped!" << endl;
	  exit(0);
	}
      }
      integer = atoi(num.c_str());
      this->SetIdVal(integer);
    }
    else {
      cout << "input file is not open or has reached the end of the file." << endl;
      cout << "program stopped." << endl;
      exit(0);
    }
  }
  else{
    cout << "Error: no input file is assigned." << endl;
    cout << "program stopped." << endl;
    exit(0);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x7e46
movq -0x10(%rbp), %rdi
callq 0x2330
testb $0x1, %al
jne 0x7bc8
jmp 0x7df9
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
addq -0x18(%rax), %rdi
callq 0x23b0
testb $0x1, %al
jne 0x7df9
leaq -0x38(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x22d0
movq -0x80(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x22b0
jmp 0x7bfc
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x23c0
movq %rax, -0x88(%rbp)
jmp 0x7c12
movq -0x88(%rbp), %rax
movsbl (%rax), %edi
callq 0x21c0
cmpl $0x0, %eax
jne 0x7cfd
xorl %eax, %eax
movl %eax, %edx
leaq -0x68(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0x1, %ecx
callq 0x2200
jmp 0x7c42
leaq -0x68(%rbp), %rdi
callq 0x20c0
movq %rax, %rsi
leaq 0x4482(%rip), %rdi      # 0xc0d7
callq 0x22e0
movl %eax, -0x8c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x2110
movl -0x8c(%rbp), %eax
cmpl $0x0, %eax
je 0x7cfb
movq 0x9359(%rip), %rdi      # 0x10fd8
leaq 0x4810(%rip), %rsi      # 0xc496
callq 0x21d0
movq %rax, -0x98(%rbp)
jmp 0x7c94
movq -0x98(%rbp), %rdi
movq 0x9326(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0x7ca9
movq 0x9328(%rip), %rdi      # 0x10fd8
leaq 0x448f(%rip), %rsi      # 0xc146
callq 0x21d0
movq %rax, -0xa0(%rbp)
jmp 0x7cc5
movq -0xa0(%rbp), %rdi
movq 0x92f5(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0x7cda
xorl %edi, %edi
callq 0x2280
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2110
jmp 0x7e9a
jmp 0x7cfd
movl $0x1, -0x6c(%rbp)
movslq -0x6c(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2140
movq %rax, %rcx
movq -0xa8(%rbp), %rax
cmpq %rcx, %rax
jae 0x7dce
movslq -0x6c(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x23c0
movq %rax, -0xb0(%rbp)
jmp 0x7d41
movq -0xb0(%rbp), %rax
movsbl (%rax), %edi
callq 0x21c0
cmpl $0x0, %eax
jne 0x7dbe
movq 0x927c(%rip), %rdi      # 0x10fd8
leaq 0x4733(%rip), %rsi      # 0xc496
callq 0x21d0
movq %rax, -0xb8(%rbp)
jmp 0x7d71
movq -0xb8(%rbp), %rdi
movq 0x9249(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0x7d86
movq 0x924b(%rip), %rdi      # 0x10fd8
leaq 0x442e(%rip), %rsi      # 0xc1c2
callq 0x21d0
movq %rax, -0xc0(%rbp)
jmp 0x7da2
movq -0xc0(%rbp), %rdi
movq 0x9218(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0x7db7
xorl %edi, %edi
callq 0x2280
jmp 0x7dc0
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x7d04
leaq -0x38(%rbp), %rdi
callq 0x20c0
movq %rax, %rdi
callq 0x2320
movq -0x78(%rbp), %rdi
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %esi
callq 0x7b60
leaq -0x38(%rbp), %rdi
callq 0x2110
jmp 0x7e44
movq 0x91d8(%rip), %rdi      # 0x10fd8
leaq 0x46ac(%rip), %rsi      # 0xc4b3
callq 0x21d0
movq %rax, %rdi
movq 0x91b2(%rip), %rsi      # 0x10fc8
callq 0x2210
movq 0x91b6(%rip), %rdi      # 0x10fd8
leaq 0x431d(%rip), %rsi      # 0xc146
callq 0x21d0
movq %rax, %rdi
movq 0x9190(%rip), %rsi      # 0x10fc8
callq 0x2210
xorl %edi, %edi
callq 0x2280
jmp 0x7e91
movq 0x918b(%rip), %rdi      # 0x10fd8
leaq 0x469a(%rip), %rsi      # 0xc4ee
callq 0x21d0
movq %rax, %rdi
movq 0x9165(%rip), %rsi      # 0x10fc8
callq 0x2210
movq 0x9169(%rip), %rdi      # 0x10fd8
leaq 0x42d0(%rip), %rsi      # 0xc146
callq 0x21d0
movq %rax, %rdi
movq 0x9143(%rip), %rsi      # 0x10fc8
callq 0x2210
xorl %edi, %edi
callq 0x2280
addq $0xc0, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x2370
nopw %cs:(%rax,%rax)