// File: /workspace/github_cpp_makefile_star2_O3/kaityo256[P]lj_simd/force_aos.cpp
// Function: force_sorted_swp()
void
force_sorted_swp(void) {
  const int pn = particle_number;
  for (int i = 0; i < pn; i++) {
    const double qix = q[i][X];
    const double qiy = q[i][Y];
    const double qiz = q[i][Z];
    double pfx = 0;
    double pfy = 0;
    double pfz = 0;
    const int kp = pointer[i];
    int ja = sorted_list[kp];
    double dxa = q[ja][X] - qix;
    double dya = q[ja][Y] - qiy;
    double dza = q[ja][Z] - qiz;
    double df = 0.0;
    double dxb = 0.0, dyb = 0.0, dzb = 0.0;
    int jb = 0;

    const int np = number_of_partners[i];
    for (int k = kp; k < np + kp; k++) {

      const double dx = dxa;
      const double dy = dya;
      const double dz = dza;
      double r2 = (dx * dx + dy * dy + dz * dz);
      const int j = ja;
      ja = sorted_list[k + 1];
      dxa = q[ja][X] - qix;
      dya = q[ja][Y] - qiy;
      dza = q[ja][Z] - qiz;
      if (r2 > CL2)continue;
      pfx += df * dxb;
      pfy += df * dyb;
      pfz += df * dzb;
      p[jb][X] -= df * dxb;
      p[jb][Y] -= df * dyb;
      p[jb][Z] -= df * dzb;
      const double r6 = r2 * r2 * r2;
      df = ((24.0 * r6 - 48.0) / (r6 * r6 * r2)) * dt;
      jb = j;
      dxb = dx;
      dyb = dy;
      dzb = dz;
    }
    p[jb][X] -= df * dxb;
    p[jb][Y] -= df * dyb;
    p[jb][Z] -= df * dzb;
    p[i][X] += pfx + df * dxb;
    p[i][Y] += pfy + df * dyb;
    p[i][Z] += pfz + df * dzb;
  }
}

// Assembly:
movslq 0x325eaa1(%rip), %rax   # 0x3261bc0
testq %rax, %rax
jle 0x32ef
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
vmovsd 0x1f0a(%rip), %xmm0     # 0x5040
vmovsd 0x1eea(%rip), %xmm1     # 0x5028
vmovsd 0x1eea(%rip), %xmm2     # 0x5030
vmovsd 0x1eea(%rip), %xmm3     # 0x5038
leaq 0x18aa3b(%rip), %rdx    # 0x18db90
leaq 0x325ea74(%rip), %rsi   # 0x3261bd0
leaq 0x8f72c6d(%rip), %rdi   # 0x8f75dd0
leaq 0x90f9666(%rip), %r8    # 0x90fc7d0
leaq 0xdbfa1f(%rip), %r9     # 0xdc2b90
xorl %ecx, %ecx
movslq (%rsi,%rcx,4), %r11
movq %rcx, %r10
shlq $0x5, %r10
testq %r11, %r11
jle 0x3275
movslq (%rdi,%rcx,4), %rbx
vmovapd (%r10,%rdx), %xmm9
vmovsd 0x10(%r10,%rdx), %xmm10
vxorpd %xmm6, %xmm6, %xmm6
vxorpd %xmm4, %xmm4, %xmm4
vxorpd %xmm7, %xmm7, %xmm7
vxorpd %xmm5, %xmm5, %xmm5
vxorpd %xmm8, %xmm8, %xmm8
xorl %ebp, %ebp
movslq (%r8,%rbx,4), %r14
addq %rbx, %r11
movq %r14, %r15
shlq $0x5, %r15
vmovsd 0x10(%r15,%rdx), %xmm12
vmovapd (%r15,%rdx), %xmm11
vsubpd %xmm9, %xmm11, %xmm11
vsubsd %xmm10, %xmm12, %xmm12
vmulpd %xmm11, %xmm11, %xmm13
vshufpd $0x1, %xmm13, %xmm13, %xmm13 # xmm13 = xmm13[1,0]
vfmadd231sd %xmm11, %xmm11, %xmm13 # xmm13 = (xmm11 * xmm11) + xmm13
vfmadd231sd %xmm12, %xmm12, %xmm13 # xmm13 = (xmm12 * xmm12) + xmm13
vucomisd %xmm0, %xmm13
ja 0x324b
movslq %ebp, %r15
vmovddup %xmm5, %xmm14           # xmm14 = xmm5[0,0]
vfmadd231sd %xmm7, %xmm5, %xmm4 # xmm4 = (xmm5 * xmm7) + xmm4
movl %r14d, %ebp
shlq $0x5, %r15
vfmadd231pd %xmm6, %xmm14, %xmm8 # xmm8 = (xmm14 * xmm6) + xmm8
vfnmadd213pd (%r15,%r9), %xmm14, %xmm6 # xmm6 = -(xmm14 * xmm6) + mem
vmovapd %xmm6, (%r15,%r9)
vmovapd %xmm1, %xmm6
vfnmadd213sd 0x10(%r15,%r9), %xmm5, %xmm7 # xmm7 = -(xmm5 * xmm7) + mem
vmulsd %xmm13, %xmm13, %xmm5
vmulsd %xmm5, %xmm13, %xmm5
vfmadd213sd %xmm2, %xmm5, %xmm6 # xmm6 = (xmm5 * xmm6) + xmm2
vmulsd %xmm5, %xmm5, %xmm5
vmulsd %xmm5, %xmm13, %xmm5
vmovsd %xmm7, 0x10(%r15,%r9)
vmovapd %xmm12, %xmm7
vdivsd %xmm5, %xmm6, %xmm5
vmovapd %xmm11, %xmm6
vmulsd %xmm3, %xmm5, %xmm5
movslq 0x4(%r8,%rbx,4), %r14
incq %rbx
movq %r14, %r15
shlq $0x5, %r15
vmovaps (%r15,%rdx), %xmm11
vmovsd 0x10(%r15,%rdx), %xmm12
cmpq %r11, %rbx
jl 0x31ca
movslq %ebp, %r11
jmp 0x328d
vxorpd %xmm6, %xmm6, %xmm6
vxorpd %xmm5, %xmm5, %xmm5
vxorpd %xmm7, %xmm7, %xmm7
xorl %r11d, %r11d
vxorpd %xmm4, %xmm4, %xmm4
vxorpd %xmm8, %xmm8, %xmm8
shlq $0x5, %r11
vmovddup %xmm5, %xmm9            # xmm9 = xmm5[0,0]
vfmadd231sd %xmm7, %xmm5, %xmm4 # xmm4 = (xmm5 * xmm7) + xmm4
incq %rcx
vmovapd (%r11,%r9), %xmm10
vfmadd231pd %xmm6, %xmm9, %xmm8 # xmm8 = (xmm9 * xmm6) + xmm8
vfnmadd231pd %xmm6, %xmm9, %xmm10 # xmm10 = -(xmm9 * xmm6) + xmm10
vmovapd %xmm10, (%r11,%r9)
vmovsd 0x10(%r11,%r9), %xmm10
vfnmadd231sd %xmm7, %xmm5, %xmm10 # xmm10 = -(xmm5 * xmm7) + xmm10
vmovsd %xmm10, 0x10(%r11,%r9)
vaddpd (%r10,%r9), %xmm8, %xmm6
vmovapd %xmm6, (%r10,%r9)
vaddsd 0x10(%r10,%r9), %xmm4, %xmm4
vmovsd %xmm4, 0x10(%r10,%r9)
cmpq %rax, %rcx
jne 0x3173
popq %rbx
popq %r14
popq %r15
popq %rbp
retq