// File: /workspace/github_cpp_makefile_star2_O3/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 $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r12
callq 0x24632
movl %eax, %ebp
movq (%rbx), %rsi
movq %rbx, %rdi
callq 0x12834
movl %ebp, %r15d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x123d4
movq %r12, %rdi
callq 0x246da
movq (%rax), %r14
movq %r12, (%rsp)
movq %r12, %rdi
callq 0x246da
cmpq 0x8(%rax), %r14
je 0xe314
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
movq (%r14), %rdi
callq 0x14996
movl (%rax), %r12d
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %r12, %rdx
jbe 0xe62b
leaq (%r12,%r12,2), %rbp
leaq (%rax,%rbp,8), %rdi
movq %r15, %rsi
callq 0x12410
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %r12, %rdx
jbe 0xe62b
movq (%rax,%rbp,8), %rcx
movq 0x8(%rax,%rbp,8), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %r12, %rdx
jbe 0xe62b
movq $0x0, (%rcx,%r12,8)
addq $0x8, %r14
movq (%rsp), %rdi
callq 0x246da
cmpq 0x8(%rax), %r14
jne 0xe28b
movq (%rsp), %r14
movq %r14, %rdi
callq 0x246da
movq (%rax), %r13
movq %r14, %rdi
callq 0x246da
cmpq 0x8(%rax), %r13
je 0xe602
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
movq (%r13), %rdi
callq 0x14996
movl (%rax), %r15d
movq (%r13), %rdi
callq 0x14bd6
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r14, %rdi
callq 0x246da
movq (%rax), %r14
movq %r13, 0x8(%rsp)
cmpq %r13, %r14
je 0xe48e
movsd 0x2d0e1(%rip), %xmm0    # 0x3b460
ucomisd 0x20(%rsp), %xmm0
jbe 0xe42e
movq (%r14), %rdi
callq 0x14bd6
movsd 0x2d0c5(%rip), %xmm0    # 0x3b460
ucomisd (%rax), %xmm0
jbe 0xe42e
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0x14946
movq %rax, %r13
movq (%r14), %rdi
callq 0x14946
leaq 0x30(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x3a0b8
movq %rbp, %rdi
callq 0x3a2f0
movsd %xmm0, 0x10(%rsp)
movq (%rbx), %r13
movq 0x8(%rbx), %rdx
subq %r13, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r15, %rdx
jbe 0xe611
leaq (%r15,%r15,2), %rbp
movq (%r14), %rdi
callq 0x14996
movl (%rax), %esi
movq (%r13,%rbp,8), %rax
movq 0x8(%r13,%rbp,8), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0xe61d
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax,%rsi,8)
jmp 0xe47f
movq (%rbx), %r13
movq 0x8(%rbx), %rdx
subq %r13, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r15, %rdx
jbe 0xe611
leaq (%r15,%r15,2), %rbp
movq (%r14), %rdi
callq 0x14996
movl (%rax), %esi
movq (%r13,%rbp,8), %rax
movq 0x8(%r13,%rbp,8), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0xe61d
movabsq $0x40c387f333333333, %rcx # imm = 0x40C387F333333333
movq %rcx, (%rax,%rsi,8)
addq $0x8, %r14
cmpq 0x8(%rsp), %r14
jne 0xe377
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %r14
movq (%rsp), %rdi
callq 0x246da
movq %r14, 0x18(%rsp)
cmpq 0x8(%rax), %r14
je 0xe5e7
leaq (%r15,%r15,2), %r14
movq 0x18(%rsp), %rbp
movq %r14, 0x28(%rsp)
movsd 0x2cf9b(%rip), %xmm0    # 0x3b460
ucomisd 0x20(%rsp), %xmm0
jbe 0xe58a
movq (%rbp), %rdi
callq 0x14bd6
movsd 0x2cf7e(%rip), %xmm0    # 0x3b460
ucomisd (%rax), %xmm0
jbe 0xe58a
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0x14946
movq %rax, %r13
movq (%rbp), %rdi
callq 0x14946
movq %r15, %r14
movq %rbx, %r15
movq %r12, %rbx
leaq 0x30(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x3a0b8
movq %r12, %rdi
movq %rbx, %r12
movq %r15, %rbx
movq %r14, %r15
callq 0x3a2f0
movsd %xmm0, 0x10(%rsp)
movq (%rbx), %r13
movq 0x8(%rbx), %rdx
subq %r13, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r14, %rdx
jbe 0xe611
movq (%rbp), %rdi
callq 0x14996
movl (%rax), %esi
movq 0x28(%rsp), %r14
movq (%r13,%r14,8), %rax
movq 0x8(%r13,%r14,8), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0xe61d
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax,%rsi,8)
jmp 0xe5d0
movq (%rbx), %r13
movq 0x8(%rbx), %rdx
subq %r13, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r15, %rdx
jbe 0xe611
movq (%rbp), %rdi
callq 0x14996
movl (%rax), %esi
movq (%r13,%r14,8), %rax
movq 0x8(%r13,%r14,8), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0xe61d
movabsq $0x40c387f333333333, %rcx # imm = 0x40C387F333333333
movq %rcx, (%rax,%rsi,8)
addq $0x8, %rbp
movq (%rsp), %rdi
callq 0x246da
cmpq 0x8(%rax), %rbp
jne 0xe4bd
movq (%rsp), %r14
movq %r14, %rdi
callq 0x246da
movq 0x18(%rsp), %r13
cmpq 0x8(%rax), %r13
jne 0xe33f
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2cd11(%rip), %rdi     # 0x3b329
movq %r15, %rsi
jmp 0xe624
leaq 0x2cd05(%rip), %rdi     # 0x3b329
xorl %eax, %eax
callq 0x4440
leaq 0x2ccf7(%rip), %rdi     # 0x3b329
movq %r12, %rsi
jmp 0xe624
nop