#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <time.h>
#include <math.h>
#include <string.h>
#define EPSILON 1E-9
#define BLOCK_SIZE 1024
#define ALING 64


__device__ double distance( double* dx, double* dy, double* dz,
                             const double Ax,  const  double Ay, const  double Az,
                             const double Bx,  const  double By,  const  double Bz){
  
      double x = Ax - Bx;
      double y = Ay - By;
      double z = Az - Bz;

      *dx = x; *dy = y; *dz = z;
      x *= x; y *= y; z *= z;
      return 1.0 / sqrt((double)x + y + z + EPSILON);

}



__global__ void particleParticleForces_k (  double *px, double *py, double *pz,
                                            double *fx, double *fy, double *fz, double dt){
  extern __shared__  double buff[];
  double *sub_px = &buff[0],
          *sub_py = &buff[gridDim.x],
          *sub_pz = &buff[gridDim.x * 2];

  int i  = blockDim.x * blockIdx.x + threadIdx.x;
  double pX = px[i];
  double pY = py[i];
  double pZ = pz[i];

  double fX = fx[i];
  double fY = fy[i];
  double fZ = fz[i];
  
  for (int blk = 0; blk < gridDim.x; blk++){
      sub_px[threadIdx.x] = px[ blockDim.x * blk + threadIdx.x];
      sub_py[threadIdx.x] = py[ blockDim.x * blk + threadIdx.x];
      sub_pz[threadIdx.x] = pz[ blockDim.x * blk + threadIdx.x];
      __syncthreads();

    for (int j = 0; j < blockDim.x; j++){
      double dx = 0.0f,  dy = 0.0f, dz = 0.0f;
      double d  = distance(&dx, &dy, &dz, pX, pY, pZ, sub_px[j], sub_py[j], sub_pz[j]);

      fX += dx * d;
      fY += dy * d;
      fZ += dz * d;
    }
    __syncthreads();
  }

  fx[i] = fX;
  fy[i] = fY;
  fz[i] = fZ;
  
  
}

__global__ void particleParticleVelocityPosition_k (  double *px, double *py, double *pz,
                                                      double *vx, double *vy, double *vz,
                                                      double *fx, double *fy, double *fz, double dt){
  int i  = blockDim.x * blockIdx.x + threadIdx.x;
  vx[i] += dt * fx[i];
  vy[i] += dt * fy[i];
  vz[i] += dt * fz[i];

  px[i] += dt * vx[i];
  py[i] += dt * vy[i];
  pz[i] += dt * vz[i];

  
}

void particleParticle (double *px, double *py, double *pz,
                       double *vx, double *vy, double *vz,
                       double *fx, double *fy, double *fz,
                       int nParticles, int timesteps, double dt){
    int threads = BLOCK_SIZE,
    blocks  = nParticles / BLOCK_SIZE;
    if (nParticles < 1024){
      blocks = 1;
      threads = nParticles;
    }

    fprintf(stdout, "\n B(%d) T(%d) shared memory %d \n", blocks, threads, 3 * threads * sizeof(double));

    for (int t = 0; t < timesteps; t++){
      particleParticleForces_k<<<blocks, threads, 3 * threads * sizeof(double) >>>(px, py, pz, fx, fy, fz, dt);
      particleParticleVelocityPosition_k<<<blocks, threads  >>>(px, py, pz, vx, vy, vz, fx, fy, fz, dt);
      assert( cudaDeviceSynchronize() == cudaSuccess);
    }//end-for (int t = 0; t < timesteps; t++){

}//end-void particleParticle


//-----------------------------------------------------------------------------------------------------
void printLog(double *px, double *py, double *pz,
  double *vx, double *vy, double *vz,
  double *fx, double *fy, double *fz, int nParticles, int timestep);
void initialCondition(double *px, double *py, double *pz,
          double *vx, double *vy, double *vz,
          double *fx, double *fy, double *fz, int nParticles);
//-----------------------------------------------------------------------------------------------------
int main (int ac, char **av){
  int timesteps  = atoi(av[1]),
      nParticles = atoi(av[2]),
      flagSave = atoi(av[3]);

  double  dt =  0.00001f,
          *h_px = NULL, *h_py = NULL, *h_pz = NULL,
          *h_vx = NULL, *h_vy = NULL, *h_vz = NULL,
          *h_fx = NULL, *h_fy = NULL, *h_fz = NULL,

          *d_px = NULL, *d_py = NULL, *d_pz = NULL,
          *d_vx = NULL, *d_vy = NULL, *d_vz = NULL,
          *d_fx = NULL, *d_fy = NULL, *d_fz = NULL;


    fprintf(stdout, "\nParcile system particle to particle \n");
    fprintf(stdout, "Memory used %lu bytes \n", nParticles * sizeof(double) * 9);

    h_px = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_px != NULL);
    h_py = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_py != NULL);
    h_pz = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_pz != NULL);
//-------------------------
    h_vx = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_vx != NULL);
    h_vy = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_vy != NULL);
    h_vz = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_vz != NULL);

//-------------------------
    h_fx = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_fx != NULL);
    h_fy = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_fy != NULL);
    h_fz = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_fz != NULL);
//-------------------------

    initialCondition(h_px, h_py, h_pz,
                     h_vx, h_vy, h_vz,
                     h_fx, h_fy, h_fz, nParticles);

    assert(cudaMalloc((void**) &d_px, nParticles * sizeof(double)) == cudaSuccess);
    assert(cudaMemcpy(d_px, h_px, nParticles * sizeof(double),  cudaMemcpyHostToDevice) == cudaSuccess);

    assert(cudaMalloc((void**) &d_py, nParticles * sizeof(double)) == cudaSuccess);
    assert(cudaMemcpy(d_py, h_py, nParticles * sizeof(double),  cudaMemcpyHostToDevice) == cudaSuccess);

    assert(cudaMalloc((void**) &d_pz, nParticles * sizeof(double)) == cudaSuccess);
    assert(cudaMemcpy(d_pz, h_pz, nParticles * sizeof(double),  cudaMemcpyHostToDevice) == cudaSuccess);
    //-----
    assert(cudaMalloc((void**) &d_vx, nParticles * sizeof(double)) == cudaSuccess);
    assert(cudaMemcpy(d_vx, h_vx, nParticles * sizeof(double),  cudaMemcpyHostToDevice) == cudaSuccess);

    assert(cudaMalloc((void**) &d_vy, nParticles * sizeof(double)) == cudaSuccess);
    assert(cudaMemcpy(d_vy, h_vy, nParticles * sizeof(double),  cudaMemcpyHostToDevice) == cudaSuccess);

    assert(cudaMalloc((void**) &d_vz, nParticles * sizeof(double)) == cudaSuccess);
    assert(cudaMemcpy(d_vz, h_vz, nParticles * sizeof(double),  cudaMemcpyHostToDevice) == cudaSuccess);
    //-----
    assert(cudaMalloc((void**) &d_fx, nParticles * sizeof(double)) == cudaSuccess);
    assert(cudaMemcpy(d_fx, h_fx, nParticles * sizeof(double),  cudaMemcpyHostToDevice) == cudaSuccess);

    assert(cudaMalloc((void**) &d_fy, nParticles * sizeof(double)) == cudaSuccess);
    assert(cudaMemcpy(d_fy, h_fy, nParticles * sizeof(double),  cudaMemcpyHostToDevice) == cudaSuccess);

    assert(cudaMalloc((void**) &d_fz, nParticles * sizeof(double)) == cudaSuccess);
    assert(cudaMemcpy(d_fz, h_fz, nParticles * sizeof(double),  cudaMemcpyHostToDevice) == cudaSuccess);



    
    particleParticle(d_px, d_py, d_pz, d_vx, d_vy, d_vz, d_fx, d_fy, d_fz, nParticles, timesteps, dt);
    

    assert(cudaMemcpy(h_px, d_px, nParticles * sizeof(double),  cudaMemcpyDeviceToHost) == cudaSuccess); 
    assert(cudaMemcpy(h_py, d_py, nParticles * sizeof(double),  cudaMemcpyDeviceToHost) == cudaSuccess);
    assert(cudaMemcpy(h_pz, d_pz, nParticles * sizeof(double),  cudaMemcpyDeviceToHost) == cudaSuccess);

    assert(cudaMemcpy(h_vx, d_vx, nParticles * sizeof(double),  cudaMemcpyDeviceToHost) == cudaSuccess);
    assert(cudaMemcpy(h_vy, d_vy, nParticles * sizeof(double),  cudaMemcpyDeviceToHost) == cudaSuccess); 
    assert(cudaMemcpy(h_vz, d_vz, nParticles * sizeof(double),  cudaMemcpyDeviceToHost) == cudaSuccess);

    assert(cudaMemcpy(h_fx, d_fx, nParticles * sizeof(double),  cudaMemcpyDeviceToHost) == cudaSuccess);
    assert(cudaMemcpy(h_fy, d_fy, nParticles * sizeof(double),  cudaMemcpyDeviceToHost) == cudaSuccess);
    assert(cudaMemcpy(h_fz, d_fz, nParticles * sizeof(double),  cudaMemcpyDeviceToHost) == cudaSuccess);

//    printLog(h_px, h_py, h_pz, h_vx, h_vy, h_vz, h_fx, h_fy, h_fz,  nParticles, timesteps);

    if (flagSave == 1)
      printLog(h_px, h_py, h_pz, h_vx, h_vy, h_vz, h_fx, h_fy, h_fz, nParticles, timesteps);

    free(h_px);free(h_py); free(h_pz);
    free(h_vx);free(h_vy); free(h_vz);
    free(h_fx);free(h_fy); free(h_fz);


    cudaFree(d_px);cudaFree(d_py); cudaFree(d_pz);
    cudaFree(d_vx);cudaFree(d_vy); cudaFree(d_vz);
    cudaFree(d_fx);cudaFree(d_fy); cudaFree(d_fz);



}


/*Declarando as structs de particula e forca*/
void printLog(double *px, double *py, double *pz,
  double *vx, double *vy, double *vz,
  double *fx, double *fy, double *fz, int nParticles, int timestep){
  char fileName[128];
  sprintf(fileName, "%s-%d-log.bin", __FILE__,  timestep);
  fprintf(stdout, "Saving file [%s] ", fileName); fflush(stdout);
  FILE *ptr = fopen(fileName, "w+");
  for(int i = 0; i < nParticles; i++){
    fprintf(ptr, "%d \t %.10f %.10f %.10f \t %.10f %.10f %.10f \t %.10f %.10f %.10f \n", i,  px[i], py[i], pz[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i]);

  }
  fclose(ptr);
  fprintf(stdout, "[OK]\n"); fflush(stdout);
}
void initialCondition(double *px, double *py, double *pz,
          double *vx, double *vy, double *vz,
          double *fx, double *fy, double *fz, int nParticles){

    srand(42);
    memset(vx, 0x00, nParticles * sizeof(double));
    memset(vy, 0x00, nParticles * sizeof(double));
    memset(vz, 0x00, nParticles * sizeof(double));

    memset(fx, 0x00, nParticles * sizeof(double));
    memset(fy, 0x00, nParticles * sizeof(double));
    memset(fz, 0x00, nParticles * sizeof(double));

    for (int i = 0; i < nParticles ; i++){
        px[i] =  2.0 * (rand() / (double)RAND_MAX) - 1.0;
        py[i] =  2.0 * (rand() / (double)RAND_MAX) - 1.0;
        pz[i] =  2.0 * (rand() / (double)RAND_MAX) - 1.0;
    }//end-for (int i = 0; i < nParticles ; i++){

}
	.file	"tmpxft_002ed3f8_00000000-6_main-n-bodies-2.0.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2034:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2034:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z8distancePdS_S_dddddd
	.type	_Z8distancePdS_S_dddddd, @function
_Z8distancePdS_S_dddddd:
.LFB2027:
	.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
.LFE2027:
	.size	_Z8distancePdS_S_dddddd, .-_Z8distancePdS_S_dddddd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/marzam/HPC-Aula/main/exemplos/problems-profile/nbody-cuda-profile/main-n-bodies-2.0.cu"
.LC1:
	.string	"%s-%d-log.bin"
.LC2:
	.string	"Saving file [%s] "
.LC3:
	.string	"w+"
.LC4:
	.string	"%d \t %.10f %.10f %.10f \t %.10f %.10f %.10f \t %.10f %.10f %.10f \n"
.LC5:
	.string	"[OK]\n"
	.text
	.globl	_Z8printLogPdS_S_S_S_S_S_S_S_ii
	.type	_Z8printLogPdS_S_S_S_S_S_S_S_ii, @function
_Z8printLogPdS_S_S_S_S_S_S_S_ii:
.LFB2030:
	.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
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r9, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r8, %rbp
	leaq	.LC0(%rip), %r8
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$200, %rsp
	.cfi_def_cfa_offset 256
	movq	%rsi, 16(%rsp)
	movl	288(%rsp), %r9d
	movl	$2, %esi
	movq	%rdx, 24(%rsp)
	movl	$128, %edx
	movq	256(%rsp), %r13
	movq	%rcx, 32(%rsp)
	leaq	.LC1(%rip), %rcx
	movq	264(%rsp), %r14
	movq	272(%rsp), %r15
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	__sprintf_chk@PLT
	movq	8(%rsp), %rcx
	movl	$2, %esi
	xorl	%eax, %eax
	movq	stdout(%rip), %rdi
	leaq	.LC2(%rip), %rdx
	call	__fprintf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	8(%rsp), %rdi
	leaq	.LC3(%rip), %rsi
	call	fopen@PLT
	xorl	%r8d, %r8d
	movq	%rax, %rdi
.L5:
	movl	%r8d, %ecx
	cmpl	%r8d, 280(%rsp)
	jle	.L10
	movsd	(%rbx,%r8,8), %xmm0
	pushq	%rax
	.cfi_def_cfa_offset 264
	movl	$2, %esi
	leaq	.LC4(%rip), %rdx
	pushq	(%r15,%r8,8)
	.cfi_def_cfa_offset 272
	movq	48(%rsp), %rax
	movsd	(%r14,%r8,8), %xmm7
	movsd	(%rax,%r8,8), %xmm3
	movq	40(%rsp), %rax
	movsd	0(%r13,%r8,8), %xmm6
	movsd	(%r12,%r8,8), %xmm5
	movq	%r8, 56(%rsp)
	movsd	(%rax,%r8,8), %xmm2
	movq	32(%rsp), %rax
	movq	%rdi, 24(%rsp)
	movsd	0(%rbp,%r8,8), %xmm4
	movsd	(%rax,%r8,8), %xmm1
	movb	$8, %al
	call	__fprintf_chk@PLT
	movq	56(%rsp), %r8
	popq	%rdx
	.cfi_def_cfa_offset 264
	popq	%rcx
	.cfi_def_cfa_offset 256
	movq	8(%rsp), %rdi
	incq	%r8
	jmp	.L5
.L10:
	call	fclose@PLT
	movq	stdout(%rip), %rdi
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	addq	$200, %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
.LFE2030:
	.size	_Z8printLogPdS_S_S_S_S_S_S_S_ii, .-_Z8printLogPdS_S_S_S_S_S_S_S_ii
	.globl	_Z16initialConditionPdS_S_S_S_S_S_S_S_i
	.type	_Z16initialConditionPdS_S_S_S_S_S_S_S_i, @function
_Z16initialConditionPdS_S_S_S_S_S_S_S_i:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %r13
	movl	$42, %edi
	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	%r9, %rbx
	pushq	%r10
	.cfi_def_cfa_offset 64
	call	srand@PLT
	movslq	88(%rsp), %rdx
	xorl	%eax, %eax
	movq	%r12, %rdi
	salq	$3, %rdx
	movq	%rdx, %rcx
	rep stosb
	movq	%rbp, %rdi
	movq	%rdx, %rcx
	rep stosb
	movq	%rbx, %rdi
	movq	%rdx, %rcx
	xorl	%ebx, %ebx
	rep stosb
	movq	64(%rsp), %rdi
	movq	%rdx, %rcx
	rep stosb
	movq	72(%rsp), %rdi
	movq	%rdx, %rcx
	rep stosb
	movq	80(%rsp), %rdi
	movq	%rdx, %rcx
	rep stosb
.L12:
	cmpl	%ebx, 88(%rsp)
	jle	.L15
	call	rand@PLT
	cvtsi2sdl	%eax, %xmm0
	divsd	.LC6(%rip), %xmm0
	addsd	%xmm0, %xmm0
	subsd	.LC7(%rip), %xmm0
	movsd	%xmm0, 0(%r13,%rbx,8)
	call	rand@PLT
	cvtsi2sdl	%eax, %xmm0
	divsd	.LC6(%rip), %xmm0
	addsd	%xmm0, %xmm0
	subsd	.LC7(%rip), %xmm0
	movsd	%xmm0, (%r14,%rbx,8)
	call	rand@PLT
	cvtsi2sdl	%eax, %xmm0
	divsd	.LC6(%rip), %xmm0
	addsd	%xmm0, %xmm0
	subsd	.LC7(%rip), %xmm0
	movsd	%xmm0, (%r15,%rbx,8)
	incq	%rbx
	jmp	.L12
.L15:
	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
.LFE2031:
	.size	_Z16initialConditionPdS_S_S_S_S_S_S_S_i, .-_Z16initialConditionPdS_S_S_S_S_S_S_S_i
	.globl	_Z55__device_stub__Z24particleParticleForces_kPdS_S_S_S_S_dPdS_S_S_S_S_d
	.type	_Z55__device_stub__Z24particleParticleForces_kPdS_S_S_S_S_dPdS_S_S_S_S_d, @function
_Z55__device_stub__Z24particleParticleForces_kPdS_S_S_S_S_dPdS_S_S_S_S_d:
.LFB2056:
	.cfi_startproc
	endbr64
	subq	$200, %rsp
	.cfi_def_cfa_offset 208
	movq	%rdi, 56(%rsp)
	leaq	80(%rsp), %rdi
	movq	%rsi, 48(%rsp)
	leaq	92(%rsp), %rsi
	movq	%rdx, 40(%rsp)
	leaq	64(%rsp), %rdx
	movq	%rcx, 32(%rsp)
	leaq	72(%rsp), %rcx
	movq	%r8, 24(%rsp)
	movq	%r9, 16(%rsp)
	movsd	%xmm0, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rax
	movl	$1, 88(%rsp)
	movq	%rax, 128(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 176(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 80(%rsp)
	movq	%rax, 92(%rsp)
	movl	$1, 100(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L16
	pushq	72(%rsp)
	.cfi_def_cfa_offset 216
	leaq	_Z24particleParticleForces_kPdS_S_S_S_S_d(%rip), %rdi
	pushq	72(%rsp)
	.cfi_def_cfa_offset 224
	movq	108(%rsp), %rcx
	movl	116(%rsp), %r8d
	movq	96(%rsp), %rsi
	movl	104(%rsp), %edx
	leaq	144(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 216
	popq	%rdx
	.cfi_def_cfa_offset 208
.L16:
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	addq	$200, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2056:
	.size	_Z55__device_stub__Z24particleParticleForces_kPdS_S_S_S_S_dPdS_S_S_S_S_d, .-_Z55__device_stub__Z24particleParticleForces_kPdS_S_S_S_S_dPdS_S_S_S_S_d
	.globl	_Z24particleParticleForces_kPdS_S_S_S_S_d
	.type	_Z24particleParticleForces_kPdS_S_S_S_S_d, @function
_Z24particleParticleForces_kPdS_S_S_S_S_d:
.LFB2057:
	.cfi_startproc
	endbr64
	jmp	_Z55__device_stub__Z24particleParticleForces_kPdS_S_S_S_S_dPdS_S_S_S_S_d
	.cfi_endproc
.LFE2057:
	.size	_Z24particleParticleForces_kPdS_S_S_S_S_d, .-_Z24particleParticleForces_kPdS_S_S_S_S_d
	.globl	_Z71__device_stub__Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_dPdS_S_S_S_S_S_S_S_d
	.type	_Z71__device_stub__Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_dPdS_S_S_S_S_S_S_S_d, @function
_Z71__device_stub__Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_dPdS_S_S_S_S_S_S_S_d:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$248, %rsp
	.cfi_def_cfa_offset 256
	movq	256(%rsp), %rax
	movq	%rdi, 72(%rsp)
	leaq	104(%rsp), %rdi
	movq	%rsi, 64(%rsp)
	leaq	116(%rsp), %rsi
	movq	%rax, 24(%rsp)
	movq	264(%rsp), %rax
	movq	%rdx, 56(%rsp)
	leaq	88(%rsp), %rdx
	movq	%rax, 16(%rsp)
	movq	272(%rsp), %rax
	movq	%rcx, 48(%rsp)
	leaq	96(%rsp), %rcx
	movq	%r8, 40(%rsp)
	movq	%r9, 32(%rsp)
	movq	%rax, 8(%rsp)
	movsd	%xmm0, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 232(%rsp)
	xorl	%eax, %eax
	leaq	72(%rsp), %rax
	movl	$1, 112(%rsp)
	movq	%rax, 152(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 192(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 200(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 208(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 216(%rsp)
	movq	%rsp, %rax
	movq	%rax, 224(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 104(%rsp)
	movq	%rax, 116(%rsp)
	movl	$1, 124(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L21
	pushq	96(%rsp)
	.cfi_def_cfa_offset 264
	leaq	_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d(%rip), %rdi
	pushq	96(%rsp)
	.cfi_def_cfa_offset 272
	movq	132(%rsp), %rcx
	movl	140(%rsp), %r8d
	movq	120(%rsp), %rsi
	movl	128(%rsp), %edx
	leaq	168(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 264
	popq	%rdx
	.cfi_def_cfa_offset 256
.L21:
	movq	232(%rsp), %rax
	subq	%fs:40, %rax
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	addq	$248, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z71__device_stub__Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_dPdS_S_S_S_S_S_S_S_d, .-_Z71__device_stub__Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_dPdS_S_S_S_S_S_S_S_d
	.globl	_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	.type	_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d, @function
_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z71__device_stub__Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_dPdS_S_S_S_S_S_S_S_d
	.cfi_endproc
.LFE2059:
	.size	_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d, .-_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	.section	.rodata.str1.1
.LC8:
	.string	"\n B(%d) T(%d) shared memory %d \n"
	.text
	.globl	_Z16particleParticlePdS_S_S_S_S_S_S_S_iid
	.type	_Z16particleParticlePdS_S_S_S_S_S_S_S_iid, @function
_Z16particleParticlePdS_S_S_S_S_S_S_S_iid:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%r9, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r8, %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	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movl	168(%rsp), %ebx
	movq	%rdi, 8(%rsp)
	movq	%rsi, 16(%rsp)
	movq	%rdx, 24(%rsp)
	movq	%rcx, 40(%rsp)
	movsd	%xmm0, 32(%rsp)
	cmpl	$1023, %ebx
	jle	.L27
	sarl	$10, %ebx
	movl	%ebx, %ebp
	movl	$1024, %ebx
.L27:
	leal	(%rbx,%rbx,2), %eax
	movq	stdout(%rip), %rdi
	movl	%ebx, %r8d
	movl	%ebp, %ecx
	cltq
	leaq	.LC8(%rip), %rdx
	movl	$2, %esi
	xorl	%r13d, %r13d
	movabsq	$4294967297, %r12
	salq	$3, %rax
	movq	%rax, (%rsp)
	movq	%rax, %r9
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L28:
	cmpl	176(%rsp), %r13d
	jge	.L35
	movq	%r12, 72(%rsp)
	movq	(%rsp), %r8
	xorl	%r9d, %r9d
	movq	%r12, 60(%rsp)
	movl	76(%rsp), %ecx
	movl	%ebx, 68(%rsp)
	movl	64(%rsp), %esi
	movl	%ebp, 56(%rsp)
	movq	68(%rsp), %rdx
	movq	56(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L29
	movsd	32(%rsp), %xmm0
	movq	160(%rsp), %r9
	movq	152(%rsp), %r8
	movq	144(%rsp), %rcx
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	_Z55__device_stub__Z24particleParticleForces_kPdS_S_S_S_S_dPdS_S_S_S_S_d
.L29:
	movq	%r12, 72(%rsp)
	movl	76(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r12, 60(%rsp)
	movl	64(%rsp), %esi
	movl	%ebx, 68(%rsp)
	movq	68(%rsp), %rdx
	movl	%ebp, 56(%rsp)
	movq	56(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L30
	pushq	%rax
	.cfi_def_cfa_offset 152
	movq	%r15, %r9
	movq	%r14, %r8
	pushq	168(%rsp)
	.cfi_def_cfa_offset 160
	pushq	168(%rsp)
	.cfi_def_cfa_offset 168
	pushq	168(%rsp)
	.cfi_def_cfa_offset 176
	movsd	64(%rsp), %xmm0
	movq	72(%rsp), %rcx
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	movq	40(%rsp), %rdi
	call	_Z71__device_stub__Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_dPdS_S_S_S_S_S_S_S_d
	addq	$32, %rsp
	.cfi_def_cfa_offset 144
.L30:
	incl	%r13d
	jmp	.L28
.L35:
	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
.LFE2028:
	.size	_Z16particleParticlePdS_S_S_S_S_S_S_S_iid, .-_Z16particleParticlePdS_S_S_S_S_S_S_S_iid
	.section	.rodata.str1.1
.LC9:
	.string	"\nParcile system particle to particle \n"
.LC10:
	.string	"Memory used %lu bytes \n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2029:
	.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
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	8(%rsi), %rdi
	call	atoi@PLT
	movq	16(%rbx), %rdi
	movl	%eax, %r14d
	call	atoi@PLT
	movq	24(%rbx), %rdi
	movl	%eax, %ebp
	call	atoi@PLT
	movq	stdout(%rip), %rdi
	movl	$2, %esi
	movslq	%ebp, %rbx
	movl	%eax, %r15d
	leaq	.LC9(%rip), %rdx
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	imulq	$72, %rbx, %rcx
	movl	$2, %esi
	xorl	%eax, %eax
	movq	stdout(%rip), %rdi
	leaq	.LC10(%rip), %rdx
	salq	$3, %rbx
	call	__fprintf_chk@PLT
	movq	%rbx, %rsi
	movl	$64, %edi
	call	aligned_alloc@PLT
	movq	%rbx, %rsi
	movl	$64, %edi
	movq	%rax, (%rsp)
	call	aligned_alloc@PLT
	movq	%rbx, %rsi
	movl	$64, %edi
	movq	%rax, 8(%rsp)
	call	aligned_alloc@PLT
	movq	%rbx, %rsi
	movl	$64, %edi
	movq	%rax, 16(%rsp)
	call	aligned_alloc@PLT
	movq	%rbx, %rsi
	movl	$64, %edi
	movq	%rax, 24(%rsp)
	call	aligned_alloc@PLT
	movq	%rbx, %rsi
	movl	$64, %edi
	movq	%rax, 32(%rsp)
	call	aligned_alloc@PLT
	movq	%rbx, %rsi
	movl	$64, %edi
	movq	%rax, 40(%rsp)
	call	aligned_alloc@PLT
	movq	%rbx, %rsi
	movl	$64, %edi
	movq	%rax, %r13
	call	aligned_alloc@PLT
	movq	%rbx, %rsi
	movl	$64, %edi
	movq	%rax, %r12
	call	aligned_alloc@PLT
	pushq	%rbp
	.cfi_def_cfa_offset 120
	pushq	%rax
	.cfi_def_cfa_offset 128
	movq	%rax, %rbx
	pushq	%r12
	.cfi_def_cfa_offset 136
	pushq	%r13
	.cfi_def_cfa_offset 144
	movq	72(%rsp), %r9
	movq	64(%rsp), %r8
	movq	56(%rsp), %rcx
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rsi
	movq	32(%rsp), %rdi
	call	_Z16initialConditionPdS_S_S_S_S_S_S_S_i
	addq	$24, %rsp
	.cfi_def_cfa_offset 120
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	pushq	%r14
	.cfi_def_cfa_offset 128
	movsd	.LC11(%rip), %xmm0
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	pushq	%rbp
	.cfi_def_cfa_offset 136
	xorl	%esi, %esi
	xorl	%edi, %edi
	pushq	$0
	.cfi_def_cfa_offset 144
	pushq	$0
	.cfi_def_cfa_offset 152
	pushq	$0
	.cfi_def_cfa_offset 160
	call	_Z16particleParticlePdS_S_S_S_S_S_S_S_iid
	addq	$48, %rsp
	.cfi_def_cfa_offset 112
	decl	%r15d
	jne	.L37
	pushq	%rax
	.cfi_def_cfa_offset 120
	pushq	%r14
	.cfi_def_cfa_offset 128
	pushq	%rbp
	.cfi_def_cfa_offset 136
	pushq	%rbx
	.cfi_def_cfa_offset 144
	pushq	%r12
	.cfi_def_cfa_offset 152
	pushq	%r13
	.cfi_def_cfa_offset 160
	movq	88(%rsp), %r9
	movq	80(%rsp), %r8
	movq	72(%rsp), %rcx
	movq	64(%rsp), %rdx
	movq	56(%rsp), %rsi
	movq	48(%rsp), %rdi
	call	_Z8printLogPdS_S_S_S_S_S_S_S_ii
	addq	$48, %rsp
	.cfi_def_cfa_offset 112
.L37:
	movq	(%rsp), %rdi
	call	free@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	32(%rsp), %rdi
	call	free@PLT
	movq	40(%rsp), %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	xorl	%edi, %edi
	call	cudaFree@PLT
	xorl	%edi, %edi
	call	cudaFree@PLT
	xorl	%edi, %edi
	call	cudaFree@PLT
	xorl	%edi, %edi
	call	cudaFree@PLT
	xorl	%edi, %edi
	call	cudaFree@PLT
	xorl	%edi, %edi
	call	cudaFree@PLT
	xorl	%edi, %edi
	call	cudaFree@PLT
	xorl	%edi, %edi
	call	cudaFree@PLT
	xorl	%edi, %edi
	call	cudaFree@PLT
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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
.LFE2029:
	.size	main, .-main
	.section	.rodata.str1.1
.LC12:
	.string	"_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d"
.LC13:
	.string	"_Z24particleParticleForces_kPdS_S_S_S_S_d"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2061:
	.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	.LC12(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d(%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	.LC13(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z24particleParticleForces_kPdS_S_S_S_S_d(%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
.LFE2061:
	.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	-4194304
	.long	1105199103
	.align 8
.LC7:
	.long	0
	.long	1072693248
	.align 8
.LC11:
	.long	-2147483648
	.long	1055193269
	.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 <assert.h>
#include <time.h>
#include <math.h>
#include <string.h>
#define EPSILON 1E-9
#define BLOCK_SIZE 1024
#define ALING 64


__device__ double distance( double* dx, double* dy, double* dz,
                             const double Ax,  const  double Ay, const  double Az,
                             const double Bx,  const  double By,  const  double Bz){
  
      double x = Ax - Bx;
      double y = Ay - By;
      double z = Az - Bz;

      *dx = x; *dy = y; *dz = z;
      x *= x; y *= y; z *= z;
      return 1.0 / sqrt((double)x + y + z + EPSILON);

}



__global__ void particleParticleForces_k (  double *px, double *py, double *pz,
                                            double *fx, double *fy, double *fz, double dt){
  extern __shared__  double buff[];
  double *sub_px = &buff[0],
          *sub_py = &buff[gridDim.x],
          *sub_pz = &buff[gridDim.x * 2];

  int i  = blockDim.x * blockIdx.x + threadIdx.x;
  double pX = px[i];
  double pY = py[i];
  double pZ = pz[i];

  double fX = fx[i];
  double fY = fy[i];
  double fZ = fz[i];
  
  for (int blk = 0; blk < gridDim.x; blk++){
      sub_px[threadIdx.x] = px[ blockDim.x * blk + threadIdx.x];
      sub_py[threadIdx.x] = py[ blockDim.x * blk + threadIdx.x];
      sub_pz[threadIdx.x] = pz[ blockDim.x * blk + threadIdx.x];
      __syncthreads();

    for (int j = 0; j < blockDim.x; j++){
      double dx = 0.0f,  dy = 0.0f, dz = 0.0f;
      double d  = distance(&dx, &dy, &dz, pX, pY, pZ, sub_px[j], sub_py[j], sub_pz[j]);

      fX += dx * d;
      fY += dy * d;
      fZ += dz * d;
    }
    __syncthreads();
  }

  fx[i] = fX;
  fy[i] = fY;
  fz[i] = fZ;
  
  
}

__global__ void particleParticleVelocityPosition_k (  double *px, double *py, double *pz,
                                                      double *vx, double *vy, double *vz,
                                                      double *fx, double *fy, double *fz, double dt){
  int i  = blockDim.x * blockIdx.x + threadIdx.x;
  vx[i] += dt * fx[i];
  vy[i] += dt * fy[i];
  vz[i] += dt * fz[i];

  px[i] += dt * vx[i];
  py[i] += dt * vy[i];
  pz[i] += dt * vz[i];

  
}

void particleParticle (double *px, double *py, double *pz,
                       double *vx, double *vy, double *vz,
                       double *fx, double *fy, double *fz,
                       int nParticles, int timesteps, double dt){
    int threads = BLOCK_SIZE,
    blocks  = nParticles / BLOCK_SIZE;
    if (nParticles < 1024){
      blocks = 1;
      threads = nParticles;
    }

    fprintf(stdout, "\n B(%d) T(%d) shared memory %d \n", blocks, threads, 3 * threads * sizeof(double));

    for (int t = 0; t < timesteps; t++){
      particleParticleForces_k<<<blocks, threads, 3 * threads * sizeof(double) >>>(px, py, pz, fx, fy, fz, dt);
      particleParticleVelocityPosition_k<<<blocks, threads  >>>(px, py, pz, vx, vy, vz, fx, fy, fz, dt);
      assert( hipDeviceSynchronize() == hipSuccess);
    }//end-for (int t = 0; t < timesteps; t++){

}//end-void particleParticle


//-----------------------------------------------------------------------------------------------------
void printLog(double *px, double *py, double *pz,
  double *vx, double *vy, double *vz,
  double *fx, double *fy, double *fz, int nParticles, int timestep);
void initialCondition(double *px, double *py, double *pz,
          double *vx, double *vy, double *vz,
          double *fx, double *fy, double *fz, int nParticles);
//-----------------------------------------------------------------------------------------------------
int main (int ac, char **av){
  int timesteps  = atoi(av[1]),
      nParticles = atoi(av[2]),
      flagSave = atoi(av[3]);

  double  dt =  0.00001f,
          *h_px = NULL, *h_py = NULL, *h_pz = NULL,
          *h_vx = NULL, *h_vy = NULL, *h_vz = NULL,
          *h_fx = NULL, *h_fy = NULL, *h_fz = NULL,

          *d_px = NULL, *d_py = NULL, *d_pz = NULL,
          *d_vx = NULL, *d_vy = NULL, *d_vz = NULL,
          *d_fx = NULL, *d_fy = NULL, *d_fz = NULL;


    fprintf(stdout, "\nParcile system particle to particle \n");
    fprintf(stdout, "Memory used %lu bytes \n", nParticles * sizeof(double) * 9);

    h_px = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_px != NULL);
    h_py = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_py != NULL);
    h_pz = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_pz != NULL);
//-------------------------
    h_vx = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_vx != NULL);
    h_vy = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_vy != NULL);
    h_vz = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_vz != NULL);

//-------------------------
    h_fx = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_fx != NULL);
    h_fy = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_fy != NULL);
    h_fz = (double *) aligned_alloc(ALING, nParticles * sizeof(double));
    assert(h_fz != NULL);
//-------------------------

    initialCondition(h_px, h_py, h_pz,
                     h_vx, h_vy, h_vz,
                     h_fx, h_fy, h_fz, nParticles);

    assert(hipMalloc((void**) &d_px, nParticles * sizeof(double)) == hipSuccess);
    assert(hipMemcpy(d_px, h_px, nParticles * sizeof(double),  hipMemcpyHostToDevice) == hipSuccess);

    assert(hipMalloc((void**) &d_py, nParticles * sizeof(double)) == hipSuccess);
    assert(hipMemcpy(d_py, h_py, nParticles * sizeof(double),  hipMemcpyHostToDevice) == hipSuccess);

    assert(hipMalloc((void**) &d_pz, nParticles * sizeof(double)) == hipSuccess);
    assert(hipMemcpy(d_pz, h_pz, nParticles * sizeof(double),  hipMemcpyHostToDevice) == hipSuccess);
    //-----
    assert(hipMalloc((void**) &d_vx, nParticles * sizeof(double)) == hipSuccess);
    assert(hipMemcpy(d_vx, h_vx, nParticles * sizeof(double),  hipMemcpyHostToDevice) == hipSuccess);

    assert(hipMalloc((void**) &d_vy, nParticles * sizeof(double)) == hipSuccess);
    assert(hipMemcpy(d_vy, h_vy, nParticles * sizeof(double),  hipMemcpyHostToDevice) == hipSuccess);

    assert(hipMalloc((void**) &d_vz, nParticles * sizeof(double)) == hipSuccess);
    assert(hipMemcpy(d_vz, h_vz, nParticles * sizeof(double),  hipMemcpyHostToDevice) == hipSuccess);
    //-----
    assert(hipMalloc((void**) &d_fx, nParticles * sizeof(double)) == hipSuccess);
    assert(hipMemcpy(d_fx, h_fx, nParticles * sizeof(double),  hipMemcpyHostToDevice) == hipSuccess);

    assert(hipMalloc((void**) &d_fy, nParticles * sizeof(double)) == hipSuccess);
    assert(hipMemcpy(d_fy, h_fy, nParticles * sizeof(double),  hipMemcpyHostToDevice) == hipSuccess);

    assert(hipMalloc((void**) &d_fz, nParticles * sizeof(double)) == hipSuccess);
    assert(hipMemcpy(d_fz, h_fz, nParticles * sizeof(double),  hipMemcpyHostToDevice) == hipSuccess);



    
    particleParticle(d_px, d_py, d_pz, d_vx, d_vy, d_vz, d_fx, d_fy, d_fz, nParticles, timesteps, dt);
    

    assert(hipMemcpy(h_px, d_px, nParticles * sizeof(double),  hipMemcpyDeviceToHost) == hipSuccess); 
    assert(hipMemcpy(h_py, d_py, nParticles * sizeof(double),  hipMemcpyDeviceToHost) == hipSuccess);
    assert(hipMemcpy(h_pz, d_pz, nParticles * sizeof(double),  hipMemcpyDeviceToHost) == hipSuccess);

    assert(hipMemcpy(h_vx, d_vx, nParticles * sizeof(double),  hipMemcpyDeviceToHost) == hipSuccess);
    assert(hipMemcpy(h_vy, d_vy, nParticles * sizeof(double),  hipMemcpyDeviceToHost) == hipSuccess); 
    assert(hipMemcpy(h_vz, d_vz, nParticles * sizeof(double),  hipMemcpyDeviceToHost) == hipSuccess);

    assert(hipMemcpy(h_fx, d_fx, nParticles * sizeof(double),  hipMemcpyDeviceToHost) == hipSuccess);
    assert(hipMemcpy(h_fy, d_fy, nParticles * sizeof(double),  hipMemcpyDeviceToHost) == hipSuccess);
    assert(hipMemcpy(h_fz, d_fz, nParticles * sizeof(double),  hipMemcpyDeviceToHost) == hipSuccess);

//    printLog(h_px, h_py, h_pz, h_vx, h_vy, h_vz, h_fx, h_fy, h_fz,  nParticles, timesteps);

    if (flagSave == 1)
      printLog(h_px, h_py, h_pz, h_vx, h_vy, h_vz, h_fx, h_fy, h_fz, nParticles, timesteps);

    free(h_px);free(h_py); free(h_pz);
    free(h_vx);free(h_vy); free(h_vz);
    free(h_fx);free(h_fy); free(h_fz);


    hipFree(d_px);hipFree(d_py); hipFree(d_pz);
    hipFree(d_vx);hipFree(d_vy); hipFree(d_vz);
    hipFree(d_fx);hipFree(d_fy); hipFree(d_fz);



}


/*Declarando as structs de particula e forca*/
void printLog(double *px, double *py, double *pz,
  double *vx, double *vy, double *vz,
  double *fx, double *fy, double *fz, int nParticles, int timestep){
  char fileName[128];
  sprintf(fileName, "%s-%d-log.bin", __FILE__,  timestep);
  fprintf(stdout, "Saving file [%s] ", fileName); fflush(stdout);
  FILE *ptr = fopen(fileName, "w+");
  for(int i = 0; i < nParticles; i++){
    fprintf(ptr, "%d \t %.10f %.10f %.10f \t %.10f %.10f %.10f \t %.10f %.10f %.10f \n", i,  px[i], py[i], pz[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i]);

  }
  fclose(ptr);
  fprintf(stdout, "[OK]\n"); fflush(stdout);
}
void initialCondition(double *px, double *py, double *pz,
          double *vx, double *vy, double *vz,
          double *fx, double *fy, double *fz, int nParticles){

    srand(42);
    memset(vx, 0x00, nParticles * sizeof(double));
    memset(vy, 0x00, nParticles * sizeof(double));
    memset(vz, 0x00, nParticles * sizeof(double));

    memset(fx, 0x00, nParticles * sizeof(double));
    memset(fy, 0x00, nParticles * sizeof(double));
    memset(fz, 0x00, nParticles * sizeof(double));

    for (int i = 0; i < nParticles ; i++){
        px[i] =  2.0 * (rand() / (double)RAND_MAX) - 1.0;
        py[i] =  2.0 * (rand() / (double)RAND_MAX) - 1.0;
        pz[i] =  2.0 * (rand() / (double)RAND_MAX) - 1.0;
    }//end-for (int i = 0; i < nParticles ; i++){

}
	.text
	.file	"main-n-bodies-2.0.hip"
	.globl	_Z39__device_stub__particleParticleForces_kPdS_S_S_S_S_d # -- Begin function _Z39__device_stub__particleParticleForces_kPdS_S_S_S_S_d
	.type	_Z39__device_stub__particleParticleForces_kPdS_S_S_S_S_d,@function
_Z39__device_stub__particleParticleForces_kPdS_S_S_S_S_d: # @_Z39__device_stub__particleParticleForces_kPdS_S_S_S_S_d
	.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	$176, %rsp
	.cfi_def_cfa_offset 224
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	72(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	64(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	56(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	48(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	40(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	32(%rsp), %r8
	movq	%r9, (%r8)
	leaq	24(%rsp), %r9
	movsd	%xmm0, (%r9)
	leaq	112(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	movq	%r9, 48(%rbx)
	leaq	96(%rsp), %r14
	leaq	80(%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	$_Z24particleParticleForces_kPdS_S_S_S_S_d, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$192, %rsp
	.cfi_adjust_cfa_offset -192
	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_end0:
	.size	_Z39__device_stub__particleParticleForces_kPdS_S_S_S_S_d, .Lfunc_end0-_Z39__device_stub__particleParticleForces_kPdS_S_S_S_S_d
	.cfi_endproc
                                        # -- End function
	.globl	_Z49__device_stub__particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d # -- Begin function _Z49__device_stub__particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	.type	_Z49__device_stub__particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d,@function
_Z49__device_stub__particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d: # @_Z49__device_stub__particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	.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	$192, %rsp
	.cfi_def_cfa_offset 240
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	72(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	64(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	56(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	48(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	40(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	32(%rsp), %r8
	movq	%r9, (%r8)
	leaq	24(%rsp), %r9
	movsd	%xmm0, (%r9)
	leaq	112(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	240(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	248(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	256(%rsp), %rax
	movq	%rax, 64(%rbx)
	movq	%r9, 72(%rbx)
	leaq	96(%rsp), %r14
	leaq	80(%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	$_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$208, %rsp
	.cfi_adjust_cfa_offset -208
	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_end1:
	.size	_Z49__device_stub__particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d, .Lfunc_end1-_Z49__device_stub__particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	.cfi_endproc
                                        # -- End function
	.globl	_Z16particleParticlePdS_S_S_S_S_S_S_S_iid # -- Begin function _Z16particleParticlePdS_S_S_S_S_S_S_S_iid
	.type	_Z16particleParticlePdS_S_S_S_S_S_S_S_iid,@function
_Z16particleParticlePdS_S_S_S_S_S_S_S_iid: # @_Z16particleParticlePdS_S_S_S_S_S_S_S_iid
	.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	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movq	%r9, 32(%rsp)                   # 8-byte Spill
	movq	%r8, 24(%rsp)                   # 8-byte Spill
	movq	%rcx, 16(%rsp)                  # 8-byte Spill
	movq	%rdx, (%rsp)                    # 8-byte Spill
	movq	%rsi, %r13
	movq	%rdi, %rbp
	movl	128(%rsp), %r12d
	movl	120(%rsp), %eax
	movl	%eax, %ecx
	shrl	$10, %ecx
	movl	$1024, %r14d                    # imm = 0x400
	cmpl	%r14d, %eax
	movl	$1, %r15d
	cmovgel	%ecx, %r15d
	cmovll	%eax, %r14d
	movq	stdout(%rip), %rdi
	leal	(%r14,%r14,2), %eax
	movslq	%eax, %rbx
	shlq	$3, %rbx
	movl	$.L.str, %esi
	movl	%r15d, %edx
	movl	%r14d, %ecx
	movq	%rbx, %r8
	xorl	%eax, %eax
	callq	fprintf
	testl	%r12d, %r12d
	jle	.LBB2_7
# %bb.1:                                # %.lr.ph
	movl	%r15d, %r15d
	btsq	$32, %r15
	movl	%r14d, %r14d
	btsq	$32, %r14
.LBB2_2:                                # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	movq	%rbx, %r8
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_4
# %bb.3:                                #   in Loop: Header=BB2_2 Depth=1
	movq	%rbp, %rdi
	movq	%r13, %rsi
	movq	(%rsp), %rdx                    # 8-byte Reload
	movq	96(%rsp), %rcx
	movq	104(%rsp), %r8
	movq	112(%rsp), %r9
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_Z39__device_stub__particleParticleForces_kPdS_S_S_S_S_d
.LBB2_4:                                #   in Loop: Header=BB2_2 Depth=1
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_6
# %bb.5:                                #   in Loop: Header=BB2_2 Depth=1
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	movq	%rbp, %rdi
	movq	%r13, %rsi
	movq	8(%rsp), %rdx                   # 8-byte Reload
	movq	24(%rsp), %rcx                  # 8-byte Reload
	movq	32(%rsp), %r8                   # 8-byte Reload
	movq	40(%rsp), %r9                   # 8-byte Reload
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	pushq	120(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	120(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	120(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	_Z49__device_stub__particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	addq	$32, %rsp
	.cfi_adjust_cfa_offset -32
.LBB2_6:                                #   in Loop: Header=BB2_2 Depth=1
	decl	%r12d
	jne	.LBB2_2
.LBB2_7:                                # %._crit_edge
	addq	$40, %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_end2:
	.size	_Z16particleParticlePdS_S_S_S_S_S_S_S_iid, .Lfunc_end2-_Z16particleParticlePdS_S_S_S_S_S_S_S_iid
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI3_0:
	.quad	0x3ee4f8b580000000              # double 9.9999997473787516E-6
	.text
	.globl	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
	movq	%rsi, %rbx
	movq	8(%rsi), %rdi
	callq	atoi
                                        # kill: def $eax killed $eax def $rax
	movq	%rax, 48(%rsp)                  # 8-byte Spill
	movq	16(%rbx), %rdi
	callq	atoi
	movl	%eax, %r14d
	movq	%r14, 56(%rsp)                  # 8-byte Spill
	movq	24(%rbx), %rdi
	callq	atoi
	movl	%eax, 20(%rsp)                  # 4-byte Spill
	movq	stdout(%rip), %rcx
	movl	$.L.str.1, %edi
	movl	$38, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	movq	stdout(%rip), %rdi
	movslq	%r14d, %rbp
	shlq	$3, %rbp
	leaq	(,%rbp,8), %rdx
	addq	%rbp, %rdx
	movl	$.L.str.2, %esi
	xorl	%eax, %eax
	callq	fprintf
	movl	$64, %edi
	movq	%rbp, %rsi
	callq	aligned_alloc
	movq	%rax, %r12
	movl	$64, %edi
	movq	%rbp, %rsi
	callq	aligned_alloc
	movq	%rax, %r14
	movl	$64, %edi
	movq	%rbp, %rsi
	callq	aligned_alloc
	movq	%rax, %rbx
	movl	$64, %edi
	movq	%rbp, %rsi
	callq	aligned_alloc
	movq	%rax, 80(%rsp)                  # 8-byte Spill
	movl	$64, %edi
	movq	%rbp, %rsi
	callq	aligned_alloc
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	movl	$64, %edi
	movq	%rbp, %rsi
	callq	aligned_alloc
	movq	%rax, %r13
	movl	$64, %edi
	movq	%rbp, %rsi
	callq	aligned_alloc
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movl	$64, %edi
	movq	%rbp, %rsi
	callq	aligned_alloc
	movq	%rax, %r15
	movl	$64, %edi
	movq	%rbp, %rsi
	callq	aligned_alloc
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	movq	%r12, 40(%rsp)                  # 8-byte Spill
	movq	%r12, %rdi
	movq	%r14, %r12
	movq	%r14, %rsi
	movq	%rbx, %rbp
	movq	%rbx, %rdx
	movq	80(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rcx
	movq	72(%rsp), %rbx                  # 8-byte Reload
	movq	%rbx, %r8
	movq	%r13, 32(%rsp)                  # 8-byte Spill
	movq	%r13, %r9
	movq	56(%rsp), %r13                  # 8-byte Reload
	pushq	%r13
	.cfi_adjust_cfa_offset 8
	pushq	%rax
	.cfi_adjust_cfa_offset 8
	movq	%r15, 40(%rsp)                  # 8-byte Spill
	pushq	%r15
	.cfi_adjust_cfa_offset 8
	pushq	32(%rsp)                        # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	callq	_Z16initialConditionPdS_S_S_S_S_S_S_S_i
	subq	$16, %rsp
	.cfi_adjust_cfa_offset 16
	movq	96(%rsp), %rax                  # 8-byte Reload
	movl	%eax, 32(%rsp)
	movq	%r13, %rax
	movl	%eax, 24(%rsp)
	movq	%rbp, %r13
	movq	112(%rsp), %rbp                 # 8-byte Reload
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rsp)
	movq	$0, 16(%rsp)
	movsd	.LCPI3_0(%rip), %xmm0           # xmm0 = mem[0],zero
	xorl	%edi, %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_Z16particleParticlePdS_S_S_S_S_S_S_S_iid
	addq	$48, %rsp
	.cfi_adjust_cfa_offset -48
	cmpl	$1, 20(%rsp)                    # 4-byte Folded Reload
	jne	.LBB3_2
# %bb.1:
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	movq	48(%rsp), %rdi                  # 8-byte Reload
	movq	%r12, %rsi
	movq	%r13, %rdx
	movq	%r14, %rcx
	movq	%rbx, %r8
	movq	40(%rsp), %r9                   # 8-byte Reload
	pushq	56(%rsp)                        # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	72(%rsp)                        # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	%rbp
	.cfi_adjust_cfa_offset 8
	pushq	56(%rsp)                        # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	48(%rsp)                        # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	callq	_Z8printLogPdS_S_S_S_S_S_S_S_ii
	addq	$48, %rsp
	.cfi_adjust_cfa_offset -48
.LBB3_2:
	movq	40(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	%r12, %rdi
	callq	free
	movq	%r13, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%rbx, %rdi
	callq	free
	movq	32(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	8(%rsp), %rdi                   # 8-byte Reload
	callq	free
	movq	24(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	%rbp, %rdi
	callq	free
	xorl	%edi, %edi
	callq	hipFree
	xorl	%edi, %edi
	callq	hipFree
	xorl	%edi, %edi
	callq	hipFree
	xorl	%edi, %edi
	callq	hipFree
	xorl	%edi, %edi
	callq	hipFree
	xorl	%edi, %edi
	callq	hipFree
	xorl	%edi, %edi
	callq	hipFree
	xorl	%edi, %edi
	callq	hipFree
	xorl	%edi, %edi
	callq	hipFree
	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_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z16initialConditionPdS_S_S_S_S_S_S_S_i
.LCPI4_0:
	.quad	0x41dfffffffc00000              # double 2147483647
.LCPI4_1:
	.quad	0xbff0000000000000              # double -1
	.text
	.globl	_Z16initialConditionPdS_S_S_S_S_S_S_S_i
	.type	_Z16initialConditionPdS_S_S_S_S_S_S_S_i,@function
_Z16initialConditionPdS_S_S_S_S_S_S_S_i: # @_Z16initialConditionPdS_S_S_S_S_S_S_S_i
	.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	%r9, 16(%rsp)                   # 8-byte Spill
	movq	%r8, 8(%rsp)                    # 8-byte Spill
	movq	%rcx, %r12
	movq	%rdx, %rbx
	movq	%rsi, %r14
	movq	%rdi, %r15
	movslq	104(%rsp), %rbp
	movl	$42, %edi
	callq	srand
	leaq	(,%rbp,8), %r13
	movq	%r12, %rdi
	xorl	%esi, %esi
	movq	%r13, %rdx
	callq	memset@PLT
	movq	8(%rsp), %rdi                   # 8-byte Reload
	xorl	%esi, %esi
	movq	%r13, %rdx
	callq	memset@PLT
	movq	16(%rsp), %rdi                  # 8-byte Reload
	xorl	%esi, %esi
	movq	%r13, %rdx
	callq	memset@PLT
	movq	80(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r13, %rdx
	callq	memset@PLT
	movq	88(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r13, %rdx
	callq	memset@PLT
	movq	96(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r13, %rdx
	callq	memset@PLT
	testq	%rbp, %rbp
	jle	.LBB4_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebp, %r12d
	xorl	%r13d, %r13d
.LBB4_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	movsd	.LCPI4_0(%rip), %xmm1           # xmm1 = mem[0],zero
	divsd	%xmm1, %xmm0
	addsd	%xmm0, %xmm0
	movsd	.LCPI4_1(%rip), %xmm1           # xmm1 = mem[0],zero
	addsd	%xmm1, %xmm0
	movsd	%xmm0, (%r15,%r13,8)
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	.LCPI4_0(%rip), %xmm0
	addsd	%xmm0, %xmm0
	addsd	.LCPI4_1(%rip), %xmm0
	movsd	%xmm0, (%r14,%r13,8)
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	.LCPI4_0(%rip), %xmm0
	addsd	%xmm0, %xmm0
	addsd	.LCPI4_1(%rip), %xmm0
	movsd	%xmm0, (%rbx,%r13,8)
	incq	%r13
	cmpq	%r13, %r12
	jne	.LBB4_2
.LBB4_3:                                # %._crit_edge
	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_end4:
	.size	_Z16initialConditionPdS_S_S_S_S_S_S_S_i, .Lfunc_end4-_Z16initialConditionPdS_S_S_S_S_S_S_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z8printLogPdS_S_S_S_S_S_S_S_ii # -- Begin function _Z8printLogPdS_S_S_S_S_S_S_S_ii
	.type	_Z8printLogPdS_S_S_S_S_S_S_S_ii,@function
_Z8printLogPdS_S_S_S_S_S_S_S_ii:        # @_Z8printLogPdS_S_S_S_S_S_S_S_ii
	.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	$168, %rsp
	.cfi_def_cfa_offset 224
	.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, 24(%rsp)                   # 8-byte Spill
	movq	%r8, 16(%rsp)                   # 8-byte Spill
	movq	%rcx, 8(%rsp)                   # 8-byte Spill
	movq	%rdx, %r12
	movq	%rsi, %r13
	movq	%rdi, %rbp
	movl	248(%rsp), %r14d
	movl	256(%rsp), %ecx
	leaq	32(%rsp), %rbx
	movl	$.L.str.3, %esi
	movl	$.L.str.4, %edx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	sprintf
	movq	stdout(%rip), %rdi
	movl	$.L.str.5, %esi
	movq	%rbx, %rdx
	xorl	%eax, %eax
	callq	fprintf
	movq	stdout(%rip), %rdi
	callq	fflush
	movl	$.L.str.6, %esi
	movq	%rbx, %rdi
	callq	fopen
	movq	%rax, %rbx
	testl	%r14d, %r14d
	jle	.LBB5_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%r14d, %r15d
	xorl	%r14d, %r14d
.LBB5_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%rbp,%r14,8), %xmm0            # xmm0 = mem[0],zero
	movsd	(%r13,%r14,8), %xmm1            # xmm1 = mem[0],zero
	movsd	(%r12,%r14,8), %xmm2            # xmm2 = mem[0],zero
	movq	8(%rsp), %rax                   # 8-byte Reload
	movsd	(%rax,%r14,8), %xmm3            # xmm3 = mem[0],zero
	movq	16(%rsp), %rax                  # 8-byte Reload
	movsd	(%rax,%r14,8), %xmm4            # xmm4 = mem[0],zero
	movq	24(%rsp), %rax                  # 8-byte Reload
	movsd	(%rax,%r14,8), %xmm5            # xmm5 = mem[0],zero
	movq	224(%rsp), %rax
	movsd	(%rax,%r14,8), %xmm6            # xmm6 = mem[0],zero
	movq	232(%rsp), %rax
	movsd	(%rax,%r14,8), %xmm7            # xmm7 = mem[0],zero
	movq	240(%rsp), %rax
	movsd	(%rax,%r14,8), %xmm8            # xmm8 = mem[0],zero
	movsd	%xmm8, (%rsp)
	movl	$.L.str.7, %esi
	movq	%rbx, %rdi
	movl	%r14d, %edx
	movb	$8, %al
	callq	fprintf
	incq	%r14
	cmpq	%r14, %r15
	jne	.LBB5_2
.LBB5_3:                                # %._crit_edge
	movq	%rbx, %rdi
	callq	fclose
	movq	stdout(%rip), %rcx
	movl	$.L.str.8, %edi
	movl	$5, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	movq	stdout(%rip), %rdi
	callq	fflush
	addq	$168, %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	_Z8printLogPdS_S_S_S_S_S_S_S_ii, .Lfunc_end5-_Z8printLogPdS_S_S_S_S_S_S_S_ii
	.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	.LBB6_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB6_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z24particleParticleForces_kPdS_S_S_S_S_d, %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	$_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %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_end6:
	.size	__hip_module_ctor, .Lfunc_end6-__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	.LBB7_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
.LBB7_2:
	retq
.Lfunc_end7:
	.size	__hip_module_dtor, .Lfunc_end7-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z24particleParticleForces_kPdS_S_S_S_S_d,@object # @_Z24particleParticleForces_kPdS_S_S_S_S_d
	.section	.rodata,"a",@progbits
	.globl	_Z24particleParticleForces_kPdS_S_S_S_S_d
	.p2align	3, 0x0
_Z24particleParticleForces_kPdS_S_S_S_S_d:
	.quad	_Z39__device_stub__particleParticleForces_kPdS_S_S_S_S_d
	.size	_Z24particleParticleForces_kPdS_S_S_S_S_d, 8

	.type	_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d,@object # @_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	.globl	_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	.p2align	3, 0x0
_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d:
	.quad	_Z49__device_stub__particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	.size	_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"\n B(%d) T(%d) shared memory %d \n"
	.size	.L.str, 33

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"\nParcile system particle to particle \n"
	.size	.L.str.1, 39

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Memory used %lu bytes \n"
	.size	.L.str.2, 24

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"%s-%d-log.bin"
	.size	.L.str.3, 14

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/marzam/HPC-Aula/main/exemplos/problems-profile/nbody-cuda-profile/main-n-bodies-2.0.hip"
	.size	.L.str.4, 150

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Saving file [%s] "
	.size	.L.str.5, 18

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"w+"
	.size	.L.str.6, 3

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"%d \t %.10f %.10f %.10f \t %.10f %.10f %.10f \t %.10f %.10f %.10f \n"
	.size	.L.str.7, 65

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"[OK]\n"
	.size	.L.str.8, 6

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z24particleParticleForces_kPdS_S_S_S_S_d"
	.size	.L__unnamed_1, 42

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d"
	.size	.L__unnamed_2, 58

	.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

	.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 _Z39__device_stub__particleParticleForces_kPdS_S_S_S_S_d
	.addrsig_sym _Z49__device_stub__particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z24particleParticleForces_kPdS_S_S_S_S_d
	.addrsig_sym _Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z24particleParticleForces_kPdS_S_S_S_S_d ; -- Begin function _Z24particleParticleForces_kPdS_S_S_S_S_d
	.globl	_Z24particleParticleForces_kPdS_S_S_S_S_d
	.p2align	8
	.type	_Z24particleParticleForces_kPdS_S_S_S_S_d,@function
_Z24particleParticleForces_kPdS_S_S_S_S_d: ; @_Z24particleParticleForces_kPdS_S_S_S_S_d
; %bb.0:
	s_clause 0x3
	s_load_b32 s2, s[0:1], 0x44
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b128 s[16:19], s[0:1], 0x20
	s_load_b32 s1, s[0:1], 0x38
	s_waitcnt lgkmcnt(0)
	s_and_b32 s12, 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, s12, v[0:1]
	s_cmp_eq_u32 s1, 0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[13:14], 3, v[1:2]
	v_add_co_u32 v1, vcc_lo, s10, v13
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v2, vcc_lo, s11, v14, vcc_lo
	v_add_co_u32 v3, vcc_lo, s16, v13
	v_add_co_ci_u32_e32 v4, vcc_lo, s17, v14, vcc_lo
	v_add_co_u32 v5, vcc_lo, s18, v13
	v_add_co_ci_u32_e32 v6, vcc_lo, s19, v14, vcc_lo
	global_load_b64 v[7:8], v[1:2], off
	global_load_b64 v[9:10], v[3:4], off
	global_load_b64 v[11:12], v[5:6], off
	s_mov_b32 s10, 0
	s_cbranch_scc1 .LBB0_6
; %bb.1:                                ; %.lr.ph73
	v_add_co_u32 v15, vcc_lo, s4, v13
	v_add_co_ci_u32_e32 v16, vcc_lo, s5, v14, vcc_lo
	v_add_co_u32 v17, vcc_lo, s6, v13
	v_add_co_ci_u32_e32 v18, vcc_lo, s7, v14, vcc_lo
	v_add_co_u32 v19, vcc_lo, s8, v13
	v_add_co_ci_u32_e32 v20, vcc_lo, s9, v14, vcc_lo
	global_load_b64 v[13:14], v[15:16], off
	global_load_b64 v[15:16], v[17:18], off
	global_load_b64 v[17:18], v[19:20], off
	s_lshl_b32 s11, s1, 3
	s_lshl_b32 s13, s1, 4
	s_cmp_lg_u32 s12, 0
	v_dual_mov_b32 v22, 0 :: v_dual_lshlrev_b32 v21, 3, v0
	s_cselect_b32 s0, -1, 0
	s_mov_b32 s2, 0xe826d695
	v_cndmask_b32_e64 v23, 0, 1, s0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_nc_u32_e32 v19, 0, v21
	v_add3_u32 v20, 0, s11, v21
	v_add3_u32 v21, 0, s13, v21
	s_mov_b32 s3, 0x3e112e0b
	v_cmp_ne_u32_e64 s0, 1, v23
.LBB0_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_4 Depth 2
	v_mad_u64_u32 v[23:24], null, s10, s12, v[0:1]
	v_mov_b32_e32 v24, v22
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[23:24], 3, v[23:24]
	v_add_co_u32 v25, vcc_lo, s4, v23
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v26, vcc_lo, s5, v24, vcc_lo
	v_add_co_u32 v27, vcc_lo, s6, v23
	v_add_co_ci_u32_e32 v28, vcc_lo, s7, v24, vcc_lo
	v_add_co_u32 v23, vcc_lo, s8, v23
	v_add_co_ci_u32_e32 v24, vcc_lo, s9, v24, vcc_lo
	global_load_b64 v[25:26], v[25:26], off
	global_load_b64 v[27:28], v[27:28], off
	global_load_b64 v[23:24], v[23:24], off
	s_and_b32 vcc_lo, exec_lo, s0
	s_waitcnt vmcnt(2)
	ds_store_b64 v19, v[25:26]
	s_waitcnt vmcnt(1)
	ds_store_b64 v20, v[27:28]
	s_waitcnt vmcnt(0)
	ds_store_b64 v21, v[23:24]
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_vccnz .LBB0_5
; %bb.3:                                ; %.lr.ph.preheader
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_mov_b32 s14, 0
	s_mov_b32 s15, s12
.LBB0_4:                                ; %.lr.ph
                                        ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_add_i32 s16, s14, s11
	v_mov_b32_e32 v23, s14
	v_mov_b32_e32 v25, s16
	s_add_i32 s16, s14, s13
	s_add_i32 s15, s15, -1
	v_mov_b32_e32 v27, s16
	ds_load_b64 v[23:24], v23
	ds_load_b64 v[25:26], v25
	s_add_i32 s14, s14, 8
	s_cmp_eq_u32 s15, 0
	ds_load_b64 v[27:28], v27
	s_waitcnt lgkmcnt(2)
	v_add_f64 v[23:24], v[13:14], -v[23:24]
	s_waitcnt lgkmcnt(1)
	v_add_f64 v[25:26], v[15:16], -v[25:26]
	s_waitcnt lgkmcnt(0)
	v_add_f64 v[27:28], v[17:18], -v[27:28]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[29:30], v[25:26], v[25:26]
	v_fma_f64 v[29:30], v[23:24], v[23:24], v[29:30]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[29:30], v[27:28], v[27:28], v[29:30]
	v_add_f64 v[29:30], v[29:30], s[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[29:30]
	v_cndmask_b32_e64 v31, 0, 1, vcc_lo
	v_lshlrev_b32_e32 v31, 8, v31
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ldexp_f64 v[29:30], v[29:30], v31
	v_rsq_f64_e32 v[31:32], v[29:30]
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[33:34], v[29:30], v[31:32]
	v_mul_f64 v[31:32], v[31:32], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[35:36], -v[31:32], v[33:34], 0.5
	v_fma_f64 v[33:34], v[33:34], v[35:36], v[33:34]
	v_fma_f64 v[31:32], v[31:32], v[35:36], v[31:32]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[35:36], -v[33:34], v[33:34], v[29:30]
	v_fma_f64 v[33:34], v[35:36], v[31:32], v[33:34]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[35:36], -v[33:34], v[33:34], v[29:30]
	v_fma_f64 v[31:32], v[35:36], v[31:32], v[33:34]
	v_cndmask_b32_e64 v33, 0, 0xffffff80, vcc_lo
	v_cmp_class_f64_e64 vcc_lo, v[29:30], 0x260
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ldexp_f64 v[31:32], v[31:32], v33
	v_dual_cndmask_b32 v30, v32, v30 :: v_dual_cndmask_b32 v29, v31, v29
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f64 v[31:32], null, v[29:30], v[29:30], 1.0
	v_div_scale_f64 v[37:38], vcc_lo, 1.0, v[29:30], 1.0
	v_rcp_f64_e32 v[33:34], v[31:32]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[35:36], -v[31:32], v[33:34], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[33:34], v[33:34], v[35:36], v[33:34]
	v_fma_f64 v[35:36], -v[31:32], v[33:34], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[33:34], v[33:34], v[35:36], v[33:34]
	v_mul_f64 v[35:36], v[37:38], v[33:34]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[31:32], -v[31:32], v[35:36], v[37:38]
	v_div_fmas_f64 v[31:32], v[31:32], v[33:34], v[35:36]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f64 v[29:30], v[31:32], v[29:30], 1.0
	v_fma_f64 v[7:8], v[23:24], v[29:30], v[7:8]
	v_fma_f64 v[9:10], v[25:26], v[29:30], v[9:10]
	v_fma_f64 v[11:12], v[27:28], v[29:30], v[11:12]
	s_cbranch_scc0 .LBB0_4
.LBB0_5:                                ; %._crit_edge
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_add_i32 s10, s10, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s10, s1
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB0_2
.LBB0_6:                                ; %Flow114
	s_waitcnt vmcnt(2)
	global_store_b64 v[1:2], v[7:8], off
	s_waitcnt vmcnt(1)
	global_store_b64 v[3:4], v[9:10], off
	s_waitcnt vmcnt(0)
	global_store_b64 v[5:6], v[11:12], off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z24particleParticleForces_kPdS_S_S_S_S_d
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 312
		.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 39
		.amdhsa_next_free_sgpr 20
		.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	_Z24particleParticleForces_kPdS_S_S_S_S_d, .Lfunc_end0-_Z24particleParticleForces_kPdS_S_S_S_S_d
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 964
; NumSgprs: 22
; NumVgprs: 39
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 4
; NumSGPRsForWavesPerEU: 22
; NumVGPRsForWavesPerEU: 39
; 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	_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d ; -- Begin function _Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	.globl	_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
	.p2align	8
	.type	_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d,@function
_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d: ; @_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x5c
	s_load_b512 s[16:31], 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_load_b128 s[0:3], s[0:1], 0x40
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 3, v[1:2]
	v_add_co_u32 v2, vcc_lo, s28, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s29, v1, vcc_lo
	v_add_co_u32 v4, vcc_lo, s22, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, s23, v1, vcc_lo
	global_load_b64 v[2:3], v[2:3], off
	global_load_b64 v[6:7], v[4:5], off
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_fma_f64 v[2:3], v[2:3], s[2:3], v[6:7]
	v_add_co_u32 v6, vcc_lo, s30, v0
	v_add_co_ci_u32_e32 v7, vcc_lo, s31, v1, vcc_lo
	v_add_co_u32 v8, vcc_lo, s24, v0
	v_add_co_ci_u32_e32 v9, vcc_lo, s25, v1, vcc_lo
	global_store_b64 v[4:5], v[2:3], off
	global_load_b64 v[2:3], v[6:7], off
	global_load_b64 v[6:7], v[8:9], off
	s_waitcnt vmcnt(0)
	v_fma_f64 v[2:3], v[2:3], s[2:3], v[6:7]
	v_add_co_u32 v6, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v7, vcc_lo, s1, v1, vcc_lo
	v_add_co_u32 v10, vcc_lo, s26, v0
	v_add_co_ci_u32_e32 v11, vcc_lo, s27, v1, vcc_lo
	global_store_b64 v[8:9], v[2:3], off
	global_load_b64 v[2:3], v[6:7], off
	global_load_b64 v[6:7], v[10:11], off
	s_waitcnt vmcnt(0)
	v_fma_f64 v[2:3], v[2:3], s[2:3], v[6:7]
	v_add_co_u32 v6, vcc_lo, s16, v0
	v_add_co_ci_u32_e32 v7, vcc_lo, s17, v1, vcc_lo
	global_store_b64 v[10:11], v[2:3], off
	global_load_b64 v[2:3], v[4:5], off
	global_load_b64 v[4:5], v[6:7], off
	s_waitcnt vmcnt(0)
	v_fma_f64 v[2:3], v[2:3], s[2:3], v[4:5]
	v_add_co_u32 v4, vcc_lo, s18, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, s19, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s20, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s21, v1, vcc_lo
	global_store_b64 v[6:7], v[2:3], off
	global_load_b64 v[2:3], v[8:9], off
	global_load_b64 v[6:7], v[4:5], off
	s_waitcnt vmcnt(0)
	v_fma_f64 v[2:3], v[2:3], s[2:3], v[6:7]
	global_store_b64 v[4:5], v[2:3], off
	global_load_b64 v[2:3], v[10:11], off
	global_load_b64 v[4:5], v[0:1], off
	s_waitcnt vmcnt(0)
	v_fma_f64 v[2:3], v[2:3], s[2:3], v[4:5]
	global_store_b64 v[0:1], v[2:3], off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 336
		.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 32
		.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	_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d, .Lfunc_end1-_Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 408
; NumSgprs: 34
; NumVgprs: 12
; ScratchSize: 0
; MemoryBound: 1
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 4
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 34
; NumVGPRsForWavesPerEU: 12
; Occupancy: 16
; WaveLimiterHint : 1
; 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
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .offset:         48
        .size:           8
        .value_kind:     by_value
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         60
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         64
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         68
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         70
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         72
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         74
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         76
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         78
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         120
        .size:           2
        .value_kind:     hidden_grid_dims
      - .offset:         176
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 312
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z24particleParticleForces_kPdS_S_S_S_S_d
    .private_segment_fixed_size: 0
    .sgpr_count:     22
    .sgpr_spill_count: 0
    .symbol:         _Z24particleParticleForces_kPdS_S_S_S_S_d.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     39
    .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
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         48
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         56
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         64
        .size:           8
        .value_kind:     global_buffer
      - .offset:         72
        .size:           8
        .value_kind:     by_value
      - .offset:         80
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         84
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         88
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         92
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         94
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         96
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         98
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         100
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         102
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         120
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         128
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         136
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         144
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 336
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d
    .private_segment_fixed_size: 0
    .sgpr_count:     34
    .sgpr_spill_count: 0
    .symbol:         _Z34particleParticleVelocityPosition_kPdS_S_S_S_S_S_S_S_d.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     12
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
