// File: 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
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq 0xb4e8c0(%rax), %rax
movl 0x3208(%rax), %eax
movl %eax, -0x10(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x754d
movq -0x50(%rbp), %rax
movq 0xb4e8b8(%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x870, %rcx, %rcx      # imm = 0x870
addq %rcx, %rax
movl 0x550(%rax), %eax
movl %eax, -0xc(%rbp)
movl $0xfffffffa, -0x38(%rbp) # imm = 0xFFFFFFFA
cmpl $0x7, -0x38(%rbp)
jge 0x7413
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x7383
movq -0x50(%rbp), %rdi
movl -0x38(%rbp), %edx
movl -0x34(%rbp), %ecx
movq 0xb4e8b8(%rdi), %rax
movslq -0x34(%rbp), %rsi
imulq $0x870, %rsi, %rsi      # imm = 0x870
addq %rsi, %rax
movslq -0x3c(%rbp), %rsi
movl 0xa0(%rax,%rsi,4), %r8d
movl $0x6, %esi
leaq -0x28(%rbp), %r9
leaq -0x30(%rbp), %rax
movq %rax, (%rsp)
callq 0x6e70
movsd -0x28(%rbp), %xmm0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x30(%rbp), %xmm0
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x7311
movq -0x50(%rbp), %rax
movsd -0x18(%rbp), %xmm0
cvtsi2sdl -0xc(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x20(%rbp), %xmm0
cvtsi2sdl -0xc(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x18(%rbp), %xmm0
movq 0xb4e8b8(%rax), %rcx
movslq -0x34(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movl -0x38(%rbp), %edx
addl $0x6, %edx
movslq %edx, %rdx
movsd %xmm0, 0x5e8(%rcx,%rdx,8)
movsd -0x20(%rbp), %xmm0
movq 0xb4e8b8(%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x870, %rcx, %rcx      # imm = 0x870
addq %rcx, %rax
movl -0x38(%rbp), %ecx
addl $0x6, %ecx
movslq %ecx, %rcx
movsd %xmm0, 0x650(%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x72f0
movl $0xfffffffc, -0x40(%rbp) # imm = 0xFFFFFFFC
cmpl $0x5, -0x40(%rbp)
jge 0x753d
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x74ad
movq -0x50(%rbp), %rdi
movl -0x40(%rbp), %edx
movl -0x34(%rbp), %ecx
movq 0xb4e8b8(%rdi), %rax
movslq -0x34(%rbp), %rsi
imulq $0x870, %rsi, %rsi      # imm = 0x870
addq %rsi, %rax
movslq -0x44(%rbp), %rsi
movl 0xa0(%rax,%rsi,4), %r8d
movl $0x4, %esi
leaq -0x28(%rbp), %r9
leaq -0x30(%rbp), %rax
movq %rax, (%rsp)
callq 0x6e70
movsd -0x28(%rbp), %xmm0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x30(%rbp), %xmm0
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x743b
movq -0x50(%rbp), %rax
movsd -0x18(%rbp), %xmm0
cvtsi2sdl -0xc(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x20(%rbp), %xmm0
cvtsi2sdl -0xc(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x18(%rbp), %xmm0
movq 0xb4e8b8(%rax), %rcx
movslq -0x34(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movl -0x40(%rbp), %edx
addl $0x4, %edx
movslq %edx, %rdx
movsd %xmm0, 0x558(%rcx,%rdx,8)
movsd -0x20(%rbp), %xmm0
movq 0xb4e8b8(%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x870, %rcx, %rcx      # imm = 0x870
addq %rcx, %rax
movl -0x40(%rbp), %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
movsd %xmm0, 0x5a0(%rax,%rcx,8)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x741a
jmp 0x753f
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x72bb
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)