// File: 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:
subq $0x38, %rsp
movl 0x3262fe6(%rip), %eax   # 0x3266b80
movl %eax, 0x34(%rsp)
movl $0x0, 0x30(%rsp)
movl 0x30(%rsp), %eax
cmpl 0x34(%rsp), %eax
jge 0x4145
movslq 0x30(%rsp), %rcx
leaq 0x18ef90(%rip), %rax    # 0x192b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x28(%rsp)
movslq 0x30(%rsp), %rcx
leaq 0x18ef73(%rip), %rax    # 0x192b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd 0x8(%rax), %xmm0
vmovsd %xmm0, 0x20(%rsp)
movslq 0x30(%rsp), %rcx
leaq 0x18ef55(%rip), %rax    # 0x192b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd 0x10(%rax), %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 0x8f7715a(%rip), %rax   # 0x8f7ad90
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rsp)
movslq -0x4(%rsp), %rcx
leaq 0x90fdb47(%rip), %rax   # 0x9101790
movl (%rax,%rcx,4), %eax
movl %eax, -0x8(%rsp)
movslq -0x8(%rsp), %rcx
leaq 0x18eef4(%rip), %rax    # 0x192b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd (%rax), %xmm0
vsubsd 0x28(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x10(%rsp)
movslq -0x8(%rsp), %rcx
leaq 0x18eed1(%rip), %rax    # 0x192b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd 0x8(%rax), %xmm0
vsubsd 0x20(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x18(%rsp)
movslq -0x8(%rsp), %rcx
leaq 0x18eead(%rip), %rax    # 0x192b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd 0x10(%rax), %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 0x3262e99(%rip), %rax   # 0x3266b90
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 0x3fcf
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 0x90fda05(%rip), %rax   # 0x9101790
movl (%rax,%rcx,4), %eax
movl %eax, -0x8(%rsp)
movslq -0x8(%rsp), %rcx
leaq 0x18edb2(%rip), %rax    # 0x192b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd (%rax), %xmm0
vsubsd 0x28(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x10(%rsp)
movslq -0x8(%rsp), %rcx
leaq 0x18ed8f(%rip), %rax    # 0x192b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd 0x8(%rax), %xmm0
vsubsd 0x20(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x18(%rsp)
movslq -0x8(%rsp), %rcx
leaq 0x18ed6b(%rip), %rax    # 0x192b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd 0x10(%rax), %xmm0
vsubsd 0x18(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x20(%rsp)
vmovsd -0x70(%rsp), %xmm0
vmovsd 0x6225(%rip), %xmm1     # 0xa030
vucomisd %xmm1, %xmm0
jbe 0x3e16
jmp 0x3fbf
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 0xdc3ccd(%rip), %rax    # 0xdc7b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd (%rax), %xmm2
vmovq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
vmovq %rcx, %xmm1
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
vmovsd %xmm0, (%rax)
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x38(%rsp), %xmm0
movslq -0x44(%rsp), %rcx
leaq 0xdc3c8a(%rip), %rax    # 0xdc7b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd 0x8(%rax), %xmm2
vmovq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
vmovq %rcx, %xmm1
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
vmovsd %xmm0, 0x8(%rax)
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x40(%rsp), %xmm0
movslq -0x44(%rsp), %rcx
leaq 0xdc3c45(%rip), %rax    # 0xdc7b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd 0x10(%rax), %xmm2
vmovq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
vmovq %rcx, %xmm1
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
vmovsd %xmm0, 0x10(%rax)
vmovsd -0x70(%rsp), %xmm0
vmulsd -0x70(%rsp), %xmm0, %xmm0
vmulsd -0x70(%rsp), %xmm0, %xmm0
vmovsd %xmm0, -0x80(%rsp)
vmovsd -0x80(%rsp), %xmm1
vmovsd 0x60e2(%rip), %xmm2     # 0xa040
vmovsd 0x60e2(%rip), %xmm0     # 0xa048
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 0x60af(%rip), %xmm1     # 0xa038
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 0x3d06
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x30(%rsp), %xmm0
movslq -0x44(%rsp), %rcx
leaq 0xdc3b69(%rip), %rax    # 0xdc7b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd (%rax), %xmm2
vmovq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
vmovq %rcx, %xmm1
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
vmovsd %xmm0, (%rax)
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x38(%rsp), %xmm0
movslq -0x44(%rsp), %rcx
leaq 0xdc3b26(%rip), %rax    # 0xdc7b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd 0x8(%rax), %xmm2
vmovq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
vmovq %rcx, %xmm1
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
vmovsd %xmm0, 0x8(%rax)
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x40(%rsp), %xmm0
movslq -0x44(%rsp), %rcx
leaq 0xdc3ae1(%rip), %rax    # 0xdc7b50
shlq $0x5, %rcx
addq %rcx, %rax
vmovsd 0x10(%rax), %xmm2
vmovq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
vmovq %rcx, %xmm1
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
vmovsd %xmm0, 0x10(%rax)
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 0xdc3a91(%rip), %rax    # 0xdc7b50
shlq $0x5, %rcx
addq %rcx, %rax
vaddsd (%rax), %xmm0, %xmm0
vmovsd %xmm0, (%rax)
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 0xdc3a5f(%rip), %rax    # 0xdc7b50
shlq $0x5, %rcx
addq %rcx, %rax
vaddsd 0x8(%rax), %xmm0, %xmm0
vmovsd %xmm0, 0x8(%rax)
vmovsd (%rsp), %xmm2
vmovsd -0x28(%rsp), %xmm1
vmovsd -0x40(%rsp), %xmm0
vfmadd213sd %xmm2, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + xmm2
movslq 0x30(%rsp), %rcx
leaq 0xdc3a2c(%rip), %rax    # 0xdc7b50
shlq $0x5, %rcx
addq %rcx, %rax
vaddsd 0x10(%rax), %xmm0, %xmm0
vmovsd %xmm0, 0x10(%rax)
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x3ba6
addq $0x38, %rsp
retq
nopw (%rax,%rax)