// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
vmovsd 0x1691(%rip), %xmm0     # 0x4040
vmovsd 0x1671(%rip), %xmm1     # 0x4028
vmovsd 0x1671(%rip), %xmm2     # 0x4030
vmovsd 0x1671(%rip), %xmm3     # 0x4038
movl 0x19f4143(%rip), %eax   # 0x19f6b10
leaq 0x18a13c(%rip), %rdx    # 0x18cb10
leaq 0x7708345(%rip), %rsi   # 0x770ad20
leaq 0x7a1573e(%rip), %rdi   # 0x7a18120
leaq 0x19f4137(%rip), %r8    # 0x19f6b20
leaq 0xdbf120(%rip), %r9     # 0xdc1b10
movl %eax, %ecx
sarl $0x1f, %ecx
andnl %eax, %ecx, %eax
xorl %ecx, %ecx
cmpq %rax, %rcx
je 0x2bd7
movslq (%rsi,%rcx,4), %r10
vmovsd (%rdx,%rcx,8), %xmm5
vmovsd 0x30d400(%rdx,%rcx,8), %xmm7
vmovsd 0x61a800(%rdx,%rcx,8), %xmm8
movslq (%r8,%rcx,4), %r11
vxorpd %xmm4, %xmm4, %xmm4
vxorpd %xmm16, %xmm16, %xmm16
vxorpd %xmm13, %xmm13, %xmm13
vxorpd %xmm11, %xmm11, %xmm11
vxorpd %xmm6, %xmm6, %xmm6
vxorpd %xmm9, %xmm9, %xmm9
vxorpd %xmm10, %xmm10, %xmm10
xorl %ebp, %ebp
movslq (%rdi,%r10,4), %rbx
addq %r10, %r11
vmovsd (%rdx,%rbx,8), %xmm12
vmovsd 0x30d400(%rdx,%rbx,8), %xmm14
vmovsd 0x61a800(%rdx,%rbx,8), %xmm15
movslq %ebp, %r15
cmpq %r11, %r10
jge 0x2b47
vsubsd %xmm7, %xmm14, %xmm17
vsubsd %xmm5, %xmm12, %xmm19
movl %ebx, %r14d
movslq 0x4(%rdi,%r10,4), %rbx
vsubsd %xmm8, %xmm15, %xmm18
incq %r10
vmulsd %xmm17, %xmm17, %xmm20
vmovsd (%rdx,%rbx,8), %xmm12
vmovsd 0x30d400(%rdx,%rbx,8), %xmm14
vmovsd 0x61a800(%rdx,%rbx,8), %xmm15
vfmadd231sd %xmm19, %xmm19, %xmm20 # xmm20 = (xmm19 * xmm19) + xmm20
vfmadd231sd %xmm18, %xmm18, %xmm20 # xmm20 = (xmm18 * xmm18) + xmm20
vucomisd %xmm0, %xmm20
ja 0x2a66
vfmadd231sd %xmm16, %xmm4, %xmm10 # xmm10 = (xmm4 * xmm16) + xmm10
vfnmadd213sd (%r9,%r15,8), %xmm4, %xmm16 # xmm16 = -(xmm4 * xmm16) + mem
vfmadd231sd %xmm13, %xmm4, %xmm9 # xmm9 = (xmm4 * xmm13) + xmm9
vfmadd231sd %xmm11, %xmm4, %xmm6 # xmm6 = (xmm4 * xmm11) + xmm6
movl %r14d, %ebp
vmovsd %xmm16, (%r9,%r15,8)
vmovapd %xmm19, %xmm16
vfnmadd213sd 0x30d400(%r9,%r15,8), %xmm4, %xmm13 # xmm13 = -(xmm4 * xmm13) + mem
vmovsd %xmm13, 0x30d400(%r9,%r15,8)
vmovapd %xmm17, %xmm13
vfnmadd213sd 0x61a800(%r9,%r15,8), %xmm4, %xmm11 # xmm11 = -(xmm4 * xmm11) + mem
vmulsd %xmm20, %xmm20, %xmm4
vmulsd %xmm4, %xmm20, %xmm4
vmovsd %xmm11, 0x61a800(%r9,%r15,8)
vmovapd %xmm1, %xmm11
vfmadd213sd %xmm2, %xmm4, %xmm11 # xmm11 = (xmm4 * xmm11) + xmm2
vmulsd %xmm4, %xmm4, %xmm4
vmulsd %xmm4, %xmm20, %xmm4
vdivsd %xmm4, %xmm11, %xmm4
vmovapd %xmm18, %xmm11
vmulsd %xmm3, %xmm4, %xmm4
jmp 0x2a66
vmovsd (%r9,%r15,8), %xmm5
vfmadd231sd %xmm16, %xmm4, %xmm10 # xmm10 = (xmm4 * xmm16) + xmm10
vfmadd231sd %xmm13, %xmm4, %xmm9 # xmm9 = (xmm4 * xmm13) + xmm9
vfmadd231sd %xmm11, %xmm4, %xmm6 # xmm6 = (xmm4 * xmm11) + xmm6
vfnmadd231sd %xmm16, %xmm4, %xmm5 # xmm5 = -(xmm4 * xmm16) + xmm5
vmovsd %xmm5, (%r9,%r15,8)
vmovsd 0x30d400(%r9,%r15,8), %xmm5
vfnmadd231sd %xmm13, %xmm4, %xmm5 # xmm5 = -(xmm4 * xmm13) + xmm5
vmovsd %xmm5, 0x30d400(%r9,%r15,8)
vmovsd 0x61a800(%r9,%r15,8), %xmm5
vfnmadd231sd %xmm11, %xmm4, %xmm5 # xmm5 = -(xmm4 * xmm11) + xmm5
vmovsd %xmm5, 0x61a800(%r9,%r15,8)
vaddsd (%r9,%rcx,8), %xmm10, %xmm5
vmovsd %xmm5, (%r9,%rcx,8)
vaddsd 0x30d400(%r9,%rcx,8), %xmm9, %xmm5
vmovsd %xmm5, 0x30d400(%r9,%rcx,8)
vaddsd 0x61a800(%r9,%rcx,8), %xmm6, %xmm4
vmovsd %xmm4, 0x61a800(%r9,%rcx,8)
incq %rcx
jmp 0x29fc
popq %rbx
popq %r14
popq %r15
popq %rbp
retq