//
//  main.cu
//  TermProject
//
//  Created by Kutay Demireren on 25/12/15.
//  Copyright © 2015 Kutay Demireren. All rights reserved.
//
/*****************************************
This program compute n many particles forces on each other and their
velocities & positions according to forces in time.
It is called N-Body Solver.

This code is written by Kutay Demireren and Elif Ecem Ates. January, 2016.
*****************************************/


#include <iostream>
#include <string.h>
#include <math.h>
#include <sys/time.h>
#include <fstream>

using namespace std;

/* Dimension of vect arrays */
#define DIM 2

/* Global definitions for X and Y */
#define X 0
#define Y 1

/* Universal Gravity Constant */
#define G 6.673*pow(10,-11)

typedef double vect_t[DIM];

struct particle_t{
    double mass;
    double position[2];
    double velocity[2];
};

/* Function prototypes */
void print_particles(particle_t *particles);
double fRand(double fMin, double fMax);
void init_force(vect_t *vect, int N);
void init_particle(particle_t *vect, int N);
double getTime();
void read_input(particle_t *particles, int N, char *file);
void usage(int argc, char **argv);

int N = 0;
int num_threads = 1;

/* Kernel functions */
__global__ void compute_force_on_device(vect_t *forces, particle_t *particles, int N, double g, double *force_qk);
__global__ void compute_pos_and_vel_on_device(vect_t *forces, particle_t *particles, int delta_t, int N, double g);


int main(int argc, char * argv[]) {
    srand((unsigned)time(0));
    /*
     Inputs to the program(respectively):
     N            number of the particles
     delta_t      time difference between two time
     T            final time number
     debug        1 to see each step, 0 to see only final step.
     num_threads  # of threads working on the program.

     Inputs provided via file:
     (for each particle)
     mass           mass of particle
     initial_pos    initial position of particle
     initial_vel    initial velocities of particle
     */

    int step = 0, T = 0, delta_t, debug, n_steps;
    vect_t *forces;
    particle_t *particles;
    double start, end, total_time;
    char *pfile;

    // Error code to check CUDA return values
    cudaError_t err = cudaSuccess;

    /* check validity of inputs	*/
    if (argc != 7)
        usage(argc, argv);
    if ((N = atoi(argv[1])) <= 0 ||
        (delta_t = atoi(argv[2])) <= 0 ||
        (T = atoi(argv[3])) <= 0 ||
        (debug = atoi(argv[4])) < 0 ||
	      (debug = atoi(argv[4])) > 1 ||
        (num_threads = atoi(argv[5])) <= 0)
        usage(argc, argv);



    /* Allocating on host memory */
    forces = (vect_t *) malloc(N*sizeof(vect_t));
    particles = (particle_t *) malloc(N*sizeof(particle_t));
    double *force_qk = (double *) malloc(2*sizeof(double));
    if(!forces || !particles || !force_qk){
        fprintf(stderr, "error: unable to allocate memory\n");
        exit(1);
    }

    //Initalizing host vectors
    init_force(forces, N);
    pfile = argv[6];
    read_input(particles, N, pfile);


    cout << endl << "Start computing n-body solver" << endl;
    cout << "------------------" << endl;


    //Size of each vector
    size_t size_force = N*sizeof(vect_t);
    size_t size_particle = N*sizeof(particle_t);
    //Initialize device input vectors
    vect_t *d_forces;
    particle_t *d_particles;
    double *d_force_qk;

    /* Allocating memory on device */
    // Allocate the device input vector d_forces
    err = cudaMalloc((void **)&d_forces, size_force);
    if (err != cudaSuccess)
      {
        fprintf(stderr, "Failed to allocate device vector d_forces (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
      }

    // Allocate the device input vector d_particles
    err = cudaMalloc((void **)&d_particles, size_particle);
    if (err != cudaSuccess)
      {
        fprintf(stderr, "Failed to allocate device vector d_particles (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
      }


    err = cudaMalloc((void **)&d_force_qk, 2*sizeof(double));
    if (err != cudaSuccess)
      {
        fprintf(stderr, "Failed to allocate device vector d_force_qk (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
      }


    /* Copy host vectors to device vectors */
    // Copy forces to d_forces
    err = cudaMemcpy(d_forces, forces, size_force, cudaMemcpyHostToDevice);
    if (err != cudaSuccess)
      {
        fprintf(stderr, "Failed to copy vector d_forces from host to device (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
      }

    // Copy particles to d_particles
    err = cudaMemcpy(d_particles, particles, size_particle, cudaMemcpyHostToDevice);
    if (err != cudaSuccess)
      {
        fprintf(stderr, "Failed to copy vector d_particles from host to device (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
      }

    // Copy particles to d_force_qk
    err = cudaMemcpy(d_force_qk, force_qk, 2*sizeof(double), cudaMemcpyHostToDevice);
    if (err != cudaSuccess)
      {
        fprintf(stderr, "Failed to copy vector d_force_qk from host to device (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
      }


    //Final setups for CUDA
    int numThreadsInBlock = num_threads;
    int numBlocks = N / numThreadsInBlock + (N%numThreadsInBlock == 0 ? 0 : 1);

    cout << "Computing starts with..." << endl << " Block Size: " << numThreadsInBlock << endl << " # of Blocks : " << numBlocks << endl;

    start = getTime();

    n_steps = T / delta_t;

    double g = G;

    //Computing
    for (step = 0; step < n_steps; step++) {
      /* Synchronize, before it compute new velocities and positions.
	     To make sure all computations have finished in the last step */
      cudaThreadSynchronize();

  if(step % 100 == 0 && debug == 1){
  	if(step == 0)
	   cout << "Initial particles" << endl;
	  else
	   cout << "Iteration " << step << endl;

	/* Take current values to print */
	err = cudaMemcpy(particles, d_particles, size_particle, cudaMemcpyDeviceToHost);
	if (err != cudaSuccess)
	  {
	    fprintf(stderr, "Failed to copy vector particles from device to host (error code %s)!\n", cudaGetErrorString(err));
	    exit(EXIT_FAILURE);
	  }

	print_particles(particles);
      }

      //Set all forces on particles to 0 before computing
      err = cudaMemset(d_forces, 0, size_force);
      if(err != cudaSuccess){
	fprintf(stderr, "Failed to set the memory to value 0 (error code %s)!\n", cudaGetErrorString(err));
	exit(1);
      }

      //Kernel launch
      compute_force_on_device<<<numBlocks, numThreadsInBlock>>>(d_forces, d_particles, N, g, d_force_qk);
      err = cudaGetLastError();
      if (err != cudaSuccess)
	{
	  fprintf(stderr, "Failed to launch compute_force_on_device kernel (error code %s)!\n", cudaGetErrorString(err));
	  exit(EXIT_FAILURE);
	}



      //Update positions and velocities according to force
      //Kernel launch
      compute_pos_and_vel_on_device<<<numBlocks, numThreadsInBlock>>>(d_forces, d_particles, delta_t, N, g);
      err = cudaGetLastError();
      if (err != cudaSuccess)
	{
	  fprintf(stderr, "Failed to launch compute_pos_and_vel_on_device kernel (error code %s)!\n", cudaGetErrorString(err));
	  exit(EXIT_FAILURE);
	}
    }
    /* End of computing */

    /* Time passed */
    end = getTime();
    total_time = end - start;

    //To make sure kernels have finished
    cudaThreadSynchronize();

    /* Copy the final states to Host */
    err = cudaMemcpy(particles, d_particles, size_particle, cudaMemcpyDeviceToHost);

    if (err != cudaSuccess)
      {
	fprintf(stderr, "Failed to copy vector particles from device to host (error code %s)!\n", cudaGetErrorString(err));
	exit(EXIT_FAILURE);
      }

    /* print final states of particles */
    cout << "Final positions and velocities " << endl;
    print_particles(particles);


    int num_flops = 20 ;
    double flop_rate = n_steps * (1E-9 * N * N * num_flops) / total_time;
    double BW = n_steps * (N * N * sizeof(double) * 3.0)/total_time /N /N /N;

    /* output results */
    fprintf(stdout, " Time in seconds: %f \n", total_time);
    fprintf(stdout, " Gflops Rate: %f GFlop/s\n", flop_rate);
    fprintf(stdout, " Bandwidth Rate : %f GB/s\n", BW);


    /* cleanup */
    err = cudaFree(d_particles);
    if (err != cudaSuccess)
      {
        fprintf(stderr, "Failed to free device vector d_particles (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
      }
    err = cudaFree(d_forces);
    if (err != cudaSuccess)
      {
        fprintf(stderr, "Failed to free device vector d_forces (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
      }
    err = cudaFree(d_force_qk);
    if (err != cudaSuccess)
      {
        fprintf(stderr, "Failed to free device vector d_forces (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
      }
    free(particles);
    free(forces);
    free(force_qk);


    return 0;
}


__global__ void compute_pos_and_vel_on_device(vect_t *forces, particle_t *particles, int delta_t, int N, double g){
    int q = 0;
    q = blockIdx.x*blockDim.x + threadIdx.x;

    if(q>=0 && q<N){
      //position update
      particles[q].position[X] += delta_t * particles[q].velocity[X];
      particles[q].position[Y] += delta_t * particles[q].velocity[Y];

      //velocity update
      particles[q].velocity[X] += delta_t/particles[q].mass*forces[q][X];
      particles[q].velocity[Y] += delta_t/particles[q].mass*forces[q][Y];
    }
}


__global__ void compute_force_on_device(vect_t *forces, particle_t *particles, int N, double g, double *force_qk){
//It is the basic computation code, computing directly the forces.
    int q = 0;
    q = blockIdx.x*blockDim.x + threadIdx.x;

    if(q>=0 && q<N){
      for(int k = 0; k<N; k++){
	if(k!=q){
	  double x_diff = particles[q].position[X] - particles[k].position[X];
	  double y_diff = particles[q].position[Y] - particles[k].position[Y];
	  double dist = sqrt(x_diff*x_diff + y_diff*y_diff);
	  double dist_cubed = dist*dist*dist;
	  forces[q][X] -= g*particles[q].mass*particles[k].mass/dist_cubed * x_diff;
	  forces[q][Y] -= g*particles[q].mass*particles[k].mass/dist_cubed * y_diff;
	}
      }
    }
}



void print_particles(particle_t *particles)
{
    for (int part = 0; part < N; part++) {
        particle_t particle = particles[part];
        cout << "position of particle " << part << " is (" << particle.position[X] << "," << particle.position[Y]  << ")" << endl;
        cout << "velocity of particle " << part << " is (" << particle.velocity[X] << "," << particle.velocity[Y]  << ")" << endl;
    }
    cout << "------------------" << endl;
}


double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

void init_force(vect_t *vect, int N)
{
    int q=0;

    for(q=0; q < N; q++)
    {
        vect[q][X]=0.0;
        vect[q][Y]=0.0;
    }
}


void init_particle(particle_t *particles, int N)
{
    for (int i = 0; i < N; i++) {
        if(i==5){ //Sun
            struct particle_t particle;
            particle.mass = fRand(1.9890e+30, 1.9890e+30);
            particle.position[X] = fRand(0,0);
            particle.position[Y] = fRand(0,0);
            particle.velocity[X] = fRand(0,0);
            particle.velocity[Y] = fRand(0,0);
            particles[i] = particle;
        }else{
            struct particle_t particle;
            double min = 5.9740e+24;
            double max = 10*min;
            particle.mass = fRand(min, max);
            particle.position[X] = fRand(-2.50e+11, 2.50e+11);
            particle.position[Y] = fRand(-2.50e+11, 2.50e+11);
            particle.velocity[X] = fRand(0, 0);
            particle.velocity[Y] = fRand(2.9800e+03, 2.9800e+05);
            particles[i] = particle;
        }
    }
}


double getTime()
{
    const double kMicro = 1.0e-6;
    struct timeval TV;

    const int RC = gettimeofday(&TV, NULL);
    if(RC == -1)
    {
        printf("ERROR: Bad call to gettimeofday\n");
        return(-1);
    }
    return( ((double)TV.tv_sec) + kMicro * ((double)TV.tv_usec) );
}


void read_input(particle_t *particles, int N, char *file)
{
  ifstream myfile;
  double mass, positionX, positionY, velocityX, velocityY;
  int i = 0;

  myfile.open(file, ios::in);

  if(myfile.is_open()){
    while(i < N){
      myfile >> positionX >> positionY >> velocityX >> velocityY >> mass;
      struct particle_t particle;
      particle.mass = mass;
      particle.position[X] = positionX;
      particle.position[Y] = positionY;
      particle.velocity[X] = velocityX;
      particle.velocity[Y] = velocityY;
      particles[i] = particle;
      i++;
    }
    myfile.close();
  }else{
    cout << fprintf(stderr, "error: file could not be opened for reading") << endl;
    exit(1);
  }
}

void usage(int argc, char **argv)
{
    cout << "Usage " << argv[0] << "<N> <delta_t> <T> <debug> <num_threads> <part_file>" << endl;
    cout << "\tN\t - number of particles (positive integer)" << endl;
    cout << "\tdelta_t\t - time difference between two time (positive)" << endl;
    cout << "\tT\t - final time number (positive)" << endl;
    cout << "\tdebug\t - 1 to see the states of particles time to time, 0 to see only final step" << endl;
    cout << "\tnum_threads\t - number of threads" << endl;
    cout << "\tpart_file\t - name of the file containing information the inital states of particles" << endl;
    exit(1);
}

	.file	"tmpxft_0033783e_00000000-6_main.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3777:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3777:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"position of particle "
.LC1:
	.string	" is ("
.LC2:
	.string	","
.LC3:
	.string	")"
.LC4:
	.string	"velocity of particle "
.LC5:
	.string	"------------------"
	.text
	.globl	_Z15print_particlesP10particle_t
	.type	_Z15print_particlesP10particle_t, @function
_Z15print_particlesP10particle_t:
.LFB3768:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	8(%rdi), %r15
	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
	leaq	_ZSt4cout(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
.L3:
	cmpl	%ebx, N(%rip)
	jle	.L7
	movsd	(%r15), %xmm0
	movq	%rbp, %rdi
	movq	8(%r15), %r12
	addq	$40, %r15
	movsd	-24(%r15), %xmm1
	movsd	-16(%r15), %xmm2
	leaq	.LC0(%rip), %rsi
	leaq	.LC1(%rip), %r14
	movsd	%xmm0, 24(%rsp)
	leaq	.LC2(%rip), %r13
	movsd	%xmm1, 8(%rsp)
	movsd	%xmm2, 16(%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	24(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r12, %xmm0
	leaq	.LC3(%rip), %r12
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC4(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %esi
	incl	%ebx
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	8(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	16(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	jmp	.L3
.L7:
	movq	%rbp, %rdi
	leaq	.LC5(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	movq	%rax, %rdi
	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
	jmp	_ZNSolsEPFRSoS_E@PLT
	.cfi_endproc
.LFE3768:
	.size	_Z15print_particlesP10particle_t, .-_Z15print_particlesP10particle_t
	.globl	_Z5fRanddd
	.type	_Z5fRanddd, @function
_Z5fRanddd:
.LFB3769:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movsd	%xmm0, 8(%rsp)
	movsd	%xmm1, (%rsp)
	call	rand@PLT
	movsd	8(%rsp), %xmm2
	movsd	(%rsp), %xmm1
	cvtsi2sdl	%eax, %xmm0
	divsd	.LC6(%rip), %xmm0
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	subsd	%xmm2, %xmm1
	mulsd	%xmm0, %xmm1
	movaps	%xmm1, %xmm0
	addsd	%xmm2, %xmm0
	ret
	.cfi_endproc
.LFE3769:
	.size	_Z5fRanddd, .-_Z5fRanddd
	.globl	_Z10init_forcePA2_di
	.type	_Z10init_forcePA2_di, @function
_Z10init_forcePA2_di:
.LFB3770:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
.L11:
	cmpl	%esi, %eax
	jge	.L13
	movq	$0x000000000, (%rdi)
	incl	%eax
	addq	$16, %rdi
	movq	$0x000000000, -8(%rdi)
	jmp	.L11
.L13:
	ret
	.cfi_endproc
.LFE3770:
	.size	_Z10init_forcePA2_di, .-_Z10init_forcePA2_di
	.globl	_Z13init_particleP10particle_ti
	.type	_Z13init_particleP10particle_ti, @function
_Z13init_particleP10particle_ti:
.LFB3771:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%esi, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
.L15:
	cmpl	%r13d, %r12d
	jge	.L20
	cmpl	$5, %r12d
	jne	.L16
	movsd	.LC8(%rip), %xmm0
	movaps	%xmm0, %xmm1
	call	_Z5fRanddd
	xorps	%xmm1, %xmm1
	movsd	%xmm0, 24(%rsp)
	movaps	%xmm1, %xmm0
	call	_Z5fRanddd
	xorps	%xmm1, %xmm1
	movsd	%xmm0, 16(%rsp)
	movaps	%xmm1, %xmm0
	call	_Z5fRanddd
	xorps	%xmm1, %xmm1
	movsd	%xmm0, 8(%rsp)
	movaps	%xmm1, %xmm0
	call	_Z5fRanddd
	xorps	%xmm1, %xmm1
	movsd	%xmm0, (%rsp)
	movaps	%xmm1, %xmm0
	call	_Z5fRanddd
	movsd	24(%rsp), %xmm5
	movsd	16(%rsp), %xmm4
	movsd	8(%rsp), %xmm3
	movsd	(%rsp), %xmm2
	movsd	%xmm0, 232(%rbx)
	movsd	%xmm5, 200(%rbx)
	movsd	%xmm4, 208(%rbx)
	movsd	%xmm3, 216(%rbx)
	movsd	%xmm2, 224(%rbx)
	jmp	.L17
.L16:
	movsd	.LC9(%rip), %xmm1
	movsd	.LC10(%rip), %xmm0
	call	_Z5fRanddd
	movsd	.LC11(%rip), %xmm1
	movsd	%xmm0, 24(%rsp)
	movsd	.LC12(%rip), %xmm0
	call	_Z5fRanddd
	movsd	.LC11(%rip), %xmm1
	movsd	%xmm0, 16(%rsp)
	movsd	.LC12(%rip), %xmm0
	call	_Z5fRanddd
	xorps	%xmm1, %xmm1
	movsd	%xmm0, 8(%rsp)
	movaps	%xmm1, %xmm0
	call	_Z5fRanddd
	movsd	.LC13(%rip), %xmm1
	movsd	%xmm0, (%rsp)
	movsd	.LC14(%rip), %xmm0
	call	_Z5fRanddd
	movsd	24(%rsp), %xmm5
	movsd	16(%rsp), %xmm4
	movsd	8(%rsp), %xmm3
	movsd	(%rsp), %xmm2
	movsd	%xmm0, 32(%rbp)
	movsd	%xmm5, 0(%rbp)
	movsd	%xmm4, 8(%rbp)
	movsd	%xmm3, 16(%rbp)
	movsd	%xmm2, 24(%rbp)
.L17:
	incl	%r12d
	addq	$40, %rbp
	jmp	.L15
.L20:
	addq	$40, %rsp
	.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
.LFE3771:
	.size	_Z13init_particleP10particle_ti, .-_Z13init_particleP10particle_ti
	.section	.rodata.str1.1
.LC16:
	.string	"ERROR: Bad call to gettimeofday\n"
	.text
	.globl	_Z7getTimev
	.type	_Z7getTimev, @function
_Z7getTimev:
.LFB3772:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdi
	call	gettimeofday@PLT
	incl	%eax
	jne	.L22
	leaq	.LC16(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movsd	.LC15(%rip), %xmm0
	jmp	.L21
.L22:
	cvtsi2sdq	16(%rsp), %xmm0
	mulsd	.LC17(%rip), %xmm0
	cvtsi2sdq	8(%rsp), %xmm1
	addsd	%xmm1, %xmm0
.L21:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3772:
	.size	_Z7getTimev, .-_Z7getTimev
	.section	.rodata.str1.1
.LC18:
	.string	"Usage "
.LC19:
	.string	"<N> <delta_t> <T> <debug> <num_threads> <part_file>"
.LC20:
	.string	"\tN\t - number of particles (positive integer)"
.LC21:
	.string	"\tdelta_t\t - time difference between two time (positive)"
.LC22:
	.string	"\tT\t - final time number (positive)"
.LC23:
	.string	"\tdebug\t - 1 to see the states of particles time to time, 0 to see only final step"
.LC24:
	.string	"\tnum_threads\t - number of threads"
.LC25:
	.string	"\tpart_file\t - name of the file containing information the inital states of particles"
	.text
	.globl	_Z5usageiPPc
	.type	_Z5usageiPPc, @function
_Z5usageiPPc:
.LFB3774:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %rbp
	leaq	.LC18(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	_ZSt4cout(%rip), %rbx
	pushq	%rax
	.cfi_def_cfa_offset 32
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	0(%rbp), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC19(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC20(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC21(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC22(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC23(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC24(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC25(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movl	$1, %edi
	call	exit@PLT
	.cfi_endproc
.LFE3774:
	.size	_Z5usageiPPc, .-_Z5usageiPPc
	.globl	_Z68__device_stub__Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiidPA2_dP10particle_tiid
	.type	_Z68__device_stub__Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiidPA2_dP10particle_tiid, @function
_Z68__device_stub__Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiidPA2_dP10particle_tiid:
.LFB3799:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	40(%rsp), %rcx
	movsd	%xmm0, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L28
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	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 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L28:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3799:
	.size	_Z68__device_stub__Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiidPA2_dP10particle_tiid, .-_Z68__device_stub__Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiidPA2_dP10particle_tiid
	.globl	_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid
	.type	_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid, @function
_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid:
.LFB3800:
	.cfi_startproc
	endbr64
	jmp	_Z68__device_stub__Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiidPA2_dP10particle_tiid
	.cfi_endproc
.LFE3800:
	.size	_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid, .-_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid
	.globl	_Z63__device_stub__Z23compute_force_on_devicePA2_dP10particle_tidPdPA2_dP10particle_tidPd
	.type	_Z63__device_stub__Z23compute_force_on_devicePA2_dP10particle_tidPdPA2_dP10particle_tidPd, @function
_Z63__device_stub__Z23compute_force_on_devicePA2_dP10particle_tidPdPA2_dP10particle_tidPd:
.LFB3801:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movl	%edx, 28(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 8(%rsp)
	leaq	56(%rsp), %rcx
	movsd	%xmm0, 16(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L33
	pushq	56(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z23compute_force_on_devicePA2_dP10particle_tidPd(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 192
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L33:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3801:
	.size	_Z63__device_stub__Z23compute_force_on_devicePA2_dP10particle_tidPdPA2_dP10particle_tidPd, .-_Z63__device_stub__Z23compute_force_on_devicePA2_dP10particle_tidPdPA2_dP10particle_tidPd
	.globl	_Z23compute_force_on_devicePA2_dP10particle_tidPd
	.type	_Z23compute_force_on_devicePA2_dP10particle_tidPd, @function
_Z23compute_force_on_devicePA2_dP10particle_tidPd:
.LFB3802:
	.cfi_startproc
	endbr64
	jmp	_Z63__device_stub__Z23compute_force_on_devicePA2_dP10particle_tidPdPA2_dP10particle_tidPd
	.cfi_endproc
.LFE3802:
	.size	_Z23compute_force_on_devicePA2_dP10particle_tidPd, .-_Z23compute_force_on_devicePA2_dP10particle_tidPd
	.section	.rodata.str1.1
.LC26:
	.string	"_Z23compute_force_on_devicePA2_dP10particle_tidPd"
.LC27:
	.string	"_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3804:
	.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	.LC26(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z23compute_force_on_devicePA2_dP10particle_tidPd(%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	.LC27(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid(%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
.LFE3804:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC28:
	.string	"error: file could not be opened for reading"
	.text
	.globl	_Z10read_inputP10particle_tiPc
	.type	_Z10read_inputP10particle_tiPc, @function
_Z10read_inputP10particle_tiPc:
.LFB3773:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3773
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rdi, %rbx
	subq	$576, %rsp
	.cfi_def_cfa_offset 624
	movq	%fs:40, %rax
	movq	%rax, 568(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rbp
	movq	%rbp, %rdi
.LEHB0:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE0:
	movl	$8, %edx
	movq	%r13, %rsi
	movq	%rbp, %rdi
.LEHB1:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	leaq	168(%rsp), %rdi
	call	_ZNKSt12__basic_fileIcE7is_openEv@PLT
	testb	%al, %al
	je	.L41
	xorl	%r13d, %r13d
	leaq	16(%rsp), %r14
.L42:
	cmpl	%r12d, %r13d
	jge	.L52
	movq	%r14, %rsi
	movq	%rbp, %rdi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	24(%rsp), %rsi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	32(%rsp), %rsi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	40(%rsp), %rsi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	8(%rsp), %rsi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movsd	8(%rsp), %xmm0
	incl	%r13d
	addq	$40, %rbx
	movsd	%xmm0, -40(%rbx)
	movsd	16(%rsp), %xmm0
	movsd	%xmm0, -32(%rbx)
	movsd	24(%rsp), %xmm0
	movsd	%xmm0, -24(%rbx)
	movsd	32(%rsp), %xmm0
	movsd	%xmm0, -16(%rbx)
	movsd	40(%rsp), %xmm0
	movsd	%xmm0, -8(%rbx)
	jmp	.L42
.L52:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	jmp	.L53
.L41:
	movq	stderr(%rip), %rdi
	leaq	.LC28(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	%eax, %esi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
.LEHE1:
	movl	$1, %edi
	call	exit@PLT
.L53:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	568(%rsp), %rax
	subq	%fs:40, %rax
	je	.L47
	jmp	.L50
.L48:
	endbr64
	movq	%rax, %rbx
.L45:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	568(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L50
	movq	%rbx, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L50:
	call	__stack_chk_fail@PLT
.L47:
	addq	$576, %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
.LFE3773:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3773:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3773-.LLSDACSB3773
.LLSDACSB3773:
	.uleb128 .LEHB0-.LFB3773
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3773
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L48-.LFB3773
	.uleb128 0
	.uleb128 .LEHB2-.LFB3773
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE3773:
	.text
	.size	_Z10read_inputP10particle_tiPc, .-_Z10read_inputP10particle_tiPc
	.section	.rodata.str1.1
.LC29:
	.string	"error: unable to allocate memory\n"
.LC30:
	.string	"Start computing n-body solver"
.LC31:
	.string	"Failed to allocate device vector d_forces (error code %s)!\n"
.LC32:
	.string	"Failed to allocate device vector d_particles (error code %s)!\n"
.LC33:
	.string	"Failed to allocate device vector d_force_qk (error code %s)!\n"
.LC34:
	.string	"Failed to copy vector d_forces from host to device (error code %s)!\n"
.LC35:
	.string	"Failed to copy vector d_particles from host to device (error code %s)!\n"
.LC36:
	.string	"Failed to copy vector d_force_qk from host to device (error code %s)!\n"
.LC37:
	.string	"Computing starts with..."
.LC38:
	.string	" Block Size: "
.LC39:
	.string	" # of Blocks : "
.LC40:
	.string	"Initial particles"
.LC41:
	.string	"Iteration "
.LC42:
	.string	"Failed to copy vector particles from device to host (error code %s)!\n"
.LC43:
	.string	"Failed to set the memory to value 0 (error code %s)!\n"
.LC45:
	.string	"Failed to launch compute_force_on_device kernel (error code %s)!\n"
.LC46:
	.string	"Failed to launch compute_pos_and_vel_on_device kernel (error code %s)!\n"
.LC47:
	.string	"Final positions and velocities "
.LC51:
	.string	" Time in seconds: %f \n"
.LC52:
	.string	" Gflops Rate: %f GFlop/s\n"
.LC53:
	.string	" Bandwidth Rate : %f GB/s\n"
.LC54:
	.string	"Failed to free device vector d_particles (error code %s)!\n"
.LC55:
	.string	"Failed to free device vector d_forces (error code %s)!\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3766:
	.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
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edi, %ebx
	xorl	%edi, %edi
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
	cmpl	$7, %ebx
	je	.L55
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L89
	movq	%rbp, %rsi
	movl	%ebx, %edi
	jmp	.L88
.L55:
	movq	8(%rbp), %rdi
	call	atoi@PLT
	movl	%eax, N(%rip)
	movl	%eax, %r12d
	testl	%eax, %eax
	jg	.L57
.L59:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L89
	movq	%rbp, %rsi
	movl	$7, %edi
.L88:
	call	_Z5usageiPPc
.L57:
	movq	16(%rbp), %rdi
	call	atoi@PLT
	movl	%eax, %r13d
	testl	%eax, %eax
	jle	.L59
	movq	24(%rbp), %rdi
	call	atoi@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	jle	.L59
	movq	32(%rbp), %rdi
	call	atoi@PLT
	movl	%eax, %r15d
	cmpl	$1, %eax
	ja	.L59
	movq	40(%rbp), %rdi
	call	atoi@PLT
	movl	%eax, num_threads(%rip)
	testl	%eax, %eax
	jle	.L59
	movslq	%r12d, %r14
	movq	%r14, %rdi
	salq	$4, %rdi
	call	malloc@PLT
	imulq	$40, %r14, %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	movl	$16, %edi
	movq	%rax, (%rsp)
	call	malloc@PLT
	cmpq	$0, 8(%rsp)
	movq	%rax, 24(%rsp)
	sete	%al
	cmpq	$0, (%rsp)
	sete	%dl
	orb	%dl, %al
	jne	.L84
	cmpq	$0, 24(%rsp)
	jne	.L60
.L84:
	movq	stderr(%rip), %rdi
	leaq	.LC29(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	jmp	.L92
.L60:
	movq	8(%rsp), %rdi
	movl	%r12d, %esi
	call	_Z10init_forcePA2_di
	movq	48(%rbp), %rdx
	movq	(%rsp), %rdi
	call	_Z10read_inputP10particle_tiPc
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC30(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC5(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movslq	N(%rip), %rax
	leaq	56(%rsp), %rdi
	movq	%rax, %rcx
	imulq	$40, %rax, %rax
	salq	$4, %rcx
	movq	%rcx, %rsi
	movq	%rcx, 32(%rsp)
	movq	%rax, 16(%rsp)
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L62
	call	cudaGetErrorString@PLT
	leaq	.LC31(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L91
.L62:
	movq	16(%rsp), %rsi
	leaq	64(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L63
	call	cudaGetErrorString@PLT
	leaq	.LC32(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L91
.L63:
	leaq	72(%rsp), %rdi
	movl	$16, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L64
	call	cudaGetErrorString@PLT
	leaq	.LC33(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L91
.L64:
	movq	56(%rsp), %rdi
	movq	32(%rsp), %rdx
	movl	$1, %ecx
	movq	8(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L65
	call	cudaGetErrorString@PLT
	leaq	.LC34(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L91
.L65:
	movq	64(%rsp), %rdi
	movq	16(%rsp), %rdx
	movl	$1, %ecx
	movq	(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L66
	call	cudaGetErrorString@PLT
	leaq	.LC35(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L91
.L66:
	movq	72(%rsp), %rdi
	movq	24(%rsp), %rsi
	movl	$1, %ecx
	movl	$16, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L67
	call	cudaGetErrorString@PLT
	leaq	.LC36(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L91
.L67:
	movl	N(%rip), %eax
	movl	num_threads(%rip), %r14d
	leaq	.LC37(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	cltd
	idivl	%r14d
	cmpl	$1, %edx
	sbbl	$-1, %eax
	xorl	%r12d, %r12d
	movl	%eax, %ebp
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC38(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r14d, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC39(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	call	_Z7getTimev
	movl	%ebx, %eax
	cltd
	movsd	%xmm0, 40(%rsp)
	idivl	%r13d
	movl	%eax, %ebx
.L68:
	cmpl	%ebx, %r12d
	jge	.L94
	call	cudaThreadSynchronize@PLT
	movl	%r12d, %eax
	movl	$100, %ecx
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L69
	cmpl	$1, %r15d
	jne	.L69
	testl	%r12d, %r12d
	jne	.L70
	leaq	.LC40(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L86
.L70:
	leaq	.LC41(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r12d, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
.L86:
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movq	(%rsp), %rdi
	movq	16(%rsp), %rdx
	movl	$2, %ecx
	movq	64(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L93
	movq	(%rsp), %rdi
	call	_Z15print_particlesP10particle_t
.L69:
	movq	56(%rsp), %rdi
	movq	32(%rsp), %rdx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L73
	call	cudaGetErrorString@PLT
	leaq	.LC43(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L91
.L73:
	movabsq	$4294967297, %rax
	movl	%r14d, 92(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rax, 96(%rsp)
	movl	100(%rsp), %ecx
	movq	%rax, 84(%rsp)
	movq	92(%rsp), %rdx
	movl	%ebp, 80(%rsp)
	movl	88(%rsp), %esi
	movq	80(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L74
	movq	72(%rsp), %rcx
	movsd	.LC44(%rip), %xmm0
	movl	N(%rip), %edx
	movq	64(%rsp), %rsi
	movq	56(%rsp), %rdi
	call	_Z63__device_stub__Z23compute_force_on_devicePA2_dP10particle_tidPdPA2_dP10particle_tidPd
.L74:
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L75
	call	cudaGetErrorString@PLT
	leaq	.LC45(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L91
.L75:
	movabsq	$4294967297, %rax
	movl	%r14d, 92(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rax, 96(%rsp)
	movl	100(%rsp), %ecx
	movq	%rax, 84(%rsp)
	movq	92(%rsp), %rdx
	movl	%ebp, 80(%rsp)
	movl	88(%rsp), %esi
	movq	80(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L76
	movsd	.LC44(%rip), %xmm0
	movl	N(%rip), %ecx
	movl	%r13d, %edx
	movq	64(%rsp), %rsi
	movq	56(%rsp), %rdi
	call	_Z68__device_stub__Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiidPA2_dP10particle_tiid
.L76:
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L77
	call	cudaGetErrorString@PLT
	leaq	.LC46(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L91
.L77:
	incl	%r12d
	jmp	.L68
.L94:
	call	_Z7getTimev
	subsd	40(%rsp), %xmm0
	movsd	%xmm0, 32(%rsp)
	call	cudaThreadSynchronize@PLT
	movq	(%rsp), %rdi
	movq	16(%rsp), %rdx
	movl	$2, %ecx
	movq	64(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L79
.L93:
	call	cudaGetErrorString@PLT
	leaq	.LC42(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L91
.L79:
	leaq	.LC47(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movq	(%rsp), %rdi
	call	_Z15print_particlesP10particle_t
	movl	N(%rip), %eax
	cvtsi2sdl	%ebx, %xmm2
	movsd	.LC48(%rip), %xmm0
	movq	stdout(%rip), %rdi
	leaq	.LC51(%rip), %rdx
	movl	$2, %esi
	cvtsi2sdl	%eax, %xmm1
	imull	%eax, %eax
	mulsd	%xmm1, %xmm0
	cltq
	salq	$3, %rax
	mulsd	%xmm1, %xmm0
	mulsd	.LC49(%rip), %xmm0
	mulsd	%xmm2, %xmm0
	divsd	32(%rsp), %xmm0
	movq	%xmm0, %rbp
	cvtsi2sdq	%rax, %xmm0
	movb	$1, %al
	mulsd	.LC50(%rip), %xmm0
	mulsd	%xmm2, %xmm0
	divsd	32(%rsp), %xmm0
	divsd	%xmm1, %xmm0
	divsd	%xmm1, %xmm0
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rbx
	movsd	32(%rsp), %xmm0
	call	__fprintf_chk@PLT
	movq	stdout(%rip), %rdi
	movq	%rbp, %xmm0
	movb	$1, %al
	leaq	.LC52(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	stdout(%rip), %rdi
	movq	%rbx, %xmm0
	movb	$1, %al
	leaq	.LC53(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L80
	call	cudaGetErrorString@PLT
	leaq	.LC54(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L91
.L80:
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L90
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L82
.L90:
	call	cudaGetErrorString@PLT
	leaq	.LC55(%rip), %rdx
	movq	%rax, %rcx
.L91:
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L92:
	movl	$1, %edi
	call	exit@PLT
.L82:
	movq	(%rsp), %rdi
	call	free@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L83
.L89:
	call	__stack_chk_fail@PLT
.L83:
	addq	$120, %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
.LFE3766:
	.size	main, .-main
	.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
	.globl	num_threads
	.data
	.align 4
	.type	num_threads, @object
	.size	num_threads, 4
num_threads:
	.long	1
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC6:
	.long	-4194304
	.long	1105199103
	.align 8
.LC8:
	.long	1023782644
	.long	1178147534
	.align 8
.LC9:
	.long	-237910690
	.long	1162392887
	.align 8
.LC10:
	.long	-1049322011
	.long	1158923308
	.align 8
.LC11:
	.long	-1577058304
	.long	1112349332
	.align 8
.LC12:
	.long	-1577058304
	.long	-1035134316
	.align 8
.LC13:
	.long	0
	.long	1091711040
	.align 8
.LC14:
	.long	0
	.long	1084704768
	.align 8
.LC15:
	.long	0
	.long	-1074790400
	.align 8
.LC17:
	.long	-1598689907
	.long	1051772663
	.align 8
.LC44:
	.long	-805144307
	.long	1037195188
	.align 8
.LC48:
	.long	-400107883
	.long	1041313291
	.align 8
.LC49:
	.long	0
	.long	1077149696
	.align 8
.LC50:
	.long	0
	.long	1074266112
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.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:

//
//  main.cu
//  TermProject
//
//  Created by Kutay Demireren on 25/12/15.
//  Copyright © 2015 Kutay Demireren. All rights reserved.
//
/*****************************************
This program compute n many particles forces on each other and their
velocities & positions according to forces in time.
It is called N-Body Solver.

This code is written by Kutay Demireren and Elif Ecem Ates. January, 2016.
*****************************************/



#include <hip/hip_runtime.h>
#include <iostream>
#include <string.h>
#include <math.h>
#include <sys/time.h>
#include <fstream>

using namespace std;

/* Dimension of vect arrays */
#define DIM 2

/* Global definitions for X and Y */
#define X 0
#define Y 1

/* Universal Gravity Constant */
#define G 6.673*pow(10,-11)

typedef double vect_t[DIM];

struct particle_t{
    double mass;
    double position[2];
    double velocity[2];
};

/* Function prototypes */
void print_particles(particle_t *particles);
double fRand(double fMin, double fMax);
void init_force(vect_t *vect, int N);
void init_particle(particle_t *vect, int N);
double getTime();
void read_input(particle_t *particles, int N, char *file);
void usage(int argc, char **argv);

int N = 0;
int num_threads = 1;

/* Kernel functions */
__global__ void compute_force_on_device(vect_t *forces, particle_t *particles, int N, double g, double *force_qk);
__global__ void compute_pos_and_vel_on_device(vect_t *forces, particle_t *particles, int delta_t, int N, double g);


int main(int argc, char * argv[]) {
    srand((unsigned)time(0));
    /*
     Inputs to the program(respectively):
     N            number of the particles
     delta_t      time difference between two time
     T            final time number
     debug        1 to see each step, 0 to see only final step.
     num_threads  # of threads working on the program.

     Inputs provided via file:
     (for each particle)
     mass           mass of particle
     initial_pos    initial position of particle
     initial_vel    initial velocities of particle
     */

    int step = 0, T = 0, delta_t, debug, n_steps;
    vect_t *forces;
    particle_t *particles;
    double start, end, total_time;
    char *pfile;

    // Error code to check CUDA return values
    hipError_t err = hipSuccess;

    /* check validity of inputs	*/
    if (argc != 7)
        usage(argc, argv);
    if ((N = atoi(argv[1])) <= 0 ||
        (delta_t = atoi(argv[2])) <= 0 ||
        (T = atoi(argv[3])) <= 0 ||
        (debug = atoi(argv[4])) < 0 ||
	      (debug = atoi(argv[4])) > 1 ||
        (num_threads = atoi(argv[5])) <= 0)
        usage(argc, argv);



    /* Allocating on host memory */
    forces = (vect_t *) malloc(N*sizeof(vect_t));
    particles = (particle_t *) malloc(N*sizeof(particle_t));
    double *force_qk = (double *) malloc(2*sizeof(double));
    if(!forces || !particles || !force_qk){
        fprintf(stderr, "error: unable to allocate memory\n");
        exit(1);
    }

    //Initalizing host vectors
    init_force(forces, N);
    pfile = argv[6];
    read_input(particles, N, pfile);


    cout << endl << "Start computing n-body solver" << endl;
    cout << "------------------" << endl;


    //Size of each vector
    size_t size_force = N*sizeof(vect_t);
    size_t size_particle = N*sizeof(particle_t);
    //Initialize device input vectors
    vect_t *d_forces;
    particle_t *d_particles;
    double *d_force_qk;

    /* Allocating memory on device */
    // Allocate the device input vector d_forces
    err = hipMalloc((void **)&d_forces, size_force);
    if (err != hipSuccess)
      {
        fprintf(stderr, "Failed to allocate device vector d_forces (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
      }

    // Allocate the device input vector d_particles
    err = hipMalloc((void **)&d_particles, size_particle);
    if (err != hipSuccess)
      {
        fprintf(stderr, "Failed to allocate device vector d_particles (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
      }


    err = hipMalloc((void **)&d_force_qk, 2*sizeof(double));
    if (err != hipSuccess)
      {
        fprintf(stderr, "Failed to allocate device vector d_force_qk (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
      }


    /* Copy host vectors to device vectors */
    // Copy forces to d_forces
    err = hipMemcpy(d_forces, forces, size_force, hipMemcpyHostToDevice);
    if (err != hipSuccess)
      {
        fprintf(stderr, "Failed to copy vector d_forces from host to device (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
      }

    // Copy particles to d_particles
    err = hipMemcpy(d_particles, particles, size_particle, hipMemcpyHostToDevice);
    if (err != hipSuccess)
      {
        fprintf(stderr, "Failed to copy vector d_particles from host to device (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
      }

    // Copy particles to d_force_qk
    err = hipMemcpy(d_force_qk, force_qk, 2*sizeof(double), hipMemcpyHostToDevice);
    if (err != hipSuccess)
      {
        fprintf(stderr, "Failed to copy vector d_force_qk from host to device (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
      }


    //Final setups for CUDA
    int numThreadsInBlock = num_threads;
    int numBlocks = N / numThreadsInBlock + (N%numThreadsInBlock == 0 ? 0 : 1);

    cout << "Computing starts with..." << endl << " Block Size: " << numThreadsInBlock << endl << " # of Blocks : " << numBlocks << endl;

    start = getTime();

    n_steps = T / delta_t;

    double g = G;

    //Computing
    for (step = 0; step < n_steps; step++) {
      /* Synchronize, before it compute new velocities and positions.
	     To make sure all computations have finished in the last step */
      hipDeviceSynchronize();

  if(step % 100 == 0 && debug == 1){
  	if(step == 0)
	   cout << "Initial particles" << endl;
	  else
	   cout << "Iteration " << step << endl;

	/* Take current values to print */
	err = hipMemcpy(particles, d_particles, size_particle, hipMemcpyDeviceToHost);
	if (err != hipSuccess)
	  {
	    fprintf(stderr, "Failed to copy vector particles from device to host (error code %s)!\n", hipGetErrorString(err));
	    exit(EXIT_FAILURE);
	  }

	print_particles(particles);
      }

      //Set all forces on particles to 0 before computing
      err = hipMemset(d_forces, 0, size_force);
      if(err != hipSuccess){
	fprintf(stderr, "Failed to set the memory to value 0 (error code %s)!\n", hipGetErrorString(err));
	exit(1);
      }

      //Kernel launch
      compute_force_on_device<<<numBlocks, numThreadsInBlock>>>(d_forces, d_particles, N, g, d_force_qk);
      err = hipGetLastError();
      if (err != hipSuccess)
	{
	  fprintf(stderr, "Failed to launch compute_force_on_device kernel (error code %s)!\n", hipGetErrorString(err));
	  exit(EXIT_FAILURE);
	}



      //Update positions and velocities according to force
      //Kernel launch
      compute_pos_and_vel_on_device<<<numBlocks, numThreadsInBlock>>>(d_forces, d_particles, delta_t, N, g);
      err = hipGetLastError();
      if (err != hipSuccess)
	{
	  fprintf(stderr, "Failed to launch compute_pos_and_vel_on_device kernel (error code %s)!\n", hipGetErrorString(err));
	  exit(EXIT_FAILURE);
	}
    }
    /* End of computing */

    /* Time passed */
    end = getTime();
    total_time = end - start;

    //To make sure kernels have finished
    hipDeviceSynchronize();

    /* Copy the final states to Host */
    err = hipMemcpy(particles, d_particles, size_particle, hipMemcpyDeviceToHost);

    if (err != hipSuccess)
      {
	fprintf(stderr, "Failed to copy vector particles from device to host (error code %s)!\n", hipGetErrorString(err));
	exit(EXIT_FAILURE);
      }

    /* print final states of particles */
    cout << "Final positions and velocities " << endl;
    print_particles(particles);


    int num_flops = 20 ;
    double flop_rate = n_steps * (1E-9 * N * N * num_flops) / total_time;
    double BW = n_steps * (N * N * sizeof(double) * 3.0)/total_time /N /N /N;

    /* output results */
    fprintf(stdout, " Time in seconds: %f \n", total_time);
    fprintf(stdout, " Gflops Rate: %f GFlop/s\n", flop_rate);
    fprintf(stdout, " Bandwidth Rate : %f GB/s\n", BW);


    /* cleanup */
    err = hipFree(d_particles);
    if (err != hipSuccess)
      {
        fprintf(stderr, "Failed to free device vector d_particles (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
      }
    err = hipFree(d_forces);
    if (err != hipSuccess)
      {
        fprintf(stderr, "Failed to free device vector d_forces (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
      }
    err = hipFree(d_force_qk);
    if (err != hipSuccess)
      {
        fprintf(stderr, "Failed to free device vector d_forces (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
      }
    free(particles);
    free(forces);
    free(force_qk);


    return 0;
}


__global__ void compute_pos_and_vel_on_device(vect_t *forces, particle_t *particles, int delta_t, int N, double g){
    int q = 0;
    q = blockIdx.x*blockDim.x + threadIdx.x;

    if(q>=0 && q<N){
      //position update
      particles[q].position[X] += delta_t * particles[q].velocity[X];
      particles[q].position[Y] += delta_t * particles[q].velocity[Y];

      //velocity update
      particles[q].velocity[X] += delta_t/particles[q].mass*forces[q][X];
      particles[q].velocity[Y] += delta_t/particles[q].mass*forces[q][Y];
    }
}


__global__ void compute_force_on_device(vect_t *forces, particle_t *particles, int N, double g, double *force_qk){
//It is the basic computation code, computing directly the forces.
    int q = 0;
    q = blockIdx.x*blockDim.x + threadIdx.x;

    if(q>=0 && q<N){
      for(int k = 0; k<N; k++){
	if(k!=q){
	  double x_diff = particles[q].position[X] - particles[k].position[X];
	  double y_diff = particles[q].position[Y] - particles[k].position[Y];
	  double dist = sqrt(x_diff*x_diff + y_diff*y_diff);
	  double dist_cubed = dist*dist*dist;
	  forces[q][X] -= g*particles[q].mass*particles[k].mass/dist_cubed * x_diff;
	  forces[q][Y] -= g*particles[q].mass*particles[k].mass/dist_cubed * y_diff;
	}
      }
    }
}



void print_particles(particle_t *particles)
{
    for (int part = 0; part < N; part++) {
        particle_t particle = particles[part];
        cout << "position of particle " << part << " is (" << particle.position[X] << "," << particle.position[Y]  << ")" << endl;
        cout << "velocity of particle " << part << " is (" << particle.velocity[X] << "," << particle.velocity[Y]  << ")" << endl;
    }
    cout << "------------------" << endl;
}


double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

void init_force(vect_t *vect, int N)
{
    int q=0;

    for(q=0; q < N; q++)
    {
        vect[q][X]=0.0;
        vect[q][Y]=0.0;
    }
}


void init_particle(particle_t *particles, int N)
{
    for (int i = 0; i < N; i++) {
        if(i==5){ //Sun
            struct particle_t particle;
            particle.mass = fRand(1.9890e+30, 1.9890e+30);
            particle.position[X] = fRand(0,0);
            particle.position[Y] = fRand(0,0);
            particle.velocity[X] = fRand(0,0);
            particle.velocity[Y] = fRand(0,0);
            particles[i] = particle;
        }else{
            struct particle_t particle;
            double min = 5.9740e+24;
            double max = 10*min;
            particle.mass = fRand(min, max);
            particle.position[X] = fRand(-2.50e+11, 2.50e+11);
            particle.position[Y] = fRand(-2.50e+11, 2.50e+11);
            particle.velocity[X] = fRand(0, 0);
            particle.velocity[Y] = fRand(2.9800e+03, 2.9800e+05);
            particles[i] = particle;
        }
    }
}


double getTime()
{
    const double kMicro = 1.0e-6;
    struct timeval TV;

    const int RC = gettimeofday(&TV, NULL);
    if(RC == -1)
    {
        printf("ERROR: Bad call to gettimeofday\n");
        return(-1);
    }
    return( ((double)TV.tv_sec) + kMicro * ((double)TV.tv_usec) );
}


void read_input(particle_t *particles, int N, char *file)
{
  ifstream myfile;
  double mass, positionX, positionY, velocityX, velocityY;
  int i = 0;

  myfile.open(file, ios::in);

  if(myfile.is_open()){
    while(i < N){
      myfile >> positionX >> positionY >> velocityX >> velocityY >> mass;
      struct particle_t particle;
      particle.mass = mass;
      particle.position[X] = positionX;
      particle.position[Y] = positionY;
      particle.velocity[X] = velocityX;
      particle.velocity[Y] = velocityY;
      particles[i] = particle;
      i++;
    }
    myfile.close();
  }else{
    cout << fprintf(stderr, "error: file could not be opened for reading") << endl;
    exit(1);
  }
}

void usage(int argc, char **argv)
{
    cout << "Usage " << argv[0] << "<N> <delta_t> <T> <debug> <num_threads> <part_file>" << endl;
    cout << "\tN\t - number of particles (positive integer)" << endl;
    cout << "\tdelta_t\t - time difference between two time (positive)" << endl;
    cout << "\tT\t - final time number (positive)" << endl;
    cout << "\tdebug\t - 1 to see the states of particles time to time, 0 to see only final step" << endl;
    cout << "\tnum_threads\t - number of threads" << endl;
    cout << "\tpart_file\t - name of the file containing information the inital states of particles" << endl;
    exit(1);
}

	.text
	.file	"main.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI0_0:
	.quad	0x3dd257b4d002790d              # double 6.6729999999999999E-11
.LCPI0_1:
	.quad	0x3e112e0be826d695              # double 1.0000000000000001E-9
.LCPI0_2:
	.quad	0x4034000000000000              # double 20
.LCPI0_3:
	.quad	0x4008000000000000              # double 3
	.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
	movl	%edi, %ebp
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	cmpl	$7, %ebp
	jne	.LBB0_43
# %bb.1:
	movq	8(%rbx), %rdi
	callq	atoi
	movl	%eax, N(%rip)
	testl	%eax, %eax
	jle	.LBB0_43
# %bb.2:
	movl	%eax, %ebp
	movq	16(%rbx), %rdi
	callq	atoi
	movl	%eax, 44(%rsp)                  # 4-byte Spill
	testl	%eax, %eax
	jle	.LBB0_43
# %bb.3:
	movq	24(%rbx), %rdi
	callq	atoi
	testl	%eax, %eax
	jle	.LBB0_43
# %bb.4:
	movl	%eax, %r14d
	movq	32(%rbx), %rdi
	callq	atoi
	movl	%eax, 24(%rsp)                  # 4-byte Spill
	cmpl	$1, %eax
	ja	.LBB0_43
# %bb.5:
	movq	40(%rbx), %rdi
	callq	atoi
	movl	%eax, num_threads(%rip)
	testl	%eax, %eax
	jle	.LBB0_43
# %bb.6:
	movl	%r14d, 60(%rsp)                 # 4-byte Spill
	movl	%ebp, %r14d
	movq	%r14, %rdi
	shlq	$4, %rdi
	callq	malloc
	movq	%rax, %r15
	leaq	(,%r14,8), %rax
	leaq	(%rax,%rax,4), %rdi
	callq	malloc
	movq	%rax, (%rsp)                    # 8-byte Spill
	movl	$16, %edi
	callq	malloc
	testq	%r15, %r15
	je	.LBB0_45
# %bb.7:
	cmpq	$0, (%rsp)                      # 8-byte Folded Reload
	je	.LBB0_45
# %bb.8:
	movq	%rax, %r12
	testq	%rax, %rax
	je	.LBB0_45
# %bb.9:                                # %_Z10init_forcePA2_di.exit
	shlq	$4, %r14
	movq	%r15, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	movq	48(%rbx), %rdx
	movq	(%rsp), %rdi                    # 8-byte Reload
	movl	%ebp, %esi
	callq	_Z10read_inputP10particle_tiPc
	movl	$_ZSt4cout, %r14d
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rax, %rbx
	movl	$.L.str.1, %esi
	movl	$29, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%rbx), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$18, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movslq	N(%rip), %rbx
	movq	%rbx, %r13
	shlq	$4, %r13
	leaq	32(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB0_46
# %bb.10:
	shlq	$3, %rbx
	leaq	(%rbx,%rbx,4), %rsi
	leaq	8(%rsp), %rdi
	movq	%rsi, 16(%rsp)                  # 8-byte Spill
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB0_47
# %bb.11:
	leaq	48(%rsp), %rdi
	movl	$16, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB0_48
# %bb.12:
	movq	32(%rsp), %rdi
	movq	%r15, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB0_49
# %bb.13:
	movq	8(%rsp), %rdi
	movq	(%rsp), %rsi                    # 8-byte Reload
	movq	16(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB0_50
# %bb.14:
	movq	%r15, 80(%rsp)                  # 8-byte Spill
	movq	48(%rsp), %rdi
	movl	$16, %edx
	movq	%r12, 72(%rsp)                  # 8-byte Spill
	movq	%r12, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB0_51
# %bb.15:
	movl	num_threads(%rip), %ebx
	movl	N(%rip), %eax
	cltd
	idivl	%ebx
	movl	%eax, %r12d
	cmpl	$1, %edx
	sbbl	$-1, %r12d
	movl	$_ZSt4cout, %r14d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.9, %esi
	movl	$24, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rax, %r14
	movl	$.L.str.10, %esi
	movl	$13, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_ZNSolsEi
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rax, %r14
	movl	$.L.str.11, %esi
	movl	$15, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r14, %rdi
	movl	%r12d, %esi
	callq	_ZNSolsEi
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	callq	_Z7getTimev
	movsd	%xmm0, 64(%rsp)                 # 8-byte Spill
	xorl	%r14d, %r14d
	movl	60(%rsp), %esi                  # 4-byte Reload
	movl	%esi, %eax
	xorl	%edx, %edx
	movl	44(%rsp), %ecx                  # 4-byte Reload
	divl	%ecx
	movl	%eax, %ebp
	cmpl	%esi, %ecx
	movq	(%rsp), %r15                    # 8-byte Reload
	ja	.LBB0_32
# %bb.16:                               # %.lr.ph
	movl	%r12d, %r12d
	btsq	$32, %r12
	btsq	$32, %rbx
.LBB0_17:                               # =>This Inner Loop Header: Depth=1
	callq	hipDeviceSynchronize
	cmpl	$1, 24(%rsp)                    # 4-byte Folded Reload
	jne	.LBB0_24
# %bb.18:                               #   in Loop: Header=BB0_17 Depth=1
	movl	%r14d, %eax
	imulq	$1374389535, %rax, %rax         # imm = 0x51EB851F
	shrq	$37, %rax
	imull	$100, %eax, %eax
	cmpl	%r14d, %eax
	jne	.LBB0_24
# %bb.19:                               #   in Loop: Header=BB0_17 Depth=1
	testl	%r14d, %r14d
	je	.LBB0_21
# %bb.20:                               #   in Loop: Header=BB0_17 Depth=1
	movl	$_ZSt4cout, %edi
	movl	$.L.str.13, %esi
	movl	$10, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%r14d, %esi
	callq	_ZNSolsEi
	movq	%rax, %r15
	jmp	.LBB0_22
.LBB0_21:                               #   in Loop: Header=BB0_17 Depth=1
	movl	$_ZSt4cout, %r15d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.12, %esi
	movl	$17, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.LBB0_22:                               #   in Loop: Header=BB0_17 Depth=1
	movq	(%r15), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	8(%rsp), %rsi
	movq	(%rsp), %r15                    # 8-byte Reload
	movq	%r15, %rdi
	movq	16(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB0_40
# %bb.23:                               #   in Loop: Header=BB0_17 Depth=1
	movq	%r15, %rdi
	callq	_Z15print_particlesP10particle_t
.LBB0_24:                               #   in Loop: Header=BB0_17 Depth=1
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r13, %rdx
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB0_39
# %bb.25:                               #   in Loop: Header=BB0_17 Depth=1
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB0_27
# %bb.26:                               #   in Loop: Header=BB0_17 Depth=1
	movq	32(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	N(%rip), %edx
	movq	48(%rsp), %rcx
	movsd	.LCPI0_0(%rip), %xmm0           # xmm0 = mem[0],zero
	callq	_Z38__device_stub__compute_force_on_devicePA2_dP10particle_tidPd
.LBB0_27:                               #   in Loop: Header=BB0_17 Depth=1
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB0_38
# %bb.28:                               #   in Loop: Header=BB0_17 Depth=1
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB0_30
# %bb.29:                               #   in Loop: Header=BB0_17 Depth=1
	movq	32(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	N(%rip), %ecx
	movl	44(%rsp), %edx                  # 4-byte Reload
	movsd	.LCPI0_0(%rip), %xmm0           # xmm0 = mem[0],zero
	callq	_Z44__device_stub__compute_pos_and_vel_on_devicePA2_dP10particle_tiid
.LBB0_30:                               #   in Loop: Header=BB0_17 Depth=1
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB0_37
# %bb.31:                               #   in Loop: Header=BB0_17 Depth=1
	incl	%r14d
	cmpl	%ebp, %r14d
	jl	.LBB0_17
.LBB0_32:                               # %._crit_edge
	callq	_Z7getTimev
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	callq	hipDeviceSynchronize
	movq	8(%rsp), %rsi
	movq	%r15, %rdi
	movq	16(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB0_40
# %bb.33:
	movsd	24(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	subsd	64(%rsp), %xmm0                 # 8-byte Folded Reload
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.18, %esi
	movl	$31, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%r15, %rdi
	callq	_Z15print_particlesP10particle_t
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ebp, %xmm0
	movl	N(%rip), %eax
	cvtsi2sd	%eax, %xmm1
	movsd	.LCPI0_1(%rip), %xmm3           # xmm3 = mem[0],zero
	mulsd	%xmm1, %xmm3
	mulsd	%xmm1, %xmm3
	mulsd	.LCPI0_2(%rip), %xmm3
	mulsd	%xmm0, %xmm3
	movsd	24(%rsp), %xmm2                 # 8-byte Reload
                                        # xmm2 = mem[0],zero
	divsd	%xmm2, %xmm3
	movsd	%xmm3, (%rsp)                   # 8-byte Spill
	imull	%eax, %eax
	shlq	$3, %rax
	xorps	%xmm3, %xmm3
	cvtsi2sd	%rax, %xmm3
	mulsd	.LCPI0_3(%rip), %xmm3
	mulsd	%xmm0, %xmm3
	divsd	%xmm2, %xmm3
	movapd	%xmm2, %xmm0
	divsd	%xmm1, %xmm3
	divsd	%xmm1, %xmm3
	divsd	%xmm1, %xmm3
	movsd	%xmm3, 16(%rsp)                 # 8-byte Spill
	movq	stdout(%rip), %rdi
	movl	$.L.str.19, %esi
	movb	$1, %al
	callq	fprintf
	movq	stdout(%rip), %rdi
	movl	$.L.str.20, %esi
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	fprintf
	movq	stdout(%rip), %rdi
	movl	$.L.str.21, %esi
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	fprintf
	movq	8(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	movq	80(%rsp), %rbx                  # 8-byte Reload
	movq	72(%rsp), %r14                  # 8-byte Reload
	jne	.LBB0_52
# %bb.34:
	movq	32(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB0_44
# %bb.35:
	movq	48(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB0_44
# %bb.36:
	movq	%r15, %rdi
	callq	free
	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
.LBB0_37:
	.cfi_def_cfa_offset 144
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.17, %esi
	jmp	.LBB0_41
.LBB0_38:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.16, %esi
	jmp	.LBB0_41
.LBB0_39:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.15, %esi
	jmp	.LBB0_41
.LBB0_40:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.14, %esi
.LBB0_41:
	movq	%rbx, %rdi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	fprintf
.LBB0_42:
	movl	$1, %edi
	callq	exit
.LBB0_43:
	movq	%rbx, %rsi
	callq	_Z5usageiPPc
.LBB0_44:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.23, %esi
	jmp	.LBB0_41
.LBB0_45:
	movq	stderr(%rip), %rcx
	movl	$.L.str, %edi
	movl	$33, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	jmp	.LBB0_42
.LBB0_46:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.3, %esi
	jmp	.LBB0_41
.LBB0_47:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	jmp	.LBB0_41
.LBB0_48:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.5, %esi
	jmp	.LBB0_41
.LBB0_49:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.6, %esi
	jmp	.LBB0_41
.LBB0_50:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.7, %esi
	jmp	.LBB0_41
.LBB0_51:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.8, %esi
	jmp	.LBB0_41
.LBB0_52:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.22, %esi
	jmp	.LBB0_41
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.globl	_Z5usageiPPc                    # -- Begin function _Z5usageiPPc
	.type	_Z5usageiPPc,@function
_Z5usageiPPc:                           # @_Z5usageiPPc
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rsi, %rbx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.31, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	(%rbx), %rsi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.32, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$_ZSt4cout, %edi
	movl	$.L.str.33, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$_ZSt4cout, %edi
	movl	$.L.str.34, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$_ZSt4cout, %edi
	movl	$.L.str.35, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$_ZSt4cout, %edi
	movl	$.L.str.36, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$_ZSt4cout, %edi
	movl	$.L.str.37, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$_ZSt4cout, %edi
	movl	$.L.str.38, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.Lfunc_end1:
	.size	_Z5usageiPPc, .Lfunc_end1-_Z5usageiPPc
	.cfi_endproc
                                        # -- End function
	.globl	_Z10init_forcePA2_di            # -- Begin function _Z10init_forcePA2_di
	.type	_Z10init_forcePA2_di,@function
_Z10init_forcePA2_di:                   # @_Z10init_forcePA2_di
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB2_1
# %bb.2:                                # %.lr.ph.preheader
	movl	%esi, %edx
	shlq	$4, %rdx
	xorl	%esi, %esi
	jmp	memset@PLT                      # TAILCALL
.LBB2_1:                                # %._crit_edge
	retq
.Lfunc_end2:
	.size	_Z10init_forcePA2_di, .Lfunc_end2-_Z10init_forcePA2_di
	.cfi_endproc
                                        # -- End function
	.globl	_Z10read_inputP10particle_tiPc  # -- Begin function _Z10read_inputP10particle_tiPc
	.type	_Z10read_inputP10particle_tiPc,@function
_Z10read_inputP10particle_tiPc:         # @_Z10read_inputP10particle_tiPc
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %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	$568, %rsp                      # imm = 0x238
	.cfi_def_cfa_offset 624
	.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	%rdx, %r14
	movl	%esi, %ebp
	movq	%rdi, %rbx
	leaq	48(%rsp), %r15
	movq	%r15, %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev
.Ltmp0:
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp1:
# %bb.1:
	leaq	168(%rsp), %rdi
	callq	_ZNKSt12__basic_fileIcE7is_openEv
	testb	%al, %al
	je	.LBB3_15
# %bb.2:                                # %.preheader
	testl	%ebp, %ebp
	jle	.LBB3_10
# %bb.3:                                # %.lr.ph.preheader
	movl	%ebp, %eax
	shlq	$3, %rax
	leaq	(%rax,%rax,4), %r15
	xorl	%r12d, %r12d
	leaq	16(%rsp), %r13
	leaq	8(%rsp), %rbp
	leaq	40(%rsp), %r14
.LBB3_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
.Ltmp10:
	leaq	48(%rsp), %rdi
	leaq	32(%rsp), %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp11:
# %bb.5:                                # %_ZNSirsERd.exit
                                        #   in Loop: Header=BB3_4 Depth=1
.Ltmp12:
	movq	%rax, %rdi
	leaq	24(%rsp), %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp13:
# %bb.6:                                # %_ZNSirsERd.exit7
                                        #   in Loop: Header=BB3_4 Depth=1
.Ltmp14:
	movq	%rax, %rdi
	movq	%r13, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp15:
# %bb.7:                                # %_ZNSirsERd.exit8
                                        #   in Loop: Header=BB3_4 Depth=1
.Ltmp16:
	movq	%rax, %rdi
	movq	%rbp, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp17:
# %bb.8:                                # %_ZNSirsERd.exit9
                                        #   in Loop: Header=BB3_4 Depth=1
.Ltmp18:
	movq	%rax, %rdi
	movq	%r14, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp19:
# %bb.9:                                # %_ZNSirsERd.exit10
                                        #   in Loop: Header=BB3_4 Depth=1
	movsd	40(%rsp), %xmm0                 # xmm0 = mem[0],zero
	movsd	32(%rsp), %xmm1                 # xmm1 = mem[0],zero
	movsd	24(%rsp), %xmm2                 # xmm2 = mem[0],zero
	movsd	16(%rsp), %xmm3                 # xmm3 = mem[0],zero
	movsd	8(%rsp), %xmm4                  # xmm4 = mem[0],zero
	movsd	%xmm0, (%rbx,%r12)
	movsd	%xmm1, 8(%rbx,%r12)
	movsd	%xmm2, 16(%rbx,%r12)
	movsd	%xmm3, 24(%rbx,%r12)
	movsd	%xmm4, 32(%rbx,%r12)
	addq	$40, %r12
	cmpq	%r12, %r15
	jne	.LBB3_4
.LBB3_10:                               # %._crit_edge
.Ltmp21:
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp22:
# %bb.11:
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	addq	$568, %rsp                      # imm = 0x238
	.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
.LBB3_15:
	.cfi_def_cfa_offset 624
	movq	stderr(%rip), %rdi
	movl	$.L.str.30, %esi
	xorl	%eax, %eax
	callq	fprintf
.Ltmp2:
	movl	$_ZSt4cout, %edi
	movl	%eax, %esi
	callq	_ZNSolsEi
.Ltmp3:
# %bb.16:
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
.Ltmp4:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp5:
# %bb.17:                               # %.noexc
.Ltmp6:
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
.Ltmp7:
# %bb.18:                               # %.noexc11
.Ltmp8:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp9:
# %bb.19:                               # %_ZNSolsEPFRSoS_E.exit
	movl	$1, %edi
	callq	exit
.LBB3_12:                               # %.loopexit
.Ltmp20:
	jmp	.LBB3_14
.LBB3_13:                               # %.loopexit.split-lp
.Ltmp23:
.LBB3_14:
	movq	%rax, %rbx
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	_Z10read_inputP10particle_tiPc, .Lfunc_end3-_Z10read_inputP10particle_tiPc
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table3:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp23-.Lfunc_begin0          #     jumps to .Ltmp23
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp10-.Lfunc_begin0          # >> Call Site 3 <<
	.uleb128 .Ltmp19-.Ltmp10                #   Call between .Ltmp10 and .Ltmp19
	.uleb128 .Ltmp20-.Lfunc_begin0          #     jumps to .Ltmp20
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp21-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp9-.Ltmp21                 #   Call between .Ltmp21 and .Ltmp9
	.uleb128 .Ltmp23-.Lfunc_begin0          #     jumps to .Ltmp23
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp9-.Lfunc_begin0           # >> Call Site 5 <<
	.uleb128 .Lfunc_end3-.Ltmp9             #   Call between .Ltmp9 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z7getTimev
.LCPI4_0:
	.quad	0x3eb0c6f7a0b5ed8d              # double 9.9999999999999995E-7
.LCPI4_1:
	.quad	0xbff0000000000000              # double -1
	.text
	.globl	_Z7getTimev
	.type	_Z7getTimev,@function
_Z7getTimev:                            # @_Z7getTimev
	.cfi_startproc
# %bb.0:
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	cmpl	$-1, %eax
	je	.LBB4_1
# %bb.2:
	cvtsi2sdq	8(%rsp), %xmm1
	cvtsi2sdq	16(%rsp), %xmm0
	mulsd	.LCPI4_0(%rip), %xmm0
	addsd	%xmm1, %xmm0
	jmp	.LBB4_3
.LBB4_1:
	movl	$.Lstr, %edi
	callq	puts@PLT
	movsd	.LCPI4_1(%rip), %xmm0           # xmm0 = mem[0],zero
.LBB4_3:
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z7getTimev, .Lfunc_end4-_Z7getTimev
	.cfi_endproc
                                        # -- End function
	.globl	_Z15print_particlesP10particle_t # -- Begin function _Z15print_particlesP10particle_t
	.type	_Z15print_particlesP10particle_t,@function
_Z15print_particlesP10particle_t:       # @_Z15print_particlesP10particle_t
	.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	$32, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	cmpl	$0, N(%rip)
	jle	.LBB5_3
# %bb.1:                                # %.lr.ph.preheader
	movq	%rdi, %rbx
	addq	$32, %rbx
	xorl	%r14d, %r14d
.LBB5_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	-24(%rbx), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	movsd	-16(%rbx), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movsd	-8(%rbx), %xmm0                 # xmm0 = mem[0],zero
	movsd	%xmm0, 16(%rsp)                 # 8-byte Spill
	movsd	(%rbx), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	movl	$_ZSt4cout, %edi
	movl	$.L.str.24, %esi
	movl	$21, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%r14d, %esi
	callq	_ZNSolsEi
	movq	%rax, %r15
	movl	$.L.str.25, %esi
	movl	$5, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r15, %rdi
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r15
	movl	$.L.str.26, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r15, %rdi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r15
	movl	$.L.str.27, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r15), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.28, %esi
	movl	$21, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%r14d, %esi
	callq	_ZNSolsEi
	movq	%rax, %r15
	movl	$.L.str.25, %esi
	movl	$5, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r15, %rdi
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r15
	movl	$.L.str.26, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r15, %rdi
	movsd	24(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r15
	movl	$.L.str.27, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r15), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	incq	%r14
	movslq	N(%rip), %rax
	addq	$40, %rbx
	cmpq	%rax, %r14
	jl	.LBB5_2
.LBB5_3:                                # %._crit_edge
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$18, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	addq	$32, %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	_ZNSo5flushEv                   # TAILCALL
.Lfunc_end5:
	.size	_Z15print_particlesP10particle_t, .Lfunc_end5-_Z15print_particlesP10particle_t
	.cfi_endproc
                                        # -- End function
	.globl	_Z38__device_stub__compute_force_on_devicePA2_dP10particle_tidPd # -- Begin function _Z38__device_stub__compute_force_on_devicePA2_dP10particle_tidPd
	.type	_Z38__device_stub__compute_force_on_devicePA2_dP10particle_tidPd,@function
_Z38__device_stub__compute_force_on_devicePA2_dP10particle_tidPd: # @_Z38__device_stub__compute_force_on_devicePA2_dP10particle_tidPd
	.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	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	40(%rsp), %rdx
	movsd	%xmm0, (%rdx)
	leaq	32(%rsp), %r8
	movq	%rcx, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%r8, 32(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z23compute_force_on_devicePA2_dP10particle_tidPd, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	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_end6:
	.size	_Z38__device_stub__compute_force_on_devicePA2_dP10particle_tidPd, .Lfunc_end6-_Z38__device_stub__compute_force_on_devicePA2_dP10particle_tidPd
	.cfi_endproc
                                        # -- End function
	.globl	_Z44__device_stub__compute_pos_and_vel_on_devicePA2_dP10particle_tiid # -- Begin function _Z44__device_stub__compute_pos_and_vel_on_devicePA2_dP10particle_tiid
	.type	_Z44__device_stub__compute_pos_and_vel_on_devicePA2_dP10particle_tiid,@function
_Z44__device_stub__compute_pos_and_vel_on_devicePA2_dP10particle_tiid: # @_Z44__device_stub__compute_pos_and_vel_on_devicePA2_dP10particle_tiid
	.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	$128, %rsp
	.cfi_def_cfa_offset 176
	.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)
	movq	%rsp, %rdx
	movl	%ecx, (%rdx)
	leaq	24(%rsp), %rcx
	movsd	%xmm0, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%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	$_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	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_end7:
	.size	_Z44__device_stub__compute_pos_and_vel_on_devicePA2_dP10particle_tiid, .Lfunc_end7-_Z44__device_stub__compute_pos_and_vel_on_devicePA2_dP10particle_tiid
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z5fRanddd
.LCPI8_0:
	.quad	0x41dfffffffc00000              # double 2147483647
	.text
	.globl	_Z5fRanddd
	.type	_Z5fRanddd,@function
_Z5fRanddd:                             # @_Z5fRanddd
	.cfi_startproc
# %bb.0:
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movsd	%xmm1, 16(%rsp)                 # 8-byte Spill
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	callq	rand
	xorps	%xmm1, %xmm1
	cvtsi2sd	%eax, %xmm1
	divsd	.LCPI8_0(%rip), %xmm1
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	8(%rsp), %xmm2                  # 8-byte Reload
                                        # xmm2 = mem[0],zero
	subsd	%xmm2, %xmm0
	mulsd	%xmm1, %xmm0
	addsd	%xmm2, %xmm0
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_Z5fRanddd, .Lfunc_end8-_Z5fRanddd
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z13init_particleP10particle_ti
.LCPI9_0:
	.quad	0x41dfffffffc00000              # double 2147483647
.LCPI9_1:
	.quad	0x45463cb259a331a1              # double 5.3765999999999998E+25
.LCPI9_2:
	.quad	0x4513c42cc1749de5              # double 5.9740000000000004E+24
.LCPI9_3:
	.quad	0x425d1a94a2000000              # double 5.0E+11
.LCPI9_4:
	.quad	0xc24d1a94a2000000              # double -2.5E+11
.LCPI9_5:
	.quad	0x411201b000000000              # double 295020
.LCPI9_6:
	.quad	0x40a7480000000000              # double 2980
.LCPI9_7:
	.quad	0x46391ace3d05aef4              # double 1.9889999999999999E+30
	.text
	.globl	_Z13init_particleP10particle_ti
	.type	_Z13init_particleP10particle_ti,@function
_Z13init_particleP10particle_ti:        # @_Z13init_particleP10particle_ti
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB9_7
# %bb.1:                                # %.lr.ph
	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	%rdi, %rbx
	movl	%esi, %eax
	shlq	$3, %rax
	leaq	(%rax,%rax,4), %rax
	movq	%rax, (%rsp)                    # 8-byte Spill
	xorl	%r13d, %r13d
.LBB9_2:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	movl	%eax, %ebp
	callq	rand
	movl	%eax, %r14d
	callq	rand
	movl	%eax, %r15d
	callq	rand
	movl	%eax, %r12d
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ebp, %xmm0
	movsd	.LCPI9_0(%rip), %xmm5           # xmm5 = mem[0],zero
	divsd	%xmm5, %xmm0
	xorps	%xmm1, %xmm1
	cvtsi2sd	%r14d, %xmm1
	divsd	%xmm5, %xmm1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%r15d, %xmm2
	xorps	%xmm3, %xmm3
	cvtsi2sd	%r12d, %xmm3
	divsd	%xmm5, %xmm2
	divsd	%xmm5, %xmm3
	xorpd	%xmm6, %xmm6
	mulsd	%xmm6, %xmm3
	addsd	%xmm6, %xmm3
	xorps	%xmm4, %xmm4
	cvtsi2sd	%eax, %xmm4
	divsd	%xmm5, %xmm4
	cmpq	$200, %r13
	jne	.LBB9_4
# %bb.3:                                #   in Loop: Header=BB9_2 Depth=1
	mulsd	%xmm6, %xmm0
	addsd	.LCPI9_7(%rip), %xmm0
	mulsd	%xmm6, %xmm1
	addsd	%xmm6, %xmm1
	mulsd	%xmm6, %xmm2
	addsd	%xmm6, %xmm2
	mulsd	%xmm6, %xmm4
	addsd	%xmm6, %xmm4
	movsd	%xmm0, 200(%rbx)
	movsd	%xmm1, 208(%rbx)
	movsd	%xmm2, 216(%rbx)
	movsd	%xmm3, 224(%rbx)
	movsd	%xmm4, 232(%rbx)
	jmp	.LBB9_5
.LBB9_4:                                #   in Loop: Header=BB9_2 Depth=1
	mulsd	.LCPI9_1(%rip), %xmm0
	addsd	.LCPI9_2(%rip), %xmm0
	movsd	.LCPI9_3(%rip), %xmm5           # xmm5 = mem[0],zero
	mulsd	%xmm5, %xmm1
	movsd	.LCPI9_4(%rip), %xmm6           # xmm6 = mem[0],zero
	addsd	%xmm6, %xmm1
	mulsd	%xmm5, %xmm2
	addsd	%xmm6, %xmm2
	mulsd	.LCPI9_5(%rip), %xmm4
	addsd	.LCPI9_6(%rip), %xmm4
	movsd	%xmm0, (%rbx,%r13)
	movsd	%xmm1, 8(%rbx,%r13)
	movsd	%xmm2, 16(%rbx,%r13)
	movsd	%xmm3, 24(%rbx,%r13)
	movsd	%xmm4, 32(%rbx,%r13)
.LBB9_5:                                #   in Loop: Header=BB9_2 Depth=1
	addq	$40, %r13
	cmpq	%r13, (%rsp)                    # 8-byte Folded Reload
	jne	.LBB9_2
# %bb.6:
	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
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
.LBB9_7:                                # %._crit_edge
	retq
.Lfunc_end9:
	.size	_Z13init_particleP10particle_ti, .Lfunc_end9-_Z13init_particleP10particle_ti
	.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	.LBB10_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB10_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid, %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	$_Z23compute_force_on_devicePA2_dP10particle_tidPd, %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_end10:
	.size	__hip_module_ctor, .Lfunc_end10-__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	.LBB11_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
.LBB11_2:
	retq
.Lfunc_end11:
	.size	__hip_module_dtor, .Lfunc_end11-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	N,@object                       # @N
	.bss
	.globl	N
	.p2align	2, 0x0
N:
	.long	0                               # 0x0
	.size	N, 4

	.type	num_threads,@object             # @num_threads
	.data
	.globl	num_threads
	.p2align	2, 0x0
num_threads:
	.long	1                               # 0x1
	.size	num_threads, 4

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"error: unable to allocate memory\n"
	.size	.L.str, 34

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Start computing n-body solver"
	.size	.L.str.1, 30

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"------------------"
	.size	.L.str.2, 19

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Failed to allocate device vector d_forces (error code %s)!\n"
	.size	.L.str.3, 60

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Failed to allocate device vector d_particles (error code %s)!\n"
	.size	.L.str.4, 63

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Failed to allocate device vector d_force_qk (error code %s)!\n"
	.size	.L.str.5, 62

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Failed to copy vector d_forces from host to device (error code %s)!\n"
	.size	.L.str.6, 69

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Failed to copy vector d_particles from host to device (error code %s)!\n"
	.size	.L.str.7, 72

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Failed to copy vector d_force_qk from host to device (error code %s)!\n"
	.size	.L.str.8, 71

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Computing starts with..."
	.size	.L.str.9, 25

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	" Block Size: "
	.size	.L.str.10, 14

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	" # of Blocks : "
	.size	.L.str.11, 16

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Initial particles"
	.size	.L.str.12, 18

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Iteration "
	.size	.L.str.13, 11

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Failed to copy vector particles from device to host (error code %s)!\n"
	.size	.L.str.14, 70

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"Failed to set the memory to value 0 (error code %s)!\n"
	.size	.L.str.15, 54

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

	.type	.L.str.16,@object               # @.str.16
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.16:
	.asciz	"Failed to launch compute_force_on_device kernel (error code %s)!\n"
	.size	.L.str.16, 66

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

	.type	.L.str.17,@object               # @.str.17
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.17:
	.asciz	"Failed to launch compute_pos_and_vel_on_device kernel (error code %s)!\n"
	.size	.L.str.17, 72

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"Final positions and velocities "
	.size	.L.str.18, 32

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	" Time in seconds: %f \n"
	.size	.L.str.19, 23

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	" Gflops Rate: %f GFlop/s\n"
	.size	.L.str.20, 26

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	" Bandwidth Rate : %f GB/s\n"
	.size	.L.str.21, 27

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"Failed to free device vector d_particles (error code %s)!\n"
	.size	.L.str.22, 59

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"Failed to free device vector d_forces (error code %s)!\n"
	.size	.L.str.23, 56

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	"position of particle "
	.size	.L.str.24, 22

	.type	.L.str.25,@object               # @.str.25
.L.str.25:
	.asciz	" is ("
	.size	.L.str.25, 6

	.type	.L.str.26,@object               # @.str.26
.L.str.26:
	.asciz	","
	.size	.L.str.26, 2

	.type	.L.str.27,@object               # @.str.27
.L.str.27:
	.asciz	")"
	.size	.L.str.27, 2

	.type	.L.str.28,@object               # @.str.28
.L.str.28:
	.asciz	"velocity of particle "
	.size	.L.str.28, 22

	.type	.L.str.30,@object               # @.str.30
.L.str.30:
	.asciz	"error: file could not be opened for reading"
	.size	.L.str.30, 44

	.type	.L.str.31,@object               # @.str.31
.L.str.31:
	.asciz	"Usage "
	.size	.L.str.31, 7

	.type	.L.str.32,@object               # @.str.32
.L.str.32:
	.asciz	"<N> <delta_t> <T> <debug> <num_threads> <part_file>"
	.size	.L.str.32, 52

	.type	.L.str.33,@object               # @.str.33
.L.str.33:
	.asciz	"\tN\t - number of particles (positive integer)"
	.size	.L.str.33, 45

	.type	.L.str.34,@object               # @.str.34
.L.str.34:
	.asciz	"\tdelta_t\t - time difference between two time (positive)"
	.size	.L.str.34, 56

	.type	.L.str.35,@object               # @.str.35
.L.str.35:
	.asciz	"\tT\t - final time number (positive)"
	.size	.L.str.35, 35

	.type	.L.str.36,@object               # @.str.36
.L.str.36:
	.asciz	"\tdebug\t - 1 to see the states of particles time to time, 0 to see only final step"
	.size	.L.str.36, 82

	.type	.L.str.37,@object               # @.str.37
.L.str.37:
	.asciz	"\tnum_threads\t - number of threads"
	.size	.L.str.37, 34

	.type	.L.str.38,@object               # @.str.38
.L.str.38:
	.asciz	"\tpart_file\t - name of the file containing information the inital states of particles"
	.size	.L.str.38, 85

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid"
	.size	.L__unnamed_1, 55

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z23compute_force_on_devicePA2_dP10particle_tidPd"
	.size	.L__unnamed_2, 50

	.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	"ERROR: Bad call to gettimeofday"
	.size	.Lstr, 32

	.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 _Z38__device_stub__compute_force_on_devicePA2_dP10particle_tidPd
	.addrsig_sym _Z44__device_stub__compute_pos_and_vel_on_devicePA2_dP10particle_tiid
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _ZSt4cout
	.addrsig_sym _Z23compute_force_on_devicePA2_dP10particle_tidPd
	.addrsig_sym _Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid ; -- Begin function _Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid
	.globl	_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid
	.p2align	8
	.type	_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid,@function
_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid: ; @_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b64 s[4:5], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	v_cmp_lt_i32_e32 vcc_lo, -1, v1
	v_cmp_gt_i32_e64 s2, s5, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_cvt_f64_i32_e32 v[15:16], s4
	v_mov_b32_e32 v2, 0
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[11:12], null, v1, 40, s[2:3]
	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, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_waitcnt vmcnt(2)
	v_div_scale_f64 v[17:18], null, v[3:4], v[3:4], v[15:16]
	s_waitcnt vmcnt(1)
	v_fma_f64 v[5:6], v[9:10], v[15:16], v[5:6]
	s_waitcnt vmcnt(0)
	v_fma_f64 v[7:8], v[13:14], v[15:16], v[7:8]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[19:20], v[17:18]
	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[17:18], v[19:20], 1.0
	v_fma_f64 v[7:8], v[19:20], v[7:8], v[19:20]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[19:20], -v[17:18], v[7:8], 1.0
	v_fma_f64 v[7:8], v[7:8], v[19:20], v[7:8]
	v_div_scale_f64 v[19:20], vcc_lo, v[15:16], v[3:4], v[15:16]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[21:22], v[19:20], v[7:8]
	v_fma_f64 v[17:18], -v[17:18], v[21:22], v[19:20]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[7:8], v[17:18], v[7:8], v[21:22]
	v_div_fixup_f64 v[2:3], v[7:8], v[3:4], v[15:16]
	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
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid
		.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 23
		.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	_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid, .Lfunc_end0-_Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 360
; NumSgprs: 18
; NumVgprs: 23
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 23
; 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	_Z23compute_force_on_devicePA2_dP10particle_tidPd ; -- Begin function _Z23compute_force_on_devicePA2_dP10particle_tidPd
	.globl	_Z23compute_force_on_devicePA2_dP10particle_tidPd
	.p2align	8
	.type	_Z23compute_force_on_devicePA2_dP10particle_tidPd,@function
_Z23compute_force_on_devicePA2_dP10particle_tidPd: ; @_Z23compute_force_on_devicePA2_dP10particle_tidPd
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x34
	s_load_b32 s4, s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_cmp_gt_i32 s4, 0
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_cselect_b32 s3, -1, 0
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_lt_i32_e32 vcc_lo, -1, v1
	v_cmp_gt_i32_e64 s2, s4, v1
	s_and_b32 s3, vcc_lo, s3
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, s3, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB1_5
; %bb.1:                                ; %.lr.ph
	s_clause 0x1
	s_load_b128 s[8:11], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x18
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[5:6], 4, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[3:4], null, v1, 40, s[10:11]
	v_add_co_u32 v5, vcc_lo, s8, v5
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v6, vcc_lo, s9, v6, vcc_lo
	s_add_u32 s2, s10, 8
	s_addc_u32 s3, s11, 0
.LBB1_2:                                ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s5, exec_lo
	v_cmpx_ne_u32_e32 0, v1
	s_cbranch_execz .LBB1_4
; %bb.3:                                ;   in Loop: Header=BB1_2 Depth=1
	global_load_b64 v[15:16], v2, s[2:3] offset:8
	s_clause 0x1
	global_load_b64 v[17:18], v[3:4], off offset:16
	global_load_b128 v[7:10], v[3:4], off
	global_load_b128 v[11:14], v2, s[2:3] offset:-8
	s_waitcnt vmcnt(2)
	v_add_f64 v[15:16], v[17:18], -v[15:16]
	s_waitcnt vmcnt(1)
	v_mul_f64 v[7:8], v[7:8], s[0:1]
	s_waitcnt vmcnt(0)
	v_add_f64 v[13:14], v[9:10], -v[13:14]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_f64 v[9:10], v[15:16], v[15:16]
	v_mul_f64 v[11:12], v[7:8], v[11:12]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[9:10], v[13:14], v[13:14], v[9:10]
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[9:10]
	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[9:10], v[9:10], 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[17:18], v[9:10]
	v_cmp_class_f64_e64 vcc_lo, v[9:10], 0x260
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[19:20], v[9:10], v[17:18]
	v_mul_f64 v[17:18], v[17:18], 0.5
	v_fma_f64 v[21:22], -v[17:18], v[19:20], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[19:20], v[19:20], v[21:22], v[19:20]
	v_fma_f64 v[17:18], v[17:18], v[21:22], v[17:18]
	v_fma_f64 v[21:22], -v[19:20], v[19:20], v[9:10]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[19:20], v[21:22], v[17:18], v[19:20]
	v_fma_f64 v[21:22], -v[19:20], v[19:20], v[9:10]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[17:18], v[21:22], v[17:18], v[19:20]
	v_ldexp_f64 v[17:18], v[17:18], v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_cndmask_b32 v9, v17, v9 :: v_dual_cndmask_b32 v10, v18, v10
	v_mul_f64 v[17:18], v[9:10], v[9:10]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_mul_f64 v[17:18], v[9:10], v[17:18]
	global_load_b128 v[7:10], v[5:6], off
	v_div_scale_f64 v[19:20], null, v[17:18], v[17:18], v[11:12]
	v_div_scale_f64 v[25:26], vcc_lo, v[11:12], v[17:18], v[11:12]
	v_rcp_f64_e32 v[21:22], v[19:20]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[23:24], -v[19:20], v[21:22], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[21:22], v[21:22], v[23:24], v[21:22]
	v_fma_f64 v[23:24], -v[19:20], v[21:22], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[21:22], v[21:22], v[23:24], v[21:22]
	v_mul_f64 v[23:24], v[25:26], v[21:22]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[19:20], -v[19:20], v[23:24], v[25:26]
	v_div_fmas_f64 v[19:20], v[19:20], v[21:22], v[23:24]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_div_fixup_f64 v[11:12], v[19:20], v[17:18], v[11:12]
	s_waitcnt vmcnt(0)
	v_fma_f64 v[7:8], -v[13:14], v[11:12], v[7:8]
	global_store_b64 v[5:6], v[7:8], off
	global_load_b64 v[7:8], v[3:4], off
	global_load_b64 v[11:12], v2, s[2:3] offset:-8
	s_waitcnt vmcnt(1)
	v_mul_f64 v[7:8], v[7:8], s[0:1]
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[7:8], v[7:8], v[11:12]
	v_div_scale_f64 v[11:12], null, v[17:18], v[17:18], v[7:8]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[13:14], v[11:12]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[19:20], -v[11:12], v[13:14], 1.0
	v_fma_f64 v[13:14], v[13:14], v[19:20], v[13:14]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[19:20], -v[11:12], v[13:14], 1.0
	v_fma_f64 v[13:14], v[13:14], v[19:20], v[13:14]
	v_div_scale_f64 v[19:20], vcc_lo, v[7:8], v[17:18], v[7:8]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[21:22], v[19:20], v[13:14]
	v_fma_f64 v[11:12], -v[11:12], v[21:22], v[19:20]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[11:12], v[11:12], v[13:14], v[21:22]
	v_div_fixup_f64 v[7:8], v[11:12], v[17:18], v[7:8]
	s_delay_alu instid0(VALU_DEP_1)
	v_fma_f64 v[7:8], -v[15:16], v[7:8], v[9:10]
	global_store_b64 v[5:6], v[7:8], off offset:8
.LBB1_4:                                ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s5
	s_add_i32 s4, s4, -1
	v_add_nc_u32_e32 v1, -1, v1
	s_add_u32 s2, s2, 40
	s_addc_u32 s3, s3, 0
	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 _Z23compute_force_on_devicePA2_dP10particle_tidPd
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.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 27
		.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	_Z23compute_force_on_devicePA2_dP10particle_tidPd, .Lfunc_end1-_Z23compute_force_on_devicePA2_dP10particle_tidPd
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 808
; NumSgprs: 18
; NumVgprs: 27
; ScratchSize: 0
; MemoryBound: 1
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 3
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 27
; 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
      - .offset:         20
        .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:           _Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z29compute_pos_and_vel_on_devicePA2_dP10particle_tiid.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     23
    .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
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z23compute_force_on_devicePA2_dP10particle_tidPd
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z23compute_force_on_devicePA2_dP10particle_tidPd.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     27
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
