// File: /workspace/github_cpp_makefile_star2_O3/kaityo256[P]lj_simd/force_soa.cpp
// Function: force_sorted()
void
force_sorted(void) {
  const int pn = particle_number;
  const int *__restrict sorted_list2 = sorted_list;
  for (int i = 0; i < pn; i++) {
    const double qix = q[X][i];
    const double qiy = q[Y][i];
    const double qiz = q[Z][i];
    const int np = number_of_partners[i];
    double pfx = 0;
    double pfy = 0;
    double pfz = 0;
    const int kp = pointer[i];
    for (int k = 0; k < np; k++) {
      const int j = sorted_list2[kp + k];
      double dx = q[X][j] - qix;
      double dy = q[Y][j] - qiy;
      double dz = q[Z][j] - qiz;
      double r2 = (dx * dx + dy * dy + dz * dz);
      //if (r2 > CL2) continue;
      double r6 = r2 * r2 * r2;
      double df = ((24.0 * r6 - 48.0) / (r6 * r6 * r2)) * dt;
      if (r2 > CL2) df = 0.0;
      pfx += df * dx;
      pfy += df * dy;
      pfz += df * dz;
      p[X][j] -= df * dx;
      p[Y][j] -= df * dy;
      p[Z][j] -= df * dz;
    }
    p[X][i] += pfx;
    p[Y][i] += pfy;
    p[Z][i] += pfz;
  }
}

// Assembly:
movslq 0x19f4d4a(%rip), %rax   # 0x19f7b30
testq %rax, %rax
jle 0x2f7a
pushq %r14
pushq %rbx
vmovsd 0x222e(%rip), %xmm0     # 0x5028
vmovsd 0x222e(%rip), %xmm1     # 0x5030
vmovsd 0x222e(%rip), %xmm2     # 0x5038
vmovsd 0x222e(%rip), %xmm3     # 0x5040
leaq 0x18ad17(%rip), %rdx    # 0x18db30
leaq 0x19f4d20(%rip), %rsi   # 0x19f7b40
leaq 0x7708f19(%rip), %rdi   # 0x770bd40
leaq 0x7a16312(%rip), %r8    # 0x7a19140
vxorpd %xmm4, %xmm4, %xmm4
leaq 0xdbfcf7(%rip), %r9     # 0xdc2b30
xorl %ecx, %ecx
movslq (%rsi,%rcx,4), %r10
vxorpd %xmm5, %xmm5, %xmm5
vxorpd %xmm7, %xmm7, %xmm7
vxorpd %xmm6, %xmm6, %xmm6
testq %r10, %r10
jle 0x2f37
vmovsd (%rdx,%rcx,8), %xmm8
vmovsd 0x30d400(%rdx,%rcx,8), %xmm9
vmovsd 0x61a800(%rdx,%rcx,8), %xmm10
movslq (%rdi,%rcx,4), %r11
xorl %ebx, %ebx
leaq (%r8,%r11,4), %r11
movslq (%r11,%rbx,4), %r14
vmovapd %xmm0, %xmm16
incq %rbx
vmovsd 0x30d400(%rdx,%r14,8), %xmm12
vmovsd (%rdx,%r14,8), %xmm11
vmovsd 0x61a800(%rdx,%r14,8), %xmm13
vsubsd %xmm9, %xmm12, %xmm12
vsubsd %xmm8, %xmm11, %xmm11
vsubsd %xmm10, %xmm13, %xmm13
vmulsd %xmm12, %xmm12, %xmm14
vfmadd231sd %xmm11, %xmm11, %xmm14 # xmm14 = (xmm11 * xmm11) + xmm14
vfmadd231sd %xmm13, %xmm13, %xmm14 # xmm14 = (xmm13 * xmm13) + xmm14
vmulsd %xmm14, %xmm14, %xmm15
vcmpgtsd %xmm3, %xmm14, %k1
vmulsd %xmm15, %xmm14, %xmm15
vfmadd213sd %xmm1, %xmm15, %xmm16 # xmm16 = (xmm15 * xmm16) + xmm1
vmulsd %xmm15, %xmm15, %xmm15
vmulsd %xmm15, %xmm14, %xmm15
vdivsd %xmm15, %xmm16, %xmm15
vmulsd %xmm2, %xmm15, %xmm15
vmovsd %xmm4, %xmm15, %xmm15 {%k1}
vfmadd231sd %xmm11, %xmm15, %xmm6 # xmm6 = (xmm15 * xmm11) + xmm6
vfnmadd213sd (%r9,%r14,8), %xmm15, %xmm11 # xmm11 = -(xmm15 * xmm11) + mem
vfmadd231sd %xmm12, %xmm15, %xmm7 # xmm7 = (xmm15 * xmm12) + xmm7
vfmadd231sd %xmm15, %xmm13, %xmm5 # xmm5 = (xmm13 * xmm15) + xmm5
vmovsd %xmm11, (%r9,%r14,8)
vfnmadd213sd 0x30d400(%r9,%r14,8), %xmm15, %xmm12 # xmm12 = -(xmm15 * xmm12) + mem
vmovsd %xmm12, 0x30d400(%r9,%r14,8)
vfnmadd213sd 0x61a800(%r9,%r14,8), %xmm15, %xmm13 # xmm13 = -(xmm15 * xmm13) + mem
vmovsd %xmm13, 0x61a800(%r9,%r14,8)
cmpq %rbx, %r10
jne 0x2e75
vaddsd (%r9,%rcx,8), %xmm6, %xmm6
vmovsd %xmm6, (%r9,%rcx,8)
vaddsd 0x30d400(%r9,%rcx,8), %xmm7, %xmm6
vmovsd %xmm6, 0x30d400(%r9,%rcx,8)
vaddsd 0x61a800(%r9,%rcx,8), %xmm5, %xmm5
vmovsd %xmm5, 0x61a800(%r9,%rcx,8)
incq %rcx
cmpq %rax, %rcx
jne 0x2e3b
popq %rbx
popq %r14
retq