// File: 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:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x17470
leaq 0x88(%rsp), %rdi
callq 0x17470
movq 0xa0(%rsp), %rdi
callq 0x436b0
movl %eax, 0x84(%rsp)
movq 0x98(%rsp), %rdi
callq 0x169a0
movq 0x98(%rsp), %rdi
movl 0x84(%rsp), %eax
movl %eax, %esi
callq 0x17490
movq 0xa0(%rsp), %rdi
callq 0x437c0
movq %rax, %rdi
callq 0x17530
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x437c0
movq %rax, %rdi
callq 0x175a0
movq %rax, 0x68(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x17560
testb $0x1, %al
jne 0x10414
jmp 0x10499
leaq 0x90(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1f820
movl (%rax), %eax
movl %eax, 0x80(%rsp)
movq 0x98(%rsp), %rdi
movl 0x80(%rsp), %eax
movl %eax, %esi
callq 0x16f50
movq %rax, %rdi
movl 0x84(%rsp), %eax
movl %eax, %esi
callq 0x175e0
movq 0x98(%rsp), %rdi
movl 0x80(%rsp), %eax
movl %eax, %esi
callq 0x16f50
movq %rax, %rdi
movl 0x80(%rsp), %eax
movl %eax, %esi
callq 0x16f90
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
leaq 0x90(%rsp), %rdi
callq 0x17680
jmp 0x103df
movq 0xa0(%rsp), %rdi
callq 0x437c0
movq %rax, %rdi
callq 0x17530
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x437c0
movq %rax, %rdi
callq 0x175a0
movq %rax, 0x58(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x17560
testb $0x1, %al
jne 0x104f5
jmp 0x1082a
leaq 0x90(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1f820
movl (%rax), %eax
movl %eax, 0x80(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1fa60
movsd 0x6ae68(%rip), %xmm0    # 0x7b398
ucomisd (%rax), %xmm0
jbe 0x1053d
movb $0x1, 0x7f(%rsp)
jmp 0x10542
movb $0x0, 0x7f(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x437c0
movq %rax, %rdi
callq 0x17530
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x17560
testb $0x1, %al
jne 0x10587
jmp 0x106a3
testb $0x1, 0x7f(%rsp)
je 0x10645
leaq 0x88(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1fa60
movsd 0x6ade9(%rip), %xmm0    # 0x7b398
ucomisd (%rax), %xmm0
jbe 0x10645
leaq 0x90(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1f6e0
movq %rax, 0x28(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1f6e0
movq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0xf810
movsd %xmm0, 0x38(%rsp)
movq 0x98(%rsp), %rdi
movl 0x80(%rsp), %eax
movl %eax, %esi
callq 0x16f50
movq %rax, 0x30(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1f820
movq 0x30(%rsp), %rdi
movl (%rax), %eax
movl %eax, %esi
callq 0x16f90
movsd 0x38(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x1068f
movq 0x98(%rsp), %rdi
movl 0x80(%rsp), %eax
movl %eax, %esi
callq 0x16f50
movq %rax, 0x20(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1f820
movq 0x20(%rsp), %rdi
movl (%rax), %eax
movl %eax, %esi
callq 0x16f90
movsd 0x6ad0d(%rip), %xmm0    # 0x7b398
movsd %xmm0, (%rax)
jmp 0x10691
leaq 0x88(%rsp), %rdi
callq 0x17680
jmp 0x10569
leaq 0x90(%rsp), %rdi
movl $0x1, %esi
callq 0x176a0
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x437c0
movq %rax, %rdi
callq 0x175a0
movq %rax, 0x40(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x17560
testb $0x1, %al
jne 0x106fc
jmp 0x10816
testb $0x1, 0x7f(%rsp)
je 0x107ba
leaq 0x88(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1fa60
movsd 0x6ac74(%rip), %xmm0    # 0x7b398
ucomisd (%rax), %xmm0
jbe 0x107ba
leaq 0x90(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1f6e0
movq %rax, 0x8(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1f6e0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0xf810
movsd %xmm0, 0x18(%rsp)
movq 0x98(%rsp), %rdi
movl 0x80(%rsp), %eax
movl %eax, %esi
callq 0x16f50
movq %rax, 0x10(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1f820
movq 0x10(%rsp), %rdi
movl (%rax), %eax
movl %eax, %esi
callq 0x16f90
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x10802
movq 0x98(%rsp), %rdi
movl 0x80(%rsp), %eax
movl %eax, %esi
callq 0x16f50
movq %rax, (%rsp)
leaq 0x88(%rsp), %rdi
callq 0x175d0
movq (%rax), %rdi
callq 0x1f820
movq (%rsp), %rdi
movl (%rax), %eax
movl %eax, %esi
callq 0x16f90
movsd 0x6ab9a(%rip), %xmm0    # 0x7b398
movsd %xmm0, (%rax)
jmp 0x10804
leaq 0x88(%rsp), %rdi
callq 0x17680
jmp 0x106c7
jmp 0x10818
leaq 0x90(%rsp), %rdi
callq 0x17680
jmp 0x104c0
addq $0xa8, %rsp
retq
nopw %cs:(%rax,%rax)