// File: /workspace/github_cpp_makefile_star2_O1/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 0x549b
movq %rdi, %rbx
movl $0xa0, %r13d
xorl %r14d, %r14d
leaq -0x30(%rbp), %rcx
movq 0xb4e8b8(%rbx), %rax
imulq $0x870, %r14, %rdx      # imm = 0x870
movq %rdx, -0x58(%rbp)
movl 0x550(%rax,%rdx), %edx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd %xmm0, -0x38(%rbp)
movq $-0x6, %r12
movq %r13, -0x70(%rbp)
movq %rdx, -0x60(%rbp)
testl %edx, %edx
jle 0x5382
xorps %xmm1, %xmm1
movq %rdx, %r15
xorps %xmm2, %xmm2
movsd %xmm2, -0x40(%rbp)
movsd %xmm1, -0x48(%rbp)
movq 0xb4e8b8(%rbx), %rax
movl (%rax,%r13), %r8d
movq %rcx, (%rsp)
movq %rbx, %rdi
movl $0x6, %esi
movl %r12d, %edx
movl %r14d, %ecx
leaq -0x50(%rbp), %r9
callq 0x500c
movsd -0x40(%rbp), %xmm2
movsd -0x48(%rbp), %xmm1
leaq -0x30(%rbp), %rcx
addsd -0x50(%rbp), %xmm2
addsd -0x30(%rbp), %xmm1
addq $0x4, %r13
decq %r15
jne 0x532f
jmp 0x538a
xorpd %xmm2, %xmm2
xorpd %xmm1, %xmm1
movsd -0x38(%rbp), %xmm0
divsd %xmm0, %xmm2
divsd %xmm0, %xmm1
movq 0xb4e8b8(%rbx), %rax
addq -0x58(%rbp), %rax
movsd %xmm2, 0x618(%rax,%r12,8)
movsd %xmm1, 0x680(%rax,%r12,8)
incq %r12
cmpq $0x7, %r12
movq -0x70(%rbp), %r13
movq -0x60(%rbp), %rdx
jne 0x5322
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd %xmm0, -0x38(%rbp)
movq $-0x4, %r12
testl %edx, %edx
jle 0x5446
xorpd %xmm1, %xmm1
xorl %r15d, %r15d
xorpd %xmm2, %xmm2
movsd %xmm2, -0x40(%rbp)
movsd %xmm1, -0x48(%rbp)
movq 0xb4e8b8(%rbx), %rax
addq %r13, %rax
movl (%rax,%r15,4), %r8d
movq %rcx, (%rsp)
movq %rbx, %rdi
movl $0x4, %esi
movl %r12d, %edx
movl %r14d, %ecx
leaq -0x50(%rbp), %r9
callq 0x500c
movsd -0x40(%rbp), %xmm2
movsd -0x48(%rbp), %xmm1
movq -0x60(%rbp), %rdx
leaq -0x30(%rbp), %rcx
addsd -0x50(%rbp), %xmm2
addsd -0x30(%rbp), %xmm1
incq %r15
cmpq %r15, %rdx
jne 0x53ed
jmp 0x544e
xorpd %xmm2, %xmm2
xorpd %xmm1, %xmm1
movsd -0x38(%rbp), %xmm0
divsd %xmm0, %xmm2
divsd %xmm0, %xmm1
movq 0xb4e8b8(%rbx), %rax
addq -0x58(%rbp), %rax
movsd %xmm2, 0x578(%rax,%r12,8)
movsd %xmm1, 0x5c0(%rax,%r12,8)
incq %r12
cmpq $0x5, %r12
jne 0x53de
incq %r14
addq $0x870, %r13            # imm = 0x870
cmpq -0x68(%rbp), %r14
jne 0x52ee
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq