// File: /workspace/github_cpp_makefile_star2_O3/atfrank[P]PCASA/lib/Molecule.cpp
// Function: Molecule::addMissingChainIds()
void Molecule::addMissingChainIds(){
  Chain *chn;
  Atom *atm;
  char currId;
  std::map<char, int> mapIds;
  unsigned int i, j;
  std::string id;

  currId='A';

  //Create map of chainIds
  for (i=0; i< this->getChnVecSize(); i++){
    chn=this->getChain(i);
    if (chn->getChainId().compare(" ") != 0){
      mapIds[chn->getChainId().at(0)]=1;
    }
  }

  for (i=0; i< this->getChnVecSize(); i++){
    chn=this->getChain(i);
    for (j=0; j< chn->getAtmVecSize(); j++){
      atm=chn->getAtom(j);
      if (atm->getChainId().compare(" ") == 0){
        while (mapIds.find(currId) != mapIds.end()){
          currId++;
        }
        id=currId;
        atm->setChainId(id);
      }
    }
    mapIds[currId]=1;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movabsq $0x7fffffff8, %rdx      # imm = 0x7FFFFFFF8
leaq 0x60(%rsp), %rbx
movl $0x0, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq %rbx, 0x10(%rbx)
movq %rbx, 0x18(%rbx)
movq %rax, 0x20(%rbx)
leaq 0x40(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movb $0x41, 0x3(%rsp)
movq 0x8(%rdi), %rax
movq %rdi, 0x8(%rsp)
movq 0x10(%rdi), %rcx
subq %rax, %rcx
testq %rdx, %rcx
je 0x2493f
leaq 0x20(%rsp), %r12
xorl %r15d, %r15d
leaq 0x10(%rsp), %r14
movq (%rax,%r15,8), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x204a4
movq %r14, %rdi
leaq 0x17f02(%rip), %rsi     # 0x3c680
callq 0x40e0
movl %eax, %ebp
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x2479c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42e0
testl %ebp, %ebp
je 0x247e3
movq %r14, %rdi
movq %r13, %rsi
callq 0x204a4
cmpq $0x0, 0x18(%rsp)
je 0x24977
movq 0x10(%rsp), %rsi
leaq 0x58(%rsp), %rdi
callq 0x27008
movl $0x1, (%rax)
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x247e3
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42e0
incq %r15
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
movq 0x10(%rcx), %rcx
subq %rax, %rcx
movq %rcx, %rdx
shrq $0x3, %rdx
movl %edx, %edx
cmpq %rdx, %r15
jb 0x24765
movabsq $0x7fffffff8, %rdx      # imm = 0x7FFFFFFF8
testq %rdx, %rcx
je 0x2493f
xorl %esi, %esi
leaq 0x4(%rsp), %r14
leaq 0x17e57(%rip), %r15     # 0x3c680
leaq 0x30(%rsp), %r12
sarq $0x3, %rcx
cmpq %rsi, %rcx
movq %rsi, 0x50(%rsp)
jbe 0x24842
movq (%rax,%rsi,8), %r13
jmp 0x24845
xorl %r13d, %r13d
xorl %ebp, %ebp
movl %ebp, 0x4(%rsp)
movq %r13, %rdi
callq 0x204d2
cmpl %eax, %ebp
jae 0x24900
movq %r13, %rdi
movq %r14, %rsi
callq 0x20468
movq %rax, %rbp
movq %rax, %rdi
callq 0x14926
movq %rax, %rdi
movq %r15, %rsi
callq 0x40e0
testl %eax, %eax
jne 0x248f5
movq 0x68(%rsp), %rcx
movb 0x3(%rsp), %al
testq %rcx, %rcx
je 0x248d2
movq %rcx, %r9
movq %rbx, %r8
movq %r8, %rdx
movq %r9, %rsi
movb 0x20(%r9), %dil
xorl %r9d, %r9d
cmpb %al, %dil
setl %r9b
movq %rsi, %r8
cmovlq %rdx, %r8
movq 0x10(%rsi,%r9,8), %r9
testq %r9, %r9
jne 0x24894
cmpq %rbx, %r8
je 0x248d2
cmpb %al, %dil
cmovlq %rdx, %rsi
cmpb 0x20(%rsi), %al
jl 0x248d2
incb %al
movb %al, 0x3(%rsp)
jmp 0x2488e
movq 0x38(%rsp), %rdx
movsbl %al, %r8d
movl $0x1, %ecx
movq %r12, %rdi
xorl %esi, %esi
callq 0x4590
movq %rbp, %rdi
movq %r12, %rsi
callq 0x14e1e
movl 0x4(%rsp), %ebp
incl %ebp
jmp 0x24847
leaq 0x58(%rsp), %rdi
leaq 0x3(%rsp), %rsi
callq 0x27008
movl $0x1, (%rax)
movq 0x50(%rsp), %rsi
incq %rsi
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
movq 0x10(%rcx), %rcx
subq %rax, %rcx
movq %rcx, %rdx
shrq $0x3, %rdx
movl %edx, %edx
cmpq %rdx, %rsi
jb 0x2482e
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x2495b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42e0
leaq 0x58(%rsp), %rdi
callq 0x27438
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17c31(%rip), %rdi     # 0x3c5af
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4440
jmp 0x249ad
jmp 0x2498f
jmp 0x249ad
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x249b0
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42e0
jmp 0x249b0
jmp 0x249ad
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x249cc
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42e0
leaq 0x58(%rsp), %rdi
callq 0x27438
movq %rbx, %rdi
callq 0x4550