// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r12
callq 0x24830
movl %eax, %ebp
movq (%rbx), %rsi
movq %rbx, %rdi
callq 0x129c6
movl %ebp, %r15d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1257a
movq %r12, %rdi
callq 0x248d8
movq (%rax), %r14
movq %r12, 0x8(%rsp)
movq %r12, %rdi
callq 0x248d8
cmpq 0x8(%rax), %r14
je 0xe496
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
movq (%r14), %rdi
callq 0x14b0e
movl (%rax), %r12d
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %r12, %rdx
jbe 0xe7bb
leaq (%r12,%r12,2), %rbp
leaq (%rax,%rbp,8), %rdi
movq %r15, %rsi
callq 0x125b6
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %r12, %rdx
jbe 0xe7bb
movq (%rax,%rbp,8), %rcx
movq 0x8(%rax,%rbp,8), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %r12, %rdx
jbe 0xe7bb
movq $0x0, (%rcx,%r12,8)
addq $0x8, %r14
movq 0x8(%rsp), %rdi
callq 0x248d8
cmpq 0x8(%rax), %r14
jne 0xe40c
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x248d8
movq (%rax), %r13
movq %r14, %rdi
callq 0x248d8
cmpq 0x8(%rax), %r13
je 0xe792
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
movq (%r13), %rdi
callq 0x14b0e
movl (%rax), %r15d
movq (%r13), %rdi
callq 0x14d4e
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %r14, %rdi
callq 0x248d8
movq (%rax), %r14
movq %r13, 0x10(%rsp)
cmpq %r13, %r14
je 0xe611
movsd 0x2df5e(%rip), %xmm0    # 0x3c460
ucomisd 0x28(%rsp), %xmm0
jbe 0xe5b1
movq (%r14), %rdi
callq 0x14d4e
movsd 0x2df42(%rip), %xmm0    # 0x3c460
ucomisd (%rax), %xmm0
jbe 0xe5b1
movq 0x10(%rsp), %rax
movq (%rax), %rdi
callq 0x14abe
movq %rax, %r13
movq (%r14), %rdi
callq 0x14abe
leaq 0x40(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x3a360
movq %rbp, %rdi
callq 0x3a598
movsd %xmm0, 0x18(%rsp)
movq (%rbx), %r13
movq 0x8(%rbx), %rdx
subq %r13, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r15, %rdx
jbe 0xe7a1
leaq (%r15,%r15,2), %rbp
movq (%r14), %rdi
callq 0x14b0e
movl (%rax), %esi
movq (%r13,%rbp,8), %rax
movq 0x8(%r13,%rbp,8), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0xe7ad
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax,%rsi,8)
jmp 0xe602
movq (%rbx), %r13
movq 0x8(%rbx), %rdx
subq %r13, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r15, %rdx
jbe 0xe7a1
leaq (%r15,%r15,2), %rbp
movq (%r14), %rdi
callq 0x14b0e
movl (%rax), %esi
movq (%r13,%rbp,8), %rax
movq 0x8(%r13,%rbp,8), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0xe7ad
movabsq $0x40c387f333333333, %rcx # imm = 0x40C387F333333333
movq %rcx, (%rax,%rsi,8)
addq $0x8, %r14
cmpq 0x10(%rsp), %r14
jne 0xe4fa
movq 0x10(%rsp), %rax
leaq 0x8(%rax), %r14
movq 0x8(%rsp), %rdi
callq 0x248d8
movq %r14, 0x20(%rsp)
cmpq 0x8(%rax), %r14
je 0xe776
leaq (%r15,%r15,2), %rax
movq %rax, 0x38(%rsp)
leaq (%r15,%r15,2), %rbp
movq 0x20(%rsp), %r14
movq %rbp, 0x30(%rsp)
movsd 0x2de0e(%rip), %xmm0    # 0x3c460
ucomisd 0x28(%rsp), %xmm0
jbe 0xe719
movq (%r14), %rdi
callq 0x14d4e
movsd 0x2ddf2(%rip), %xmm0    # 0x3c460
ucomisd (%rax), %xmm0
jbe 0xe719
movq 0x10(%rsp), %rax
movq (%rax), %rdi
callq 0x14abe
movq %rax, %r13
movq (%r14), %rdi
callq 0x14abe
movq %r15, %rbp
movq %rbx, %r15
movq %r12, %rbx
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x3a360
movq %r12, %rdi
movq %rbx, %r12
movq %r15, %rbx
movq %rbp, %r15
callq 0x3a598
movsd %xmm0, 0x18(%rsp)
movq (%rbx), %r13
movq 0x8(%rbx), %rdx
subq %r13, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %rbp, %rdx
jbe 0xe7a1
movq (%r14), %rdi
callq 0x14b0e
movl (%rax), %esi
movq 0x38(%rsp), %rcx
movq (%r13,%rcx,8), %rax
movq 0x8(%r13,%rcx,8), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0xe7ad
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax,%rsi,8)
movq 0x30(%rsp), %rbp
jmp 0xe75e
movq (%rbx), %r13
movq 0x8(%rbx), %rdx
subq %r13, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r15, %rdx
jbe 0xe7a1
movq (%r14), %rdi
callq 0x14b0e
movl (%rax), %esi
movq (%r13,%rbp,8), %rax
movq 0x8(%r13,%rbp,8), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0xe7ad
movabsq $0x40c387f333333333, %rcx # imm = 0x40C387F333333333
movq %rcx, (%rax,%rsi,8)
addq $0x8, %r14
movq 0x8(%rsp), %rdi
callq 0x248d8
cmpq 0x8(%rax), %r14
jne 0xe64a
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x248d8
movq 0x20(%rsp), %r13
cmpq 0x8(%rax), %r13
jne 0xe4c2
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2db81(%rip), %rdi     # 0x3c329
movq %r15, %rsi
jmp 0xe7b4
leaq 0x2db75(%rip), %rdi     # 0x3c329
xorl %eax, %eax
callq 0x4440
leaq 0x2db67(%rip), %rdi     # 0x3c329
movq %r12, %rsi
jmp 0xe7b4
nop