// File: /workspace/github_cpp_makefile_star2_O2/atfrank[P]PCASA/lib/Analyze.cpp
// Function: Analyze::pairwiseDistance(Molecule*, std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&)
void Analyze::pairwiseDistance(Molecule *mol, std::vector<std::vector<double> >& pdin){
  std::vector<Atom*>::iterator ai;
  std::vector<Atom*>::iterator aj;
  unsigned int natom;
  unsigned int aiInx;
  bool flag;

  natom=mol->getAtmVecSize();

  pdin.clear();
  pdin.resize(natom);

  for (ai=mol->getAtmVec().begin(); ai != mol->getAtmVec().end(); ++ai){
    aiInx=(*ai)->getAtmInx();
    pdin.at(aiInx).resize(natom);
    pdin.at(aiInx).at(aiInx)=0.0; //Zero diagonal
  }

  for (ai=mol->getAtmVec().begin(); ai != mol->getAtmVec().end(); ++ai){
    aiInx=(*ai)->getAtmInx();
    if ((*ai)->getX() < 9999.9){
      flag=true;
    }
    else{
      flag=false;
    }
    //Lower Triangle
    for (aj=mol->getAtmVec().begin(); aj != ai; ++aj){
      if (flag && (*aj)->getX() < 9999.9){
        pdin.at(aiInx).at((*aj)->getAtmInx())=Analyze::distance((*ai)->getCoor(), (*aj)->getCoor());
      }
      else{
        pdin.at(aiInx).at((*aj)->getAtmInx())=9999.9;
      }
    }
  
    //Upper Triangle
    for (aj=ai+1; aj != mol->getAtmVec().end(); ++aj){
      if (flag && (*aj)->getX() < 9999.9){
        pdin.at(aiInx).at((*aj)->getAtmInx())=Analyze::distance((*ai)->getCoor(), (*aj)->getCoor());
      }
      else{
        pdin.at(aiInx).at((*aj)->getAtmInx())=9999.9;
      }
    }
  }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x1ac18
movl %eax, %ebp
movq %rbx, %rdi
callq 0xc782
movl %ebp, %r15d
movq %rbx, %rdi
movq %r15, %rsi
callq 0xca00
movq %r14, %rdi
callq 0x1aca8
movq (%rax), %r13
movq %r14, %rdi
callq 0x1aca8
cmpq 0x8(%rax), %r13
je 0x99d4
movq (%r13), %rdi
callq 0xea8c
movl (%rax), %r12d
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc8f8
movq %rax, %rdi
movq %r15, %rsi
callq 0xca36
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc8f8
movq %rax, %rdi
movq %r12, %rsi
callq 0xc916
andq $0x0, (%rax)
addq $0x8, %r13
jmp 0x9984
movq %r14, %rdi
callq 0x1aca8
movq (%rax), %r13
movq %r14, %rdi
callq 0x1aca8
cmpq 0x8(%rax), %r13
je 0x9b3f
movq (%r13), %rdi
callq 0xea8c
movl (%rax), %r15d
movq (%r13), %rdi
callq 0xec26
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r14, %rdi
callq 0x1aca8
movq (%rax), %rbp
cmpq %r13, %rbp
je 0x9a9f
movsd 0x23a38(%rip), %xmm0    # 0x2d460
ucomisd 0x8(%rsp), %xmm0
jbe 0x9a67
movq (%rbp), %rdi
callq 0xec26
movsd 0x23a1f(%rip), %xmm0    # 0x2d460
ucomisd (%rax), %xmm0
jbe 0x9a67
movq (%r13), %rdi
callq 0xea3c
movq %rax, %r12
movq (%rbp), %rdi
callq 0xea3c
movq %r12, %rdi
movq %rax, %rsi
callq 0x91f8
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc8f8
movq %rax, %r12
movq (%rbp), %rdi
callq 0xea8c
movl (%rax), %esi
movq %r12, %rdi
callq 0xc916
movsd (%rsp), %xmm0
movsd %xmm0, (%rax)
addq $0x8, %rbp
jmp 0x9a1b
leaq 0x8(%r13), %rbp
movq %rbp, 0x10(%rsp)
movq %r14, %rdi
callq 0x1aca8
cmpq 0x8(%rax), %rbp
je 0x9b35
movsd 0x239a2(%rip), %xmm0    # 0x2d460
ucomisd 0x8(%rsp), %xmm0
jbe 0x9afd
movq (%rbp), %rdi
callq 0xec26
movsd 0x23989(%rip), %xmm0    # 0x2d460
ucomisd (%rax), %xmm0
jbe 0x9afd
movq (%r13), %rdi
callq 0xea3c
movq %rax, %r12
movq (%rbp), %rdi
callq 0xea3c
movq %r12, %rdi
movq %rax, %rsi
callq 0x91f8
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc8f8
movq %rax, %r12
movq (%rbp), %rdi
callq 0xea8c
movl (%rax), %esi
movq %r12, %rdi
callq 0xc916
movsd (%rsp), %xmm0
movsd %xmm0, (%rax)
addq $0x8, %rbp
jmp 0x9aa8
movq 0x10(%rsp), %r13
jmp 0x99df
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq