// File: /workspace/github_cpp_makefile_star2_O1/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 0x24a05
leaq 0x20(%rsp), %r12
xorl %r15d, %r15d
leaq 0x10(%rsp), %r14
movq (%rax,%r15,8), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x20628
movq %r14, %rdi
leaq 0x18d24(%rip), %rsi     # 0x3d6a0
callq 0x40e0
movl %eax, %ebp
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x2499a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42e0
testl %ebp, %ebp
je 0x249e3
movq %r14, %rdi
movq %r13, %rsi
callq 0x20628
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
je 0x24b81
movq 0x10(%rsp), %rsi
leaq 0x58(%rsp), %rdi
callq 0x27284
movl $0x1, (%rax)
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x249e3
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
shrq $0x3, %rcx
movl %ecx, %ecx
cmpq %rcx, %r15
jb 0x24963
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
movq 0x10(%rcx), %rcx
subq %rax, %rcx
movabsq $0x7fffffff8, %rdx      # imm = 0x7FFFFFFF8
testq %rdx, %rcx
je 0x24b49
xorl %esi, %esi
leaq 0x4(%rsp), %r14
leaq 0x18c6a(%rip), %r15     # 0x3d6a0
leaq 0x30(%rsp), %r12
sarq $0x3, %rcx
cmpq %rsi, %rcx
movq %rsi, 0x50(%rsp)
jbe 0x24a4f
movq (%rax,%rsi,8), %r13
jmp 0x24a52
xorl %r13d, %r13d
xorl %ebp, %ebp
movl %ebp, 0x4(%rsp)
movq %r13, %rdi
callq 0x20656
cmpl %eax, %ebp
jae 0x24b0a
movq %r13, %rdi
movq %r14, %rsi
callq 0x205ec
movq %rax, %rbp
movq %rax, %rdi
callq 0x14a9e
movq %rax, %rdi
movq %r15, %rsi
callq 0x40e0
testl %eax, %eax
jne 0x24aff
movq 0x68(%rsp), %rax
movb 0x3(%rsp), %cl
movq %rbx, %rdx
testq %rax, %rax
je 0x24abb
movq %rax, %rsi
movq %rbx, %rdx
xorl %edi, %edi
cmpb %cl, 0x20(%rsi)
setl %dil
cmovgeq %rsi, %rdx
movq 0x10(%rsi,%rdi,8), %rsi
testq %rsi, %rsi
jne 0x24aa4
movq %rbx, %rsi
cmpq %rbx, %rdx
je 0x24acd
cmpb 0x20(%rdx), %cl
cmovlq %rbx, %rdx
movq %rdx, %rsi
cmpq %rbx, %rsi
je 0x24ada
incb %cl
movb %cl, 0x3(%rsp)
jmp 0x24a96
movsbl 0x3(%rsp), %r8d
movq 0x38(%rsp), %rdx
movl $0x1, %ecx
movq %r12, %rdi
xorl %esi, %esi
callq 0x4590
movq %rbp, %rdi
movq %r12, %rsi
callq 0x14f90
movl 0x4(%rsp), %ebp
incl %ebp
jmp 0x24a54
leaq 0x58(%rsp), %rdi
leaq 0x3(%rsp), %rsi
callq 0x27284
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 0x24a3b
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x24b65
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42e0
leaq 0x58(%rsp), %rdi
callq 0x27698
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18a47(%rip), %rdi     # 0x3d5cf
xorl %esi, %esi
xorl %eax, %eax
callq 0x4440
jmp 0x24b95
jmp 0x24bb5
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x24bb8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42e0
jmp 0x24bb8
jmp 0x24bb5
jmp 0x24bb5
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x24bd4
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42e0
leaq 0x58(%rsp), %rdi
callq 0x27698
movq %rbx, %rdi
callq 0x4550