#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define DIM 2 /* Two-dimensional system */
#define X 0   /* x-coordinate subscript */
#define Y 1   /* y-coordinate subscript */
#define START_TIMER \
   cudaEvent_t start = cudaEvent_t(); \
   cudaEvent_t stop = cudaEvent_t(); \
   cudaEventCreate(&start); \
   cudaEventCreate(&stop); \
   cudaEventRecord(start, 0);

#define END_TIMER \
   cudaEventRecord(stop, 0); \
   cudaEventSynchronize(stop); \
   cudaEventElapsedTime(time, start, stop); \
   cudaEventDestroy(start); \
   cudaEventDestroy(stop);

const int GRID_SIZE = 192;
const int BLOCK_SIZE = 128;

const double G = 6.673e-11;
const double ACCURACY = 0.01;

typedef double vect_t[DIM]; /* Vector type for position, etc. */

struct particle_s
{
   double m; /* Mass     */
   vect_t s; /* Position */
   vect_t v; /* Velocity */
};

void Get_args(int, char *[], int *, int *, double *, int *, char *);
void Get_init_cond(struct particle_s*, int);
void Gen_init_cond(struct particle_s[], int);
void Compute_force(int, vect_t*, struct particle_s*, int);
void Update_part(int, vect_t*, struct particle_s*, int, double);
void Compute_energy(struct particle_s*, int, double *, double *);
void sequential(struct particle_s *, double *, double *, int, int, double, float *);
void parallel_compute_forces(vect_t*, struct particle_s*, int);
void parallel_update_parts(vect_t*, struct particle_s*, int, double);
void parallel_compute_energy(struct particle_s*, int, double *, double *);
void parallel(struct particle_s *, double *, double *, int n, int, double, float *);
int verify_solution(int, struct particle_s*, struct particle_s*, double, double, double, double);
int is_close(double, double, double);
__device__ void indexes(unsigned, unsigned, unsigned*, unsigned*);

int main(int argc, char *argv[])
{
   int n;                   /* Number of particles          */
   int n_steps;             /* Number of timesteps          */
   int output_freq;         /* Frequency of output          */
   double delta_t;           /* Size of timestep             */
   struct particle_s *sequential_curr, *parallel_curr;
   char g_i;                /* Generate or input init conds */
   double sequential_kinetic_energy, sequential_potential_energy;
   double parallel_kinetic_energy, parallel_potential_energy;
   float sequential_time, parallel_time;

   Get_args(argc, argv, &n, &n_steps, &delta_t, &output_freq, &g_i);
   sequential_curr = (struct particle_s*)malloc(n * sizeof(struct particle_s));
   parallel_curr = (struct particle_s*)malloc(n * sizeof(struct particle_s));
   if (g_i == 'i')
      Get_init_cond(sequential_curr, n);
   else
      Gen_init_cond(sequential_curr, n);
   memcpy(parallel_curr, sequential_curr, n * sizeof(struct particle_s));

   sequential(sequential_curr, &sequential_kinetic_energy, &sequential_potential_energy, n, n_steps, delta_t, &sequential_time);
   parallel(parallel_curr, &parallel_kinetic_energy, &parallel_potential_energy, n, n_steps, delta_t, &parallel_time);
   printf("Sequential time: %.15f ms\n", sequential_time);
   printf("Parallel time: %.15f ms\n", parallel_time);
   printf("Speedup: %.15f\n", sequential_time / parallel_time);

   if(verify_solution(n, sequential_curr, parallel_curr, sequential_kinetic_energy, parallel_kinetic_energy, sequential_potential_energy, parallel_potential_energy))
      printf("TEST PASSED\n");
   else
      printf("TEST FAILED\n");

   free(sequential_curr);
   free(parallel_curr);
   return 0;
} /* main */

void Get_args(int argc, char *argv[], int *n_p, int *n_steps_p, double *delta_t_p, int *output_freq_p, char *g_i_p)
{
   if (argc != 6)
      printf("Bad arguments\n");
   *n_p = strtol(argv[1], NULL, 10);
   *n_steps_p = strtol(argv[2], NULL, 10);
   *delta_t_p = strtod(argv[3], NULL);
   *output_freq_p = strtol(argv[4], NULL, 10);
   *g_i_p = argv[5][0];

   if (*n_p <= 0 || *n_steps_p < 0 || *delta_t_p <= 0)
      printf("Bad arguments\n");
   if (*g_i_p != 'g' && *g_i_p != 'i')
      printf("Bad arguments\n");

} /* Get_args */

void Get_init_cond(struct particle_s* curr, int n)
{
   int part;

   printf("For each particle, enter (in order):\n");
   printf("   its mass, its x-coord, its y-coord, ");
   printf("its x-velocity, its y-velocity\n");
   for (part = 0; part < n; part++)
   {
      scanf("%lf", &curr[part].m);
      scanf("%lf", &curr[part].s[X]);
      scanf("%lf", &curr[part].s[Y]);
      scanf("%lf", &curr[part].v[X]);
      scanf("%lf", &curr[part].v[Y]);
   }
} /* Get_init_cond */

void Gen_init_cond(struct particle_s* curr, int n)
{
   int part;
   double mass = 5.0e24;
   double gap = 1.0e5;
   double speed = 3.0e4;

   for (part = 0; part < n; part++)
   {
      curr[part].m = mass;
      curr[part].s[X] = part * gap;
      curr[part].s[Y] = 0.0;
      curr[part].v[X] = 0.0;
      if (part % 2 == 0)
         curr[part].v[Y] = speed;
      else
         curr[part].v[Y] = -speed;
   }
} /* Gen_init_cond */

void Compute_force(int part, vect_t* forces, struct particle_s* curr, int n)
{
   int k;
   double mg;
   vect_t f_part_k;
   double len, len_3, fact;

   for (k = part + 1; k < n; k++)
   {
      f_part_k[X] = curr[part].s[X] - curr[k].s[X];
      f_part_k[Y] = curr[part].s[Y] - curr[k].s[Y];
      len = sqrt(f_part_k[X] * f_part_k[X] + f_part_k[Y] * f_part_k[Y]);
      len_3 = len * len * len;
      mg = -G * curr[part].m * curr[k].m;
      fact = mg / len_3;
      f_part_k[X] *= fact;
      f_part_k[Y] *= fact;

      forces[part][X] += f_part_k[X];
      forces[part][Y] += f_part_k[Y];
      forces[k][X] -= f_part_k[X];
      forces[k][Y] -= f_part_k[Y];
   }
} /* Compute_force */

void Update_part(int part, vect_t* forces, struct particle_s* curr, int n, double delta_t)
{
   double fact = delta_t / curr[part].m;

   curr[part].s[X] += delta_t * curr[part].v[X];
   curr[part].s[Y] += delta_t * curr[part].v[Y];
   curr[part].v[X] += fact * forces[part][X];
   curr[part].v[Y] += fact * forces[part][Y];
} /* Update_part */

void Compute_energy(struct particle_s* curr, int n, double *kin_en_p, double *pot_en_p)
{
   int i, j;
   vect_t diff;
   double pe = 0.0, ke = 0.0;
   double dist, speed_sqr;

   for (i = 0; i < n; i++)
   {
      speed_sqr = curr[i].v[X] * curr[i].v[X] + curr[i].v[Y] * curr[i].v[Y];
      ke += curr[i].m * speed_sqr;
   }
   ke *= 0.5;

   for (i = 0; i < n - 1; i++)
   {
      for (j = i + 1; j < n; j++)
      {
         diff[X] = curr[i].s[X] - curr[j].s[X];
         diff[Y] = curr[i].s[Y] - curr[j].s[Y];
         dist = sqrt(diff[X] * diff[X] + diff[Y] * diff[Y]);
         pe += -G * curr[i].m * curr[j].m / dist;
      }
   }

   *kin_en_p = ke;
   *pot_en_p = pe;
} /* Compute_energy */

void sequential(struct particle_s *curr, double* kinetic_energy, double* potential_energy, int n, int n_steps, double delta_t, float* time)
{
   START_TIMER
   vect_t *forces = (vect_t*)malloc(n * sizeof(vect_t));   
   Compute_energy(curr, n, kinetic_energy, potential_energy);
   printf("   PE = %e, KE = %e, Total Energy = %e\n", *potential_energy, *kinetic_energy, *kinetic_energy + *potential_energy);
   
   for (int step = 1; step <= n_steps; step++)
   {
      memset(forces, 0, n * sizeof(vect_t));
      for (int part = 0; part < n - 1; part++)
         Compute_force(part, forces, curr, n);
      for (int part = 0; part < n; part++)
         Update_part(part, forces, curr, n, delta_t);
   }

   Compute_energy(curr, n, kinetic_energy, potential_energy);
   printf("   PE = %e, KE = %e, Total Energy = %e\n", *potential_energy, *kinetic_energy, *kinetic_energy + *potential_energy);
   free(forces);
   END_TIMER
}

__global__ void kernel_forces(vect_t* forces, struct particle_s* curr, int n, vect_t* partial_forces)
{
   double mg;
   vect_t f_part_k;
   double len, len_3, fact;
   int idx = blockIdx.x * blockDim.x + threadIdx.x;
   vect_t to_add = {0, 0};
   struct particle_s my_curr = curr[idx];
   
   if(idx < n - 1)
   {
      for(int k = idx + 1; k < n; k++)
      {
         f_part_k[X] = my_curr.s[X] - curr[k].s[X];
         f_part_k[Y] = my_curr.s[Y] - curr[k].s[Y];
         len = sqrt(f_part_k[X] * f_part_k[X] + f_part_k[Y] * f_part_k[Y]);
         len_3 = len * len * len;
         mg = -G * my_curr.m * curr[k].m;
         fact = mg / len_3;
         f_part_k[X] *= fact;
         f_part_k[Y] *= fact;
   
         to_add[X] += f_part_k[X];
         to_add[Y] += f_part_k[Y];
         partial_forces[k * n + idx][X] = -f_part_k[X];
         partial_forces[k * n + idx][Y] = -f_part_k[Y];
      }
      forces[idx][X] += to_add[X];
      forces[idx][Y] += to_add[Y];
   }
}

__global__ void kernel_add_partials(int n, vect_t* forces, vect_t* partial_forces)
{
   int idx = blockIdx.x * blockDim.x + threadIdx.x;

   if(idx < n)
   {
      for(int j = 0; j < n; j++)
      {
         if(j != idx)
         {
            forces[idx][X] += partial_forces[idx * n + j][X];
            forces[idx][Y] += partial_forces[idx * n + j][Y];
         }
      }
   }
}

void parallel_compute_forces(vect_t* forces, struct particle_s* curr, int n, vect_t* partial_forces)
{
   int grid_size = (n + BLOCK_SIZE - 1) / BLOCK_SIZE;
   
   // cudaMemset(partial_forces, 0, n * n * sizeof(vect_t));

   kernel_forces<<<grid_size, BLOCK_SIZE>>>(forces, curr, n, partial_forces);
   kernel_add_partials<<<grid_size, BLOCK_SIZE>>>(n, forces, partial_forces);
}

__global__ void kernel_update(vect_t* forces, struct particle_s* curr, int n, double delta_t)
{
   int idx = blockIdx.x * blockDim.x + threadIdx.x;
   if(idx < n)
   {
      double fact = delta_t / curr[idx].m;
      curr[idx].s[X] += delta_t * curr[idx].v[X];
      curr[idx].s[Y] += delta_t * curr[idx].v[Y];
      curr[idx].v[X] += fact * forces[idx][X];
      curr[idx].v[Y] += fact * forces[idx][Y];
   }
}

void parallel_update_parts(vect_t* forces, struct particle_s* curr, int n, double delta_t)
{ // deluje da radi
   int grid_size = (n + BLOCK_SIZE - 1) / BLOCK_SIZE;
   kernel_update<<<grid_size, BLOCK_SIZE>>>(forces, curr, n, delta_t);
}

__global__ void kernel_kinetic_energy(double* partial_sums, int n, struct particle_s* curr)
{
   int idx = blockIdx.x * blockDim.x + threadIdx.x;
   for(int i = idx; i < n; i += gridDim.x * blockDim.x)
      partial_sums[idx] += curr[i].m * (curr[i].v[X] * curr[i].v[X] + curr[i].v[Y] * curr[i].v[Y]);
}

__global__ void kernel_potential_energy(double* partial_sums, int n, struct particle_s* curr)
{
   unsigned idx = blockIdx.x * blockDim.x + threadIdx.x, i, j;
   unsigned size = n * (n - 1) / 2;
   vect_t diff;
   double dist;
   for(unsigned k = idx; k < size; k += gridDim.x * blockDim.x) 
   {
      indexes(k, n - 1, &i, &j);
      j++;
      diff[X] = curr[i].s[X] - curr[j].s[X];
      diff[Y] = curr[i].s[Y] - curr[j].s[Y];
      dist = sqrt(diff[X] * diff[X] + diff[Y] * diff[Y]);
      partial_sums[idx] += -G * curr[i].m * curr[j].m / dist;
   }
}

void parallel_compute_energy(struct particle_s* curr, int n, double *kin_en_p, double *pot_en_p)
{ // deluje da radi
   int i;
   double pe = 0.0, ke = 0.0;
   double* partial_sums_device, *partial_sums_host;

   partial_sums_host = (double*)malloc(GRID_SIZE * BLOCK_SIZE * sizeof(double));
   cudaMalloc(&partial_sums_device, GRID_SIZE * BLOCK_SIZE * sizeof(double));
   
   cudaMemset(partial_sums_device, 0, GRID_SIZE * BLOCK_SIZE * sizeof(double));
   kernel_kinetic_energy<<<GRID_SIZE, BLOCK_SIZE>>>(partial_sums_device, n, curr);
   cudaMemcpy(partial_sums_host, partial_sums_device, GRID_SIZE * BLOCK_SIZE * sizeof(double), cudaMemcpyDeviceToHost);
   // razmisliti o redukciji na gpu
   for(i = 0; i < GRID_SIZE * BLOCK_SIZE; i++)
      ke += partial_sums_host[i];
   ke *= 0.5;

   cudaMemset(partial_sums_device, 0, GRID_SIZE * BLOCK_SIZE * sizeof(double));
   kernel_potential_energy<<<GRID_SIZE, BLOCK_SIZE>>>(partial_sums_device, n, curr);
   cudaMemcpy(partial_sums_host, partial_sums_device, GRID_SIZE * BLOCK_SIZE * sizeof(double), cudaMemcpyDeviceToHost);
   // razmisliti o redukciji na gpu
   for(i = 0; i < GRID_SIZE * BLOCK_SIZE; i++)
      pe += partial_sums_host[i];

   *kin_en_p = ke;
   *pot_en_p = pe;
   free(partial_sums_host);
   cudaFree(partial_sums_device);
}

void parallel(struct particle_s *curr, double* kinetic_energy, double* potential_energy, int n, int n_steps, double delta_t, float* time)
{
   START_TIMER
   vect_t *forces, *forces_device, *partial_forces;  
   struct particle_s* curr_device;

   forces = (vect_t*)malloc(n * sizeof(vect_t));
   cudaMalloc(&forces_device, n * sizeof(vect_t));
   cudaMalloc(&curr_device, n * sizeof(struct particle_s));
   cudaMalloc(&partial_forces, n * n * sizeof(vect_t));
   cudaMemcpy(forces_device, forces, n * sizeof(vect_t), cudaMemcpyHostToDevice);
   cudaMemcpy(curr_device, curr, n * sizeof(struct particle_s), cudaMemcpyHostToDevice);
   
   parallel_compute_energy(curr_device, n, kinetic_energy, potential_energy);
   printf("   PE = %e, KE = %e, Total Energy = %e\n", *potential_energy, *kinetic_energy, *kinetic_energy + *potential_energy);
   
   for (int step = 1; step <= n_steps; step++)
   {
      cudaMemset(forces_device, 0, n * sizeof(vect_t));
      parallel_compute_forces(forces_device, curr_device, n, partial_forces);
      parallel_update_parts(forces_device, curr_device, n, delta_t);
   }
   
   parallel_compute_energy(curr_device, n, kinetic_energy, potential_energy);
   printf("   PE = %e, KE = %e, Total Energy = %e\n", *potential_energy, *kinetic_energy, *kinetic_energy + *potential_energy);
   
   cudaMemcpy(curr, curr_device, n * sizeof(struct particle_s), cudaMemcpyDeviceToHost);
   cudaFree(forces_device);
   cudaFree(curr_device);
   cudaFree(partial_forces);
   free(forces);
   END_TIMER
}

int verify_solution(int n, struct particle_s curr_sequential[], struct particle_s curr_parallel[], double kinetic_energy_sequential, double kinetic_energy_parallel, double potential_energy_sequential, double potential_energy_parallel)
{
   if (!is_close(kinetic_energy_sequential, kinetic_energy_parallel, ACCURACY))
      return 0;
   if (!is_close(potential_energy_sequential, potential_energy_parallel, ACCURACY))
      return 0;
   for (int i = 0; i < n; i++)
   {
      if (!is_close(curr_sequential[i].m, curr_parallel[i].m, ACCURACY))
         return 0;
      for (int j = 0; j < DIM; j++)
      {
         if(!is_close(curr_sequential[i].s[j], curr_parallel[i].s[j], ACCURACY))
            return 0;
         if(!is_close(curr_sequential[i].v[j], curr_parallel[i].v[j], ACCURACY))
            return 0;
      }
   }
   return 1;
}

inline int is_close(double first, double second, double accuracy)
{
   return (fabs(1 - second / first) < accuracy);
}

__device__ void indexes(unsigned k, unsigned N, unsigned* row_ptr, unsigned* col_ptr)
{
    double n = N;
    double row = (-2 * n - 1 + sqrt((4 * n * (n + 1) - 8 * (double)k - 7))) / -2;
    if (row == (double)(int)row)
        row -= 1;
    *row_ptr = (unsigned)row;
    *col_ptr = k - N * *row_ptr + *row_ptr * (*row_ptr + 1) / 2;
}
	.file	"tmpxft_00370bfa_00000000-6_dz4z3.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2044:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2044:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Bad arguments\n"
	.text
	.globl	_Z8Get_argsiPPcPiS1_PdS1_S_
	.type	_Z8Get_argsiPPcPiS1_PdS1_S_, @function
_Z8Get_argsiPPcPiS1_PdS1_S_:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r9, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rcx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r8, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	pushq	%r10
	.cfi_def_cfa_offset 64
	movq	64(%rsp), %r15
	cmpl	$6, %edi
	je	.L3
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L3:
	movq	8(%rbx), %rdi
	xorl	%esi, %esi
	movl	$10, %edx
	call	__isoc23_strtol@PLT
	movq	16(%rbx), %rdi
	movl	$10, %edx
	xorl	%esi, %esi
	movl	%eax, 0(%r13)
	call	__isoc23_strtol@PLT
	movq	24(%rbx), %rdi
	xorl	%esi, %esi
	movl	%eax, (%r12)
	call	strtod@PLT
	movq	32(%rbx), %rdi
	xorl	%esi, %esi
	movl	$10, %edx
	movsd	%xmm0, 0(%rbp)
	call	__isoc23_strtol@PLT
	movl	%eax, (%r14)
	movq	40(%rbx), %rax
	movb	(%rax), %al
	movb	%al, (%r15)
	cmpl	$0, 0(%r13)
	jle	.L4
	cmpl	$0, (%r12)
	js	.L4
	xorps	%xmm0, %xmm0
	comisd	0(%rbp), %xmm0
	jb	.L5
.L4:
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movb	(%r15), %al
	subl	$103, %eax
	testb	$-3, %al
	je	.L2
	popq	%rdx
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	leaq	.LC0(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 48
	movl	$2, %edi
	popq	%rbp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
.L2:
	.cfi_restore_state
	popq	%rax
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z8Get_argsiPPcPiS1_PdS1_S_, .-_Z8Get_argsiPPcPiS1_PdS1_S_
	.section	.rodata.str1.1
.LC2:
	.string	"For each particle, enter (in order):\n"
.LC3:
	.string	"   its mass, its x-coord, its y-coord, "
.LC4:
	.string	"its x-velocity, its y-velocity\n"
.LC5:
	.string	"%lf"
	.text
	.globl	_Z13Get_init_condP10particle_si
	.type	_Z13Get_init_condP10particle_si, @function
_Z13Get_init_condP10particle_si:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%esi, %r13d
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC5(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	movl	$2, %edi
	pushq	%rdx
	.cfi_def_cfa_offset 48
	call	__printf_chk@PLT
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L14:
	cmpl	%r13d, %ebp
	jge	.L17
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	incl	%ebp
	call	__isoc23_scanf@PLT
	leaq	8(%rbx), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	leaq	16(%rbx), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	leaq	24(%rbx), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	leaq	32(%rbx), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	addq	$40, %rbx
	jmp	.L14
.L17:
	popq	%rax
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z13Get_init_condP10particle_si, .-_Z13Get_init_condP10particle_si
	.globl	_Z13Gen_init_condP10particle_si
	.type	_Z13Gen_init_condP10particle_si, @function
_Z13Gen_init_condP10particle_si:
.LFB2030:
	.cfi_startproc
	endbr64
	movsd	.LC8(%rip), %xmm1
	movsd	.LC9(%rip), %xmm2
	xorl	%eax, %eax
.L19:
	cmpl	%esi, %eax
	jge	.L23
	cvtsi2sdl	%eax, %xmm0
	movq	$0x000000000, 16(%rdi)
	movq	$0x000000000, 24(%rdi)
	movsd	%xmm1, (%rdi)
	mulsd	%xmm2, %xmm0
	movsd	%xmm0, 8(%rdi)
	movsd	.LC7(%rip), %xmm0
	testb	$1, %al
	jne	.L20
	movsd	.LC6(%rip), %xmm0
.L20:
	movsd	%xmm0, 32(%rdi)
	incl	%eax
	addq	$40, %rdi
	jmp	.L19
.L23:
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z13Gen_init_condP10particle_si, .-_Z13Gen_init_condP10particle_si
	.globl	_Z13Compute_forceiPA2_dP10particle_si
	.type	_Z13Compute_forceiPA2_dP10particle_si, @function
_Z13Compute_forceiPA2_dP10particle_si:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leal	1(%rdi), %r15d
	movslq	%edi, %rdi
	imulq	$40, %rdi, %rax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	salq	$4, %rdi
	movl	%ecx, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	(%rdx,%rax), %r12
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	(%rsi,%rdi), %rbx
	movq	%r12, %r13
	movq	%rbx, %rbp
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
.L25:
	addq	$40, %r13
	addq	$16, %rbp
	cmpl	%r14d, %r15d
	jge	.L28
	movsd	8(%r12), %xmm2
	movsd	16(%r12), %xmm1
	incl	%r15d
	subsd	8(%r13), %xmm2
	subsd	16(%r13), %xmm1
	movaps	%xmm2, %xmm0
	movaps	%xmm1, %xmm3
	movsd	%xmm2, 8(%rsp)
	mulsd	%xmm1, %xmm3
	movsd	%xmm1, (%rsp)
	mulsd	%xmm2, %xmm0
	addsd	%xmm3, %xmm0
	call	sqrt@PLT
	movsd	8(%rsp), %xmm2
	movsd	(%rsp), %xmm1
	movaps	%xmm0, %xmm4
	movsd	.LC10(%rip), %xmm0
	mulsd	(%r12), %xmm0
	movaps	%xmm4, %xmm3
	mulsd	%xmm4, %xmm3
	mulsd	0(%r13), %xmm0
	mulsd	%xmm4, %xmm3
	divsd	%xmm3, %xmm0
	mulsd	%xmm0, %xmm2
	mulsd	%xmm0, %xmm1
	movsd	(%rbx), %xmm0
	addsd	%xmm2, %xmm0
	movsd	%xmm0, (%rbx)
	movsd	8(%rbx), %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, 8(%rbx)
	movsd	0(%rbp), %xmm0
	subsd	%xmm2, %xmm0
	movsd	%xmm0, 0(%rbp)
	movsd	8(%rbp), %xmm0
	subsd	%xmm1, %xmm0
	movsd	%xmm0, 8(%rbp)
	jmp	.L25
.L28:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z13Compute_forceiPA2_dP10particle_si, .-_Z13Compute_forceiPA2_dP10particle_si
	.globl	_Z11Update_partiPA2_dP10particle_sid
	.type	_Z11Update_partiPA2_dP10particle_sid, @function
_Z11Update_partiPA2_dP10particle_sid:
.LFB2032:
	.cfi_startproc
	endbr64
	movslq	%edi, %rdi
	movaps	%xmm0, %xmm1
	imulq	$40, %rdi, %rax
	salq	$4, %rdi
	addq	%rdi, %rsi
	addq	%rax, %rdx
	movsd	24(%rdx), %xmm3
	divsd	(%rdx), %xmm1
	movaps	%xmm3, %xmm2
	mulsd	%xmm0, %xmm2
	addsd	8(%rdx), %xmm2
	movsd	%xmm2, 8(%rdx)
	movsd	32(%rdx), %xmm2
	mulsd	%xmm2, %xmm0
	addsd	16(%rdx), %xmm0
	movsd	%xmm0, 16(%rdx)
	movsd	(%rsi), %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	8(%rsi), %xmm1
	addsd	%xmm3, %xmm0
	addsd	%xmm2, %xmm1
	movsd	%xmm0, 24(%rdx)
	movsd	%xmm1, 32(%rdx)
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z11Update_partiPA2_dP10particle_sid, .-_Z11Update_partiPA2_dP10particle_sid
	.globl	_Z14Compute_energyP10particle_siPdS1_
	.type	_Z14Compute_energyP10particle_siPdS1_, @function
_Z14Compute_energyP10particle_siPdS1_:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdi, %rax
	movq	%rdx, %r15
	xorps	%xmm1, %xmm1
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	xorl	%edx, %edx
	movq	%rcx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
.L31:
	cmpl	%ebp, %edx
	jge	.L38
	movsd	24(%rax), %xmm0
	movsd	32(%rax), %xmm2
	incl	%edx
	addq	$40, %rax
	mulsd	%xmm0, %xmm0
	mulsd	%xmm2, %xmm2
	addsd	%xmm2, %xmm0
	mulsd	-40(%rax), %xmm0
	addsd	%xmm0, %xmm1
	jmp	.L31
.L38:
	movsd	.LC11(%rip), %xmm2
	xorps	%xmm3, %xmm3
	xorl	%r13d, %r13d
	mulsd	%xmm1, %xmm2
.L33:
	leal	-1(%rbp), %eax
	cmpl	%r13d, %eax
	jle	.L39
	incl	%r13d
	movq	%rbx, %r12
	movl	%r13d, %eax
.L34:
	addq	$40, %r12
	cmpl	%ebp, %eax
	je	.L40
	movsd	8(%rbx), %xmm0
	movsd	16(%rbx), %xmm1
	movl	%eax, 12(%rsp)
	subsd	8(%r12), %xmm0
	subsd	16(%r12), %xmm1
	movsd	%xmm2, 24(%rsp)
	movsd	%xmm3, 16(%rsp)
	mulsd	%xmm1, %xmm1
	mulsd	%xmm0, %xmm0
	addsd	%xmm1, %xmm0
	call	sqrt@PLT
	movsd	16(%rsp), %xmm3
	movl	12(%rsp), %eax
	movaps	%xmm0, %xmm1
	movsd	.LC10(%rip), %xmm0
	movsd	24(%rsp), %xmm2
	mulsd	(%rbx), %xmm0
	incl	%eax
	mulsd	(%r12), %xmm0
	divsd	%xmm1, %xmm0
	addsd	%xmm0, %xmm3
	jmp	.L34
.L40:
	addq	$40, %rbx
	jmp	.L33
.L39:
	movsd	%xmm2, (%r15)
	movsd	%xmm3, (%r14)
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2033:
	.size	_Z14Compute_energyP10particle_siPdS1_, .-_Z14Compute_energyP10particle_siPdS1_
	.section	.rodata.str1.1
.LC12:
	.string	"   PE = %e, KE = %e, Total Energy = %e\n"
	.text
	.globl	_Z10sequentialP10particle_sPdS1_iidPf
	.type	_Z10sequentialP10particle_sPdS1_iidPf, @function
_Z10sequentialP10particle_sPdS1_iidPf:
.LFB2034:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	$1, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%r8d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%ecx, %ebx
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%r9, 32(%rsp)
	movq	%rdi, 8(%rsp)
	leaq	56(%rsp), %rdi
	movsd	%xmm0, 24(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movq	%rax, 56(%rsp)
	movq	%rax, 64(%rsp)
	call	cudaEventCreate@PLT
	leaq	64(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movslq	%ebx, %rax
	salq	$4, %rax
	movq	%rax, %rdi
	movq	%rax, 16(%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rdi
	movq	%rbp, %rcx
	movq	%r12, %rdx
	movl	%ebx, %esi
	movq	%rax, (%rsp)
	call	_Z14Compute_energyP10particle_siPdS1_
	movsd	(%r12), %xmm1
	movsd	0(%rbp), %xmm0
	movb	$3, %al
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	movaps	%xmm1, %xmm2
	addsd	%xmm0, %xmm2
	call	__printf_chk@PLT
	leal	-1(%rbx), %eax
	movl	%eax, 44(%rsp)
.L42:
	cmpl	%r13d, %r14d
	jg	.L50
	movq	16(%rsp), %rcx
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	xorl	%r15d, %r15d
	movq	%rcx, %rdx
	call	__memset_chk@PLT
.L43:
	cmpl	%r15d, 44(%rsp)
	jle	.L51
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movl	%r15d, %edi
	movl	%ebx, %ecx
	incl	%r15d
	call	_Z13Compute_forceiPA2_dP10particle_si
	jmp	.L43
.L51:
	xorl	%r8d, %r8d
.L45:
	cmpl	%ebx, %r8d
	jge	.L52
	movsd	24(%rsp), %xmm0
	movq	8(%rsp), %rdx
	movl	%r8d, %edi
	movl	%ebx, %ecx
	movq	(%rsp), %rsi
	incl	%r8d
	call	_Z11Update_partiPA2_dP10particle_sid
	jmp	.L45
.L52:
	incl	%r14d
	jmp	.L42
.L50:
	movq	8(%rsp), %rdi
	movq	%rbp, %rcx
	movq	%r12, %rdx
	movl	%ebx, %esi
	call	_Z14Compute_energyP10particle_siPdS1_
	movsd	(%r12), %xmm1
	movsd	0(%rbp), %xmm0
	movb	$3, %al
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	movaps	%xmm1, %xmm2
	addsd	%xmm0, %xmm2
	call	__printf_chk@PLT
	movq	(%rsp), %rdi
	call	free@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	64(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	64(%rsp), %rdx
	movq	56(%rsp), %rsi
	movq	32(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	56(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	64(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L48
	call	__stack_chk_fail@PLT
.L48:
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2034:
	.size	_Z10sequentialP10particle_sPdS1_iidPf, .-_Z10sequentialP10particle_sPdS1_iidPf
	.globl	_Z15verify_solutioniP10particle_sS0_dddd
	.type	_Z15verify_solutioniP10particle_sS0_dddd, @function
_Z15verify_solutioniP10particle_sS0_dddd:
.LFB2039:
	.cfi_startproc
	endbr64
	divsd	%xmm0, %xmm1
	movsd	.LC13(%rip), %xmm0
	movsd	.LC15(%rip), %xmm4
	movl	%edi, %eax
	movaps	%xmm0, %xmm5
	subsd	%xmm1, %xmm5
	movq	.LC14(%rip), %xmm1
	andps	%xmm1, %xmm5
	comisd	%xmm5, %xmm4
	jbe	.L84
	divsd	%xmm2, %xmm3
	movaps	%xmm0, %xmm2
	xorl	%ecx, %ecx
	subsd	%xmm3, %xmm2
	andps	%xmm1, %xmm2
	comisd	%xmm2, %xmm4
	jbe	.L84
.L57:
	cmpl	%eax, %ecx
	jge	.L85
	movaps	%xmm0, %xmm2
	movsd	(%rdx), %xmm3
	divsd	(%rsi), %xmm3
	movq	%rdx, %r8
	subsd	%xmm3, %xmm2
	movq	%rsi, %rdi
	andps	%xmm1, %xmm2
	comisd	%xmm2, %xmm4
	jbe	.L84
	movaps	%xmm0, %xmm2
	movsd	8(%rdx), %xmm3
	divsd	8(%rsi), %xmm3
	subsd	%xmm3, %xmm2
	andps	%xmm1, %xmm2
	comisd	%xmm2, %xmm4
	jbe	.L84
	movaps	%xmm0, %xmm2
	movsd	24(%rdx), %xmm3
	divsd	24(%rsi), %xmm3
	subsd	%xmm3, %xmm2
	andps	%xmm1, %xmm2
	comisd	%xmm2, %xmm4
	jbe	.L84
	movaps	%xmm0, %xmm2
	movsd	16(%rdx), %xmm3
	divsd	16(%rsi), %xmm3
	subsd	%xmm3, %xmm2
	andps	%xmm1, %xmm2
	comisd	%xmm2, %xmm4
	jbe	.L84
	movaps	%xmm0, %xmm2
	movsd	32(%r8), %xmm3
	addq	$40, %rdx
	addq	$40, %rsi
	divsd	32(%rdi), %xmm3
	subsd	%xmm3, %xmm2
	andps	%xmm1, %xmm2
	comisd	%xmm2, %xmm4
	jbe	.L84
	incl	%ecx
	jmp	.L57
.L85:
	movl	$1, %eax
	ret
.L84:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE2039:
	.size	_Z15verify_solutioniP10particle_sS0_dddd, .-_Z15verify_solutioniP10particle_sS0_dddd
	.globl	_Z7indexesjjPjS_
	.type	_Z7indexesjjPjS_, @function
_Z7indexesjjPjS_:
.LFB2041:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE2041:
	.size	_Z7indexesjjPjS_, .-_Z7indexesjjPjS_
	.globl	_Z53__device_stub__Z13kernel_forcesPA2_dP10particle_siS0_PA2_dP10particle_siS0_
	.type	_Z53__device_stub__Z13kernel_forcesPA2_dP10particle_siS0_PA2_dP10particle_siS0_, @function
_Z53__device_stub__Z13kernel_forcesPA2_dP10particle_siS0_PA2_dP10particle_siS0_:
.LFB2066:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L88
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z13kernel_forcesPA2_dP10particle_siS0_(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L88:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L90
	call	__stack_chk_fail@PLT
.L90:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2066:
	.size	_Z53__device_stub__Z13kernel_forcesPA2_dP10particle_siS0_PA2_dP10particle_siS0_, .-_Z53__device_stub__Z13kernel_forcesPA2_dP10particle_siS0_PA2_dP10particle_siS0_
	.globl	_Z13kernel_forcesPA2_dP10particle_siS0_
	.type	_Z13kernel_forcesPA2_dP10particle_siS0_, @function
_Z13kernel_forcesPA2_dP10particle_siS0_:
.LFB2067:
	.cfi_startproc
	endbr64
	jmp	_Z53__device_stub__Z13kernel_forcesPA2_dP10particle_siS0_PA2_dP10particle_siS0_
	.cfi_endproc
.LFE2067:
	.size	_Z13kernel_forcesPA2_dP10particle_siS0_, .-_Z13kernel_forcesPA2_dP10particle_siS0_
	.globl	_Z46__device_stub__Z19kernel_add_partialsiPA2_dS0_iPA2_dS0_
	.type	_Z46__device_stub__Z19kernel_add_partialsiPA2_dS0_iPA2_dS0_, @function
_Z46__device_stub__Z19kernel_add_partialsiPA2_dS0_iPA2_dS0_:
.LFB2068:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movl	%edi, 28(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L93
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z19kernel_add_partialsiPA2_dS0_(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L93:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L95
	call	__stack_chk_fail@PLT
.L95:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2068:
	.size	_Z46__device_stub__Z19kernel_add_partialsiPA2_dS0_iPA2_dS0_, .-_Z46__device_stub__Z19kernel_add_partialsiPA2_dS0_iPA2_dS0_
	.globl	_Z19kernel_add_partialsiPA2_dS0_
	.type	_Z19kernel_add_partialsiPA2_dS0_, @function
_Z19kernel_add_partialsiPA2_dS0_:
.LFB2069:
	.cfi_startproc
	endbr64
	jmp	_Z46__device_stub__Z19kernel_add_partialsiPA2_dS0_iPA2_dS0_
	.cfi_endproc
.LFE2069:
	.size	_Z19kernel_add_partialsiPA2_dS0_, .-_Z19kernel_add_partialsiPA2_dS0_
	.globl	_Z23parallel_compute_forcesPA2_dP10particle_siS0_
	.type	_Z23parallel_compute_forcesPA2_dP10particle_siS0_, @function
_Z23parallel_compute_forcesPA2_dP10particle_siS0_:
.LFB2035:
	.cfi_startproc
	endbr64
	leal	127(%rdx), %eax
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rsi, %r14
	movl	$128, %esi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rcx, %r13
	movl	$33554433, %ecx
	xorl	%r9d, %r9d
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	salq	$7, %rcx
	movq	%rdi, %r12
	xorl	%r8d, %r8d
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movl	%edx, %ebx
	cltd
	idivl	%esi
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%rcx, %rdx
	movq	%rcx, 20(%rsp)
	movl	$1, %ecx
	movl	$1, 28(%rsp)
	movl	%eax, 8(%rsp)
	movl	%eax, %ebp
	movabsq	$4294967297, %rax
	movq	%rax, 12(%rsp)
	movq	8(%rsp), %rdi
	movl	16(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L99
	movq	%r13, %rcx
	movl	%ebx, %edx
	movq	%r14, %rsi
	movq	%r12, %rdi
	call	_Z53__device_stub__Z13kernel_forcesPA2_dP10particle_siS0_PA2_dP10particle_siS0_
.L99:
	movl	%ebp, 8(%rsp)
	movl	$33554433, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movabsq	$4294967297, %rax
	salq	$7, %rdx
	movl	$1, %ecx
	movl	$1, 28(%rsp)
	movq	%rax, 12(%rsp)
	movq	8(%rsp), %rdi
	movl	16(%rsp), %esi
	movq	%rdx, 20(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L98
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	movq	%r13, %rdx
	movq	%r12, %rsi
	movl	%ebx, %edi
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_Z46__device_stub__Z19kernel_add_partialsiPA2_dS0_iPA2_dS0_
.L98:
	.cfi_restore_state
	addq	$32, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2035:
	.size	_Z23parallel_compute_forcesPA2_dP10particle_siS0_, .-_Z23parallel_compute_forcesPA2_dP10particle_siS0_
	.globl	_Z51__device_stub__Z13kernel_updatePA2_dP10particle_sidPA2_dP10particle_sid
	.type	_Z51__device_stub__Z13kernel_updatePA2_dP10particle_sidPA2_dP10particle_sid, @function
_Z51__device_stub__Z13kernel_updatePA2_dP10particle_sidPA2_dP10particle_sid:
.LFB2070:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rcx
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movsd	%xmm0, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L102
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z13kernel_updatePA2_dP10particle_sid(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L102:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L104
	call	__stack_chk_fail@PLT
.L104:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2070:
	.size	_Z51__device_stub__Z13kernel_updatePA2_dP10particle_sidPA2_dP10particle_sid, .-_Z51__device_stub__Z13kernel_updatePA2_dP10particle_sidPA2_dP10particle_sid
	.globl	_Z13kernel_updatePA2_dP10particle_sid
	.type	_Z13kernel_updatePA2_dP10particle_sid, @function
_Z13kernel_updatePA2_dP10particle_sid:
.LFB2071:
	.cfi_startproc
	endbr64
	jmp	_Z51__device_stub__Z13kernel_updatePA2_dP10particle_sidPA2_dP10particle_sid
	.cfi_endproc
.LFE2071:
	.size	_Z13kernel_updatePA2_dP10particle_sid, .-_Z13kernel_updatePA2_dP10particle_sid
	.globl	_Z21parallel_update_partsPA2_dP10particle_sid
	.type	_Z21parallel_update_partsPA2_dP10particle_sid, @function
_Z21parallel_update_partsPA2_dP10particle_sid:
.LFB2036:
	.cfi_startproc
	endbr64
	leal	127(%rdx), %eax
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	$128, %ecx
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdi, %rbp
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	%edx, %ebx
	cltd
	idivl	%ecx
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movl	$33554433, %edx
	movl	$1, %ecx
	salq	$7, %rdx
	movsd	%xmm0, 8(%rsp)
	movl	%eax, 24(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 28(%rsp)
	movq	24(%rsp), %rdi
	movl	32(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	movsd	8(%rsp), %xmm0
	testl	%eax, %eax
	jne	.L107
	addq	$48, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	movl	%ebx, %edx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	_Z51__device_stub__Z13kernel_updatePA2_dP10particle_sidPA2_dP10particle_sid
.L107:
	.cfi_restore_state
	addq	$48, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2036:
	.size	_Z21parallel_update_partsPA2_dP10particle_sid, .-_Z21parallel_update_partsPA2_dP10particle_sid
	.globl	_Z55__device_stub__Z21kernel_kinetic_energyPdiP10particle_sPdiP10particle_s
	.type	_Z55__device_stub__Z21kernel_kinetic_energyPdiP10particle_sPdiP10particle_s, @function
_Z55__device_stub__Z21kernel_kinetic_energyPdiP10particle_sPdiP10particle_s:
.LFB2072:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L110
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z21kernel_kinetic_energyPdiP10particle_s(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L110:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L112
	call	__stack_chk_fail@PLT
.L112:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2072:
	.size	_Z55__device_stub__Z21kernel_kinetic_energyPdiP10particle_sPdiP10particle_s, .-_Z55__device_stub__Z21kernel_kinetic_energyPdiP10particle_sPdiP10particle_s
	.globl	_Z21kernel_kinetic_energyPdiP10particle_s
	.type	_Z21kernel_kinetic_energyPdiP10particle_s, @function
_Z21kernel_kinetic_energyPdiP10particle_s:
.LFB2073:
	.cfi_startproc
	endbr64
	jmp	_Z55__device_stub__Z21kernel_kinetic_energyPdiP10particle_sPdiP10particle_s
	.cfi_endproc
.LFE2073:
	.size	_Z21kernel_kinetic_energyPdiP10particle_s, .-_Z21kernel_kinetic_energyPdiP10particle_s
	.globl	_Z57__device_stub__Z23kernel_potential_energyPdiP10particle_sPdiP10particle_s
	.type	_Z57__device_stub__Z23kernel_potential_energyPdiP10particle_sPdiP10particle_s, @function
_Z57__device_stub__Z23kernel_potential_energyPdiP10particle_sPdiP10particle_s:
.LFB2074:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L115
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z23kernel_potential_energyPdiP10particle_s(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L115:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L117
	call	__stack_chk_fail@PLT
.L117:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2074:
	.size	_Z57__device_stub__Z23kernel_potential_energyPdiP10particle_sPdiP10particle_s, .-_Z57__device_stub__Z23kernel_potential_energyPdiP10particle_sPdiP10particle_s
	.globl	_Z23kernel_potential_energyPdiP10particle_s
	.type	_Z23kernel_potential_energyPdiP10particle_s, @function
_Z23kernel_potential_energyPdiP10particle_s:
.LFB2075:
	.cfi_startproc
	endbr64
	jmp	_Z57__device_stub__Z23kernel_potential_energyPdiP10particle_sPdiP10particle_s
	.cfi_endproc
.LFE2075:
	.size	_Z23kernel_potential_energyPdiP10particle_s, .-_Z23kernel_potential_energyPdiP10particle_s
	.globl	_Z23parallel_compute_energyP10particle_siPdS1_
	.type	_Z23parallel_compute_energyP10particle_siPdS1_, @function
_Z23parallel_compute_energyP10particle_siPdS1_:
.LFB2037:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	movl	$196608, %edi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rcx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	leaq	8(%rsp), %rdi
	movl	$196608, %esi
	movq	%rax, %rbx
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	movl	$196608, %edx
	call	cudaMemset@PLT
	movl	$33554433, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$67108867, %edi
	salq	$7, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	salq	$6, %rdi
	movq	%rdx, 28(%rsp)
	movl	$1, 36(%rsp)
	movq	%rdi, 16(%rsp)
	movl	$1, 24(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L121
	movq	8(%rsp), %rdi
	movq	%r14, %rdx
	movl	%ebp, %esi
	call	_Z55__device_stub__Z21kernel_kinetic_energyPdiP10particle_sPdiP10particle_s
.L121:
	movq	8(%rsp), %rsi
	movl	$2, %ecx
	movl	$196608, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	xorl	%eax, %eax
	xorps	%xmm0, %xmm0
.L122:
	addsd	(%rbx,%rax,8), %xmm0
	incq	%rax
	cmpq	$24576, %rax
	jne	.L122
	mulsd	.LC11(%rip), %xmm0
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	movl	$196608, %edx
	movq	%xmm0, %r15
	call	cudaMemset@PLT
	movl	$33554433, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$67108867, %edi
	salq	$7, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	salq	$6, %rdi
	movq	%rdx, 28(%rsp)
	movl	$1, 36(%rsp)
	movq	%rdi, 16(%rsp)
	movl	$1, 24(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L123
	movq	8(%rsp), %rdi
	movq	%r14, %rdx
	movl	%ebp, %esi
	call	_Z57__device_stub__Z23kernel_potential_energyPdiP10particle_sPdiP10particle_s
.L123:
	movq	8(%rsp), %rsi
	movl	$2, %ecx
	movl	$196608, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	xorl	%eax, %eax
	xorps	%xmm0, %xmm0
.L124:
	addsd	(%rbx,%rax,8), %xmm0
	incq	%rax
	cmpq	$24576, %rax
	jne	.L124
	movq	%r15, 0(%r13)
	movq	%rbx, %rdi
	movsd	%xmm0, (%r12)
	call	free@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L125
	call	__stack_chk_fail@PLT
.L125:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2037:
	.size	_Z23parallel_compute_energyP10particle_siPdS1_, .-_Z23parallel_compute_energyP10particle_siPdS1_
	.globl	_Z8parallelP10particle_sPdS1_iidPf
	.type	_Z8parallelP10particle_sPdS1_iidPf, @function
_Z8parallelP10particle_sPdS1_iidPf:
.LFB2038:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$1, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%r8d, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movslq	%ecx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rbx
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%r9, 40(%rsp)
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movsd	%xmm0, 32(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movq	%rax, 48(%rsp)
	movq	%rax, 56(%rsp)
	call	cudaEventCreate@PLT
	leaq	56(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	%rbp, %rax
	imulq	$40, %rbp, %rbp
	salq	$4, %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rsi
	leaq	64(%rsp), %rdi
	movq	%rax, 16(%rsp)
	call	cudaMalloc@PLT
	leaq	80(%rsp), %rdi
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	movl	%ebx, %esi
	leaq	72(%rsp), %rdi
	imull	%ebx, %esi
	movslq	%esi, %rsi
	salq	$4, %rsi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	$1, %ecx
	movq	64(%rsp), %rdi
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rsi
	movq	80(%rsp), %rdi
	movq	%rbp, %rdx
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	80(%rsp), %rdi
	movq	%r12, %rcx
	movq	%r13, %rdx
	movl	%ebx, %esi
	call	_Z23parallel_compute_energyP10particle_siPdS1_
	movsd	0(%r13), %xmm1
	movsd	(%r12), %xmm0
	movb	$3, %al
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	movaps	%xmm1, %xmm2
	addsd	%xmm0, %xmm2
	call	__printf_chk@PLT
.L130:
	cmpl	%r14d, %r15d
	jg	.L134
	movq	8(%rsp), %rdx
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	incl	%r15d
	call	cudaMemset@PLT
	movq	72(%rsp), %rcx
	movq	80(%rsp), %rsi
	movl	%ebx, %edx
	movq	64(%rsp), %rdi
	call	_Z23parallel_compute_forcesPA2_dP10particle_siS0_
	movsd	32(%rsp), %xmm0
	movq	80(%rsp), %rsi
	movl	%ebx, %edx
	movq	64(%rsp), %rdi
	call	_Z21parallel_update_partsPA2_dP10particle_sid
	jmp	.L130
.L134:
	movq	80(%rsp), %rdi
	movq	%r12, %rcx
	movq	%r13, %rdx
	movl	%ebx, %esi
	call	_Z23parallel_compute_energyP10particle_siPdS1_
	movsd	0(%r13), %xmm1
	movsd	(%r12), %xmm0
	movb	$3, %al
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	movaps	%xmm1, %xmm2
	addsd	%xmm0, %xmm2
	call	__printf_chk@PLT
	movq	80(%rsp), %rsi
	movq	24(%rsp), %rdi
	movq	%rbp, %rdx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	movq	40(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	48(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	56(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L132
	call	__stack_chk_fail@PLT
.L132:
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2038:
	.size	_Z8parallelP10particle_sPdS1_iidPf, .-_Z8parallelP10particle_sPdS1_iidPf
	.section	.rodata.str1.1
.LC16:
	.string	"Sequential time: %.15f ms\n"
.LC17:
	.string	"Parallel time: %.15f ms\n"
.LC18:
	.string	"Speedup: %.15f\n"
.LC19:
	.string	"TEST PASSED\n"
.LC20:
	.string	"TEST FAILED\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$104, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rcx
	leaq	28(%rsp), %rdx
	pushq	%rax
	.cfi_def_cfa_offset 152
	leaq	35(%rsp), %rax
	pushq	%rax
	.cfi_def_cfa_offset 160
	leaq	52(%rsp), %r9
	leaq	64(%rsp), %r8
	call	_Z8Get_argsiPPcPiS1_PdS1_S_
	movslq	44(%rsp), %r13
	movq	%r13, %r12
	imulq	$40, %r13, %r13
	movq	%r13, %rdi
	call	malloc@PLT
	movq	%r13, %rdi
	movq	%rax, %rbx
	call	malloc@PLT
	popq	%rdx
	.cfi_def_cfa_offset 152
	popq	%rcx
	.cfi_def_cfa_offset 144
	movl	%r12d, %esi
	cmpb	$105, 27(%rsp)
	movq	%rax, %rbp
	movq	%rbx, %rdi
	jne	.L136
	call	_Z13Get_init_condP10particle_si
	jmp	.L137
.L136:
	call	_Z13Gen_init_condP10particle_si
.L137:
	movq	%r13, %rcx
	movq	%r13, %rdx
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__memcpy_chk@PLT
	movsd	48(%rsp), %xmm0
	movl	32(%rsp), %r8d
	leaq	64(%rsp), %rdx
	leaq	56(%rsp), %rsi
	leaq	40(%rsp), %r9
	movl	%r12d, %ecx
	movq	%rbx, %rdi
	movl	%r8d, 4(%rsp)
	movsd	%xmm0, 8(%rsp)
	call	_Z10sequentialP10particle_sPdS1_iidPf
	movl	4(%rsp), %r8d
	movl	%r12d, %ecx
	movq	%rbp, %rdi
	movsd	8(%rsp), %xmm0
	leaq	80(%rsp), %rdx
	leaq	44(%rsp), %r9
	leaq	72(%rsp), %rsi
	call	_Z8parallelP10particle_sPdS1_iidPf
	leaq	.LC16(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	40(%rsp), %xmm0
	call	__printf_chk@PLT
	movl	$2, %edi
	movb	$1, %al
	leaq	.LC17(%rip), %rsi
	cvtss2sd	44(%rsp), %xmm0
	call	__printf_chk@PLT
	leaq	.LC18(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movss	40(%rsp), %xmm0
	divss	44(%rsp), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movsd	80(%rsp), %xmm3
	movq	%rbx, %rsi
	movsd	64(%rsp), %xmm2
	movsd	72(%rsp), %xmm1
	movsd	56(%rsp), %xmm0
	movq	%rbp, %rdx
	movl	%r12d, %edi
	call	_Z15verify_solutioniP10particle_sS0_dddd
	leaq	.LC19(%rip), %rsi
	testl	%eax, %eax
	jne	.L142
	leaq	.LC20(%rip), %rsi
.L142:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L140
	call	__stack_chk_fail@PLT
.L140:
	addq	$104, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	main, .-main
	.section	.rodata.str1.1
.LC21:
	.string	"_Z23kernel_potential_energyPdiP10particle_s"
.LC22:
	.string	"_Z21kernel_kinetic_energyPdiP10particle_s"
.LC23:
	.string	"_Z13kernel_updatePA2_dP10particle_sid"
.LC24:
	.string	"_Z19kernel_add_partialsiPA2_dS0_"
.LC25:
	.string	"_Z13kernel_forcesPA2_dP10particle_siS0_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2077:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC21(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z23kernel_potential_energyPdiP10particle_s(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC22(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z21kernel_kinetic_energyPdiP10particle_s(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC23(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13kernel_updatePA2_dP10particle_sid(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC24(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z19kernel_add_partialsiPA2_dS0_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC25(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13kernel_forcesPA2_dP10particle_siS0_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2077:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC6:
	.long	0
	.long	1088244736
	.align 8
.LC7:
	.long	0
	.long	-1059238912
	.align 8
.LC8:
	.long	740819601
	.long	1158712106
	.align 8
.LC9:
	.long	0
	.long	1090021888
	.align 8
.LC10:
	.long	-805144307
	.long	-1110288460
	.align 8
.LC11:
	.long	0
	.long	1071644672
	.align 8
.LC13:
	.long	0
	.long	1072693248
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC14:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC15:
	.long	1202590843
	.long	1065646817
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define DIM 2 /* Two-dimensional system */
#define X 0   /* x-coordinate subscript */
#define Y 1   /* y-coordinate subscript */
#define START_TIMER \
   hipEvent_t start = hipEvent_t(); \
   hipEvent_t stop = hipEvent_t(); \
   hipEventCreate(&start); \
   hipEventCreate(&stop); \
   hipEventRecord(start, 0);

#define END_TIMER \
   hipEventRecord(stop, 0); \
   hipEventSynchronize(stop); \
   hipEventElapsedTime(time, start, stop); \
   hipEventDestroy(start); \
   hipEventDestroy(stop);

const int GRID_SIZE = 192;
const int BLOCK_SIZE = 128;

const double G = 6.673e-11;
const double ACCURACY = 0.01;

typedef double vect_t[DIM]; /* Vector type for position, etc. */

struct particle_s
{
   double m; /* Mass     */
   vect_t s; /* Position */
   vect_t v; /* Velocity */
};

void Get_args(int, char *[], int *, int *, double *, int *, char *);
void Get_init_cond(struct particle_s*, int);
void Gen_init_cond(struct particle_s[], int);
void Compute_force(int, vect_t*, struct particle_s*, int);
void Update_part(int, vect_t*, struct particle_s*, int, double);
void Compute_energy(struct particle_s*, int, double *, double *);
void sequential(struct particle_s *, double *, double *, int, int, double, float *);
void parallel_compute_forces(vect_t*, struct particle_s*, int);
void parallel_update_parts(vect_t*, struct particle_s*, int, double);
void parallel_compute_energy(struct particle_s*, int, double *, double *);
void parallel(struct particle_s *, double *, double *, int n, int, double, float *);
int verify_solution(int, struct particle_s*, struct particle_s*, double, double, double, double);
int is_close(double, double, double);
__device__ void indexes(unsigned, unsigned, unsigned*, unsigned*);

int main(int argc, char *argv[])
{
   int n;                   /* Number of particles          */
   int n_steps;             /* Number of timesteps          */
   int output_freq;         /* Frequency of output          */
   double delta_t;           /* Size of timestep             */
   struct particle_s *sequential_curr, *parallel_curr;
   char g_i;                /* Generate or input init conds */
   double sequential_kinetic_energy, sequential_potential_energy;
   double parallel_kinetic_energy, parallel_potential_energy;
   float sequential_time, parallel_time;

   Get_args(argc, argv, &n, &n_steps, &delta_t, &output_freq, &g_i);
   sequential_curr = (struct particle_s*)malloc(n * sizeof(struct particle_s));
   parallel_curr = (struct particle_s*)malloc(n * sizeof(struct particle_s));
   if (g_i == 'i')
      Get_init_cond(sequential_curr, n);
   else
      Gen_init_cond(sequential_curr, n);
   memcpy(parallel_curr, sequential_curr, n * sizeof(struct particle_s));

   sequential(sequential_curr, &sequential_kinetic_energy, &sequential_potential_energy, n, n_steps, delta_t, &sequential_time);
   parallel(parallel_curr, &parallel_kinetic_energy, &parallel_potential_energy, n, n_steps, delta_t, &parallel_time);
   printf("Sequential time: %.15f ms\n", sequential_time);
   printf("Parallel time: %.15f ms\n", parallel_time);
   printf("Speedup: %.15f\n", sequential_time / parallel_time);

   if(verify_solution(n, sequential_curr, parallel_curr, sequential_kinetic_energy, parallel_kinetic_energy, sequential_potential_energy, parallel_potential_energy))
      printf("TEST PASSED\n");
   else
      printf("TEST FAILED\n");

   free(sequential_curr);
   free(parallel_curr);
   return 0;
} /* main */

void Get_args(int argc, char *argv[], int *n_p, int *n_steps_p, double *delta_t_p, int *output_freq_p, char *g_i_p)
{
   if (argc != 6)
      printf("Bad arguments\n");
   *n_p = strtol(argv[1], NULL, 10);
   *n_steps_p = strtol(argv[2], NULL, 10);
   *delta_t_p = strtod(argv[3], NULL);
   *output_freq_p = strtol(argv[4], NULL, 10);
   *g_i_p = argv[5][0];

   if (*n_p <= 0 || *n_steps_p < 0 || *delta_t_p <= 0)
      printf("Bad arguments\n");
   if (*g_i_p != 'g' && *g_i_p != 'i')
      printf("Bad arguments\n");

} /* Get_args */

void Get_init_cond(struct particle_s* curr, int n)
{
   int part;

   printf("For each particle, enter (in order):\n");
   printf("   its mass, its x-coord, its y-coord, ");
   printf("its x-velocity, its y-velocity\n");
   for (part = 0; part < n; part++)
   {
      scanf("%lf", &curr[part].m);
      scanf("%lf", &curr[part].s[X]);
      scanf("%lf", &curr[part].s[Y]);
      scanf("%lf", &curr[part].v[X]);
      scanf("%lf", &curr[part].v[Y]);
   }
} /* Get_init_cond */

void Gen_init_cond(struct particle_s* curr, int n)
{
   int part;
   double mass = 5.0e24;
   double gap = 1.0e5;
   double speed = 3.0e4;

   for (part = 0; part < n; part++)
   {
      curr[part].m = mass;
      curr[part].s[X] = part * gap;
      curr[part].s[Y] = 0.0;
      curr[part].v[X] = 0.0;
      if (part % 2 == 0)
         curr[part].v[Y] = speed;
      else
         curr[part].v[Y] = -speed;
   }
} /* Gen_init_cond */

void Compute_force(int part, vect_t* forces, struct particle_s* curr, int n)
{
   int k;
   double mg;
   vect_t f_part_k;
   double len, len_3, fact;

   for (k = part + 1; k < n; k++)
   {
      f_part_k[X] = curr[part].s[X] - curr[k].s[X];
      f_part_k[Y] = curr[part].s[Y] - curr[k].s[Y];
      len = sqrt(f_part_k[X] * f_part_k[X] + f_part_k[Y] * f_part_k[Y]);
      len_3 = len * len * len;
      mg = -G * curr[part].m * curr[k].m;
      fact = mg / len_3;
      f_part_k[X] *= fact;
      f_part_k[Y] *= fact;

      forces[part][X] += f_part_k[X];
      forces[part][Y] += f_part_k[Y];
      forces[k][X] -= f_part_k[X];
      forces[k][Y] -= f_part_k[Y];
   }
} /* Compute_force */

void Update_part(int part, vect_t* forces, struct particle_s* curr, int n, double delta_t)
{
   double fact = delta_t / curr[part].m;

   curr[part].s[X] += delta_t * curr[part].v[X];
   curr[part].s[Y] += delta_t * curr[part].v[Y];
   curr[part].v[X] += fact * forces[part][X];
   curr[part].v[Y] += fact * forces[part][Y];
} /* Update_part */

void Compute_energy(struct particle_s* curr, int n, double *kin_en_p, double *pot_en_p)
{
   int i, j;
   vect_t diff;
   double pe = 0.0, ke = 0.0;
   double dist, speed_sqr;

   for (i = 0; i < n; i++)
   {
      speed_sqr = curr[i].v[X] * curr[i].v[X] + curr[i].v[Y] * curr[i].v[Y];
      ke += curr[i].m * speed_sqr;
   }
   ke *= 0.5;

   for (i = 0; i < n - 1; i++)
   {
      for (j = i + 1; j < n; j++)
      {
         diff[X] = curr[i].s[X] - curr[j].s[X];
         diff[Y] = curr[i].s[Y] - curr[j].s[Y];
         dist = sqrt(diff[X] * diff[X] + diff[Y] * diff[Y]);
         pe += -G * curr[i].m * curr[j].m / dist;
      }
   }

   *kin_en_p = ke;
   *pot_en_p = pe;
} /* Compute_energy */

void sequential(struct particle_s *curr, double* kinetic_energy, double* potential_energy, int n, int n_steps, double delta_t, float* time)
{
   START_TIMER
   vect_t *forces = (vect_t*)malloc(n * sizeof(vect_t));   
   Compute_energy(curr, n, kinetic_energy, potential_energy);
   printf("   PE = %e, KE = %e, Total Energy = %e\n", *potential_energy, *kinetic_energy, *kinetic_energy + *potential_energy);
   
   for (int step = 1; step <= n_steps; step++)
   {
      memset(forces, 0, n * sizeof(vect_t));
      for (int part = 0; part < n - 1; part++)
         Compute_force(part, forces, curr, n);
      for (int part = 0; part < n; part++)
         Update_part(part, forces, curr, n, delta_t);
   }

   Compute_energy(curr, n, kinetic_energy, potential_energy);
   printf("   PE = %e, KE = %e, Total Energy = %e\n", *potential_energy, *kinetic_energy, *kinetic_energy + *potential_energy);
   free(forces);
   END_TIMER
}

__global__ void kernel_forces(vect_t* forces, struct particle_s* curr, int n, vect_t* partial_forces)
{
   double mg;
   vect_t f_part_k;
   double len, len_3, fact;
   int idx = blockIdx.x * blockDim.x + threadIdx.x;
   vect_t to_add = {0, 0};
   struct particle_s my_curr = curr[idx];
   
   if(idx < n - 1)
   {
      for(int k = idx + 1; k < n; k++)
      {
         f_part_k[X] = my_curr.s[X] - curr[k].s[X];
         f_part_k[Y] = my_curr.s[Y] - curr[k].s[Y];
         len = sqrt(f_part_k[X] * f_part_k[X] + f_part_k[Y] * f_part_k[Y]);
         len_3 = len * len * len;
         mg = -G * my_curr.m * curr[k].m;
         fact = mg / len_3;
         f_part_k[X] *= fact;
         f_part_k[Y] *= fact;
   
         to_add[X] += f_part_k[X];
         to_add[Y] += f_part_k[Y];
         partial_forces[k * n + idx][X] = -f_part_k[X];
         partial_forces[k * n + idx][Y] = -f_part_k[Y];
      }
      forces[idx][X] += to_add[X];
      forces[idx][Y] += to_add[Y];
   }
}

__global__ void kernel_add_partials(int n, vect_t* forces, vect_t* partial_forces)
{
   int idx = blockIdx.x * blockDim.x + threadIdx.x;

   if(idx < n)
   {
      for(int j = 0; j < n; j++)
      {
         if(j != idx)
         {
            forces[idx][X] += partial_forces[idx * n + j][X];
            forces[idx][Y] += partial_forces[idx * n + j][Y];
         }
      }
   }
}

void parallel_compute_forces(vect_t* forces, struct particle_s* curr, int n, vect_t* partial_forces)
{
   int grid_size = (n + BLOCK_SIZE - 1) / BLOCK_SIZE;
   
   // cudaMemset(partial_forces, 0, n * n * sizeof(vect_t));

   kernel_forces<<<grid_size, BLOCK_SIZE>>>(forces, curr, n, partial_forces);
   kernel_add_partials<<<grid_size, BLOCK_SIZE>>>(n, forces, partial_forces);
}

__global__ void kernel_update(vect_t* forces, struct particle_s* curr, int n, double delta_t)
{
   int idx = blockIdx.x * blockDim.x + threadIdx.x;
   if(idx < n)
   {
      double fact = delta_t / curr[idx].m;
      curr[idx].s[X] += delta_t * curr[idx].v[X];
      curr[idx].s[Y] += delta_t * curr[idx].v[Y];
      curr[idx].v[X] += fact * forces[idx][X];
      curr[idx].v[Y] += fact * forces[idx][Y];
   }
}

void parallel_update_parts(vect_t* forces, struct particle_s* curr, int n, double delta_t)
{ // deluje da radi
   int grid_size = (n + BLOCK_SIZE - 1) / BLOCK_SIZE;
   kernel_update<<<grid_size, BLOCK_SIZE>>>(forces, curr, n, delta_t);
}

__global__ void kernel_kinetic_energy(double* partial_sums, int n, struct particle_s* curr)
{
   int idx = blockIdx.x * blockDim.x + threadIdx.x;
   for(int i = idx; i < n; i += gridDim.x * blockDim.x)
      partial_sums[idx] += curr[i].m * (curr[i].v[X] * curr[i].v[X] + curr[i].v[Y] * curr[i].v[Y]);
}

__global__ void kernel_potential_energy(double* partial_sums, int n, struct particle_s* curr)
{
   unsigned idx = blockIdx.x * blockDim.x + threadIdx.x, i, j;
   unsigned size = n * (n - 1) / 2;
   vect_t diff;
   double dist;
   for(unsigned k = idx; k < size; k += gridDim.x * blockDim.x) 
   {
      indexes(k, n - 1, &i, &j);
      j++;
      diff[X] = curr[i].s[X] - curr[j].s[X];
      diff[Y] = curr[i].s[Y] - curr[j].s[Y];
      dist = sqrt(diff[X] * diff[X] + diff[Y] * diff[Y]);
      partial_sums[idx] += -G * curr[i].m * curr[j].m / dist;
   }
}

void parallel_compute_energy(struct particle_s* curr, int n, double *kin_en_p, double *pot_en_p)
{ // deluje da radi
   int i;
   double pe = 0.0, ke = 0.0;
   double* partial_sums_device, *partial_sums_host;

   partial_sums_host = (double*)malloc(GRID_SIZE * BLOCK_SIZE * sizeof(double));
   hipMalloc(&partial_sums_device, GRID_SIZE * BLOCK_SIZE * sizeof(double));
   
   hipMemset(partial_sums_device, 0, GRID_SIZE * BLOCK_SIZE * sizeof(double));
   kernel_kinetic_energy<<<GRID_SIZE, BLOCK_SIZE>>>(partial_sums_device, n, curr);
   hipMemcpy(partial_sums_host, partial_sums_device, GRID_SIZE * BLOCK_SIZE * sizeof(double), hipMemcpyDeviceToHost);
   // razmisliti o redukciji na gpu
   for(i = 0; i < GRID_SIZE * BLOCK_SIZE; i++)
      ke += partial_sums_host[i];
   ke *= 0.5;

   hipMemset(partial_sums_device, 0, GRID_SIZE * BLOCK_SIZE * sizeof(double));
   kernel_potential_energy<<<GRID_SIZE, BLOCK_SIZE>>>(partial_sums_device, n, curr);
   hipMemcpy(partial_sums_host, partial_sums_device, GRID_SIZE * BLOCK_SIZE * sizeof(double), hipMemcpyDeviceToHost);
   // razmisliti o redukciji na gpu
   for(i = 0; i < GRID_SIZE * BLOCK_SIZE; i++)
      pe += partial_sums_host[i];

   *kin_en_p = ke;
   *pot_en_p = pe;
   free(partial_sums_host);
   hipFree(partial_sums_device);
}

void parallel(struct particle_s *curr, double* kinetic_energy, double* potential_energy, int n, int n_steps, double delta_t, float* time)
{
   START_TIMER
   vect_t *forces, *forces_device, *partial_forces;  
   struct particle_s* curr_device;

   forces = (vect_t*)malloc(n * sizeof(vect_t));
   hipMalloc(&forces_device, n * sizeof(vect_t));
   hipMalloc(&curr_device, n * sizeof(struct particle_s));
   hipMalloc(&partial_forces, n * n * sizeof(vect_t));
   hipMemcpy(forces_device, forces, n * sizeof(vect_t), hipMemcpyHostToDevice);
   hipMemcpy(curr_device, curr, n * sizeof(struct particle_s), hipMemcpyHostToDevice);
   
   parallel_compute_energy(curr_device, n, kinetic_energy, potential_energy);
   printf("   PE = %e, KE = %e, Total Energy = %e\n", *potential_energy, *kinetic_energy, *kinetic_energy + *potential_energy);
   
   for (int step = 1; step <= n_steps; step++)
   {
      hipMemset(forces_device, 0, n * sizeof(vect_t));
      parallel_compute_forces(forces_device, curr_device, n, partial_forces);
      parallel_update_parts(forces_device, curr_device, n, delta_t);
   }
   
   parallel_compute_energy(curr_device, n, kinetic_energy, potential_energy);
   printf("   PE = %e, KE = %e, Total Energy = %e\n", *potential_energy, *kinetic_energy, *kinetic_energy + *potential_energy);
   
   hipMemcpy(curr, curr_device, n * sizeof(struct particle_s), hipMemcpyDeviceToHost);
   hipFree(forces_device);
   hipFree(curr_device);
   hipFree(partial_forces);
   free(forces);
   END_TIMER
}

int verify_solution(int n, struct particle_s curr_sequential[], struct particle_s curr_parallel[], double kinetic_energy_sequential, double kinetic_energy_parallel, double potential_energy_sequential, double potential_energy_parallel)
{
   if (!is_close(kinetic_energy_sequential, kinetic_energy_parallel, ACCURACY))
      return 0;
   if (!is_close(potential_energy_sequential, potential_energy_parallel, ACCURACY))
      return 0;
   for (int i = 0; i < n; i++)
   {
      if (!is_close(curr_sequential[i].m, curr_parallel[i].m, ACCURACY))
         return 0;
      for (int j = 0; j < DIM; j++)
      {
         if(!is_close(curr_sequential[i].s[j], curr_parallel[i].s[j], ACCURACY))
            return 0;
         if(!is_close(curr_sequential[i].v[j], curr_parallel[i].v[j], ACCURACY))
            return 0;
      }
   }
   return 1;
}

inline int is_close(double first, double second, double accuracy)
{
   return (fabs(1 - second / first) < accuracy);
}

__device__ void indexes(unsigned k, unsigned N, unsigned* row_ptr, unsigned* col_ptr)
{
    double n = N;
    double row = (-2 * n - 1 + sqrt((4 * n * (n + 1) - 8 * (double)k - 7))) / -2;
    if (row == (double)(int)row)
        row -= 1;
    *row_ptr = (unsigned)row;
    *col_ptr = k - N * *row_ptr + *row_ptr * (*row_ptr + 1) / 2;
}
	.text
	.file	"dz4z3.hip"
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	19(%rsp), %r13
	movq	%r13, (%rsp)
	leaq	84(%rsp), %rbx
	leaq	20(%rsp), %rcx
	leaq	64(%rsp), %r8
	leaq	80(%rsp), %r9
	movq	%rbx, %rdx
	callq	_Z8Get_argsiPPcPiS1_PdS1_S_
	movslq	(%rbx), %r15
	movq	%r15, %rax
	shlq	$3, %rax
	leaq	(%rax,%rax,4), %r12
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, %rbx
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, %r14
	cmpb	$105, (%r13)
	jne	.LBB0_2
# %bb.1:
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_Z13Get_init_condP10particle_si
	jmp	.LBB0_3
.LBB0_2:
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_Z13Gen_init_condP10particle_si
.LBB0_3:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	callq	memcpy@PLT
	movl	20(%rsp), %ebp
	movsd	64(%rsp), %xmm0                 # xmm0 = mem[0],zero
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	leaq	56(%rsp), %rsi
	leaq	48(%rsp), %rdx
	leaq	76(%rsp), %r13
	movq	%rbx, %rdi
	movl	%r15d, %ecx
	movl	%ebp, %r8d
	movq	%r13, %r9
	callq	_Z10sequentialP10particle_sPdS1_iidPf
	leaq	40(%rsp), %rsi
	leaq	32(%rsp), %rdx
	leaq	72(%rsp), %r12
	movq	%r14, %rdi
	movl	%r15d, %ecx
	movl	%ebp, %r8d
	movsd	24(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movq	%r12, %r9
	callq	_Z8parallelP10particle_sPdS1_iidPf
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r13), %xmm0
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r12), %xmm0
	movl	$.L.str.1, %edi
	movb	$1, %al
	callq	printf
	movss	(%r13), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	(%r12), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.2, %edi
	movb	$1, %al
	callq	printf
	leaq	56(%rsp), %rax
	movsd	(%rax), %xmm0                   # xmm0 = mem[0],zero
	leaq	40(%rsp), %rax
	movsd	(%rax), %xmm1                   # xmm1 = mem[0],zero
	leaq	48(%rsp), %rax
	movsd	(%rax), %xmm2                   # xmm2 = mem[0],zero
	leaq	32(%rsp), %rax
	movsd	(%rax), %xmm3                   # xmm3 = mem[0],zero
	movl	%r15d, %edi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	callq	_Z15verify_solutioniP10particle_sS0_dddd
	testl	%eax, %eax
	movl	$.Lstr, %eax
	movl	$.Lstr.1, %edi
	cmoveq	%rax, %rdi
	callq	puts@PLT
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	xorl	%eax, %eax
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.globl	_Z8Get_argsiPPcPiS1_PdS1_S_     # -- Begin function _Z8Get_argsiPPcPiS1_PdS1_S_
	.type	_Z8Get_argsiPPcPiS1_PdS1_S_,@function
_Z8Get_argsiPPcPiS1_PdS1_S_:            # @_Z8Get_argsiPPcPiS1_PdS1_S_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, %r12
	movq	%r8, %rbx
	movq	%rcx, %r14
	movq	%rdx, %r15
	movq	%rsi, %r13
	movq	64(%rsp), %rbp
	cmpl	$6, %edi
	je	.LBB1_2
# %bb.1:
	movl	$.Lstr.4, %edi
	callq	puts@PLT
.LBB1_2:
	movq	8(%r13), %rdi
	xorl	%esi, %esi
	movl	$10, %edx
	callq	__isoc23_strtol
	movl	%eax, (%r15)
	movq	16(%r13), %rdi
	xorl	%esi, %esi
	movl	$10, %edx
	callq	__isoc23_strtol
	movl	%eax, (%r14)
	movq	24(%r13), %rdi
	xorl	%esi, %esi
	callq	strtod
	movsd	%xmm0, (%rbx)
	movq	32(%r13), %rdi
	xorl	%esi, %esi
	movl	$10, %edx
	callq	__isoc23_strtol
	movl	%eax, (%r12)
	movq	40(%r13), %rax
	movb	(%rax), %al
	movb	%al, (%rbp)
	cmpl	$0, (%r15)
	jle	.LBB1_5
# %bb.3:
	cmpl	$0, (%r14)
	js	.LBB1_5
# %bb.4:
	xorpd	%xmm0, %xmm0
	ucomisd	(%rbx), %xmm0
	jb	.LBB1_6
.LBB1_5:
	movl	$.Lstr.4, %edi
	callq	puts@PLT
	movb	(%rbp), %al
.LBB1_6:
	cmpb	$103, %al
	je	.LBB1_8
# %bb.7:
	movzbl	%al, %eax
	cmpl	$105, %eax
	jne	.LBB1_9
.LBB1_8:
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB1_9:
	.cfi_def_cfa_offset 64
	movl	$.Lstr.4, %edi
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	puts@PLT                        # TAILCALL
.Lfunc_end1:
	.size	_Z8Get_argsiPPcPiS1_PdS1_S_, .Lfunc_end1-_Z8Get_argsiPPcPiS1_PdS1_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z13Get_init_condP10particle_si # -- Begin function _Z13Get_init_condP10particle_si
	.type	_Z13Get_init_condP10particle_si,@function
_Z13Get_init_condP10particle_si:        # @_Z13Get_init_condP10particle_si
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebp
	movq	%rdi, %rbx
	movl	$.Lstr.5, %edi
	callq	puts@PLT
	movl	$.L.str.7, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.6, %edi
	callq	puts@PLT
	testl	%ebp, %ebp
	jle	.LBB2_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebp, %r14d
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$.L.str.9, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	leaq	8(%rbx), %rsi
	movl	$.L.str.9, %edi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	leaq	16(%rbx), %rsi
	movl	$.L.str.9, %edi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	leaq	24(%rbx), %rsi
	movl	$.L.str.9, %edi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	leaq	32(%rbx), %rsi
	movl	$.L.str.9, %edi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	addq	$40, %rbx
	decq	%r14
	jne	.LBB2_2
.LBB2_3:                                # %._crit_edge
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z13Get_init_condP10particle_si, .Lfunc_end2-_Z13Get_init_condP10particle_si
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z13Gen_init_condP10particle_si
.LCPI3_0:
	.quad	0x40f86a0000000000              # double 1.0E+5
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	3, 0x0
.LCPI3_1:
	.quad	0xc0dd4c0000000000              # double -3.0E+4
	.quad	0x40dd4c0000000000              # double 3.0E+4
	.text
	.globl	_Z13Gen_init_condP10particle_si
	.type	_Z13Gen_init_condP10particle_si,@function
_Z13Gen_init_condP10particle_si:        # @_Z13Gen_init_condP10particle_si
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB3_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%esi, %eax
	addq	$32, %rdi
	xorl	%ecx, %ecx
	movabsq	$4976630601490104977, %rdx      # imm = 0x45108B2A2C280291
	movsd	.LCPI3_0(%rip), %xmm0           # xmm0 = mem[0],zero
	xorps	%xmm1, %xmm1
.LBB3_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%ecx, %xmm2
	movq	%rdx, -32(%rdi)
	mulsd	%xmm0, %xmm2
	movsd	%xmm2, -24(%rdi)
	xorl	%esi, %esi
	testb	$1, %cl
	sete	%sil
	movups	%xmm1, -16(%rdi)
	movsd	.LCPI3_1(,%rsi,8), %xmm2        # xmm2 = mem[0],zero
	movsd	%xmm2, (%rdi)
	incq	%rcx
	addq	$40, %rdi
	cmpq	%rcx, %rax
	jne	.LBB3_2
.LBB3_3:                                # %._crit_edge
	retq
.Lfunc_end3:
	.size	_Z13Gen_init_condP10particle_si, .Lfunc_end3-_Z13Gen_init_condP10particle_si
	.cfi_endproc
                                        # -- End function
	.globl	_Z10sequentialP10particle_sPdS1_iidPf # -- Begin function _Z10sequentialP10particle_sPdS1_iidPf
	.type	_Z10sequentialP10particle_sPdS1_iidPf,@function
_Z10sequentialP10particle_sPdS1_iidPf:  # @_Z10sequentialP10particle_sPdS1_iidPf
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, 48(%rsp)                   # 8-byte Spill
	movsd	%xmm0, 64(%rsp)                 # 8-byte Spill
	movl	%r8d, 12(%rsp)                  # 4-byte Spill
	movl	%ecx, %r12d
	movq	%rdx, %r14
	movq	%rsi, %rbp
	movq	%rdi, %r13
	xorl	%eax, %eax
	leaq	24(%rsp), %rbx
	movq	%rax, (%rbx)
	leaq	16(%rsp), %r15
	movq	%rax, (%r15)
	movq	%rbx, %rdi
	callq	hipEventCreate
	movq	%r15, %rdi
	callq	hipEventCreate
	movq	(%rbx), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movslq	%r12d, %r15
	movq	%r15, %rdi
	shlq	$4, %rdi
	movq	%rdi, 56(%rsp)                  # 8-byte Spill
	callq	malloc
	movq	%rax, %rbx
	movq	%r13, %rdi
	movl	%r15d, %esi
	movq	%rbp, %rdx
	movq	%r14, %rcx
	callq	_Z14Compute_energyP10particle_siPdS1_
	movq	%r14, 32(%rsp)                  # 8-byte Spill
	movsd	(%r14), %xmm0                   # xmm0 = mem[0],zero
	movq	%rbp, 40(%rsp)                  # 8-byte Spill
	movsd	(%rbp), %xmm1                   # xmm1 = mem[0],zero
	movapd	%xmm0, %xmm2
	addsd	%xmm1, %xmm2
	movl	$.L.str.10, %edi
	movb	$3, %al
	callq	printf
	cmpl	$0, 12(%rsp)                    # 4-byte Folded Reload
	jle	.LBB4_9
# %bb.1:                                # %.lr.ph47
	leal	-1(%r12), %ebp
	movl	$1, %r14d
.LBB4_2:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_4 Depth 2
                                        #     Child Loop BB4_7 Depth 2
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movq	56(%rsp), %rdx                  # 8-byte Reload
	callq	memset@PLT
	cmpl	$2, %r12d
	jl	.LBB4_5
# %bb.3:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB4_2 Depth=1
	xorl	%r15d, %r15d
.LBB4_4:                                # %.lr.ph
                                        #   Parent Loop BB4_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%r15d, %edi
	movq	%rbx, %rsi
	movq	%r13, %rdx
	movl	%r12d, %ecx
	callq	_Z13Compute_forceiPA2_dP10particle_si
	incl	%r15d
	cmpl	%r15d, %ebp
	jne	.LBB4_4
.LBB4_5:                                # %.preheader
                                        #   in Loop: Header=BB4_2 Depth=1
	testl	%r12d, %r12d
	jle	.LBB4_8
# %bb.6:                                # %.lr.ph43.preheader
                                        #   in Loop: Header=BB4_2 Depth=1
	xorl	%r15d, %r15d
.LBB4_7:                                # %.lr.ph43
                                        #   Parent Loop BB4_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%r15d, %edi
	movq	%rbx, %rsi
	movq	%r13, %rdx
	movsd	64(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_Z11Update_partiPA2_dP10particle_sid
	incl	%r15d
	cmpl	%r15d, %r12d
	jne	.LBB4_7
.LBB4_8:                                # %._crit_edge
                                        #   in Loop: Header=BB4_2 Depth=1
	leal	1(%r14), %eax
	cmpl	12(%rsp), %r14d                 # 4-byte Folded Reload
	movl	%eax, %r14d
	jne	.LBB4_2
.LBB4_9:                                # %._crit_edge48
	movq	%r13, %rdi
	movl	%r12d, %esi
	movq	40(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rdx
	movq	32(%rsp), %r15                  # 8-byte Reload
	movq	%r15, %rcx
	callq	_Z14Compute_energyP10particle_siPdS1_
	movsd	(%r15), %xmm0                   # xmm0 = mem[0],zero
	movsd	(%r14), %xmm1                   # xmm1 = mem[0],zero
	movapd	%xmm0, %xmm2
	addsd	%xmm1, %xmm2
	movl	$.L.str.10, %edi
	movb	$3, %al
	callq	printf
	movq	%rbx, %rdi
	callq	free
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	16(%rsp), %rdi
	callq	hipEventSynchronize
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
	movq	48(%rsp), %rdi                  # 8-byte Reload
	callq	hipEventElapsedTime
	movq	24(%rsp), %rdi
	callq	hipEventDestroy
	movq	16(%rsp), %rdi
	callq	hipEventDestroy
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z10sequentialP10particle_sPdS1_iidPf, .Lfunc_end4-_Z10sequentialP10particle_sPdS1_iidPf
	.cfi_endproc
                                        # -- End function
	.globl	_Z8parallelP10particle_sPdS1_iidPf # -- Begin function _Z8parallelP10particle_sPdS1_iidPf
	.type	_Z8parallelP10particle_sPdS1_iidPf,@function
_Z8parallelP10particle_sPdS1_iidPf:     # @_Z8parallelP10particle_sPdS1_iidPf
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, 88(%rsp)                   # 8-byte Spill
	movsd	%xmm0, 96(%rsp)                 # 8-byte Spill
	movl	%r8d, %ebx
	movl	%ecx, %ebp
	movq	%rdx, 32(%rsp)                  # 8-byte Spill
	movq	%rsi, 64(%rsp)                  # 8-byte Spill
	movq	%rdi, %r13
	xorl	%eax, %eax
	leaq	48(%rsp), %r14
	movq	%rax, (%r14)
	leaq	24(%rsp), %r15
	movq	%rax, (%r15)
	movq	%r14, %rdi
	callq	hipEventCreate
	movq	%r15, %rdi
	callq	hipEventCreate
	movq	(%r14), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movslq	%ebp, %r14
	movq	%r14, %r15
	shlq	$4, %r15
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, %r12
	leaq	16(%rsp), %rdi
	movq	%r15, %rsi
	callq	hipMalloc
	leaq	(,%r14,8), %rax
	leaq	(%rax,%rax,4), %rsi
	movq	%rsi, 56(%rsp)                  # 8-byte Spill
	leaq	8(%rsp), %rdi
	callq	hipMalloc
	movl	%r14d, %esi
	imull	%esi, %esi
	shlq	$4, %rsi
	leaq	40(%rsp), %rdi
	callq	hipMalloc
	leaq	16(%rsp), %rax
	movq	(%rax), %rdi
	movq	%r12, 80(%rsp)                  # 8-byte Spill
	movq	%r12, %rsi
	movq	32(%rsp), %r12                  # 8-byte Reload
	movq	%r15, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	8(%rsp), %rax
	movq	(%rax), %rdi
	movq	%r13, 72(%rsp)                  # 8-byte Spill
	movq	%r13, %rsi
	movq	56(%rsp), %r13                  # 8-byte Reload
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	8(%rsp), %rax
	movq	(%rax), %rdi
	movl	%r14d, %esi
	movq	64(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rdx
	movq	%r12, %rcx
	callq	_Z23parallel_compute_energyP10particle_siPdS1_
	movsd	(%r12), %xmm0                   # xmm0 = mem[0],zero
	movsd	(%r14), %xmm1                   # xmm1 = mem[0],zero
	movapd	%xmm0, %xmm2
	addsd	%xmm1, %xmm2
	movl	$.L.str.10, %edi
	movb	$3, %al
	callq	printf
	testl	%ebx, %ebx
	jle	.LBB5_2
.LBB5_1:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r15, %rdx
	callq	hipMemset
	movq	16(%rsp), %rdi
	movq	8(%rsp), %rsi
	movq	40(%rsp), %rcx
	movl	%ebp, %edx
	callq	_Z23parallel_compute_forcesPA2_dP10particle_siS0_
	movq	16(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	%ebp, %edx
	movsd	96(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_Z21parallel_update_partsPA2_dP10particle_sid
	decl	%ebx
	jne	.LBB5_1
.LBB5_2:                                # %._crit_edge
	movq	8(%rsp), %rdi
	movl	%ebp, %esi
	movq	%r14, %rdx
	movq	32(%rsp), %rbx                  # 8-byte Reload
	movq	%rbx, %rcx
	callq	_Z23parallel_compute_energyP10particle_siPdS1_
	movsd	(%rbx), %xmm0                   # xmm0 = mem[0],zero
	movsd	(%r14), %xmm1                   # xmm1 = mem[0],zero
	movapd	%xmm0, %xmm2
	addsd	%xmm1, %xmm2
	movl	$.L.str.10, %edi
	movb	$3, %al
	callq	printf
	movq	8(%rsp), %rsi
	movq	72(%rsp), %rdi                  # 8-byte Reload
	movq	%r13, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	40(%rsp), %rdi
	callq	hipFree
	movq	80(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	24(%rsp), %rdi
	callq	hipEventSynchronize
	movq	48(%rsp), %rsi
	movq	24(%rsp), %rdx
	movq	88(%rsp), %rdi                  # 8-byte Reload
	callq	hipEventElapsedTime
	movq	48(%rsp), %rdi
	callq	hipEventDestroy
	movq	24(%rsp), %rdi
	callq	hipEventDestroy
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z8parallelP10particle_sPdS1_iidPf, .Lfunc_end5-_Z8parallelP10particle_sPdS1_iidPf
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z15verify_solutioniP10particle_sS0_dddd
.LCPI6_0:
	.quad	0x3ff0000000000000              # double 1
.LCPI6_2:
	.quad	0x3f847ae147ae147b              # double 0.01
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI6_1:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.text
	.globl	_Z15verify_solutioniP10particle_sS0_dddd
	.type	_Z15verify_solutioniP10particle_sS0_dddd,@function
_Z15verify_solutioniP10particle_sS0_dddd: # @_Z15verify_solutioniP10particle_sS0_dddd
	.cfi_startproc
# %bb.0:
	divsd	%xmm0, %xmm1
	movsd	.LCPI6_0(%rip), %xmm0           # xmm0 = mem[0],zero
	movapd	%xmm0, %xmm4
	subsd	%xmm1, %xmm4
	andpd	.LCPI6_1(%rip), %xmm4
	xorl	%eax, %eax
	movsd	.LCPI6_2(%rip), %xmm1           # xmm1 = mem[0],zero
	ucomisd	%xmm4, %xmm1
	jbe	.LBB6_12
# %bb.1:
	divsd	%xmm2, %xmm3
	movapd	%xmm0, %xmm2
	subsd	%xmm3, %xmm2
	andpd	.LCPI6_1(%rip), %xmm2
	ucomisd	%xmm2, %xmm1
	jbe	.LBB6_12
# %bb.2:                                # %.preheader36
	testl	%edi, %edi
	jle	.LBB6_3
# %bb.4:                                # %.lr.ph.preheader
	movl	%edi, %ecx
	xorl	%edi, %edi
	movapd	.LCPI6_1(%rip), %xmm2           # xmm2 = [NaN,NaN]
	xorl	%eax, %eax
.LBB6_5:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_8 Depth 2
	leaq	(,%rdi,8), %r8
	leaq	(%r8,%r8,4), %r8
	movsd	(%rdx,%r8), %xmm3               # xmm3 = mem[0],zero
	divsd	(%rsi,%r8), %xmm3
	movapd	%xmm0, %xmm4
	subsd	%xmm3, %xmm4
	andpd	%xmm2, %xmm4
	ucomisd	%xmm4, %xmm1
	jbe	.LBB6_11
# %bb.6:                                # %.preheader.preheader
                                        #   in Loop: Header=BB6_5 Depth=1
	movb	$1, %r9b
	leaq	(%rsi,%r8), %r10
	addq	%rdx, %r8
	xorl	%r11d, %r11d
.LBB6_8:                                # %.preheader
                                        #   Parent Loop BB6_5 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	8(%r8,%r11,8), %xmm3            # xmm3 = mem[0],zero
	divsd	8(%r10,%r11,8), %xmm3
	movapd	%xmm0, %xmm4
	subsd	%xmm3, %xmm4
	andpd	%xmm2, %xmm4
	ucomisd	%xmm4, %xmm1
	jbe	.LBB6_11
# %bb.9:                                #   in Loop: Header=BB6_8 Depth=2
	movsd	24(%r8,%r11,8), %xmm3           # xmm3 = mem[0],zero
	divsd	24(%r10,%r11,8), %xmm3
	movapd	%xmm0, %xmm4
	subsd	%xmm3, %xmm4
	andpd	%xmm2, %xmm4
	ucomisd	%xmm4, %xmm1
	jbe	.LBB6_11
# %bb.7:                                #   in Loop: Header=BB6_8 Depth=2
	movl	$1, %r11d
	testb	$1, %r9b
	movl	$0, %r9d
	jne	.LBB6_8
# %bb.10:                               #   in Loop: Header=BB6_5 Depth=1
	incq	%rdi
	cmpq	%rcx, %rdi
	setae	%al
	jne	.LBB6_5
	jmp	.LBB6_11
.LBB6_3:
	movb	$1, %al
.LBB6_11:                               # %.thread
	movzbl	%al, %eax
	andl	$1, %eax
.LBB6_12:
	retq
.Lfunc_end6:
	.size	_Z15verify_solutioniP10particle_sS0_dddd, .Lfunc_end6-_Z15verify_solutioniP10particle_sS0_dddd
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z13Compute_forceiPA2_dP10particle_si
.LCPI7_0:
	.quad	0xbdd257b4d002790d              # double -6.6729999999999999E-11
	.text
	.globl	_Z13Compute_forceiPA2_dP10particle_si
	.type	_Z13Compute_forceiPA2_dP10particle_si,@function
_Z13Compute_forceiPA2_dP10particle_si:  # @_Z13Compute_forceiPA2_dP10particle_si
	.cfi_startproc
# %bb.0:
                                        # kill: def $edi killed $edi def $rdi
	leal	1(%rdi), %eax
	cmpl	%ecx, %eax
	jge	.LBB7_3
# %bb.1:                                # %.lr.ph
	movslq	%edi, %r10
	leaq	(%r10,%r10,4), %r11
	leaq	(%rdx,%r11,8), %rax
	shlq	$4, %r10
	leaq	(%r10,%rsi), %r8
	leaq	(%r10,%rsi), %r9
	addq	$8, %r9
	leaq	(%rdx,%r11,8), %rdx
	addq	$56, %rdx
	addq	%r10, %rsi
	addq	$24, %rsi
	notl	%edi
	addl	%ecx, %edi
	movsd	.LCPI7_0(%rip), %xmm0           # xmm0 = mem[0],zero
.LBB7_2:                                # =>This Inner Loop Header: Depth=1
	movsd	8(%rax), %xmm1                  # xmm1 = mem[0],zero
	subsd	-8(%rdx), %xmm1
	movsd	16(%rax), %xmm2                 # xmm2 = mem[0],zero
	subsd	(%rdx), %xmm2
	movapd	%xmm1, %xmm3
	movapd	%xmm2, %xmm4
	mulsd	%xmm1, %xmm3
	mulsd	%xmm2, %xmm4
	addsd	%xmm3, %xmm4
	xorps	%xmm3, %xmm3
	sqrtsd	%xmm4, %xmm3
	movapd	%xmm3, %xmm4
	mulsd	%xmm3, %xmm4
	movsd	(%rax), %xmm5                   # xmm5 = mem[0],zero
	mulsd	%xmm0, %xmm5
	mulsd	%xmm3, %xmm4
	mulsd	-16(%rdx), %xmm5
	divsd	%xmm4, %xmm5
	mulsd	%xmm5, %xmm1
	movsd	(%r8), %xmm3                    # xmm3 = mem[0],zero
	addsd	%xmm1, %xmm3
	movsd	%xmm3, (%r8)
	mulsd	%xmm2, %xmm5
	movsd	(%r9), %xmm2                    # xmm2 = mem[0],zero
	addsd	%xmm5, %xmm2
	movsd	%xmm2, (%r9)
	movsd	-8(%rsi), %xmm2                 # xmm2 = mem[0],zero
	movsd	(%rsi), %xmm3                   # xmm3 = mem[0],zero
	subsd	%xmm1, %xmm2
	subsd	%xmm5, %xmm3
	movsd	%xmm2, -8(%rsi)
	movsd	%xmm3, (%rsi)
	addq	$40, %rdx
	addq	$16, %rsi
	decl	%edi
	jne	.LBB7_2
.LBB7_3:                                # %._crit_edge
	retq
.Lfunc_end7:
	.size	_Z13Compute_forceiPA2_dP10particle_si, .Lfunc_end7-_Z13Compute_forceiPA2_dP10particle_si
	.cfi_endproc
                                        # -- End function
	.globl	_Z11Update_partiPA2_dP10particle_sid # -- Begin function _Z11Update_partiPA2_dP10particle_sid
	.type	_Z11Update_partiPA2_dP10particle_sid,@function
_Z11Update_partiPA2_dP10particle_sid:   # @_Z11Update_partiPA2_dP10particle_sid
	.cfi_startproc
# %bb.0:
	movslq	%edi, %rax
	leaq	(%rax,%rax,4), %rcx
	movapd	%xmm0, %xmm1
	divsd	(%rdx,%rcx,8), %xmm1
	movsd	24(%rdx,%rcx,8), %xmm2          # xmm2 = mem[0],zero
	movsd	32(%rdx,%rcx,8), %xmm3          # xmm3 = mem[0],zero
	movapd	%xmm2, %xmm4
	mulsd	%xmm0, %xmm4
	addsd	8(%rdx,%rcx,8), %xmm4
	movsd	%xmm4, 8(%rdx,%rcx,8)
	mulsd	%xmm3, %xmm0
	addsd	16(%rdx,%rcx,8), %xmm0
	movsd	%xmm0, 16(%rdx,%rcx,8)
	shlq	$4, %rax
	movsd	(%rsi,%rax), %xmm0              # xmm0 = mem[0],zero
	mulsd	%xmm1, %xmm0
	addsd	%xmm2, %xmm0
	movsd	%xmm0, 24(%rdx,%rcx,8)
	mulsd	8(%rsi,%rax), %xmm1
	addsd	%xmm3, %xmm1
	movsd	%xmm1, 32(%rdx,%rcx,8)
	retq
.Lfunc_end8:
	.size	_Z11Update_partiPA2_dP10particle_sid, .Lfunc_end8-_Z11Update_partiPA2_dP10particle_sid
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z14Compute_energyP10particle_siPdS1_
.LCPI9_0:
	.quad	0x3fe0000000000000              # double 0.5
.LCPI9_1:
	.quad	0x3dd257b4d002790d              # double 6.6729999999999999E-11
	.text
	.globl	_Z14Compute_energyP10particle_siPdS1_
	.type	_Z14Compute_energyP10particle_siPdS1_,@function
_Z14Compute_energyP10particle_siPdS1_:  # @_Z14Compute_energyP10particle_siPdS1_
	.cfi_startproc
# %bb.0:
                                        # kill: def $esi killed $esi def $rsi
	testl	%esi, %esi
	jle	.LBB9_1
# %bb.5:                                # %.lr.ph.preheader
	movl	%esi, %eax
	leaq	(,%rax,8), %r8
	leaq	(%r8,%r8,4), %r8
	xorpd	%xmm0, %xmm0
	xorl	%r9d, %r9d
.LBB9_6:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	24(%rdi,%r9), %xmm1             # xmm1 = mem[0],zero
	movsd	32(%rdi,%r9), %xmm2             # xmm2 = mem[0],zero
	mulsd	%xmm1, %xmm1
	mulsd	%xmm2, %xmm2
	addsd	%xmm1, %xmm2
	mulsd	(%rdi,%r9), %xmm2
	addsd	%xmm2, %xmm0
	addq	$40, %r9
	cmpq	%r9, %r8
	jne	.LBB9_6
# %bb.3:                                # %.preheader
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	mulsd	.LCPI9_0(%rip), %xmm0
	xorpd	%xmm1, %xmm1
	cmpl	$1, %esi
	je	.LBB9_10
# %bb.4:                                # %.lr.ph55.preheader
	decl	%esi
	leaq	56(%rdi), %r8
	movl	$1, %r9d
	xorl	%r10d, %r10d
	movsd	.LCPI9_1(%rip), %xmm2           # xmm2 = mem[0],zero
.LBB9_8:                                # %.lr.ph51
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_9 Depth 2
	leaq	(%r10,%r10,4), %r11
	incq	%r10
	movsd	8(%rdi,%r11,8), %xmm3           # xmm3 = mem[0],zero
	movsd	16(%rdi,%r11,8), %xmm4          # xmm4 = mem[0],zero
	movsd	(%rdi,%r11,8), %xmm5            # xmm5 = mem[0],zero
	mulsd	%xmm2, %xmm5
	movq	%rax, %r11
	movq	%r8, %rbx
.LBB9_9:                                #   Parent Loop BB9_8 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movapd	%xmm3, %xmm6
	subsd	-8(%rbx), %xmm6
	movapd	%xmm4, %xmm7
	subsd	(%rbx), %xmm7
	mulsd	%xmm6, %xmm6
	mulsd	%xmm7, %xmm7
	addsd	%xmm6, %xmm7
	xorps	%xmm6, %xmm6
	sqrtsd	%xmm7, %xmm6
	movsd	-16(%rbx), %xmm7                # xmm7 = mem[0],zero
	mulsd	%xmm5, %xmm7
	divsd	%xmm6, %xmm7
	subsd	%xmm7, %xmm1
	addq	$40, %rbx
	decq	%r11
	cmpq	%r11, %r9
	jne	.LBB9_9
# %bb.7:                                # %.loopexit
                                        #   in Loop: Header=BB9_8 Depth=1
	incq	%r9
	addq	$40, %r8
	cmpq	%rsi, %r10
	jne	.LBB9_8
.LBB9_10:
	popq	%rbx
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	jmp	.LBB9_2
.LBB9_1:
	xorpd	%xmm0, %xmm0
	xorpd	%xmm1, %xmm1
.LBB9_2:                                # %._crit_edge
	movsd	%xmm0, (%rdx)
	movsd	%xmm1, (%rcx)
	retq
.Lfunc_end9:
	.size	_Z14Compute_energyP10particle_siPdS1_, .Lfunc_end9-_Z14Compute_energyP10particle_siPdS1_
	.cfi_endproc
                                        # -- End function
	.globl	_Z28__device_stub__kernel_forcesPA2_dP10particle_siS0_ # -- Begin function _Z28__device_stub__kernel_forcesPA2_dP10particle_siS0_
	.type	_Z28__device_stub__kernel_forcesPA2_dP10particle_siS0_,@function
_Z28__device_stub__kernel_forcesPA2_dP10particle_siS0_: # @_Z28__device_stub__kernel_forcesPA2_dP10particle_siS0_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	4(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	24(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z13kernel_forcesPA2_dP10particle_siS0_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end10:
	.size	_Z28__device_stub__kernel_forcesPA2_dP10particle_siS0_, .Lfunc_end10-_Z28__device_stub__kernel_forcesPA2_dP10particle_siS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z34__device_stub__kernel_add_partialsiPA2_dS0_ # -- Begin function _Z34__device_stub__kernel_add_partialsiPA2_dS0_
	.type	_Z34__device_stub__kernel_add_partialsiPA2_dS0_,@function
_Z34__device_stub__kernel_add_partialsiPA2_dS0_: # @_Z34__device_stub__kernel_add_partialsiPA2_dS0_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z19kernel_add_partialsiPA2_dS0_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end11:
	.size	_Z34__device_stub__kernel_add_partialsiPA2_dS0_, .Lfunc_end11-_Z34__device_stub__kernel_add_partialsiPA2_dS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z23parallel_compute_forcesPA2_dP10particle_siS0_ # -- Begin function _Z23parallel_compute_forcesPA2_dP10particle_siS0_
	.type	_Z23parallel_compute_forcesPA2_dP10particle_siS0_,@function
_Z23parallel_compute_forcesPA2_dP10particle_siS0_: # @_Z23parallel_compute_forcesPA2_dP10particle_siS0_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rcx, %rbx
	movl	%edx, %r14d
	movq	%rsi, %r13
	movq	%rdi, %r15
	movabsq	$4294967424, %r12               # imm = 0x100000080
	leal	127(%r14), %eax
	leal	254(%r14), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$7, %ecx
	leaq	(%rcx,%r12), %rbp
	addq	$-128, %rbp
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB12_2
# %bb.1:
	movq	%r15, %rdi
	movq	%r13, %rsi
	movl	%r14d, %edx
	movq	%rbx, %rcx
	callq	_Z28__device_stub__kernel_forcesPA2_dP10particle_siS0_
.LBB12_2:
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	je	.LBB12_4
# %bb.3:
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB12_4:
	.cfi_def_cfa_offset 64
	movl	%r14d, %edi
	movq	%r15, %rsi
	movq	%rbx, %rdx
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	_Z34__device_stub__kernel_add_partialsiPA2_dS0_ # TAILCALL
.Lfunc_end12:
	.size	_Z23parallel_compute_forcesPA2_dP10particle_siS0_, .Lfunc_end12-_Z23parallel_compute_forcesPA2_dP10particle_siS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z28__device_stub__kernel_updatePA2_dP10particle_sid # -- Begin function _Z28__device_stub__kernel_updatePA2_dP10particle_sid
	.type	_Z28__device_stub__kernel_updatePA2_dP10particle_sid,@function
_Z28__device_stub__kernel_updatePA2_dP10particle_sid: # @_Z28__device_stub__kernel_updatePA2_dP10particle_sid
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	4(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	24(%rsp), %rdx
	movsd	%xmm0, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z13kernel_updatePA2_dP10particle_sid, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end13:
	.size	_Z28__device_stub__kernel_updatePA2_dP10particle_sid, .Lfunc_end13-_Z28__device_stub__kernel_updatePA2_dP10particle_sid
	.cfi_endproc
                                        # -- End function
	.globl	_Z21parallel_update_partsPA2_dP10particle_sid # -- Begin function _Z21parallel_update_partsPA2_dP10particle_sid
	.type	_Z21parallel_update_partsPA2_dP10particle_sid,@function
_Z21parallel_update_partsPA2_dP10particle_sid: # @_Z21parallel_update_partsPA2_dP10particle_sid
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	%edx, %ebx
	movq	%rsi, %r14
	movq	%rdi, %r15
	leal	127(%rbx), %eax
	leal	254(%rbx), %edi
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$7, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$128, %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	je	.LBB14_2
# %bb.1:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB14_2:
	.cfi_def_cfa_offset 48
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	%ebx, %edx
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	_Z28__device_stub__kernel_updatePA2_dP10particle_sid # TAILCALL
.Lfunc_end14:
	.size	_Z21parallel_update_partsPA2_dP10particle_sid, .Lfunc_end14-_Z21parallel_update_partsPA2_dP10particle_sid
	.cfi_endproc
                                        # -- End function
	.globl	_Z36__device_stub__kernel_kinetic_energyPdiP10particle_s # -- Begin function _Z36__device_stub__kernel_kinetic_energyPdiP10particle_s
	.type	_Z36__device_stub__kernel_kinetic_energyPdiP10particle_s,@function
_Z36__device_stub__kernel_kinetic_energyPdiP10particle_s: # @_Z36__device_stub__kernel_kinetic_energyPdiP10particle_s
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	12(%rsp), %rcx
	movl	%esi, (%rcx)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z21kernel_kinetic_energyPdiP10particle_s, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end15:
	.size	_Z36__device_stub__kernel_kinetic_energyPdiP10particle_s, .Lfunc_end15-_Z36__device_stub__kernel_kinetic_energyPdiP10particle_s
	.cfi_endproc
                                        # -- End function
	.globl	_Z38__device_stub__kernel_potential_energyPdiP10particle_s # -- Begin function _Z38__device_stub__kernel_potential_energyPdiP10particle_s
	.type	_Z38__device_stub__kernel_potential_energyPdiP10particle_s,@function
_Z38__device_stub__kernel_potential_energyPdiP10particle_s: # @_Z38__device_stub__kernel_potential_energyPdiP10particle_s
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	12(%rsp), %rcx
	movl	%esi, (%rcx)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z23kernel_potential_energyPdiP10particle_s, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end16:
	.size	_Z38__device_stub__kernel_potential_energyPdiP10particle_s, .Lfunc_end16-_Z38__device_stub__kernel_potential_energyPdiP10particle_s
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z23parallel_compute_energyP10particle_siPdS1_
.LCPI17_0:
	.quad	0x3fe0000000000000              # double 0.5
	.text
	.globl	_Z23parallel_compute_energyP10particle_siPdS1_
	.type	_Z23parallel_compute_energyP10particle_siPdS1_,@function
_Z23parallel_compute_energyP10particle_siPdS1_: # @_Z23parallel_compute_energyP10particle_siPdS1_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rcx, 16(%rsp)                  # 8-byte Spill
	movq	%rdx, %r14
	movl	%esi, %ebp
	movq	%rdi, %r12
	movabsq	$4294967424, %r13               # imm = 0x100000080
	movl	$196608, %edi                   # imm = 0x30000
	callq	malloc
	movq	%rax, %r15
	movq	%rsp, %rbx
	movl	$196608, %esi                   # imm = 0x30000
	movq	%rbx, %rdi
	callq	hipMalloc
	movq	(%rbx), %rdi
	movl	$196608, %edx                   # imm = 0x30000
	xorl	%esi, %esi
	callq	hipMemset
	leaq	64(%r13), %rdi
	movl	$1, %esi
	movq	%r13, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB17_2
# %bb.1:
	movq	(%rsp), %rdi
	movl	%ebp, %esi
	movq	%r12, %rdx
	callq	_Z36__device_stub__kernel_kinetic_energyPdiP10particle_s
.LBB17_2:
	movq	(%rsp), %rsi
	movl	$196608, %edx                   # imm = 0x30000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	xorpd	%xmm0, %xmm0
	xorl	%eax, %eax
.LBB17_3:                               # =>This Inner Loop Header: Depth=1
	addsd	(%r15,%rax,8), %xmm0
	incq	%rax
	cmpq	$24576, %rax                    # imm = 0x6000
	jne	.LBB17_3
# %bb.4:
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movq	(%rsp), %rdi
	movl	$196608, %edx                   # imm = 0x30000
	xorl	%esi, %esi
	callq	hipMemset
	leaq	64(%r13), %rdi
	movl	$1, %esi
	movq	%r13, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB17_6
# %bb.5:
	movq	(%rsp), %rdi
	movl	%ebp, %esi
	movq	%r12, %rdx
	callq	_Z38__device_stub__kernel_potential_energyPdiP10particle_s
.LBB17_6:
	movq	(%rsp), %rsi
	movl	$196608, %edx                   # imm = 0x30000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	xorpd	%xmm0, %xmm0
	xorl	%eax, %eax
.LBB17_7:                               # =>This Inner Loop Header: Depth=1
	addsd	(%r15,%rax,8), %xmm0
	incq	%rax
	cmpq	$24576, %rax                    # imm = 0x6000
	jne	.LBB17_7
# %bb.8:
	movsd	8(%rsp), %xmm1                  # 8-byte Reload
                                        # xmm1 = mem[0],zero
	mulsd	.LCPI17_0(%rip), %xmm1
	movsd	%xmm1, (%r14)
	movq	16(%rsp), %rax                  # 8-byte Reload
	movsd	%xmm0, (%rax)
	movq	%r15, %rdi
	callq	free
	movq	(%rsp), %rdi
	callq	hipFree
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end17:
	.size	_Z23parallel_compute_energyP10particle_siPdS1_, .Lfunc_end17-_Z23parallel_compute_energyP10particle_siPdS1_
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB18_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB18_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13kernel_forcesPA2_dP10particle_siS0_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z19kernel_add_partialsiPA2_dS0_, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13kernel_updatePA2_dP10particle_sid, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z21kernel_kinetic_energyPdiP10particle_s, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z23kernel_potential_energyPdiP10particle_s, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end18:
	.size	__hip_module_ctor, .Lfunc_end18-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB19_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB19_2:
	retq
.Lfunc_end19:
	.size	__hip_module_dtor, .Lfunc_end19-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Sequential time: %.15f ms\n"
	.size	.L.str, 27

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Parallel time: %.15f ms\n"
	.size	.L.str.1, 25

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Speedup: %.15f\n"
	.size	.L.str.2, 16

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"   its mass, its x-coord, its y-coord, "
	.size	.L.str.7, 40

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"%lf"
	.size	.L.str.9, 4

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"   PE = %e, KE = %e, Total Energy = %e\n"
	.size	.L.str.10, 40

	.type	_Z13kernel_forcesPA2_dP10particle_siS0_,@object # @_Z13kernel_forcesPA2_dP10particle_siS0_
	.section	.rodata,"a",@progbits
	.globl	_Z13kernel_forcesPA2_dP10particle_siS0_
	.p2align	3, 0x0
_Z13kernel_forcesPA2_dP10particle_siS0_:
	.quad	_Z28__device_stub__kernel_forcesPA2_dP10particle_siS0_
	.size	_Z13kernel_forcesPA2_dP10particle_siS0_, 8

	.type	_Z19kernel_add_partialsiPA2_dS0_,@object # @_Z19kernel_add_partialsiPA2_dS0_
	.globl	_Z19kernel_add_partialsiPA2_dS0_
	.p2align	3, 0x0
_Z19kernel_add_partialsiPA2_dS0_:
	.quad	_Z34__device_stub__kernel_add_partialsiPA2_dS0_
	.size	_Z19kernel_add_partialsiPA2_dS0_, 8

	.type	_Z13kernel_updatePA2_dP10particle_sid,@object # @_Z13kernel_updatePA2_dP10particle_sid
	.globl	_Z13kernel_updatePA2_dP10particle_sid
	.p2align	3, 0x0
_Z13kernel_updatePA2_dP10particle_sid:
	.quad	_Z28__device_stub__kernel_updatePA2_dP10particle_sid
	.size	_Z13kernel_updatePA2_dP10particle_sid, 8

	.type	_Z21kernel_kinetic_energyPdiP10particle_s,@object # @_Z21kernel_kinetic_energyPdiP10particle_s
	.globl	_Z21kernel_kinetic_energyPdiP10particle_s
	.p2align	3, 0x0
_Z21kernel_kinetic_energyPdiP10particle_s:
	.quad	_Z36__device_stub__kernel_kinetic_energyPdiP10particle_s
	.size	_Z21kernel_kinetic_energyPdiP10particle_s, 8

	.type	_Z23kernel_potential_energyPdiP10particle_s,@object # @_Z23kernel_potential_energyPdiP10particle_s
	.globl	_Z23kernel_potential_energyPdiP10particle_s
	.p2align	3, 0x0
_Z23kernel_potential_energyPdiP10particle_s:
	.quad	_Z38__device_stub__kernel_potential_energyPdiP10particle_s
	.size	_Z23kernel_potential_energyPdiP10particle_s, 8

	.type	.L__unnamed_1,@object           # @0
	.section	.rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
	.asciz	"_Z13kernel_forcesPA2_dP10particle_siS0_"
	.size	.L__unnamed_1, 40

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z19kernel_add_partialsiPA2_dS0_"
	.size	.L__unnamed_2, 33

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z13kernel_updatePA2_dP10particle_sid"
	.size	.L__unnamed_3, 38

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z21kernel_kinetic_energyPdiP10particle_s"
	.size	.L__unnamed_4, 42

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"_Z23kernel_potential_energyPdiP10particle_s"
	.size	.L__unnamed_5, 44

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"TEST FAILED"
	.size	.Lstr, 12

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"TEST PASSED"
	.size	.Lstr.1, 12

	.type	.Lstr.4,@object                 # @str.4
.Lstr.4:
	.asciz	"Bad arguments"
	.size	.Lstr.4, 14

	.type	.Lstr.5,@object                 # @str.5
.Lstr.5:
	.asciz	"For each particle, enter (in order):"
	.size	.Lstr.5, 37

	.type	.Lstr.6,@object                 # @str.6
.Lstr.6:
	.asciz	"its x-velocity, its y-velocity"
	.size	.Lstr.6, 31

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z28__device_stub__kernel_forcesPA2_dP10particle_siS0_
	.addrsig_sym _Z34__device_stub__kernel_add_partialsiPA2_dS0_
	.addrsig_sym _Z28__device_stub__kernel_updatePA2_dP10particle_sid
	.addrsig_sym _Z36__device_stub__kernel_kinetic_energyPdiP10particle_s
	.addrsig_sym _Z38__device_stub__kernel_potential_energyPdiP10particle_s
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z13kernel_forcesPA2_dP10particle_siS0_
	.addrsig_sym _Z19kernel_add_partialsiPA2_dS0_
	.addrsig_sym _Z13kernel_updatePA2_dP10particle_sid
	.addrsig_sym _Z21kernel_kinetic_energyPdiP10particle_s
	.addrsig_sym _Z23kernel_potential_energyPdiP10particle_s
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z13kernel_forcesPA2_dP10particle_siS0_ ; -- Begin function _Z13kernel_forcesPA2_dP10particle_siS0_
	.globl	_Z13kernel_forcesPA2_dP10particle_siS0_
	.p2align	8
	.type	_Z13kernel_forcesPA2_dP10particle_siS0_,@function
_Z13kernel_forcesPA2_dP10particle_siS0_: ; @_Z13kernel_forcesPA2_dP10particle_siS0_
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s8, s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	s_mul_i32 s15, s15, s2
	s_add_i32 s2, s8, -1
	v_add_nc_u32_e32 v5, s15, v0
	v_cmp_gt_i32_e32 vcc_lo, s2, v5
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB0_6
; %bb.1:                                ; %.preheader
	s_load_b128 s[4:7], s[0:1], 0x0
	v_mov_b32_e32 v1, 0
	v_dual_mov_b32 v2, 0 :: v_dual_add_nc_u32 v17, 1, v5
	v_ashrrev_i32_e32 v6, 31, v5
	s_mov_b32 s9, exec_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_dual_mov_b32 v10, v2 :: v_dual_mov_b32 v9, v1
	v_cmpx_gt_i32_e64 s8, v17
	s_cbranch_execz .LBB0_5
; %bb.2:                                ; %.lr.ph
	s_waitcnt lgkmcnt(0)
	v_mad_i64_i32 v[9:10], null, v5, 40, s[6:7]
	s_mov_b32 s2, 0xd002790d
	s_mov_b32 s3, 0xbdd257b4
	v_mul_lo_u32 v15, s8, v17
	s_clause 0x1
	global_load_b128 v[1:4], v[9:10], off
	global_load_b64 v[7:8], v[9:10], off offset:16
	v_add_co_u32 v13, vcc_lo, v9, 56
	v_add_co_ci_u32_e32 v14, vcc_lo, 0, v10, vcc_lo
	v_add3_u32 v15, v0, v15, s15
	s_waitcnt vmcnt(1)
	v_mul_f64 v[11:12], v[1:2], s[2:3]
	s_load_b64 s[2:3], s[0:1], 0x18
	v_mov_b32_e32 v1, 0
	v_mov_b32_e32 v2, 0
	s_mov_b32 s1, 0
	s_delay_alu instid0(VALU_DEP_1)
	v_dual_mov_b32 v10, v2 :: v_dual_mov_b32 v9, v1
.LBB0_3:                                ; =>This Inner Loop Header: Depth=1
	s_clause 0x1
	global_load_b64 v[22:23], v[13:14], off
	global_load_b128 v[18:21], v[13:14], off offset:-16
	v_ashrrev_i32_e32 v16, 31, v15
	v_add_nc_u32_e32 v17, 1, v17
	s_waitcnt vmcnt(1)
	v_add_f64 v[22:23], v[7:8], -v[22:23]
	s_waitcnt vmcnt(0)
	v_add_f64 v[20:21], v[3:4], -v[20:21]
	v_mul_f64 v[18:19], v[11:12], v[18:19]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[24:25], v[22:23], v[22:23]
	v_fma_f64 v[24:25], v[20:21], v[20:21], v[24:25]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[24:25]
	v_cndmask_b32_e64 v0, 0, 1, vcc_lo
	v_lshlrev_b32_e32 v0, 8, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ldexp_f64 v[24:25], v[24:25], v0
	v_cndmask_b32_e64 v0, 0, 0xffffff80, vcc_lo
	v_rsq_f64_e32 v[26:27], v[24:25]
	v_cmp_class_f64_e64 vcc_lo, v[24:25], 0x260
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[28:29], v[24:25], v[26:27]
	v_mul_f64 v[26:27], v[26:27], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[30:31], -v[26:27], v[28:29], 0.5
	v_fma_f64 v[28:29], v[28:29], v[30:31], v[28:29]
	v_fma_f64 v[26:27], v[26:27], v[30:31], v[26:27]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[30:31], -v[28:29], v[28:29], v[24:25]
	v_fma_f64 v[28:29], v[30:31], v[26:27], v[28:29]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[30:31], -v[28:29], v[28:29], v[24:25]
	v_fma_f64 v[26:27], v[30:31], v[26:27], v[28:29]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ldexp_f64 v[26:27], v[26:27], v0
	v_dual_cndmask_b32 v25, v27, v25 :: v_dual_cndmask_b32 v24, v26, v24
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[26:27], v[24:25], v[24:25]
	v_mul_f64 v[24:25], v[24:25], v[26:27]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f64 v[26:27], null, v[24:25], v[24:25], v[18:19]
	v_div_scale_f64 v[32:33], vcc_lo, v[18:19], v[24:25], v[18:19]
	v_rcp_f64_e32 v[28:29], v[26:27]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[30:31], -v[26:27], v[28:29], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[28:29], v[28:29], v[30:31], v[28:29]
	v_fma_f64 v[30:31], -v[26:27], v[28:29], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[28:29], v[28:29], v[30:31], v[28:29]
	v_mul_f64 v[30:31], v[32:33], v[28:29]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[26:27], -v[26:27], v[30:31], v[32:33]
	v_div_fmas_f64 v[26:27], v[26:27], v[28:29], v[30:31]
	v_add_co_u32 v13, vcc_lo, v13, 40
	v_add_co_ci_u32_e32 v14, vcc_lo, 0, v14, vcc_lo
	v_cmp_le_i32_e32 vcc_lo, s8, v17
	s_or_b32 s1, vcc_lo, s1
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f64 v[24:25], v[26:27], v[24:25], v[18:19]
	v_fma_f64 v[1:2], v[20:21], v[24:25], v[1:2]
	v_mul_f64 v[18:19], v[20:21], -v[24:25]
	v_mul_f64 v[20:21], v[22:23], -v[24:25]
	v_fma_f64 v[9:10], v[22:23], v[24:25], v[9:10]
	v_lshlrev_b64 v[22:23], 4, v[15:16]
	v_add_nc_u32_e32 v15, s8, v15
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v22, s0, s2, v22
	v_add_co_ci_u32_e64 v23, s0, s3, v23, s0
	global_store_b128 v[22:23], v[18:21], off
	s_and_not1_b32 exec_lo, exec_lo, s1
	s_cbranch_execnz .LBB0_3
; %bb.4:                                ; %Flow
	s_or_b32 exec_lo, exec_lo, s1
.LBB0_5:                                ; %Flow77
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	s_or_b32 exec_lo, exec_lo, s9
	v_lshlrev_b64 v[3:4], 4, v[5:6]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v7, vcc_lo, s4, v3
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v8, vcc_lo, s5, v4, vcc_lo
	global_load_b128 v[3:6], v[7:8], off
	s_waitcnt vmcnt(0)
	v_add_f64 v[0:1], v[1:2], v[3:4]
	v_add_f64 v[2:3], v[9:10], v[5:6]
	global_store_b128 v[7:8], v[0:3], off
.LBB0_6:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13kernel_forcesPA2_dP10particle_siS0_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 34
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z13kernel_forcesPA2_dP10particle_siS0_, .Lfunc_end0-_Z13kernel_forcesPA2_dP10particle_siS0_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 804
; NumSgprs: 18
; NumVgprs: 34
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 4
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 34
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z19kernel_add_partialsiPA2_dS0_ ; -- Begin function _Z19kernel_add_partialsiPA2_dS0_
	.globl	_Z19kernel_add_partialsiPA2_dS0_
	.p2align	8
	.type	_Z19kernel_add_partialsiPA2_dS0_,@function
_Z19kernel_add_partialsiPA2_dS0_:       ; @_Z19kernel_add_partialsiPA2_dS0_
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b32 s4, s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_max_i32_e32 v0, 0, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s4, v0
	s_cbranch_execz .LBB1_5
; %bb.1:                                ; %.lr.ph
	s_load_b128 s[0:3], s[0:1], 0x8
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[4:5], 4, v[1:2]
	v_mul_lo_u32 v2, v1, s4
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v4, vcc_lo, s0, v4
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v5, vcc_lo, s1, v5, vcc_lo
.LBB1_2:                                ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s0, exec_lo
	v_cmpx_ne_u32_e32 0, v1
	s_cbranch_execz .LBB1_4
; %bb.3:                                ;   in Loop: Header=BB1_2 Depth=1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[6:7], 4, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v10, vcc_lo, s2, v6
	v_add_co_ci_u32_e32 v11, vcc_lo, s3, v7, vcc_lo
	global_load_b64 v[12:13], v[10:11], off
	global_load_b128 v[6:9], v[4:5], off
	s_waitcnt vmcnt(0)
	v_add_f64 v[6:7], v[12:13], v[6:7]
	global_store_b64 v[4:5], v[6:7], off
	global_load_b64 v[6:7], v[10:11], off offset:8
	s_waitcnt vmcnt(0)
	v_add_f64 v[6:7], v[6:7], v[8:9]
	global_store_b64 v[4:5], v[6:7], off offset:8
.LBB1_4:                                ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
	v_add_nc_u32_e32 v1, -1, v1
	v_add_nc_u32_e32 v2, 1, v2
	s_add_i32 s4, s4, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s4, 0
	s_cbranch_scc1 .LBB1_2
.LBB1_5:                                ; %.loopexit
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z19kernel_add_partialsiPA2_dS0_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 14
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z19kernel_add_partialsiPA2_dS0_, .Lfunc_end1-_Z19kernel_add_partialsiPA2_dS0_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 268
; NumSgprs: 18
; NumVgprs: 14
; ScratchSize: 0
; MemoryBound: 1
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 14
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z13kernel_updatePA2_dP10particle_sid ; -- Begin function _Z13kernel_updatePA2_dP10particle_sid
	.globl	_Z13kernel_updatePA2_dP10particle_sid
	.p2align	8
	.type	_Z13kernel_updatePA2_dP10particle_sid,@function
_Z13kernel_updatePA2_dP10particle_sid:  ; @_Z13kernel_updatePA2_dP10particle_sid
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB2_2
; %bb.1:
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x18
	v_ashrrev_i32_e32 v2, 31, v1
	s_waitcnt lgkmcnt(0)
	v_mad_i64_i32 v[11:12], null, v1, 40, s[6:7]
	s_delay_alu instid0(VALU_DEP_2)
	v_lshlrev_b64 v[0:1], 4, v[1:2]
	s_clause 0x2
	global_load_b128 v[3:6], v[11:12], off
	global_load_b128 v[7:10], v[11:12], off offset:16
	global_load_b64 v[13:14], v[11:12], off offset:32
	v_add_co_u32 v0, vcc_lo, s4, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	s_waitcnt vmcnt(2)
	v_div_scale_f64 v[15:16], null, v[3:4], v[3:4], s[0:1]
	s_waitcnt vmcnt(1)
	v_fma_f64 v[5:6], v[9:10], s[0:1], v[5:6]
	s_waitcnt vmcnt(0)
	v_fma_f64 v[7:8], v[13:14], s[0:1], v[7:8]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[17:18], v[15:16]
	global_store_b128 v[11:12], v[5:8], off offset:8
	global_load_b64 v[5:6], v[0:1], off
	v_fma_f64 v[7:8], -v[15:16], v[17:18], 1.0
	v_fma_f64 v[7:8], v[17:18], v[7:8], v[17:18]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[17:18], -v[15:16], v[7:8], 1.0
	v_fma_f64 v[7:8], v[7:8], v[17:18], v[7:8]
	v_div_scale_f64 v[17:18], vcc_lo, s[0:1], v[3:4], s[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[19:20], v[17:18], v[7:8]
	v_fma_f64 v[15:16], -v[15:16], v[19:20], v[17:18]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[7:8], v[15:16], v[7:8], v[19:20]
	v_div_fixup_f64 v[2:3], v[7:8], v[3:4], s[0:1]
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_fma_f64 v[4:5], v[2:3], v[5:6], v[9:10]
	global_store_b64 v[11:12], v[4:5], off offset:24
	global_load_b64 v[0:1], v[0:1], off offset:8
	s_waitcnt vmcnt(0)
	v_fma_f64 v[0:1], v[2:3], v[0:1], v[13:14]
	global_store_b64 v[11:12], v[0:1], off offset:32
.LBB2_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13kernel_updatePA2_dP10particle_sid
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 21
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z13kernel_updatePA2_dP10particle_sid, .Lfunc_end2-_Z13kernel_updatePA2_dP10particle_sid
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 356
; NumSgprs: 18
; NumVgprs: 21
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 21
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z21kernel_kinetic_energyPdiP10particle_s ; -- Begin function _Z21kernel_kinetic_energyPdiP10particle_s
	.globl	_Z21kernel_kinetic_energyPdiP10particle_s
	.p2align	8
	.type	_Z21kernel_kinetic_energyPdiP10particle_s,@function
_Z21kernel_kinetic_energyPdiP10particle_s: ; @_Z21kernel_kinetic_energyPdiP10particle_s
; %bb.0:
	s_clause 0x1
	s_load_b32 s5, s[0:1], 0x24
	s_load_b32 s4, s[0:1], 0x8
	s_add_u32 s2, s0, 24
	s_addc_u32 s3, s1, 0
	s_mov_b32 s6, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s5, s5, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s5, v[0:1]
	v_cmpx_gt_i32_e64 s4, v1
	s_cbranch_execz .LBB3_3
; %bb.1:                                ; %.lr.ph
	s_load_b64 s[6:7], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_load_b32 s2, s[2:3], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	s_mov_b32 s3, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 3, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s6, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s7, v3, vcc_lo
	s_mul_i32 s2, s2, s5
	global_load_b64 v[4:5], v[2:3], off
.LBB3_2:                                ; =>This Inner Loop Header: Depth=1
	v_mad_i64_i32 v[10:11], null, v1, 40, s[0:1]
	v_add_nc_u32_e32 v1, s2, v1
	s_clause 0x1
	global_load_b128 v[6:9], v[10:11], off offset:24
	global_load_b64 v[10:11], v[10:11], off
	v_cmp_le_i32_e32 vcc_lo, s4, v1
	s_or_b32 s3, vcc_lo, s3
	s_waitcnt vmcnt(1)
	v_mul_f64 v[8:9], v[8:9], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f64 v[6:7], v[6:7], v[6:7], v[8:9]
	s_waitcnt vmcnt(0)
	v_fma_f64 v[4:5], v[10:11], v[6:7], v[4:5]
	global_store_b64 v[2:3], v[4:5], off
	s_and_not1_b32 exec_lo, exec_lo, s3
	s_cbranch_execnz .LBB3_2
.LBB3_3:                                ; %Flow23
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z21kernel_kinetic_energyPdiP10particle_s
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 12
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end3:
	.size	_Z21kernel_kinetic_energyPdiP10particle_s, .Lfunc_end3-_Z21kernel_kinetic_energyPdiP10particle_s
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 248
; NumSgprs: 18
; NumVgprs: 12
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 12
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z23kernel_potential_energyPdiP10particle_s ; -- Begin function _Z23kernel_potential_energyPdiP10particle_s
	.globl	_Z23kernel_potential_energyPdiP10particle_s
	.p2align	8
	.type	_Z23kernel_potential_energyPdiP10particle_s,@function
_Z23kernel_potential_energyPdiP10particle_s: ; @_Z23kernel_potential_energyPdiP10particle_s
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x24
	s_load_b32 s5, s[0:1], 0x8
	s_add_u32 s2, s0, 24
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s6, s4, 0xffff
	s_add_i32 s4, s5, -1
	v_mad_u64_u32 v[1:2], null, s15, s6, v[0:1]
	s_mul_i32 s5, s4, s5
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshr_b32 s7, s5, 31
	s_add_i32 s5, s5, s7
	s_mov_b32 s7, exec_lo
	s_ashr_i32 s5, s5, 1
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_cmpx_gt_u32_e64 s5, v1
	s_cbranch_execz .LBB4_3
; %bb.1:                                ; %.lr.ph
	s_load_b64 s[8:9], s[0:1], 0x0
	v_mov_b32_e32 v2, 0
	v_cvt_f64_u32_e32 v[6:7], s4
	s_load_b32 s7, s[2:3], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	s_mov_b32 s2, 0xd002790d
	v_lshlrev_b64 v[2:3], 3, v[1:2]
	s_mov_b32 s3, 0xbdd257b4
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s8, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s9, v3, vcc_lo
	s_mul_i32 s6, s7, s6
	s_mov_b32 s7, 0
	global_load_b64 v[4:5], v[2:3], off
	v_mul_f64 v[8:9], v[6:7], 4.0
	v_add_f64 v[10:11], v[6:7], 1.0
	v_fma_f64 v[6:7], v[6:7], -2.0, -1.0
	s_delay_alu instid0(VALU_DEP_2)
	v_mul_f64 v[8:9], v[8:9], v[10:11]
.LBB4_2:                                ; =>This Inner Loop Header: Depth=1
	v_cvt_f64_u32_e32 v[10:11], v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], 0xc0200000, v[10:11], v[8:9]
	v_add_f64 v[10:11], 0xc01c0000, v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[10:11]
	v_cndmask_b32_e64 v0, 0, 1, vcc_lo
	v_lshlrev_b32_e32 v0, 8, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ldexp_f64 v[10:11], v[10:11], v0
	v_cndmask_b32_e64 v0, 0, 0xffffff80, vcc_lo
	v_rsq_f64_e32 v[12:13], v[10:11]
	v_cmp_class_f64_e64 vcc_lo, v[10:11], 0x260
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[14:15], v[10:11], v[12:13]
	v_mul_f64 v[12:13], v[12:13], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], -v[12:13], v[14:15], 0.5
	v_fma_f64 v[14:15], v[14:15], v[16:17], v[14:15]
	v_fma_f64 v[12:13], v[12:13], v[16:17], v[12:13]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], -v[14:15], v[14:15], v[10:11]
	v_fma_f64 v[14:15], v[16:17], v[12:13], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], -v[14:15], v[14:15], v[10:11]
	v_fma_f64 v[12:13], v[16:17], v[12:13], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ldexp_f64 v[12:13], v[12:13], v0
	v_dual_cndmask_b32 v11, v13, v11 :: v_dual_cndmask_b32 v10, v12, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[10:11], v[6:7], v[10:11]
	v_mul_f64 v[12:13], v[10:11], -0.5
	v_fma_f64 v[10:11], v[10:11], -0.5, -1.0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_i32_f64_e32 v0, v[12:13]
	v_cvt_f64_i32_e32 v[14:15], v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_cmp_eq_f64_e32 vcc_lo, v[12:13], v[14:15]
	v_dual_cndmask_b32 v11, v13, v11 :: v_dual_cndmask_b32 v10, v12, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_u32_f64_e32 v0, v[10:11]
	v_mad_u64_u32 v[10:11], null, v0, v0, v[0:1]
	v_mul_lo_u32 v11, s4, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshrrev_b32_e32 v10, 1, v10
	v_sub_nc_u32_e32 v12, v10, v11
	v_mad_u64_u32 v[10:11], null, v0, 40, s[0:1]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add3_u32 v0, v1, v12, 1
	v_add_nc_u32_e32 v1, s6, v1
	v_mad_u64_u32 v[14:15], null, v0, 40, s[0:1]
	s_clause 0x3
	global_load_b64 v[18:19], v[10:11], off offset:16
	global_load_b64 v[20:21], v[14:15], off offset:16
	global_load_b128 v[10:13], v[10:11], off
	global_load_b128 v[14:17], v[14:15], off
	s_waitcnt vmcnt(2)
	v_add_f64 v[18:19], v[18:19], -v[20:21]
	s_waitcnt vmcnt(1)
	v_mul_f64 v[10:11], v[10:11], s[2:3]
	s_waitcnt vmcnt(0)
	v_add_f64 v[12:13], v[12:13], -v[16:17]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_f64 v[16:17], v[18:19], v[18:19]
	v_mul_f64 v[10:11], v[10:11], v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[12:13], v[12:13], v[12:13], v[16:17]
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[12:13]
	v_cndmask_b32_e64 v0, 0, 1, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b32_e32 v0, 8, v0
	v_ldexp_f64 v[12:13], v[12:13], v0
	v_cndmask_b32_e64 v0, 0, 0xffffff80, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_rsq_f64_e32 v[16:17], v[12:13]
	v_cmp_class_f64_e64 vcc_lo, v[12:13], 0x260
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[18:19], v[12:13], v[16:17]
	v_mul_f64 v[16:17], v[16:17], 0.5
	v_fma_f64 v[20:21], -v[16:17], v[18:19], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[18:19], v[18:19], v[20:21], v[18:19]
	v_fma_f64 v[16:17], v[16:17], v[20:21], v[16:17]
	v_fma_f64 v[20:21], -v[18:19], v[18:19], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[20:21], v[16:17], v[18:19]
	v_fma_f64 v[20:21], -v[18:19], v[18:19], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], v[20:21], v[16:17], v[18:19]
	v_ldexp_f64 v[16:17], v[16:17], v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_cndmask_b32 v13, v17, v13 :: v_dual_cndmask_b32 v12, v16, v12
	v_div_scale_f64 v[14:15], null, v[12:13], v[12:13], v[10:11]
	v_div_scale_f64 v[20:21], vcc_lo, v[10:11], v[12:13], v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[16:17], v[14:15]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[18:19], -v[14:15], v[16:17], 1.0
	v_fma_f64 v[16:17], v[16:17], v[18:19], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], -v[14:15], v[16:17], 1.0
	v_fma_f64 v[16:17], v[16:17], v[18:19], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[18:19], v[20:21], v[16:17]
	v_fma_f64 v[14:15], -v[14:15], v[18:19], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_div_fmas_f64 v[14:15], v[14:15], v[16:17], v[18:19]
	v_cmp_le_u32_e32 vcc_lo, s5, v1
	s_or_b32 s7, vcc_lo, s7
	v_div_fixup_f64 v[10:11], v[14:15], v[12:13], v[10:11]
	s_delay_alu instid0(VALU_DEP_1)
	v_add_f64 v[4:5], v[4:5], v[10:11]
	global_store_b64 v[2:3], v[4:5], off
	s_and_not1_b32 exec_lo, exec_lo, s7
	s_cbranch_execnz .LBB4_2
.LBB4_3:                                ; %Flow29
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z23kernel_potential_energyPdiP10particle_s
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 22
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end4:
	.size	_Z23kernel_potential_energyPdiP10particle_s, .Lfunc_end4-_Z23kernel_potential_energyPdiP10particle_s
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 976
; NumSgprs: 18
; NumVgprs: 22
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 22
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13kernel_forcesPA2_dP10particle_siS0_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z13kernel_forcesPA2_dP10particle_siS0_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     34
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z19kernel_add_partialsiPA2_dS0_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z19kernel_add_partialsiPA2_dS0_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     14
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           8
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13kernel_updatePA2_dP10particle_sid
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z13kernel_updatePA2_dP10particle_sid.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     21
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z21kernel_kinetic_energyPdiP10particle_s
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z21kernel_kinetic_energyPdiP10particle_s.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     12
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z23kernel_potential_energyPdiP10particle_s
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z23kernel_potential_energyPdiP10particle_s.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     22
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
