// File: /workspace/github_cpp_makefile_star2_O3/WolfgangLechner[P]StructureAnalysis/molecular_system.cpp
// Function: CMolecularSystem::calculate_complexQLM()
void CMolecularSystem::calculate_complexQLM()
{
  //nn = number of neighbors
  int nn,nop;
  double realti,imgti;
  double realYLM,imgYLM;
  nop = this->parameter->nop;
  for (int ti= 0;ti<nop;ti++)
  {
    nn = this->molecules[ti].n_neighbors;
    for (int mi = -6;mi < 7;mi++)
    {
      realti = 0.0;
      imgti = 0.0;
      for (int ci = 0;ci<nn;ci++)
      {
        QLM(6,mi,ti,this->molecules[ti].neighbors[ci],realYLM, imgYLM);
	realti += realYLM;
	imgti += imgYLM;
      }
      realti = realti/(double(nn));
      imgti = imgti/(double(nn));
      this->molecules[ti].realQ6[mi+6] = realti;
      this->molecules[ti].imgQ6[mi+6] = imgti;
    }
    for (int mi = -4;mi < 5;mi++)
    {
      realti = 0.0;
      imgti = 0.0;
      for (int ci = 0;ci<nn;ci++)
      {
        QLM(4,mi,ti,this->molecules[ti].neighbors[ci],realYLM, imgYLM);
        realti += realYLM;
        imgti += imgYLM;
      }
      realti = realti/(double(nn));
      imgti = imgti/(double(nn));
      this->molecules[ti].realQ4[mi+4] = realti;
      this->molecules[ti].imgQ4[mi+4] = imgti;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq 0xb4e8c0(%rdi), %rax
movslq 0x3208(%rax), %rax
movq %rax, -0x68(%rbp)
testq %rax, %rax
jle 0x542f
movq %rdi, %rbx
movq 0xb4e8b8(%rdi), %rax
movl $0xa0, %r13d
xorl %r14d, %r14d
leaq -0x30(%rbp), %rdx
imulq $0x870, %r14, %rcx      # imm = 0x870
movq %rcx, -0x58(%rbp)
movl 0x550(%rax,%rcx), %esi
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
movsd %xmm0, -0x50(%rbp)
movq $-0x6, %r12
movq %rsi, -0x60(%rbp)
movq %r13, -0x70(%rbp)
testl %esi, %esi
jle 0x532b
xorps %xmm1, %xmm1
movq %rsi, %r15
xorps %xmm2, %xmm2
movsd %xmm2, -0x38(%rbp)
movsd %xmm1, -0x40(%rbp)
movq 0xb4e8b8(%rbx), %rax
movl (%rax,%r13), %r8d
movq %rdx, (%rsp)
movq %rbx, %rdi
movl $0x6, %esi
movl %r12d, %edx
movl %r14d, %ecx
leaq -0x48(%rbp), %r9
callq 0x4fd4
movsd -0x38(%rbp), %xmm2
movsd -0x40(%rbp), %xmm1
leaq -0x30(%rbp), %rdx
addsd -0x48(%rbp), %xmm2
addsd -0x30(%rbp), %xmm1
addq $0x4, %r13
decq %r15
jne 0x52c9
movq 0xb4e8b8(%rbx), %rax
movq -0x70(%rbp), %r13
movq -0x60(%rbp), %rsi
jmp 0x5333
xorpd %xmm2, %xmm2
xorpd %xmm1, %xmm1
movsd -0x50(%rbp), %xmm0
divsd %xmm0, %xmm2
divsd %xmm0, %xmm1
movq -0x58(%rbp), %rcx
addq %rax, %rcx
movsd %xmm2, 0x618(%rcx,%r12,8)
movsd %xmm1, 0x680(%rcx,%r12,8)
incq %r12
cmpq $0x7, %r12
jne 0x52bc
movq $-0x4, %r12
testl %esi, %esi
jle 0x53de
xorpd %xmm1, %xmm1
xorl %r15d, %r15d
xorpd %xmm2, %xmm2
movsd %xmm2, -0x38(%rbp)
movsd %xmm1, -0x40(%rbp)
movq 0xb4e8b8(%rbx), %rax
addq %r13, %rax
movl (%rax,%r15,4), %r8d
movq %rdx, (%rsp)
movq %rbx, %rdi
movl $0x4, %esi
movl %r12d, %edx
movl %r14d, %ecx
leaq -0x48(%rbp), %r9
callq 0x4fd4
movsd -0x38(%rbp), %xmm2
movsd -0x40(%rbp), %xmm1
movq -0x60(%rbp), %rsi
leaq -0x30(%rbp), %rdx
addsd -0x48(%rbp), %xmm2
addsd -0x30(%rbp), %xmm1
incq %r15
cmpq %r15, %rsi
jne 0x537e
movq 0xb4e8b8(%rbx), %rax
jmp 0x53e6
xorpd %xmm2, %xmm2
xorpd %xmm1, %xmm1
movsd -0x50(%rbp), %xmm0
divsd %xmm0, %xmm2
divsd %xmm0, %xmm1
movq -0x58(%rbp), %rcx
addq %rax, %rcx
movsd %xmm2, 0x578(%rcx,%r12,8)
movsd %xmm1, 0x5c0(%rcx,%r12,8)
incq %r12
cmpq $0x5, %r12
jne 0x536f
incq %r14
addq $0x870, %r13            # imm = 0x870
cmpq -0x68(%rbp), %r14
jne 0x528f
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq