// File: /workspace/github_cpp_makefile_star2_O1/Altius[P]hotspot2/src/hotspot2_part2.cpp
// Function: buildIntToChromNameMap(std::basic_ifstream<char, std::char_traits<char>>&, std::map<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, std::less<int>, std::allocator<std::pair<int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*>>>&)
bool buildIntToChromNameMap(ifstream& infile, map<int, string*>& mapOut)
{
  const int BUFSIZE(100);
  char buf[BUFSIZE], *p;
  int ID;
  map<int, string*>::const_iterator it;
  int linenum(0), fieldnum;

  while (infile.getline(buf, BUFSIZE))
    {
      linenum++;
      fieldnum = 1;
      if (!(p = strtok(buf, "\t")) || !*p)
	{
	MissingField:
	  cerr << "Error:  Failed to find field " << fieldnum
	       << " on line " << linenum
	       << " of the number-to-chromosomeName mapping file."
	       << endl << endl;
	  return false;
	}
      ID = atoi(p);
      it = mapOut.find(ID);
      if (it != mapOut.end())
	{
	  cerr << "Error:  Multiple entries found in the number-to-chromosomeName mapping file\n"
	       << "with value " << ID << " in the first column; each mapping must be unique."
	       << endl << endl;
	  return false;
	}
      fieldnum++;
      if (!(p = strtok(NULL, "\t")) || !*p)
	goto MissingField;
      mapOut[ID] = new string(p);
    }
  
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r13
movq %rdi, %r12
movq (%rdi), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %ecx
leaq 0x10(%rsp), %rsi
movl $0x64, %edx
movq %r12, %rdi
callq 0x2300
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
setne %bl
jne 0x2c8c
leaq 0x8(%r13), %rax
movq %rax, 0x8(%rsp)
xorl %r14d, %r14d
leaq 0x10(%rsp), %r15
incl %r14d
movq %r15, %rdi
leaq 0x38d1(%rip), %rsi      # 0x6383
callq 0x2250
movl $0x1, %ebp
testq %rax, %rax
je 0x2bdd
cmpb $0x0, (%rax)
je 0x2bdd
movq %r12, %r15
movq %r13, %r12
movq %rax, %rdi
callq 0x2240
movl %eax, 0x4(%rsp)
movq 0x10(%r12), %rdx
movq 0x8(%rsp), %rdi
movq %rdi, %rcx
testq %rdx, %rdx
je 0x2b0c
movq %rdi, %rcx
xorl %esi, %esi
cmpl %eax, 0x20(%rdx)
setl %sil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x2af5
movq %rdi, %rdx
cmpq %rdi, %rcx
je 0x2b1e
cmpl 0x20(%rcx), %eax
cmovlq %rdi, %rcx
movq %rcx, %rdx
cmpq %rdi, %rdx
jne 0x2ca0
xorl %edi, %edi
leaq 0x3853(%rip), %rsi      # 0x6383
callq 0x2250
movl $0x2, %ebp
testq %rax, %rax
je 0x2bdd
movq %rax, %r13
cmpb $0x0, (%rax)
je 0x2bdd
movl $0x20, %edi
callq 0x21a0
movq %rax, %rbx
addq $0x10, %rax
movq %rax, (%rbx)
movq %r13, %rdi
callq 0x20c0
movq %r13, %rdx
addq %rax, %rdx
movb $0x1, %bpl
movq %rbx, %rdi
movq %r13, %rsi
callq 0x47ba
movq %r12, %r13
xorl %ebp, %ebp
movq %r12, %rdi
leaq 0x4(%rsp), %rsi
callq 0x401c
movq %rbx, (%rax)
movq %r15, %r12
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %ecx
movl $0x64, %edx
movq %r15, %rdi
leaq 0x10(%rsp), %r15
movq %r15, %rsi
callq 0x2300
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
setne %bl
je 0x2aa5
jmp 0x2c8c
movq 0x640c(%rip), %r15      # 0x8ff0
leaq 0x347d(%rip), %rsi      # 0x6068
movl $0x1d, %edx
movq %r15, %rdi
callq 0x21e0
movq %r15, %rdi
movl %ebp, %esi
callq 0x22b0
movq %rax, %r15
leaq 0x347a(%rip), %rsi      # 0x6086
movl $0x9, %edx
movq %rax, %rdi
callq 0x21e0
movq %r15, %rdi
movl %r14d, %esi
callq 0x22b0
movq %rax, %r14
leaq 0x34a8(%rip), %rsi      # 0x60d6
movl $0x2e, %edx
movq %rax, %rdi
callq 0x21e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
andb $0x1, %bl
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6349(%rip), %r14      # 0x8ff0
leaq 0x3457(%rip), %rsi      # 0x6105
movl $0x4c, %edx
movq %r14, %rdi
callq 0x21e0
leaq 0x3490(%rip), %rsi      # 0x6152
movl $0xb, %edx
movq %r14, %rdi
callq 0x21e0
movl 0x4(%rsp), %esi
movq %r14, %rdi
callq 0x22b0
movq %rax, %r14
leaq 0x3479(%rip), %rsi      # 0x615e
movl $0x32, %edx
jmp 0x2c33
movq %rax, %r14
testb %bpl, %bpl
je 0x2d04
movl $0x20, %esi
movq %rbx, %rdi
callq 0x21b0
movq %r14, %rdi
callq 0x22c0