// File: WolfgangLechner[P]StructureAnalysis/molecular_system.cpp
// Function: CMolecularSystem::get_NumberFromBond(int, int)
double CMolecularSystem::get_NumberFromBond(int ti,int tj)
{
  double sumSquareti,sumSquaretj;
  double realdotproduct,imgdotproduct;
  double connection;
  sumSquareti = 0.0;
  sumSquaretj = 0.0;
  realdotproduct = 0.0;
  imgdotproduct = 0.0;

  for (int mi = 0;mi < 13;mi++)
  {

    sumSquareti += this->molecules[ti].realQ6[mi]*this->molecules[ti].realQ6[mi] + this->molecules[ti].imgQ6[mi] *this->molecules[ti].imgQ6[mi];
    sumSquaretj += this->molecules[tj].realQ6[mi]*this->molecules[tj].realQ6[mi] + this->molecules[tj].imgQ6[mi] *this->molecules[tj].imgQ6[mi];
    realdotproduct += this->molecules[ti].realQ6[mi]*this->molecules[tj].realQ6[mi];
    imgdotproduct  += this->molecules[ti].imgQ6[mi] *this->molecules[tj].imgQ6[mi];
  }
  connection = (realdotproduct+imgdotproduct)/(sqrt(sumSquaretj)*sqrt(sumSquareti));
  return connection;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
cmpl $0xd, -0x3c(%rbp)
jge 0x86dd
movq -0x48(%rbp), %rax
movq 0xb4e8b8(%rax), %rcx
movslq -0xc(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
movsd 0x5e8(%rcx,%rdx,8), %xmm0
movq 0xb4e8b8(%rax), %rcx
movslq -0xc(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
movsd 0x5e8(%rcx,%rdx,8), %xmm2
movq 0xb4e8b8(%rax), %rcx
movslq -0xc(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
movsd 0x650(%rcx,%rdx,8), %xmm1
movq 0xb4e8b8(%rax), %rcx
movslq -0xc(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
mulsd 0x650(%rcx,%rdx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movq 0xb4e8b8(%rax), %rcx
movslq -0x10(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
movsd 0x5e8(%rcx,%rdx,8), %xmm0
movq 0xb4e8b8(%rax), %rcx
movslq -0x10(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
movsd 0x5e8(%rcx,%rdx,8), %xmm2
movq 0xb4e8b8(%rax), %rcx
movslq -0x10(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
movsd 0x650(%rcx,%rdx,8), %xmm1
movq 0xb4e8b8(%rax), %rcx
movslq -0x10(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
mulsd 0x650(%rcx,%rdx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movq 0xb4e8b8(%rax), %rcx
movslq -0xc(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
movsd 0x5e8(%rcx,%rdx,8), %xmm0
movq 0xb4e8b8(%rax), %rcx
movslq -0x10(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
movsd 0x5e8(%rcx,%rdx,8), %xmm2
movsd -0x28(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movq 0xb4e8b8(%rax), %rcx
movslq -0xc(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
movsd 0x650(%rcx,%rdx,8), %xmm0
movq 0xb4e8b8(%rax), %rax
movslq -0x10(%rbp), %rcx
imulq $0x870, %rcx, %rcx      # imm = 0x870
addq %rcx, %rax
movslq -0x3c(%rbp), %rcx
movsd 0x650(%rax,%rcx,8), %xmm2
movsd -0x30(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x84e1
movsd -0x28(%rbp), %xmm0
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x31a0
movsd %xmm0, -0x58(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x31a0
movsd -0x58(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x50(%rbp), %xmm0
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)