/*Demo 1D sheath PIC simulation with CUDA
GPU1: particle mover moved to the GPU
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"

/*CUDA error wraper*/
static void CUDA_ERROR( cudaError_t err) 
{
    if (err != cudaSuccess) {
        printf("CUDA ERROR: %s, exiting\n", cudaGetErrorString(err));
        exit(-1);
    }
}

/*constants*/
#define EPS_0 8.85418782e-12  	// F/m, vacuum permittivity
#define K	1.38065e-23			// J/K, Boltzmann constant
#define ME 9.10938215e-31		// kg, electron mass
#define QE 1.602176565e-19		// C, elementary charge
#define AMU  1.660538921e-27	// kg, atomic mass unit
#define EV_TO_K	11604.52		// 1eV in Kelvin, QE/K

/*simulation parameters, these could come from an input file*/
#define PLASMA_DEN	1e16		// plasma density to load
#define NUM_IONS 500000		    // number of ions
#define NUM_ELECTRONS 500000	// number of electrons
#define DX 1e-4					// cell spacing
#define NC 100					// number of cells
#define NUM_TS	10000			// number of time steps
#define DT 1e-11				// time step size
#define ELECTRON_TEMP 3.0		// electron temperature in eV
#define ION_TEMP 1.0			// ion temperature in eV

/*domain parameters, set here so can access from GPU*/
#define X0  0			/*mesh origin*/
#define XL  NC*DX			/*domain length*/
#define XMAX  (X0 + XL)		/*domain max position*/
	
const int THREADS_PER_BLOCK = 256;
/* Data structure to hold domain information*/
struct Domain
{
	const int ni = NC+1;			/*number of nodes*/
	const double x0 = X0;
	const double dx = DX;
	const double xl = XL;
	const double xmax = XMAX;

	/*data structures*/
	double *phi;		/*potential*/
	double *ef;			/*electric field on the cpu*/
	double *rho;		/*charge density*/

	float *ndi;		/*ion density on the CPU*/
	float *nde;		/*electron density on the CPU*/
};

/* Data structure for particle storage **/
struct Particle
{
	double x;			/*position*/
	double v;			/*velocity*/
	bool alive;			/*flag to avoid removing particles*/
};

/* Data structure to hold species information*/
struct Species
{
	double mass;			/*particle mass in kg*/
	double charge;			/*particle charge in Coulomb*/
	double spwt;			/*species specific weight*/
	
	int np;					/*number of particles*/
	int np_alloc;			/*size of the allocated data array*/
	Particle *part;			/*array holding particles on the CPU*/
	Particle *part_gpu;		/*array holding particles on the GPU*/
};

/** FUNCTION PROTOTYPES **/
double rnd();
double SampleVel(double v_th);
void ScatterSpecies(Species *species, float *den, float *den_gpu);
void ComputeRho(Species *ions, Species *electrons);
bool SolvePotential(double *phi, double *rho);
bool SolvePotentialDirect(double *phi, double *rho);
void ComputeEF(double *phi, double *ef, double *ef_gpu);
void PushSpecies(Species *species, double *ef);
void RewindSpecies(Species *species, double *ef);
void AddParticle(Species *species, double x, double v);	
__host__ __device__ double XtoL(double pos);
void scatter(double lc, double value, double *field);
__host__ __device__ double gather(double lc, double *field);
void WriteResults(int ts);

/*gpu versions of above functions to avoid needing compute_35*/
__device__ void dev_scatter(double lc, float value, float *field);

/* GLOBAL VARIABLES */
Domain domain;
FILE *file_res;

/* --------- main -------------*/
int main()
{
	
	/*get info on our GPU, defaulting to first one*/
	cudaDeviceProp prop;
	CUDA_ERROR(cudaGetDeviceProperties(&prop,0));
	printf("Found GPU '%s' with %g Gb of global memory, max %d threads per block, and %d multiprocessors\n", 
		prop.name, prop.totalGlobalMem/(1024.0*1024.0),
		prop.maxThreadsPerBlock,prop.multiProcessorCount);

	/*init CUDA*/
	CUDA_ERROR(cudaSetDevice(0));
	
	int p;
	int ts;						// time step

	/*allocate data structures, remember these need to be cleared first in C++*/
	domain.phi = new double[domain.ni];		//potential
	domain.rho  = new double[domain.ni];		//charge density
	domain.ef  = new double[domain.ni];		//electric field
	domain.nde  = new float[domain.ni];		//number density of electrons
	domain.ndi	= new float[domain.ni];		//number density of ions

	/*save pointers so we can write phi instead of domain.phi*/
	double *phi = domain.phi;
	double *rho = domain.rho;
	double *ef = domain.ef;
	float *nde = domain.nde;
	float *ndi = domain.ndi;
	
	/*also allocate GPU space for the ion and electron density*/
	float *nde_gpu, *ndi_gpu;
	CUDA_ERROR(cudaMalloc((void**)&nde_gpu,domain.ni*sizeof(float)));
	CUDA_ERROR(cudaMalloc((void**)&ndi_gpu,domain.ni*sizeof(float)));
	
	/*also allocate GPU space for the electric field*/
	double *ef_gpu;
	CUDA_ERROR(cudaMalloc((void**)&ef_gpu,domain.ni*sizeof(double)));
	
	/*clear data*/
	memset(phi,0,sizeof(double)*domain.ni);
	
	/*variables to hold species data ions*/
	Species ions;
	Species electrons;
	
	/*set material data*/
	ions.mass = 16*AMU;		
	ions.charge = QE;
	ions.spwt = PLASMA_DEN*domain.xl/NUM_IONS;
	ions.np = 0;
	ions.np_alloc = NUM_IONS;
	ions.part = new Particle[NUM_IONS];
	CUDA_ERROR(cudaMalloc((void**)&ions.part_gpu,NUM_IONS*sizeof(Particle)));
	
	electrons.mass = ME;	// electrons
	electrons.charge = -QE;
	electrons.spwt = PLASMA_DEN*domain.xl/NUM_ELECTRONS;
	electrons.np = 0;
	electrons.np_alloc = NUM_ELECTRONS;
	electrons.part = new Particle[NUM_ELECTRONS];
	CUDA_ERROR(cudaMalloc((void**)&electrons.part_gpu,NUM_ELECTRONS*sizeof(Particle)));
	
	/*randomize RNG*/
	srand(time(NULL));
		
	/*load uniformly spaced ions and electrons*/
	double delta_ions = domain.xl/NUM_IONS;
	double v_thi = sqrt(2*K*ION_TEMP*EV_TO_K/ions.mass);	
	for (p=0;p<NUM_IONS;p++)
	{
		double x = domain.x0 + p*delta_ions;
		double v = SampleVel(v_thi);
		AddParticle(&ions,x,v);
	}
		
	/*now do the same for electrons*/
	double delta_electrons = domain.xl/NUM_ELECTRONS;
	double v_the = sqrt(2*K*ELECTRON_TEMP*EV_TO_K/electrons.mass);	
	for (p=0;p<NUM_ELECTRONS;p++)
	{
		double x = domain.x0 + p*delta_electrons;
		double v = SampleVel(v_the);
		AddParticle(&electrons,x,v);
	}
	
	/*copy particles to the GPU*/
	CUDA_ERROR(cudaMemcpy(ions.part_gpu,ions.part,NUM_IONS*sizeof(Particle),cudaMemcpyHostToDevice));
	CUDA_ERROR(cudaMemcpy(electrons.part_gpu,electrons.part,NUM_IONS*sizeof(Particle),cudaMemcpyHostToDevice));

	/*compute number density*/
	ScatterSpecies(&ions,ndi,ndi_gpu);
	ScatterSpecies(&electrons,nde,nde_gpu);
		
	/*compute charge density and solve potential*/
	ComputeRho(&ions, &electrons);
	SolvePotential(phi,rho);
	ComputeEF(phi,ef,ef_gpu);
	
	RewindSpecies(&ions,ef_gpu);
	RewindSpecies(&electrons,ef_gpu);
	
	/*OUTPUT*/
	file_res = fopen("results.dat","w");
	fprintf(file_res,"VARIABLES = x nde ndi rho phi ef\n");
	WriteResults(0);
		
	clock_t start = clock();	// grab starting clock time

	/* MAIN LOOP*/
	for (ts = 1; ts<=NUM_TS; ts++)
	{
		/*compute number density*/
		ScatterSpecies(&ions,ndi,ndi_gpu);
		ScatterSpecies(&electrons,nde,nde_gpu);
		
		ComputeRho(&ions, &electrons);
		SolvePotential(phi,rho);
		ComputeEF(phi,ef,ef_gpu);
		
		/*move particles*/
		PushSpecies(&electrons,ef_gpu);
		PushSpecies(&ions,ef_gpu);
		
		/*write diagnostics*/
		if (ts%25==0)
		{
			/*max phi*/
			double max_phi = abs(phi[0]);
			for (int i=0;i<domain.ni;i++)
				if (abs(phi[i])>max_phi) max_phi=abs(phi[i]);
			
			printf("TS:%i\tnp_i:%d\tnp_e:%d\tdphi:%.3g\n", 
				ts,ions.np,electrons.np,max_phi-phi[0]);			
		}
		
		/*save data*/
		if (ts%1000==0) WriteResults(ts);
	}
	
	clock_t end=clock();
	
	fclose(file_res);
	
	/*free up memory*/
	delete phi;
	delete rho;
	delete ef;
	delete nde;
	delete ndi;
	cudaFree(nde_gpu);
	cudaFree(ndi_gpu);
	cudaFree(ef_gpu);
	
	/*free particles*/
	delete ions.part;
	delete electrons.part;
	cudaFree(ions.part_gpu);
	cudaFree(electrons.part_gpu);
	
	printf("Time per time step: %.3g ms\n",1000*(end-start)/(double)(CLOCKS_PER_SEC*NUM_TS));

	/* call cudaDeviceReset for correct profiling data*/
	CUDA_ERROR(cudaDeviceReset());

	return 0;
}

/***** HELPER FUNCTIONS *********************************************************/
/* random number generator
   for now using built-in but this is not adequate for real simulations*/
double rnd()
{
	return rand()/(double)RAND_MAX;
}
   
/* samples random velocity from Maxwellian distribution using Birdsall's method*/
double SampleVel(double v_th)
{
    const int M = 12;    
    double sum = 0;
	for (int i=0;i<M;i++) sum+=rnd();

    return sqrt(0.5)*v_th*(sum-M/2.0)/sqrt(M/12.0);
}


/*GPU code to move particles*/
__global__ void scatterParticle(Particle *particles, float *den, long N)
{
	/*get particle id*/
	long p = blockIdx.x*blockDim.x+threadIdx.x;
	if (p<N && particles[p].alive)
	{
		double lc = XtoL(particles[p].x);
		dev_scatter(lc, 1.0, den);
	}
}

/*scatter particles of species to the mesh*/
void ScatterSpecies(Species *species, float *den, float *den_gpu)
{
	/*initialize densities to zero*/
	CUDA_ERROR(cudaMemset(den_gpu,0,sizeof(float)*domain.ni));
	
	/*scatter particles to the mesh*/
	int nblocks = 1+species->np_alloc/THREADS_PER_BLOCK;
	scatterParticle<<<nblocks,THREADS_PER_BLOCK>>>(species->part_gpu,den_gpu,species->np_alloc);
	
	/*copy density back to CPU*/
	CUDA_ERROR(cudaMemcpy(den,den_gpu,sizeof(float)*domain.ni,cudaMemcpyDeviceToHost));

	/*divide by cell volume*/
	for (int i=0;i<domain.ni;i++)
		den[i]*=species->spwt/domain.dx;
		
	/*only half cell at boundaries*/
	den[0] *=2.0;
	den[domain.ni-1] *= 2.0;
}

/*adds new particle to the species, returns pointer to the newly added data*/
void AddParticle(Species *species, double x, double v)
{
	/*abort the simulation if we ran out of space to store this particle*/
	if (species->np > species->np_alloc-1)
	{
		printf("Too many particles!\n"); exit(-1);
	}
	
	/*store position and velocity of this particle*/
	species->part[species->np].x = x;
	species->part[species->np].v = v;
	species->part[species->np].alive = true;
		
	/*increment particle counter*/
	species->np++;
}

/*computes charge density by adding ion and electron data*/
void ComputeRho(Species *ions, Species *electrons)
{
	double *rho = domain.rho;
	
	for (int i=0;i<domain.ni;i++)
		rho[i] = ions->charge*domain.ndi[i] + electrons->charge*domain.nde[i];
}

/*Thomas algorithm for a tri-diagonal matrix*/
bool SolvePotentialDirect(double *x, double *rho)
{
	/*set coefficients, this should be pre-computed*/
	int ni = domain.ni;
	double dx2 = domain.dx*domain.dx;
	int i;
	double *a = new double[ni];
	double *b = new double[ni];
	double *c = new double[ni];
	
	/*central difference on internal nodes*/
	for (i=1;i<ni-1;i++)
	{
		a[i] = 1; b[i] = -2; c[i] = 1;
	}
	
	/*dirichlet b.c. on boundaries*/
	a[0]=0;b[0]=1;c[0]=0;
	a[ni-1]=0;b[ni-1]=1;c[ni-1]=0;
	
	/*multiply RHS*/
	for  (i=1;i<domain.ni-1;i++)
		x[i]=-rho[i]*dx2/EPS_0;
		
	x[0] = 0;
	x[ni-1] = 0;
	
	/* Modify the coefficients. */
	c[0] /= b[0];				/* Division by zero risk. */
	x[0] /= b[0];				/* Division by zero would imply a singular matrix. */
	for(i = 1; i < ni; i++)
	{
		double id = (b[i] - c[i-1] * a[i]);	/* Division by zero risk. */
		c[i] /= id;							/* Last value calculated is redundant. */
		x[i] = (x[i] - x[i-1] * a[i])/id;
	}

	/* Now back substitute. */
	for(i = ni - 2; i >= 0; i--)
		x[i] = x[i] - c[i] * x[i + 1];

	return true;		
}

/* solves potential using the Gauss Seidel Method, returns true if converged*/
bool SolvePotential(double *phi, double *rho)
{
	double L2;
	double dx2 = domain.dx*domain.dx;	/*precompute*/
	
	/*initialize boundaries*/
	phi[0]=phi[domain.ni-1]=0;
	
	/*solve potential, identical to lesson 2*/
	for (int solver_it=0;solver_it<40000;solver_it++)
	{
		/*Gauss Seidel method, phi[i-1]-2*phi[i]+phi[i+1] = -dx^2*rho[i]/eps_0*/
		for (int i=1;i<domain.ni-1;i++)
		{
			/*SOR*/
			double g = 0.5*(phi[i-1] + phi[i+1] + dx2*rho[i]/EPS_0);
			phi[i] = phi[i] + 1.4*(g-phi[i]);
		}
				
		/*check for convergence*/
		if (solver_it%25==0)
		{
			double sum = 0;
			for (int i=1;i<domain.ni-1;i++)
			{
				double R = -rho[i]/EPS_0 - (phi[i-1] - 2*phi[i] + phi[i+1])/dx2;
				sum+=R*R;
			}
			L2 = sqrt(sum)/domain.ni;
			if (L2<1e-4) {return true;}
		}
	}
	printf("Gauss-Seidel solver failed to converge, L2=%.3g!\n",L2);
	return false;	
}

/* computes electric field by differentiating potential*/
void ComputeEF(double *phi, double *ef, double *ef_gpu)
{
	for (int i=1;i<domain.ni-1;i++)
		ef[i] = -(phi[i+1]-phi[i-1])/(2*domain.dx);	//central difference
	
	/*one sided difference at boundaries*/
	ef[0] = -(phi[1]-phi[0])/domain.dx;
	ef[domain.ni-1] = -(phi[domain.ni-1]-phi[domain.ni-2])/domain.dx;

	/*copy to the gpu*/
	CUDA_ERROR(cudaMemcpy(ef_gpu,ef,domain.ni*sizeof(double),cudaMemcpyHostToDevice));
}

/*GPU code to move particles*/
__global__ void pushParticle(Particle *particles, double *ef, double qm, long N)
{
	/*get particle id*/
	long p = blockIdx.x*blockDim.x+threadIdx.x;
	
	if (p<N && particles[p].alive)
	{			
		/*grab pointer to this particle*/
		Particle *part = &particles[p];
	
		/*compute particle node position*/
		double lc = XtoL(part->x);
		
		/*gather electric field onto particle position*/
		double part_ef = gather(lc,ef);
		
		/*advance velocity*/
		part->v += DT*qm*part_ef;	
		
		/*advance position*/
		part->x += DT*part->v;
			
		/*remove particles leaving the domain*/
		if (part->x < X0 || part->x >= XMAX)
			part->alive = false;					
	}
}

/* moves particles of a single species, returns wall charge*/
void PushSpecies(Species *species, double *ef)
{
	/*precompute q/m*/
	double qm = species->charge / species->mass;
	
	/*loop over particles*/
	int nblocks = 1+species->np_alloc/THREADS_PER_BLOCK;
	pushParticle<<<nblocks,THREADS_PER_BLOCK>>>(species->part_gpu,ef,qm,species->np_alloc);
}



/*GPU code to rewind particles*/
__global__ void rewindParticle(Particle *particles, double *ef, double qm, long N)
{
	/*get particle id*/
	long p = blockIdx.x*blockDim.x+threadIdx.x;
	
	if (p<N && particles[p].alive)
	{			
		/*grab pointer to this particle*/
		Particle *part = &particles[p];
	
		/*compute particle node position*/
		double lc = XtoL(part->x);
		
		/*gather electric field onto particle position*/
		double part_ef = gather(lc,ef);
		
		/*advance velocity*/
		part->v -= 0.5*DT*qm*part_ef;	
	}
}


/* rewinds particle velocities by -0.5DT*/
void RewindSpecies(Species *species, double *ef)
{
	/*precompute q/m*/
	double qm = species->charge / species->mass;
	
	/*loop over particles*/
	int nblocks = 1+species->np_alloc/THREADS_PER_BLOCK;
	rewindParticle<<<nblocks,THREADS_PER_BLOCK>>>(species->part_gpu,ef,qm,species->np_alloc);
}


/* converts physical coordinate to logical*/
__host__ __device__ double XtoL(double pos)
{
	double li = (pos-0)/DX;
	return li;
}


/* scatters scalar value onto a field at logical coordinate lc*/
void scatter(double lc, double value, double *field)
{
	int i = (int)lc;
	double di = lc-i;
			
	field[i] += value*(1-di);
	field[i+1] += value*(di);
}

/* atomic scatter of scalar value onto a field at logical coordinate lc*/
__device__ void dev_scatter(double lc, float value, float *field)
{
	int i = (int)lc;
	float di = lc-i;
			
	atomicAdd(&(field[i]),value*(1-di));
	atomicAdd(&(field[i+1]),value*(di));
}

/* gathers field value at logical coordinate lc*/
__host__ __device__ double gather(double lc, double *field)
{
	int i = (int)lc;
	double di = lc-i;
				
	/*gather field value onto particle position*/
	double val = field[i]*(1-di) + field[i+1]*(di);
	return val;
}


/* writes new zone to the results file*/
void WriteResults(int ts)
{
	fprintf(file_res,"ZONE I=%d T=ZONE_%06d\n",domain.ni,ts);
	for (int i=0;i<domain.ni;i++)
	{
		fprintf(file_res,"%g %g %g %g %g %g\n",i*domain.dx,
									domain.nde[i],domain.ndi[i],
									domain.rho[i],domain.phi[i],domain.ef[i]);
	}
			
	fflush(file_res);
}

	.file	"tmpxft_00309ba3_00000000-6_sheath-gpu.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2049:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2049:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"CUDA ERROR: %s, exiting\n"
	.text
	.type	_ZL10CUDA_ERROR9cudaError, @function
_ZL10CUDA_ERROR9cudaError:
.LFB2027:
	.cfi_startproc
	testl	%edi, %edi
	je	.L2
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	cudaGetErrorString@PLT
	movl	$2, %edi
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	orl	$-1, %edi
	call	exit@PLT
.L2:
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_ZL10CUDA_ERROR9cudaError, .-_ZL10CUDA_ERROR9cudaError
	.globl	_Z3rndv
	.type	_Z3rndv, @function
_Z3rndv:
.LFB2032:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	rand@PLT
	cvtsi2sdl	%eax, %xmm0
	divsd	.LC1(%rip), %xmm0
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z3rndv, .-_Z3rndv
	.globl	_Z9SampleVeld
	.type	_Z9SampleVeld, @function
_Z9SampleVeld:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movaps	%xmm0, %xmm1
	movl	$12, %ebx
	xorps	%xmm2, %xmm2
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
.L11:
	movsd	%xmm1, 8(%rsp)
	movsd	%xmm2, (%rsp)
	call	_Z3rndv
	movsd	(%rsp), %xmm2
	decl	%ebx
	movsd	8(%rsp), %xmm1
	addsd	%xmm0, %xmm2
	jne	.L11
	mulsd	.LC3(%rip), %xmm1
	subsd	.LC4(%rip), %xmm2
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	movaps	%xmm1, %xmm0
	mulsd	%xmm2, %xmm0
	ret
	.cfi_endproc
.LFE2033:
	.size	_Z9SampleVeld, .-_Z9SampleVeld
	.section	.rodata.str1.1
.LC5:
	.string	"Too many particles!\n"
	.text
	.globl	_Z11AddParticleP7Speciesdd
	.type	_Z11AddParticleP7Speciesdd, @function
_Z11AddParticleP7Speciesdd:
.LFB2035:
	.cfi_startproc
	endbr64
	movl	24(%rdi), %edx
	cmpl	%edx, 28(%rdi)
	jg	.L15
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$2, %edi
	leaq	.LC5(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	orl	$-1, %edi
	call	exit@PLT
.L15:
	.cfi_def_cfa_offset 8
	movslq	%edx, %rax
	incl	%edx
	imulq	$24, %rax, %rax
	addq	32(%rdi), %rax
	movb	$1, 16(%rax)
	movsd	%xmm0, (%rax)
	movsd	%xmm1, 8(%rax)
	movl	%edx, 24(%rdi)
	ret
	.cfi_endproc
.LFE2035:
	.size	_Z11AddParticleP7Speciesdd, .-_Z11AddParticleP7Speciesdd
	.globl	_Z10ComputeRhoP7SpeciesS0_
	.type	_Z10ComputeRhoP7SpeciesS0_, @function
_Z10ComputeRhoP7SpeciesS0_:
.LFB2036:
	.cfi_startproc
	endbr64
	movq	56+domain(%rip), %r9
	movl	domain(%rip), %edx
	xorl	%eax, %eax
	movq	64+domain(%rip), %rcx
	movq	72+domain(%rip), %r8
.L20:
	cmpl	%eax, %edx
	jle	.L22
	cvtss2sd	(%rcx,%rax,4), %xmm0
	cvtss2sd	(%r8,%rax,4), %xmm1
	mulsd	8(%rdi), %xmm0
	mulsd	8(%rsi), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, (%r9,%rax,8)
	incq	%rax
	jmp	.L20
.L22:
	ret
	.cfi_endproc
.LFE2036:
	.size	_Z10ComputeRhoP7SpeciesS0_, .-_Z10ComputeRhoP7SpeciesS0_
	.globl	_Z20SolvePotentialDirectPdS_
	.type	_Z20SolvePotentialDirectPdS_, @function
_Z20SolvePotentialDirectPdS_:
.LFB2037:
	.cfi_startproc
	endbr64
	movabsq	$1152921504606846975, %rax
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movsd	16+domain(%rip), %xmm0
	movslq	domain(%rip), %r12
	mulsd	%xmm0, %xmm0
	movsd	%xmm0, 8(%rsp)
	cmpq	%r12, %rax
	jb	.L24
	movq	%r12, %rbx
	salq	$3, %r12
	movq	%rdi, %rbp
	movq	%rsi, %r15
	movq	%r12, %rdi
	call	_Znam@PLT
	movq	%r12, %rdi
	movq	%rax, %r13
	call	_Znam@PLT
	movq	%r12, %rdi
	movq	%rax, %r14
	call	_Znam@PLT
	movsd	.LC6(%rip), %xmm0
	movsd	.LC7(%rip), %xmm1
	leal	-1(%rbx), %ecx
	movq	%rax, %rdx
	xorl	%eax, %eax
	jmp	.L25
.L24:
	call	__cxa_throw_bad_array_new_length@PLT
.L25:
	incq	%rax
	cmpl	%eax, %ecx
	jle	.L34
	movsd	%xmm0, 0(%r13,%rax,8)
	movsd	%xmm1, (%r14,%rax,8)
	movsd	%xmm0, (%rdx,%rax,8)
	jmp	.L25
.L34:
	movl	domain(%rip), %eax
	movq	$0x000000000, 0(%r13)
	movq	$0x000000000, (%rdx)
	movq	.LC8(%rip), %xmm1
	movsd	.LC9(%rip), %xmm2
	movsd	%xmm0, (%r14)
	leal	-1(%rax), %ecx
	xorl	%eax, %eax
	movq	$0x000000000, -8(%r13,%r12)
	movq	$0x000000000, -8(%rdx,%r12)
	movsd	%xmm0, -8(%r14,%r12)
.L27:
	incq	%rax
	cmpl	%eax, %ecx
	jle	.L35
	movsd	(%r15,%rax,8), %xmm0
	xorps	%xmm1, %xmm0
	mulsd	8(%rsp), %xmm0
	divsd	%xmm2, %xmm0
	movsd	%xmm0, 0(%rbp,%rax,8)
	jmp	.L27
.L35:
	movq	$0x000000000, 0(%rbp)
	xorl	%eax, %eax
	movq	$0x000000000, -8(%rbp,%r12)
.L29:
	incq	%rax
	cmpl	%eax, %ebx
	jle	.L36
	movsd	0(%r13,%rax,8), %xmm0
	movsd	-8(%rdx,%rax,8), %xmm2
	movsd	(%r14,%rax,8), %xmm1
	mulsd	%xmm0, %xmm2
	subsd	%xmm2, %xmm1
	movsd	(%rdx,%rax,8), %xmm2
	divsd	%xmm1, %xmm2
	movsd	%xmm2, (%rdx,%rax,8)
	movsd	-8(%rbp,%rax,8), %xmm2
	mulsd	%xmm0, %xmm2
	movsd	0(%rbp,%rax,8), %xmm0
	subsd	%xmm2, %xmm0
	divsd	%xmm1, %xmm0
	movsd	%xmm0, 0(%rbp,%rax,8)
	jmp	.L29
.L36:
	leal	-2(%rbx), %eax
	cltq
.L31:
	testl	%eax, %eax
	js	.L37
	movsd	(%rdx,%rax,8), %xmm1
	mulsd	8(%rbp,%rax,8), %xmm1
	movsd	0(%rbp,%rax,8), %xmm0
	subsd	%xmm1, %xmm0
	movsd	%xmm0, 0(%rbp,%rax,8)
	decq	%rax
	jmp	.L31
.L37:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	movb	$1, %al
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2037:
	.size	_Z20SolvePotentialDirectPdS_, .-_Z20SolvePotentialDirectPdS_
	.section	.rodata.str1.1
.LC13:
	.string	"Gauss-Seidel solver failed to converge, L2=%.3g!\n"
	.text
	.globl	_Z14SolvePotentialPdS_
	.type	_Z14SolvePotentialPdS_, @function
_Z14SolvePotentialPdS_:
.LFB2038:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movsd	16+domain(%rip), %xmm2
	movslq	domain(%rip), %rax
	movq	$0x000000000, -8(%rdi,%rax,8)
	mulsd	%xmm2, %xmm2
	movq	%rax, %r13
	movq	$0x000000000, (%rdi)
.L39:
	movsd	.LC9(%rip), %xmm7
	movsd	.LC10(%rip), %xmm6
	xorl	%eax, %eax
	leal	-1(%r13), %ecx
	movsd	.LC11(%rip), %xmm5
.L46:
	incq	%rax
	cmpl	%eax, %ecx
	jle	.L50
	movsd	(%r12,%rax,8), %xmm0
	movsd	-8(%rbx,%rax,8), %xmm1
	addsd	8(%rbx,%rax,8), %xmm1
	movsd	(%rbx,%rax,8), %xmm4
	mulsd	%xmm2, %xmm0
	divsd	%xmm7, %xmm0
	addsd	%xmm1, %xmm0
	mulsd	%xmm6, %xmm0
	subsd	%xmm4, %xmm0
	mulsd	%xmm5, %xmm0
	addsd	%xmm4, %xmm0
	movsd	%xmm0, (%rbx,%rax,8)
	jmp	.L46
.L50:
	movl	%ebp, %eax
	movl	$25, %esi
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L42
	movsd	.LC9(%rip), %xmm5
	xorl	%eax, %eax
	xorps	%xmm4, %xmm4
.L41:
	incq	%rax
	cmpl	%eax, %ecx
	jle	.L51
	movsd	(%rbx,%rax,8), %xmm1
	movsd	(%r12,%rax,8), %xmm0
	xorps	.LC8(%rip), %xmm0
	movaps	%xmm1, %xmm3
	addsd	%xmm1, %xmm3
	movsd	-8(%rbx,%rax,8), %xmm1
	divsd	%xmm5, %xmm0
	subsd	%xmm3, %xmm1
	addsd	8(%rbx,%rax,8), %xmm1
	divsd	%xmm2, %xmm1
	subsd	%xmm1, %xmm0
	mulsd	%xmm0, %xmm0
	addsd	%xmm0, %xmm4
	jmp	.L41
.L51:
	movaps	%xmm4, %xmm0
	movsd	%xmm2, 8(%rsp)
	call	sqrt@PLT
	movsd	8(%rsp), %xmm2
	movaps	%xmm0, %xmm3
	cvtsi2sdl	%r13d, %xmm0
	divsd	%xmm0, %xmm3
	movsd	.LC12(%rip), %xmm0
	comisd	%xmm3, %xmm0
	ja	.L48
.L42:
	incl	%ebp
	cmpl	$40000, %ebp
	jne	.L39
	movaps	%xmm3, %xmm0
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L38
.L48:
	movb	$1, %al
.L38:
	addq	$24, %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
.LFE2038:
	.size	_Z14SolvePotentialPdS_, .-_Z14SolvePotentialPdS_
	.globl	_Z9ComputeEFPdS_S_
	.type	_Z9ComputeEFPdS_S_, @function
_Z9ComputeEFPdS_S_:
.LFB2039:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	pushq	%rcx
	.cfi_def_cfa_offset 16
	movq	%rdx, %rdi
	movslq	domain(%rip), %rdx
	movq	.LC8(%rip), %xmm2
	xorl	%ecx, %ecx
	leal	-1(%rdx), %r8d
.L53:
	incq	%rcx
	movsd	16+domain(%rip), %xmm1
	cmpl	%ecx, %r8d
	jle	.L56
	movsd	8(%rax,%rcx,8), %xmm0
	subsd	-8(%rax,%rcx,8), %xmm0
	addsd	%xmm1, %xmm1
	xorps	%xmm2, %xmm0
	divsd	%xmm1, %xmm0
	movsd	%xmm0, (%rsi,%rcx,8)
	jmp	.L53
.L56:
	movsd	8(%rax), %xmm0
	subsd	(%rax), %xmm0
	salq	$3, %rdx
	movl	$1, %ecx
	xorps	%xmm2, %xmm0
	divsd	%xmm1, %xmm0
	movsd	%xmm0, (%rsi)
	movsd	-8(%rax,%rdx), %xmm0
	subsd	-16(%rax,%rdx), %xmm0
	xorps	%xmm2, %xmm0
	divsd	16+domain(%rip), %xmm0
	movsd	%xmm0, -8(%rsi,%rdx)
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_ZL10CUDA_ERROR9cudaError
	.cfi_endproc
.LFE2039:
	.size	_Z9ComputeEFPdS_S_, .-_Z9ComputeEFPdS_S_
	.globl	_Z4XtoLd
	.type	_Z4XtoLd, @function
_Z4XtoLd:
.LFB2042:
	.cfi_startproc
	endbr64
	divsd	.LC12(%rip), %xmm0
	ret
	.cfi_endproc
.LFE2042:
	.size	_Z4XtoLd, .-_Z4XtoLd
	.globl	_Z7scatterddPd
	.type	_Z7scatterddPd, @function
_Z7scatterddPd:
.LFB2043:
	.cfi_startproc
	endbr64
	cvttsd2sil	%xmm0, %eax
	cvtsi2sdl	%eax, %xmm2
	cltq
	salq	$3, %rax
	leaq	(%rdi,%rax), %rdx
	leaq	8(%rdi,%rax), %rax
	subsd	%xmm2, %xmm0
	movsd	.LC6(%rip), %xmm2
	subsd	%xmm0, %xmm2
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm2
	addsd	(%rdx), %xmm2
	movsd	%xmm2, (%rdx)
	addsd	(%rax), %xmm0
	movsd	%xmm0, (%rax)
	ret
	.cfi_endproc
.LFE2043:
	.size	_Z7scatterddPd, .-_Z7scatterddPd
	.globl	_Z11dev_scatterdfPf
	.type	_Z11dev_scatterdfPf, @function
_Z11dev_scatterdfPf:
.LFB2044:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE2044:
	.size	_Z11dev_scatterdfPf, .-_Z11dev_scatterdfPf
	.globl	_Z6gatherdPd
	.type	_Z6gatherdPd, @function
_Z6gatherdPd:
.LFB2045:
	.cfi_startproc
	endbr64
	cvttsd2sil	%xmm0, %eax
	movaps	%xmm0, %xmm1
	cvtsi2sdl	%eax, %xmm0
	cltq
	subsd	%xmm0, %xmm1
	movsd	.LC6(%rip), %xmm0
	subsd	%xmm1, %xmm0
	mulsd	8(%rdi,%rax,8), %xmm1
	mulsd	(%rdi,%rax,8), %xmm0
	addsd	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE2045:
	.size	_Z6gatherdPd, .-_Z6gatherdPd
	.section	.rodata.str1.1
.LC14:
	.string	"ZONE I=%d T=ZONE_%06d\n"
.LC15:
	.string	"%g %g %g %g %g %g\n"
	.text
	.globl	_Z12WriteResultsi
	.type	_Z12WriteResultsi, @function
_Z12WriteResultsi:
.LFB2046:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%edi, %r8d
	movl	$2, %esi
	xorl	%eax, %eax
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	.LC15(%rip), %rbp
	xorl	%ebx, %ebx
	pushq	%rdx
	.cfi_def_cfa_offset 32
	movl	domain(%rip), %ecx
	leaq	.LC14(%rip), %rdx
	movq	file_res(%rip), %rdi
	call	__fprintf_chk@PLT
.L63:
	cmpl	%ebx, domain(%rip)
	movq	file_res(%rip), %rdi
	jle	.L66
	movq	48+domain(%rip), %rax
	cvtsi2sdl	%ebx, %xmm0
	movq	%rbp, %rdx
	movl	$2, %esi
	mulsd	16+domain(%rip), %xmm0
	movsd	(%rax,%rbx,8), %xmm5
	movq	40+domain(%rip), %rax
	movsd	(%rax,%rbx,8), %xmm4
	movq	56+domain(%rip), %rax
	movsd	(%rax,%rbx,8), %xmm3
	movq	64+domain(%rip), %rax
	cvtss2sd	(%rax,%rbx,4), %xmm2
	movq	72+domain(%rip), %rax
	cvtss2sd	(%rax,%rbx,4), %xmm1
	movb	$6, %al
	incq	%rbx
	call	__fprintf_chk@PLT
	jmp	.L63
.L66:
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	fflush@PLT
	.cfi_endproc
.LFE2046:
	.size	_Z12WriteResultsi, .-_Z12WriteResultsi
	.globl	_Z46__device_stub__Z15scatterParticleP8ParticlePflP8ParticlePfl
	.type	_Z46__device_stub__Z15scatterParticleP8ParticlePflP8ParticlePfl, @function
_Z46__device_stub__Z15scatterParticleP8ParticlePflP8ParticlePfl:
.LFB2071:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L67
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z15scatterParticleP8ParticlePfl(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L67:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L69
	call	__stack_chk_fail@PLT
.L69:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2071:
	.size	_Z46__device_stub__Z15scatterParticleP8ParticlePflP8ParticlePfl, .-_Z46__device_stub__Z15scatterParticleP8ParticlePflP8ParticlePfl
	.globl	_Z15scatterParticleP8ParticlePfl
	.type	_Z15scatterParticleP8ParticlePfl, @function
_Z15scatterParticleP8ParticlePfl:
.LFB2072:
	.cfi_startproc
	endbr64
	jmp	_Z46__device_stub__Z15scatterParticleP8ParticlePflP8ParticlePfl
	.cfi_endproc
.LFE2072:
	.size	_Z15scatterParticleP8ParticlePfl, .-_Z15scatterParticleP8ParticlePfl
	.globl	_Z14ScatterSpeciesP7SpeciesPfS1_
	.type	_Z14ScatterSpeciesP7SpeciesPfS1_, @function
_Z14ScatterSpeciesP7SpeciesPfS1_:
.LFB2034:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rdx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdi, %rbp
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rsi, %rbx
	xorl	%esi, %esi
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movslq	domain(%rip), %rdx
	salq	$2, %rdx
	call	cudaMemset@PLT
	movl	%eax, %edi
	call	_ZL10CUDA_ERROR9cudaError
	movl	28(%rbp), %eax
	movl	$256, %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	cltd
	idivl	%ecx
	movl	$16777217, %edx
	movl	$1, %ecx
	salq	$8, %rdx
	incl	%eax
	movl	%eax, 8(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 12(%rsp)
	movq	8(%rsp), %rdi
	movl	16(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L73
	movslq	28(%rbp), %rdx
	movq	40(%rbp), %rdi
	movq	%r12, %rsi
	call	_Z46__device_stub__Z15scatterParticleP8ParticlePflP8ParticlePfl
.L73:
	movslq	domain(%rip), %rdx
	movl	$2, %ecx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	salq	$2, %rdx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	call	_ZL10CUDA_ERROR9cudaError
	movslq	domain(%rip), %rdx
	movsd	16+domain(%rip), %xmm1
	xorl	%eax, %eax
.L74:
	cmpl	%eax, %edx
	jle	.L77
	movsd	16(%rbp), %xmm0
	cvtss2sd	(%rbx,%rax,4), %xmm2
	divsd	%xmm1, %xmm0
	mulsd	%xmm2, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%rbx,%rax,4)
	incq	%rax
	jmp	.L74
.L77:
	movss	(%rbx), %xmm0
	leaq	-4(%rbx,%rdx,4), %rax
	addss	%xmm0, %xmm0
	movss	%xmm0, (%rbx)
	movss	(%rax), %xmm0
	addss	%xmm0, %xmm0
	movss	%xmm0, (%rax)
	addq	$32, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2034:
	.size	_Z14ScatterSpeciesP7SpeciesPfS1_, .-_Z14ScatterSpeciesP7SpeciesPfS1_
	.globl	_Z44__device_stub__Z12pushParticleP8ParticlePddlP8ParticlePddl
	.type	_Z44__device_stub__Z12pushParticleP8ParticlePddlP8ParticlePddl, @function
_Z44__device_stub__Z12pushParticleP8ParticlePddlP8ParticlePddl:
.LFB2073:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rcx
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, (%rsp)
	leaq	40(%rsp), %rdx
	movsd	%xmm0, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L78
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z12pushParticleP8ParticlePddl(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L78:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L80
	call	__stack_chk_fail@PLT
.L80:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2073:
	.size	_Z44__device_stub__Z12pushParticleP8ParticlePddlP8ParticlePddl, .-_Z44__device_stub__Z12pushParticleP8ParticlePddlP8ParticlePddl
	.globl	_Z12pushParticleP8ParticlePddl
	.type	_Z12pushParticleP8ParticlePddl, @function
_Z12pushParticleP8ParticlePddl:
.LFB2074:
	.cfi_startproc
	endbr64
	jmp	_Z44__device_stub__Z12pushParticleP8ParticlePddlP8ParticlePddl
	.cfi_endproc
.LFE2074:
	.size	_Z12pushParticleP8ParticlePddl, .-_Z12pushParticleP8ParticlePddl
	.globl	_Z11PushSpeciesP7SpeciesPd
	.type	_Z11PushSpeciesP7SpeciesPd, @function
_Z11PushSpeciesP7SpeciesPd:
.LFB2040:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$256, %ecx
	movq	%rsi, %rbp
	xorl	%r9d, %r9d
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	xorl	%r8d, %r8d
	subq	$56, %rsp
	.cfi_def_cfa_offset 80
	movl	28(%rdi), %eax
	movsd	8(%rdi), %xmm0
	movsd	(%rdi), %xmm1
	cltd
	movsd	%xmm0, 8(%rsp)
	idivl	%ecx
	movsd	%xmm1, (%rsp)
	movl	$16777217, %edx
	movl	$1, %ecx
	salq	$8, %rdx
	incl	%eax
	movl	%eax, 24(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 28(%rsp)
	movq	24(%rsp), %rdi
	movl	32(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	movsd	8(%rsp), %xmm0
	testl	%eax, %eax
	jne	.L83
	movslq	28(%rbx), %rdx
	movq	40(%rbx), %rdi
	divsd	(%rsp), %xmm0
	movq	%rbp, %rsi
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	_Z44__device_stub__Z12pushParticleP8ParticlePddlP8ParticlePddl
.L83:
	.cfi_restore_state
	addq	$56, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2040:
	.size	_Z11PushSpeciesP7SpeciesPd, .-_Z11PushSpeciesP7SpeciesPd
	.globl	_Z46__device_stub__Z14rewindParticleP8ParticlePddlP8ParticlePddl
	.type	_Z46__device_stub__Z14rewindParticleP8ParticlePddlP8ParticlePddl, @function
_Z46__device_stub__Z14rewindParticleP8ParticlePddlP8ParticlePddl:
.LFB2075:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rcx
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, (%rsp)
	leaq	40(%rsp), %rdx
	movsd	%xmm0, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L86
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z14rewindParticleP8ParticlePddl(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L86:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L88
	call	__stack_chk_fail@PLT
.L88:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2075:
	.size	_Z46__device_stub__Z14rewindParticleP8ParticlePddlP8ParticlePddl, .-_Z46__device_stub__Z14rewindParticleP8ParticlePddlP8ParticlePddl
	.globl	_Z14rewindParticleP8ParticlePddl
	.type	_Z14rewindParticleP8ParticlePddl, @function
_Z14rewindParticleP8ParticlePddl:
.LFB2076:
	.cfi_startproc
	endbr64
	jmp	_Z46__device_stub__Z14rewindParticleP8ParticlePddlP8ParticlePddl
	.cfi_endproc
.LFE2076:
	.size	_Z14rewindParticleP8ParticlePddl, .-_Z14rewindParticleP8ParticlePddl
	.globl	_Z13RewindSpeciesP7SpeciesPd
	.type	_Z13RewindSpeciesP7SpeciesPd, @function
_Z13RewindSpeciesP7SpeciesPd:
.LFB2041:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$256, %ecx
	movq	%rsi, %rbp
	xorl	%r9d, %r9d
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	xorl	%r8d, %r8d
	subq	$56, %rsp
	.cfi_def_cfa_offset 80
	movl	28(%rdi), %eax
	movsd	8(%rdi), %xmm0
	movsd	(%rdi), %xmm1
	cltd
	movsd	%xmm0, 8(%rsp)
	idivl	%ecx
	movsd	%xmm1, (%rsp)
	movl	$16777217, %edx
	movl	$1, %ecx
	salq	$8, %rdx
	incl	%eax
	movl	%eax, 24(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 28(%rsp)
	movq	24(%rsp), %rdi
	movl	32(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	movsd	8(%rsp), %xmm0
	testl	%eax, %eax
	jne	.L91
	movslq	28(%rbx), %rdx
	movq	40(%rbx), %rdi
	divsd	(%rsp), %xmm0
	movq	%rbp, %rsi
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	_Z46__device_stub__Z14rewindParticleP8ParticlePddlP8ParticlePddl
.L91:
	.cfi_restore_state
	addq	$56, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2041:
	.size	_Z13RewindSpeciesP7SpeciesPd, .-_Z13RewindSpeciesP7SpeciesPd
	.section	.rodata.str1.1
.LC17:
	.string	"Found GPU '%s' with %g Gb of global memory, max %d threads per block, and %d multiprocessors\n"
.LC26:
	.string	"w"
.LC27:
	.string	"results.dat"
.LC28:
	.string	"VARIABLES = x nde ndi rho phi ef\n"
.LC30:
	.string	"TS:%i\tnp_i:%d\tnp_e:%d\tdphi:%.3g\n"
.LC32:
	.string	"Time per time step: %.3g ms\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%esi, %esi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$1224, %rsp
	.cfi_def_cfa_offset 1280
	movq	%fs:40, %rax
	movq	%rax, 1208(%rsp)
	xorl	%eax, %eax
	leaq	176(%rsp), %rbx
	movq	%rbx, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	movl	%eax, %edi
	call	_ZL10CUDA_ERROR9cudaError
	movq	464(%rsp), %rax
	movl	564(%rsp), %r8d
	movl	496(%rsp), %ecx
	testq	%rax, %rax
	js	.L95
	cvtsi2sdq	%rax, %xmm0
	jmp	.L96
.L95:
	movq	%rax, %rdx
	andl	$1, %eax
	shrq	%rdx
	orq	%rax, %rdx
	cvtsi2sdq	%rdx, %xmm0
	addsd	%xmm0, %xmm0
.L96:
	mulsd	.LC16(%rip), %xmm0
	movq	%rbx, %rdx
	movl	$2, %edi
	movb	$1, %al
	leaq	.LC17(%rip), %rsi
	movabsq	$1152921504606846975, %rbx
	call	__printf_chk@PLT
	xorl	%edi, %edi
	call	cudaSetDevice@PLT
	movl	%eax, %edi
	call	_ZL10CUDA_ERROR9cudaError
	movslq	domain(%rip), %rdi
	cmpq	%rdi, %rbx
	jb	.L97
	salq	$3, %rdi
	call	_Znam@PLT
	movslq	domain(%rip), %rdi
	movq	%rax, 40+domain(%rip)
	cmpq	%rdi, %rbx
	jnb	.L98
.L97:
	movq	1208(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L133
	call	__cxa_throw_bad_array_new_length@PLT
.L98:
	salq	$3, %rdi
	call	_Znam@PLT
	movslq	domain(%rip), %rdi
	movq	%rax, 56+domain(%rip)
	cmpq	%rdi, %rbx
	jb	.L97
	movabsq	$2305843009213693950, %rbx
	salq	$3, %rdi
	call	_Znam@PLT
	movslq	domain(%rip), %rdi
	movq	%rax, 48+domain(%rip)
	cmpq	%rdi, %rbx
	jb	.L97
	salq	$2, %rdi
	call	_Znam@PLT
	movslq	domain(%rip), %rdi
	movq	%rax, 72+domain(%rip)
	cmpq	%rdi, %rbx
	jb	.L97
	salq	$2, %rdi
	movl	$15625, %ebp
	call	_Znam@PLT
	movslq	domain(%rip), %rsi
	salq	$37, %rbp
	leaq	56(%rsp), %rdi
	movq	40+domain(%rip), %rbx
	movq	%rax, 64+domain(%rip)
	movq	%rax, %r12
	salq	$2, %rsi
	movq	56+domain(%rip), %r15
	movq	48+domain(%rip), %r14
	movq	72+domain(%rip), %r13
	call	cudaMalloc@PLT
	movl	%eax, %edi
	call	_ZL10CUDA_ERROR9cudaError
	movslq	domain(%rip), %rsi
	leaq	64(%rsp), %rdi
	salq	$2, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	call	_ZL10CUDA_ERROR9cudaError
	movslq	domain(%rip), %rsi
	leaq	72(%rsp), %rdi
	salq	$3, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	call	_ZL10CUDA_ERROR9cudaError
	movslq	domain(%rip), %rcx
	xorl	%eax, %eax
	movq	%rbx, %rdi
	movsd	.LC20(%rip), %xmm0
	salq	$3, %rcx
	rep stosb
	movq	.LC18(%rip), %rax
	movl	$12000000, %edi
	movq	%rbp, 104(%rsp)
	movq	%rax, 80(%rsp)
	movq	.LC19(%rip), %rax
	mulsd	24+domain(%rip), %xmm0
	divsd	.LC21(%rip), %xmm0
	movq	%rax, 88(%rsp)
	movsd	%xmm0, 96(%rsp)
	call	_Znam@PLT
	movl	$12000000, %esi
	leaq	120(%rsp), %rdi
	movq	%rax, 112(%rsp)
	call	cudaMalloc@PLT
	movl	%eax, %edi
	call	_ZL10CUDA_ERROR9cudaError
	movq	.LC22(%rip), %rax
	movsd	.LC20(%rip), %xmm0
	movl	$12000000, %edi
	mulsd	24+domain(%rip), %xmm0
	movq	%rbp, 152(%rsp)
	xorl	%ebp, %ebp
	movq	%rax, 128(%rsp)
	movq	.LC23(%rip), %rax
	divsd	.LC21(%rip), %xmm0
	movsd	%xmm0, 144(%rsp)
	movq	%rax, 136(%rsp)
	call	_Znam@PLT
	movl	$12000000, %esi
	leaq	168(%rsp), %rdi
	movq	%rax, 160(%rsp)
	call	cudaMalloc@PLT
	movl	%eax, %edi
	call	_ZL10CUDA_ERROR9cudaError
	xorl	%edi, %edi
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
	movsd	24+domain(%rip), %xmm0
	divsd	.LC21(%rip), %xmm0
	movsd	%xmm0, 16(%rsp)
	movsd	.LC24(%rip), %xmm0
	divsd	80(%rsp), %xmm0
	call	sqrt@PLT
	leaq	80(%rsp), %rax
	movq	%rax, 8(%rsp)
	movsd	%xmm0, 24(%rsp)
.L100:
	cvtsi2sdl	%ebp, %xmm0
	mulsd	16(%rsp), %xmm0
	incl	%ebp
	addsd	8+domain(%rip), %xmm0
	movsd	%xmm0, 32(%rsp)
	movsd	24(%rsp), %xmm0
	call	_Z9SampleVeld
	movq	8(%rsp), %rdi
	movaps	%xmm0, %xmm1
	movsd	32(%rsp), %xmm0
	call	_Z11AddParticleP7Speciesdd
	cmpl	$500000, %ebp
	jne	.L100
	movsd	24+domain(%rip), %xmm0
	divsd	.LC21(%rip), %xmm0
	movsd	%xmm0, 24(%rsp)
	xorl	%ebp, %ebp
	movsd	.LC25(%rip), %xmm0
	divsd	128(%rsp), %xmm0
	call	sqrt@PLT
	leaq	128(%rsp), %rax
	movq	%rax, 16(%rsp)
	movsd	%xmm0, 32(%rsp)
.L101:
	cvtsi2sdl	%ebp, %xmm0
	mulsd	24(%rsp), %xmm0
	incl	%ebp
	addsd	8+domain(%rip), %xmm0
	movsd	%xmm0, 40(%rsp)
	movsd	32(%rsp), %xmm0
	call	_Z9SampleVeld
	movq	16(%rsp), %rdi
	movaps	%xmm0, %xmm1
	movsd	40(%rsp), %xmm0
	call	_Z11AddParticleP7Speciesdd
	cmpl	$500000, %ebp
	jne	.L101
	movq	112(%rsp), %rsi
	movq	120(%rsp), %rdi
	movl	$1, %ecx
	movl	$12000000, %edx
	movl	$1, %ebp
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	call	_ZL10CUDA_ERROR9cudaError
	movl	$1, %ecx
	movl	$12000000, %edx
	movq	160(%rsp), %rsi
	movq	168(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	call	_ZL10CUDA_ERROR9cudaError
	movq	64(%rsp), %rdx
	movq	8(%rsp), %rdi
	movq	%r12, %rsi
	call	_Z14ScatterSpeciesP7SpeciesPfS1_
	movq	56(%rsp), %rdx
	movq	16(%rsp), %rdi
	movq	%r13, %rsi
	call	_Z14ScatterSpeciesP7SpeciesPfS1_
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	_Z10ComputeRhoP7SpeciesS0_
	movq	%r15, %rsi
	movq	%rbx, %rdi
	call	_Z14SolvePotentialPdS_
	movq	72(%rsp), %rdx
	movq	%r14, %rsi
	movq	%rbx, %rdi
	call	_Z9ComputeEFPdS_S_
	movq	72(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	_Z13RewindSpeciesP7SpeciesPd
	movq	72(%rsp), %rsi
	movq	16(%rsp), %rdi
	call	_Z13RewindSpeciesP7SpeciesPd
	leaq	.LC26(%rip), %rsi
	leaq	.LC27(%rip), %rdi
	call	fopen@PLT
	leaq	.LC28(%rip), %rdx
	movl	$2, %esi
	movq	%rax, %rdi
	movq	%rax, file_res(%rip)
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	xorl	%edi, %edi
	call	_Z12WriteResultsi
	call	clock@PLT
	movq	%rax, 24(%rsp)
.L107:
	movq	64(%rsp), %rdx
	movq	8(%rsp), %rdi
	movq	%r12, %rsi
	call	_Z14ScatterSpeciesP7SpeciesPfS1_
	movq	56(%rsp), %rdx
	movq	16(%rsp), %rdi
	movq	%r13, %rsi
	call	_Z14ScatterSpeciesP7SpeciesPfS1_
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	_Z10ComputeRhoP7SpeciesS0_
	movq	%r15, %rsi
	movq	%rbx, %rdi
	call	_Z14SolvePotentialPdS_
	movq	72(%rsp), %rdx
	movq	%r14, %rsi
	movq	%rbx, %rdi
	call	_Z9ComputeEFPdS_S_
	movq	72(%rsp), %rsi
	movq	16(%rsp), %rdi
	call	_Z11PushSpeciesP7SpeciesPd
	movq	72(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	_Z11PushSpeciesP7SpeciesPd
	movl	%ebp, %eax
	movl	$25, %ecx
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L102
	movsd	(%rbx), %xmm2
	movl	domain(%rip), %edx
	xorl	%eax, %eax
	movaps	%xmm2, %xmm0
	andps	.LC29(%rip), %xmm0
.L103:
	cmpl	%eax, %edx
	jle	.L134
	movsd	(%rbx,%rax,8), %xmm1
	andps	.LC29(%rip), %xmm1
	incq	%rax
	maxsd	%xmm0, %xmm1
	movaps	%xmm1, %xmm0
	jmp	.L103
.L134:
	subsd	%xmm2, %xmm0
	movl	152(%rsp), %r8d
	movl	%ebp, %edx
	movb	$1, %al
	movl	104(%rsp), %ecx
	leaq	.LC30(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
.L102:
	movl	%ebp, %eax
	movl	$1000, %ecx
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L106
	movl	%ebp, %edi
	call	_Z12WriteResultsi
.L106:
	incl	%ebp
	cmpl	$10001, %ebp
	jne	.L107
	call	clock@PLT
	movq	file_res(%rip), %rdi
	movq	%rax, %rbp
	call	fclose@PLT
	movl	$8, %esi
	movq	%rbx, %rdi
	call	_ZdlPvm@PLT
	testq	%r15, %r15
	je	.L108
	movl	$8, %esi
	movq	%r15, %rdi
	call	_ZdlPvm@PLT
.L108:
	testq	%r14, %r14
	je	.L109
	movl	$8, %esi
	movq	%r14, %rdi
	call	_ZdlPvm@PLT
.L109:
	testq	%r13, %r13
	je	.L110
	movl	$4, %esi
	movq	%r13, %rdi
	call	_ZdlPvm@PLT
.L110:
	movl	$4, %esi
	movq	%r12, %rdi
	call	_ZdlPvm@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movq	112(%rsp), %rdi
	testq	%rdi, %rdi
	je	.L111
	movl	$24, %esi
	call	_ZdlPvm@PLT
.L111:
	movq	160(%rsp), %rdi
	testq	%rdi, %rdi
	je	.L112
	movl	$24, %esi
	call	_ZdlPvm@PLT
.L112:
	movq	120(%rsp), %rdi
	call	cudaFree@PLT
	movq	168(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rax
	movl	$2, %edi
	leaq	.LC32(%rip), %rsi
	subq	%rax, %rbp
	movb	$1, %al
	imulq	$1000, %rbp, %rbp
	cvtsi2sdq	%rbp, %xmm0
	divsd	.LC31(%rip), %xmm0
	call	__printf_chk@PLT
	call	cudaDeviceReset@PLT
	movl	%eax, %edi
	call	_ZL10CUDA_ERROR9cudaError
	movq	1208(%rsp), %rax
	subq	%fs:40, %rax
	je	.L113
.L133:
	call	__stack_chk_fail@PLT
.L113:
	addq	$1224, %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
.LFE2031:
	.size	main, .-main
	.section	.rodata.str1.1
.LC33:
	.string	"_Z14rewindParticleP8ParticlePddl"
.LC34:
	.string	"_Z12pushParticleP8ParticlePddl"
.LC35:
	.string	"_Z15scatterParticleP8ParticlePfl"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2078:
	.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	.LC33(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z14rewindParticleP8ParticlePddl(%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	.LC34(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z12pushParticleP8ParticlePddl(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC35(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z15scatterParticleP8ParticlePfl(%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
.LFE2078:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text.startup
	.type	_GLOBAL__sub_I_domain, @function
_GLOBAL__sub_I_domain:
.LFB2195:
	.cfi_startproc
	endbr64
	movsd	.LC36(%rip), %xmm0
	movq	.LC12(%rip), %rax
	movl	$101, domain(%rip)
	movq	$0x000000000, 8+domain(%rip)
	movq	%rax, 16+domain(%rip)
	movsd	%xmm0, 24+domain(%rip)
	movsd	%xmm0, 32+domain(%rip)
	ret
	.cfi_endproc
.LFE2195:
	.size	_GLOBAL__sub_I_domain, .-_GLOBAL__sub_I_domain
	.section	.init_array
	.align 8
	.quad	_GLOBAL__sub_I_domain
	.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	file_res
	.bss
	.align 8
	.type	file_res, @object
	.size	file_res, 8
file_res:
	.zero	8
	.globl	domain
	.align 32
	.type	domain, @object
	.size	domain, 80
domain:
	.zero	80
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	-4194304
	.long	1105199103
	.align 8
.LC3:
	.long	1719614413
	.long	1072079006
	.align 8
.LC4:
	.long	0
	.long	1075314688
	.align 8
.LC6:
	.long	0
	.long	1072693248
	.align 8
.LC7:
	.long	0
	.long	-1073741824
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC8:
	.long	0
	.long	-2147483648
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC9:
	.long	-245078340
	.long	1034123382
	.align 8
.LC10:
	.long	0
	.long	1071644672
	.align 8
.LC11:
	.long	1717986918
	.long	1073112678
	.align 8
.LC12:
	.long	-350469331
	.long	1058682594
	.align 8
.LC16:
	.long	0
	.long	1051721728
	.align 8
.LC18:
	.long	1622951700
	.long	983593463
	.align 8
.LC19:
	.long	402043217
	.long	1007133914
	.align 8
.LC20:
	.long	937459712
	.long	1128383353
	.align 8
.LC21:
	.long	0
	.long	1092519040
	.align 8
.LC22:
	.long	-1813299378
	.long	967997916
	.align 8
.LC23:
	.long	402043217
	.long	-1140349734
	.align 8
.LC24:
	.long	-2003658124
	.long	1008182491
	.align 8
.LC25:
	.long	-1502743593
	.long	1009892260
	.section	.rodata.cst16
	.align 16
.LC29:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC31:
	.long	536870912
	.long	1107468383
	.align 8
.LC36:
	.long	1202590843
	.long	1065646817
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

/*Demo 1D sheath PIC simulation with CUDA
GPU1: particle mover moved to the GPU
*/

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


/*CUDA error wraper*/
static void CUDA_ERROR( hipError_t err) 
{
    if (err != hipSuccess) {
        printf("CUDA ERROR: %s, exiting\n", hipGetErrorString(err));
        exit(-1);
    }
}

/*constants*/
#define EPS_0 8.85418782e-12  	// F/m, vacuum permittivity
#define K	1.38065e-23			// J/K, Boltzmann constant
#define ME 9.10938215e-31		// kg, electron mass
#define QE 1.602176565e-19		// C, elementary charge
#define AMU  1.660538921e-27	// kg, atomic mass unit
#define EV_TO_K	11604.52		// 1eV in Kelvin, QE/K

/*simulation parameters, these could come from an input file*/
#define PLASMA_DEN	1e16		// plasma density to load
#define NUM_IONS 500000		    // number of ions
#define NUM_ELECTRONS 500000	// number of electrons
#define DX 1e-4					// cell spacing
#define NC 100					// number of cells
#define NUM_TS	10000			// number of time steps
#define DT 1e-11				// time step size
#define ELECTRON_TEMP 3.0		// electron temperature in eV
#define ION_TEMP 1.0			// ion temperature in eV

/*domain parameters, set here so can access from GPU*/
#define X0  0			/*mesh origin*/
#define XL  NC*DX			/*domain length*/
#define XMAX  (X0 + XL)		/*domain max position*/
	
const int THREADS_PER_BLOCK = 256;
/* Data structure to hold domain information*/
struct Domain
{
	const int ni = NC+1;			/*number of nodes*/
	const double x0 = X0;
	const double dx = DX;
	const double xl = XL;
	const double xmax = XMAX;

	/*data structures*/
	double *phi;		/*potential*/
	double *ef;			/*electric field on the cpu*/
	double *rho;		/*charge density*/

	float *ndi;		/*ion density on the CPU*/
	float *nde;		/*electron density on the CPU*/
};

/* Data structure for particle storage **/
struct Particle
{
	double x;			/*position*/
	double v;			/*velocity*/
	bool alive;			/*flag to avoid removing particles*/
};

/* Data structure to hold species information*/
struct Species
{
	double mass;			/*particle mass in kg*/
	double charge;			/*particle charge in Coulomb*/
	double spwt;			/*species specific weight*/
	
	int np;					/*number of particles*/
	int np_alloc;			/*size of the allocated data array*/
	Particle *part;			/*array holding particles on the CPU*/
	Particle *part_gpu;		/*array holding particles on the GPU*/
};

/** FUNCTION PROTOTYPES **/
double rnd();
double SampleVel(double v_th);
void ScatterSpecies(Species *species, float *den, float *den_gpu);
void ComputeRho(Species *ions, Species *electrons);
bool SolvePotential(double *phi, double *rho);
bool SolvePotentialDirect(double *phi, double *rho);
void ComputeEF(double *phi, double *ef, double *ef_gpu);
void PushSpecies(Species *species, double *ef);
void RewindSpecies(Species *species, double *ef);
void AddParticle(Species *species, double x, double v);	
__host__ __device__ double XtoL(double pos);
void scatter(double lc, double value, double *field);
__host__ __device__ double gather(double lc, double *field);
void WriteResults(int ts);

/*gpu versions of above functions to avoid needing compute_35*/
__device__ void dev_scatter(double lc, float value, float *field);

/* GLOBAL VARIABLES */
Domain domain;
FILE *file_res;

/* --------- main -------------*/
int main()
{
	
	/*get info on our GPU, defaulting to first one*/
	hipDeviceProp_t prop;
	CUDA_ERROR(hipGetDeviceProperties(&prop,0));
	printf("Found GPU '%s' with %g Gb of global memory, max %d threads per block, and %d multiprocessors\n", 
		prop.name, prop.totalGlobalMem/(1024.0*1024.0),
		prop.maxThreadsPerBlock,prop.multiProcessorCount);

	/*init CUDA*/
	CUDA_ERROR(hipSetDevice(0));
	
	int p;
	int ts;						// time step

	/*allocate data structures, remember these need to be cleared first in C++*/
	domain.phi = new double[domain.ni];		//potential
	domain.rho  = new double[domain.ni];		//charge density
	domain.ef  = new double[domain.ni];		//electric field
	domain.nde  = new float[domain.ni];		//number density of electrons
	domain.ndi	= new float[domain.ni];		//number density of ions

	/*save pointers so we can write phi instead of domain.phi*/
	double *phi = domain.phi;
	double *rho = domain.rho;
	double *ef = domain.ef;
	float *nde = domain.nde;
	float *ndi = domain.ndi;
	
	/*also allocate GPU space for the ion and electron density*/
	float *nde_gpu, *ndi_gpu;
	CUDA_ERROR(hipMalloc((void**)&nde_gpu,domain.ni*sizeof(float)));
	CUDA_ERROR(hipMalloc((void**)&ndi_gpu,domain.ni*sizeof(float)));
	
	/*also allocate GPU space for the electric field*/
	double *ef_gpu;
	CUDA_ERROR(hipMalloc((void**)&ef_gpu,domain.ni*sizeof(double)));
	
	/*clear data*/
	memset(phi,0,sizeof(double)*domain.ni);
	
	/*variables to hold species data ions*/
	Species ions;
	Species electrons;
	
	/*set material data*/
	ions.mass = 16*AMU;		
	ions.charge = QE;
	ions.spwt = PLASMA_DEN*domain.xl/NUM_IONS;
	ions.np = 0;
	ions.np_alloc = NUM_IONS;
	ions.part = new Particle[NUM_IONS];
	CUDA_ERROR(hipMalloc((void**)&ions.part_gpu,NUM_IONS*sizeof(Particle)));
	
	electrons.mass = ME;	// electrons
	electrons.charge = -QE;
	electrons.spwt = PLASMA_DEN*domain.xl/NUM_ELECTRONS;
	electrons.np = 0;
	electrons.np_alloc = NUM_ELECTRONS;
	electrons.part = new Particle[NUM_ELECTRONS];
	CUDA_ERROR(hipMalloc((void**)&electrons.part_gpu,NUM_ELECTRONS*sizeof(Particle)));
	
	/*randomize RNG*/
	srand(time(NULL));
		
	/*load uniformly spaced ions and electrons*/
	double delta_ions = domain.xl/NUM_IONS;
	double v_thi = sqrt(2*K*ION_TEMP*EV_TO_K/ions.mass);	
	for (p=0;p<NUM_IONS;p++)
	{
		double x = domain.x0 + p*delta_ions;
		double v = SampleVel(v_thi);
		AddParticle(&ions,x,v);
	}
		
	/*now do the same for electrons*/
	double delta_electrons = domain.xl/NUM_ELECTRONS;
	double v_the = sqrt(2*K*ELECTRON_TEMP*EV_TO_K/electrons.mass);	
	for (p=0;p<NUM_ELECTRONS;p++)
	{
		double x = domain.x0 + p*delta_electrons;
		double v = SampleVel(v_the);
		AddParticle(&electrons,x,v);
	}
	
	/*copy particles to the GPU*/
	CUDA_ERROR(hipMemcpy(ions.part_gpu,ions.part,NUM_IONS*sizeof(Particle),hipMemcpyHostToDevice));
	CUDA_ERROR(hipMemcpy(electrons.part_gpu,electrons.part,NUM_IONS*sizeof(Particle),hipMemcpyHostToDevice));

	/*compute number density*/
	ScatterSpecies(&ions,ndi,ndi_gpu);
	ScatterSpecies(&electrons,nde,nde_gpu);
		
	/*compute charge density and solve potential*/
	ComputeRho(&ions, &electrons);
	SolvePotential(phi,rho);
	ComputeEF(phi,ef,ef_gpu);
	
	RewindSpecies(&ions,ef_gpu);
	RewindSpecies(&electrons,ef_gpu);
	
	/*OUTPUT*/
	file_res = fopen("results.dat","w");
	fprintf(file_res,"VARIABLES = x nde ndi rho phi ef\n");
	WriteResults(0);
		
	clock_t start = clock();	// grab starting clock time

	/* MAIN LOOP*/
	for (ts = 1; ts<=NUM_TS; ts++)
	{
		/*compute number density*/
		ScatterSpecies(&ions,ndi,ndi_gpu);
		ScatterSpecies(&electrons,nde,nde_gpu);
		
		ComputeRho(&ions, &electrons);
		SolvePotential(phi,rho);
		ComputeEF(phi,ef,ef_gpu);
		
		/*move particles*/
		PushSpecies(&electrons,ef_gpu);
		PushSpecies(&ions,ef_gpu);
		
		/*write diagnostics*/
		if (ts%25==0)
		{
			/*max phi*/
			double max_phi = abs(phi[0]);
			for (int i=0;i<domain.ni;i++)
				if (abs(phi[i])>max_phi) max_phi=abs(phi[i]);
			
			printf("TS:%i\tnp_i:%d\tnp_e:%d\tdphi:%.3g\n", 
				ts,ions.np,electrons.np,max_phi-phi[0]);			
		}
		
		/*save data*/
		if (ts%1000==0) WriteResults(ts);
	}
	
	clock_t end=clock();
	
	fclose(file_res);
	
	/*free up memory*/
	delete phi;
	delete rho;
	delete ef;
	delete nde;
	delete ndi;
	hipFree(nde_gpu);
	hipFree(ndi_gpu);
	hipFree(ef_gpu);
	
	/*free particles*/
	delete ions.part;
	delete electrons.part;
	hipFree(ions.part_gpu);
	hipFree(electrons.part_gpu);
	
	printf("Time per time step: %.3g ms\n",1000*(end-start)/(double)(CLOCKS_PER_SEC*NUM_TS));

	/* call cudaDeviceReset for correct profiling data*/
	CUDA_ERROR(hipDeviceReset());

	return 0;
}

/***** HELPER FUNCTIONS *********************************************************/
/* random number generator
   for now using built-in but this is not adequate for real simulations*/
double rnd()
{
	return rand()/(double)RAND_MAX;
}
   
/* samples random velocity from Maxwellian distribution using Birdsall's method*/
double SampleVel(double v_th)
{
    const int M = 12;    
    double sum = 0;
	for (int i=0;i<M;i++) sum+=rnd();

    return sqrt(0.5)*v_th*(sum-M/2.0)/sqrt(M/12.0);
}


/*GPU code to move particles*/
__global__ void scatterParticle(Particle *particles, float *den, long N)
{
	/*get particle id*/
	long p = blockIdx.x*blockDim.x+threadIdx.x;
	if (p<N && particles[p].alive)
	{
		double lc = XtoL(particles[p].x);
		dev_scatter(lc, 1.0, den);
	}
}

/*scatter particles of species to the mesh*/
void ScatterSpecies(Species *species, float *den, float *den_gpu)
{
	/*initialize densities to zero*/
	CUDA_ERROR(hipMemset(den_gpu,0,sizeof(float)*domain.ni));
	
	/*scatter particles to the mesh*/
	int nblocks = 1+species->np_alloc/THREADS_PER_BLOCK;
	scatterParticle<<<nblocks,THREADS_PER_BLOCK>>>(species->part_gpu,den_gpu,species->np_alloc);
	
	/*copy density back to CPU*/
	CUDA_ERROR(hipMemcpy(den,den_gpu,sizeof(float)*domain.ni,hipMemcpyDeviceToHost));

	/*divide by cell volume*/
	for (int i=0;i<domain.ni;i++)
		den[i]*=species->spwt/domain.dx;
		
	/*only half cell at boundaries*/
	den[0] *=2.0;
	den[domain.ni-1] *= 2.0;
}

/*adds new particle to the species, returns pointer to the newly added data*/
void AddParticle(Species *species, double x, double v)
{
	/*abort the simulation if we ran out of space to store this particle*/
	if (species->np > species->np_alloc-1)
	{
		printf("Too many particles!\n"); exit(-1);
	}
	
	/*store position and velocity of this particle*/
	species->part[species->np].x = x;
	species->part[species->np].v = v;
	species->part[species->np].alive = true;
		
	/*increment particle counter*/
	species->np++;
}

/*computes charge density by adding ion and electron data*/
void ComputeRho(Species *ions, Species *electrons)
{
	double *rho = domain.rho;
	
	for (int i=0;i<domain.ni;i++)
		rho[i] = ions->charge*domain.ndi[i] + electrons->charge*domain.nde[i];
}

/*Thomas algorithm for a tri-diagonal matrix*/
bool SolvePotentialDirect(double *x, double *rho)
{
	/*set coefficients, this should be pre-computed*/
	int ni = domain.ni;
	double dx2 = domain.dx*domain.dx;
	int i;
	double *a = new double[ni];
	double *b = new double[ni];
	double *c = new double[ni];
	
	/*central difference on internal nodes*/
	for (i=1;i<ni-1;i++)
	{
		a[i] = 1; b[i] = -2; c[i] = 1;
	}
	
	/*dirichlet b.c. on boundaries*/
	a[0]=0;b[0]=1;c[0]=0;
	a[ni-1]=0;b[ni-1]=1;c[ni-1]=0;
	
	/*multiply RHS*/
	for  (i=1;i<domain.ni-1;i++)
		x[i]=-rho[i]*dx2/EPS_0;
		
	x[0] = 0;
	x[ni-1] = 0;
	
	/* Modify the coefficients. */
	c[0] /= b[0];				/* Division by zero risk. */
	x[0] /= b[0];				/* Division by zero would imply a singular matrix. */
	for(i = 1; i < ni; i++)
	{
		double id = (b[i] - c[i-1] * a[i]);	/* Division by zero risk. */
		c[i] /= id;							/* Last value calculated is redundant. */
		x[i] = (x[i] - x[i-1] * a[i])/id;
	}

	/* Now back substitute. */
	for(i = ni - 2; i >= 0; i--)
		x[i] = x[i] - c[i] * x[i + 1];

	return true;		
}

/* solves potential using the Gauss Seidel Method, returns true if converged*/
bool SolvePotential(double *phi, double *rho)
{
	double L2;
	double dx2 = domain.dx*domain.dx;	/*precompute*/
	
	/*initialize boundaries*/
	phi[0]=phi[domain.ni-1]=0;
	
	/*solve potential, identical to lesson 2*/
	for (int solver_it=0;solver_it<40000;solver_it++)
	{
		/*Gauss Seidel method, phi[i-1]-2*phi[i]+phi[i+1] = -dx^2*rho[i]/eps_0*/
		for (int i=1;i<domain.ni-1;i++)
		{
			/*SOR*/
			double g = 0.5*(phi[i-1] + phi[i+1] + dx2*rho[i]/EPS_0);
			phi[i] = phi[i] + 1.4*(g-phi[i]);
		}
				
		/*check for convergence*/
		if (solver_it%25==0)
		{
			double sum = 0;
			for (int i=1;i<domain.ni-1;i++)
			{
				double R = -rho[i]/EPS_0 - (phi[i-1] - 2*phi[i] + phi[i+1])/dx2;
				sum+=R*R;
			}
			L2 = sqrt(sum)/domain.ni;
			if (L2<1e-4) {return true;}
		}
	}
	printf("Gauss-Seidel solver failed to converge, L2=%.3g!\n",L2);
	return false;	
}

/* computes electric field by differentiating potential*/
void ComputeEF(double *phi, double *ef, double *ef_gpu)
{
	for (int i=1;i<domain.ni-1;i++)
		ef[i] = -(phi[i+1]-phi[i-1])/(2*domain.dx);	//central difference
	
	/*one sided difference at boundaries*/
	ef[0] = -(phi[1]-phi[0])/domain.dx;
	ef[domain.ni-1] = -(phi[domain.ni-1]-phi[domain.ni-2])/domain.dx;

	/*copy to the gpu*/
	CUDA_ERROR(hipMemcpy(ef_gpu,ef,domain.ni*sizeof(double),hipMemcpyHostToDevice));
}

/*GPU code to move particles*/
__global__ void pushParticle(Particle *particles, double *ef, double qm, long N)
{
	/*get particle id*/
	long p = blockIdx.x*blockDim.x+threadIdx.x;
	
	if (p<N && particles[p].alive)
	{			
		/*grab pointer to this particle*/
		Particle *part = &particles[p];
	
		/*compute particle node position*/
		double lc = XtoL(part->x);
		
		/*gather electric field onto particle position*/
		double part_ef = gather(lc,ef);
		
		/*advance velocity*/
		part->v += DT*qm*part_ef;	
		
		/*advance position*/
		part->x += DT*part->v;
			
		/*remove particles leaving the domain*/
		if (part->x < X0 || part->x >= XMAX)
			part->alive = false;					
	}
}

/* moves particles of a single species, returns wall charge*/
void PushSpecies(Species *species, double *ef)
{
	/*precompute q/m*/
	double qm = species->charge / species->mass;
	
	/*loop over particles*/
	int nblocks = 1+species->np_alloc/THREADS_PER_BLOCK;
	pushParticle<<<nblocks,THREADS_PER_BLOCK>>>(species->part_gpu,ef,qm,species->np_alloc);
}



/*GPU code to rewind particles*/
__global__ void rewindParticle(Particle *particles, double *ef, double qm, long N)
{
	/*get particle id*/
	long p = blockIdx.x*blockDim.x+threadIdx.x;
	
	if (p<N && particles[p].alive)
	{			
		/*grab pointer to this particle*/
		Particle *part = &particles[p];
	
		/*compute particle node position*/
		double lc = XtoL(part->x);
		
		/*gather electric field onto particle position*/
		double part_ef = gather(lc,ef);
		
		/*advance velocity*/
		part->v -= 0.5*DT*qm*part_ef;	
	}
}


/* rewinds particle velocities by -0.5DT*/
void RewindSpecies(Species *species, double *ef)
{
	/*precompute q/m*/
	double qm = species->charge / species->mass;
	
	/*loop over particles*/
	int nblocks = 1+species->np_alloc/THREADS_PER_BLOCK;
	rewindParticle<<<nblocks,THREADS_PER_BLOCK>>>(species->part_gpu,ef,qm,species->np_alloc);
}


/* converts physical coordinate to logical*/
__host__ __device__ double XtoL(double pos)
{
	double li = (pos-0)/DX;
	return li;
}


/* scatters scalar value onto a field at logical coordinate lc*/
void scatter(double lc, double value, double *field)
{
	int i = (int)lc;
	double di = lc-i;
			
	field[i] += value*(1-di);
	field[i+1] += value*(di);
}

/* atomic scatter of scalar value onto a field at logical coordinate lc*/
__device__ void dev_scatter(double lc, float value, float *field)
{
	int i = (int)lc;
	float di = lc-i;
			
	atomicAdd(&(field[i]),value*(1-di));
	atomicAdd(&(field[i+1]),value*(di));
}

/* gathers field value at logical coordinate lc*/
__host__ __device__ double gather(double lc, double *field)
{
	int i = (int)lc;
	double di = lc-i;
				
	/*gather field value onto particle position*/
	double val = field[i]*(1-di) + field[i+1]*(di);
	return val;
}


/* writes new zone to the results file*/
void WriteResults(int ts)
{
	fprintf(file_res,"ZONE I=%d T=ZONE_%06d\n",domain.ni,ts);
	for (int i=0;i<domain.ni;i++)
	{
		fprintf(file_res,"%g %g %g %g %g %g\n",i*domain.dx,
									domain.nde[i],domain.ndi[i],
									domain.rho[i],domain.phi[i],domain.ef[i]);
	}
			
	fflush(file_res);
}

	.text
	.file	"sheath-gpu.hip"
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function main
.LCPI0_0:
	.long	1127219200                      # 0x43300000
	.long	1160773632                      # 0x45300000
	.long	0                               # 0x0
	.long	0                               # 0x0
.LCPI0_1:
	.quad	0x4330000000000000              # double 4503599627370496
	.quad	0x4530000000000000              # double 1.9342813113834067E+25
.LCPI0_11:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI0_2:
	.quad	0x3eb0000000000000              # double 9.5367431640625E-7
.LCPI0_3:
	.quad	0x4341c37937e08000              # double 1.0E+16
.LCPI0_4:
	.quad	0x411e848000000000              # double 5.0E+5
.LCPI0_5:
	.quad	0x3c17a4db88929a74              # double 3.2043561076000004E-19
.LCPI0_6:
	.quad	0x3fe6a09e667f3bcd              # double 0.70710678118654757
.LCPI0_7:
	.quad	0x41dfffffffc00000              # double 2147483647
.LCPI0_8:
	.quad	0xc018000000000000              # double -6
.LCPI0_9:
	.quad	0x3ff0000000000000              # double 1
.LCPI0_10:
	.quad	0x3c31bba4a66df3d7              # double 9.613068322800001E-19
.LCPI0_12:
	.quad	0x4202a05f20000000              # double 1.0E+10
	.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	$1656, %rsp                     # imm = 0x678
	.cfi_def_cfa_offset 1712
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	184(%rsp), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	hipGetDevicePropertiesR0600
	movl	%eax, %edi
	callq	_ZL10CUDA_ERROR10hipError_t
	movsd	288(%rbx), %xmm1                # xmm1 = mem[0],zero
	unpcklps	.LCPI0_0(%rip), %xmm1           # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
	subpd	.LCPI0_1(%rip), %xmm1
	movapd	%xmm1, %xmm0
	unpckhpd	%xmm1, %xmm0                    # xmm0 = xmm0[1],xmm1[1]
	addsd	%xmm1, %xmm0
	mulsd	.LCPI0_2(%rip), %xmm0
	movl	320(%rbx), %edx
	movl	388(%rbx), %ecx
	movl	$.L.str, %edi
	movq	%rbx, %rsi
	movb	$1, %al
	callq	printf
	xorl	%edi, %edi
	callq	hipSetDevice
	movl	%eax, %edi
	callq	_ZL10CUDA_ERROR10hipError_t
	movslq	domain(%rip), %rax
	leaq	(,%rax,8), %r15
	testq	%rax, %rax
	movq	$-1, %r13
	cmovsq	%r13, %r15
	leaq	(,%rax,4), %r14
	cmovnsq	%r14, %r13
	movq	%r15, %rdi
	callq	_Znam
	movq	%rax, %rbx
	movq	%rax, domain+40(%rip)
	movq	%r15, %rdi
	callq	_Znam
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	movq	%rax, domain+56(%rip)
	movq	%r15, %rdi
	callq	_Znam
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	movq	%rax, domain+48(%rip)
	movq	%r13, %rdi
	callq	_Znam
	movq	%rax, %r12
	movq	%rax, domain+72(%rip)
	movq	%r13, %rdi
	callq	_Znam
	movq	%rax, %r13
	movq	%rax, domain+64(%rip)
	leaq	80(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	movl	%eax, %edi
	callq	_ZL10CUDA_ERROR10hipError_t
	movslq	domain(%rip), %rsi
	shlq	$2, %rsi
	leaq	72(%rsp), %rdi
	callq	hipMalloc
	movl	%eax, %edi
	callq	_ZL10CUDA_ERROR10hipError_t
	movslq	domain(%rip), %rsi
	shlq	$3, %rsi
	leaq	8(%rsp), %rdi
	callq	hipMalloc
	movl	%eax, %edi
	callq	_ZL10CUDA_ERROR10hipError_t
	movslq	domain(%rip), %rdx
	shlq	$3, %rdx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	movabsq	$4224501757767337748, %rax      # imm = 0x3AA071F760BC4714
	leaq	176(%rsp), %r14
	movq	%rax, -40(%r14)
	movabsq	$4325607223724519761, %rax      # imm = 0x3C07A4DA17F6B151
	movq	%rax, -32(%r14)
	movsd	domain+24(%rip), %xmm0          # xmm0 = mem[0],zero
	mulsd	.LCPI0_3(%rip), %xmm0
	divsd	.LCPI0_4(%rip), %xmm0
	movsd	%xmm0, -24(%r14)
	movabsq	$2147483648000000, %rax         # imm = 0x7A12000000000
	movq	%rax, -16(%r14)
	movl	$12000000, %edi                 # imm = 0xB71B00
	callq	_Znam
	movq	%rax, -8(%r14)
	movl	$12000000, %esi                 # imm = 0xB71B00
	movq	%r14, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	callq	_ZL10CUDA_ERROR10hipError_t
	movabsq	$4157519394297823054, %rax      # imm = 0x39B279DC93EB3F4E
	leaq	128(%rsp), %r15
	movq	%rax, -40(%r15)
	movabsq	$-4897764813130256047, %rax     # imm = 0xBC07A4DA17F6B151
	movsd	.LCPI0_3(%rip), %xmm0           # xmm0 = mem[0],zero
	mulsd	domain+24(%rip), %xmm0
	movq	%rax, -32(%r15)
	divsd	.LCPI0_4(%rip), %xmm0
	movsd	%xmm0, -24(%r15)
	movabsq	$2147483648000000, %rax         # imm = 0x7A12000000000
	movq	%rax, -16(%r15)
	movl	$12000000, %edi                 # imm = 0xB71B00
	callq	_Znam
	movq	%rax, -8(%r15)
	movl	$12000000, %esi                 # imm = 0xB71B00
	movq	%r15, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	callq	_ZL10CUDA_ERROR10hipError_t
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	movsd	.LCPI0_5(%rip), %xmm0           # xmm0 = mem[0],zero
	divsd	-40(%r14), %xmm0
	movsd	domain+24(%rip), %xmm1          # xmm1 = mem[0],zero
	movsd	%xmm1, (%rsp)                   # 8-byte Spill
	xorpd	%xmm1, %xmm1
	ucomisd	%xmm1, %xmm0
	jb	.LBB0_2
# %bb.1:
	sqrtsd	%xmm0, %xmm2
	jmp	.LBB0_3
.LBB0_2:                                # %call.sqrt
	callq	sqrt
	xorpd	%xmm1, %xmm1
	movapd	%xmm0, %xmm2
.LBB0_3:                                # %.split
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	.LCPI0_4(%rip), %xmm0
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	mulsd	.LCPI0_6(%rip), %xmm2
	movsd	%xmm2, 24(%rsp)                 # 8-byte Spill
	leaq	136(%rsp), %r14
.LBB0_4:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_5 Depth 2
	movsd	domain+8(%rip), %xmm0           # xmm0 = mem[0],zero
	movsd	%xmm0, 48(%rsp)                 # 8-byte Spill
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	%xmm1, 64(%rsp)                 # 8-byte Spill
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, 56(%rsp)                 # 8-byte Spill
	xorpd	%xmm1, %xmm1
	movl	$12, %r15d
.LBB0_5:                                #   Parent Loop BB0_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	%xmm1, 16(%rsp)                 # 8-byte Spill
	callq	rand
	movsd	16(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	.LCPI0_7(%rip), %xmm0
	addsd	%xmm0, %xmm1
	decl	%r15d
	jne	.LBB0_5
# %bb.6:                                # %_Z9SampleVeld.exit
                                        #   in Loop: Header=BB0_4 Depth=1
	movsd	56(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	addsd	48(%rsp), %xmm0                 # 8-byte Folded Reload
	addsd	.LCPI0_8(%rip), %xmm1
	mulsd	24(%rsp), %xmm1                 # 8-byte Folded Reload
	movq	%r14, %rdi
	callq	_Z11AddParticleP7Speciesdd
	movsd	64(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	addsd	.LCPI0_9(%rip), %xmm1
	incl	%ebp
	cmpl	$500000, %ebp                   # imm = 0x7A120
	jne	.LBB0_4
# %bb.7:
	movsd	.LCPI0_10(%rip), %xmm0          # xmm0 = mem[0],zero
	divsd	88(%rsp), %xmm0
	movsd	domain+24(%rip), %xmm1          # xmm1 = mem[0],zero
	movsd	%xmm1, (%rsp)                   # 8-byte Spill
	xorpd	%xmm1, %xmm1
	ucomisd	%xmm1, %xmm0
	jb	.LBB0_9
# %bb.8:
	xorps	%xmm2, %xmm2
	sqrtsd	%xmm0, %xmm2
	jmp	.LBB0_10
.LBB0_9:                                # %call.sqrt96
	callq	sqrt
	xorpd	%xmm1, %xmm1
	movapd	%xmm0, %xmm2
.LBB0_10:                               # %.split95
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	.LCPI0_4(%rip), %xmm0
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	mulsd	.LCPI0_6(%rip), %xmm2
	movsd	%xmm2, 24(%rsp)                 # 8-byte Spill
	xorl	%ebp, %ebp
	leaq	88(%rsp), %r14
.LBB0_11:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_12 Depth 2
	movsd	domain+8(%rip), %xmm0           # xmm0 = mem[0],zero
	movsd	%xmm0, 48(%rsp)                 # 8-byte Spill
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	%xmm1, 64(%rsp)                 # 8-byte Spill
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, 56(%rsp)                 # 8-byte Spill
	xorpd	%xmm1, %xmm1
	movl	$12, %r15d
.LBB0_12:                               #   Parent Loop BB0_11 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	%xmm1, 16(%rsp)                 # 8-byte Spill
	callq	rand
	movsd	16(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	.LCPI0_7(%rip), %xmm0
	addsd	%xmm0, %xmm1
	decl	%r15d
	jne	.LBB0_12
# %bb.13:                               # %_Z9SampleVeld.exit62
                                        #   in Loop: Header=BB0_11 Depth=1
	movsd	56(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	addsd	48(%rsp), %xmm0                 # 8-byte Folded Reload
	addsd	.LCPI0_8(%rip), %xmm1
	mulsd	24(%rsp), %xmm1                 # 8-byte Folded Reload
	movq	%r14, %rdi
	callq	_Z11AddParticleP7Speciesdd
	movsd	64(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	addsd	.LCPI0_9(%rip), %xmm1
	incl	%ebp
	cmpl	$500000, %ebp                   # imm = 0x7A120
	jne	.LBB0_11
# %bb.14:
	leaq	136(%rsp), %r14
	movq	32(%r14), %rsi
	movq	40(%r14), %rdi
	movl	$1, %ebp
	movl	$12000000, %edx                 # imm = 0xB71B00
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	callq	_ZL10CUDA_ERROR10hipError_t
	leaq	88(%rsp), %r15
	movq	32(%r15), %rsi
	movq	40(%r15), %rdi
	movl	$12000000, %edx                 # imm = 0xB71B00
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	callq	_ZL10CUDA_ERROR10hipError_t
	movq	72(%rsp), %rdx
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_Z14ScatterSpeciesP7SpeciesPfS1_
	movq	80(%rsp), %rdx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_Z14ScatterSpeciesP7SpeciesPfS1_
	movl	domain(%rip), %eax
	testl	%eax, %eax
	jle	.LBB0_17
# %bb.15:                               # %.lr.ph.i
	movq	domain+56(%rip), %rcx
	movq	domain+64(%rip), %rdx
	movq	domain+72(%rip), %rsi
	xorl	%edi, %edi
.LBB0_16:                               # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rdx,%rdi,4), %xmm0
	mulsd	144(%rsp), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	(%rsi,%rdi,4), %xmm1
	mulsd	96(%rsp), %xmm1
	addsd	%xmm0, %xmm1
	movsd	%xmm1, (%rcx,%rdi,8)
	incq	%rdi
	cmpq	%rdi, %rax
	jne	.LBB0_16
.LBB0_17:                               # %_Z10ComputeRhoP7SpeciesS0_.exit
	movq	%rbx, %rdi
	movq	40(%rsp), %rsi                  # 8-byte Reload
	callq	_Z14SolvePotentialPdS_
	movq	8(%rsp), %rdx
	movq	%rbx, %rdi
	movq	32(%rsp), %rsi                  # 8-byte Reload
	callq	_Z9ComputeEFPdS_S_
	movq	8(%rsp), %rsi
	leaq	136(%rsp), %r14
	movq	%r14, %rdi
	callq	_Z13RewindSpeciesP7SpeciesPd
	movq	8(%rsp), %rsi
	leaq	88(%rsp), %r15
	movq	%r15, %rdi
	callq	_Z13RewindSpeciesP7SpeciesPd
	movl	$.L.str.1, %edi
	movl	$.L.str.2, %esi
	callq	fopen
	movq	%rax, file_res(%rip)
	movl	$.L.str.3, %edi
	movl	$33, %esi
	movl	$1, %edx
	movq	%rax, %rcx
	callq	fwrite@PLT
	xorl	%edi, %edi
	callq	_Z12WriteResultsi
	callq	clock
	movq	%rax, 16(%rsp)                  # 8-byte Spill
.LBB0_18:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_20 Depth 2
                                        #     Child Loop BB0_34 Depth 2
	movq	72(%rsp), %rdx
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_Z14ScatterSpeciesP7SpeciesPfS1_
	movq	80(%rsp), %rdx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_Z14ScatterSpeciesP7SpeciesPfS1_
	movl	domain(%rip), %eax
	testl	%eax, %eax
	jle	.LBB0_21
# %bb.19:                               # %.lr.ph.i64
                                        #   in Loop: Header=BB0_18 Depth=1
	movq	domain+56(%rip), %rcx
	movq	domain+64(%rip), %rdx
	movq	domain+72(%rip), %rsi
	xorl	%edi, %edi
.LBB0_20:                               #   Parent Loop BB0_18 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rdx,%rdi,4), %xmm0
	mulsd	144(%rsp), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	(%rsi,%rdi,4), %xmm1
	mulsd	96(%rsp), %xmm1
	addsd	%xmm0, %xmm1
	movsd	%xmm1, (%rcx,%rdi,8)
	incq	%rdi
	cmpq	%rdi, %rax
	jne	.LBB0_20
.LBB0_21:                               # %_Z10ComputeRhoP7SpeciesS0_.exit69
                                        #   in Loop: Header=BB0_18 Depth=1
	movq	%rbx, %rdi
	movq	40(%rsp), %rsi                  # 8-byte Reload
	callq	_Z14SolvePotentialPdS_
	movq	8(%rsp), %rdx
	movq	%rbx, %rdi
	movq	32(%rsp), %rsi                  # 8-byte Reload
	callq	_Z9ComputeEFPdS_S_
	movq	8(%rsp), %rsi
	movq	%r15, %rdi
	callq	_Z11PushSpeciesP7SpeciesPd
	movq	8(%rsp), %rsi
	movq	%r14, %rdi
	callq	_Z11PushSpeciesP7SpeciesPd
	imull	$-1030792151, %ebp, %eax        # imm = 0xC28F5C29
	cmpl	$171798691, %eax                # imm = 0xA3D70A3
	ja	.LBB0_25
# %bb.22:                               #   in Loop: Header=BB0_18 Depth=1
	movsd	(%rbx), %xmm1                   # xmm1 = mem[0],zero
	movapd	%xmm1, %xmm2
	movapd	.LCPI0_11(%rip), %xmm3          # xmm3 = [NaN,NaN]
	andpd	%xmm3, %xmm2
	movl	domain(%rip), %eax
	testl	%eax, %eax
	jle	.LBB0_23
# %bb.33:                               # %.lr.ph.preheader
                                        #   in Loop: Header=BB0_18 Depth=1
	xorl	%ecx, %ecx
.LBB0_34:                               # %.lr.ph
                                        #   Parent Loop BB0_18 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%rbx,%rcx,8), %xmm0            # xmm0 = mem[0],zero
	andpd	%xmm3, %xmm0
	maxsd	%xmm2, %xmm0
	incq	%rcx
	movapd	%xmm0, %xmm2
	cmpq	%rcx, %rax
	jne	.LBB0_34
	jmp	.LBB0_24
.LBB0_23:                               #   in Loop: Header=BB0_18 Depth=1
	movapd	%xmm2, %xmm0
.LBB0_24:                               # %._crit_edge
                                        #   in Loop: Header=BB0_18 Depth=1
	movl	160(%rsp), %edx
	movl	112(%rsp), %ecx
	subsd	%xmm1, %xmm0
	movl	$.L.str.4, %edi
	movl	%ebp, %esi
	movb	$1, %al
	callq	printf
.LBB0_25:                               #   in Loop: Header=BB0_18 Depth=1
	imull	$652835029, %ebp, %eax          # imm = 0x26E978D5
	rorl	$3, %eax
	cmpl	$4294967, %eax                  # imm = 0x418937
	ja	.LBB0_27
# %bb.26:                               #   in Loop: Header=BB0_18 Depth=1
	movl	%ebp, %edi
	callq	_Z12WriteResultsi
.LBB0_27:                               #   in Loop: Header=BB0_18 Depth=1
	incl	%ebp
	cmpl	$10001, %ebp                    # imm = 0x2711
	jne	.LBB0_18
# %bb.28:
	callq	clock
	movq	%rax, %r14
	movq	file_res(%rip), %rdi
	callq	fclose
	movq	%rbx, %rdi
	callq	_ZdlPv
	movq	40(%rsp), %rdi                  # 8-byte Reload
	callq	_ZdlPv
	movq	32(%rsp), %rdi                  # 8-byte Reload
	callq	_ZdlPv
	movq	%r12, %rdi
	callq	_ZdlPv
	movq	%r13, %rdi
	callq	_ZdlPv
	movq	80(%rsp), %rdi
	callq	hipFree
	movq	72(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	168(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB0_30
# %bb.29:
	callq	_ZdlPv
.LBB0_30:
	movq	120(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB0_32
# %bb.31:
	callq	_ZdlPv
.LBB0_32:
	movq	176(%rsp), %rdi
	callq	hipFree
	movq	128(%rsp), %rdi
	callq	hipFree
	subq	16(%rsp), %r14                  # 8-byte Folded Reload
	imulq	$1000, %r14, %rax               # imm = 0x3E8
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI0_12(%rip), %xmm0
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	callq	hipDeviceReset
	movl	%eax, %edi
	callq	_ZL10CUDA_ERROR10hipError_t
	xorl	%eax, %eax
	addq	$1656, %rsp                     # imm = 0x678
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.type	_ZL10CUDA_ERROR10hipError_t,@function # -- Begin function _ZL10CUDA_ERROR10hipError_t
_ZL10CUDA_ERROR10hipError_t:            # @_ZL10CUDA_ERROR10hipError_t
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jne	.LBB1_2
# %bb.1:
	retq
.LBB1_2:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	hipGetErrorString
	movl	$.L.str.10, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$-1, %edi
	callq	exit
.Lfunc_end1:
	.size	_ZL10CUDA_ERROR10hipError_t, .Lfunc_end1-_ZL10CUDA_ERROR10hipError_t
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z9SampleVeld
.LCPI2_0:
	.quad	0x41dfffffffc00000              # double 2147483647
.LCPI2_1:
	.quad	0x3fe6a09e667f3bcd              # double 0.70710678118654757
.LCPI2_2:
	.quad	0xc018000000000000              # double -6
	.text
	.globl	_Z9SampleVeld
	.type	_Z9SampleVeld,@function
_Z9SampleVeld:                          # @_Z9SampleVeld
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -16
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	xorpd	%xmm0, %xmm0
	movl	$12, %ebx
.LBB2_1:                                # =>This Inner Loop Header: Depth=1
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	callq	rand
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	xorps	%xmm1, %xmm1
	cvtsi2sd	%eax, %xmm1
	divsd	.LCPI2_0(%rip), %xmm1
	addsd	%xmm1, %xmm0
	decl	%ebx
	jne	.LBB2_1
# %bb.2:
	movsd	(%rsp), %xmm1                   # 8-byte Reload
                                        # xmm1 = mem[0],zero
	mulsd	.LCPI2_1(%rip), %xmm1
	addsd	.LCPI2_2(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z9SampleVeld, .Lfunc_end2-_Z9SampleVeld
	.cfi_endproc
                                        # -- End function
	.globl	_Z11AddParticleP7Speciesdd      # -- Begin function _Z11AddParticleP7Speciesdd
	.type	_Z11AddParticleP7Speciesdd,@function
_Z11AddParticleP7Speciesdd:             # @_Z11AddParticleP7Speciesdd
	.cfi_startproc
# %bb.0:
	movslq	24(%rdi), %rax
	cmpl	28(%rdi), %eax
	jge	.LBB3_2
# %bb.1:
	movq	32(%rdi), %rcx
	leaq	(%rax,%rax,2), %rdx
	movsd	%xmm0, (%rcx,%rdx,8)
	movsd	%xmm1, 8(%rcx,%rdx,8)
	movb	$1, 16(%rcx,%rdx,8)
	incl	%eax
	movl	%eax, 24(%rdi)
	retq
.LBB3_2:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	$-1, %edi
	callq	exit
.Lfunc_end3:
	.size	_Z11AddParticleP7Speciesdd, .Lfunc_end3-_Z11AddParticleP7Speciesdd
	.cfi_endproc
                                        # -- End function
	.globl	_Z14ScatterSpeciesP7SpeciesPfS1_ # -- Begin function _Z14ScatterSpeciesP7SpeciesPfS1_
	.type	_Z14ScatterSpeciesP7SpeciesPfS1_,@function
_Z14ScatterSpeciesP7SpeciesPfS1_:       # @_Z14ScatterSpeciesP7SpeciesPfS1_
	.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
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movslq	domain(%rip), %rdx
	shlq	$2, %rdx
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	hipMemset
	movl	%eax, %edi
	callq	_ZL10CUDA_ERROR10hipError_t
	movl	28(%r14), %eax
	leal	255(%rax), %edi
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$8, %edi
	incl	%edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$256, %rdx                      # imm = 0x100
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_2
# %bb.1:
	movq	40(%r14), %rdi
	movslq	28(%r14), %rdx
	movq	%r15, %rsi
	callq	_Z30__device_stub__scatterParticleP8ParticlePfl
.LBB4_2:
	movslq	domain(%rip), %rdx
	shlq	$2, %rdx
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	callq	_ZL10CUDA_ERROR10hipError_t
	movl	domain(%rip), %eax
	testl	%eax, %eax
	jle	.LBB4_5
# %bb.3:                                # %.lr.ph
	movsd	16(%r14), %xmm0                 # xmm0 = mem[0],zero
	divsd	domain+16(%rip), %xmm0
	xorl	%ecx, %ecx
.LBB4_4:                                # =>This Inner Loop Header: Depth=1
	xorps	%xmm1, %xmm1
	cvtss2sd	(%rbx,%rcx,4), %xmm1
	mulsd	%xmm0, %xmm1
	cvtsd2ss	%xmm1, %xmm1
	movss	%xmm1, (%rbx,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB4_4
.LBB4_5:                                # %._crit_edge
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	addss	%xmm0, %xmm0
	movss	%xmm0, (%rbx)
	cltq
	movss	-4(%rbx,%rax,4), %xmm0          # xmm0 = mem[0],zero,zero,zero
	addss	%xmm0, %xmm0
	movss	%xmm0, -4(%rbx,%rax,4)
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z14ScatterSpeciesP7SpeciesPfS1_, .Lfunc_end4-_Z14ScatterSpeciesP7SpeciesPfS1_
	.cfi_endproc
                                        # -- End function
	.globl	_Z10ComputeRhoP7SpeciesS0_      # -- Begin function _Z10ComputeRhoP7SpeciesS0_
	.type	_Z10ComputeRhoP7SpeciesS0_,@function
_Z10ComputeRhoP7SpeciesS0_:             # @_Z10ComputeRhoP7SpeciesS0_
	.cfi_startproc
# %bb.0:
	movl	domain(%rip), %eax
	testl	%eax, %eax
	jle	.LBB5_3
# %bb.1:                                # %.lr.ph
	movq	domain+56(%rip), %rcx
	movq	domain+64(%rip), %rdx
	movq	domain+72(%rip), %r8
	xorl	%r9d, %r9d
.LBB5_2:                                # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rdx,%r9,4), %xmm0
	mulsd	8(%rdi), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	(%r8,%r9,4), %xmm1
	mulsd	8(%rsi), %xmm1
	addsd	%xmm0, %xmm1
	movsd	%xmm1, (%rcx,%r9,8)
	incq	%r9
	cmpq	%r9, %rax
	jne	.LBB5_2
.LBB5_3:                                # %._crit_edge
	retq
.Lfunc_end5:
	.size	_Z10ComputeRhoP7SpeciesS0_, .Lfunc_end5-_Z10ComputeRhoP7SpeciesS0_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z14SolvePotentialPdS_
.LCPI6_0:
	.quad	0x3da37876f16466bc              # double 8.8541878200000003E-12
.LCPI6_1:
	.quad	0x3fe0000000000000              # double 0.5
.LCPI6_2:
	.quad	0x3ff6666666666666              # double 1.3999999999999999
.LCPI6_3:
	.quad	0xbda37876f16466bc              # double -8.8541878200000003E-12
.LCPI6_4:
	.quad	0x3f1a36e2eb1c432d              # double 1.0E-4
	.text
	.globl	_Z14SolvePotentialPdS_
	.type	_Z14SolvePotentialPdS_,@function
_Z14SolvePotentialPdS_:                 # @_Z14SolvePotentialPdS_
	.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	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movsd	domain+16(%rip), %xmm5          # xmm5 = mem[0],zero
	mulsd	%xmm5, %xmm5
	movslq	domain(%rip), %rax
	xorl	%r15d, %r15d
	movq	%r15, -8(%rdi,%rax,8)
	movq	%r15, (%rdi)
	movb	$1, %bpl
	movsd	.LCPI6_0(%rip), %xmm6           # xmm6 = mem[0],zero
	movsd	.LCPI6_1(%rip), %xmm7           # xmm7 = mem[0],zero
	movsd	.LCPI6_2(%rip), %xmm8           # xmm8 = mem[0],zero
	movsd	.LCPI6_3(%rip), %xmm9           # xmm9 = mem[0],zero
	xorpd	%xmm10, %xmm10
	movsd	.LCPI6_4(%rip), %xmm11          # xmm11 = mem[0],zero
                                        # implicit-def: $xmm0
	movsd	%xmm5, (%rsp)                   # 8-byte Spill
.LBB6_1:                                # %.preheader52
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_3 Depth 2
                                        #     Child Loop BB6_7 Depth 2
	cmpl	$3, %eax
	jl	.LBB6_8
# %bb.2:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB6_1 Depth=1
	leal	-1(%rax), %ecx
	movl	%ecx, %ecx
	movsd	(%r14), %xmm2                   # xmm2 = mem[0],zero
	movsd	8(%r14), %xmm1                  # xmm1 = mem[0],zero
	movl	$1, %edx
.LBB6_3:                                # %.lr.ph
                                        #   Parent Loop BB6_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	8(%r14,%rdx,8), %xmm3           # xmm3 = mem[0],zero
	addsd	%xmm3, %xmm2
	movsd	(%rbx,%rdx,8), %xmm4            # xmm4 = mem[0],zero
	mulsd	%xmm5, %xmm4
	divsd	%xmm6, %xmm4
	addsd	%xmm2, %xmm4
	mulsd	%xmm7, %xmm4
	subsd	%xmm1, %xmm4
	mulsd	%xmm8, %xmm4
	addsd	%xmm1, %xmm4
	movsd	%xmm4, (%r14,%rdx,8)
	leaq	1(%rdx), %rsi
	movapd	%xmm4, %xmm2
	movapd	%xmm3, %xmm1
	movq	%rsi, %rdx
	cmpq	%rsi, %rcx
	jne	.LBB6_3
# %bb.4:                                # %._crit_edge
                                        #   in Loop: Header=BB6_1 Depth=1
	imull	$-1030792151, %r15d, %edx       # imm = 0xC28F5C29
	cmpl	$171798692, %edx                # imm = 0xA3D70A4
	jae	.LBB6_14
# %bb.5:                                # %.preheader
                                        #   in Loop: Header=BB6_1 Depth=1
	xorpd	%xmm0, %xmm0
	cmpl	$3, %eax
	jl	.LBB6_10
# %bb.6:                                # %.lr.ph60.preheader
                                        #   in Loop: Header=BB6_1 Depth=1
	movsd	8(%r14), %xmm1                  # xmm1 = mem[0],zero
	decq	%rcx
	xorl	%eax, %eax
.LBB6_7:                                # %.lr.ph60
                                        #   Parent Loop BB6_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	8(%rbx,%rax,8), %xmm2           # xmm2 = mem[0],zero
	divsd	%xmm9, %xmm2
	addsd	%xmm1, %xmm1
	movsd	(%r14,%rax,8), %xmm3            # xmm3 = mem[0],zero
	subsd	%xmm1, %xmm3
	movsd	16(%r14,%rax,8), %xmm1          # xmm1 = mem[0],zero
	addsd	%xmm1, %xmm3
	divsd	%xmm5, %xmm3
	subsd	%xmm3, %xmm2
	mulsd	%xmm2, %xmm2
	addsd	%xmm2, %xmm0
	incq	%rax
	cmpq	%rax, %rcx
	jne	.LBB6_7
	jmp	.LBB6_10
.LBB6_8:                                # %._crit_edge.thread
                                        #   in Loop: Header=BB6_1 Depth=1
	imull	$-1030792151, %r15d, %ecx       # imm = 0xC28F5C29
	cmpl	$171798692, %ecx                # imm = 0xA3D70A4
	jae	.LBB6_14
# %bb.9:                                #   in Loop: Header=BB6_1 Depth=1
	xorpd	%xmm0, %xmm0
.LBB6_10:                               # %._crit_edge61
                                        #   in Loop: Header=BB6_1 Depth=1
	ucomisd	%xmm10, %xmm0
	jb	.LBB6_12
# %bb.11:                               #   in Loop: Header=BB6_1 Depth=1
	sqrtsd	%xmm0, %xmm0
	jmp	.LBB6_13
.LBB6_12:                               # %call.sqrt
                                        #   in Loop: Header=BB6_1 Depth=1
	callq	sqrt
	movsd	.LCPI6_4(%rip), %xmm11          # xmm11 = mem[0],zero
	xorpd	%xmm10, %xmm10
	movsd	.LCPI6_3(%rip), %xmm9           # xmm9 = mem[0],zero
	movsd	.LCPI6_2(%rip), %xmm8           # xmm8 = mem[0],zero
	movsd	.LCPI6_1(%rip), %xmm7           # xmm7 = mem[0],zero
	movsd	.LCPI6_0(%rip), %xmm6           # xmm6 = mem[0],zero
	movsd	(%rsp), %xmm5                   # 8-byte Reload
                                        # xmm5 = mem[0],zero
.LBB6_13:                               # %._crit_edge61.split
                                        #   in Loop: Header=BB6_1 Depth=1
	movl	domain(%rip), %eax
	xorps	%xmm1, %xmm1
	cvtsi2sd	%eax, %xmm1
	divsd	%xmm1, %xmm0
	ucomisd	%xmm0, %xmm11
	ja	.LBB6_16
.LBB6_14:                               #   in Loop: Header=BB6_1 Depth=1
	cmpl	$39999, %r15d                   # imm = 0x9C3F
	leal	1(%r15), %ecx
	setb	%bpl
	movl	%ecx, %r15d
	cmpl	$40000, %ecx                    # imm = 0x9C40
	jne	.LBB6_1
# %bb.15:                               # %.thread
	movl	$.L.str.7, %edi
	movb	$1, %al
	callq	printf
.LBB6_16:                               # %.loopexit
	andb	$1, %bpl
	movl	%ebp, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_Z14SolvePotentialPdS_, .Lfunc_end6-_Z14SolvePotentialPdS_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z9ComputeEFPdS_S_
.LCPI7_0:
	.quad	0x8000000000000000              # double -0
	.quad	0x8000000000000000              # double -0
	.text
	.globl	_Z9ComputeEFPdS_S_
	.type	_Z9ComputeEFPdS_S_,@function
_Z9ComputeEFPdS_S_:                     # @_Z9ComputeEFPdS_S_
	.cfi_startproc
# %bb.0:
	movq	%rdx, %rax
	movslq	domain(%rip), %rdx
	leal	-1(%rdx), %ecx
	cmpq	$3, %rdx
	jl	.LBB7_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%ecx, %r8d
	decq	%r8
	xorl	%r9d, %r9d
	movapd	.LCPI7_0(%rip), %xmm0           # xmm0 = [-0.0E+0,-0.0E+0]
.LBB7_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	16(%rdi,%r9,8), %xmm1           # xmm1 = mem[0],zero
	subsd	(%rdi,%r9,8), %xmm1
	xorpd	%xmm0, %xmm1
	movsd	domain+16(%rip), %xmm2          # xmm2 = mem[0],zero
	addsd	%xmm2, %xmm2
	divsd	%xmm2, %xmm1
	movsd	%xmm1, 8(%rsi,%r9,8)
	incq	%r9
	cmpq	%r9, %r8
	jne	.LBB7_2
.LBB7_3:                                # %._crit_edge
	pushq	%rax
	.cfi_def_cfa_offset 16
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	subsd	(%rdi), %xmm0
	movapd	.LCPI7_0(%rip), %xmm1           # xmm1 = [-0.0E+0,-0.0E+0]
	xorpd	%xmm1, %xmm0
	divsd	domain+16(%rip), %xmm0
	movsd	%xmm0, (%rsi)
	movslq	%ecx, %rcx
	movsd	(%rdi,%rcx,8), %xmm0            # xmm0 = mem[0],zero
	subsd	-16(%rdi,%rdx,8), %xmm0
	xorpd	%xmm1, %xmm0
	divsd	domain+16(%rip), %xmm0
	movsd	%xmm0, (%rsi,%rcx,8)
	shlq	$3, %rdx
	movq	%rax, %rdi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_ZL10CUDA_ERROR10hipError_t     # TAILCALL
.Lfunc_end7:
	.size	_Z9ComputeEFPdS_S_, .Lfunc_end7-_Z9ComputeEFPdS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z13RewindSpeciesP7SpeciesPd    # -- Begin function _Z13RewindSpeciesP7SpeciesPd
	.type	_Z13RewindSpeciesP7SpeciesPd,@function
_Z13RewindSpeciesP7SpeciesPd:           # @_Z13RewindSpeciesP7SpeciesPd
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, 16(%rsp)                 # 8-byte Spill
	movl	28(%rdi), %eax
	leal	255(%rax), %edi
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$8, %edi
	incl	%edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$256, %rdx                      # imm = 0x100
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	je	.LBB8_2
# %bb.1:
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.LBB8_2:
	.cfi_def_cfa_offset 48
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	8(%rsp), %xmm0                  # 8-byte Folded Reload
	movq	40(%r14), %rdi
	movslq	28(%r14), %rdx
	movq	%rbx, %rsi
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_Z29__device_stub__rewindParticleP8ParticlePddl # TAILCALL
.Lfunc_end8:
	.size	_Z13RewindSpeciesP7SpeciesPd, .Lfunc_end8-_Z13RewindSpeciesP7SpeciesPd
	.cfi_endproc
                                        # -- End function
	.globl	_Z12WriteResultsi               # -- Begin function _Z12WriteResultsi
	.type	_Z12WriteResultsi,@function
_Z12WriteResultsi:                      # @_Z12WriteResultsi
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	%edi, %ecx
	movq	file_res(%rip), %rdi
	movl	domain(%rip), %edx
	movl	$.L.str.8, %esi
	xorl	%eax, %eax
	callq	fprintf
	cmpl	$0, domain(%rip)
	jle	.LBB9_3
# %bb.1:                                # %.lr.ph.preheader
	xorl	%ebx, %ebx
.LBB9_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	file_res(%rip), %rdi
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ebx, %xmm0
	mulsd	domain+16(%rip), %xmm0
	movq	domain+72(%rip), %rax
	xorps	%xmm1, %xmm1
	cvtss2sd	(%rax,%rbx,4), %xmm1
	movq	domain+64(%rip), %rax
	xorps	%xmm2, %xmm2
	cvtss2sd	(%rax,%rbx,4), %xmm2
	movq	domain+56(%rip), %rax
	movsd	(%rax,%rbx,8), %xmm3            # xmm3 = mem[0],zero
	movq	domain+40(%rip), %rax
	movsd	(%rax,%rbx,8), %xmm4            # xmm4 = mem[0],zero
	movq	domain+48(%rip), %rax
	movsd	(%rax,%rbx,8), %xmm5            # xmm5 = mem[0],zero
	movl	$.L.str.9, %esi
	movb	$6, %al
	callq	fprintf
	incq	%rbx
	movslq	domain(%rip), %rax
	cmpq	%rax, %rbx
	jl	.LBB9_2
.LBB9_3:                                # %._crit_edge
	movq	file_res(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	fflush                          # TAILCALL
.Lfunc_end9:
	.size	_Z12WriteResultsi, .Lfunc_end9-_Z12WriteResultsi
	.cfi_endproc
                                        # -- End function
	.globl	_Z11PushSpeciesP7SpeciesPd      # -- Begin function _Z11PushSpeciesP7SpeciesPd
	.type	_Z11PushSpeciesP7SpeciesPd,@function
_Z11PushSpeciesP7SpeciesPd:             # @_Z11PushSpeciesP7SpeciesPd
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, 16(%rsp)                 # 8-byte Spill
	movl	28(%rdi), %eax
	leal	255(%rax), %edi
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$8, %edi
	incl	%edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$256, %rdx                      # imm = 0x100
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	je	.LBB10_2
# %bb.1:
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.LBB10_2:
	.cfi_def_cfa_offset 48
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	8(%rsp), %xmm0                  # 8-byte Folded Reload
	movq	40(%r14), %rdi
	movslq	28(%r14), %rdx
	movq	%rbx, %rsi
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_Z27__device_stub__pushParticleP8ParticlePddl # TAILCALL
.Lfunc_end10:
	.size	_Z11PushSpeciesP7SpeciesPd, .Lfunc_end10-_Z11PushSpeciesP7SpeciesPd
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z3rndv
.LCPI11_0:
	.quad	0x41dfffffffc00000              # double 2147483647
	.text
	.globl	_Z3rndv
	.type	_Z3rndv,@function
_Z3rndv:                                # @_Z3rndv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	rand
	cvtsi2sd	%eax, %xmm0
	divsd	.LCPI11_0(%rip), %xmm0
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end11:
	.size	_Z3rndv, .Lfunc_end11-_Z3rndv
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__scatterParticleP8ParticlePfl # -- Begin function _Z30__device_stub__scatterParticleP8ParticlePfl
	.type	_Z30__device_stub__scatterParticleP8ParticlePfl,@function
_Z30__device_stub__scatterParticleP8ParticlePfl: # @_Z30__device_stub__scatterParticleP8ParticlePfl
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	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	$_Z15scatterParticleP8ParticlePfl, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end12:
	.size	_Z30__device_stub__scatterParticleP8ParticlePfl, .Lfunc_end12-_Z30__device_stub__scatterParticleP8ParticlePfl
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z20SolvePotentialDirectPdS_
.LCPI13_0:
	.quad	0xbda37876f16466bc              # double -8.8541878200000003E-12
	.text
	.globl	_Z20SolvePotentialDirectPdS_
	.type	_Z20SolvePotentialDirectPdS_,@function
_Z20SolvePotentialDirectPdS_:           # @_Z20SolvePotentialDirectPdS_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movslq	domain(%rip), %rbp
	leaq	(,%rbp,8), %rax
	testq	%rbp, %rbp
	movsd	domain+16(%rip), %xmm0          # xmm0 = mem[0],zero
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	movq	$-1, %r13
	cmovnsq	%rax, %r13
	movq	%r13, %rdi
	callq	_Znam
	movq	%rax, %r14
	movq	%r13, %rdi
	callq	_Znam
	movq	%rax, %r15
	movq	%r13, %rdi
	callq	_Znam
	leal	-1(%rbp), %esi
	movl	%ebp, %ecx
	movl	%esi, %edx
	movabsq	$4607182418800017408, %rdi      # imm = 0x3FF0000000000000
	cmpq	$3, %rbp
	jl	.LBB13_3
# %bb.1:                                # %.lr.ph.preheader
	movl	$1, %r8d
	movabsq	$-4611686018427387904, %r9      # imm = 0xC000000000000000
.LBB13_2:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%rdi, (%r14,%r8,8)
	movq	%r9, (%r15,%r8,8)
	movq	%rdi, (%rax,%r8,8)
	incq	%r8
	cmpq	%r8, %rdx
	jne	.LBB13_2
.LBB13_3:                               # %._crit_edge
	xorl	%r8d, %r8d
	movq	%rdi, (%r15)
	movq	%r8, (%rax)
	movslq	%esi, %rsi
	movq	%r8, (%r14,%rsi,8)
	movq	%rdi, (%r15,%rsi,8)
	movq	%r8, (%rax,%rsi,8)
	cmpl	$3, %ecx
	movsd	(%rsp), %xmm2                   # 8-byte Reload
                                        # xmm2 = mem[0],zero
	jl	.LBB13_6
# %bb.4:                                # %.lr.ph71.preheader
	mulsd	%xmm2, %xmm2
	movl	$1, %edi
	movsd	.LCPI13_0(%rip), %xmm0          # xmm0 = mem[0],zero
.LBB13_5:                               # %.lr.ph71
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%r12,%rdi,8), %xmm1            # xmm1 = mem[0],zero
	mulsd	%xmm2, %xmm1
	divsd	%xmm0, %xmm1
	movsd	%xmm1, (%rbx,%rdi,8)
	incq	%rdi
	cmpq	%rdi, %rdx
	jne	.LBB13_5
.LBB13_6:                               # %._crit_edge72
	xorl	%edx, %edx
	movq	%rdx, (%rbx)
	movq	%rdx, (%rbx,%rsi,8)
	movsd	(%r15), %xmm2                   # xmm2 = mem[0],zero
	movsd	(%rax), %xmm0                   # xmm0 = mem[0],zero
	divsd	%xmm2, %xmm0
	movsd	%xmm0, (%rax)
	movsd	(%rbx), %xmm1                   # xmm1 = mem[0],zero
	divsd	%xmm2, %xmm1
	movsd	%xmm1, (%rbx)
	cmpl	$2, %ecx
	jl	.LBB13_12
# %bb.7:                                # %.lr.ph75.preheader
	movl	$1, %edx
.LBB13_8:                               # %.lr.ph75
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%r15,%rdx,8), %xmm2            # xmm2 = mem[0],zero
	movsd	(%r14,%rdx,8), %xmm3            # xmm3 = mem[0],zero
	mulsd	%xmm3, %xmm0
	subsd	%xmm0, %xmm2
	movsd	(%rax,%rdx,8), %xmm0            # xmm0 = mem[0],zero
	divsd	%xmm2, %xmm0
	movsd	%xmm0, (%rax,%rdx,8)
	movsd	(%rbx,%rdx,8), %xmm4            # xmm4 = mem[0],zero
	mulsd	%xmm3, %xmm1
	subsd	%xmm1, %xmm4
	divsd	%xmm2, %xmm4
	movsd	%xmm4, (%rbx,%rdx,8)
	incq	%rdx
	movapd	%xmm4, %xmm1
	cmpq	%rdx, %rcx
	jne	.LBB13_8
# %bb.9:                                # %._crit_edge76
	cmpl	$2, %ecx
	jl	.LBB13_12
# %bb.10:                               # %.lr.ph79.preheader
	addl	$-2, %ecx
	movsd	8(%rbx,%rcx,8), %xmm0           # xmm0 = mem[0],zero
.LBB13_11:                              # %.lr.ph79
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%rbx,%rcx,8), %xmm1            # xmm1 = mem[0],zero
	mulsd	(%rax,%rcx,8), %xmm0
	subsd	%xmm0, %xmm1
	movsd	%xmm1, (%rbx,%rcx,8)
	movapd	%xmm1, %xmm0
	addq	$-1, %rcx
	jb	.LBB13_11
.LBB13_12:                              # %._crit_edge80
	movb	$1, %al
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end13:
	.size	_Z20SolvePotentialDirectPdS_, .Lfunc_end13-_Z20SolvePotentialDirectPdS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z27__device_stub__pushParticleP8ParticlePddl # -- Begin function _Z27__device_stub__pushParticleP8ParticlePddl
	.type	_Z27__device_stub__pushParticleP8ParticlePddl,@function
_Z27__device_stub__pushParticleP8ParticlePddl: # @_Z27__device_stub__pushParticleP8ParticlePddl
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	24(%rsp), %rsi
	movsd	%xmm0, (%rsi)
	leaq	16(%rsp), %rdi
	movq	%rdx, (%rdi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdi, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%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	$_Z12pushParticleP8ParticlePddl, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end14:
	.size	_Z27__device_stub__pushParticleP8ParticlePddl, .Lfunc_end14-_Z27__device_stub__pushParticleP8ParticlePddl
	.cfi_endproc
                                        # -- End function
	.globl	_Z29__device_stub__rewindParticleP8ParticlePddl # -- Begin function _Z29__device_stub__rewindParticleP8ParticlePddl
	.type	_Z29__device_stub__rewindParticleP8ParticlePddl,@function
_Z29__device_stub__rewindParticleP8ParticlePddl: # @_Z29__device_stub__rewindParticleP8ParticlePddl
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	24(%rsp), %rsi
	movsd	%xmm0, (%rsi)
	leaq	16(%rsp), %rdi
	movq	%rdx, (%rdi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdi, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%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	$_Z14rewindParticleP8ParticlePddl, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end15:
	.size	_Z29__device_stub__rewindParticleP8ParticlePddl, .Lfunc_end15-_Z29__device_stub__rewindParticleP8ParticlePddl
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z4XtoLd
.LCPI16_0:
	.quad	0x3f1a36e2eb1c432d              # double 1.0E-4
	.text
	.globl	_Z4XtoLd
	.type	_Z4XtoLd,@function
_Z4XtoLd:                               # @_Z4XtoLd
	.cfi_startproc
# %bb.0:
	divsd	.LCPI16_0(%rip), %xmm0
	retq
.Lfunc_end16:
	.size	_Z4XtoLd, .Lfunc_end16-_Z4XtoLd
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z7scatterddPd
.LCPI17_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z7scatterddPd
	.type	_Z7scatterddPd,@function
_Z7scatterddPd:                         # @_Z7scatterddPd
	.cfi_startproc
# %bb.0:
	cvttsd2si	%xmm0, %eax
	cvttpd2dq	%xmm0, %xmm2
	cvtdq2pd	%xmm2, %xmm2
	subsd	%xmm2, %xmm0
	movsd	.LCPI17_0(%rip), %xmm2          # xmm2 = mem[0],zero
	subsd	%xmm0, %xmm2
	mulsd	%xmm1, %xmm2
	cltq
	addsd	(%rdi,%rax,8), %xmm2
	movsd	%xmm2, (%rdi,%rax,8)
	mulsd	%xmm1, %xmm0
	addsd	8(%rdi,%rax,8), %xmm0
	movsd	%xmm0, 8(%rdi,%rax,8)
	retq
.Lfunc_end17:
	.size	_Z7scatterddPd, .Lfunc_end17-_Z7scatterddPd
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z6gatherdPd
.LCPI18_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z6gatherdPd
	.type	_Z6gatherdPd,@function
_Z6gatherdPd:                           # @_Z6gatherdPd
	.cfi_startproc
# %bb.0:
	cvttsd2si	%xmm0, %eax
	cvttpd2dq	%xmm0, %xmm1
	cvtdq2pd	%xmm1, %xmm1
	subsd	%xmm1, %xmm0
	cltq
	movsd	.LCPI18_0(%rip), %xmm1          # xmm1 = mem[0],zero
	subsd	%xmm0, %xmm1
	mulsd	(%rdi,%rax,8), %xmm1
	mulsd	8(%rdi,%rax,8), %xmm0
	addsd	%xmm1, %xmm0
	retq
.Lfunc_end18:
	.size	_Z6gatherdPd, .Lfunc_end18-_Z6gatherdPd
	.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	.LBB19_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB19_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z15scatterParticleP8ParticlePfl, %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	$_Z12pushParticleP8ParticlePddl, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z14rewindParticleP8ParticlePddl, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %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_end19:
	.size	__hip_module_ctor, .Lfunc_end19-__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	.LBB20_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
.LBB20_2:
	retq
.Lfunc_end20:
	.size	__hip_module_dtor, .Lfunc_end20-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	domain,@object                  # @domain
	.data
	.globl	domain
	.p2align	3, 0x0
domain:
	.long	101                             # 0x65
	.zero	4
	.quad	0x0000000000000000              # double 0
	.quad	0x3f1a36e2eb1c432d              # double 1.0E-4
	.quad	0x3f847ae147ae147b              # double 0.01
	.quad	0x3f847ae147ae147b              # double 0.01
	.quad	0
	.quad	0
	.quad	0
	.quad	0
	.quad	0
	.size	domain, 80

	.type	file_res,@object                # @file_res
	.bss
	.globl	file_res
	.p2align	3, 0x0
file_res:
	.quad	0
	.size	file_res, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Found GPU '%s' with %g Gb of global memory, max %d threads per block, and %d multiprocessors\n"
	.size	.L.str, 94

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"results.dat"
	.size	.L.str.1, 12

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"VARIABLES = x nde ndi rho phi ef\n"
	.size	.L.str.3, 34

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"TS:%i\tnp_i:%d\tnp_e:%d\tdphi:%.3g\n"
	.size	.L.str.4, 33

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Time per time step: %.3g ms\n"
	.size	.L.str.5, 29

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

	.type	.L.str.7,@object                # @.str.7
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.7:
	.asciz	"Gauss-Seidel solver failed to converge, L2=%.3g!\n"
	.size	.L.str.7, 50

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

	.type	_Z14rewindParticleP8ParticlePddl,@object # @_Z14rewindParticleP8ParticlePddl
	.globl	_Z14rewindParticleP8ParticlePddl
	.p2align	3, 0x0
_Z14rewindParticleP8ParticlePddl:
	.quad	_Z29__device_stub__rewindParticleP8ParticlePddl
	.size	_Z14rewindParticleP8ParticlePddl, 8

	.type	.L.str.8,@object                # @.str.8
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.8:
	.asciz	"ZONE I=%d T=ZONE_%06d\n"
	.size	.L.str.8, 23

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"%g %g %g %g %g %g\n"
	.size	.L.str.9, 19

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"CUDA ERROR: %s, exiting\n"
	.size	.L.str.10, 25

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z15scatterParticleP8ParticlePfl"
	.size	.L__unnamed_1, 33

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z12pushParticleP8ParticlePddl"
	.size	.L__unnamed_2, 31

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z14rewindParticleP8ParticlePddl"
	.size	.L__unnamed_3, 33

	.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	"Too many particles!"
	.size	.Lstr, 20

	.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 _Z30__device_stub__scatterParticleP8ParticlePfl
	.addrsig_sym _Z27__device_stub__pushParticleP8ParticlePddl
	.addrsig_sym _Z29__device_stub__rewindParticleP8ParticlePddl
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z15scatterParticleP8ParticlePfl
	.addrsig_sym _Z12pushParticleP8ParticlePddl
	.addrsig_sym _Z14rewindParticleP8ParticlePddl
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z15scatterParticleP8ParticlePfl ; -- Begin function _Z15scatterParticleP8ParticlePfl
	.globl	_Z15scatterParticleP8ParticlePfl
	.p2align	8
	.type	_Z15scatterParticleP8ParticlePfl,@function
_Z15scatterParticleP8ParticlePfl:       ; @_Z15scatterParticleP8ParticlePfl
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x24
	s_load_b64 s[2:3], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_mov_b32_e32 v2, 0
	v_cmp_gt_i64_e32 vcc_lo, s[2:3], v[1:2]
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB0_6
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[2:3], null, v1, 24, s[0:1]
	s_mov_b32 s0, 0
	global_load_u8 v0, v[2:3], off offset:16
	s_waitcnt vmcnt(0)
	v_cmp_ne_u16_e32 vcc_lo, 0, v0
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_6
; %bb.2:
	global_load_b64 v[0:1], v[2:3], off
	s_mov_b32 s4, 0xeb1c432d
	s_mov_b32 s5, 0x3f1a36e2
	s_waitcnt vmcnt(0)
	v_div_scale_f64 v[2:3], null, s[4:5], s[4:5], v[0:1]
	v_div_scale_f64 v[8:9], vcc_lo, v[0:1], s[4:5], v[0:1]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[4:5], v[2:3]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0
	v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0
	v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[6:7], v[8:9], v[4:5]
	v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]
	v_div_fixup_f64 v[4:5], v[2:3], s[4:5], v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_i32_f64_e32 v2, v[4:5]
	v_ashrrev_i32_e32 v3, 31, v2
	v_cvt_f64_i32_e32 v[6:7], v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[2:3]
	v_add_co_u32 v0, vcc_lo, s2, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	global_load_b32 v3, v[0:1], off
	v_add_f64 v[4:5], v[4:5], -v[6:7]
	v_cvt_f32_f64_e32 v4, v[4:5]
	s_delay_alu instid0(VALU_DEP_1)
	v_sub_f32_e32 v5, 1.0, v4
.LBB0_3:                                ; %atomicrmw.start
                                        ; =>This Inner Loop Header: Depth=1
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_add_f32_e32 v2, v3, v5
	global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off glc
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, v2, v3
	v_mov_b32_e32 v3, v2
	s_or_b32 s0, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s0
	s_cbranch_execnz .LBB0_3
; %bb.4:                                ; %atomicrmw.end
	s_or_b32 exec_lo, exec_lo, s0
	global_load_b32 v3, v[0:1], off offset:4
	s_mov_b32 s0, 0
.LBB0_5:                                ; %atomicrmw.start10
                                        ; =>This Inner Loop Header: Depth=1
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v2, v3, v4
	global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:4 glc
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, v2, v3
	v_mov_b32_e32 v3, v2
	s_or_b32 s0, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s0
	s_cbranch_execnz .LBB0_5
.LBB0_6:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15scatterParticleP8ParticlePfl
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 10
		.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	_Z15scatterParticleP8ParticlePfl, .Lfunc_end0-_Z15scatterParticleP8ParticlePfl
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 424
; NumSgprs: 18
; NumVgprs: 10
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 10
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z12pushParticleP8ParticlePddl ; -- Begin function _Z12pushParticleP8ParticlePddl
	.globl	_Z12pushParticleP8ParticlePddl
	.p2align	8
	.type	_Z12pushParticleP8ParticlePddl,@function
_Z12pushParticleP8ParticlePddl:         ; @_Z12pushParticleP8ParticlePddl
; %bb.0:
	s_clause 0x1
	s_load_b32 s8, s[0:1], 0x2c
	s_load_b256 s[0:7], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s8, s8, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[2:3], null, s15, s8, v[0:1]
	v_mov_b32_e32 v3, 0
	v_cmp_gt_i64_e32 vcc_lo, s[6:7], v[2:3]
	s_and_saveexec_b32 s6, vcc_lo
	s_cbranch_execz .LBB1_4
; %bb.1:
	v_mad_u64_u32 v[0:1], null, v2, 24, s[0:1]
	global_load_u8 v2, v[0:1], off offset:16
	s_waitcnt vmcnt(0)
	v_cmp_ne_u16_e32 vcc_lo, 0, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB1_4
; %bb.2:
	global_load_b128 v[2:5], v[0:1], off
	s_mov_b32 s0, 0xeb1c432d
	s_mov_b32 s1, 0x3f1a36e2
	s_waitcnt vmcnt(0)
	v_div_scale_f64 v[6:7], null, s[0:1], s[0:1], v[2:3]
	v_div_scale_f64 v[12:13], vcc_lo, v[2:3], s[0:1], v[2:3]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[8:9], v[6:7]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[10:11], v[12:13], v[8:9]
	v_fma_f64 v[6:7], -v[6:7], v[10:11], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[6:7], v[6:7], v[8:9], v[10:11]
	v_div_fixup_f64 v[10:11], v[6:7], s[0:1], v[2:3]
	s_mov_b32 s0, 0xe1796495
	s_mov_b32 s1, 0x3da5fd7f
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_i32_f64_e32 v12, v[10:11]
	v_ashrrev_i32_e32 v13, 31, v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[6:7], 3, v[12:13]
	v_cvt_f64_i32_e32 v[12:13], v12
	v_add_co_u32 v6, vcc_lo, s2, v6
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v7, vcc_lo, s3, v7, vcc_lo
	global_load_b128 v[6:9], v[6:7], off
	v_add_f64 v[10:11], v[10:11], -v[12:13]
	v_add_f64 v[12:13], -v[10:11], 1.0
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_f64 v[6:7], v[6:7], v[12:13]
	v_mul_f64 v[12:13], s[4:5], s[0:1]
	v_fma_f64 v[6:7], v[8:9], v[10:11], v[6:7]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[4:5], v[12:13], v[6:7], v[4:5]
	v_fma_f64 v[2:3], v[4:5], s[0:1], v[2:3]
	s_mov_b32 s0, 0x47ae147b
	s_mov_b32 s1, 0x3f847ae1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(SALU_CYCLE_1)
	v_cmp_gt_f64_e32 vcc_lo, 0, v[2:3]
	v_cmp_le_f64_e64 s0, s[0:1], v[2:3]
	global_store_b128 v[0:1], v[2:5], off
	s_or_b32 s0, vcc_lo, s0
	s_and_b32 exec_lo, exec_lo, s0
	s_cbranch_execz .LBB1_4
; %bb.3:
	v_add_co_u32 v0, vcc_lo, v0, 16
	v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
	v_mov_b32_e32 v2, 0
	global_store_b8 v[0:1], v2, off
.LBB1_4:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z12pushParticleP8ParticlePddl
		.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 14
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z12pushParticleP8ParticlePddl, .Lfunc_end1-_Z12pushParticleP8ParticlePddl
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 448
; NumSgprs: 18
; NumVgprs: 14
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 14
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z14rewindParticleP8ParticlePddl ; -- Begin function _Z14rewindParticleP8ParticlePddl
	.globl	_Z14rewindParticleP8ParticlePddl
	.p2align	8
	.type	_Z14rewindParticleP8ParticlePddl,@function
_Z14rewindParticleP8ParticlePddl:       ; @_Z14rewindParticleP8ParticlePddl
; %bb.0:
	s_clause 0x1
	s_load_b32 s8, s[0:1], 0x2c
	s_load_b256 s[0:7], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s8, s8, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[2:3], null, s15, s8, v[0:1]
	v_mov_b32_e32 v3, 0
	v_cmp_gt_i64_e32 vcc_lo, s[6:7], v[2:3]
	s_and_saveexec_b32 s6, vcc_lo
	s_cbranch_execz .LBB2_3
; %bb.1:
	v_mad_u64_u32 v[0:1], null, v2, 24, s[0:1]
	global_load_u8 v2, v[0:1], off offset:16
	s_waitcnt vmcnt(0)
	v_cmp_ne_u16_e32 vcc_lo, 0, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB2_3
; %bb.2:
	global_load_b128 v[2:5], v[0:1], off
	s_mov_b32 s0, 0xeb1c432d
	s_mov_b32 s1, 0x3f1a36e2
	s_waitcnt vmcnt(0)
	v_div_scale_f64 v[6:7], null, s[0:1], s[0:1], v[2:3]
	v_div_scale_f64 v[12:13], vcc_lo, v[2:3], s[0:1], v[2:3]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[8:9], v[6:7]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[10:11], v[12:13], v[8:9]
	v_fma_f64 v[6:7], -v[6:7], v[10:11], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[6:7], v[6:7], v[8:9], v[10:11]
	v_div_fixup_f64 v[2:3], v[6:7], s[0:1], v[2:3]
	s_mov_b32 s0, 0xe1796495
	s_mov_b32 s1, 0xbd95fd7f
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_i32_f64_e32 v10, v[2:3]
	v_ashrrev_i32_e32 v11, 31, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[6:7], 3, v[10:11]
	v_cvt_f64_i32_e32 v[10:11], v10
	v_add_co_u32 v6, vcc_lo, s2, v6
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v7, vcc_lo, s3, v7, vcc_lo
	global_load_b128 v[6:9], v[6:7], off
	v_add_f64 v[2:3], v[2:3], -v[10:11]
	v_add_f64 v[10:11], -v[2:3], 1.0
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[6:7], v[6:7], v[10:11]
	v_fma_f64 v[2:3], v[8:9], v[2:3], v[6:7]
	v_mul_f64 v[6:7], s[4:5], s[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]
	global_store_b64 v[0:1], v[2:3], off offset:8
.LBB2_3:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14rewindParticleP8ParticlePddl
		.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 14
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z14rewindParticleP8ParticlePddl, .Lfunc_end2-_Z14rewindParticleP8ParticlePddl
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 372
; NumSgprs: 18
; NumVgprs: 14
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 14
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

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

	.end_amdgpu_metadata
