// File: /workspace/github_cpp_makefile_star2_O1/kaityo256[P]lj_simd/force_soa.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[X][i];
    const double qiy = q[Y][i];
    const double qiz = q[Z][i];
    double pfx = 0;
    double pfy = 0;
    double pfz = 0;
    const int kp = pointer[i];
    int ja = sorted_list[kp];
    double dxa = q[X][ja] - qix;
    double dya = q[Y][ja] - qiy;
    double dza = q[Z][ja] - 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[X][ja] - qix;
      dya = q[Y][ja] - qiy;
      dza = q[Z][ja] - qiz;
      if (r2 > CL2)continue;
      pfx += df * dxb;
      pfy += df * dyb;
      pfz += df * dzb;
      p[X][jb] -= df * dxb;
      p[Y][jb] -= df * dyb;
      p[Z][jb] -= 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[X][jb] -= df * dxb;
    p[Y][jb] -= df * dyb;
    p[Z][jb] -= df * dzb;
    p[X][i] += pfx + df * dxb;
    p[Y][i] += pfy + df * dyb;
    p[Z][i] += pfz + df * dzb;
  }
}

// Assembly:
movslq 0x19f3f51(%rip), %rax   # 0x19f7b30
testq %rax, %rax
jle 0x3e2a
pushq %rbp
pushq %r14
pushq %rbx
xorl %ecx, %ecx
leaq 0x189f3b(%rip), %rdx    # 0x18db30
leaq 0x19f3f44(%rip), %rsi   # 0x19f7b40
leaq 0x770813d(%rip), %rdi   # 0x770bd40
leaq 0x7a15536(%rip), %r8    # 0x7a19140
vmovsd 0x142e(%rip), %xmm0     # 0x5040
leaq 0xdbef17(%rip), %r9     # 0xdc2b30
vmovsd 0x1407(%rip), %xmm1     # 0x5028
vmovsd 0x1407(%rip), %xmm2     # 0x5030
vmovsd 0x1407(%rip), %xmm3     # 0x5038
movslq (%rsi,%rcx,4), %r10
testq %r10, %r10
jle 0x3d72
vmovsd (%rdx,%rcx,8), %xmm10
vmovsd 0x30d400(%rdx,%rcx,8), %xmm12
vmovsd 0x61a800(%rdx,%rcx,8), %xmm13
movslq (%rdi,%rcx,4), %r11
addq %r11, %r10
movslq (%r8,%r11,4), %rbx
vmovsd 0x61a800(%rdx,%rbx,8), %xmm15
vmovsd 0x30d400(%rdx,%rbx,8), %xmm16
vmovsd (%rdx,%rbx,8), %xmm14
xorl %ebp, %ebp
vxorpd %xmm5, %xmm5, %xmm5
vxorpd %xmm6, %xmm6, %xmm6
vxorpd %xmm4, %xmm4, %xmm4
vxorpd %xmm8, %xmm8, %xmm8
vxorpd %xmm9, %xmm9, %xmm9
vxorpd %xmm11, %xmm11, %xmm11
vxorpd %xmm7, %xmm7, %xmm7
vsubsd %xmm12, %xmm16, %xmm16
vsubsd %xmm13, %xmm15, %xmm15
vsubsd %xmm10, %xmm14, %xmm14
vmulsd %xmm16, %xmm16, %xmm17
vfmadd231sd %xmm14, %xmm14, %xmm17 # xmm17 = (xmm14 * xmm14) + xmm17
vfmadd231sd %xmm15, %xmm15, %xmm17 # xmm17 = (xmm15 * xmm15) + xmm17
vucomisd %xmm0, %xmm17
ja 0x3d43
vfmadd231sd %xmm11, %xmm7, %xmm5 # xmm5 = (xmm7 * xmm11) + xmm5
vfmadd231sd %xmm9, %xmm7, %xmm6 # xmm6 = (xmm7 * xmm9) + xmm6
vfmadd231sd %xmm8, %xmm7, %xmm4 # xmm4 = (xmm7 * xmm8) + xmm4
movslq %ebp, %r14
vfnmadd213sd (%r9,%r14,8), %xmm7, %xmm11 # xmm11 = -(xmm7 * xmm11) + mem
vmovsd %xmm11, (%r9,%r14,8)
vfnmadd213sd 0x30d400(%r9,%r14,8), %xmm7, %xmm9 # xmm9 = -(xmm7 * xmm9) + mem
vmovsd %xmm9, 0x30d400(%r9,%r14,8)
vfnmadd213sd 0x61a800(%r9,%r14,8), %xmm7, %xmm8 # xmm8 = -(xmm7 * xmm8) + mem
vmovsd %xmm8, 0x61a800(%r9,%r14,8)
vmulsd %xmm17, %xmm17, %xmm7
vmulsd %xmm7, %xmm17, %xmm7
vmovapd %xmm1, %xmm8
vfmadd213sd %xmm2, %xmm7, %xmm8 # xmm8 = (xmm7 * xmm8) + xmm2
vmulsd %xmm7, %xmm7, %xmm7
vmulsd %xmm7, %xmm17, %xmm7
vdivsd %xmm7, %xmm8, %xmm7
vmulsd %xmm3, %xmm7, %xmm7
vmovapd %xmm14, %xmm11
vmovapd %xmm16, %xmm9
vmovapd %xmm15, %xmm8
movl %ebx, %ebp
movslq 0x4(%r8,%r11,4), %rbx
incq %r11
vmovsd (%rdx,%rbx,8), %xmm14
vmovsd 0x30d400(%rdx,%rbx,8), %xmm16
vmovsd 0x61a800(%rdx,%rbx,8), %xmm15
cmpq %r10, %r11
jl 0x3c9a
movslq %ebp, %r10
jmp 0x3d94
vxorpd %xmm7, %xmm7, %xmm7
vxorpd %xmm11, %xmm11, %xmm11
vxorpd %xmm9, %xmm9, %xmm9
vxorpd %xmm8, %xmm8, %xmm8
xorl %r10d, %r10d
vxorpd %xmm4, %xmm4, %xmm4
vxorpd %xmm6, %xmm6, %xmm6
vxorpd %xmm5, %xmm5, %xmm5
vmovsd (%r9,%r10,8), %xmm10
vfnmadd231sd %xmm11, %xmm7, %xmm10 # xmm10 = -(xmm7 * xmm11) + xmm10
vmovsd %xmm10, (%r9,%r10,8)
vmovsd 0x30d400(%r9,%r10,8), %xmm10
vfnmadd231sd %xmm9, %xmm7, %xmm10 # xmm10 = -(xmm7 * xmm9) + xmm10
vmovsd %xmm10, 0x30d400(%r9,%r10,8)
vmovsd 0x61a800(%r9,%r10,8), %xmm10
vfnmadd231sd %xmm8, %xmm7, %xmm10 # xmm10 = -(xmm7 * xmm8) + xmm10
vmovsd %xmm10, 0x61a800(%r9,%r10,8)
vfmadd231sd %xmm11, %xmm7, %xmm5 # xmm5 = (xmm7 * xmm11) + xmm5
vaddsd (%r9,%rcx,8), %xmm5, %xmm5
vmovsd %xmm5, (%r9,%rcx,8)
vfmadd231sd %xmm9, %xmm7, %xmm6 # xmm6 = (xmm7 * xmm9) + xmm6
vaddsd 0x30d400(%r9,%rcx,8), %xmm6, %xmm5
vmovsd %xmm5, 0x30d400(%r9,%rcx,8)
vfmadd231sd %xmm8, %xmm7, %xmm4 # xmm4 = (xmm7 * xmm8) + xmm4
vaddsd 0x61a800(%r9,%rcx,8), %xmm4, %xmm4
vmovsd %xmm4, 0x61a800(%r9,%rcx,8)
incq %rcx
cmpq %rax, %rcx
jne 0x3c31
popq %rbx
popq %r14
popq %rbp
retq
nop