// File: 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:
subq $0x38, %rsp
movl 0x19f4bf6(%rip), %eax   # 0x19fab10
movl %eax, 0x34(%rsp)
movl $0x0, 0x30(%rsp)
movl 0x30(%rsp), %eax
cmpl 0x34(%rsp), %eax
jge 0x64d7
movslq 0x30(%rsp), %rcx
leaq 0x18abd0(%rip), %rax    # 0x190b10
vmovsd (%rax,%rcx,8), %xmm0
vmovsd %xmm0, 0x28(%rsp)
movslq 0x30(%rsp), %rcx
leaq 0x18abb9(%rip), %rax    # 0x190b10
vmovsd 0x30d400(%rax,%rcx,8), %xmm0
vmovsd %xmm0, 0x20(%rsp)
movslq 0x30(%rsp), %rcx
leaq 0x18ab9e(%rip), %rax    # 0x190b10
vmovsd 0x61a800(%rax,%rcx,8), %xmm0
vmovsd %xmm0, 0x18(%rsp)
vpxor %xmm0, %xmm0, %xmm0
vmovsd %xmm0, 0x10(%rsp)
vpxor %xmm0, %xmm0, %xmm0
vmovsd %xmm0, 0x8(%rsp)
vpxor %xmm0, %xmm0, %xmm0
vmovsd %xmm0, (%rsp)
movslq 0x30(%rsp), %rcx
leaq 0x7708d76(%rip), %rax   # 0x770ed20
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rsp)
movslq -0x4(%rsp), %rcx
leaq 0x7a16163(%rip), %rax   # 0x7a1c120
movl (%rax,%rcx,4), %eax
movl %eax, -0x8(%rsp)
movslq -0x8(%rsp), %rcx
leaq 0x18ab40(%rip), %rax    # 0x190b10
vmovsd (%rax,%rcx,8), %xmm0
vsubsd 0x28(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x10(%rsp)
movslq -0x8(%rsp), %rcx
leaq 0x18ab23(%rip), %rax    # 0x190b10
vmovsd 0x30d400(%rax,%rcx,8), %xmm0
vsubsd 0x20(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x18(%rsp)
movslq -0x8(%rsp), %rcx
leaq 0x18ab02(%rip), %rax    # 0x190b10
vmovsd 0x61a800(%rax,%rcx,8), %xmm0
vsubsd 0x18(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x20(%rsp)
vpxor %xmm0, %xmm0, %xmm0
vmovsd %xmm0, -0x28(%rsp)
vpxor %xmm0, %xmm0, %xmm0
vmovsd %xmm0, -0x30(%rsp)
vpxor %xmm0, %xmm0, %xmm0
vmovsd %xmm0, -0x38(%rsp)
vpxor %xmm0, %xmm0, %xmm0
vmovsd %xmm0, -0x40(%rsp)
movl $0x0, -0x44(%rsp)
movslq 0x30(%rsp), %rcx
leaq 0x19f4ac1(%rip), %rax   # 0x19fab20
movl (%rax,%rcx,4), %eax
movl %eax, -0x48(%rsp)
movl -0x4(%rsp), %eax
movl %eax, -0x4c(%rsp)
movl -0x4c(%rsp), %eax
movl -0x48(%rsp), %ecx
addl -0x4(%rsp), %ecx
cmpl %ecx, %eax
jge 0x633d
vmovsd -0x10(%rsp), %xmm0
vmovsd %xmm0, -0x58(%rsp)
vmovsd -0x18(%rsp), %xmm0
vmovsd %xmm0, -0x60(%rsp)
vmovsd -0x20(%rsp), %xmm0
vmovsd %xmm0, -0x68(%rsp)
vmovsd -0x58(%rsp), %xmm0
vmovsd -0x58(%rsp), %xmm2
vmovsd -0x60(%rsp), %xmm1
vmulsd -0x60(%rsp), %xmm1, %xmm1
vfmadd213sd %xmm1, %xmm0, %xmm2 # xmm2 = (xmm0 * xmm2) + xmm1
vmovsd -0x68(%rsp), %xmm1
vmovsd -0x68(%rsp), %xmm0
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
vmovsd %xmm0, -0x70(%rsp)
movl -0x8(%rsp), %eax
movl %eax, -0x74(%rsp)
movl -0x4c(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x7a1602d(%rip), %rax   # 0x7a1c120
movl (%rax,%rcx,4), %eax
movl %eax, -0x8(%rsp)
movslq -0x8(%rsp), %rcx
leaq 0x18aa0a(%rip), %rax    # 0x190b10
vmovsd (%rax,%rcx,8), %xmm0
vsubsd 0x28(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x10(%rsp)
movslq -0x8(%rsp), %rcx
leaq 0x18a9ed(%rip), %rax    # 0x190b10
vmovsd 0x30d400(%rax,%rcx,8), %xmm0
vsubsd 0x20(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x18(%rsp)
movslq -0x8(%rsp), %rcx
leaq 0x18a9cc(%rip), %rax    # 0x190b10
vmovsd 0x61a800(%rax,%rcx,8), %xmm0
vsubsd 0x18(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x20(%rsp)
vmovsd -0x70(%rsp), %xmm0
vmovsd 0x1ec9(%rip), %xmm1     # 0x8030
vucomisd %xmm1, %xmm0
jbe 0x6172
jmp 0x632d
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x30(%rsp), %xmm0
vmovsd 0x10(%rsp), %xmm2
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
vmovsd %xmm0, 0x10(%rsp)
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x38(%rsp), %xmm0
vmovsd 0x8(%rsp), %xmm2
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
vmovsd %xmm0, 0x8(%rsp)
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x40(%rsp), %xmm0
vmovsd (%rsp), %xmm2
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
vmovsd %xmm0, (%rsp)
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x30(%rsp), %xmm0
movslq -0x44(%rsp), %rcx
leaq 0xdbf931(%rip), %rax    # 0xdc5b10
vmovsd (%rax,%rcx,8), %xmm2
vmovq %xmm1, %rax
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rax
vmovq %rax, %xmm1
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
leaq 0xdbf909(%rip), %rax    # 0xdc5b10
vmovsd %xmm0, (%rax,%rcx,8)
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x38(%rsp), %xmm0
movslq -0x44(%rsp), %rcx
leaq 0xdbf8ec(%rip), %rax    # 0xdc5b10
vmovsd 0x30d400(%rax,%rcx,8), %xmm2
vmovq %xmm1, %rax
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rax
vmovq %rax, %xmm1
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
leaq 0xdbf8c0(%rip), %rax    # 0xdc5b10
vmovsd %xmm0, 0x30d400(%rax,%rcx,8)
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x40(%rsp), %xmm0
movslq -0x44(%rsp), %rcx
leaq 0xdbf89f(%rip), %rax    # 0xdc5b10
vmovsd 0x61a800(%rax,%rcx,8), %xmm2
vmovq %xmm1, %rax
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rax
vmovq %rax, %xmm1
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
leaq 0xdbf873(%rip), %rax    # 0xdc5b10
vmovsd %xmm0, 0x61a800(%rax,%rcx,8)
vmovsd -0x70(%rsp), %xmm0
vmulsd -0x70(%rsp), %xmm0, %xmm0
vmulsd -0x70(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x80(%rsp)
vmovsd -0x80(%rsp), %xmm1
vmovsd 0x1d74(%rip), %xmm2     # 0x8040
vmovsd 0x1d74(%rip), %xmm0     # 0x8048
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
vmovsd -0x80(%rsp), %xmm1
vmulsd -0x80(%rsp), %xmm1, %xmm1
vmulsd -0x70(%rsp), %xmm1, %xmm1
vdivsd %xmm1, %xmm0, %xmm0
vmovsd 0x1d41(%rip), %xmm1     # 0x8038
vmulsd %xmm1, %xmm0, %xmm0
vmovsd %xmm0, -0x28(%rsp)
movl -0x74(%rsp), %eax
movl %eax, -0x44(%rsp)
vmovsd -0x58(%rsp), %xmm0
vmovsd %xmm0, -0x30(%rsp)
vmovsd -0x60(%rsp), %xmm0
vmovsd %xmm0, -0x38(%rsp)
vmovsd -0x68(%rsp), %xmm0
vmovsd %xmm0, -0x40(%rsp)
movl -0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rsp)
jmp 0x606e
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x30(%rsp), %xmm0
movslq -0x44(%rsp), %rcx
leaq 0xdbf7bb(%rip), %rax    # 0xdc5b10
vmovsd (%rax,%rcx,8), %xmm2
vmovq %xmm1, %rax
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rax
vmovq %rax, %xmm1
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
leaq 0xdbf793(%rip), %rax    # 0xdc5b10
vmovsd %xmm0, (%rax,%rcx,8)
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x38(%rsp), %xmm0
movslq -0x44(%rsp), %rcx
leaq 0xdbf776(%rip), %rax    # 0xdc5b10
vmovsd 0x30d400(%rax,%rcx,8), %xmm2
vmovq %xmm1, %rax
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rax
vmovq %rax, %xmm1
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
leaq 0xdbf74a(%rip), %rax    # 0xdc5b10
vmovsd %xmm0, 0x30d400(%rax,%rcx,8)
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x40(%rsp), %xmm0
movslq -0x44(%rsp), %rcx
leaq 0xdbf729(%rip), %rax    # 0xdc5b10
vmovsd 0x61a800(%rax,%rcx,8), %xmm2
vmovq %xmm1, %rax
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rax
vmovq %rax, %xmm1
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
leaq 0xdbf6fd(%rip), %rax    # 0xdc5b10
vmovsd %xmm0, 0x61a800(%rax,%rcx,8)
vmovsd 0x10(%rsp), %xmm2
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x30(%rsp), %xmm0
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
movslq 0x30(%rsp), %rcx
leaq 0xdbf6d1(%rip), %rax    # 0xdc5b10
vaddsd (%rax,%rcx,8), %xmm0, %xmm0
leaq 0xdbf6c5(%rip), %rax    # 0xdc5b10
vmovsd %xmm0, (%rax,%rcx,8)
vmovsd 0x8(%rsp), %xmm2
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x38(%rsp), %xmm0
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
movslq 0x30(%rsp), %rcx
leaq 0xdbf69d(%rip), %rax    # 0xdc5b10
vaddsd 0x30d400(%rax,%rcx,8), %xmm0, %xmm0
leaq 0xdbf68d(%rip), %rax    # 0xdc5b10
vmovsd %xmm0, 0x30d400(%rax,%rcx,8)
vmovsd (%rsp), %xmm2
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x40(%rsp), %xmm0
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
movslq 0x30(%rsp), %rcx
leaq 0xdbf662(%rip), %rax    # 0xdc5b10
vaddsd 0x61a800(%rax,%rcx,8), %xmm0, %xmm0
leaq 0xdbf652(%rip), %rax    # 0xdc5b10
vmovsd %xmm0, 0x61a800(%rax,%rcx,8)
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x5f26
addq $0x38, %rsp
retq
nopl (%rax)