//To compile should add "-lfftw3 -lgsl"
#include <stdio.h>
#include <math.h>
// #include <gsl/gsl_rng.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
#include <time.h>
//#include <fftw3.h>
#include <complex>
#include <cufft.h>
using namespace std;

struct particle3D{
	int number;
	double *mass;
	double *x;
	double *y;
	double *z;
	double *Fx;
	double *Fy;
	double *Fz;
	double *vx;
	double *vy;
	double *vz;
};
struct grid3D{
	double L;
	int Nx;
	int Ny;
	int Nz;
	int N;
	double dx;
	double dy;
	double dz;
	double *phi;
	double *density;
	double *Fx;
	double *Fy;
	double *Fz;
};
struct rk43D{
    int step1;
    int step2;
    double *ax;
    double *ay;
	double *az;
    double *vx;
    double *vy;
	double *vz;
};
__global__
void phiToForce(double* phi,double* Fx,double* Fy,double* Fz,int Nx,double L,double nConst){
	int N = Nx*Nx*Nx;
	int const Ny = Nx;
  	int const Nz = Nx;
	double dx = L / Nx;
	double factor = -1./(2.0*dx) * nConst;

	int index = blockDim.x * blockIdx.x + threadIdx.x;
    
    while(index < N){
    	int ii = index / (Ny*Nz);
    	int jj = (index / Nz) % Ny;
    	int kk = index % Nz;
    	Fx[index] = factor*( phi[ ( (ii+1)%Nx )*Ny*Nz + jj*Nz + kk ] 
                              - phi[ ( (Nx+ii-1)%Nx )*Ny*Nz + jj*Nz + kk ] );

    	Fy[index] = factor*( phi[ ii*Ny*Nz + ( (jj+1)%Ny )*Nz + kk ] 
                              - phi[ ii*Ny*Nz + ( (Ny+jj-1)%Ny )*Nz + kk ] );  

  		Fz[index] = factor*( phi[ ii*Ny*Nz  + jj*Nz + ((kk+1)%Nz)] 
                              - phi[ ii*Ny*Nz  + jj*Nz + ((Nz+kk-1)%Nz)]);
    	index += blockDim.x*gridDim.x;
    }

}
__global__
void overk2(double *out,int Nx,int Ny,int Nzh){
	//Notice that *out actullay is a compelx <double> pointer array.

	int N = Nx*Ny*Nzh;
	int index = blockDim.x * blockIdx.x + threadIdx.x;
	int fi,fj;
	double kxx,kyy,kzz;

    while(index < N){
    	int ii = index / (Ny*Nzh);
    	int jj = (index / Nzh) % Ny;
    	int kk = index % Nzh;

    	if (2*ii < Nx) {fi = ii;}
		else           {fi = Nx-ii;}
		if (2*jj < Ny) {fj = jj;}
		else           {fj = Ny-jj;}

		kxx = 1.0*fi*fi;
		kyy = 1.0*fj*fj;
		kzz = 1.0*kk*kk;

		if(index != 0){
			//ii != 0 || jj != 0 || kk!=0
			out[2*index] = out[2*index] / (kxx+kyy+kzz);		//real part
			out[2*index+1] = out[2*index+1] / (kxx+kyy+kzz);	//imaginary part
		}   	

    	index += blockDim.x*gridDim.x;
    }
}

void Weight(struct grid3D *grid,struct particle3D *particle,int type);
void WeightForce(struct grid3D *grid,struct particle3D *particle,int type);
void poisson_solver_fft_force_3d(int const dim, struct grid3D *grid);
void _2nd_order_diff_3d(struct grid3D *grid, int const ii, int const jj, int const kk );
void _2nd_order_diff_3d_cuda(struct grid3D *grid);
void calculateGreenFFT(struct grid3D *grid, complex<double>* fftgf);
void isolatedPotential(struct grid3D *grid, complex<double>* fftgf);


void kick(struct particle3D *particle , double dt);
void drift(struct particle3D *particle , double dt);
void init_rk4(struct particle3D *particle, struct particle3D *buff, struct rk43D *rk4);
void rk4_mid(struct particle3D *particle, struct particle3D *buff, struct rk43D *rk4, double dt, int weighting);
void rk4_end(struct particle3D *particle, struct rk43D *rk4, double dt);
void periodic_boundary(double position, double length);
void boundary_check(int boundary, struct particle3D *particle, double L);

//Functions to locate memory and free memory of different struct.
void locateMemoryParticle(struct particle3D *particle,int N);
void freeMemoryParticle(struct particle3D *particle);
void locateMemoryRk4(struct rk43D *rk4,int N);
void freeMemoryRk4(struct rk43D *rk4);
void locateMemoryGrid(struct grid3D *grid);
void freeMemoryGrid(struct grid3D *grid);


int main( int argc, char *argv[] ){
	//================Simulation Constants
	int weightFunction = 1;  	//0/1/2 : NGP/CIC/TSC
	int orbitIntegration = 1;	//0/1/2 : KDK/DKD/RK4
	int poissonSolver = 0;		//0/1   : fft/isolated
	int boundary = 0;           //0/1/2 : periodic/isolated/no boundary
	int dim = 3;				
	double L = 10.0;				//Length of box (from -L/2 ~ L/2)
	int Nx = 256;				//Number of grid in x direction. (should be odd number)
	int NParticle=2;//Number of particles used in simulation
	//double massParticle=1.0;
	double dt = 1.0e-2;
	double G = 1.0;
	double T,r1_0,r2_0;
	cudaEvent_t start, stop;	//For cuda timing
	float totalTime;
	
	//================Structs
	struct grid3D grid;
	struct particle3D myParticle;
	struct particle3D buffParticle;		//If not RK4 mode , it will not be malloc and free
	struct rk43D myrk4;					//If not RK4 mode , it will not be malloc and free
	complex<double>* fftgf;

	cudaEventCreate(&start);
	cudaEventCreate(&stop);
 	cudaEventRecord(start,0);

 	

	//Output to a file
	FILE *output;
	output = fopen("result.txt","w");
	//================Random number generator.
		//To use : d=gsl_rng_uniform(rng);
		// gsl_rng *rng;
		// rng = gsl_rng_alloc(gsl_rng_mt19937);
		// gsl_rng_set(rng,123456);//The seed is 123456.

	//================Initialize Grid Parameter=========== 
		
		grid.L = L;		
		grid.Nx = Nx;		
		grid.Ny = grid.Nx;
		grid.Nz = grid.Nx;
		grid.N = grid.Nx * grid.Ny * grid.Nz;
		grid.dx = grid.L / (grid.Nx-1);	//-1 is because boundary (make box closed)
		grid.dy = grid.L / (grid.Ny-1);
		grid.dz = grid.L / (grid.Nz-1);
		locateMemoryGrid(&grid);

	//================Initialize Particles ======
		
		myParticle.number = NParticle;
		locateMemoryParticle(&myParticle,NParticle);

		if(orbitIntegration == 2){
	//================Initialize Particles for RK4 (buffer)======
			buffParticle.number = NParticle;
			locateMemoryParticle(&buffParticle,NParticle);
	//================Initialize Runge-Kutta Coefficient======
			myrk4.step1 = 0;
			myrk4.step2 = 1;
			locateMemoryRk4(&myrk4,NParticle);
		}

		if(poissonSolver == 1){
			fftgf = (complex<double>*) malloc(sizeof(complex<double>) * 8*grid.N);
			calculateGreenFFT(&grid,fftgf);
		}
      
	
	//Initialize mass of particles
		myParticle.mass[0]=2.0;
		myParticle.mass[1]=1.0;

		if(orbitIntegration == 2){
			buffParticle.mass[0] = myParticle.mass[0];
			buffParticle.mass[1] = myParticle.mass[1];
		}
	//Initialize Initial Position of Particle.
		// for (int i = 0; i < myParticle.number; ++i){
		// 	myParticle.x[i]=gsl_rng_uniform(rng) * grid.L - grid.L/2;
		// 	myParticle.y[i]=gsl_rng_uniform(rng) * grid.L - grid.L/2;
		// 	printf("At (%f,%f) \n",myParticle.x[i],myParticle.y[i]);
		// }
		myParticle.x[0] = 1.0;
		myParticle.y[0] = 0.0;
		myParticle.z[0] = 0.0;
		myParticle.x[1] = -2.0;
		myParticle.y[1] = 0.0;
		myParticle.z[1] = 0.0;
		r1_0 = sqrt(pow(myParticle.x[0],2)+pow(myParticle.y[0],2)+pow(myParticle.z[0],2));
		r2_0 = sqrt(pow(myParticle.x[1],2)+pow(myParticle.y[1],2)+pow(myParticle.z[1],2));

		Weight(&grid,&myParticle,weightFunction);
		
		if(poissonSolver == 0){poisson_solver_fft_force_3d(dim,&grid);}
		else if ( poissonSolver == 1 ){isolatedPotential(&grid,fftgf);}
		
		WeightForce(&grid,&myParticle,weightFunction);

	// //Initialize Initial velocity
		myParticle.vx[0] = 0.0;
		myParticle.vy[0] = -sqrt(fabs(myParticle.Fx[0]*myParticle.x[0])/myParticle.mass[0]);
		myParticle.vz[0] = 0.0;
		myParticle.vx[1] = 0.0;
		myParticle.vy[1] = sqrt(fabs(myParticle.Fx[1]*myParticle.x[1])/myParticle.mass[1]);
		myParticle.vz[1] = 0.0;

		double F_0;
		F_0 = G * myParticle.mass[0] * myParticle.mass[1]/pow(r1_0+r2_0,2);
		T =sqrt(myParticle.mass[0]*4*pow(M_PI,2)*r1_0/F_0);

		//Check whether force is same magnitude but inverse direction.
		printf("%f\t%f\t%f\n",myParticle.Fx[0],myParticle.Fy[0],myParticle.Fz[0]);
		printf("%f\t%f\t%f\n",myParticle.Fx[1],myParticle.Fy[1],myParticle.Fz[1]);
		
	//Time evolution loop
	double t = 0.0;
	for(int st=0;st < 1000;st++){
	 	//Deposit Particles to grid
	 	Weight(&grid,&myParticle,weightFunction);

	 	//Use Fourier Transform to calculate potential and force.
		if ( poissonSolver == 0 )	poisson_solver_fft_force_3d(dim, &grid);
		else if ( poissonSolver == 1 ){isolatedPotential(&grid,fftgf);}

 		//Remap the force to particle.
		WeightForce(&grid,&myParticle,weightFunction);

      

 		//Move particle
		if(orbitIntegration == 0){
 		//KDK scheme
			kick(&myParticle,dt/2);
 			drift(&myParticle,dt);
			boundary_check(boundary, &myParticle, L);
 			Weight(&grid,&myParticle,weightFunction);
			if ( poissonSolver == 0 )       poisson_solver_fft_force_3d(dim, &grid);
			else if ( poissonSolver == 1 ){isolatedPotential(&grid,fftgf);}
			WeightForce(&grid,&myParticle,weightFunction);

 			kick(&myParticle,dt/2);
		}
		else if(orbitIntegration == 1){
 			//DKD scheme
 			drift(&myParticle,dt/2);
			boundary_check(boundary, &myParticle, L);
 			Weight(&grid,&myParticle,weightFunction);
			if ( poissonSolver == 0 )       poisson_solver_fft_force_3d(dim, &grid);
			else if ( poissonSolver == 1 )  isolatedPotential(&grid,fftgf);
			WeightForce(&grid,&myParticle,weightFunction);

 			kick(&myParticle,dt);
 			drift(&myParticle,dt/2);
 		}
		else if(orbitIntegration == 2){
 			//RK4	
			init_rk4(&myParticle,&buffParticle,&myrk4);
			
			rk4_mid(&myParticle,&buffParticle,&myrk4,dt/2,1);        //k1
			boundary_check(boundary, &buffParticle, L);
			Weight(&grid,&buffParticle,weightFunction);
			if ( poissonSolver == 0 )       poisson_solver_fft_force_3d(dim, &grid);
			else if ( poissonSolver == 1 )  isolatedPotential(&grid,fftgf);
			WeightForce(&grid,&buffParticle,weightFunction);
			
			rk4_mid(&myParticle,&buffParticle,&myrk4,dt/2,2);        //k2
			boundary_check(boundary, &buffParticle, L);
			Weight(&grid,&buffParticle,weightFunction);
			if ( poissonSolver == 0 )       poisson_solver_fft_force_3d(dim, &grid);
			else if ( poissonSolver == 1 )  isolatedPotential(&grid,fftgf);
			WeightForce(&grid,&buffParticle,weightFunction);
			
			rk4_mid(&myParticle,&buffParticle,&myrk4,dt,2);          //k3
			boundary_check(boundary, &buffParticle, L);
			Weight(&grid,&buffParticle,weightFunction);
			if ( poissonSolver == 0 )       poisson_solver_fft_force_3d(dim, &grid);
			else if ( poissonSolver == 1 )  isolatedPotential(&grid,fftgf);
			WeightForce(&grid,&buffParticle,weightFunction);
			
			rk4_mid(&myParticle,&buffParticle,&myrk4,dt,1);          //k4
			
			rk4_end(&myParticle,&myrk4,dt);

 		}
		//Boundary Condition
		#ifdef CHECK_THIS_LATER
		if (boundary == 0){
			for (int i=0; i<NParticle; i++){
			       	if ( abs(myParticle.x[i]) > L/2){
					periodic_boundary(myParticle.x[i],L);
				}
				if ( abs(myParticle.y[i]) > L/2){
					periodic_boundary(myParticle.y[i],L);
				}
				if ( abs(myParticle.z[i]) > L/2){
					periodic_boundary(myParticle.z[i],L);
				}
			}	
		}
		else if (boundary == 1){
			for (int i=0; i<NParticle; i++){
				if ( abs(myParticle.x[i]) > L/2 || abs(myParticle.y[i]) > L/2 || abs(myParticle.z[i]) > L/2){
					myParticle.mass[i] = 0;
					cout << "A particle reaches the boundary." << endl;
				}
			}
		}
 		#endif
		boundary_check(boundary, &myParticle, L);

 		//print out the position of particle 1
		if(st % 20 == 0){
			printf("Step:%d\n", st);
			// double momentum_x = 0;
			// double momentum_y = 0;
			// double momentum_z = 0;

   //      		for (int i=0; i<NParticle; i++){
			// 	momentum_x += myParticle.mass[i] * myParticle.vx[i];
			// 	momentum_y += myParticle.mass[i] * myParticle.vy[i];
			// 	momentum_z += myParticle.mass[i] * myParticle.vz[i];
			// }
			// cout << "(px , py,  pz) = (" << momentum_x << ", " << momentum_y << ", " << momentum_z << ")" << endl;
			fprintf(output,"%f\t%f\t",myParticle.x[0],myParticle.y[0]);
			fprintf(output,"%f\t%f\n",myParticle.x[1],myParticle.y[1]);
	
		}
		t+=dt;
 	}
 	cudaEventRecord(stop,0);
	cudaEventSynchronize(stop);
	cudaEventElapsedTime(&totalTime, start, stop);
	printf("Total time : %f\n",totalTime/1000);
		
 	fclose(output);
	freeMemoryGrid(&grid);
	freeMemoryParticle(&myParticle);
	if(orbitIntegration == 2){
		freeMemoryParticle(&buffParticle);
	}
	if(poissonSolver == 1){
		free(fftgf);
	}
	return 0;
}

void poisson_solver_fft_force_3d(int const dim, struct grid3D *grid){
	
	int const Nx = grid->Nx;
	int const Ny = grid->Ny; 
	int const Nz = grid->Nz;
	int const Nzh = (Nz/2+1);
	cufftHandle p1,p2;
	
	double *in;
	complex<double> *out;
	in = (double*) malloc( sizeof(double) * Nx*Ny*Nz );
	out = (complex<double>*) malloc( sizeof(complex<double>) * Nx*Ny*Nzh);
		

	

	/////////// fft ///////////
	cufftDoubleReal *dataIn;
	cufftDoubleComplex *dataOut;
    cudaMalloc((void**)&dataIn, sizeof(cufftDoubleReal)*Nx*Ny*Nz);
    cudaMalloc((void**)&dataOut, sizeof(cufftDoubleComplex)*Nx*Ny*Nzh);
    cudaMemcpy(dataIn, grid->density, sizeof(cufftDoubleReal)*Nx*Ny*Nz, cudaMemcpyHostToDevice);
	
	//cufft
	if (cufftPlan3d(&p1,Nx,Ny,Nz, CUFFT_D2Z) != CUFFT_SUCCESS) {
        printf("CUFFT error: Plan D2Z creation failed.\n");
		exit(1);
    }
    if (cufftExecD2Z(p1, dataIn, dataOut) != CUFFT_SUCCESS) {
		printf("CUFFT error: ExecD2Z forward failed.\n");
		exit(1);
    }
    cudaMemcpy(out, dataOut,sizeof(cufftDoubleComplex)*Nx*Ny*Nzh, cudaMemcpyDeviceToHost);
    cudaDeviceSynchronize();
    cufftDestroy(p1);
    

	double *d_out;
	cudaMalloc((void**)&d_out, sizeof(double)*2*Nx*Ny*Nzh);
	cudaMemcpy(d_out,out,sizeof(double)*2*Nx*Ny*Nzh,cudaMemcpyHostToDevice);

	overk2 <<<128,128>>> (d_out,Nx,Ny,Nzh);

	cudaMemcpy(out,d_out,sizeof(double)*2*Nx*Ny*Nzh,cudaMemcpyDeviceToHost);

	cudaFree(d_out);
	


	/////////// inverse fft ///////////
    cudaMemcpy(dataOut, out,sizeof(cufftDoubleComplex)*Nx*Ny*Nzh, cudaMemcpyHostToDevice);
	
	//cufft
	if (cufftPlan3d(&p2,Nx,Ny,Nz, CUFFT_Z2D) != CUFFT_SUCCESS) {
        printf("CUFFT error: Plan creation failed.\n");
		exit(1);
    }
    if (cufftExecZ2D(p2, dataOut, dataIn) != CUFFT_SUCCESS) {
		printf("CUFFT error: ExecZ2D  failed.\n");
		exit(1);
    }
    cudaMemcpy(in, dataIn, sizeof(cufftDoubleReal)*Nx*Ny*Nz, cudaMemcpyDeviceToHost);
    cudaDeviceSynchronize();
    cufftDestroy(p2);


	/////////// normalization ///////////

	double nConst = -1.0 / M_PI/grid->L;	//Normalization constant.

	double* d_in;
	double* d_Fx; 
	double* d_Fy;
	double* d_Fz;

	int size = grid->N*sizeof(double);

	cudaMalloc((void**)&d_in, size);
	cudaMalloc((void**)&d_Fx, size);
	cudaMalloc((void**)&d_Fy, size);
	cudaMalloc((void**)&d_Fz, size);

	cudaMemcpy(d_in,in,size,cudaMemcpyHostToDevice);
	phiToForce <<<128,128>>>(d_in,d_Fx,d_Fy,d_Fz,grid->Nx,grid->L,nConst);
	cudaDeviceSynchronize();
	cudaMemcpy(grid->Fx,d_Fx,size, cudaMemcpyDeviceToHost);
	cudaMemcpy(grid->Fy,d_Fy,size, cudaMemcpyDeviceToHost);
	cudaMemcpy(grid->Fz,d_Fz,size, cudaMemcpyDeviceToHost);

	cudaFree(d_in);
	cudaFree(d_Fx);
	cudaFree(d_Fy);
	cudaFree(d_Fz);
	cudaFree(dataIn);
	cudaFree(dataOut);
	

	free(in);
	free(out);
	
}


void _2nd_order_diff_3d(struct grid3D *grid, int const ii, int const jj, int const kk ) {

  double factor1 = -1./(2.*grid->dx);
  double factor2 = -1./(2.*grid->dy);
  double factor3 = -1./(2.*grid->dz);
  int const Nx = grid->Nx;
  int const Ny = grid->Ny;
  int const Nz = grid->Nz;
  int index = ii*Ny*Nz + jj*Nz + kk;

  grid->Fx[ index ] = factor1*( grid->phi[ ( (Nx+ii+1)%Nx )*Nx*Ny + jj*Nx + kk ] 
                              - grid->phi[ ( (Nx+ii-1)%Nx )*Nx*Ny + jj*Nx + kk ] );

  grid->Fy[ index ] = factor2*( grid->phi[ ii*Nx*Ny + ( (Ny+jj+1)%Ny )*Nx + kk ] 
                              - grid->phi[ ii*Nx*Ny + ( (Ny+jj-1)%Ny )*Nx + kk ] );  

  grid->Fz[ index ] = factor3*( grid->phi[ ii*Nx*Ny  + jj*Nx + ((Nz+kk+1)%Nz)] 
                              - grid->phi[ ii*Nx*Ny  + jj*Nx + ((Nz+kk-1)%Nz)]);

}
void _2nd_order_diff_3d_cuda(struct grid3D *grid) {
	double* d_phi;
	double* d_Fx; 
	double* d_Fy;
	double* d_Fz;

	int size = grid->N * sizeof(double);

	cudaMalloc((void**)&d_phi, size);
	cudaMalloc((void**)&d_Fx, size);
	cudaMalloc((void**)&d_Fy, size);
	cudaMalloc((void**)&d_Fz, size);

	cudaMemcpy(d_phi,grid->phi,size,cudaMemcpyHostToDevice);
	phiToForce <<<128,128>>>(d_phi,d_Fx,d_Fy,d_Fz,grid->Nx,grid->L,1.0);
	cudaDeviceSynchronize();
	cudaMemcpy(grid->Fx,d_Fx,size, cudaMemcpyDeviceToHost);
	cudaMemcpy(grid->Fy,d_Fy,size, cudaMemcpyDeviceToHost);
	cudaMemcpy(grid->Fz,d_Fz,size, cudaMemcpyDeviceToHost);

	cudaFree(d_phi);
	cudaFree(d_Fx);
	cudaFree(d_Fy);
	cudaFree(d_Fz);
}

void calculateGreenFFT(struct grid3D *grid, complex<double> *fftgf){
	double *greenFunction;
	int N = grid->N;
	int Nx = grid->Nx;
	int Ny = grid->Ny;
	int Nz = grid->Nz;

	int NNx = 2*Nx;
	int NNy = 2*Ny;
	int NNz = 2*Nz;

	greenFunction = (double*)malloc(8*N*sizeof(double));
	

	complex<double> *gf; 	//For green function
	gf = (complex<double>*) malloc(sizeof(complex<double>) * 8*N);
	

	//Initialize green function array
	for(int i=0;i<NNx;i++){
		for(int j=0;j<NNy;j++){
			for(int k=0;k<NNz;k++){
				greenFunction[i*NNx*NNy+j*NNx+k] = 0.0;	
			}		
		}
	}
	//Construct green function
	for(int i=0;i<Nx;i++){
		for(int j=0;j<Ny;j++){
			for(int k=0;k<Nz;k++){
				if(i != 0 || j != 0 || k != 0){
					greenFunction[i*NNx*NNy+j*NNx+k] = -1.0/sqrt(pow(i,2)+pow(j,2)+pow(k,2));
				}
			}
		}
	}

	for(int i=Nx+1;i<NNx;i++){
		for(int j=0;j<Ny;j++){
			for(int k=0;k<Nz;k++){
				greenFunction[i*NNx*NNy+j*NNx+k] = greenFunction[(NNx-i)*NNx*NNy+j*NNx+k];
			}
		}
	}
	for(int i=0;i<Nx;i++){
		for(int j=Ny+1;j<NNy;j++){
			for(int k=0;k<Nz;k++){
				greenFunction[i*NNx*NNy+j*NNx+k] = greenFunction[i*NNx*NNy+(NNy-j)*NNx+k];
			}
		}
	}

	for(int i=Nx+1;i<NNx;i++){
		for(int j=Ny+1;j<NNy;j++){
			for(int k=0;k<Nz;k++){
				greenFunction[i*NNx*NNy+j*NNx+k] = greenFunction[(NNx-i)*NNx*NNy+(NNy-j)*NNx+k];
			}
			
		}
	}

	for(int i=0;i<NNx;i++){
		for(int j=0;j<NNy;j++){
			for(int k=Nz+1;k<NNz;k++){
				greenFunction[i*NNx*NNy+j*NNx+k] = greenFunction[i*NNx*NNy + j*NNx + (NNz-k)];
			}
		}
	}

	for(int i=0;i<NNx;i++){
		for(int j=0;j<NNy;j++){
			for(int k=0;k<NNz;k++){
				gf[i*NNx*NNy + j*NNx + k] = complex<double>(0.,0.);
				gf[i*NNx*NNy + j*NNx + k] += greenFunction[i*NNx*NNy + j*NNx + k];
			}
			
		}
	}

	cufftHandle plan;
	cufftDoubleComplex *data;
    cudaMalloc((void**)&data, sizeof(cufftDoubleComplex)*8*N);
    cudaMemcpy(data, gf, sizeof(double)*8*N*2, cudaMemcpyHostToDevice);

	if (cufftPlan3d(&plan,NNx,NNy,NNz, CUFFT_Z2Z) != CUFFT_SUCCESS) {
        printf("CUFFT error: Plan creation failed.\n");
		exit(1);
    }
    if (cufftExecZ2Z(plan, data, data, CUFFT_FORWARD) != CUFFT_SUCCESS) {
		printf("CUFFT error: ExecZ2Z forward failed.\n");
		exit(1);
    }
    cudaMemcpy(fftgf, data, sizeof(double)*8*N*2, cudaMemcpyDeviceToHost);
    cudaDeviceSynchronize();
    cufftDestroy(plan);
    cudaFree(data);
	
	free(gf);
	free(greenFunction);
	
}

void isolatedPotential(struct grid3D *grid, complex<double>* fftgf){
	double *densityPad;
	int N = grid->N;
	int Nx = grid->Nx;
	int Ny = grid->Ny;
	int Nz = grid->Nz;

	int NNx = 2*Nx;
	int NNy = 2*Ny;
	int NNz = 2*Nz;

	densityPad = (double*)malloc(8*N*sizeof(double));
	cufftHandle p1,p2;				//fft plan for cuFFT
	
	complex<double> *dp, *fftdp;	//For Padding density
	
	complex<double> *phi,*ifftphi;	//For potential
	
	dp = (complex<double>*) malloc(sizeof(complex<double>) * 8*N);
	fftdp = (complex<double>*) malloc(sizeof(complex<double>) * 8*N);
	phi = (complex<double>*) malloc(sizeof(complex<double>) * 8*N);
	ifftphi = (complex<double>*) malloc(sizeof(complex<double>) * 8*N);

	for(int i=0;i<NNx;i++){
		for(int j=0;j<NNy;j++){
			for(int k=0;k<NNz;k++){
				if(i < Nx && j < Ny && k < Nz){
					//Copy initial density
					densityPad[i*NNx*NNy+j*NNx+k] = grid->density[i*Nx*Ny+j*Nx+k];
				}else{
					//Padding 0s
					densityPad[i*NNx*NNy+j*NNx+k] = 0.0;
				}
			}
		}
	}
	

	for(int i=0;i<NNx;i++){
		for(int j=0;j<NNy;j++){
			for(int k=0;k<NNz;k++){
				dp[i*NNx*NNy + j*NNx + k] = complex<double>(0.,0.);
				dp[i*NNx*NNy + j*NNx + k] += densityPad[i*NNx*NNy + j*NNx + k];
			}
			
		}
	}

    cufftDoubleComplex *data;
    cudaMalloc((void**)&data, sizeof(cufftDoubleComplex)*8*N);
    cudaMemcpy(data, dp, sizeof(double)*8*N*2, cudaMemcpyHostToDevice);
	
	//cufft
	if (cufftPlan3d(&p1,NNx,NNy,NNz, CUFFT_Z2Z) != CUFFT_SUCCESS) {
        printf("CUFFT error: Plan creation failed.\n");
		exit(1);
    }
    if (cufftExecZ2Z(p1, data, data, CUFFT_FORWARD) != CUFFT_SUCCESS) {
		printf("CUFFT error: ExecZ2Z forward failed.\n");
		exit(1);
    }
    cudaMemcpy(fftdp, data, sizeof(double)*8*N*2, cudaMemcpyDeviceToHost);
    cudaDeviceSynchronize();
    cufftDestroy(p1);
    cudaFree(data);
	

	for(int i=0;i<NNx;i++){
		for(int j=0;j<NNy;j++){
			for(int k=0;k<NNz;k++){
				//Multiply 2 imaginary numbers
				int index = i*NNx*NNy + j*NNx + k;
				// phi[index][0] = fftdp[index][0] * fftgf[index][0] - fftdp[index][1] * fftgf[index][1];
				// phi[index][1] = fftdp[index][0] * fftgf[index][1] + fftdp[index][1] * fftgf[index][0];
				phi[index] = fftdp[index] * fftgf[index];
			}
		}
	}

	cufftDoubleComplex *data2;
    cudaMalloc((void**)&data2, sizeof(cufftDoubleComplex)*8*N);
    cudaMemcpy(data, phi, sizeof(double)*8*N*2, cudaMemcpyHostToDevice);
	
	////ifft cufft
	if (cufftPlan3d(&p2,NNx,NNy,NNz, CUFFT_Z2Z) != CUFFT_SUCCESS) {
        printf("CUFFT error: Plan creation failed.\n");
		exit(1);
    }
    if (cufftExecZ2Z(p2, data2, data2, CUFFT_INVERSE) != CUFFT_SUCCESS) {
		printf("CUFFT error: ExecZ2Z forward failed.\n");
		exit(1);
    }
    cudaMemcpy(ifftphi, data2, sizeof(double)*8*N*2, cudaMemcpyDeviceToHost);
    cudaDeviceSynchronize();
    cufftDestroy(p2);
    cudaFree(data2);

	
	

	for(int i=0;i<Nx;i++){
		for(int j=0;j<Ny;j++){
			for(int k=0;k<Nz;k++){
				int index1 = i*Nx*Ny+j*Nx+k;//index for N size grid.
				int index2 = i*NNx*NNy + j*NNx + k;// index for 2N size grid.
				grid->phi[index1] = -1.0/grid->dx / (8*N) * abs(ifftphi[index2]);
			}
		}		
	}

	// for (int i=0; i < Nx; i++){
	// 	for (int j=0; j < Ny; j++){  
	// 		for(int k=0 ; k < Nz ; k++){
	// 			_2nd_order_diff_3d(grid, i, j,k);
	// 		}   
	// 	}
	// }

	//Use GPU to calculate force from potential.
	_2nd_order_diff_3d_cuda(grid);

	free(densityPad);
	free(dp);
	free(fftdp);
	free(phi);
	free(ifftphi);

}

void Weight(struct grid3D *grid,struct particle3D *particle,int type){

	//Initialize Density field
	for(int i=0 ; i < grid->N ; i++){
		grid->density[i]=0.0;
	}

	for(int i=0;i < particle->number;i++){
		int lx,ly,lz,sx,sy,sz;
		double shift = -grid->L/2;	//make (0,0) to be in the center of grid.
		lx = (particle->x[i]-shift)/grid->dx;
		ly = (particle->y[i]-shift)/grid->dy;
		lz = (particle->z[i]-shift)/grid->dz;

		if(type == 0){
			//NGP
			sx = particle->x[i]-shift-lx * grid->dx - 0.5*grid->dx + 1;
			sy = particle->y[i]-shift-ly * grid->dy - 0.5*grid->dy + 1;
			sz = particle->z[i]-shift-lz * grid->dz - 0.5*grid->dz + 1;
			grid->density[(lx+sx)*grid->Nx*grid->Ny + (ly+sy)*grid->Nx + (lz+sz) ] += particle->mass[i];
		}else if(type == 1){
			//CIC
			for(int zz=0;zz<2;zz++){
				for(int j=0;j<4;j++){
					int p = j / 2;
					int q = j % 2;
					double wFactor = (1-fabs(particle->x[i]-shift-(lx+p)*grid->dx)/grid->dx)*(1-fabs(particle->y[i]-shift-(ly+q)*grid->dy)/grid->dy);
					wFactor *= (1-fabs(particle->z[i]-shift-(lz+zz)*grid->dz)/grid->dz);
					grid->density[(lx+p)*grid->Nx*grid->Ny + (ly+q)*grid->Nx + (lz+zz) ] += particle->mass[i] * wFactor;
				}
			}
			
		}else if(type == 2){
			//TSC
			//xxx
			//xox
			//xxx
			lx = (particle->x[i]-shift+0.5*grid->dx)/grid->dx;	//Find the nearest point in lattice index.
			ly = (particle->y[i]-shift+0.5*grid->dy)/grid->dy;
			lz = (particle->z[i]-shift+0.5*grid->dz)/grid->dz;
			double weightX[3];	//Weight factor in x direction for 3 affected points
			double weightY[3];
			double weightZ[3];
			//Construct weighting factor
			for(int xx=-1;xx<2;xx++){
				double ddx = fabs(particle->x[i]-shift-(lx+xx)*grid->dx);
				if(ddx <= grid->dx/2){
					weightX[xx+1] = 3.0/4 - pow(ddx / grid->dx,2);
				}else if(ddx<= grid->dx/2*3.0){
					weightX[xx+1] = 0.5*pow(1.5-ddx / grid->dx,2);
				}else{
					printf("Should not be here");
					weightX[xx+1]=0.0;
				}
				
			}
			for(int yy=-1;yy<2;yy++){
				double ddy = fabs(particle->y[i]-shift-(ly+yy)*grid->dy);
				if(ddy <= grid->dy/2){
					weightY[yy+1] = 3.0/4 - pow(ddy / grid->dy,2);
				}else if(ddy <= grid->dy/2*3.0){
					weightY[yy+1] = 0.5*pow(1.5-ddy / grid->dy,2);
				}else{
					weightY[yy+1]=0.0;
				}
			}
			for(int zz=-1;zz<2;zz++){
				double ddz = fabs(particle->z[i]-shift-(lz+zz)*grid->dz);
				if(ddz <= grid->dz/2){
					weightZ[zz+1] = 3.0/4 - pow(ddz / grid->dz,2);
				}else if(ddz <= grid->dz/2*3.0){
					weightZ[zz+1] = 0.5*pow(1.5-ddz / grid->dz,2);
				}else{
					weightZ[zz+1]=0.0;
				}
			}
			//Weight mass into density
			int indx,indy,indz;
			for(int xx=-1;xx<2;xx++){
				for(int yy=-1;yy<2;yy++){
					for(int zz=-1;zz<2;zz++){
						//Account for periodic boundary
						indx = ((lx+xx)+grid->Nx)%grid->Nx;
						indy = ((ly+yy)+grid->Ny)%grid->Ny;
						indz = ((lz+zz)+grid->Nz)%grid->Nz;
						int index = indx*grid->Nx*grid->Ny + indy*grid->Nx + indz;
						grid->density[index]+=weightX[xx+1]*weightY[yy+1]*weightZ[zz+1]*particle->mass[i];
					}
					
				}
			}
		}
		
	}
}
void WeightForce(struct grid3D *grid,struct particle3D *particle,int type){
	//type = 0/1/2  => NGP/CIC/TSC
	for(int i=0;i < particle->number;i++){
		int lx,ly,lz,sx,sy,sz;
		double shift = -grid->L/2;	//make (0,0) to be in the center of grid.
		lx = (particle->x[i]-shift)/grid->dx;
		ly = (particle->y[i]-shift)/grid->dy;
		lz = (particle->z[i]-shift)/grid->dz;
		particle->Fx[i]=0.0;
		particle->Fy[i]=0.0;
		particle->Fz[i]=0.0;

		if(type == 0){
			sx = particle->x[i]-shift-lx * grid->dx - 0.5*grid->dx + 1;
			sy = particle->y[i]-shift-ly * grid->dy - 0.5*grid->dy + 1;
			sz = particle->z[i]-shift-lz * grid->dz - 0.5*grid->dz + 1;
			int pos = (lx+sx)*grid->Nx*grid->Ny + (ly+sy)*grid->Nx + (lz+sz) ;
			particle->Fx[i]=grid->Fx[pos]*particle->mass[i];
			particle->Fy[i]=grid->Fy[pos]*particle->mass[i];
			particle->Fz[i]=grid->Fz[pos]*particle->mass[i];
		}else if(type == 1){
			for(int zz=0;zz<2;zz++){
				for(int j=0;j<4;j++){
					int p = j / 2;
					int q = j % 2;
					double wFactor = (1-fabs(particle->x[i]-shift-(lx+p)*grid->dx)/grid->dx)*(1-fabs(particle->y[i]-shift-(ly+q)*grid->dy)/grid->dy);
					wFactor *= (1-fabs(particle->z[i]-shift-(lz+zz)*grid->dz)/grid->dz);
					int pos = (lx+p)*grid->Nx*grid->Ny + (ly+q)*grid->Nx + (lz+zz) ;
					particle->Fx[i] += grid->Fx[pos] * wFactor*particle->mass[i];
					particle->Fy[i] += grid->Fy[pos] * wFactor*particle->mass[i];
					particle->Fz[i] += grid->Fz[pos] * wFactor*particle->mass[i];
				}
			}
			
		}else if(type == 2){
			//TSC
			//xxx
			//xox
			//xxx
			lx = (particle->x[i]-shift+0.5*grid->dx)/grid->dx;	//Find the nearest point in lattice index.
			ly = (particle->y[i]-shift+0.5*grid->dy)/grid->dy;
			lz = (particle->z[i]-shift+0.5*grid->dz)/grid->dz;
			double weightX[3];	//Weight factor in x direction for 3 affected points
			double weightY[3];
			double weightZ[3];
			//Construct weighting factor
			for(int xx=-1;xx<2;xx++){
				double ddx = fabs(particle->x[i]-shift-(lx+xx)*grid->dx);
				if(ddx <= grid->dx/2){
					weightX[xx+1] = 3.0/4 - pow(ddx / grid->dx,2);
				}else if(ddx<= grid->dx/2*3.0){
					weightX[xx+1] = 0.5*pow(1.5-ddx / grid->dx,2);
				}else{
					printf("Should not be here");
					weightX[xx+1]=0.0;
				}
				
			}
			for(int yy=-1;yy<2;yy++){
				double ddy = fabs(particle->y[i]-shift-(ly+yy)*grid->dy);
				if(ddy <= grid->dy/2){
					weightY[yy+1] = 3.0/4 - pow(ddy / grid->dy,2);
				}else if(ddy <= grid->dy/2*3.0){
					weightY[yy+1] = 0.5*pow(1.5-ddy / grid->dy,2);
				}else{
					weightY[yy+1]=0.0;
				}
			}
			for(int zz=-1;zz<2;zz++){
				double ddz = fabs(particle->z[i]-shift-(lz+zz)*grid->dz);
				if(ddz <= grid->dz/2){
					weightZ[zz+1] = 3.0/4 - pow(ddz / grid->dz,2);
				}else if(ddz <= grid->dz/2*3.0){
					weightZ[zz+1] = 0.5*pow(1.5-ddz / grid->dz,2);
				}else{
					weightZ[zz+1]=0.0;
				}
			}
			//Weight mass into density
			int indx,indy,indz;
			for(int xx=-1;xx<2;xx++){
				for(int yy=-1;yy<2;yy++){
					for(int zz=-1;zz<2;zz++){
						//Account for periodic boundary
						indx = ((lx+xx)+grid->Nx)%grid->Nx;
						indy = ((ly+yy)+grid->Ny)%grid->Ny;
						indz = ((lz+zz)+grid->Nz)%grid->Nz;
						int index = indx*grid->Nx*grid->Ny + indy*grid->Nx + indz;
						double weight = weightX[xx+1]*weightY[yy+1]*weightZ[zz+1];
						particle->Fx[i] += grid->Fx[index]*weight*particle->mass[i];
						particle->Fy[i] += grid->Fy[index]*weight*particle->mass[i];
						particle->Fz[i] += grid->Fz[index]*weight*particle->mass[i];
					}
					
				}
			}
		}

		
	}
}
void kick(struct particle3D *particle , double dt){
	double ax,ay,az;
	for(int i=0 ; i<particle->number ; i++){
		//Cauculate the acceleration of each particle.
		ax = particle->Fx[i] / particle->mass[i];
		ay = particle->Fy[i] / particle->mass[i];
		az = particle->Fz[i] / particle->mass[i];

		//Calculate velocity of each particle.
		particle->vx[i] += ax * dt;
		particle->vy[i] += ay * dt;
		particle->vz[i] += az * dt;
	}
}
void drift(struct particle3D *particle , double dt){
	for(int i=0 ; i<particle->number ; i++){
		particle->x[i] += particle->vx[i] * dt;
		particle->y[i] += particle->vy[i] * dt;
		particle->z[i] += particle->vz[i] * dt;
	}
}
void init_rk4(struct particle3D *particle, struct particle3D *buff, struct rk43D *rk4){
	for(int i=0 ; i<particle->number ; i++){
		buff->vx[i] = particle->vx[i];
		buff->vy[i] = particle->vy[i];
		buff->vz[i] = particle->vz[i];
		buff->Fx[i] = particle->Fx[i];
		buff->Fy[i] = particle->Fy[i];
		buff->Fz[i] = particle->Fz[i];
		rk4->ax[i] = 0;
		rk4->ay[i] = 0;
		rk4->az[i] = 0;
		rk4->vx[i] = 0;
		rk4->vy[i] = 0;
		rk4->vz[i] = 0;
		rk4->step1 = 0;
		rk4->step2 = 1;
	}
}
void rk4_mid(struct particle3D *particle, struct particle3D *buff, struct rk43D *rk4, double dt, int weighting){
	for(int i=0 ; i<particle->number ; i++){
		buff->Fx[i] = rk4->step1 * buff->Fx[i] + rk4->step2 * particle->Fx[i];
		buff->Fy[i] = rk4->step1 * buff->Fy[i] + rk4->step2 * particle->Fy[i];
		buff->Fz[i] = rk4->step1 * buff->Fz[i] + rk4->step2 * particle->Fz[i];

		buff->x[i] = particle->x[i] + buff->vx[i] * dt;
		buff->y[i] = particle->y[i] + buff->vy[i] * dt;
		buff->z[i] = particle->z[i] + buff->vz[i] * dt;

		rk4->ax[i] += weighting/6.0 * buff->Fx[i]/particle->mass[i];
		rk4->ay[i] += weighting/6.0 * buff->Fy[i]/particle->mass[i];
		rk4->az[i] += weighting/6.0 * buff->Fz[i]/particle->mass[i];
		rk4->vx[i] += weighting/6.0 * buff->vx[i];
		rk4->vy[i] += weighting/6.0 * buff->vy[i];
		rk4->vz[i] += weighting/6.0 * buff->vz[i];

		buff->vx[i] = particle->vx[i] + buff->Fx[i]/particle->mass[i] * dt;
		buff->vy[i] = particle->vy[i] + buff->Fy[i]/particle->mass[i] * dt;
		buff->vz[i] = particle->vz[i] + buff->Fz[i]/particle->mass[i] * dt;

		rk4->step1 = 1;
		rk4->step2 = 0;
	}
}
void rk4_end(struct particle3D *particle, struct rk43D *rk4, double dt){
	for(int i=0 ; i<particle->number ; i++){
		particle->x[i]  += rk4->vx[i] * dt;
		particle->y[i]  += rk4->vy[i] * dt;
		particle->z[i]  += rk4->vz[i] * dt;
		particle->vx[i] += rk4->ax[i] * dt;
		particle->vy[i] += rk4->ay[i] * dt;
		particle->vz[i] += rk4->az[i] * dt;
	}
}
void periodic_boundary(double position, double length){
	int sign = position/abs(position);
	position = sign * remainder(abs(position + sign*length/2), length) - sign*length/2;
	cout << "A particle reaches the boundary." << endl;
}
void boundary_check(int boundary, struct particle3D *particle, double L){
	if (boundary == 0){
		for (int i=0; i<particle->number; i++){
			if ( abs(particle->x[i]) > L/2){
				periodic_boundary(particle->x[i],L);
			}
			if ( abs(particle->y[i]) > L/2){
				periodic_boundary(particle->y[i],L);
			}
			if ( abs(particle->z[i]) > L/2){
				periodic_boundary(particle->z[i],L);
			}
		}
	}
	else if (boundary == 1){
		for (int i=0; i<particle->number; i++){
			if ( abs(particle->x[i]) > L/2 || abs(particle->y[i]) > L/2 || abs(particle->z[i]) > L/2){
				particle->mass[i] = 0;
				cout << "A particle reaches the boundary." << endl;
			}
		}
	}
}
//Functions to locate memory and free memory of different struct.
void locateMemoryParticle(struct particle3D *particle,int N){
	particle->mass = (double*)malloc(N*sizeof(double));
    particle->x = (double*)malloc(N*sizeof(double));
    particle->y = (double*)malloc(N*sizeof(double));
    particle->z = (double*)malloc(N*sizeof(double));
	particle->Fx = (double*)malloc(N*sizeof(double));
    particle->Fy = (double*)malloc(N*sizeof(double));
    particle->Fz = (double*)malloc(N*sizeof(double));
	particle->vx = (double*)malloc(N*sizeof(double));
    particle->vy = (double*)malloc(N*sizeof(double));
	particle->vz = (double*)malloc(N*sizeof(double));
}
void freeMemoryParticle(struct particle3D *particle){
	free(particle->mass);
	free(particle->x);
	free(particle->y);
	free(particle->z);
	free(particle->Fx);
	free(particle->Fy);
	free(particle->Fz);
	free(particle->vx);
	free(particle->vy);
	free(particle->vz);
}
void locateMemoryRk4(struct rk43D *rk4,int N){
	rk4->ax = (double*)malloc(N*sizeof(double));
	rk4->ay = (double*)malloc(N*sizeof(double));
	rk4->az = (double*)malloc(N*sizeof(double));
	rk4->vx = (double*)malloc(N*sizeof(double));
	rk4->vy = (double*)malloc(N*sizeof(double));
	rk4->vz = (double*)malloc(N*sizeof(double));	
}
void freeMemoryRk4(struct rk43D *rk4){
	free(rk4->ax);
	free(rk4->ay);
	free(rk4->az);
	free(rk4->vx);
	free(rk4->vy);
	free(rk4->vz);
}
void locateMemoryGrid(struct grid3D *grid){
	grid->density = (double*) malloc(grid->N*sizeof(double));	//Density on the grid
	grid->phi = (double*) malloc(grid->N*sizeof(double));		//Potential on the grid
	grid->Fx = (double*) malloc(grid->N*sizeof(double));			//Force on grid comes from potential calculation
	grid->Fy = (double*) malloc(grid->N*sizeof(double));
	grid->Fz = (double*) malloc(grid->N*sizeof(double));
}
void freeMemoryGrid(struct grid3D *grid){
	free(grid->density);
	free(grid->phi);
	free(grid->Fx);
	free(grid->Fy);
	free(grid->Fz);
}

	.file	"tmpxft_00331840_00000000-6_cudaCircularOrbit3D.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3983:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3983:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z18_2nd_order_diff_3dP6grid3Diii
	.type	_Z18_2nd_order_diff_3dP6grid3Diii, @function
_Z18_2nd_order_diff_3dP6grid3Diii:
.LFB3962:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	%edx, %r8d
	movsd	.LC0(%rip), %xmm1
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movaps	%xmm1, %xmm4
	movaps	%xmm1, %xmm3
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movl	12(%rdi), %r12d
	movl	8(%rdi), %r9d
	movsd	24(%rdi), %xmm2
	movl	%r12d, %eax
	movsd	32(%rdi), %xmm0
	movq	48(%rdi), %rbx
	addl	%r12d, %r8d
	imull	%esi, %eax
	leal	(%r9,%rsi), %r14d
	movl	%r9d, %r13d
	movl	16(%rdi), %ebp
	imull	%edx, %r13d
	addsd	%xmm2, %xmm2
	imull	%r9d, %esi
	addsd	%xmm0, %xmm0
	leal	(%rdx,%rax), %r11d
	leal	1(%r14), %eax
	divsd	%xmm2, %xmm1
	imull	%ebp, %r11d
	cltd
	idivl	%r9d
	addl	%ecx, %r11d
	imull	%r12d, %esi
	leal	-1(%r14), %eax
	movslq	%r11d, %r11
	divsd	%xmm0, %xmm4
	movsd	40(%rdi), %xmm0
	addsd	%xmm0, %xmm0
	imull	%r9d, %edx
	imull	%r12d, %edx
	leal	(%rdx,%r13), %r10d
	cltd
	idivl	%r9d
	divsd	%xmm0, %xmm3
	addl	%ecx, %r10d
	movslq	%r10d, %r10
	movsd	(%rbx,%r10,8), %xmm0
	imull	%r9d, %edx
	imull	%r12d, %edx
	leal	(%rdx,%r13), %eax
	addl	%ecx, %eax
	cltq
	subsd	(%rbx,%rax,8), %xmm0
	movq	64(%rdi), %rax
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, (%rax,%r11,8)
	leal	1(%r8), %eax
	cltd
	idivl	%r12d
	leal	-1(%r8), %eax
	movq	80(%rdi), %r8
	imull	%r9d, %edx
	leal	(%rdx,%rsi), %r10d
	cltd
	idivl	%r12d
	movq	72(%rdi), %rax
	addl	%ecx, %r10d
	movslq	%r10d, %r10
	movsd	(%rbx,%r10,8), %xmm0
	imull	%r9d, %edx
	addl	%esi, %edx
	addl	%r13d, %esi
	addl	%ecx, %edx
	addl	%ebp, %ecx
	movslq	%edx, %rdx
	subsd	(%rbx,%rdx,8), %xmm0
	mulsd	%xmm4, %xmm0
	movsd	%xmm0, (%rax,%r11,8)
	leal	1(%rcx), %eax
	cltd
	idivl	%ebp
	leal	-1(%rcx), %eax
	addl	%esi, %edx
	movslq	%edx, %rdi
	cltd
	idivl	%ebp
	movsd	(%rbx,%rdi,8), %xmm0
	addl	%esi, %edx
	movslq	%edx, %rdx
	subsd	(%rbx,%rdx,8), %xmm0
	mulsd	%xmm3, %xmm0
	movsd	%xmm0, (%r8,%r11,8)
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3962:
	.size	_Z18_2nd_order_diff_3dP6grid3Diii, .-_Z18_2nd_order_diff_3dP6grid3Diii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"CUFFT error: Plan creation failed.\n"
.LC3:
	.string	"CUFFT error: ExecZ2Z forward failed.\n"
	.text
	.globl	_Z17calculateGreenFFTP6grid3DPSt7complexIdE
	.type	_Z17calculateGreenFFTP6grid3DPSt7complexIdE, @function
_Z17calculateGreenFFTP6grid3DPSt7complexIdE:
.LFB3964:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movslq	20(%rdi), %r12
	movl	8(%rdi), %r15d
	movq	%rsi, 56(%rsp)
	movl	12(%rdi), %r14d
	leal	(%r15,%r15), %ebx
	leal	(%r14,%r14), %r13d
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	movl	16(%rdi), %eax
	leal	0(,%r12,8), %edi
	salq	$7, %r12
	movslq	%edi, %rdi
	movl	%eax, 4(%rsp)
	salq	$3, %rdi
	addl	%eax, %eax
	movl	%eax, 20(%rsp)
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%r12, 8(%rsp)
	movl	%ebx, %r12d
	movq	%rax, %rbp
	imull	%r13d, %r12d
	call	malloc@PLT
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	movq	%rax, 24(%rsp)
.L5:
	cmpl	%ebx, %edx
	jge	.L58
	movl	%ecx, %esi
	xorl	%edi, %edi
.L9:
	cmpl	%r13d, %edi
	jge	.L7
	movslq	%esi, %rax
	leaq	0(%rbp,%rax,8), %r8
	xorl	%eax, %eax
.L8:
	cmpl	%eax, 20(%rsp)
	jle	.L59
	movq	$0x000000000, (%r8,%rax,8)
	incq	%rax
	jmp	.L8
.L59:
	incl	%edi
	addl	%ebx, %esi
	jmp	.L9
.L7:
	incl	%edx
	addl	%r12d, %ecx
	jmp	.L5
.L58:
	xorl	%esi, %esi
	xorl	%edx, %edx
.L10:
	cmpl	%r15d, %edx
	jge	.L60
	movl	%esi, %edi
	xorl	%ecx, %ecx
.L14:
	cmpl	%r14d, %ecx
	jge	.L61
	xorl	%eax, %eax
.L13:
	movl	4(%rsp), %r11d
	cmpl	%r11d, %eax
	jge	.L62
	movl	%edx, %r8d
	orl	%ecx, %r8d
	orl	%eax, %r8d
	je	.L11
	cvtsi2sdl	%edx, %xmm0
	movl	%esi, 48(%rsp)
	cvtsi2sdl	%ecx, %xmm2
	movl	%edi, 40(%rsp)
	cvtsi2sdl	%eax, %xmm1
	movl	%edx, 36(%rsp)
	movl	%ecx, 32(%rsp)
	mulsd	%xmm0, %xmm0
	movl	%eax, 16(%rsp)
	mulsd	%xmm2, %xmm2
	mulsd	%xmm1, %xmm1
	addsd	%xmm2, %xmm0
	addsd	%xmm1, %xmm0
	call	sqrt@PLT
	movl	16(%rsp), %eax
	movl	40(%rsp), %edi
	movaps	%xmm0, %xmm1
	movsd	.LC0(%rip), %xmm0
	movl	48(%rsp), %esi
	leal	(%rax,%rdi), %r8d
	movl	36(%rsp), %edx
	movl	32(%rsp), %ecx
	divsd	%xmm1, %xmm0
	movslq	%r8d, %r8
	movsd	%xmm0, 0(%rbp,%r8,8)
.L11:
	incl	%eax
	jmp	.L13
.L62:
	incl	%ecx
	addl	%ebx, %edi
	jmp	.L14
.L61:
	incl	%edx
	addl	%r12d, %esi
	jmp	.L10
.L60:
	leal	1(%r15), %eax
	movl	%eax, 16(%rsp)
	movl	%ebx, %eax
	movl	16(%rsp), %edx
	subl	%r15d, %eax
	decl	%eax
	imull	%r12d, %eax
	movl	%eax, 32(%rsp)
	movl	16(%rsp), %eax
	movl	32(%rsp), %ecx
	imull	%r13d, %eax
	imull	%ebx, %eax
	movl	%eax, 36(%rsp)
	movl	%eax, %esi
.L15:
	cmpl	%ebx, %edx
	jge	.L63
	movl	%esi, %edi
	movl	%ecx, %r8d
	xorl	%r9d, %r9d
.L19:
	cmpl	%r14d, %r9d
	jge	.L17
	movslq	%r8d, %rax
	leaq	0(%rbp,%rax,8), %r11
	movslq	%edi, %rax
	leaq	0(%rbp,%rax,8), %r10
	xorl	%eax, %eax
.L18:
	cmpl	%eax, 4(%rsp)
	jle	.L64
	movsd	(%r11,%rax,8), %xmm0
	movsd	%xmm0, (%r10,%rax,8)
	incq	%rax
	jmp	.L18
.L64:
	incl	%r9d
	addl	%ebx, %r8d
	addl	%ebx, %edi
	jmp	.L19
.L17:
	incl	%edx
	subl	%r12d, %ecx
	addl	%r12d, %esi
	jmp	.L15
.L63:
	leal	-1(%r14), %eax
	leal	1(%r14), %edx
	xorl	%ecx, %ecx
	xorl	%esi, %esi
	imull	%ebx, %eax
	imull	%ebx, %edx
	movl	%eax, %r10d
.L20:
	cmpl	%r15d, %esi
	jge	.L26
	leal	1(%r14), %r9d
	leal	(%r10,%rcx), %r8d
	leal	(%rdx,%rcx), %edi
.L21:
	cmpl	%r13d, %r9d
	jge	.L23
	movslq	%r8d, %rax
	leaq	0(%rbp,%rax,8), %rax
	movq	%rax, 40(%rsp)
	movslq	%edi, %rax
	leaq	0(%rbp,%rax,8), %rax
	movq	%rax, 48(%rsp)
	xorl	%eax, %eax
.L24:
	cmpl	%eax, 4(%rsp)
	jle	.L65
	movq	40(%rsp), %r11
	movsd	(%r11,%rax,8), %xmm0
	movq	48(%rsp), %r11
	movsd	%xmm0, (%r11,%rax,8)
	incq	%rax
	jmp	.L24
.L65:
	incl	%r9d
	subl	%ebx, %r8d
	addl	%ebx, %edi
	jmp	.L21
.L23:
	incl	%esi
	addl	%r12d, %ecx
	jmp	.L20
.L29:
	incl	16(%rsp)
	subl	%r12d, 32(%rsp)
	addl	%r12d, 36(%rsp)
.L26:
	cmpl	%ebx, 16(%rsp)
	jge	.L66
	movl	32(%rsp), %eax
	leal	1(%r14), %edi
	leal	(%rax,%r10), %esi
	movl	36(%rsp), %eax
	leal	(%rax,%rdx), %ecx
.L27:
	cmpl	%r13d, %edi
	jge	.L29
	movslq	%esi, %rax
	leaq	0(%rbp,%rax,8), %r9
	movslq	%ecx, %rax
	leaq	0(%rbp,%rax,8), %r8
	xorl	%eax, %eax
.L30:
	cmpl	%eax, 4(%rsp)
	jle	.L67
	movsd	(%r9,%rax,8), %xmm0
	movsd	%xmm0, (%r8,%rax,8)
	incq	%rax
	jmp	.L30
.L67:
	incl	%edi
	subl	%ebx, %esi
	addl	%ebx, %ecx
	jmp	.L27
.L66:
	movslq	4(%rsp), %rcx
	movl	4(%rsp), %eax
	xorl	%edi, %edi
	xorl	%esi, %esi
	addq	%rcx, %rcx
	incl	%eax
.L32:
	cmpl	%ebx, %esi
	jge	.L68
	movl	%edi, %r9d
	xorl	%r8d, %r8d
.L36:
	cmpl	%r13d, %r8d
	jge	.L69
	movslq	%r9d, %r11
	movslq	%eax, %rdx
	leaq	(%r11,%rcx), %r10
	leaq	0(%rbp,%r11,8), %r11
	leaq	0(%rbp,%r10,8), %r10
.L33:
	cmpl	%edx, 20(%rsp)
	jle	.L70
	imulq	$-8, %rdx, %r14
	movsd	(%r10,%r14), %xmm0
	movsd	%xmm0, (%r11,%rdx,8)
	incq	%rdx
	jmp	.L33
.L70:
	incl	%r8d
	addl	%ebx, %r9d
	jmp	.L36
.L69:
	incl	%esi
	addl	%r12d, %edi
	jmp	.L32
.L68:
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	xorps	%xmm0, %xmm0
.L37:
	cmpl	%ebx, %ecx
	jge	.L71
	movl	%esi, %edi
	xorl	%r8d, %r8d
.L41:
	cmpl	%r13d, %r8d
	jge	.L39
	movslq	%edi, %rax
	movq	%rax, %rdx
	leaq	0(%rbp,%rax,8), %r9
	xorl	%eax, %eax
	salq	$4, %rdx
.L40:
	cmpl	%eax, 20(%rsp)
	jle	.L72
	movsd	(%r9,%rax,8), %xmm1
	movq	24(%rsp), %r14
	incq	%rax
	movq	$0x000000000, 8(%r14,%rdx)
	addsd	%xmm0, %xmm1
	movsd	%xmm1, (%r14,%rdx)
	addq	$16, %rdx
	jmp	.L40
.L72:
	incl	%r8d
	addl	%ebx, %edi
	jmp	.L41
.L39:
	incl	%ecx
	addl	%r12d, %esi
	jmp	.L37
.L71:
	movq	8(%rsp), %rsi
	leaq	80(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdx
	movq	24(%rsp), %rsi
	movl	$1, %ecx
	movq	80(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	20(%rsp), %ecx
	movl	%ebx, %esi
	leaq	76(%rsp), %rdi
	movl	$105, %r8d
	movl	%r13d, %edx
	call	cufftPlan3d@PLT
	leaq	.LC2(%rip), %rsi
	testl	%eax, %eax
	jne	.L56
	movq	80(%rsp), %rsi
	movl	76(%rsp), %edi
	orl	$-1, %ecx
	movq	%rsi, %rdx
	call	cufftExecZ2Z@PLT
	testl	%eax, %eax
	je	.L43
	leaq	.LC3(%rip), %rsi
.L56:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L43:
	movq	8(%rsp), %rdx
	movq	80(%rsp), %rsi
	movl	$2, %ecx
	movq	56(%rsp), %rdi
	call	cudaMemcpy@PLT
	call	cudaDeviceSynchronize@PLT
	movl	76(%rsp), %edi
	call	cufftDestroy@PLT
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L44
	call	__stack_chk_fail@PLT
.L44:
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	movq	%rbp, %rdi
	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
	jmp	free@PLT
	.cfi_endproc
.LFE3964:
	.size	_Z17calculateGreenFFTP6grid3DPSt7complexIdE, .-_Z17calculateGreenFFTP6grid3DPSt7complexIdE
	.section	.rodata.str1.1
.LC11:
	.string	"Should not be here"
	.text
	.globl	_Z6WeightP6grid3DP10particle3Di
	.type	_Z6WeightP6grid3DP10particle3Di, @function
_Z6WeightP6grid3DP10particle3Di:
.LFB3966:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$152, %rsp
	.cfi_def_cfa_offset 208
	movl	%edx, 56(%rsp)
	movl	20(%rdi), %edx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
.L74:
	cmpl	%eax, %edx
	jle	.L130
	movq	56(%rbx), %rcx
	movq	$0x000000000, (%rcx,%rax,8)
	incq	%rax
	jmp	.L74
.L130:
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)
.L76:
	movl	8(%rsp), %eax
	cmpl	%eax, 0(%rbp)
	jle	.L131
	movsd	(%rbx), %xmm1
	movsd	.LC5(%rip), %xmm0
	xorps	.LC4(%rip), %xmm1
	movq	8(%rsp), %rax
	movq	16(%rbp), %r10
	movsd	24(%rbx), %xmm5
	mulsd	%xmm0, %xmm1
	movq	24(%rbp), %r11
	movsd	32(%rbx), %xmm6
	leaq	0(,%rax,8), %r15
	addq	%r15, %r10
	movq	32(%rbp), %r12
	movsd	40(%rbx), %xmm7
	movsd	(%r10), %xmm2
	addq	%r15, %r11
	movsd	(%r11), %xmm4
	addq	%r15, %r12
	cmpl	$0, 56(%rsp)
	subsd	%xmm1, %xmm2
	subsd	%xmm1, %xmm4
	movaps	%xmm2, %xmm3
	divsd	%xmm5, %xmm3
	cvttsd2sil	%xmm3, %r8d
	movaps	%xmm4, %xmm3
	divsd	%xmm6, %xmm3
	cvttsd2sil	%xmm3, %r9d
	movsd	(%r12), %xmm3
	subsd	%xmm1, %xmm3
	movaps	%xmm3, %xmm8
	divsd	%xmm7, %xmm8
	cvttsd2sil	%xmm8, %esi
	jne	.L77
	cvtsi2sdl	%r8d, %xmm1
	movl	8(%rbx), %ecx
	movq	8(%rsp), %rdi
	mulsd	%xmm5, %xmm1
	mulsd	%xmm0, %xmm5
	subsd	%xmm1, %xmm2
	movsd	.LC6(%rip), %xmm1
	subsd	%xmm5, %xmm2
	addsd	%xmm1, %xmm2
	cvttsd2sil	%xmm2, %eax
	cvtsi2sdl	%r9d, %xmm2
	addl	%r8d, %eax
	mulsd	%xmm6, %xmm2
	imull	%ecx, %eax
	mulsd	%xmm0, %xmm6
	imull	12(%rbx), %eax
	mulsd	%xmm7, %xmm0
	subsd	%xmm2, %xmm4
	cvtsi2sdl	%esi, %xmm2
	subsd	%xmm6, %xmm4
	mulsd	%xmm7, %xmm2
	addsd	%xmm1, %xmm4
	cvttsd2sil	%xmm4, %edx
	subsd	%xmm2, %xmm3
	subsd	%xmm0, %xmm3
	addl	%r9d, %edx
	imull	%ecx, %edx
	addsd	%xmm1, %xmm3
	addl	%edx, %eax
	cvttsd2sil	%xmm3, %edx
	addl	%esi, %edx
	addl	%edx, %eax
	movq	56(%rbx), %rdx
	cltq
	leaq	(%rdx,%rax,8), %rax
	movq	8(%rbp), %rdx
	movsd	(%rax), %xmm0
	addsd	(%rdx,%rdi,8), %xmm0
	movsd	%xmm0, (%rax)
	jmp	.L78
.L77:
	cmpl	$1, 56(%rsp)
	jne	.L79
	movq	56(%rbx), %rax
	addq	8(%rbp), %r15
	xorl	%edi, %edi
	movq	%r15, 32(%rsp)
	movl	8(%rbx), %r13d
	movq	%rax, 16(%rsp)
	movl	12(%rbx), %eax
	movq	.LC7(%rip), %xmm2
	movsd	.LC6(%rip), %xmm3
	movl	%eax, 24(%rsp)
.L80:
	leal	(%rdi,%rsi), %r14d
	xorl	%ecx, %ecx
	cvtsi2sdl	%r14d, %xmm4
.L81:
	movl	%ecx, %eax
	movsd	24(%rbx), %xmm7
	movsd	(%r10), %xmm0
	movl	%ecx, %edx
	sarl	%eax
	andl	$1, %edx
	movsd	32(%rbx), %xmm5
	movl	24(%rsp), %r15d
	addl	%r8d, %eax
	subsd	%xmm1, %xmm0
	addl	%r9d, %edx
	incl	%ecx
	cvtsi2sdl	%eax, %xmm6
	imull	%r13d, %eax
	mulsd	%xmm7, %xmm6
	imull	%r15d, %eax
	subsd	%xmm6, %xmm0
	movaps	%xmm3, %xmm6
	andps	%xmm2, %xmm0
	divsd	%xmm7, %xmm0
	cvtsi2sdl	%edx, %xmm7
	imull	%r13d, %edx
	mulsd	%xmm5, %xmm7
	addl	%edx, %eax
	movq	16(%rsp), %rdx
	addl	%r14d, %eax
	cltq
	leaq	(%rdx,%rax,8), %rax
	movq	32(%rsp), %rdx
	subsd	%xmm0, %xmm6
	movsd	(%r11), %xmm0
	subsd	%xmm1, %xmm0
	subsd	%xmm7, %xmm0
	movaps	%xmm4, %xmm7
	andps	%xmm2, %xmm0
	divsd	%xmm5, %xmm0
	movaps	%xmm3, %xmm5
	subsd	%xmm0, %xmm5
	movsd	(%r12), %xmm0
	subsd	%xmm1, %xmm0
	mulsd	%xmm5, %xmm6
	movsd	40(%rbx), %xmm5
	mulsd	%xmm5, %xmm7
	subsd	%xmm7, %xmm0
	andps	%xmm2, %xmm0
	divsd	%xmm5, %xmm0
	movaps	%xmm3, %xmm5
	subsd	%xmm0, %xmm5
	mulsd	%xmm6, %xmm5
	mulsd	(%rdx), %xmm5
	addsd	(%rax), %xmm5
	movsd	%xmm5, (%rax)
	cmpl	$4, %ecx
	jne	.L81
	testl	%edi, %edi
	jne	.L78
	movl	$1, %edi
	jmp	.L80
.L79:
	cmpl	$2, 56(%rsp)
	jne	.L78
	movaps	%xmm5, %xmm8
	orq	$-1, %r12
	mulsd	%xmm0, %xmm8
	addsd	%xmm2, %xmm8
	divsd	%xmm5, %xmm8
	cvttsd2sil	%xmm8, %edx
	movq	.LC7(%rip), %xmm8
.L88:
	movq	16(%rbp), %rax
	movsd	24(%rbx), %xmm9
	movsd	(%rax,%r15), %xmm2
	leal	(%rdx,%r12), %eax
	movaps	%xmm9, %xmm10
	cvtsi2sdl	%eax, %xmm5
	mulsd	%xmm0, %xmm10
	subsd	%xmm1, %xmm2
	mulsd	%xmm9, %xmm5
	subsd	%xmm5, %xmm2
	movaps	%xmm2, %xmm5
	andps	%xmm8, %xmm5
	comisd	%xmm5, %xmm10
	jb	.L123
	divsd	%xmm9, %xmm2
	movaps	%xmm2, %xmm5
	mulsd	%xmm2, %xmm5
	movsd	.LC8(%rip), %xmm2
	subsd	%xmm5, %xmm2
	jmp	.L85
.L123:
	mulsd	.LC9(%rip), %xmm10
	comisd	%xmm5, %xmm10
	jb	.L124
	divsd	%xmm9, %xmm5
	movsd	.LC10(%rip), %xmm2
	subsd	%xmm5, %xmm2
	mulsd	%xmm2, %xmm2
	mulsd	%xmm0, %xmm2
	jmp	.L85
.L124:
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	movl	%edx, 60(%rsp)
	movsd	%xmm1, 48(%rsp)
	movsd	%xmm7, 40(%rsp)
	movsd	%xmm3, 32(%rsp)
	movsd	%xmm6, 24(%rsp)
	movsd	%xmm4, 16(%rsp)
	call	__printf_chk@PLT
	movsd	.LC5(%rip), %xmm0
	movl	60(%rsp), %edx
	xorps	%xmm2, %xmm2
	movq	.LC7(%rip), %xmm8
	movsd	48(%rsp), %xmm1
	movsd	40(%rsp), %xmm7
	movsd	32(%rsp), %xmm3
	movsd	24(%rsp), %xmm6
	movsd	16(%rsp), %xmm4
.L85:
	movsd	%xmm2, 72(%rsp,%r12,8)
	incq	%r12
	cmpq	$2, %r12
	jne	.L88
	movaps	%xmm6, %xmm2
	movsd	32(%rbx), %xmm5
	movq	24(%rbp), %rax
	movsd	.LC9(%rip), %xmm9
	mulsd	%xmm0, %xmm2
	movsd	.LC8(%rip), %xmm10
	movsd	(%rax,%r15), %xmm11
	orq	$-1, %rax
	subsd	%xmm1, %xmm11
	addsd	%xmm4, %xmm2
	divsd	%xmm6, %xmm2
	movaps	%xmm5, %xmm6
	mulsd	%xmm0, %xmm6
	cvttsd2sil	%xmm2, %esi
.L93:
	leal	(%rsi,%rax), %ecx
	movaps	%xmm11, %xmm2
	cvtsi2sdl	%ecx, %xmm4
	mulsd	%xmm5, %xmm4
	subsd	%xmm4, %xmm2
	movaps	%xmm2, %xmm4
	andps	%xmm8, %xmm4
	comisd	%xmm4, %xmm6
	jb	.L125
	divsd	%xmm5, %xmm2
	movaps	%xmm2, %xmm4
	mulsd	%xmm2, %xmm4
	movaps	%xmm10, %xmm2
	subsd	%xmm4, %xmm2
	jmp	.L91
.L125:
	movaps	%xmm6, %xmm2
	mulsd	%xmm9, %xmm2
	comisd	%xmm4, %xmm2
	jb	.L126
	divsd	%xmm5, %xmm4
	movsd	.LC10(%rip), %xmm2
	subsd	%xmm4, %xmm2
	mulsd	%xmm2, %xmm2
	mulsd	%xmm0, %xmm2
	jmp	.L91
.L126:
	xorps	%xmm2, %xmm2
.L91:
	movsd	%xmm2, 96(%rsp,%rax,8)
	incq	%rax
	cmpq	$2, %rax
	jne	.L93
	movaps	%xmm7, %xmm2
	movq	32(%rbp), %rcx
	movsd	.LC9(%rip), %xmm6
	mulsd	%xmm0, %xmm2
	movsd	(%rcx,%r15), %xmm4
	orq	$-1, %rcx
	subsd	%xmm1, %xmm4
	addsd	%xmm3, %xmm2
	movsd	40(%rbx), %xmm3
	movaps	%xmm3, %xmm5
	divsd	%xmm7, %xmm2
	movsd	.LC8(%rip), %xmm7
	mulsd	%xmm0, %xmm5
	cvttsd2sil	%xmm2, %eax
.L98:
	leal	(%rax,%rcx), %edi
	movaps	%xmm4, %xmm1
	cvtsi2sdl	%edi, %xmm2
	mulsd	%xmm3, %xmm2
	subsd	%xmm2, %xmm1
	movaps	%xmm1, %xmm2
	andps	%xmm8, %xmm2
	comisd	%xmm2, %xmm5
	jb	.L127
	divsd	%xmm3, %xmm1
	mulsd	%xmm1, %xmm1
	movaps	%xmm1, %xmm2
	movaps	%xmm7, %xmm1
	subsd	%xmm2, %xmm1
	jmp	.L96
.L127:
	movaps	%xmm5, %xmm1
	mulsd	%xmm6, %xmm1
	comisd	%xmm2, %xmm1
	jb	.L128
	divsd	%xmm3, %xmm2
	movsd	.LC10(%rip), %xmm1
	subsd	%xmm2, %xmm1
	mulsd	%xmm1, %xmm1
	mulsd	%xmm0, %xmm1
	jmp	.L96
.L128:
	xorps	%xmm1, %xmm1
.L96:
	movsd	%xmm1, 120(%rsp,%rcx,8)
	incq	%rcx
	leaq	112(%rsp), %r14
	cmpq	$2, %rcx
	jne	.L98
	movl	8(%rbx), %r9d
	movl	12(%rbx), %r12d
	orq	$-1, %rdi
	movl	16(%rbx), %r11d
	movq	8(%rbp), %rcx
	addl	%r9d, %edx
	addl	%r12d, %esi
	movq	56(%rbx), %r13
	addl	%r11d, %eax
	movl	%edx, 40(%rsp)
	addq	%r15, %rcx
	leaq	88(%rsp), %r15
	movl	%esi, 32(%rsp)
	movl	%eax, 24(%rsp)
.L99:
	movl	40(%rsp), %eax
	movsd	72(%rsp,%rdi,8), %xmm1
	orq	$-1, %rsi
	addl	%edi, %eax
	cltd
	idivl	%r9d
	imull	%r9d, %edx
	movl	%edx, %r8d
	imull	%r12d, %r8d
.L103:
	movl	32(%rsp), %eax
	movsd	8(%r15,%rsi,8), %xmm2
	orq	$-1, %r10
	mulsd	%xmm1, %xmm2
	addl	%esi, %eax
	cltd
	idivl	%r12d
	imull	%r9d, %edx
	leal	(%rdx,%r8), %eax
	movl	%eax, 16(%rsp)
.L100:
	movl	24(%rsp), %eax
	movsd	8(%r14,%r10,8), %xmm0
	mulsd	%xmm2, %xmm0
	addl	%r10d, %eax
	incq	%r10
	mulsd	(%rcx), %xmm0
	cltd
	idivl	%r11d
	movl	16(%rsp), %eax
	addl	%eax, %edx
	movslq	%edx, %rdx
	leaq	0(%r13,%rdx,8), %rax
	addsd	(%rax), %xmm0
	movsd	%xmm0, (%rax)
	cmpq	$2, %r10
	jne	.L100
	incq	%rsi
	cmpq	$2, %rsi
	jne	.L103
	incq	%rdi
	cmpq	$2, %rdi
	jne	.L99
.L78:
	incq	8(%rsp)
	jmp	.L76
.L131:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L105
	call	__stack_chk_fail@PLT
.L105:
	addq	$152, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3966:
	.size	_Z6WeightP6grid3DP10particle3Di, .-_Z6WeightP6grid3DP10particle3Di
	.globl	_Z11WeightForceP6grid3DP10particle3Di
	.type	_Z11WeightForceP6grid3DP10particle3Di, @function
_Z11WeightForceP6grid3DP10particle3Di:
.LFB3967:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$168, %rsp
	.cfi_def_cfa_offset 224
	movl	%edx, 72(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)
.L133:
	movl	8(%rsp), %eax
	cmpl	%eax, 0(%rbp)
	jle	.L187
	movsd	(%rbx), %xmm0
	movsd	.LC5(%rip), %xmm1
	xorps	.LC4(%rip), %xmm0
	movq	8(%rsp), %rax
	movq	16(%rbp), %r9
	movq	24(%rbp), %r8
	mulsd	%xmm1, %xmm0
	leaq	0(,%rax,8), %r13
	movq	32(%rbp), %rdi
	movq	40(%rbp), %r10
	addq	%r13, %r9
	addq	%r13, %r8
	movq	48(%rbp), %r11
	movq	56(%rbp), %r12
	movsd	(%r9), %xmm2
	addq	%r13, %rdi
	addq	%r13, %r10
	addq	%r13, %r11
	addq	%r13, %r12
	cmpl	$0, 72(%rsp)
	subsd	%xmm0, %xmm2
	divsd	24(%rbx), %xmm2
	cvttsd2sil	%xmm2, %eax
	movsd	(%r8), %xmm2
	subsd	%xmm0, %xmm2
	divsd	32(%rbx), %xmm2
	cvttsd2sil	%xmm2, %r14d
	movsd	(%rdi), %xmm2
	movl	%eax, (%rsp)
	subsd	%xmm0, %xmm2
	divsd	40(%rbx), %xmm2
	movq	$0x000000000, (%r10)
	cvttsd2sil	%xmm2, %r15d
	movq	$0x000000000, (%r11)
	movq	$0x000000000, (%r12)
	jne	.L134
	cvtsi2sdl	(%rsp), %xmm6
	movsd	24(%rbx), %xmm4
	movsd	(%r9), %xmm2
	movsd	32(%rbx), %xmm5
	movsd	40(%rbx), %xmm3
	movl	(%rsp), %esi
	subsd	%xmm0, %xmm2
	movl	8(%rbx), %eax
	mulsd	%xmm4, %xmm6
	mulsd	%xmm1, %xmm4
	subsd	%xmm6, %xmm2
	cvtsi2sdl	%r14d, %xmm6
	subsd	%xmm4, %xmm2
	movsd	.LC6(%rip), %xmm4
	mulsd	%xmm5, %xmm6
	addsd	%xmm4, %xmm2
	mulsd	%xmm1, %xmm5
	cvttsd2sil	%xmm2, %edx
	movsd	(%r8), %xmm2
	subsd	%xmm0, %xmm2
	addl	%esi, %edx
	imull	%eax, %edx
	subsd	%xmm6, %xmm2
	imull	12(%rbx), %edx
	subsd	%xmm5, %xmm2
	cvtsi2sdl	%r15d, %xmm5
	addsd	%xmm4, %xmm2
	mulsd	%xmm3, %xmm5
	cvttsd2sil	%xmm2, %ecx
	movsd	(%rdi), %xmm2
	mulsd	%xmm1, %xmm3
	subsd	%xmm0, %xmm2
	addl	%r14d, %ecx
	movaps	%xmm2, %xmm0
	imull	%ecx, %eax
	movq	64(%rbx), %rcx
	subsd	%xmm5, %xmm0
	addl	%eax, %edx
	subsd	%xmm3, %xmm0
	addsd	%xmm4, %xmm0
	cvttsd2sil	%xmm0, %eax
	addl	%r15d, %eax
	addl	%eax, %edx
	movq	8(%rbp), %rax
	movslq	%edx, %rdx
	addq	%r13, %rax
	movsd	(%rcx,%rdx,8), %xmm0
	movq	72(%rbx), %rcx
	mulsd	(%rax), %xmm0
	movsd	%xmm0, (%r10)
	movsd	(%rcx,%rdx,8), %xmm0
	mulsd	(%rax), %xmm0
	movq	80(%rbx), %rcx
	movsd	%xmm0, (%r11)
	movsd	(%rcx,%rdx,8), %xmm0
	mulsd	(%rax), %xmm0
	movsd	%xmm0, (%r12)
	jmp	.L135
.L134:
	cmpl	$1, 72(%rsp)
	jne	.L136
	movl	8(%rbx), %eax
	movq	72(%rbx), %rsi
	movq	.LC7(%rip), %xmm3
	movsd	.LC6(%rip), %xmm4
	movl	%eax, 32(%rsp)
	movl	12(%rbx), %eax
	movq	%rsi, 56(%rsp)
	movq	80(%rbx), %rsi
	movl	%eax, 40(%rsp)
	movq	64(%rbx), %rax
	movq	%rsi, 64(%rsp)
	movq	%rax, 48(%rsp)
	movq	8(%rbp), %rax
	addq	%r13, %rax
	xorl	%r13d, %r13d
.L137:
	leal	0(%r13,%r15), %ecx
	xorl	%esi, %esi
	cvtsi2sdl	%ecx, %xmm5
	movl	%ecx, 24(%rsp)
.L138:
	movl	(%rsp), %ecx
	movl	%esi, %edx
	movsd	24(%rbx), %xmm7
	sarl	%edx
	movsd	(%r9), %xmm1
	movsd	32(%rbx), %xmm2
	addl	%ecx, %edx
	movl	%esi, %ecx
	incl	%esi
	cvtsi2sdl	%edx, %xmm6
	subsd	%xmm0, %xmm1
	andl	$1, %ecx
	addl	%r14d, %ecx
	movl	%ecx, 16(%rsp)
	mulsd	%xmm7, %xmm6
	subsd	%xmm6, %xmm1
	movaps	%xmm4, %xmm6
	andps	%xmm3, %xmm1
	divsd	%xmm7, %xmm1
	cvtsi2sdl	%ecx, %xmm7
	movl	32(%rsp), %ecx
	imull	%ecx, %edx
	movl	40(%rsp), %ecx
	mulsd	%xmm2, %xmm7
	imull	%ecx, %edx
	movl	32(%rsp), %ecx
	movl	%edx, 76(%rsp)
	movl	16(%rsp), %edx
	imull	%ecx, %edx
	movl	%edx, %ecx
	movl	76(%rsp), %edx
	addl	%ecx, %edx
	movl	24(%rsp), %ecx
	addl	%ecx, %edx
	movq	48(%rsp), %rcx
	movslq	%edx, %rdx
	subsd	%xmm1, %xmm6
	movsd	(%r8), %xmm1
	subsd	%xmm0, %xmm1
	subsd	%xmm7, %xmm1
	movaps	%xmm5, %xmm7
	andps	%xmm3, %xmm1
	divsd	%xmm2, %xmm1
	movaps	%xmm4, %xmm2
	subsd	%xmm1, %xmm2
	movsd	40(%rbx), %xmm1
	mulsd	%xmm1, %xmm7
	mulsd	%xmm2, %xmm6
	movsd	(%rdi), %xmm2
	subsd	%xmm0, %xmm2
	subsd	%xmm7, %xmm2
	andps	%xmm3, %xmm2
	divsd	%xmm1, %xmm2
	movaps	%xmm4, %xmm1
	subsd	%xmm2, %xmm1
	movsd	(%rcx,%rdx,8), %xmm2
	movq	56(%rsp), %rcx
	mulsd	%xmm6, %xmm1
	mulsd	%xmm1, %xmm2
	mulsd	(%rax), %xmm2
	addsd	(%r10), %xmm2
	movsd	%xmm2, (%r10)
	movsd	(%rcx,%rdx,8), %xmm2
	movq	64(%rsp), %rcx
	mulsd	%xmm1, %xmm2
	mulsd	(%rax), %xmm2
	addsd	(%r11), %xmm2
	movsd	%xmm2, (%r11)
	mulsd	(%rcx,%rdx,8), %xmm1
	mulsd	(%rax), %xmm1
	addsd	(%r12), %xmm1
	movsd	%xmm1, (%r12)
	cmpl	$4, %esi
	jne	.L138
	testl	%r13d, %r13d
	jne	.L135
	movl	$1, %r13d
	jmp	.L137
.L136:
	cmpl	$2, 72(%rsp)
	jne	.L135
	movsd	24(%rbx), %xmm3
	movsd	(%r9), %xmm2
	orq	$-1, %r14
	movsd	32(%rbx), %xmm7
	movq	(%rdi), %r12
	movaps	%xmm3, %xmm4
	subsd	%xmm0, %xmm2
	movsd	40(%rbx), %xmm6
	movq	.LC7(%rip), %xmm5
	mulsd	%xmm1, %xmm4
	addsd	%xmm4, %xmm2
	movsd	(%r8), %xmm4
	divsd	%xmm3, %xmm2
	cvttsd2sil	%xmm2, %r15d
.L145:
	movq	16(%rbp), %rax
	movsd	24(%rbx), %xmm8
	movsd	(%rax,%r13), %xmm2
	leal	(%r15,%r14), %eax
	movaps	%xmm8, %xmm9
	cvtsi2sdl	%eax, %xmm3
	mulsd	%xmm1, %xmm9
	subsd	%xmm0, %xmm2
	mulsd	%xmm8, %xmm3
	subsd	%xmm3, %xmm2
	movaps	%xmm2, %xmm3
	andps	%xmm5, %xmm3
	comisd	%xmm3, %xmm9
	jb	.L180
	divsd	%xmm8, %xmm2
	movaps	%xmm2, %xmm3
	mulsd	%xmm2, %xmm3
	movsd	.LC8(%rip), %xmm2
	subsd	%xmm3, %xmm2
	jmp	.L142
.L180:
	mulsd	.LC9(%rip), %xmm9
	comisd	%xmm3, %xmm9
	jb	.L181
	divsd	%xmm8, %xmm3
	movsd	.LC10(%rip), %xmm2
	subsd	%xmm3, %xmm2
	mulsd	%xmm2, %xmm2
	mulsd	%xmm1, %xmm2
	jmp	.L142
.L181:
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	movsd	%xmm0, 32(%rsp)
	movsd	%xmm6, 24(%rsp)
	movsd	%xmm7, 16(%rsp)
	movsd	%xmm4, (%rsp)
	call	__printf_chk@PLT
	movq	.LC7(%rip), %xmm5
	movsd	(%rsp), %xmm4
	xorps	%xmm2, %xmm2
	movsd	.LC5(%rip), %xmm1
	movsd	32(%rsp), %xmm0
	movsd	24(%rsp), %xmm6
	movsd	16(%rsp), %xmm7
.L142:
	movsd	%xmm2, 88(%rsp,%r14,8)
	incq	%r14
	cmpq	$2, %r14
	jne	.L145
	movaps	%xmm7, %xmm2
	subsd	%xmm0, %xmm4
	movq	24(%rbp), %rax
	movsd	.LC9(%rip), %xmm8
	movsd	.LC8(%rip), %xmm9
	mulsd	%xmm1, %xmm2
	movsd	(%rax,%r13), %xmm10
	orq	$-1, %rax
	subsd	%xmm0, %xmm10
	addsd	%xmm2, %xmm4
	divsd	%xmm7, %xmm4
	cvttsd2sil	%xmm4, %edx
	movsd	32(%rbx), %xmm4
	movaps	%xmm4, %xmm7
	mulsd	%xmm1, %xmm7
.L150:
	leal	(%rdx,%rax), %ecx
	movaps	%xmm10, %xmm2
	cvtsi2sdl	%ecx, %xmm3
	mulsd	%xmm4, %xmm3
	subsd	%xmm3, %xmm2
	movaps	%xmm2, %xmm3
	andps	%xmm5, %xmm3
	comisd	%xmm3, %xmm7
	jb	.L182
	divsd	%xmm4, %xmm2
	movaps	%xmm2, %xmm3
	mulsd	%xmm2, %xmm3
	movaps	%xmm9, %xmm2
	subsd	%xmm3, %xmm2
	jmp	.L148
.L182:
	movaps	%xmm7, %xmm2
	mulsd	%xmm8, %xmm2
	comisd	%xmm3, %xmm2
	jb	.L183
	divsd	%xmm4, %xmm3
	movsd	.LC10(%rip), %xmm2
	subsd	%xmm3, %xmm2
	mulsd	%xmm2, %xmm2
	mulsd	%xmm1, %xmm2
	jmp	.L148
.L183:
	xorps	%xmm2, %xmm2
.L148:
	movsd	%xmm2, 112(%rsp,%rax,8)
	incq	%rax
	cmpq	$2, %rax
	jne	.L150
	movaps	%xmm6, %xmm3
	movq	%r12, %xmm2
	movq	32(%rbp), %rcx
	movsd	.LC9(%rip), %xmm7
	mulsd	%xmm1, %xmm3
	subsd	%xmm0, %xmm2
	movsd	.LC8(%rip), %xmm8
	movsd	(%rcx,%r13), %xmm4
	orq	$-1, %rcx
	subsd	%xmm0, %xmm4
	addsd	%xmm3, %xmm2
	movsd	40(%rbx), %xmm3
	divsd	%xmm6, %xmm2
	movaps	%xmm3, %xmm6
	mulsd	%xmm1, %xmm6
	cvttsd2sil	%xmm2, %eax
.L155:
	leal	(%rax,%rcx), %esi
	movaps	%xmm4, %xmm0
	cvtsi2sdl	%esi, %xmm2
	mulsd	%xmm3, %xmm2
	subsd	%xmm2, %xmm0
	movaps	%xmm0, %xmm2
	andps	%xmm5, %xmm2
	comisd	%xmm2, %xmm6
	jb	.L184
	divsd	%xmm3, %xmm0
	mulsd	%xmm0, %xmm0
	movaps	%xmm0, %xmm2
	movaps	%xmm8, %xmm0
	subsd	%xmm2, %xmm0
	jmp	.L153
.L184:
	movaps	%xmm6, %xmm0
	mulsd	%xmm7, %xmm0
	comisd	%xmm2, %xmm0
	jb	.L185
	divsd	%xmm3, %xmm2
	movsd	.LC10(%rip), %xmm0
	subsd	%xmm2, %xmm0
	mulsd	%xmm0, %xmm0
	mulsd	%xmm1, %xmm0
	jmp	.L153
.L185:
	xorps	%xmm0, %xmm0
.L153:
	leaq	128(%rsp), %rdi
	movsd	%xmm0, 136(%rsp,%rcx,8)
	incq	%rcx
	movq	%rdi, 48(%rsp)
	cmpq	$2, %rcx
	jne	.L155
	movl	16(%rbx), %edi
	movl	8(%rbx), %r8d
	movl	12(%rbx), %r10d
	movq	72(%rbx), %rsi
	movq	40(%rbp), %r12
	movq	8(%rbp), %r11
	movl	%edi, (%rsp)
	movq	64(%rbx), %rdi
	movq	48(%rbp), %r14
	movq	%rsi, 32(%rsp)
	orq	$-1, %rsi
	addq	%r13, %r12
	addq	%r13, %r11
	movq	%rdi, 24(%rsp)
	movq	80(%rbx), %rdi
	addq	%r13, %r14
	addq	56(%rbp), %r13
	movq	%rdi, 40(%rsp)
	leal	(%r8,%r15), %edi
	leaq	104(%rsp), %r15
	movl	%edi, 76(%rsp)
	leal	(%r10,%rdx), %edi
	movl	%edi, 64(%rsp)
	movl	(%rsp), %edi
	addl	%edi, %eax
	movl	%eax, 56(%rsp)
.L156:
	movl	76(%rsp), %eax
	movsd	88(%rsp,%rsi,8), %xmm2
	orq	$-1, %rcx
	addl	%esi, %eax
	cltd
	idivl	%r8d
	movl	%edx, %edi
	imull	%r8d, %edi
	imull	%r10d, %edi
.L160:
	movl	64(%rsp), %eax
	movsd	8(%r15,%rcx,8), %xmm3
	orq	$-1, %r9
	mulsd	%xmm2, %xmm3
	addl	%ecx, %eax
	cltd
	idivl	%r10d
	imull	%r8d, %edx
	leal	(%rdx,%rdi), %eax
	movl	%eax, 16(%rsp)
.L157:
	movq	48(%rsp), %rax
	movsd	8(%rax,%r9,8), %xmm0
	movl	56(%rsp), %eax
	mulsd	%xmm3, %xmm0
	addl	%r9d, %eax
	incq	%r9
	cltd
	idivl	(%rsp)
	movl	16(%rsp), %eax
	addl	%eax, %edx
	movq	24(%rsp), %rax
	movslq	%edx, %rdx
	movsd	(%rax,%rdx,8), %xmm1
	movq	32(%rsp), %rax
	mulsd	%xmm0, %xmm1
	mulsd	(%r11), %xmm1
	addsd	(%r12), %xmm1
	movsd	%xmm1, (%r12)
	movsd	(%rax,%rdx,8), %xmm1
	movq	40(%rsp), %rax
	mulsd	%xmm0, %xmm1
	mulsd	(%r11), %xmm1
	addsd	(%r14), %xmm1
	movsd	%xmm1, (%r14)
	mulsd	(%rax,%rdx,8), %xmm0
	mulsd	(%r11), %xmm0
	addsd	0(%r13), %xmm0
	movsd	%xmm0, 0(%r13)
	cmpq	$2, %r9
	jne	.L157
	incq	%rcx
	cmpq	$2, %rcx
	jne	.L160
	incq	%rsi
	cmpq	$2, %rsi
	jne	.L156
.L135:
	incq	8(%rsp)
	jmp	.L133
.L187:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L162
	call	__stack_chk_fail@PLT
.L162:
	addq	$168, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3967:
	.size	_Z11WeightForceP6grid3DP10particle3Di, .-_Z11WeightForceP6grid3DP10particle3Di
	.globl	_Z4kickP10particle3Dd
	.type	_Z4kickP10particle3Dd, @function
_Z4kickP10particle3Dd:
.LFB3968:
	.cfi_startproc
	endbr64
	movl	(%rdi), %ecx
	movq	%rdi, %rax
	xorl	%edx, %edx
.L189:
	cmpl	%edx, %ecx
	jle	.L191
	movq	8(%rax), %rdi
	movq	40(%rax), %r8
	leaq	0(,%rdx,8), %rsi
	movsd	(%rdi,%rdx,8), %xmm4
	movsd	(%r8,%rdx,8), %xmm3
	movq	48(%rax), %rdi
	divsd	%xmm4, %xmm3
	movsd	(%rdi,%rdx,8), %xmm2
	movq	56(%rax), %rdi
	movsd	(%rdi,%rdx,8), %xmm1
	movq	64(%rax), %rdi
	incq	%rdx
	addq	%rsi, %rdi
	divsd	%xmm4, %xmm2
	mulsd	%xmm0, %xmm3
	addsd	(%rdi), %xmm3
	movsd	%xmm3, (%rdi)
	movq	72(%rax), %rdi
	addq	%rsi, %rdi
	addq	80(%rax), %rsi
	divsd	%xmm4, %xmm1
	mulsd	%xmm0, %xmm2
	addsd	(%rdi), %xmm2
	movsd	%xmm2, (%rdi)
	mulsd	%xmm0, %xmm1
	addsd	(%rsi), %xmm1
	movsd	%xmm1, (%rsi)
	jmp	.L189
.L191:
	ret
	.cfi_endproc
.LFE3968:
	.size	_Z4kickP10particle3Dd, .-_Z4kickP10particle3Dd
	.globl	_Z5driftP10particle3Dd
	.type	_Z5driftP10particle3Dd, @function
_Z5driftP10particle3Dd:
.LFB3969:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movl	(%rdi), %edi
	xorl	%edx, %edx
.L193:
	cmpl	%edx, %edi
	jle	.L195
	movq	64(%rax), %r8
	movq	16(%rax), %rsi
	leaq	0(,%rdx,8), %rcx
	movsd	(%r8,%rdx,8), %xmm1
	addq	%rcx, %rsi
	movq	72(%rax), %r8
	mulsd	%xmm0, %xmm1
	addsd	(%rsi), %xmm1
	movsd	%xmm1, (%rsi)
	movq	24(%rax), %rsi
	movsd	(%r8,%rdx,8), %xmm1
	mulsd	%xmm0, %xmm1
	addq	%rcx, %rsi
	addq	32(%rax), %rcx
	addsd	(%rsi), %xmm1
	movsd	%xmm1, (%rsi)
	movq	80(%rax), %rsi
	movsd	(%rsi,%rdx,8), %xmm1
	incq	%rdx
	mulsd	%xmm0, %xmm1
	addsd	(%rcx), %xmm1
	movsd	%xmm1, (%rcx)
	jmp	.L193
.L195:
	ret
	.cfi_endproc
.LFE3969:
	.size	_Z5driftP10particle3Dd, .-_Z5driftP10particle3Dd
	.globl	_Z8init_rk4P10particle3DS0_P5rk43D
	.type	_Z8init_rk4P10particle3DS0_P5rk43D, @function
_Z8init_rk4P10particle3DS0_P5rk43D:
.LFB3970:
	.cfi_startproc
	endbr64
	movabsq	$4294967296, %r8
	movq	%rdi, %rcx
	movl	(%rdi), %edi
	xorl	%eax, %eax
.L197:
	cmpl	%eax, %edi
	jle	.L199
	movq	64(%rcx), %r9
	movsd	(%r9,%rax,8), %xmm0
	movq	64(%rsi), %r9
	movsd	%xmm0, (%r9,%rax,8)
	movq	72(%rcx), %r9
	movsd	(%r9,%rax,8), %xmm0
	movq	72(%rsi), %r9
	movsd	%xmm0, (%r9,%rax,8)
	movq	80(%rcx), %r9
	movsd	(%r9,%rax,8), %xmm0
	movq	80(%rsi), %r9
	movsd	%xmm0, (%r9,%rax,8)
	movq	40(%rcx), %r9
	movsd	(%r9,%rax,8), %xmm0
	movq	40(%rsi), %r9
	movsd	%xmm0, (%r9,%rax,8)
	movq	48(%rcx), %r9
	movsd	(%r9,%rax,8), %xmm0
	movq	48(%rsi), %r9
	movsd	%xmm0, (%r9,%rax,8)
	movq	56(%rcx), %r9
	movsd	(%r9,%rax,8), %xmm0
	movq	56(%rsi), %r9
	movsd	%xmm0, (%r9,%rax,8)
	movq	8(%rdx), %r9
	movq	$0x000000000, (%r9,%rax,8)
	movq	16(%rdx), %r9
	movq	$0x000000000, (%r9,%rax,8)
	movq	24(%rdx), %r9
	movq	$0x000000000, (%r9,%rax,8)
	movq	32(%rdx), %r9
	movq	$0x000000000, (%r9,%rax,8)
	movq	40(%rdx), %r9
	movq	$0x000000000, (%r9,%rax,8)
	movq	48(%rdx), %r9
	movq	$0x000000000, (%r9,%rax,8)
	incq	%rax
	movq	%r8, (%rdx)
	jmp	.L197
.L199:
	ret
	.cfi_endproc
.LFE3970:
	.size	_Z8init_rk4P10particle3DS0_P5rk43D, .-_Z8init_rk4P10particle3DS0_P5rk43D
	.globl	_Z7rk4_midP10particle3DS0_P5rk43Ddi
	.type	_Z7rk4_midP10particle3DS0_P5rk43Ddi, @function
_Z7rk4_midP10particle3DS0_P5rk43Ddi:
.LFB3971:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movsd	.LC12(%rip), %xmm2
	movq	%rdx, %r8
	movaps	%xmm0, %xmm1
	movl	(%rdi), %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	xorl	%eax, %eax
	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
	movl	%ecx, %ebx
.L201:
	cmpl	%eax, %r15d
	jle	.L204
	movq	40(%rsi), %r11
	leaq	0(,%rax,8), %rdx
	movq	40(%rdi), %rcx
	cvtsi2sdl	(%r8), %xmm3
	movq	48(%rsi), %r10
	cvtsi2sdl	4(%r8), %xmm0
	addq	%rdx, %r11
	movsd	(%rcx,%rax,8), %xmm4
	movsd	(%r11), %xmm5
	movq	48(%rdi), %rcx
	addq	%rdx, %r10
	movq	56(%rsi), %r9
	movq	64(%rsi), %r13
	mulsd	%xmm3, %xmm5
	movq	16(%rdi), %rbp
	movq	72(%rsi), %r12
	mulsd	%xmm0, %xmm4
	addq	%rdx, %r9
	addq	%rdx, %r13
	movq	32(%rdi), %r14
	addq	%rdx, %r12
	addsd	%xmm5, %xmm4
	movsd	%xmm4, (%r11)
	movsd	(%rcx,%rax,8), %xmm4
	movsd	(%r10), %xmm5
	movq	56(%rdi), %rcx
	mulsd	%xmm0, %xmm4
	mulsd	%xmm3, %xmm5
	addsd	%xmm5, %xmm4
	movsd	%xmm4, (%r10)
	mulsd	(%rcx,%rax,8), %xmm0
	movq	16(%rsi), %rcx
	mulsd	(%r9), %xmm3
	addsd	%xmm3, %xmm0
	movsd	%xmm0, (%r9)
	movsd	0(%r13), %xmm0
	mulsd	%xmm1, %xmm0
	addsd	0(%rbp,%rax,8), %xmm0
	movq	24(%rdi), %rbp
	movsd	%xmm0, (%rcx,%rax,8)
	movsd	(%r12), %xmm0
	movq	24(%rsi), %rcx
	mulsd	%xmm1, %xmm0
	addsd	0(%rbp,%rax,8), %xmm0
	movq	80(%rsi), %rbp
	addq	%rdx, %rbp
	movsd	%xmm0, (%rcx,%rax,8)
	movq	32(%rsi), %rcx
	movsd	0(%rbp), %xmm0
	mulsd	%xmm1, %xmm0
	addsd	(%r14,%rax,8), %xmm0
	movq	8(%r8), %r14
	addq	%rdx, %r14
	movsd	%xmm0, (%rcx,%rax,8)
	cvtsi2sdl	%ebx, %xmm0
	movq	8(%rdi), %rcx
	movsd	(%r11), %xmm3
	addq	%rdx, %rcx
	divsd	%xmm2, %xmm0
	mulsd	%xmm0, %xmm3
	divsd	(%rcx), %xmm3
	addsd	(%r14), %xmm3
	movsd	%xmm3, (%r14)
	movq	16(%r8), %r14
	movsd	(%r10), %xmm3
	mulsd	%xmm0, %xmm3
	addq	%rdx, %r14
	divsd	(%rcx), %xmm3
	addsd	(%r14), %xmm3
	movsd	%xmm3, (%r14)
	movq	24(%r8), %r14
	movsd	(%r9), %xmm3
	mulsd	%xmm0, %xmm3
	addq	%rdx, %r14
	divsd	(%rcx), %xmm3
	addsd	(%r14), %xmm3
	movsd	%xmm3, (%r14)
	movq	32(%r8), %r14
	movsd	0(%r13), %xmm3
	mulsd	%xmm0, %xmm3
	addq	%rdx, %r14
	addsd	(%r14), %xmm3
	movsd	%xmm3, (%r14)
	movq	40(%r8), %r14
	movsd	(%r12), %xmm3
	mulsd	%xmm0, %xmm3
	addq	%rdx, %r14
	addq	48(%r8), %rdx
	addsd	(%r14), %xmm3
	movsd	%xmm3, (%r14)
	mulsd	0(%rbp), %xmm0
	addsd	(%rdx), %xmm0
	movsd	%xmm0, (%rdx)
	movsd	(%r11), %xmm0
	divsd	(%rcx), %xmm0
	movq	64(%rdi), %rdx
	mulsd	%xmm1, %xmm0
	addsd	(%rdx,%rax,8), %xmm0
	movq	72(%rdi), %rdx
	movsd	%xmm0, 0(%r13)
	movsd	(%r10), %xmm0
	divsd	(%rcx), %xmm0
	mulsd	%xmm1, %xmm0
	addsd	(%rdx,%rax,8), %xmm0
	movq	80(%rdi), %rdx
	movsd	%xmm0, (%r12)
	movsd	(%r9), %xmm0
	divsd	(%rcx), %xmm0
	mulsd	%xmm1, %xmm0
	addsd	(%rdx,%rax,8), %xmm0
	incq	%rax
	movsd	%xmm0, 0(%rbp)
	movq	$1, (%r8)
	jmp	.L201
.L204:
	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
.LFE3971:
	.size	_Z7rk4_midP10particle3DS0_P5rk43Ddi, .-_Z7rk4_midP10particle3DS0_P5rk43Ddi
	.globl	_Z7rk4_endP10particle3DP5rk43Dd
	.type	_Z7rk4_endP10particle3DP5rk43Dd, @function
_Z7rk4_endP10particle3DP5rk43Dd:
.LFB3972:
	.cfi_startproc
	endbr64
	movq	%rdi, %rdx
	movl	(%rdi), %edi
	xorl	%eax, %eax
.L206:
	cmpl	%eax, %edi
	jle	.L208
	movq	32(%rsi), %r9
	movq	16(%rdx), %r8
	leaq	0(,%rax,8), %rcx
	movsd	(%r9,%rax,8), %xmm1
	addq	%rcx, %r8
	movq	40(%rsi), %r9
	mulsd	%xmm0, %xmm1
	addsd	(%r8), %xmm1
	movsd	%xmm1, (%r8)
	movq	24(%rdx), %r8
	movsd	(%r9,%rax,8), %xmm1
	movq	48(%rsi), %r9
	mulsd	%xmm0, %xmm1
	addq	%rcx, %r8
	addsd	(%r8), %xmm1
	movsd	%xmm1, (%r8)
	movq	32(%rdx), %r8
	movsd	(%r9,%rax,8), %xmm1
	movq	8(%rsi), %r9
	mulsd	%xmm0, %xmm1
	addq	%rcx, %r8
	addsd	(%r8), %xmm1
	movsd	%xmm1, (%r8)
	movq	64(%rdx), %r8
	movsd	(%r9,%rax,8), %xmm1
	movq	16(%rsi), %r9
	mulsd	%xmm0, %xmm1
	addq	%rcx, %r8
	addsd	(%r8), %xmm1
	movsd	%xmm1, (%r8)
	movq	72(%rdx), %r8
	movsd	(%r9,%rax,8), %xmm1
	mulsd	%xmm0, %xmm1
	addq	%rcx, %r8
	addq	80(%rdx), %rcx
	addsd	(%r8), %xmm1
	movsd	%xmm1, (%r8)
	movq	24(%rsi), %r8
	movsd	(%r8,%rax,8), %xmm1
	incq	%rax
	mulsd	%xmm0, %xmm1
	addsd	(%rcx), %xmm1
	movsd	%xmm1, (%rcx)
	jmp	.L206
.L208:
	ret
	.cfi_endproc
.LFE3972:
	.size	_Z7rk4_endP10particle3DP5rk43Dd, .-_Z7rk4_endP10particle3DP5rk43Dd
	.section	.rodata.str1.1
.LC13:
	.string	"A particle reaches the boundary."
	.text
	.globl	_Z17periodic_boundarydd
	.type	_Z17periodic_boundarydd, @function
_Z17periodic_boundarydd:
.LFB3973:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	.LC7(%rip), %xmm3
	movaps	%xmm0, %xmm4
	movaps	%xmm0, %xmm2
	andps	%xmm3, %xmm4
	divsd	%xmm4, %xmm2
	cvttsd2sil	%xmm2, %eax
	cvtsi2sdl	%eax, %xmm2
	mulsd	%xmm1, %xmm2
	mulsd	.LC5(%rip), %xmm2
	addsd	%xmm2, %xmm0
	andps	%xmm3, %xmm0
	call	remainder@PLT
	leaq	_ZSt4cout(%rip), %rdi
	leaq	.LC13(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	popq	%rdx
	.cfi_def_cfa_offset 8
	movq	%rax, %rdi
	jmp	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	.cfi_endproc
.LFE3973:
	.size	_Z17periodic_boundarydd, .-_Z17periodic_boundarydd
	.globl	_Z14boundary_checkiP10particle3Dd
	.type	_Z14boundary_checkiP10particle3Dd, @function
_Z14boundary_checkiP10particle3Dd:
.LFB3974:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movaps	%xmm0, %xmm1
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rsi, %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	testl	%edi, %edi
	jne	.L234
	xorl	%ebp, %ebp
.L212:
	cmpl	%ebp, (%rbx)
	jle	.L211
	movsd	.LC5(%rip), %xmm4
	movq	16(%rbx), %rax
	leaq	0(,%rbp,8), %r12
	mulsd	%xmm1, %xmm4
	movsd	(%rax,%rbp,8), %xmm0
	movaps	%xmm0, %xmm2
	andps	.LC7(%rip), %xmm2
	comisd	%xmm4, %xmm2
	movsd	%xmm4, (%rsp)
	jbe	.L214
	movsd	%xmm1, 8(%rsp)
	call	_Z17periodic_boundarydd
	movsd	8(%rsp), %xmm1
.L214:
	movq	24(%rbx), %rax
	movsd	(%rax,%r12), %xmm0
	movaps	%xmm0, %xmm2
	andps	.LC7(%rip), %xmm2
	comisd	(%rsp), %xmm2
	jbe	.L216
	movsd	%xmm1, 8(%rsp)
	call	_Z17periodic_boundarydd
	movsd	8(%rsp), %xmm1
.L216:
	movq	32(%rbx), %rax
	movsd	(%rax,%r12), %xmm0
	movaps	%xmm0, %xmm2
	andps	.LC7(%rip), %xmm2
	comisd	(%rsp), %xmm2
	jbe	.L218
	movsd	%xmm1, (%rsp)
	call	_Z17periodic_boundarydd
	movsd	(%rsp), %xmm1
.L218:
	incq	%rbp
	jmp	.L212
.L234:
	decl	%edi
	jne	.L211
	movq	.LC7(%rip), %xmm0
	xorl	%ebp, %ebp
.L221:
	cmpl	%ebp, (%rbx)
	jle	.L211
	movsd	.LC5(%rip), %xmm2
	movq	16(%rbx), %rdx
	leaq	0(,%rbp,8), %rax
	mulsd	%xmm1, %xmm2
	movsd	(%rdx,%rbp,8), %xmm3
	andps	%xmm0, %xmm3
	comisd	%xmm2, %xmm3
	ja	.L223
	movq	24(%rbx), %rdx
	movsd	(%rdx,%rbp,8), %xmm3
	andps	%xmm0, %xmm3
	comisd	%xmm2, %xmm3
	ja	.L223
	movq	32(%rbx), %rdx
	movsd	(%rdx,%rax), %xmm3
	andps	%xmm0, %xmm3
	comisd	%xmm2, %xmm3
	jbe	.L224
.L223:
	movq	8(%rbx), %rdx
	leaq	.LC13(%rip), %rsi
	movsd	%xmm1, (%rsp)
	leaq	_ZSt4cout(%rip), %rdi
	movq	$0x000000000, (%rdx,%rax)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	movq	.LC7(%rip), %xmm0
	movsd	(%rsp), %xmm1
.L224:
	incq	%rbp
	jmp	.L221
.L211:
	addq	$16, %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
.LFE3974:
	.size	_Z14boundary_checkiP10particle3Dd, .-_Z14boundary_checkiP10particle3Dd
	.globl	_Z20locateMemoryParticleP10particle3Di
	.type	_Z20locateMemoryParticleP10particle3Di, @function
_Z20locateMemoryParticleP10particle3Di:
.LFB3975:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%esi, %rbx
	pushq	%rax
	.cfi_def_cfa_offset 32
	salq	$3, %rbx
	movq	%rbx, %rdi
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 8(%rbp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 16(%rbp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 24(%rbp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 32(%rbp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 40(%rbp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 48(%rbp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 56(%rbp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 64(%rbp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 72(%rbp)
	call	malloc@PLT
	movq	%rax, 80(%rbp)
	popq	%rdx
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3975:
	.size	_Z20locateMemoryParticleP10particle3Di, .-_Z20locateMemoryParticleP10particle3Di
	.globl	_Z18freeMemoryParticleP10particle3D
	.type	_Z18freeMemoryParticleP10particle3D, @function
_Z18freeMemoryParticleP10particle3D:
.LFB3976:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	movq	8(%rdi), %rdi
	call	free@PLT
	movq	16(%rbx), %rdi
	call	free@PLT
	movq	24(%rbx), %rdi
	call	free@PLT
	movq	32(%rbx), %rdi
	call	free@PLT
	movq	40(%rbx), %rdi
	call	free@PLT
	movq	48(%rbx), %rdi
	call	free@PLT
	movq	56(%rbx), %rdi
	call	free@PLT
	movq	64(%rbx), %rdi
	call	free@PLT
	movq	72(%rbx), %rdi
	call	free@PLT
	movq	80(%rbx), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE3976:
	.size	_Z18freeMemoryParticleP10particle3D, .-_Z18freeMemoryParticleP10particle3D
	.globl	_Z15locateMemoryRk4P5rk43Di
	.type	_Z15locateMemoryRk4P5rk43Di, @function
_Z15locateMemoryRk4P5rk43Di:
.LFB3977:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%esi, %rbx
	pushq	%rax
	.cfi_def_cfa_offset 32
	salq	$3, %rbx
	movq	%rbx, %rdi
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 8(%rbp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 16(%rbp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 24(%rbp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 32(%rbp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 40(%rbp)
	call	malloc@PLT
	movq	%rax, 48(%rbp)
	popq	%rdx
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3977:
	.size	_Z15locateMemoryRk4P5rk43Di, .-_Z15locateMemoryRk4P5rk43Di
	.globl	_Z13freeMemoryRk4P5rk43D
	.type	_Z13freeMemoryRk4P5rk43D, @function
_Z13freeMemoryRk4P5rk43D:
.LFB3978:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	movq	8(%rdi), %rdi
	call	free@PLT
	movq	16(%rbx), %rdi
	call	free@PLT
	movq	24(%rbx), %rdi
	call	free@PLT
	movq	32(%rbx), %rdi
	call	free@PLT
	movq	40(%rbx), %rdi
	call	free@PLT
	movq	48(%rbx), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE3978:
	.size	_Z13freeMemoryRk4P5rk43D, .-_Z13freeMemoryRk4P5rk43D
	.globl	_Z16locateMemoryGridP6grid3D
	.type	_Z16locateMemoryGridP6grid3D, @function
_Z16locateMemoryGridP6grid3D:
.LFB3979:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	pushq	%rax
	.cfi_def_cfa_offset 32
	movslq	20(%rdi), %rbp
	salq	$3, %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, 56(%rbx)
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, 48(%rbx)
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, 64(%rbx)
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, 72(%rbx)
	call	malloc@PLT
	movq	%rax, 80(%rbx)
	popq	%rdx
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3979:
	.size	_Z16locateMemoryGridP6grid3D, .-_Z16locateMemoryGridP6grid3D
	.globl	_Z14freeMemoryGridP6grid3D
	.type	_Z14freeMemoryGridP6grid3D, @function
_Z14freeMemoryGridP6grid3D:
.LFB3980:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	movq	56(%rdi), %rdi
	call	free@PLT
	movq	48(%rbx), %rdi
	call	free@PLT
	movq	64(%rbx), %rdi
	call	free@PLT
	movq	72(%rbx), %rdi
	call	free@PLT
	movq	80(%rbx), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE3980:
	.size	_Z14freeMemoryGridP6grid3D, .-_Z14freeMemoryGridP6grid3D
	.globl	_Z39__device_stub__Z10phiToForcePdS_S_S_iddPdS_S_S_idd
	.type	_Z39__device_stub__Z10phiToForcePdS_S_S_iddPdS_S_S_idd, @function
_Z39__device_stub__Z10phiToForcePdS_S_S_iddPdS_S_S_idd:
.LFB4005:
	.cfi_startproc
	endbr64
	subq	$200, %rsp
	.cfi_def_cfa_offset 208
	movq	%rdi, 56(%rsp)
	leaq	80(%rsp), %rdi
	movq	%rsi, 48(%rsp)
	leaq	92(%rsp), %rsi
	movq	%rdx, 40(%rsp)
	leaq	64(%rsp), %rdx
	movq	%rcx, 32(%rsp)
	leaq	72(%rsp), %rcx
	movl	%r8d, 28(%rsp)
	movsd	%xmm0, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rax
	movl	$1, 88(%rsp)
	movq	%rax, 128(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 176(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 80(%rsp)
	movq	%rax, 92(%rsp)
	movl	$1, 100(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L247
	pushq	72(%rsp)
	.cfi_def_cfa_offset 216
	leaq	_Z10phiToForcePdS_S_S_idd(%rip), %rdi
	pushq	72(%rsp)
	.cfi_def_cfa_offset 224
	movq	108(%rsp), %rcx
	movl	116(%rsp), %r8d
	movq	96(%rsp), %rsi
	movl	104(%rsp), %edx
	leaq	144(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 216
	popq	%rdx
	.cfi_def_cfa_offset 208
.L247:
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L249
	call	__stack_chk_fail@PLT
.L249:
	addq	$200, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4005:
	.size	_Z39__device_stub__Z10phiToForcePdS_S_S_iddPdS_S_S_idd, .-_Z39__device_stub__Z10phiToForcePdS_S_S_iddPdS_S_S_idd
	.globl	_Z10phiToForcePdS_S_S_idd
	.type	_Z10phiToForcePdS_S_S_idd, @function
_Z10phiToForcePdS_S_S_idd:
.LFB4006:
	.cfi_startproc
	endbr64
	jmp	_Z39__device_stub__Z10phiToForcePdS_S_S_iddPdS_S_S_idd
	.cfi_endproc
.LFE4006:
	.size	_Z10phiToForcePdS_S_S_idd, .-_Z10phiToForcePdS_S_S_idd
	.globl	_Z23_2nd_order_diff_3d_cudaP6grid3D
	.type	_Z23_2nd_order_diff_3d_cudaP6grid3D, @function
_Z23_2nd_order_diff_3d_cudaP6grid3D:
.LFB3963:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$72, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	movl	20(%rdi), %eax
	movq	%rsp, %rdi
	leal	0(,%rax,8), %ebx
	movslq	%ebx, %rbx
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	leaq	8(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	48(%rbp), %rsi
	movq	(%rsp), %rdi
	movq	%rbx, %rdx
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	$33554433, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$7, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movq	%rdi, %rdx
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L253
	movsd	.LC6(%rip), %xmm1
	movsd	0(%rbp), %xmm0
	movl	8(%rbp), %r8d
	movq	24(%rsp), %rcx
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	call	_Z39__device_stub__Z10phiToForcePdS_S_S_iddPdS_S_S_idd
.L253:
	call	cudaDeviceSynchronize@PLT
	movq	64(%rbp), %rdi
	movq	8(%rsp), %rsi
	movq	%rbx, %rdx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	72(%rbp), %rdi
	movq	16(%rsp), %rsi
	movq	%rbx, %rdx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rsi
	movq	80(%rbp), %rdi
	movq	%rbx, %rdx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L254
	call	__stack_chk_fail@PLT
.L254:
	addq	$72, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3963:
	.size	_Z23_2nd_order_diff_3d_cudaP6grid3D, .-_Z23_2nd_order_diff_3d_cudaP6grid3D
	.globl	_Z17isolatedPotentialP6grid3DPSt7complexIdE
	.type	_Z17isolatedPotentialP6grid3DPSt7complexIdE, @function
_Z17isolatedPotentialP6grid3DPSt7complexIdE:
.LFB3965:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movslq	20(%rdi), %r14
	movl	8(%rdi), %r12d
	movq	%rsi, 72(%rsp)
	leal	(%r12,%r12), %ebp
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	movl	12(%rdi), %eax
	movl	%eax, 12(%rsp)
	movl	16(%rdi), %eax
	movl	%eax, 44(%rsp)
	movl	12(%rsp), %eax
	leal	(%rax,%rax), %r13d
	movl	44(%rsp), %eax
	addl	%eax, %eax
	movl	%eax, 8(%rsp)
	leal	0(,%r14,8), %eax
	salq	$7, %r14
	movslq	%eax, %rdi
	movl	%eax, 64(%rsp)
	salq	$3, %rdi
	call	malloc@PLT
	movq	%r14, %rdi
	movq	%r14, (%rsp)
	movq	%rax, 48(%rsp)
	call	malloc@PLT
	movq	(%rsp), %rdi
	movq	%rax, 16(%rsp)
	call	malloc@PLT
	movq	(%rsp), %rdi
	movq	%rax, 24(%rsp)
	call	malloc@PLT
	movq	(%rsp), %rdi
	movq	%rax, 32(%rsp)
	call	malloc@PLT
	xorl	%edi, %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	movq	%rax, 56(%rsp)
	movl	%r13d, %eax
	imull	%ebp, %eax
	movl	%eax, 40(%rsp)
	movl	12(%rsp), %eax
	imull	%r12d, %eax
	movl	%eax, 68(%rsp)
.L257:
	cmpl	%ebp, %edx
	jge	.L297
	movl	%edi, %r9d
	movl	%esi, %r8d
	xorl	%ecx, %ecx
.L262:
	cmpl	%r13d, %ecx
	jge	.L260
	movq	48(%rsp), %r10
	movslq	%r8d, %rax
	leaq	(%r10,%rax,8), %r10
	xorl	%eax, %eax
.L261:
	movl	%eax, %r11d
	cmpl	%eax, 8(%rsp)
	jle	.L298
	movl	12(%rsp), %r14d
	cmpl	%r12d, %edx
	setl	%r15b
	cmpl	%r14d, %ecx
	setl	%r14b
	testb	%r14b, %r15b
	je	.L284
	cmpl	%r11d, 44(%rsp)
	jle	.L284
	movq	56(%rbx), %r14
	leal	(%r9,%rax), %r11d
	movslq	%r11d, %r11
	movsd	(%r14,%r11,8), %xmm0
	jmp	.L258
.L284:
	xorps	%xmm0, %xmm0
.L258:
	movsd	%xmm0, (%r10,%rax,8)
	incq	%rax
	jmp	.L261
.L298:
	incl	%ecx
	addl	%ebp, %r8d
	addl	%r12d, %r9d
	jmp	.L262
.L260:
	movl	40(%rsp), %eax
	incl	%edx
	addl	%eax, %esi
	movl	68(%rsp), %eax
	addl	%eax, %edi
	jmp	.L257
.L297:
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	xorps	%xmm0, %xmm0
.L263:
	cmpl	%ebp, %ecx
	jge	.L299
	movl	%esi, %edi
	xorl	%r8d, %r8d
.L267:
	cmpl	%r13d, %r8d
	jge	.L265
	movslq	%edi, %rax
	movq	48(%rsp), %r9
	movq	%rax, %rdx
	leaq	(%r9,%rax,8), %r9
	salq	$4, %rdx
	xorl	%eax, %eax
.L266:
	cmpl	%eax, 8(%rsp)
	jle	.L300
	movsd	(%r9,%rax,8), %xmm1
	movq	16(%rsp), %r10
	incq	%rax
	movq	$0x000000000, 8(%r10,%rdx)
	addsd	%xmm0, %xmm1
	movsd	%xmm1, (%r10,%rdx)
	addq	$16, %rdx
	jmp	.L266
.L300:
	incl	%r8d
	addl	%ebp, %edi
	jmp	.L267
.L265:
	movl	40(%rsp), %eax
	incl	%ecx
	addl	%eax, %esi
	jmp	.L263
.L299:
	movq	(%rsp), %rsi
	leaq	104(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	$1, %ecx
	movq	104(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	8(%rsp), %ecx
	leaq	96(%rsp), %rdi
	movl	%ebp, %esi
	movl	$105, %r8d
	movl	%r13d, %edx
	call	cufftPlan3d@PLT
	testl	%eax, %eax
	je	.L268
.L275:
	leaq	.LC2(%rip), %rsi
	jmp	.L296
.L268:
	movq	104(%rsp), %rsi
	movl	96(%rsp), %edi
	orl	$-1, %ecx
	movq	%rsi, %rdx
	call	cufftExecZ2Z@PLT
	movl	%eax, %r14d
	testl	%eax, %eax
	je	.L269
.L276:
	leaq	.LC3(%rip), %rsi
.L296:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L269:
	movq	(%rsp), %rdx
	movq	104(%rsp), %rsi
	movl	$2, %ecx
	movq	24(%rsp), %rdi
	call	cudaMemcpy@PLT
	call	cudaDeviceSynchronize@PLT
	movl	96(%rsp), %edi
	call	cufftDestroy@PLT
	movq	104(%rsp), %rdi
	call	cudaFree@PLT
	xorl	%eax, %eax
.L270:
	cmpl	%ebp, %eax
	jge	.L301
	movl	%r14d, %ecx
	xorl	%esi, %esi
.L274:
	cmpl	%r13d, %esi
	jge	.L272
	movslq	%ecx, %r15
	xorl	%edx, %edx
	salq	$4, %r15
.L273:
	movl	8(%rsp), %edi
	cmpl	%edi, %edx
	jge	.L302
	movl	%eax, 80(%rsp)
	movq	24(%rsp), %rax
	movl	%ecx, 92(%rsp)
	movsd	(%rax,%r15), %xmm0
	movq	72(%rsp), %rax
	movl	%edx, 88(%rsp)
	movl	%esi, 84(%rsp)
	movsd	8(%rax,%r15), %xmm3
	movsd	(%rax,%r15), %xmm2
	movq	24(%rsp), %rax
	movsd	8(%rax,%r15), %xmm1
	call	__muldc3@PLT
	movq	32(%rsp), %rax
	movl	88(%rsp), %edx
	movl	92(%rsp), %ecx
	movl	84(%rsp), %esi
	movsd	%xmm0, (%rax,%r15)
	incl	%edx
	movsd	%xmm1, 8(%rax,%r15)
	movl	80(%rsp), %eax
	addq	$16, %r15
	jmp	.L273
.L302:
	incl	%esi
	addl	%ebp, %ecx
	jmp	.L274
.L272:
	movl	40(%rsp), %ecx
	incl	%eax
	addl	%ecx, %r14d
	jmp	.L270
.L301:
	movq	(%rsp), %rsi
	leaq	112(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	$1, %ecx
	movq	104(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	8(%rsp), %ecx
	leaq	100(%rsp), %rdi
	movl	%ebp, %esi
	movl	$105, %r8d
	movl	%r13d, %edx
	call	cufftPlan3d@PLT
	testl	%eax, %eax
	jne	.L275
	movq	112(%rsp), %rsi
	movl	100(%rsp), %edi
	movl	$1, %ecx
	movq	%rsi, %rdx
	call	cufftExecZ2Z@PLT
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	.L276
	movq	(%rsp), %rdx
	movq	112(%rsp), %rsi
	movl	$2, %ecx
	movq	56(%rsp), %rdi
	call	cudaMemcpy@PLT
	call	cudaDeviceSynchronize@PLT
	movl	100(%rsp), %edi
	call	cufftDestroy@PLT
	movq	112(%rsp), %rdi
	call	cudaFree@PLT
	xorl	%edx, %edx
	xorl	%eax, %eax
.L277:
	cmpl	%r12d, %eax
	jge	.L303
	movl	%edx, %esi
	movl	%r13d, %edi
	xorl	%r8d, %r8d
.L281:
	movl	12(%rsp), %ecx
	cmpl	%ecx, %r8d
	jge	.L279
	movq	56(%rsp), %rcx
	movslq	%edi, %r14
	movslq	%esi, %r15
	salq	$4, %r14
	salq	$3, %r15
	addq	%rcx, %r14
	xorl	%ecx, %ecx
.L280:
	movl	44(%rsp), %r10d
	cmpl	%r10d, %ecx
	jge	.L304
	movsd	8(%r14), %xmm1
	movsd	(%r14), %xmm0
	movl	%edx, 88(%rsp)
	addq	$16, %r14
	movl	%esi, 84(%rsp)
	movl	%ecx, 80(%rsp)
	movl	%r8d, 72(%rsp)
	movl	%eax, 8(%rsp)
	movl	%edi, (%rsp)
	call	cabs@PLT
	cvtsi2sdl	64(%rsp), %xmm2
	movq	48(%rbx), %r9
	movaps	%xmm0, %xmm1
	movsd	.LC0(%rip), %xmm0
	divsd	24(%rbx), %xmm0
	movl	80(%rsp), %ecx
	movl	88(%rsp), %edx
	movl	84(%rsp), %esi
	movl	72(%rsp), %r8d
	movl	8(%rsp), %eax
	incl	%ecx
	divsd	%xmm2, %xmm0
	movl	(%rsp), %edi
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, (%r9,%r15)
	addq	$8, %r15
	jmp	.L280
.L304:
	incl	%r8d
	addl	%ebp, %edi
	addl	%r12d, %esi
	jmp	.L281
.L279:
	movl	40(%rsp), %ecx
	incl	%eax
	addl	%ecx, %r13d
	movl	68(%rsp), %ecx
	addl	%ecx, %edx
	jmp	.L277
.L303:
	movq	%rbx, %rdi
	call	_Z23_2nd_order_diff_3d_cudaP6grid3D
	movq	48(%rsp), %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	32(%rsp), %rdi
	call	free@PLT
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L282
	call	__stack_chk_fail@PLT
.L282:
	movq	56(%rsp), %rdi
	addq	$136, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE3965:
	.size	_Z17isolatedPotentialP6grid3DPSt7complexIdE, .-_Z17isolatedPotentialP6grid3DPSt7complexIdE
	.globl	_Z28__device_stub__Z6overk2PdiiiPdiii
	.type	_Z28__device_stub__Z6overk2PdiiiPdiii, @function
_Z28__device_stub__Z6overk2PdiiiPdiii:
.LFB4007:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 12(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	12(%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	.L305
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z6overk2Pdiii(%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
.L305:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L307
	call	__stack_chk_fail@PLT
.L307:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4007:
	.size	_Z28__device_stub__Z6overk2PdiiiPdiii, .-_Z28__device_stub__Z6overk2PdiiiPdiii
	.globl	_Z6overk2Pdiii
	.type	_Z6overk2Pdiii, @function
_Z6overk2Pdiii:
.LFB4008:
	.cfi_startproc
	endbr64
	jmp	_Z28__device_stub__Z6overk2PdiiiPdiii
	.cfi_endproc
.LFE4008:
	.size	_Z6overk2Pdiii, .-_Z6overk2Pdiii
	.section	.rodata.str1.1
.LC14:
	.string	"CUFFT error: Plan D2Z creation failed.\n"
.LC15:
	.string	"CUFFT error: ExecD2Z forward failed.\n"
.LC16:
	.string	"CUFFT error: ExecZ2D  failed.\n"
	.text
	.globl	_Z27poisson_solver_fft_force_3diP6grid3D
	.type	_Z27poisson_solver_fft_force_3diP6grid3D, @function
_Z27poisson_solver_fft_force_3diP6grid3D:
.LFB3961:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$2, %ecx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movl	16(%rsi), %r12d
	movl	8(%rsi), %r13d
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	movl	12(%rsi), %r14d
	movl	%r12d, %eax
	cltd
	idivl	%ecx
	movslq	%r13d, %rdx
	leal	1(%rax), %r15d
	movslq	%r14d, %rax
	imulq	%rax, %rdx
	movslq	%r12d, %rax
	imulq	%rdx, %rax
	movq	%rdx, 8(%rsp)
	salq	$3, %rax
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rdx
	movq	%rax, %rbp
	movslq	%r15d, %rax
	imulq	%rdx, %rax
	salq	$4, %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	movq	24(%rsp), %rsi
	leaq	40(%rsp), %rdi
	movq	%rax, 16(%rsp)
	call	cudaMalloc@PLT
	movq	8(%rsp), %rsi
	leaq	48(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	56(%rbx), %rsi
	movq	24(%rsp), %rdx
	movl	$1, %ecx
	movq	40(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%r13d, %esi
	leaq	32(%rsp), %rdi
	movl	%r12d, %ecx
	movl	$106, %r8d
	movl	%r14d, %edx
	call	cufftPlan3d@PLT
	leaq	.LC14(%rip), %rsi
	testl	%eax, %eax
	jne	.L320
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rsi
	movl	32(%rsp), %edi
	call	cufftExecD2Z@PLT
	testl	%eax, %eax
	je	.L312
	leaq	.LC15(%rip), %rsi
.L320:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L312:
	movq	8(%rsp), %rdx
	movq	48(%rsp), %rsi
	movl	$2, %ecx
	movq	16(%rsp), %rdi
	call	cudaMemcpy@PLT
	call	cudaDeviceSynchronize@PLT
	movl	32(%rsp), %edi
	call	cufftDestroy@PLT
	movq	8(%rsp), %rsi
	leaq	56(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	$1, %ecx
	movq	56(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	$33554433, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$7, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movl	$1, 116(%rsp)
	movq	%rdi, %rdx
	movq	%rdi, 108(%rsp)
	movq	%rdi, 96(%rsp)
	movl	$1, 104(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L313
	movq	56(%rsp), %rdi
	movl	%r15d, %ecx
	movl	%r14d, %edx
	movl	%r13d, %esi
	call	_Z28__device_stub__Z6overk2PdiiiPdiii
.L313:
	movq	8(%rsp), %rdx
	movq	56(%rsp), %rsi
	movl	$2, %ecx
	movq	16(%rsp), %rdi
	call	cudaMemcpy@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	$1, %ecx
	movq	48(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%r13d, %esi
	leaq	36(%rsp), %rdi
	movl	%r12d, %ecx
	movl	$108, %r8d
	movl	%r14d, %edx
	call	cufftPlan3d@PLT
	leaq	.LC2(%rip), %rsi
	testl	%eax, %eax
	jne	.L320
	movq	48(%rsp), %rsi
	movq	40(%rsp), %rdx
	movl	36(%rsp), %edi
	call	cufftExecZ2D@PLT
	leaq	.LC16(%rip), %rsi
	testl	%eax, %eax
	jne	.L320
	movq	24(%rsp), %rdx
	movq	40(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbp, %rdi
	call	cudaMemcpy@PLT
	call	cudaDeviceSynchronize@PLT
	movl	36(%rsp), %edi
	call	cufftDestroy@PLT
	movl	20(%rbx), %eax
	movsd	(%rbx), %xmm2
	leaq	64(%rsp), %rdi
	leal	0(,%rax,8), %r12d
	movsd	%xmm2, 8(%rsp)
	movslq	%r12d, %r12
	movq	%r12, %rsi
	call	cudaMalloc@PLT
	leaq	72(%rsp), %rdi
	movq	%r12, %rsi
	call	cudaMalloc@PLT
	leaq	80(%rsp), %rdi
	movq	%r12, %rsi
	call	cudaMalloc@PLT
	leaq	88(%rsp), %rdi
	movq	%r12, %rsi
	call	cudaMalloc@PLT
	movq	64(%rsp), %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	$33554433, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$7, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movl	$1, 116(%rsp)
	movq	%rdi, %rdx
	movq	%rdi, 108(%rsp)
	movq	%rdi, 96(%rsp)
	movl	$1, 104(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L316
	movsd	(%rbx), %xmm0
	movl	8(%rbx), %r8d
	movq	88(%rsp), %rcx
	movq	80(%rsp), %rdx
	movq	72(%rsp), %rsi
	movq	64(%rsp), %rdi
	movsd	.LC17(%rip), %xmm1
	divsd	8(%rsp), %xmm1
	call	_Z39__device_stub__Z10phiToForcePdS_S_S_iddPdS_S_S_idd
.L316:
	call	cudaDeviceSynchronize@PLT
	movq	64(%rbx), %rdi
	movq	72(%rsp), %rsi
	movq	%r12, %rdx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	72(%rbx), %rdi
	movq	80(%rsp), %rsi
	movq	%r12, %rdx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	88(%rsp), %rsi
	movq	80(%rbx), %rdi
	movq	%r12, %rdx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L317
	call	__stack_chk_fail@PLT
.L317:
	movq	16(%rsp), %rdi
	addq	$136, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE3961:
	.size	_Z27poisson_solver_fft_force_3diP6grid3D, .-_Z27poisson_solver_fft_force_3diP6grid3D
	.section	.rodata.str1.1
.LC18:
	.string	"w"
.LC19:
	.string	"result.txt"
.LC26:
	.string	"%f\t%f\t%f\n"
.LC29:
	.string	"Step:%d\n"
.LC30:
	.string	"%f\t%f\t"
.LC31:
	.string	"%f\t%f\n"
.LC33:
	.string	"Total time : %f\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3959:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$264, %rsp
	.cfi_def_cfa_offset 320
	movq	%fs:40, %rax
	movq	%rax, 248(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	64(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	leaq	.LC18(%rip), %rsi
	leaq	.LC19(%rip), %rdi
	call	fopen@PLT
	movsd	.LC21(%rip), %xmm0
	movq	%rax, 16(%rsp)
	movq	.LC20(%rip), %rax
	movsd	%xmm0, 96(%rsp)
	movq	%rax, 72(%rsp)
	movabsq	$1099511628032, %rax
	movq	%rax, 80(%rsp)
	movabsq	$72057594037928192, %rax
	movq	%rax, 88(%rsp)
	leaq	72(%rsp), %rax
	movq	%rax, %rdi
	movsd	%xmm0, 104(%rsp)
	movsd	%xmm0, 112(%rsp)
	movq	%rax, 8(%rsp)
	call	_Z16locateMemoryGridP6grid3D
	leaq	160(%rsp), %rax
	movl	$2, %esi
	movl	$2, 160(%rsp)
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	_Z20locateMemoryParticleP10particle3Di
	movq	168(%rsp), %r15
	movq	.LC22(%rip), %rax
	movq	176(%rsp), %r12
	movsd	.LC6(%rip), %xmm0
	movq	%rax, (%r15)
	movq	184(%rsp), %r14
	movq	192(%rsp), %rax
	movq	.LC23(%rip), %rbx
	movsd	%xmm0, 8(%r15)
	movsd	%xmm0, (%r12)
	movq	$0x000000000, (%r14)
	movq	$0x000000000, (%rax)
	movq	%rbx, 8(%r12)
	movq	$0x000000000, 8(%r14)
	movsd	(%rax), %xmm1
	movq	$0x000000000, 8(%rax)
	movsd	(%r12), %xmm2
	movsd	(%r14), %xmm0
	mulsd	%xmm1, %xmm1
	mulsd	%xmm2, %xmm2
	mulsd	%xmm0, %xmm0
	addsd	%xmm2, %xmm0
	addsd	%xmm1, %xmm0
	call	sqrt@PLT
	xorps	%xmm1, %xmm1
	movsd	%xmm0, 40(%rsp)
	movsd	8(%r12), %xmm0
	mulsd	%xmm0, %xmm0
	addsd	%xmm1, %xmm0
	call	sqrt@PLT
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$1, %edx
	movsd	%xmm0, 32(%rsp)
	call	_Z6WeightP6grid3DP10particle3Di
	movq	8(%rsp), %rsi
	movl	$3, %edi
	call	_Z27poisson_solver_fft_force_3diP6grid3D
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$1, %edx
	call	_Z11WeightForceP6grid3DP10particle3Di
	movq	200(%rsp), %r13
	movq	224(%rsp), %rcx
	movq	.LC7(%rip), %xmm2
	movq	$0x000000000, (%rcx)
	movsd	0(%r13), %xmm0
	mulsd	(%r12), %xmm0
	movq	%rcx, 24(%rsp)
	andps	%xmm2, %xmm0
	divsd	(%r15), %xmm0
	call	sqrt@PLT
	movq	24(%rsp), %rcx
	movq	232(%rsp), %rbp
	movq	240(%rsp), %rbx
	xorps	.LC4(%rip), %xmm0
	movq	.LC7(%rip), %xmm2
	movsd	%xmm0, 0(%rbp)
	movq	$0x000000000, (%rbx)
	movq	$0x000000000, 8(%rcx)
	movsd	8(%r13), %xmm0
	mulsd	8(%r12), %xmm0
	andps	%xmm2, %xmm0
	divsd	8(%r15), %xmm0
	call	sqrt@PLT
	movsd	40(%rsp), %xmm3
	movsd	32(%rsp), %xmm1
	movsd	%xmm0, 8(%rbp)
	movsd	.LC24(%rip), %xmm0
	addsd	%xmm3, %xmm1
	movq	$0x000000000, 8(%rbx)
	movsd	(%r15), %xmm2
	mulsd	%xmm2, %xmm0
	mulsd	%xmm1, %xmm1
	mulsd	8(%r15), %xmm2
	leaq	.LC26(%rip), %r15
	mulsd	.LC25(%rip), %xmm0
	divsd	%xmm1, %xmm2
	mulsd	%xmm3, %xmm0
	divsd	%xmm2, %xmm0
	call	sqrt@PLT
	movsd	0(%r13), %xmm0
	movq	%r15, %rsi
	movb	$3, %al
	movq	216(%rsp), %rbp
	movq	208(%rsp), %rbx
	movl	$2, %edi
	movsd	0(%rbp), %xmm2
	movsd	(%rbx), %xmm1
	call	__printf_chk@PLT
	movsd	8(%r13), %xmm0
	movq	%r15, %rsi
	movb	$3, %al
	movsd	8(%rbp), %xmm2
	movsd	8(%rbx), %xmm1
	movl	$2, %edi
	xorl	%r15d, %r15d
	call	__printf_chk@PLT
.L323:
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$1, %edx
	call	_Z6WeightP6grid3DP10particle3Di
	movq	8(%rsp), %rsi
	movl	$3, %edi
	call	_Z27poisson_solver_fft_force_3diP6grid3D
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$1, %edx
	call	_Z11WeightForceP6grid3DP10particle3Di
	movsd	.LC27(%rip), %xmm0
	movq	(%rsp), %rdi
	call	_Z5driftP10particle3Dd
	movsd	.LC20(%rip), %xmm0
	movq	(%rsp), %rsi
	xorl	%edi, %edi
	call	_Z14boundary_checkiP10particle3Dd
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$1, %edx
	call	_Z6WeightP6grid3DP10particle3Di
	movq	8(%rsp), %rsi
	movl	$3, %edi
	call	_Z27poisson_solver_fft_force_3diP6grid3D
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$1, %edx
	call	_Z11WeightForceP6grid3DP10particle3Di
	movsd	.LC28(%rip), %xmm0
	movq	(%rsp), %rdi
	call	_Z4kickP10particle3Dd
	movsd	.LC27(%rip), %xmm0
	movq	(%rsp), %rdi
	call	_Z5driftP10particle3Dd
	movsd	.LC20(%rip), %xmm0
	movq	(%rsp), %rsi
	xorl	%edi, %edi
	call	_Z14boundary_checkiP10particle3Dd
	movl	%r15d, %eax
	movl	$20, %ecx
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L322
	movl	%r15d, %edx
	leaq	.LC29(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movsd	(%r14), %xmm1
	movb	$2, %al
	movsd	(%r12), %xmm0
	movq	16(%rsp), %rdi
	leaq	.LC30(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movsd	8(%r12), %xmm0
	movb	$2, %al
	movsd	8(%r14), %xmm1
	movq	16(%rsp), %rdi
	leaq	.LC31(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L322:
	incl	%r15d
	cmpl	$1000, %r15d
	jne	.L323
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	64(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	64(%rsp), %rdx
	movq	56(%rsp), %rsi
	leaq	52(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC33(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movss	52(%rsp), %xmm0
	divss	.LC32(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	16(%rsp), %rdi
	call	fclose@PLT
	movq	8(%rsp), %rdi
	call	_Z14freeMemoryGridP6grid3D
	movq	(%rsp), %rdi
	call	_Z18freeMemoryParticleP10particle3D
	movq	248(%rsp), %rax
	subq	%fs:40, %rax
	je	.L324
	call	__stack_chk_fail@PLT
.L324:
	addq	$264, %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
.LFE3959:
	.size	main, .-main
	.section	.rodata.str1.1
.LC34:
	.string	"_Z6overk2Pdiii"
.LC35:
	.string	"_Z10phiToForcePdS_S_S_idd"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4010:
	.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	.LC34(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z6overk2Pdiii(%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	.LC35(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z10phiToForcePdS_S_S_idd(%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
.LFE4010:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	0
	.long	-1074790400
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC4:
	.long	0
	.long	-2147483648
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC5:
	.long	0
	.long	1071644672
	.align 8
.LC6:
	.long	0
	.long	1072693248
	.section	.rodata.cst16
	.align 16
.LC7:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC8:
	.long	0
	.long	1072168960
	.align 8
.LC9:
	.long	0
	.long	1074266112
	.align 8
.LC10:
	.long	0
	.long	1073217536
	.align 8
.LC12:
	.long	0
	.long	1075314688
	.align 8
.LC17:
	.long	1841940611
	.long	-1076601040
	.align 8
.LC20:
	.long	0
	.long	1076101120
	.align 8
.LC21:
	.long	336860180
	.long	1067717652
	.align 8
.LC22:
	.long	0
	.long	1073741824
	.align 8
.LC23:
	.long	0
	.long	-1073741824
	.align 8
.LC24:
	.long	0
	.long	1074790400
	.align 8
.LC25:
	.long	-910277154
	.long	1076084028
	.align 8
.LC27:
	.long	1202590843
	.long	1064598241
	.align 8
.LC28:
	.long	1202590843
	.long	1065646817
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC32:
	.long	1148846080
	.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:

//To compile should add "-lfftw3 -lgsl"

#include <hip/hip_runtime.h>
#include <stdio.h>
#include <math.h>
// #include <gsl/gsl_rng.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
#include <time.h>
//#include <fftw3.h>
#include <complex>
#include <hipfft/hipfft.h>
using namespace std;

struct particle3D{
	int number;
	double *mass;
	double *x;
	double *y;
	double *z;
	double *Fx;
	double *Fy;
	double *Fz;
	double *vx;
	double *vy;
	double *vz;
};
struct grid3D{
	double L;
	int Nx;
	int Ny;
	int Nz;
	int N;
	double dx;
	double dy;
	double dz;
	double *phi;
	double *density;
	double *Fx;
	double *Fy;
	double *Fz;
};
struct rk43D{
    int step1;
    int step2;
    double *ax;
    double *ay;
	double *az;
    double *vx;
    double *vy;
	double *vz;
};
__global__
void phiToForce(double* phi,double* Fx,double* Fy,double* Fz,int Nx,double L,double nConst){
	int N = Nx*Nx*Nx;
	int const Ny = Nx;
  	int const Nz = Nx;
	double dx = L / Nx;
	double factor = -1./(2.0*dx) * nConst;

	int index = blockDim.x * blockIdx.x + threadIdx.x;
    
    while(index < N){
    	int ii = index / (Ny*Nz);
    	int jj = (index / Nz) % Ny;
    	int kk = index % Nz;
    	Fx[index] = factor*( phi[ ( (ii+1)%Nx )*Ny*Nz + jj*Nz + kk ] 
                              - phi[ ( (Nx+ii-1)%Nx )*Ny*Nz + jj*Nz + kk ] );

    	Fy[index] = factor*( phi[ ii*Ny*Nz + ( (jj+1)%Ny )*Nz + kk ] 
                              - phi[ ii*Ny*Nz + ( (Ny+jj-1)%Ny )*Nz + kk ] );  

  		Fz[index] = factor*( phi[ ii*Ny*Nz  + jj*Nz + ((kk+1)%Nz)] 
                              - phi[ ii*Ny*Nz  + jj*Nz + ((Nz+kk-1)%Nz)]);
    	index += blockDim.x*gridDim.x;
    }

}
__global__
void overk2(double *out,int Nx,int Ny,int Nzh){
	//Notice that *out actullay is a compelx <double> pointer array.

	int N = Nx*Ny*Nzh;
	int index = blockDim.x * blockIdx.x + threadIdx.x;
	int fi,fj;
	double kxx,kyy,kzz;

    while(index < N){
    	int ii = index / (Ny*Nzh);
    	int jj = (index / Nzh) % Ny;
    	int kk = index % Nzh;

    	if (2*ii < Nx) {fi = ii;}
		else           {fi = Nx-ii;}
		if (2*jj < Ny) {fj = jj;}
		else           {fj = Ny-jj;}

		kxx = 1.0*fi*fi;
		kyy = 1.0*fj*fj;
		kzz = 1.0*kk*kk;

		if(index != 0){
			//ii != 0 || jj != 0 || kk!=0
			out[2*index] = out[2*index] / (kxx+kyy+kzz);		//real part
			out[2*index+1] = out[2*index+1] / (kxx+kyy+kzz);	//imaginary part
		}   	

    	index += blockDim.x*gridDim.x;
    }
}

void Weight(struct grid3D *grid,struct particle3D *particle,int type);
void WeightForce(struct grid3D *grid,struct particle3D *particle,int type);
void poisson_solver_fft_force_3d(int const dim, struct grid3D *grid);
void _2nd_order_diff_3d(struct grid3D *grid, int const ii, int const jj, int const kk );
void _2nd_order_diff_3d_cuda(struct grid3D *grid);
void calculateGreenFFT(struct grid3D *grid, complex<double>* fftgf);
void isolatedPotential(struct grid3D *grid, complex<double>* fftgf);


void kick(struct particle3D *particle , double dt);
void drift(struct particle3D *particle , double dt);
void init_rk4(struct particle3D *particle, struct particle3D *buff, struct rk43D *rk4);
void rk4_mid(struct particle3D *particle, struct particle3D *buff, struct rk43D *rk4, double dt, int weighting);
void rk4_end(struct particle3D *particle, struct rk43D *rk4, double dt);
void periodic_boundary(double position, double length);
void boundary_check(int boundary, struct particle3D *particle, double L);

//Functions to locate memory and free memory of different struct.
void locateMemoryParticle(struct particle3D *particle,int N);
void freeMemoryParticle(struct particle3D *particle);
void locateMemoryRk4(struct rk43D *rk4,int N);
void freeMemoryRk4(struct rk43D *rk4);
void locateMemoryGrid(struct grid3D *grid);
void freeMemoryGrid(struct grid3D *grid);


int main( int argc, char *argv[] ){
	//================Simulation Constants
	int weightFunction = 1;  	//0/1/2 : NGP/CIC/TSC
	int orbitIntegration = 1;	//0/1/2 : KDK/DKD/RK4
	int poissonSolver = 0;		//0/1   : fft/isolated
	int boundary = 0;           //0/1/2 : periodic/isolated/no boundary
	int dim = 3;				
	double L = 10.0;				//Length of box (from -L/2 ~ L/2)
	int Nx = 256;				//Number of grid in x direction. (should be odd number)
	int NParticle=2;//Number of particles used in simulation
	//double massParticle=1.0;
	double dt = 1.0e-2;
	double G = 1.0;
	double T,r1_0,r2_0;
	hipEvent_t start, stop;	//For cuda timing
	float totalTime;
	
	//================Structs
	struct grid3D grid;
	struct particle3D myParticle;
	struct particle3D buffParticle;		//If not RK4 mode , it will not be malloc and free
	struct rk43D myrk4;					//If not RK4 mode , it will not be malloc and free
	complex<double>* fftgf;

	hipEventCreate(&start);
	hipEventCreate(&stop);
 	hipEventRecord(start,0);

 	

	//Output to a file
	FILE *output;
	output = fopen("result.txt","w");
	//================Random number generator.
		//To use : d=gsl_rng_uniform(rng);
		// gsl_rng *rng;
		// rng = gsl_rng_alloc(gsl_rng_mt19937);
		// gsl_rng_set(rng,123456);//The seed is 123456.

	//================Initialize Grid Parameter=========== 
		
		grid.L = L;		
		grid.Nx = Nx;		
		grid.Ny = grid.Nx;
		grid.Nz = grid.Nx;
		grid.N = grid.Nx * grid.Ny * grid.Nz;
		grid.dx = grid.L / (grid.Nx-1);	//-1 is because boundary (make box closed)
		grid.dy = grid.L / (grid.Ny-1);
		grid.dz = grid.L / (grid.Nz-1);
		locateMemoryGrid(&grid);

	//================Initialize Particles ======
		
		myParticle.number = NParticle;
		locateMemoryParticle(&myParticle,NParticle);

		if(orbitIntegration == 2){
	//================Initialize Particles for RK4 (buffer)======
			buffParticle.number = NParticle;
			locateMemoryParticle(&buffParticle,NParticle);
	//================Initialize Runge-Kutta Coefficient======
			myrk4.step1 = 0;
			myrk4.step2 = 1;
			locateMemoryRk4(&myrk4,NParticle);
		}

		if(poissonSolver == 1){
			fftgf = (complex<double>*) malloc(sizeof(complex<double>) * 8*grid.N);
			calculateGreenFFT(&grid,fftgf);
		}
      
	
	//Initialize mass of particles
		myParticle.mass[0]=2.0;
		myParticle.mass[1]=1.0;

		if(orbitIntegration == 2){
			buffParticle.mass[0] = myParticle.mass[0];
			buffParticle.mass[1] = myParticle.mass[1];
		}
	//Initialize Initial Position of Particle.
		// for (int i = 0; i < myParticle.number; ++i){
		// 	myParticle.x[i]=gsl_rng_uniform(rng) * grid.L - grid.L/2;
		// 	myParticle.y[i]=gsl_rng_uniform(rng) * grid.L - grid.L/2;
		// 	printf("At (%f,%f) \n",myParticle.x[i],myParticle.y[i]);
		// }
		myParticle.x[0] = 1.0;
		myParticle.y[0] = 0.0;
		myParticle.z[0] = 0.0;
		myParticle.x[1] = -2.0;
		myParticle.y[1] = 0.0;
		myParticle.z[1] = 0.0;
		r1_0 = sqrt(pow(myParticle.x[0],2)+pow(myParticle.y[0],2)+pow(myParticle.z[0],2));
		r2_0 = sqrt(pow(myParticle.x[1],2)+pow(myParticle.y[1],2)+pow(myParticle.z[1],2));

		Weight(&grid,&myParticle,weightFunction);
		
		if(poissonSolver == 0){poisson_solver_fft_force_3d(dim,&grid);}
		else if ( poissonSolver == 1 ){isolatedPotential(&grid,fftgf);}
		
		WeightForce(&grid,&myParticle,weightFunction);

	// //Initialize Initial velocity
		myParticle.vx[0] = 0.0;
		myParticle.vy[0] = -sqrt(fabs(myParticle.Fx[0]*myParticle.x[0])/myParticle.mass[0]);
		myParticle.vz[0] = 0.0;
		myParticle.vx[1] = 0.0;
		myParticle.vy[1] = sqrt(fabs(myParticle.Fx[1]*myParticle.x[1])/myParticle.mass[1]);
		myParticle.vz[1] = 0.0;

		double F_0;
		F_0 = G * myParticle.mass[0] * myParticle.mass[1]/pow(r1_0+r2_0,2);
		T =sqrt(myParticle.mass[0]*4*pow(M_PI,2)*r1_0/F_0);

		//Check whether force is same magnitude but inverse direction.
		printf("%f\t%f\t%f\n",myParticle.Fx[0],myParticle.Fy[0],myParticle.Fz[0]);
		printf("%f\t%f\t%f\n",myParticle.Fx[1],myParticle.Fy[1],myParticle.Fz[1]);
		
	//Time evolution loop
	double t = 0.0;
	for(int st=0;st < 1000;st++){
	 	//Deposit Particles to grid
	 	Weight(&grid,&myParticle,weightFunction);

	 	//Use Fourier Transform to calculate potential and force.
		if ( poissonSolver == 0 )	poisson_solver_fft_force_3d(dim, &grid);
		else if ( poissonSolver == 1 ){isolatedPotential(&grid,fftgf);}

 		//Remap the force to particle.
		WeightForce(&grid,&myParticle,weightFunction);

      

 		//Move particle
		if(orbitIntegration == 0){
 		//KDK scheme
			kick(&myParticle,dt/2);
 			drift(&myParticle,dt);
			boundary_check(boundary, &myParticle, L);
 			Weight(&grid,&myParticle,weightFunction);
			if ( poissonSolver == 0 )       poisson_solver_fft_force_3d(dim, &grid);
			else if ( poissonSolver == 1 ){isolatedPotential(&grid,fftgf);}
			WeightForce(&grid,&myParticle,weightFunction);

 			kick(&myParticle,dt/2);
		}
		else if(orbitIntegration == 1){
 			//DKD scheme
 			drift(&myParticle,dt/2);
			boundary_check(boundary, &myParticle, L);
 			Weight(&grid,&myParticle,weightFunction);
			if ( poissonSolver == 0 )       poisson_solver_fft_force_3d(dim, &grid);
			else if ( poissonSolver == 1 )  isolatedPotential(&grid,fftgf);
			WeightForce(&grid,&myParticle,weightFunction);

 			kick(&myParticle,dt);
 			drift(&myParticle,dt/2);
 		}
		else if(orbitIntegration == 2){
 			//RK4	
			init_rk4(&myParticle,&buffParticle,&myrk4);
			
			rk4_mid(&myParticle,&buffParticle,&myrk4,dt/2,1);        //k1
			boundary_check(boundary, &buffParticle, L);
			Weight(&grid,&buffParticle,weightFunction);
			if ( poissonSolver == 0 )       poisson_solver_fft_force_3d(dim, &grid);
			else if ( poissonSolver == 1 )  isolatedPotential(&grid,fftgf);
			WeightForce(&grid,&buffParticle,weightFunction);
			
			rk4_mid(&myParticle,&buffParticle,&myrk4,dt/2,2);        //k2
			boundary_check(boundary, &buffParticle, L);
			Weight(&grid,&buffParticle,weightFunction);
			if ( poissonSolver == 0 )       poisson_solver_fft_force_3d(dim, &grid);
			else if ( poissonSolver == 1 )  isolatedPotential(&grid,fftgf);
			WeightForce(&grid,&buffParticle,weightFunction);
			
			rk4_mid(&myParticle,&buffParticle,&myrk4,dt,2);          //k3
			boundary_check(boundary, &buffParticle, L);
			Weight(&grid,&buffParticle,weightFunction);
			if ( poissonSolver == 0 )       poisson_solver_fft_force_3d(dim, &grid);
			else if ( poissonSolver == 1 )  isolatedPotential(&grid,fftgf);
			WeightForce(&grid,&buffParticle,weightFunction);
			
			rk4_mid(&myParticle,&buffParticle,&myrk4,dt,1);          //k4
			
			rk4_end(&myParticle,&myrk4,dt);

 		}
		//Boundary Condition
		#ifdef CHECK_THIS_LATER
		if (boundary == 0){
			for (int i=0; i<NParticle; i++){
			       	if ( abs(myParticle.x[i]) > L/2){
					periodic_boundary(myParticle.x[i],L);
				}
				if ( abs(myParticle.y[i]) > L/2){
					periodic_boundary(myParticle.y[i],L);
				}
				if ( abs(myParticle.z[i]) > L/2){
					periodic_boundary(myParticle.z[i],L);
				}
			}	
		}
		else if (boundary == 1){
			for (int i=0; i<NParticle; i++){
				if ( abs(myParticle.x[i]) > L/2 || abs(myParticle.y[i]) > L/2 || abs(myParticle.z[i]) > L/2){
					myParticle.mass[i] = 0;
					cout << "A particle reaches the boundary." << endl;
				}
			}
		}
 		#endif
		boundary_check(boundary, &myParticle, L);

 		//print out the position of particle 1
		if(st % 20 == 0){
			printf("Step:%d\n", st);
			// double momentum_x = 0;
			// double momentum_y = 0;
			// double momentum_z = 0;

   //      		for (int i=0; i<NParticle; i++){
			// 	momentum_x += myParticle.mass[i] * myParticle.vx[i];
			// 	momentum_y += myParticle.mass[i] * myParticle.vy[i];
			// 	momentum_z += myParticle.mass[i] * myParticle.vz[i];
			// }
			// cout << "(px , py,  pz) = (" << momentum_x << ", " << momentum_y << ", " << momentum_z << ")" << endl;
			fprintf(output,"%f\t%f\t",myParticle.x[0],myParticle.y[0]);
			fprintf(output,"%f\t%f\n",myParticle.x[1],myParticle.y[1]);
	
		}
		t+=dt;
 	}
 	hipEventRecord(stop,0);
	hipEventSynchronize(stop);
	hipEventElapsedTime(&totalTime, start, stop);
	printf("Total time : %f\n",totalTime/1000);
		
 	fclose(output);
	freeMemoryGrid(&grid);
	freeMemoryParticle(&myParticle);
	if(orbitIntegration == 2){
		freeMemoryParticle(&buffParticle);
	}
	if(poissonSolver == 1){
		free(fftgf);
	}
	return 0;
}

void poisson_solver_fft_force_3d(int const dim, struct grid3D *grid){
	
	int const Nx = grid->Nx;
	int const Ny = grid->Ny; 
	int const Nz = grid->Nz;
	int const Nzh = (Nz/2+1);
	hipfftHandle p1,p2;
	
	double *in;
	complex<double> *out;
	in = (double*) malloc( sizeof(double) * Nx*Ny*Nz );
	out = (complex<double>*) malloc( sizeof(complex<double>) * Nx*Ny*Nzh);
		

	

	/////////// fft ///////////
	hipfftDoubleReal *dataIn;
	hipfftDoubleComplex *dataOut;
    hipMalloc((void**)&dataIn, sizeof(hipfftDoubleReal)*Nx*Ny*Nz);
    hipMalloc((void**)&dataOut, sizeof(hipfftDoubleComplex)*Nx*Ny*Nzh);
    hipMemcpy(dataIn, grid->density, sizeof(hipfftDoubleReal)*Nx*Ny*Nz, hipMemcpyHostToDevice);
	
	//cufft
	if (hipfftPlan3d(&p1,Nx,Ny,Nz, HIPFFT_D2Z) != HIPFFT_SUCCESS) {
        printf("CUFFT error: Plan D2Z creation failed.\n");
		exit(1);
    }
    if (hipfftExecD2Z(p1, dataIn, dataOut) != HIPFFT_SUCCESS) {
		printf("CUFFT error: ExecD2Z forward failed.\n");
		exit(1);
    }
    hipMemcpy(out, dataOut,sizeof(hipfftDoubleComplex)*Nx*Ny*Nzh, hipMemcpyDeviceToHost);
    hipDeviceSynchronize();
    hipfftDestroy(p1);
    

	double *d_out;
	hipMalloc((void**)&d_out, sizeof(double)*2*Nx*Ny*Nzh);
	hipMemcpy(d_out,out,sizeof(double)*2*Nx*Ny*Nzh,hipMemcpyHostToDevice);

	overk2 <<<128,128>>> (d_out,Nx,Ny,Nzh);

	hipMemcpy(out,d_out,sizeof(double)*2*Nx*Ny*Nzh,hipMemcpyDeviceToHost);

	hipFree(d_out);
	


	/////////// inverse fft ///////////
    hipMemcpy(dataOut, out,sizeof(hipfftDoubleComplex)*Nx*Ny*Nzh, hipMemcpyHostToDevice);
	
	//cufft
	if (hipfftPlan3d(&p2,Nx,Ny,Nz, HIPFFT_Z2D) != HIPFFT_SUCCESS) {
        printf("CUFFT error: Plan creation failed.\n");
		exit(1);
    }
    if (hipfftExecZ2D(p2, dataOut, dataIn) != HIPFFT_SUCCESS) {
		printf("CUFFT error: ExecZ2D  failed.\n");
		exit(1);
    }
    hipMemcpy(in, dataIn, sizeof(hipfftDoubleReal)*Nx*Ny*Nz, hipMemcpyDeviceToHost);
    hipDeviceSynchronize();
    hipfftDestroy(p2);


	/////////// normalization ///////////

	double nConst = -1.0 / M_PI/grid->L;	//Normalization constant.

	double* d_in;
	double* d_Fx; 
	double* d_Fy;
	double* d_Fz;

	int size = grid->N*sizeof(double);

	hipMalloc((void**)&d_in, size);
	hipMalloc((void**)&d_Fx, size);
	hipMalloc((void**)&d_Fy, size);
	hipMalloc((void**)&d_Fz, size);

	hipMemcpy(d_in,in,size,hipMemcpyHostToDevice);
	phiToForce <<<128,128>>>(d_in,d_Fx,d_Fy,d_Fz,grid->Nx,grid->L,nConst);
	hipDeviceSynchronize();
	hipMemcpy(grid->Fx,d_Fx,size, hipMemcpyDeviceToHost);
	hipMemcpy(grid->Fy,d_Fy,size, hipMemcpyDeviceToHost);
	hipMemcpy(grid->Fz,d_Fz,size, hipMemcpyDeviceToHost);

	hipFree(d_in);
	hipFree(d_Fx);
	hipFree(d_Fy);
	hipFree(d_Fz);
	hipFree(dataIn);
	hipFree(dataOut);
	

	free(in);
	free(out);
	
}


void _2nd_order_diff_3d(struct grid3D *grid, int const ii, int const jj, int const kk ) {

  double factor1 = -1./(2.*grid->dx);
  double factor2 = -1./(2.*grid->dy);
  double factor3 = -1./(2.*grid->dz);
  int const Nx = grid->Nx;
  int const Ny = grid->Ny;
  int const Nz = grid->Nz;
  int index = ii*Ny*Nz + jj*Nz + kk;

  grid->Fx[ index ] = factor1*( grid->phi[ ( (Nx+ii+1)%Nx )*Nx*Ny + jj*Nx + kk ] 
                              - grid->phi[ ( (Nx+ii-1)%Nx )*Nx*Ny + jj*Nx + kk ] );

  grid->Fy[ index ] = factor2*( grid->phi[ ii*Nx*Ny + ( (Ny+jj+1)%Ny )*Nx + kk ] 
                              - grid->phi[ ii*Nx*Ny + ( (Ny+jj-1)%Ny )*Nx + kk ] );  

  grid->Fz[ index ] = factor3*( grid->phi[ ii*Nx*Ny  + jj*Nx + ((Nz+kk+1)%Nz)] 
                              - grid->phi[ ii*Nx*Ny  + jj*Nx + ((Nz+kk-1)%Nz)]);

}
void _2nd_order_diff_3d_cuda(struct grid3D *grid) {
	double* d_phi;
	double* d_Fx; 
	double* d_Fy;
	double* d_Fz;

	int size = grid->N * sizeof(double);

	hipMalloc((void**)&d_phi, size);
	hipMalloc((void**)&d_Fx, size);
	hipMalloc((void**)&d_Fy, size);
	hipMalloc((void**)&d_Fz, size);

	hipMemcpy(d_phi,grid->phi,size,hipMemcpyHostToDevice);
	phiToForce <<<128,128>>>(d_phi,d_Fx,d_Fy,d_Fz,grid->Nx,grid->L,1.0);
	hipDeviceSynchronize();
	hipMemcpy(grid->Fx,d_Fx,size, hipMemcpyDeviceToHost);
	hipMemcpy(grid->Fy,d_Fy,size, hipMemcpyDeviceToHost);
	hipMemcpy(grid->Fz,d_Fz,size, hipMemcpyDeviceToHost);

	hipFree(d_phi);
	hipFree(d_Fx);
	hipFree(d_Fy);
	hipFree(d_Fz);
}

void calculateGreenFFT(struct grid3D *grid, complex<double> *fftgf){
	double *greenFunction;
	int N = grid->N;
	int Nx = grid->Nx;
	int Ny = grid->Ny;
	int Nz = grid->Nz;

	int NNx = 2*Nx;
	int NNy = 2*Ny;
	int NNz = 2*Nz;

	greenFunction = (double*)malloc(8*N*sizeof(double));
	

	complex<double> *gf; 	//For green function
	gf = (complex<double>*) malloc(sizeof(complex<double>) * 8*N);
	

	//Initialize green function array
	for(int i=0;i<NNx;i++){
		for(int j=0;j<NNy;j++){
			for(int k=0;k<NNz;k++){
				greenFunction[i*NNx*NNy+j*NNx+k] = 0.0;	
			}		
		}
	}
	//Construct green function
	for(int i=0;i<Nx;i++){
		for(int j=0;j<Ny;j++){
			for(int k=0;k<Nz;k++){
				if(i != 0 || j != 0 || k != 0){
					greenFunction[i*NNx*NNy+j*NNx+k] = -1.0/sqrt(pow(i,2)+pow(j,2)+pow(k,2));
				}
			}
		}
	}

	for(int i=Nx+1;i<NNx;i++){
		for(int j=0;j<Ny;j++){
			for(int k=0;k<Nz;k++){
				greenFunction[i*NNx*NNy+j*NNx+k] = greenFunction[(NNx-i)*NNx*NNy+j*NNx+k];
			}
		}
	}
	for(int i=0;i<Nx;i++){
		for(int j=Ny+1;j<NNy;j++){
			for(int k=0;k<Nz;k++){
				greenFunction[i*NNx*NNy+j*NNx+k] = greenFunction[i*NNx*NNy+(NNy-j)*NNx+k];
			}
		}
	}

	for(int i=Nx+1;i<NNx;i++){
		for(int j=Ny+1;j<NNy;j++){
			for(int k=0;k<Nz;k++){
				greenFunction[i*NNx*NNy+j*NNx+k] = greenFunction[(NNx-i)*NNx*NNy+(NNy-j)*NNx+k];
			}
			
		}
	}

	for(int i=0;i<NNx;i++){
		for(int j=0;j<NNy;j++){
			for(int k=Nz+1;k<NNz;k++){
				greenFunction[i*NNx*NNy+j*NNx+k] = greenFunction[i*NNx*NNy + j*NNx + (NNz-k)];
			}
		}
	}

	for(int i=0;i<NNx;i++){
		for(int j=0;j<NNy;j++){
			for(int k=0;k<NNz;k++){
				gf[i*NNx*NNy + j*NNx + k] = complex<double>(0.,0.);
				gf[i*NNx*NNy + j*NNx + k] += greenFunction[i*NNx*NNy + j*NNx + k];
			}
			
		}
	}

	hipfftHandle plan;
	hipfftDoubleComplex *data;
    hipMalloc((void**)&data, sizeof(hipfftDoubleComplex)*8*N);
    hipMemcpy(data, gf, sizeof(double)*8*N*2, hipMemcpyHostToDevice);

	if (hipfftPlan3d(&plan,NNx,NNy,NNz, HIPFFT_Z2Z) != HIPFFT_SUCCESS) {
        printf("CUFFT error: Plan creation failed.\n");
		exit(1);
    }
    if (hipfftExecZ2Z(plan, data, data, HIPFFT_FORWARD) != HIPFFT_SUCCESS) {
		printf("CUFFT error: ExecZ2Z forward failed.\n");
		exit(1);
    }
    hipMemcpy(fftgf, data, sizeof(double)*8*N*2, hipMemcpyDeviceToHost);
    hipDeviceSynchronize();
    hipfftDestroy(plan);
    hipFree(data);
	
	free(gf);
	free(greenFunction);
	
}

void isolatedPotential(struct grid3D *grid, complex<double>* fftgf){
	double *densityPad;
	int N = grid->N;
	int Nx = grid->Nx;
	int Ny = grid->Ny;
	int Nz = grid->Nz;

	int NNx = 2*Nx;
	int NNy = 2*Ny;
	int NNz = 2*Nz;

	densityPad = (double*)malloc(8*N*sizeof(double));
	hipfftHandle p1,p2;				//fft plan for cuFFT
	
	complex<double> *dp, *fftdp;	//For Padding density
	
	complex<double> *phi,*ifftphi;	//For potential
	
	dp = (complex<double>*) malloc(sizeof(complex<double>) * 8*N);
	fftdp = (complex<double>*) malloc(sizeof(complex<double>) * 8*N);
	phi = (complex<double>*) malloc(sizeof(complex<double>) * 8*N);
	ifftphi = (complex<double>*) malloc(sizeof(complex<double>) * 8*N);

	for(int i=0;i<NNx;i++){
		for(int j=0;j<NNy;j++){
			for(int k=0;k<NNz;k++){
				if(i < Nx && j < Ny && k < Nz){
					//Copy initial density
					densityPad[i*NNx*NNy+j*NNx+k] = grid->density[i*Nx*Ny+j*Nx+k];
				}else{
					//Padding 0s
					densityPad[i*NNx*NNy+j*NNx+k] = 0.0;
				}
			}
		}
	}
	

	for(int i=0;i<NNx;i++){
		for(int j=0;j<NNy;j++){
			for(int k=0;k<NNz;k++){
				dp[i*NNx*NNy + j*NNx + k] = complex<double>(0.,0.);
				dp[i*NNx*NNy + j*NNx + k] += densityPad[i*NNx*NNy + j*NNx + k];
			}
			
		}
	}

    hipfftDoubleComplex *data;
    hipMalloc((void**)&data, sizeof(hipfftDoubleComplex)*8*N);
    hipMemcpy(data, dp, sizeof(double)*8*N*2, hipMemcpyHostToDevice);
	
	//cufft
	if (hipfftPlan3d(&p1,NNx,NNy,NNz, HIPFFT_Z2Z) != HIPFFT_SUCCESS) {
        printf("CUFFT error: Plan creation failed.\n");
		exit(1);
    }
    if (hipfftExecZ2Z(p1, data, data, HIPFFT_FORWARD) != HIPFFT_SUCCESS) {
		printf("CUFFT error: ExecZ2Z forward failed.\n");
		exit(1);
    }
    hipMemcpy(fftdp, data, sizeof(double)*8*N*2, hipMemcpyDeviceToHost);
    hipDeviceSynchronize();
    hipfftDestroy(p1);
    hipFree(data);
	

	for(int i=0;i<NNx;i++){
		for(int j=0;j<NNy;j++){
			for(int k=0;k<NNz;k++){
				//Multiply 2 imaginary numbers
				int index = i*NNx*NNy + j*NNx + k;
				// phi[index][0] = fftdp[index][0] * fftgf[index][0] - fftdp[index][1] * fftgf[index][1];
				// phi[index][1] = fftdp[index][0] * fftgf[index][1] + fftdp[index][1] * fftgf[index][0];
				phi[index] = fftdp[index] * fftgf[index];
			}
		}
	}

	hipfftDoubleComplex *data2;
    hipMalloc((void**)&data2, sizeof(hipfftDoubleComplex)*8*N);
    hipMemcpy(data, phi, sizeof(double)*8*N*2, hipMemcpyHostToDevice);
	
	////ifft cufft
	if (hipfftPlan3d(&p2,NNx,NNy,NNz, HIPFFT_Z2Z) != HIPFFT_SUCCESS) {
        printf("CUFFT error: Plan creation failed.\n");
		exit(1);
    }
    if (hipfftExecZ2Z(p2, data2, data2, HIPFFT_BACKWARD) != HIPFFT_SUCCESS) {
		printf("CUFFT error: ExecZ2Z forward failed.\n");
		exit(1);
    }
    hipMemcpy(ifftphi, data2, sizeof(double)*8*N*2, hipMemcpyDeviceToHost);
    hipDeviceSynchronize();
    hipfftDestroy(p2);
    hipFree(data2);

	
	

	for(int i=0;i<Nx;i++){
		for(int j=0;j<Ny;j++){
			for(int k=0;k<Nz;k++){
				int index1 = i*Nx*Ny+j*Nx+k;//index for N size grid.
				int index2 = i*NNx*NNy + j*NNx + k;// index for 2N size grid.
				grid->phi[index1] = -1.0/grid->dx / (8*N) * abs(ifftphi[index2]);
			}
		}		
	}

	// for (int i=0; i < Nx; i++){
	// 	for (int j=0; j < Ny; j++){  
	// 		for(int k=0 ; k < Nz ; k++){
	// 			_2nd_order_diff_3d(grid, i, j,k);
	// 		}   
	// 	}
	// }

	//Use GPU to calculate force from potential.
	_2nd_order_diff_3d_cuda(grid);

	free(densityPad);
	free(dp);
	free(fftdp);
	free(phi);
	free(ifftphi);

}

void Weight(struct grid3D *grid,struct particle3D *particle,int type){

	//Initialize Density field
	for(int i=0 ; i < grid->N ; i++){
		grid->density[i]=0.0;
	}

	for(int i=0;i < particle->number;i++){
		int lx,ly,lz,sx,sy,sz;
		double shift = -grid->L/2;	//make (0,0) to be in the center of grid.
		lx = (particle->x[i]-shift)/grid->dx;
		ly = (particle->y[i]-shift)/grid->dy;
		lz = (particle->z[i]-shift)/grid->dz;

		if(type == 0){
			//NGP
			sx = particle->x[i]-shift-lx * grid->dx - 0.5*grid->dx + 1;
			sy = particle->y[i]-shift-ly * grid->dy - 0.5*grid->dy + 1;
			sz = particle->z[i]-shift-lz * grid->dz - 0.5*grid->dz + 1;
			grid->density[(lx+sx)*grid->Nx*grid->Ny + (ly+sy)*grid->Nx + (lz+sz) ] += particle->mass[i];
		}else if(type == 1){
			//CIC
			for(int zz=0;zz<2;zz++){
				for(int j=0;j<4;j++){
					int p = j / 2;
					int q = j % 2;
					double wFactor = (1-fabs(particle->x[i]-shift-(lx+p)*grid->dx)/grid->dx)*(1-fabs(particle->y[i]-shift-(ly+q)*grid->dy)/grid->dy);
					wFactor *= (1-fabs(particle->z[i]-shift-(lz+zz)*grid->dz)/grid->dz);
					grid->density[(lx+p)*grid->Nx*grid->Ny + (ly+q)*grid->Nx + (lz+zz) ] += particle->mass[i] * wFactor;
				}
			}
			
		}else if(type == 2){
			//TSC
			//xxx
			//xox
			//xxx
			lx = (particle->x[i]-shift+0.5*grid->dx)/grid->dx;	//Find the nearest point in lattice index.
			ly = (particle->y[i]-shift+0.5*grid->dy)/grid->dy;
			lz = (particle->z[i]-shift+0.5*grid->dz)/grid->dz;
			double weightX[3];	//Weight factor in x direction for 3 affected points
			double weightY[3];
			double weightZ[3];
			//Construct weighting factor
			for(int xx=-1;xx<2;xx++){
				double ddx = fabs(particle->x[i]-shift-(lx+xx)*grid->dx);
				if(ddx <= grid->dx/2){
					weightX[xx+1] = 3.0/4 - pow(ddx / grid->dx,2);
				}else if(ddx<= grid->dx/2*3.0){
					weightX[xx+1] = 0.5*pow(1.5-ddx / grid->dx,2);
				}else{
					printf("Should not be here");
					weightX[xx+1]=0.0;
				}
				
			}
			for(int yy=-1;yy<2;yy++){
				double ddy = fabs(particle->y[i]-shift-(ly+yy)*grid->dy);
				if(ddy <= grid->dy/2){
					weightY[yy+1] = 3.0/4 - pow(ddy / grid->dy,2);
				}else if(ddy <= grid->dy/2*3.0){
					weightY[yy+1] = 0.5*pow(1.5-ddy / grid->dy,2);
				}else{
					weightY[yy+1]=0.0;
				}
			}
			for(int zz=-1;zz<2;zz++){
				double ddz = fabs(particle->z[i]-shift-(lz+zz)*grid->dz);
				if(ddz <= grid->dz/2){
					weightZ[zz+1] = 3.0/4 - pow(ddz / grid->dz,2);
				}else if(ddz <= grid->dz/2*3.0){
					weightZ[zz+1] = 0.5*pow(1.5-ddz / grid->dz,2);
				}else{
					weightZ[zz+1]=0.0;
				}
			}
			//Weight mass into density
			int indx,indy,indz;
			for(int xx=-1;xx<2;xx++){
				for(int yy=-1;yy<2;yy++){
					for(int zz=-1;zz<2;zz++){
						//Account for periodic boundary
						indx = ((lx+xx)+grid->Nx)%grid->Nx;
						indy = ((ly+yy)+grid->Ny)%grid->Ny;
						indz = ((lz+zz)+grid->Nz)%grid->Nz;
						int index = indx*grid->Nx*grid->Ny + indy*grid->Nx + indz;
						grid->density[index]+=weightX[xx+1]*weightY[yy+1]*weightZ[zz+1]*particle->mass[i];
					}
					
				}
			}
		}
		
	}
}
void WeightForce(struct grid3D *grid,struct particle3D *particle,int type){
	//type = 0/1/2  => NGP/CIC/TSC
	for(int i=0;i < particle->number;i++){
		int lx,ly,lz,sx,sy,sz;
		double shift = -grid->L/2;	//make (0,0) to be in the center of grid.
		lx = (particle->x[i]-shift)/grid->dx;
		ly = (particle->y[i]-shift)/grid->dy;
		lz = (particle->z[i]-shift)/grid->dz;
		particle->Fx[i]=0.0;
		particle->Fy[i]=0.0;
		particle->Fz[i]=0.0;

		if(type == 0){
			sx = particle->x[i]-shift-lx * grid->dx - 0.5*grid->dx + 1;
			sy = particle->y[i]-shift-ly * grid->dy - 0.5*grid->dy + 1;
			sz = particle->z[i]-shift-lz * grid->dz - 0.5*grid->dz + 1;
			int pos = (lx+sx)*grid->Nx*grid->Ny + (ly+sy)*grid->Nx + (lz+sz) ;
			particle->Fx[i]=grid->Fx[pos]*particle->mass[i];
			particle->Fy[i]=grid->Fy[pos]*particle->mass[i];
			particle->Fz[i]=grid->Fz[pos]*particle->mass[i];
		}else if(type == 1){
			for(int zz=0;zz<2;zz++){
				for(int j=0;j<4;j++){
					int p = j / 2;
					int q = j % 2;
					double wFactor = (1-fabs(particle->x[i]-shift-(lx+p)*grid->dx)/grid->dx)*(1-fabs(particle->y[i]-shift-(ly+q)*grid->dy)/grid->dy);
					wFactor *= (1-fabs(particle->z[i]-shift-(lz+zz)*grid->dz)/grid->dz);
					int pos = (lx+p)*grid->Nx*grid->Ny + (ly+q)*grid->Nx + (lz+zz) ;
					particle->Fx[i] += grid->Fx[pos] * wFactor*particle->mass[i];
					particle->Fy[i] += grid->Fy[pos] * wFactor*particle->mass[i];
					particle->Fz[i] += grid->Fz[pos] * wFactor*particle->mass[i];
				}
			}
			
		}else if(type == 2){
			//TSC
			//xxx
			//xox
			//xxx
			lx = (particle->x[i]-shift+0.5*grid->dx)/grid->dx;	//Find the nearest point in lattice index.
			ly = (particle->y[i]-shift+0.5*grid->dy)/grid->dy;
			lz = (particle->z[i]-shift+0.5*grid->dz)/grid->dz;
			double weightX[3];	//Weight factor in x direction for 3 affected points
			double weightY[3];
			double weightZ[3];
			//Construct weighting factor
			for(int xx=-1;xx<2;xx++){
				double ddx = fabs(particle->x[i]-shift-(lx+xx)*grid->dx);
				if(ddx <= grid->dx/2){
					weightX[xx+1] = 3.0/4 - pow(ddx / grid->dx,2);
				}else if(ddx<= grid->dx/2*3.0){
					weightX[xx+1] = 0.5*pow(1.5-ddx / grid->dx,2);
				}else{
					printf("Should not be here");
					weightX[xx+1]=0.0;
				}
				
			}
			for(int yy=-1;yy<2;yy++){
				double ddy = fabs(particle->y[i]-shift-(ly+yy)*grid->dy);
				if(ddy <= grid->dy/2){
					weightY[yy+1] = 3.0/4 - pow(ddy / grid->dy,2);
				}else if(ddy <= grid->dy/2*3.0){
					weightY[yy+1] = 0.5*pow(1.5-ddy / grid->dy,2);
				}else{
					weightY[yy+1]=0.0;
				}
			}
			for(int zz=-1;zz<2;zz++){
				double ddz = fabs(particle->z[i]-shift-(lz+zz)*grid->dz);
				if(ddz <= grid->dz/2){
					weightZ[zz+1] = 3.0/4 - pow(ddz / grid->dz,2);
				}else if(ddz <= grid->dz/2*3.0){
					weightZ[zz+1] = 0.5*pow(1.5-ddz / grid->dz,2);
				}else{
					weightZ[zz+1]=0.0;
				}
			}
			//Weight mass into density
			int indx,indy,indz;
			for(int xx=-1;xx<2;xx++){
				for(int yy=-1;yy<2;yy++){
					for(int zz=-1;zz<2;zz++){
						//Account for periodic boundary
						indx = ((lx+xx)+grid->Nx)%grid->Nx;
						indy = ((ly+yy)+grid->Ny)%grid->Ny;
						indz = ((lz+zz)+grid->Nz)%grid->Nz;
						int index = indx*grid->Nx*grid->Ny + indy*grid->Nx + indz;
						double weight = weightX[xx+1]*weightY[yy+1]*weightZ[zz+1];
						particle->Fx[i] += grid->Fx[index]*weight*particle->mass[i];
						particle->Fy[i] += grid->Fy[index]*weight*particle->mass[i];
						particle->Fz[i] += grid->Fz[index]*weight*particle->mass[i];
					}
					
				}
			}
		}

		
	}
}
void kick(struct particle3D *particle , double dt){
	double ax,ay,az;
	for(int i=0 ; i<particle->number ; i++){
		//Cauculate the acceleration of each particle.
		ax = particle->Fx[i] / particle->mass[i];
		ay = particle->Fy[i] / particle->mass[i];
		az = particle->Fz[i] / particle->mass[i];

		//Calculate velocity of each particle.
		particle->vx[i] += ax * dt;
		particle->vy[i] += ay * dt;
		particle->vz[i] += az * dt;
	}
}
void drift(struct particle3D *particle , double dt){
	for(int i=0 ; i<particle->number ; i++){
		particle->x[i] += particle->vx[i] * dt;
		particle->y[i] += particle->vy[i] * dt;
		particle->z[i] += particle->vz[i] * dt;
	}
}
void init_rk4(struct particle3D *particle, struct particle3D *buff, struct rk43D *rk4){
	for(int i=0 ; i<particle->number ; i++){
		buff->vx[i] = particle->vx[i];
		buff->vy[i] = particle->vy[i];
		buff->vz[i] = particle->vz[i];
		buff->Fx[i] = particle->Fx[i];
		buff->Fy[i] = particle->Fy[i];
		buff->Fz[i] = particle->Fz[i];
		rk4->ax[i] = 0;
		rk4->ay[i] = 0;
		rk4->az[i] = 0;
		rk4->vx[i] = 0;
		rk4->vy[i] = 0;
		rk4->vz[i] = 0;
		rk4->step1 = 0;
		rk4->step2 = 1;
	}
}
void rk4_mid(struct particle3D *particle, struct particle3D *buff, struct rk43D *rk4, double dt, int weighting){
	for(int i=0 ; i<particle->number ; i++){
		buff->Fx[i] = rk4->step1 * buff->Fx[i] + rk4->step2 * particle->Fx[i];
		buff->Fy[i] = rk4->step1 * buff->Fy[i] + rk4->step2 * particle->Fy[i];
		buff->Fz[i] = rk4->step1 * buff->Fz[i] + rk4->step2 * particle->Fz[i];

		buff->x[i] = particle->x[i] + buff->vx[i] * dt;
		buff->y[i] = particle->y[i] + buff->vy[i] * dt;
		buff->z[i] = particle->z[i] + buff->vz[i] * dt;

		rk4->ax[i] += weighting/6.0 * buff->Fx[i]/particle->mass[i];
		rk4->ay[i] += weighting/6.0 * buff->Fy[i]/particle->mass[i];
		rk4->az[i] += weighting/6.0 * buff->Fz[i]/particle->mass[i];
		rk4->vx[i] += weighting/6.0 * buff->vx[i];
		rk4->vy[i] += weighting/6.0 * buff->vy[i];
		rk4->vz[i] += weighting/6.0 * buff->vz[i];

		buff->vx[i] = particle->vx[i] + buff->Fx[i]/particle->mass[i] * dt;
		buff->vy[i] = particle->vy[i] + buff->Fy[i]/particle->mass[i] * dt;
		buff->vz[i] = particle->vz[i] + buff->Fz[i]/particle->mass[i] * dt;

		rk4->step1 = 1;
		rk4->step2 = 0;
	}
}
void rk4_end(struct particle3D *particle, struct rk43D *rk4, double dt){
	for(int i=0 ; i<particle->number ; i++){
		particle->x[i]  += rk4->vx[i] * dt;
		particle->y[i]  += rk4->vy[i] * dt;
		particle->z[i]  += rk4->vz[i] * dt;
		particle->vx[i] += rk4->ax[i] * dt;
		particle->vy[i] += rk4->ay[i] * dt;
		particle->vz[i] += rk4->az[i] * dt;
	}
}
void periodic_boundary(double position, double length){
	int sign = position/abs(position);
	position = sign * remainder(abs(position + sign*length/2), length) - sign*length/2;
	cout << "A particle reaches the boundary." << endl;
}
void boundary_check(int boundary, struct particle3D *particle, double L){
	if (boundary == 0){
		for (int i=0; i<particle->number; i++){
			if ( abs(particle->x[i]) > L/2){
				periodic_boundary(particle->x[i],L);
			}
			if ( abs(particle->y[i]) > L/2){
				periodic_boundary(particle->y[i],L);
			}
			if ( abs(particle->z[i]) > L/2){
				periodic_boundary(particle->z[i],L);
			}
		}
	}
	else if (boundary == 1){
		for (int i=0; i<particle->number; i++){
			if ( abs(particle->x[i]) > L/2 || abs(particle->y[i]) > L/2 || abs(particle->z[i]) > L/2){
				particle->mass[i] = 0;
				cout << "A particle reaches the boundary." << endl;
			}
		}
	}
}
//Functions to locate memory and free memory of different struct.
void locateMemoryParticle(struct particle3D *particle,int N){
	particle->mass = (double*)malloc(N*sizeof(double));
    particle->x = (double*)malloc(N*sizeof(double));
    particle->y = (double*)malloc(N*sizeof(double));
    particle->z = (double*)malloc(N*sizeof(double));
	particle->Fx = (double*)malloc(N*sizeof(double));
    particle->Fy = (double*)malloc(N*sizeof(double));
    particle->Fz = (double*)malloc(N*sizeof(double));
	particle->vx = (double*)malloc(N*sizeof(double));
    particle->vy = (double*)malloc(N*sizeof(double));
	particle->vz = (double*)malloc(N*sizeof(double));
}
void freeMemoryParticle(struct particle3D *particle){
	free(particle->mass);
	free(particle->x);
	free(particle->y);
	free(particle->z);
	free(particle->Fx);
	free(particle->Fy);
	free(particle->Fz);
	free(particle->vx);
	free(particle->vy);
	free(particle->vz);
}
void locateMemoryRk4(struct rk43D *rk4,int N){
	rk4->ax = (double*)malloc(N*sizeof(double));
	rk4->ay = (double*)malloc(N*sizeof(double));
	rk4->az = (double*)malloc(N*sizeof(double));
	rk4->vx = (double*)malloc(N*sizeof(double));
	rk4->vy = (double*)malloc(N*sizeof(double));
	rk4->vz = (double*)malloc(N*sizeof(double));	
}
void freeMemoryRk4(struct rk43D *rk4){
	free(rk4->ax);
	free(rk4->ay);
	free(rk4->az);
	free(rk4->vx);
	free(rk4->vy);
	free(rk4->vz);
}
void locateMemoryGrid(struct grid3D *grid){
	grid->density = (double*) malloc(grid->N*sizeof(double));	//Density on the grid
	grid->phi = (double*) malloc(grid->N*sizeof(double));		//Potential on the grid
	grid->Fx = (double*) malloc(grid->N*sizeof(double));			//Force on grid comes from potential calculation
	grid->Fy = (double*) malloc(grid->N*sizeof(double));
	grid->Fz = (double*) malloc(grid->N*sizeof(double));
}
void freeMemoryGrid(struct grid3D *grid){
	free(grid->density);
	free(grid->phi);
	free(grid->Fx);
	free(grid->Fy);
	free(grid->Fz);
}

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

                                        # End of file scope inline assembly
	.globl	_Z25__device_stub__phiToForcePdS_S_S_idd # -- Begin function _Z25__device_stub__phiToForcePdS_S_S_idd
	.type	_Z25__device_stub__phiToForcePdS_S_S_idd,@function
_Z25__device_stub__phiToForcePdS_S_S_idd: # @_Z25__device_stub__phiToForcePdS_S_S_idd
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$176, %rsp
	.cfi_def_cfa_offset 224
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	72(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	64(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	56(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	48(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	12(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	40(%rsp), %r8
	movsd	%xmm0, (%r8)
	leaq	32(%rsp), %r9
	movsd	%xmm1, (%r9)
	leaq	112(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	movq	%r9, 48(%rbx)
	leaq	96(%rsp), %r14
	leaq	80(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z10phiToForcePdS_S_S_idd, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$192, %rsp
	.cfi_adjust_cfa_offset -192
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z25__device_stub__phiToForcePdS_S_S_idd, .Lfunc_end0-_Z25__device_stub__phiToForcePdS_S_S_idd
	.cfi_endproc
                                        # -- End function
	.globl	_Z21__device_stub__overk2Pdiii  # -- Begin function _Z21__device_stub__overk2Pdiii
	.type	_Z21__device_stub__overk2Pdiii,@function
_Z21__device_stub__overk2Pdiii:         # @_Z21__device_stub__overk2Pdiii
	.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	20(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	16(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	12(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%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	$_Z6overk2Pdiii, %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_end1:
	.size	_Z21__device_stub__overk2Pdiii, .Lfunc_end1-_Z21__device_stub__overk2Pdiii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function main
.LCPI2_0:
	.long	256                             # 0x100
	.long	256                             # 0x100
	.long	256                             # 0x100
	.long	16777216                        # 0x1000000
.LCPI2_1:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
.LCPI2_2:
	.quad	0x8000000000000000              # double -0
	.quad	0x8000000000000000              # double -0
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI2_3:
	.quad	0x4010000000000000              # double 4
.LCPI2_4:
	.quad	0x4023bd3cc9be45de              # double 9.869604401089358
.LCPI2_5:
	.quad	0x3f747ae147ae147b              # double 0.0050000000000000001
.LCPI2_6:
	.quad	0x4024000000000000              # double 10
.LCPI2_7:
	.quad	0x3f847ae147ae147b              # double 0.01
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI2_8:
	.long	0x447a0000                      # float 1000
	.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	$232, %rsp
	.cfi_def_cfa_offset 288
	.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	40(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventCreate
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
	movq	(%rbx), %rdi
	xorl	%r13d, %r13d
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	$.L.str, %edi
	movl	$.L.str.1, %esi
	callq	fopen
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	movabsq	$4621819117588971520, %rax      # imm = 0x4024000000000000
	leaq	144(%rsp), %r14
	movq	%rax, (%r14)
	movaps	.LCPI2_0(%rip), %xmm0           # xmm0 = [256,256,256,16777216]
	movups	%xmm0, 8(%r14)
	movabsq	$4585812397038769172, %rax      # imm = 0x3FA4141414141414
	movq	%rax, 24(%r14)
	movq	%rax, 32(%r14)
	movq	%rax, 40(%r14)
	movq	%r14, %rdi
	callq	_Z16locateMemoryGridP6grid3D
	leaq	56(%rsp), %r15
	movl	$2, (%r15)
	movq	%r15, %rdi
	movl	$2, %esi
	callq	_Z20locateMemoryParticleP10particle3Di
	movq	8(%r15), %rbp
	movabsq	$4611686018427387904, %rax      # imm = 0x4000000000000000
	movq	%rax, (%rbp)
	movabsq	$4607182418800017408, %rax      # imm = 0x3FF0000000000000
	movq	%rax, 8(%rbp)
	movq	16(%r15), %r12
	movq	%rax, (%r12)
	movq	24(%r15), %rdx
	movq	%r13, (%rdx)
	movq	32(%r15), %rax
	movq	%r13, (%rax)
	movabsq	$-4611686018427387904, %rcx     # imm = 0xC000000000000000
	movq	%rcx, 8(%r12)
	movq	%r13, 8(%rdx)
	movq	%r13, 8(%rax)
	movsd	(%r12), %xmm0                   # xmm0 = mem[0],zero
	movsd	8(%r12), %xmm1                  # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm0
	movsd	(%rdx), %xmm2                   # xmm2 = mem[0],zero
	movq	%rdx, 32(%rsp)                  # 8-byte Spill
	movsd	8(%rdx), %xmm3                  # xmm3 = mem[0],zero
	mulsd	%xmm2, %xmm2
	addsd	%xmm0, %xmm2
	movsd	(%rax), %xmm0                   # xmm0 = mem[0],zero
	mulsd	%xmm0, %xmm0
	addsd	%xmm2, %xmm0
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	mulsd	%xmm1, %xmm1
	mulsd	%xmm3, %xmm3
	addsd	%xmm1, %xmm3
	movsd	%xmm3, 8(%rsp)                  # 8-byte Spill
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	$1, %edx
	callq	_Z6WeightP6grid3DP10particle3Di
	movq	%r14, %rsi
	callq	_Z27poisson_solver_fft_force_3diP6grid3D
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	$1, %edx
	callq	_Z11WeightForceP6grid3DP10particle3Di
	movq	64(%r15), %rbx
	movq	%r13, (%rbx)
	movq	40(%r15), %r15
	movsd	(%r15), %xmm0                   # xmm0 = mem[0],zero
	mulsd	(%r12), %xmm0
	andpd	.LCPI2_1(%rip), %xmm0
	divsd	(%rbp), %xmm0
	xorpd	%xmm1, %xmm1
	ucomisd	%xmm1, %xmm0
	jb	.LBB2_2
# %bb.1:
	sqrtsd	%xmm0, %xmm0
	jmp	.LBB2_3
.LBB2_2:                                # %call.sqrt
	callq	sqrt
	xorpd	%xmm1, %xmm1
.LBB2_3:                                # %.split
	xorps	%xmm2, %xmm2
	sqrtsd	(%rsp), %xmm2                   # 8-byte Folded Reload
	xorpd	.LCPI2_2(%rip), %xmm0
	xorps	%xmm3, %xmm3
	sqrtsd	8(%rsp), %xmm3                  # 8-byte Folded Reload
	movq	128(%rsp), %r14
	movlpd	%xmm0, (%r14)
	movq	136(%rsp), %r13
	xorl	%eax, %eax
	movq	%rax, (%r13)
	movq	%rax, 8(%rbx)
	movsd	8(%r15), %xmm0                  # xmm0 = mem[0],zero
	mulsd	8(%r12), %xmm0
	andpd	.LCPI2_1(%rip), %xmm0
	divsd	8(%rbp), %xmm0
	ucomisd	%xmm1, %xmm0
	jb	.LBB2_5
# %bb.4:
	sqrtsd	%xmm0, %xmm0
	jmp	.LBB2_6
.LBB2_5:                                # %call.sqrt106
	movsd	%xmm2, 8(%rsp)                  # 8-byte Spill
	movsd	%xmm3, (%rsp)                   # 8-byte Spill
	callq	sqrt
	movsd	(%rsp), %xmm3                   # 8-byte Reload
                                        # xmm3 = mem[0],zero
	movsd	8(%rsp), %xmm2                  # 8-byte Reload
                                        # xmm2 = mem[0],zero
.LBB2_6:                                # %.split.split
	movsd	%xmm0, 8(%r14)
	movq	$0, 8(%r13)
	movsd	(%rbp), %xmm0                   # xmm0 = mem[0],zero
	movsd	8(%rbp), %xmm1                  # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	addsd	%xmm2, %xmm3
	mulsd	%xmm3, %xmm3
	mulsd	.LCPI2_3(%rip), %xmm0
	divsd	%xmm3, %xmm1
	mulsd	.LCPI2_4(%rip), %xmm0
	mulsd	%xmm2, %xmm0
	divsd	%xmm1, %xmm0
	xorpd	%xmm1, %xmm1
	ucomisd	%xmm1, %xmm0
	jae	.LBB2_8
# %bb.7:                                # %call.sqrt107
	callq	sqrt
.LBB2_8:                                # %.split.split.split
	movsd	(%r15), %xmm0                   # xmm0 = mem[0],zero
	leaq	56(%rsp), %r14
	movq	48(%r14), %rbx
	movq	56(%r14), %r13
	movsd	(%rbx), %xmm1                   # xmm1 = mem[0],zero
	movsd	(%r13), %xmm2                   # xmm2 = mem[0],zero
	movl	$.L.str.2, %edi
	movb	$3, %al
	callq	printf
	movsd	8(%r15), %xmm0                  # xmm0 = mem[0],zero
	movsd	8(%rbx), %xmm1                  # xmm1 = mem[0],zero
	movsd	8(%r13), %xmm2                  # xmm2 = mem[0],zero
	movl	$.L.str.2, %edi
	movb	$3, %al
	callq	printf
	leaq	144(%rsp), %r15
	xorl	%ebp, %ebp
.LBB2_9:                                # =>This Inner Loop Header: Depth=1
	movzwl	%bp, %ebx
	imull	$52429, %ebx, %eax              # imm = 0xCCCD
	shrl	$18, %eax
	andl	$-4, %eax
	leal	(%rax,%rax,4), %r13d
	negl	%r13d
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$1, %edx
	callq	_Z6WeightP6grid3DP10particle3Di
	movq	%r15, %rsi
	callq	_Z27poisson_solver_fft_force_3diP6grid3D
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$1, %edx
	callq	_Z11WeightForceP6grid3DP10particle3Di
	movq	%r14, %rdi
	movsd	.LCPI2_5(%rip), %xmm0           # xmm0 = mem[0],zero
	callq	_Z5driftP10particle3Dd
	xorl	%edi, %edi
	movq	%r14, %rsi
	movsd	.LCPI2_6(%rip), %xmm0           # xmm0 = mem[0],zero
	callq	_Z14boundary_checkiP10particle3Dd
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$1, %edx
	callq	_Z6WeightP6grid3DP10particle3Di
	movq	%r15, %rsi
	callq	_Z27poisson_solver_fft_force_3diP6grid3D
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$1, %edx
	callq	_Z11WeightForceP6grid3DP10particle3Di
	movq	%r14, %rdi
	movsd	.LCPI2_7(%rip), %xmm0           # xmm0 = mem[0],zero
	callq	_Z4kickP10particle3Dd
	movq	%r14, %rdi
	movsd	.LCPI2_5(%rip), %xmm0           # xmm0 = mem[0],zero
	callq	_Z5driftP10particle3Dd
	xorl	%edi, %edi
	movq	%r14, %rsi
	movsd	.LCPI2_6(%rip), %xmm0           # xmm0 = mem[0],zero
	callq	_Z14boundary_checkiP10particle3Dd
	addw	%r13w, %bx
	jne	.LBB2_11
# %bb.10:                               #   in Loop: Header=BB2_9 Depth=1
	movl	$.L.str.3, %edi
	movl	%ebp, %esi
	xorl	%eax, %eax
	callq	printf
	movsd	(%r12), %xmm0                   # xmm0 = mem[0],zero
	movq	32(%rsp), %r13                  # 8-byte Reload
	movsd	(%r13), %xmm1                   # xmm1 = mem[0],zero
	movl	$.L.str.4, %esi
	movq	24(%rsp), %rbx                  # 8-byte Reload
	movq	%rbx, %rdi
	movb	$2, %al
	callq	fprintf
	movsd	8(%r12), %xmm0                  # xmm0 = mem[0],zero
	movsd	8(%r13), %xmm1                  # xmm1 = mem[0],zero
	movl	$.L.str.5, %esi
	movq	%rbx, %rdi
	movb	$2, %al
	callq	fprintf
.LBB2_11:                               #   in Loop: Header=BB2_9 Depth=1
	incl	%ebp
	cmpl	$1000, %ebp                     # imm = 0x3E8
	jne	.LBB2_9
# %bb.12:
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	16(%rsp), %rdi
	callq	hipEventSynchronize
	movq	40(%rsp), %rsi
	movq	16(%rsp), %rdx
	leaq	52(%rsp), %r14
	movq	%r14, %rdi
	callq	hipEventElapsedTime
	movss	(%r14), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI2_8(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.6, %edi
	movb	$1, %al
	callq	printf
	movq	24(%rsp), %rdi                  # 8-byte Reload
	callq	fclose
	leaq	144(%rsp), %rdi
	callq	_Z14freeMemoryGridP6grid3D
	leaq	56(%rsp), %rdi
	callq	_Z18freeMemoryParticleP10particle3D
	xorl	%eax, %eax
	addq	$232, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	main, .Lfunc_end2-main
	.cfi_endproc
                                        # -- End function
	.globl	_Z16locateMemoryGridP6grid3D    # -- Begin function _Z16locateMemoryGridP6grid3D
	.type	_Z16locateMemoryGridP6grid3D,@function
_Z16locateMemoryGridP6grid3D:           # @_Z16locateMemoryGridP6grid3D
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rdi, %rbx
	movslq	20(%rdi), %r14
	shlq	$3, %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 56(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 48(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 64(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 72(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 80(%rbx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z16locateMemoryGridP6grid3D, .Lfunc_end3-_Z16locateMemoryGridP6grid3D
	.cfi_endproc
                                        # -- End function
	.globl	_Z20locateMemoryParticleP10particle3Di # -- Begin function _Z20locateMemoryParticleP10particle3Di
	.type	_Z20locateMemoryParticleP10particle3Di,@function
_Z20locateMemoryParticleP10particle3Di: # @_Z20locateMemoryParticleP10particle3Di
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rdi, %rbx
	movslq	%esi, %r14
	shlq	$3, %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 8(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 16(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 24(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 32(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 40(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 48(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 56(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 64(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 72(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 80(%rbx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z20locateMemoryParticleP10particle3Di, .Lfunc_end4-_Z20locateMemoryParticleP10particle3Di
	.cfi_endproc
                                        # -- End function
	.globl	_Z15locateMemoryRk4P5rk43Di     # -- Begin function _Z15locateMemoryRk4P5rk43Di
	.type	_Z15locateMemoryRk4P5rk43Di,@function
_Z15locateMemoryRk4P5rk43Di:            # @_Z15locateMemoryRk4P5rk43Di
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rdi, %rbx
	movslq	%esi, %r14
	shlq	$3, %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 8(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 16(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 24(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 32(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 40(%rbx)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 48(%rbx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z15locateMemoryRk4P5rk43Di, .Lfunc_end5-_Z15locateMemoryRk4P5rk43Di
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z17calculateGreenFFTP6grid3DPSt7complexIdE
.LCPI6_0:
	.quad	0xbff0000000000000              # double -1
.LCPI6_1:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z17calculateGreenFFTP6grid3DPSt7complexIdE
	.type	_Z17calculateGreenFFTP6grid3DPSt7complexIdE,@function
_Z17calculateGreenFFTP6grid3DPSt7complexIdE: # @_Z17calculateGreenFFTP6grid3DPSt7complexIdE
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, 72(%rsp)                  # 8-byte Spill
	movslq	20(%rdi), %rbx
	movl	8(%rdi), %r12d
	movl	12(%rdi), %eax
	movl	16(%rdi), %r14d
	leal	(%r12,%r12), %r13d
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	addl	%eax, %eax
	movl	%eax, 4(%rsp)                   # 4-byte Spill
	leal	(%r14,%r14), %eax
	movl	%eax, 20(%rsp)                  # 4-byte Spill
	movq	%rbx, %rdi
	shlq	$6, %rdi
	callq	malloc
	movq	%rax, %r15
	shlq	$7, %rbx
	movq	%rbx, 80(%rsp)                  # 8-byte Spill
	movq	%rbx, %rdi
	movq	%r12, %rbx
	callq	malloc
	movq	%rax, %r12
	testl	%ebx, %ebx
	movq	%rbx, 32(%rsp)                  # 8-byte Spill
	jle	.LBB6_18
# %bb.1:                                # %.preheader248.lr.ph
	movl	20(%rsp), %edx                  # 4-byte Reload
	cmpl	$2, %edx
	movl	$1, %eax
	movl	$1, %ecx
	cmovgel	%edx, %ecx
	movl	4(%rsp), %esi                   # 4-byte Reload
	cmpl	$2, %esi
	movl	$1, %edx
	cmovgel	%esi, %edx
	cmpl	$2, %r13d
	cmovgel	%r13d, %eax
	movq	8(%rsp), %rsi                   # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	imull	%ebx, %esi
	shll	$2, %esi
	xorl	%edi, %edi
	xorl	%r8d, %r8d
.LBB6_2:                                # %.preheader248
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_4 Depth 2
                                        #       Child Loop BB6_65 Depth 3
	cmpl	$0, 8(%rsp)                     # 4-byte Folded Reload
	jle	.LBB6_6
# %bb.3:                                # %.preheader247.lr.ph
                                        #   in Loop: Header=BB6_2 Depth=1
	xorl	%r9d, %r9d
	movl	%edi, %r10d
.LBB6_4:                                # %.preheader247
                                        #   Parent Loop BB6_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB6_65 Depth 3
	movq	%rcx, %r11
	movl	%r10d, %ebx
	testl	%r14d, %r14d
	jle	.LBB6_5
.LBB6_65:                               #   Parent Loop BB6_2 Depth=1
                                        #     Parent Loop BB6_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movslq	%ebx, %rbx
	movq	$0, (%r15,%rbx,8)
	incl	%ebx
	decq	%r11
	jne	.LBB6_65
.LBB6_5:                                # %._crit_edge
                                        #   in Loop: Header=BB6_4 Depth=2
	incl	%r9d
	addl	%r13d, %r10d
	cmpl	%edx, %r9d
	jne	.LBB6_4
.LBB6_6:                                # %._crit_edge251
                                        #   in Loop: Header=BB6_2 Depth=1
	incl	%r8d
	addl	%esi, %edi
	cmpl	%eax, %r8d
	jne	.LBB6_2
# %bb.7:                                # %.preheader246
	movq	32(%rsp), %rbx                  # 8-byte Reload
	testl	%ebx, %ebx
	jle	.LBB6_18
# %bb.8:                                # %.preheader245.lr.ph
	movq	8(%rsp), %rax                   # 8-byte Reload
                                        # kill: def $eax killed $eax killed $rax def $rax
	imull	%ebx, %eax
	shll	$2, %eax
	movl	%r13d, %ecx
	xorl	%edx, %edx
	xorpd	%xmm0, %xmm0
	movsd	.LCPI6_0(%rip), %xmm1           # xmm1 = mem[0],zero
	movsd	.LCPI6_1(%rip), %xmm2           # xmm2 = mem[0],zero
	xorl	%esi, %esi
.LBB6_9:                                # %.preheader245
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_11 Depth 2
                                        #       Child Loop BB6_13 Depth 3
	cmpl	$0, 8(%rsp)                     # 4-byte Folded Reload
	jle	.LBB6_17
# %bb.10:                               # %.preheader244.lr.ph
                                        #   in Loop: Header=BB6_9 Depth=1
	movapd	%xmm0, %xmm3
	mulsd	%xmm0, %xmm3
	xorl	%edi, %edi
	xorpd	%xmm4, %xmm4
	movq	%rdx, %r8
.LBB6_11:                               # %.preheader244
                                        #   Parent Loop BB6_9 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB6_13 Depth 3
	testl	%r14d, %r14d
	jle	.LBB6_16
# %bb.12:                               # %.lr.ph254
                                        #   in Loop: Header=BB6_11 Depth=2
	movl	%edi, %r9d
	orl	%esi, %r9d
	movapd	%xmm4, %xmm5
	mulsd	%xmm4, %xmm5
	addsd	%xmm3, %xmm5
	xorl	%r10d, %r10d
.LBB6_13:                               #   Parent Loop BB6_9 Depth=1
                                        #     Parent Loop BB6_11 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	%r9d, %r11d
	orl	%r10d, %r11d
	je	.LBB6_15
# %bb.14:                               #   in Loop: Header=BB6_13 Depth=3
	xorps	%xmm6, %xmm6
	cvtsi2sd	%r10d, %xmm6
	mulsd	%xmm6, %xmm6
	addsd	%xmm5, %xmm6
	sqrtsd	%xmm6, %xmm6
	movapd	%xmm1, %xmm7
	divsd	%xmm6, %xmm7
	leal	(%r8,%r10), %r11d
	movslq	%r11d, %r11
	movsd	%xmm7, (%r15,%r11,8)
.LBB6_15:                               #   in Loop: Header=BB6_13 Depth=3
	incq	%r10
	cmpq	%r10, %r14
	jne	.LBB6_13
.LBB6_16:                               # %._crit_edge255
                                        #   in Loop: Header=BB6_11 Depth=2
	addsd	%xmm2, %xmm4
	incl	%edi
	addq	%rcx, %r8
	cmpl	8(%rsp), %edi                   # 4-byte Folded Reload
	jne	.LBB6_11
.LBB6_17:                               # %._crit_edge257
                                        #   in Loop: Header=BB6_9 Depth=1
	addsd	%xmm2, %xmm0
	incl	%esi
	addq	%rax, %rdx
	cmpl	%ebx, %esi
	jne	.LBB6_9
.LBB6_18:                               # %._crit_edge259
	leal	1(%rbx), %eax
	movslq	%r13d, %rcx
	cmpl	%r13d, %eax
	jge	.LBB6_27
# %bb.19:                               # %.preheader243.lr.ph
	movl	%eax, %edx
	movq	8(%rsp), %r8                    # 8-byte Reload
                                        # kill: def $r8d killed $r8d killed $r8 def $r8
	movq	32(%rsp), %rdi                  # 8-byte Reload
	imull	%edi, %r8d
	leal	(,%r8,4), %esi
	decl	%edi
	imull	%r8d, %edi
                                        # kill: def $r8d killed $r8d killed $r8
	imull	%eax, %r8d
	shll	$2, %r8d
	leaq	(,%rcx,8), %r9
	shll	$2, %edi
.LBB6_20:                               # %.preheader243
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_22 Depth 2
                                        #       Child Loop BB6_24 Depth 3
	cmpl	$0, 8(%rsp)                     # 4-byte Folded Reload
	jle	.LBB6_26
# %bb.21:                               # %.preheader242.lr.ph
                                        #   in Loop: Header=BB6_20 Depth=1
	movslq	%r8d, %r10
	leaq	(%r15,%r10,8), %r10
	movslq	%edi, %r11
	leaq	(%r15,%r11,8), %r11
	xorl	%ebp, %ebp
.LBB6_22:                               # %.preheader242
                                        #   Parent Loop BB6_20 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB6_24 Depth 3
	testl	%r14d, %r14d
	jle	.LBB6_25
# %bb.23:                               # %.lr.ph261
                                        #   in Loop: Header=BB6_22 Depth=2
	xorl	%ebx, %ebx
.LBB6_24:                               #   Parent Loop BB6_20 Depth=1
                                        #     Parent Loop BB6_22 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movsd	(%r11,%rbx,8), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, (%r10,%rbx,8)
	incq	%rbx
	cmpq	%rbx, %r14
	jne	.LBB6_24
.LBB6_25:                               # %._crit_edge262
                                        #   in Loop: Header=BB6_22 Depth=2
	incq	%rbp
	addq	%r9, %r10
	addq	%r9, %r11
	cmpq	8(%rsp), %rbp                   # 8-byte Folded Reload
	jne	.LBB6_22
.LBB6_26:                               # %._crit_edge264
                                        #   in Loop: Header=BB6_20 Depth=1
	incq	%rdx
	addl	%esi, %r8d
	subl	%esi, %edi
	cmpl	%edx, %r13d
	jne	.LBB6_20
.LBB6_27:                               # %.preheader241
	movq	32(%rsp), %rbx                  # 8-byte Reload
	testl	%ebx, %ebx
	jle	.LBB6_32
# %bb.28:                               # %.preheader240.lr.ph
	movq	8(%rsp), %r9                    # 8-byte Reload
	movslq	%r9d, %r8
	incq	%r8
	movslq	4(%rsp), %rdx                   # 4-byte Folded Reload
	movq	%rcx, %rsi
	imulq	%r8, %rsi
	leaq	(%r15,%rsi,8), %rsi
	movq	%rsi, 24(%rsp)                  # 8-byte Spill
	movl	%ebx, %edi
	imull	%r9d, %edi
	shll	$2, %edi
	subq	%r8, %rdx
	imulq	%rcx, %rdx
	shlq	$3, %rcx
	leaq	(%r15,%rdx,8), %rdx
	movq	%rdx, 40(%rsp)                  # 8-byte Spill
	movq	%rcx, %r9
	negq	%r9
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
.LBB6_29:                               # %.preheader240
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_56 Depth 2
                                        #       Child Loop BB6_58 Depth 3
	cmpl	4(%rsp), %r8d                   # 4-byte Folded Reload
	jge	.LBB6_31
# %bb.30:                               #   in Loop: Header=BB6_29 Depth=1
	movslq	%r10d, %rdx
	movq	24(%rsp), %rsi                  # 8-byte Reload
	leaq	(%rsi,%rdx,8), %rbp
	movq	40(%rsp), %rsi                  # 8-byte Reload
	leaq	(%rsi,%rdx,8), %rsi
	movq	%r8, %rdx
.LBB6_56:                               # %.preheader238
                                        #   Parent Loop BB6_29 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB6_58 Depth 3
	testl	%r14d, %r14d
	jle	.LBB6_55
# %bb.57:                               # %.lr.ph267
                                        #   in Loop: Header=BB6_56 Depth=2
	xorl	%ebx, %ebx
.LBB6_58:                               #   Parent Loop BB6_29 Depth=1
                                        #     Parent Loop BB6_56 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movsd	(%rsi,%rbx,8), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, (%rbp,%rbx,8)
	incq	%rbx
	cmpq	%rbx, %r14
	jne	.LBB6_58
.LBB6_55:                               # %.loopexit239
                                        #   in Loop: Header=BB6_56 Depth=2
	incq	%rdx
	addq	%rcx, %rbp
	addq	%r9, %rsi
	cmpl	%edx, 4(%rsp)                   # 4-byte Folded Reload
	jne	.LBB6_56
.LBB6_31:                               # %._crit_edge270
                                        #   in Loop: Header=BB6_29 Depth=1
	incq	%r11
	addl	%edi, %r10d
	movq	32(%rsp), %rbx                  # 8-byte Reload
	cmpq	%rbx, %r11
	jne	.LBB6_29
.LBB6_32:                               # %.preheader237
	cmpl	%r13d, %eax
	jge	.LBB6_36
# %bb.33:                               # %.preheader236.lr.ph
	movq	8(%rsp), %rcx                   # 8-byte Reload
	leal	1(%rcx), %edx
	movl	%edx, 24(%rsp)                  # 4-byte Spill
	leal	3(%r13), %edx
	imull	%ecx, %edx
	incl	%edx
	imull	%ebx, %edx
	addl	%edx, %edx
	movl	%ecx, %esi
	imull	%ebx, %esi
	shll	$2, %esi
	leal	-1(%r13), %edi
	imull	%ecx, %edi
	decl	%edi
	imull	%ebx, %edi
	addl	%edi, %edi
.LBB6_34:                               # %.preheader236
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_60 Depth 2
                                        #       Child Loop BB6_61 Depth 3
	movl	%edi, %r8d
	movl	%edx, %r9d
	movl	24(%rsp), %ecx                  # 4-byte Reload
	movl	%ecx, %r10d
	cmpl	4(%rsp), %ecx                   # 4-byte Folded Reload
	jge	.LBB6_35
.LBB6_60:                               # %.preheader235
                                        #   Parent Loop BB6_34 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB6_61 Depth 3
	movq	%r14, %r11
	movl	%r8d, %ebp
	movl	%r9d, %ecx
	testl	%r14d, %r14d
	jle	.LBB6_59
.LBB6_61:                               #   Parent Loop BB6_34 Depth=1
                                        #     Parent Loop BB6_60 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movslq	%ebp, %rbp
	movsd	(%r15,%rbp,8), %xmm0            # xmm0 = mem[0],zero
	movslq	%ecx, %rcx
	movsd	%xmm0, (%r15,%rcx,8)
	incl	%ecx
	incl	%ebp
	decq	%r11
	jne	.LBB6_61
.LBB6_59:                               # %.loopexit
                                        #   in Loop: Header=BB6_60 Depth=2
	incl	%r10d
	addl	%r13d, %r9d
	subl	%r13d, %r8d
	cmpl	4(%rsp), %r10d                  # 4-byte Folded Reload
	jne	.LBB6_60
.LBB6_35:                               # %._crit_edge276
                                        #   in Loop: Header=BB6_34 Depth=1
	incl	%eax
	addl	%esi, %edx
	subl	%esi, %edi
	cmpl	%r13d, %eax
	jne	.LBB6_34
.LBB6_36:                               # %.preheader234
	testl	%ebx, %ebx
	jle	.LBB6_52
# %bb.37:                               # %.preheader233.lr.ph
	leal	1(%r14), %eax
	movslq	%eax, %rdx
	movl	4(%rsp), %esi                   # 4-byte Reload
	cmpl	$2, %esi
	movl	$1, %ecx
	cmovgel	%esi, %ecx
	movl	$1, %esi
	cmpl	$2, %r13d
	cmovgel	%r13d, %esi
	movl	%esi, 60(%rsp)                  # 4-byte Spill
	leaq	(%r15,%rdx,8), %rsi
	movq	8(%rsp), %rdx                   # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	imull	%ebx, %edx
	shll	$2, %edx
	movl	%edx, 56(%rsp)                  # 4-byte Spill
	leal	-1(%r14), %r8d
	xorl	%edx, %edx
	movq	%rdx, 24(%rsp)                  # 8-byte Spill
	movl	%r8d, %edx
	movl	%r8d, 40(%rsp)                  # 4-byte Spill
	xorl	%r11d, %r11d
.LBB6_38:                               # %.preheader233
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_40 Depth 2
                                        #       Child Loop BB6_42 Depth 3
	cmpl	$0, 8(%rsp)                     # 4-byte Folded Reload
	jle	.LBB6_44
# %bb.39:                               # %.preheader232.lr.ph
                                        #   in Loop: Header=BB6_38 Depth=1
	movl	40(%rsp), %r10d                 # 4-byte Reload
	movq	24(%rsp), %rdx                  # 8-byte Reload
	movl	%edx, %edi
	xorl	%ebp, %ebp
.LBB6_40:                               # %.preheader232
                                        #   Parent Loop BB6_38 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB6_42 Depth 3
	cmpl	20(%rsp), %eax                  # 4-byte Folded Reload
	jge	.LBB6_43
# %bb.41:                               # %.lr.ph280
                                        #   in Loop: Header=BB6_40 Depth=2
	movslq	%edi, %rdx
	leaq	(%rsi,%rdx,8), %rbx
	movl	%r10d, %r9d
	xorl	%edx, %edx
.LBB6_42:                               #   Parent Loop BB6_38 Depth=1
                                        #     Parent Loop BB6_40 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movslq	%r9d, %r9
	movsd	(%r15,%r9,8), %xmm0             # xmm0 = mem[0],zero
	movsd	%xmm0, (%rbx,%rdx,8)
	incq	%rdx
	decl	%r9d
	cmpl	%edx, %r8d
	jne	.LBB6_42
.LBB6_43:                               # %._crit_edge281
                                        #   in Loop: Header=BB6_40 Depth=2
	incq	%rbp
	addl	%r13d, %edi
	addl	%r13d, %r10d
	cmpq	%rcx, %rbp
	jne	.LBB6_40
.LBB6_44:                               # %._crit_edge283
                                        #   in Loop: Header=BB6_38 Depth=1
	incl	%r11d
	movl	56(%rsp), %edx                  # 4-byte Reload
	movq	24(%rsp), %rdi                  # 8-byte Reload
	addl	%edx, %edi
	movq	%rdi, 24(%rsp)                  # 8-byte Spill
	addl	%edx, 40(%rsp)                  # 4-byte Folded Spill
	cmpl	60(%rsp), %r11d                 # 4-byte Folded Reload
	jne	.LBB6_38
# %bb.45:                               # %.preheader231
	movq	32(%rsp), %rdi                  # 8-byte Reload
	testl	%edi, %edi
	jle	.LBB6_52
# %bb.46:                               # %.preheader230.lr.ph
	movl	20(%rsp), %edx                  # 4-byte Reload
	cmpl	$2, %edx
	movl	$1, %eax
	movl	$1, %ecx
	cmovgel	%edx, %ecx
	movl	4(%rsp), %esi                   # 4-byte Reload
	cmpl	$2, %esi
	movl	$1, %edx
	cmovgel	%esi, %edx
	cmpl	$2, %r13d
	cmovgel	%r13d, %eax
	movq	8(%rsp), %rsi                   # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	imull	%edi, %esi
	shll	$2, %esi
	xorl	%edi, %edi
	xorpd	%xmm0, %xmm0
	xorl	%r8d, %r8d
.LBB6_47:                               # %.preheader230
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_49 Depth 2
                                        #       Child Loop BB6_66 Depth 3
	cmpl	$0, 8(%rsp)                     # 4-byte Folded Reload
	jle	.LBB6_51
# %bb.48:                               # %.preheader.lr.ph
                                        #   in Loop: Header=BB6_47 Depth=1
	xorl	%r9d, %r9d
	movl	%edi, %r10d
.LBB6_49:                               # %.preheader
                                        #   Parent Loop BB6_47 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB6_66 Depth 3
	movq	%rcx, %r11
	movl	%r10d, %ebp
	testl	%r14d, %r14d
	jle	.LBB6_50
.LBB6_66:                               #   Parent Loop BB6_47 Depth=1
                                        #     Parent Loop BB6_49 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movslq	%ebp, %rbp
	movq	%rbp, %rbx
	shlq	$4, %rbx
	movq	$0, 8(%r12,%rbx)
	movsd	(%r15,%rbp,8), %xmm1            # xmm1 = mem[0],zero
	addsd	%xmm0, %xmm1
	movsd	%xmm1, (%r12,%rbx)
	incl	%ebp
	decq	%r11
	jne	.LBB6_66
.LBB6_50:                               # %._crit_edge287
                                        #   in Loop: Header=BB6_49 Depth=2
	incl	%r9d
	addl	%r13d, %r10d
	cmpl	%edx, %r9d
	jne	.LBB6_49
.LBB6_51:                               # %._crit_edge289
                                        #   in Loop: Header=BB6_47 Depth=1
	incl	%r8d
	addl	%esi, %edi
	cmpl	%eax, %r8d
	jne	.LBB6_47
.LBB6_52:                               # %._crit_edge291
	leaq	48(%rsp), %rbx
	movq	%rbx, %rdi
	movq	80(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rsi
	callq	hipMalloc
	movq	(%rbx), %rdi
	movq	%r12, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	64(%rsp), %rdi
	movl	%r13d, %esi
	movl	4(%rsp), %edx                   # 4-byte Reload
	movl	20(%rsp), %ecx                  # 4-byte Reload
	movl	$105, %r8d
	callq	hipfftPlan3d
	testl	%eax, %eax
	jne	.LBB6_53
# %bb.62:
	movq	64(%rsp), %rdi
	movq	48(%rsp), %rdx
	movq	%rdx, %rsi
	movl	$-1, %ecx
	callq	hipfftExecZ2Z
	testl	%eax, %eax
	jne	.LBB6_63
# %bb.64:
	movq	48(%rsp), %rsi
	movq	72(%rsp), %rdi                  # 8-byte Reload
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	callq	hipDeviceSynchronize
	movq	64(%rsp), %rdi
	callq	hipfftDestroy
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	%r12, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB6_53:
	.cfi_def_cfa_offset 144
	movl	$.Lstr.9, %edi
	jmp	.LBB6_54
.LBB6_63:
	movl	$.Lstr.8, %edi
.LBB6_54:
	callq	puts@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end6:
	.size	_Z17calculateGreenFFTP6grid3DPSt7complexIdE, .Lfunc_end6-_Z17calculateGreenFFTP6grid3DPSt7complexIdE
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z6WeightP6grid3DP10particle3Di
.LCPI7_0:
	.quad	0xbfe0000000000000              # double -0.5
.LCPI7_1:
	.quad	0x3fe0000000000000              # double 0.5
.LCPI7_3:
	.quad	0x3fe8000000000000              # double 0.75
.LCPI7_4:
	.quad	0x4008000000000000              # double 3
.LCPI7_5:
	.quad	0x3ff8000000000000              # double 1.5
.LCPI7_6:
	.quad	0x3ff0000000000000              # double 1
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI7_2:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.text
	.globl	_Z6WeightP6grid3DP10particle3Di
	.type	_Z6WeightP6grid3DP10particle3Di,@function
_Z6WeightP6grid3DP10particle3Di:        # @_Z6WeightP6grid3DP10particle3Di
	.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	$136, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebx
	movq	%rsi, %r13
	movq	%rdi, %r15
	movl	20(%rdi), %edx
	testl	%edx, %edx
	jle	.LBB7_2
# %bb.1:                                # %.lr.ph
	movq	56(%r15), %rdi
	shlq	$3, %rdx
	xorl	%esi, %esi
	callq	memset@PLT
.LBB7_2:                                # %.preheader230
	movl	(%r13), %r11d
	testl	%r11d, %r11d
	jle	.LBB7_40
# %bb.3:                                # %.lr.ph241
	movq	24(%r13), %rdi
	movq	32(%r13), %r8
	movsd	.LCPI7_1(%rip), %xmm7           # xmm7 = mem[0],zero
	movsd	.LCPI7_6(%rip), %xmm8           # xmm8 = mem[0],zero
	movapd	.LCPI7_2(%rip), %xmm9           # xmm9 = [NaN,NaN]
	movsd	.LCPI7_4(%rip), %xmm10          # xmm10 = mem[0],zero
	movsd	.LCPI7_5(%rip), %xmm11          # xmm11 = mem[0],zero
	movsd	.LCPI7_3(%rip), %xmm12          # xmm12 = mem[0],zero
	movapd	.LCPI7_2(%rip), %xmm13          # xmm13 = [NaN,NaN]
	xorl	%r12d, %r12d
	movl	%ebx, 20(%rsp)                  # 4-byte Spill
	movq	%r13, 40(%rsp)                  # 8-byte Spill
.LBB7_4:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB7_8 Depth 2
                                        #       Child Loop BB7_9 Depth 3
                                        #     Child Loop BB7_13 Depth 2
                                        #     Child Loop BB7_20 Depth 2
                                        #     Child Loop BB7_26 Depth 2
                                        #     Child Loop BB7_32 Depth 2
                                        #       Child Loop BB7_33 Depth 3
                                        #         Child Loop BB7_34 Depth 4
	movsd	24(%r15), %xmm2                 # xmm2 = mem[0],zero
	movsd	(%r15), %xmm14                  # xmm14 = mem[0],zero
	mulsd	.LCPI7_0(%rip), %xmm14
	movq	16(%r13), %r9
	movsd	(%r9,%r12,8), %xmm3             # xmm3 = mem[0],zero
	subsd	%xmm14, %xmm3
	movapd	%xmm3, %xmm0
	divsd	%xmm2, %xmm0
	cvttsd2si	%xmm0, %ecx
	movsd	(%rdi,%r12,8), %xmm0            # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	movsd	32(%r15), %xmm1                 # xmm1 = mem[0],zero
	movapd	%xmm0, %xmm6
	divsd	%xmm1, %xmm0
	cvttsd2si	%xmm0, %edx
	movsd	(%r8,%r12,8), %xmm4             # xmm4 = mem[0],zero
	subsd	%xmm14, %xmm4
	movsd	40(%r15), %xmm0                 # xmm0 = mem[0],zero
	movapd	%xmm4, %xmm5
	divsd	%xmm0, %xmm4
	cvttsd2si	%xmm4, %eax
	movl	%eax, 24(%rsp)                  # 4-byte Spill
	testl	%ebx, %ebx
	je	.LBB7_38
# %bb.5:                                #   in Loop: Header=BB7_4 Depth=1
	cmpl	$2, %ebx
	je	.LBB7_12
# %bb.6:                                #   in Loop: Header=BB7_4 Depth=1
	cmpl	$1, %ebx
	jne	.LBB7_39
# %bb.7:                                # %.preheader226
                                        #   in Loop: Header=BB7_4 Depth=1
	movl	%r11d, (%rsp)                   # 4-byte Spill
	movq	8(%r13), %r10
	movq	56(%r15), %r11
	movl	8(%r15), %ebp
	movl	12(%r15), %r13d
	xorl	%ebx, %ebx
	movb	$1, %al
.LBB7_8:                                # %.preheader224
                                        #   Parent Loop BB7_4 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB7_9 Depth 3
	movl	%eax, 8(%rsp)                   # 4-byte Spill
	addl	24(%rsp), %ebx                  # 4-byte Folded Reload
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ebx, %xmm0
	xorl	%esi, %esi
.LBB7_9:                                #   Parent Loop BB7_4 Depth=1
                                        #     Parent Loop BB7_8 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	%esi, %r14d
	shrl	%r14d
	movl	%esi, %eax
	andl	$1, %eax
	movsd	(%r9,%r12,8), %xmm1             # xmm1 = mem[0],zero
	addl	%ecx, %r14d
	xorps	%xmm2, %xmm2
	cvtsi2sd	%r14d, %xmm2
	movsd	24(%r15), %xmm3                 # xmm3 = mem[0],zero
	subsd	%xmm14, %xmm1
	movsd	32(%r15), %xmm4                 # xmm4 = mem[0],zero
	mulsd	%xmm3, %xmm2
	movapd	%xmm8, %xmm5
	subsd	%xmm2, %xmm1
	movsd	(%rdi,%r12,8), %xmm2            # xmm2 = mem[0],zero
	subsd	%xmm14, %xmm2
	addl	%edx, %eax
	andpd	%xmm13, %xmm1
	xorps	%xmm6, %xmm6
	cvtsi2sd	%eax, %xmm6
	mulsd	%xmm4, %xmm6
	divsd	%xmm3, %xmm1
	subsd	%xmm6, %xmm2
	andpd	%xmm13, %xmm2
	divsd	%xmm4, %xmm2
	subsd	%xmm1, %xmm5
	movapd	%xmm8, %xmm1
	movsd	(%r8,%r12,8), %xmm3             # xmm3 = mem[0],zero
	subsd	%xmm14, %xmm3
	subsd	%xmm2, %xmm1
	movsd	40(%r15), %xmm2                 # xmm2 = mem[0],zero
	movapd	%xmm2, %xmm4
	mulsd	%xmm0, %xmm4
	mulsd	%xmm5, %xmm1
	subsd	%xmm4, %xmm3
	andpd	%xmm13, %xmm3
	divsd	%xmm2, %xmm3
	movapd	%xmm8, %xmm2
	subsd	%xmm3, %xmm2
	mulsd	%xmm1, %xmm2
	mulsd	(%r10,%r12,8), %xmm2
	imull	%r13d, %r14d
	addl	%eax, %r14d
	imull	%ebp, %r14d
	addl	%ebx, %r14d
	movslq	%r14d, %rax
	addsd	(%r11,%rax,8), %xmm2
	movsd	%xmm2, (%r11,%rax,8)
	incl	%esi
	cmpl	$4, %esi
	jne	.LBB7_9
# %bb.10:                               #   in Loop: Header=BB7_8 Depth=2
	movl	$1, %ebx
	testb	$1, 8(%rsp)                     # 1-byte Folded Reload
	movl	$0, %eax
	jne	.LBB7_8
# %bb.11:                               #   in Loop: Header=BB7_4 Depth=1
	movl	20(%rsp), %ebx                  # 4-byte Reload
	movq	40(%rsp), %r13                  # 8-byte Reload
	movl	(%rsp), %r11d                   # 4-byte Reload
	jmp	.LBB7_39
.LBB7_12:                               #   in Loop: Header=BB7_4 Depth=1
	movapd	%xmm2, %xmm4
	mulsd	%xmm7, %xmm4
	addsd	%xmm4, %xmm3
	divsd	%xmm2, %xmm3
	cvttsd2si	%xmm3, %ecx
	movapd	%xmm1, %xmm2
	mulsd	%xmm7, %xmm2
	addsd	%xmm2, %xmm6
	divsd	%xmm1, %xmm6
	movsd	%xmm6, (%rsp)                   # 8-byte Spill
	movapd	%xmm0, %xmm1
	mulsd	%xmm7, %xmm1
	addsd	%xmm1, %xmm5
	divsd	%xmm0, %xmm5
	movsd	%xmm5, 8(%rsp)                  # 8-byte Spill
	movq	%rcx, %rax
	movq	%rcx, 24(%rsp)                  # 8-byte Spill
	leal	-1(%rcx), %ebx
	xorl	%r14d, %r14d
	movsd	%xmm14, 32(%rsp)                # 8-byte Spill
.LBB7_13:                               #   Parent Loop BB7_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	16(%r13), %rax
	movsd	(%rax,%r12,8), %xmm0            # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	leal	(%rbx,%r14), %eax
	xorps	%xmm2, %xmm2
	cvtsi2sd	%eax, %xmm2
	movsd	24(%r15), %xmm1                 # xmm1 = mem[0],zero
	mulsd	%xmm1, %xmm2
	subsd	%xmm2, %xmm0
	andpd	%xmm9, %xmm0
	movapd	%xmm1, %xmm2
	mulsd	%xmm7, %xmm2
	ucomisd	%xmm0, %xmm2
	jae	.LBB7_14
# %bb.15:                               #   in Loop: Header=BB7_13 Depth=2
	mulsd	%xmm10, %xmm2
	ucomisd	%xmm0, %xmm2
	jae	.LBB7_16
# %bb.17:                               #   in Loop: Header=BB7_13 Depth=2
	movl	$.L.str.12, %edi
	xorl	%eax, %eax
	callq	printf
	movsd	32(%rsp), %xmm14                # 8-byte Reload
                                        # xmm14 = mem[0],zero
	movapd	.LCPI7_2(%rip), %xmm13          # xmm13 = [NaN,NaN]
	movsd	.LCPI7_3(%rip), %xmm12          # xmm12 = mem[0],zero
	movsd	.LCPI7_5(%rip), %xmm11          # xmm11 = mem[0],zero
	movsd	.LCPI7_4(%rip), %xmm10          # xmm10 = mem[0],zero
	movapd	.LCPI7_2(%rip), %xmm9           # xmm9 = [NaN,NaN]
	movsd	.LCPI7_6(%rip), %xmm8           # xmm8 = mem[0],zero
	movsd	.LCPI7_1(%rip), %xmm7           # xmm7 = mem[0],zero
	xorpd	%xmm1, %xmm1
	jmp	.LBB7_18
.LBB7_14:                               #   in Loop: Header=BB7_13 Depth=2
	divsd	%xmm1, %xmm0
	mulsd	%xmm0, %xmm0
	movapd	%xmm12, %xmm1
	subsd	%xmm0, %xmm1
	jmp	.LBB7_18
.LBB7_16:                               #   in Loop: Header=BB7_13 Depth=2
	divsd	%xmm1, %xmm0
	movapd	%xmm11, %xmm1
	subsd	%xmm0, %xmm1
	mulsd	%xmm1, %xmm1
	mulsd	%xmm7, %xmm1
.LBB7_18:                               #   in Loop: Header=BB7_13 Depth=2
	movsd	%xmm1, 112(%rsp,%r14,8)
	incq	%r14
	cmpq	$3, %r14
	jne	.LBB7_13
# %bb.19:                               # %.preheader229
                                        #   in Loop: Header=BB7_4 Depth=1
	cvttsd2si	(%rsp), %r9d            # 8-byte Folded Reload
	movq	24(%r13), %rdi
	movsd	(%rdi,%r12,8), %xmm0            # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	movsd	32(%r15), %xmm1                 # xmm1 = mem[0],zero
	movapd	%xmm1, %xmm2
	mulsd	%xmm7, %xmm2
	movapd	%xmm2, %xmm3
	mulsd	%xmm10, %xmm3
	leal	-1(%r9), %eax
	xorl	%ecx, %ecx
.LBB7_20:                               #   Parent Loop BB7_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leal	(%rax,%rcx), %edx
	xorps	%xmm5, %xmm5
	cvtsi2sd	%edx, %xmm5
	mulsd	%xmm1, %xmm5
	movapd	%xmm0, %xmm4
	subsd	%xmm5, %xmm4
	andpd	%xmm9, %xmm4
	ucomisd	%xmm4, %xmm2
	jae	.LBB7_21
# %bb.22:                               #   in Loop: Header=BB7_20 Depth=2
	xorpd	%xmm5, %xmm5
	ucomisd	%xmm4, %xmm3
	jb	.LBB7_24
# %bb.23:                               #   in Loop: Header=BB7_20 Depth=2
	divsd	%xmm1, %xmm4
	movapd	%xmm11, %xmm5
	subsd	%xmm4, %xmm5
	mulsd	%xmm5, %xmm5
	mulsd	%xmm7, %xmm5
	jmp	.LBB7_24
.LBB7_21:                               #   in Loop: Header=BB7_20 Depth=2
	divsd	%xmm1, %xmm4
	mulsd	%xmm4, %xmm4
	movapd	%xmm12, %xmm5
	subsd	%xmm4, %xmm5
.LBB7_24:                               #   in Loop: Header=BB7_20 Depth=2
	movsd	%xmm5, 80(%rsp,%rcx,8)
	incq	%rcx
	cmpq	$3, %rcx
	jne	.LBB7_20
# %bb.25:                               # %.preheader228
                                        #   in Loop: Header=BB7_4 Depth=1
	cvttsd2si	8(%rsp), %eax           # 8-byte Folded Reload
	movq	32(%r13), %r8
	movsd	(%r8,%r12,8), %xmm0             # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	movsd	40(%r15), %xmm1                 # xmm1 = mem[0],zero
	movapd	%xmm1, %xmm2
	mulsd	%xmm7, %xmm2
	movapd	%xmm2, %xmm3
	mulsd	%xmm10, %xmm3
	leal	-1(%rax), %ecx
	xorl	%edx, %edx
.LBB7_26:                               #   Parent Loop BB7_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leal	(%rcx,%rdx), %esi
	xorps	%xmm5, %xmm5
	cvtsi2sd	%esi, %xmm5
	mulsd	%xmm1, %xmm5
	movapd	%xmm0, %xmm4
	subsd	%xmm5, %xmm4
	andpd	%xmm9, %xmm4
	ucomisd	%xmm4, %xmm2
	jae	.LBB7_27
# %bb.28:                               #   in Loop: Header=BB7_26 Depth=2
	xorpd	%xmm5, %xmm5
	ucomisd	%xmm4, %xmm3
	jb	.LBB7_30
# %bb.29:                               #   in Loop: Header=BB7_26 Depth=2
	divsd	%xmm1, %xmm4
	movapd	%xmm11, %xmm5
	subsd	%xmm4, %xmm5
	mulsd	%xmm5, %xmm5
	mulsd	%xmm7, %xmm5
	jmp	.LBB7_30
.LBB7_27:                               #   in Loop: Header=BB7_26 Depth=2
	divsd	%xmm1, %xmm4
	mulsd	%xmm4, %xmm4
	movapd	%xmm12, %xmm5
	subsd	%xmm4, %xmm5
.LBB7_30:                               #   in Loop: Header=BB7_26 Depth=2
	movsd	%xmm5, 48(%rsp,%rdx,8)
	incq	%rdx
	cmpq	$3, %rdx
	jne	.LBB7_26
# %bb.31:                               # %.preheader227
                                        #   in Loop: Header=BB7_4 Depth=1
	movq	%r8, (%rsp)                     # 8-byte Spill
	movq	%rdi, 32(%rsp)                  # 8-byte Spill
	movl	8(%r15), %r10d
	movl	12(%r15), %r11d
	movl	16(%r15), %ebx
	movq	8(%r13), %rbp
	movq	56(%r15), %r14
	leal	(%rax,%rbx), %r13d
	decl	%r13d
	movq	$-1, %rsi
.LBB7_32:                               # %.preheader225
                                        #   Parent Loop BB7_4 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB7_33 Depth 3
                                        #         Child Loop BB7_34 Depth 4
	movq	24(%rsp), %rax                  # 8-byte Reload
	addl	%esi, %eax
	addl	%r10d, %eax
	cltd
	idivl	%r10d
	movl	%edx, %ecx
	imull	%r11d, %ecx
	movsd	120(%rsp,%rsi,8), %xmm0         # xmm0 = mem[0],zero
	incq	%rsi
	movq	%rsi, 8(%rsp)                   # 8-byte Spill
	movq	$-1, %rdi
.LBB7_33:                               # %.preheader
                                        #   Parent Loop BB7_4 Depth=1
                                        #     Parent Loop BB7_32 Depth=2
                                        # =>    This Loop Header: Depth=3
                                        #         Child Loop BB7_34 Depth 4
	leal	(%rdi,%r9), %eax
	addl	%r11d, %eax
	cltd
	idivl	%r11d
	movl	%edx, %esi
	addl	%ecx, %esi
	imull	%r10d, %esi
	movsd	88(%rsp,%rdi,8), %xmm1          # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	incq	%rdi
	xorl	%r8d, %r8d
.LBB7_34:                               #   Parent Loop BB7_4 Depth=1
                                        #     Parent Loop BB7_32 Depth=2
                                        #       Parent Loop BB7_33 Depth=3
                                        # =>      This Inner Loop Header: Depth=4
	leal	(%r8,%r13), %eax
	cltd
	idivl	%ebx
	movsd	48(%rsp,%r8,8), %xmm2           # xmm2 = mem[0],zero
	mulsd	%xmm1, %xmm2
	mulsd	(%rbp,%r12,8), %xmm2
	addl	%esi, %edx
	movslq	%edx, %rax
	addsd	(%r14,%rax,8), %xmm2
	movsd	%xmm2, (%r14,%rax,8)
	incq	%r8
	cmpq	$3, %r8
	jne	.LBB7_34
# %bb.35:                               #   in Loop: Header=BB7_33 Depth=3
	cmpq	$2, %rdi
	jne	.LBB7_33
# %bb.36:                               #   in Loop: Header=BB7_32 Depth=2
	movq	8(%rsp), %rsi                   # 8-byte Reload
	cmpq	$2, %rsi
	jne	.LBB7_32
# %bb.37:                               #   in Loop: Header=BB7_4 Depth=1
	movq	40(%rsp), %r13                  # 8-byte Reload
	movl	(%r13), %r11d
	movl	20(%rsp), %ebx                  # 4-byte Reload
	movq	32(%rsp), %rdi                  # 8-byte Reload
	movq	(%rsp), %r8                     # 8-byte Reload
	jmp	.LBB7_39
.LBB7_38:                               #   in Loop: Header=BB7_4 Depth=1
	xorps	%xmm4, %xmm4
	cvtsi2sd	%ecx, %xmm4
	mulsd	%xmm2, %xmm4
	subsd	%xmm4, %xmm3
	mulsd	%xmm7, %xmm2
	subsd	%xmm2, %xmm3
	addsd	%xmm8, %xmm3
	cvttsd2si	%xmm3, %eax
	xorps	%xmm2, %xmm2
	cvtsi2sd	%edx, %xmm2
	mulsd	%xmm1, %xmm2
	subsd	%xmm2, %xmm6
	mulsd	%xmm7, %xmm1
	subsd	%xmm1, %xmm6
	addsd	%xmm8, %xmm6
	cvttsd2si	%xmm6, %esi
	movl	24(%rsp), %ebp                  # 4-byte Reload
	xorps	%xmm1, %xmm1
	cvtsi2sd	%ebp, %xmm1
	mulsd	%xmm0, %xmm1
	subsd	%xmm1, %xmm5
	mulsd	%xmm7, %xmm0
	subsd	%xmm0, %xmm5
	addsd	%xmm8, %xmm5
	movq	%rdi, %r9
	cvttsd2si	%xmm5, %edi
	movq	%r8, %r10
	movq	8(%r13), %r8
	movsd	(%r8,%r12,8), %xmm0             # xmm0 = mem[0],zero
	movq	56(%r15), %r8
	addl	%ecx, %eax
	imull	12(%r15), %eax
	addl	%edx, %esi
	addl	%eax, %esi
	addl	%ebp, %edi
	imull	8(%r15), %esi
	addl	%edi, %esi
	movq	%r9, %rdi
	movslq	%esi, %rax
	addsd	(%r8,%rax,8), %xmm0
	movsd	%xmm0, (%r8,%rax,8)
	movq	%r10, %r8
.LBB7_39:                               # %.loopexit
                                        #   in Loop: Header=BB7_4 Depth=1
	incq	%r12
	movslq	%r11d, %rax
	cmpq	%rax, %r12
	jl	.LBB7_4
.LBB7_40:                               # %._crit_edge
	addq	$136, %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_end7:
	.size	_Z6WeightP6grid3DP10particle3Di, .Lfunc_end7-_Z6WeightP6grid3DP10particle3Di
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z27poisson_solver_fft_force_3diP6grid3D
.LCPI8_0:
	.quad	0xbfd45f306dc9c883              # double -0.31830988618379069
	.text
	.globl	_Z27poisson_solver_fft_force_3diP6grid3D
	.type	_Z27poisson_solver_fft_force_3diP6grid3D,@function
_Z27poisson_solver_fft_force_3diP6grid3D: # @_Z27poisson_solver_fft_force_3diP6grid3D
	.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	$120, %rsp
	.cfi_def_cfa_offset 176
	.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, %r13
	movslq	8(%rsi), %rbx
	movq	%rbx, 8(%rsp)                   # 8-byte Spill
	movslq	12(%rsi), %rax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	movslq	16(%rsi), %r15
	movl	%r15d, %ebp
	shrl	$31, %ebp
	addl	%r15d, %ebp
	sarl	%ebp
	incl	%ebp
	imulq	%rax, %rbx
	movq	%r15, %r12
	imulq	%rbx, %r12
	shlq	$3, %r12
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 104(%rsp)                 # 8-byte Spill
	movslq	%ebp, %r14
	imulq	%rbx, %r14
	shlq	$4, %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 112(%rsp)                 # 8-byte Spill
	leaq	24(%rsp), %rbx
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	leaq	16(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	movq	(%rbx), %rdi
	movq	%r13, 96(%rsp)                  # 8-byte Spill
	movq	56(%r13), %rsi
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	88(%rsp), %rdi
	movq	8(%rsp), %rsi                   # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	movq	32(%rsp), %rdx                  # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	movl	%r15d, %ecx
	movl	$106, %r8d
	callq	hipfftPlan3d
	testl	%eax, %eax
	jne	.LBB8_1
# %bb.3:
	movq	88(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
	callq	hipfftExecD2Z
	testl	%eax, %eax
	jne	.LBB8_4
# %bb.5:
	movq	16(%rsp), %rsi
	movq	112(%rsp), %r13                 # 8-byte Reload
	movq	%r13, %rdi
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	callq	hipDeviceSynchronize
	movq	88(%rsp), %rdi
	callq	hipfftDestroy
	leaq	64(%rsp), %rbx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	movq	(%rbx), %rdi
	movq	%r13, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movabsq	$4294967424, %rdi               # imm = 0x100000080
	movl	$1, %esi
	movq	%rdi, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB8_7
# %bb.6:
	movq	64(%rsp), %rdi
	movq	8(%rsp), %rsi                   # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	movq	32(%rsp), %rdx                  # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	movl	%ebp, %ecx
	callq	_Z21__device_stub__overk2Pdiii
.LBB8_7:
	movq	64(%rsp), %rsi
	movq	%r13, %rdi
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	64(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	movq	%r13, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	80(%rsp), %rdi
	movq	8(%rsp), %rsi                   # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	movq	32(%rsp), %rdx                  # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	movl	%r15d, %ecx
	movl	$108, %r8d
	callq	hipfftPlan3d
	testl	%eax, %eax
	jne	.LBB8_8
# %bb.9:
	movq	%r13, %rbp
	movq	80(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdx
	callq	hipfftExecZ2D
	testl	%eax, %eax
	movq	104(%rsp), %r13                 # 8-byte Reload
	jne	.LBB8_10
# %bb.11:
	movq	24(%rsp), %rsi
	movq	%r13, %rdi
	movq	%r12, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	callq	hipDeviceSynchronize
	movq	80(%rsp), %rdi
	callq	hipfftDestroy
	movq	96(%rsp), %r15                  # 8-byte Reload
	movsd	(%r15), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	20(%r15), %eax
	shll	$3, %eax
	movslq	%eax, %rbx
	leaq	72(%rsp), %r14
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	leaq	56(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	leaq	48(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	leaq	40(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	movq	(%r14), %rdi
	movq	%r13, %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movabsq	$4294967424, %rdi               # imm = 0x100000080
	movl	$1, %esi
	movq	%rdi, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB8_13
# %bb.12:
	movsd	.LCPI8_0(%rip), %xmm1           # xmm1 = mem[0],zero
	divsd	8(%rsp), %xmm1                  # 8-byte Folded Reload
	movq	72(%rsp), %rdi
	movq	56(%rsp), %rsi
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rcx
	movl	8(%r15), %r8d
	movsd	(%r15), %xmm0                   # xmm0 = mem[0],zero
	callq	_Z25__device_stub__phiToForcePdS_S_S_idd
.LBB8_13:
	callq	hipDeviceSynchronize
	movq	64(%r15), %rdi
	movq	56(%rsp), %rsi
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	72(%r15), %rdi
	movq	48(%rsp), %rsi
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	80(%r15), %rdi
	movq	40(%rsp), %rsi
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	72(%rsp), %rdi
	callq	hipFree
	movq	56(%rsp), %rdi
	callq	hipFree
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	40(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	%r13, %rdi
	callq	free
	movq	%rbp, %rdi
	callq	free
	addq	$120, %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
.LBB8_1:
	.cfi_def_cfa_offset 176
	movl	$.Lstr.5, %edi
	jmp	.LBB8_2
.LBB8_4:
	movl	$.Lstr.4, %edi
	jmp	.LBB8_2
.LBB8_8:
	movl	$.Lstr.9, %edi
	jmp	.LBB8_2
.LBB8_10:
	movl	$.Lstr.2, %edi
.LBB8_2:
	callq	puts@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end8:
	.size	_Z27poisson_solver_fft_force_3diP6grid3D, .Lfunc_end8-_Z27poisson_solver_fft_force_3diP6grid3D
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z17isolatedPotentialP6grid3DPSt7complexIdE
.LCPI9_0:
	.quad	0xbff0000000000000              # double -1
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI9_1:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.text
	.globl	_Z17isolatedPotentialP6grid3DPSt7complexIdE
	.type	_Z17isolatedPotentialP6grid3DPSt7complexIdE,@function
_Z17isolatedPotentialP6grid3DPSt7complexIdE: # @_Z17isolatedPotentialP6grid3DPSt7complexIdE
	.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	$200, %rsp
	.cfi_def_cfa_offset 256
	.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, 192(%rsp)                 # 8-byte Spill
	movq	%rdi, %rbp
	movslq	20(%rdi), %r14
	movl	8(%rdi), %ebx
	movl	12(%rdi), %r15d
	movslq	16(%rdi), %r13
	leal	(%rbx,%rbx), %eax
	movl	%eax, (%rsp)                    # 4-byte Spill
	leal	(%r15,%r15), %eax
	movl	%eax, 4(%rsp)                   # 4-byte Spill
	leal	(,%r13,2), %eax
	movl	%eax, 20(%rsp)                  # 4-byte Spill
	movq	%r14, %rdi
	shlq	$6, %rdi
	callq	malloc
	movq	%rax, %r12
	movq	%r14, 160(%rsp)                 # 8-byte Spill
	shlq	$7, %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	movq	%r14, 144(%rsp)                 # 8-byte Spill
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 80(%rsp)                  # 8-byte Spill
	movq	%rbx, 8(%rsp)                   # 8-byte Spill
	testl	%ebx, %ebx
	movq	%r15, 64(%rsp)                  # 8-byte Spill
	jle	.LBB9_15
# %bb.1:                                # %.preheader192.lr.ph
	movq	%r12, %rsi
	movl	20(%rsp), %ecx                  # 4-byte Reload
	cmpl	$2, %ecx
	movl	$1, %eax
	cmovgel	%ecx, %eax
	movl	4(%rsp), %edx                   # 4-byte Reload
	cmpl	$2, %edx
	movl	$1, %ecx
	cmovgel	%edx, %ecx
	movl	$1, %edi
	movl	(%rsp), %edx                    # 4-byte Reload
	cmpl	$2, %edx
	cmovgel	%edx, %edi
	movl	%edi, 24(%rsp)                  # 4-byte Spill
	movl	%r15d, %edx
	imull	8(%rsp), %edx                   # 4-byte Folded Reload
	movq	%rdx, 40(%rsp)                  # 8-byte Spill
	xorl	%edi, %edi
	xorl	%r8d, %r8d
.LBB9_2:                                # %.preheader192
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_4 Depth 2
                                        #       Child Loop BB9_6 Depth 3
	testl	%r15d, %r15d
	jle	.LBB9_19
# %bb.3:                                # %.preheader191.lr.ph
                                        #   in Loop: Header=BB9_2 Depth=1
	movl	%r8d, %r9d
	imull	4(%rsp), %r9d                   # 4-byte Folded Reload
	xorl	%r10d, %r10d
	movq	%rdi, %r11
.LBB9_4:                                # %.preheader191
                                        #   Parent Loop BB9_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB9_6 Depth 3
	testl	%r13d, %r13d
	jle	.LBB9_18
# %bb.5:                                # %.lr.ph
                                        #   in Loop: Header=BB9_4 Depth=2
	cmpl	8(%rsp), %r8d                   # 4-byte Folded Reload
	setl	%bl
	cmpl	64(%rsp), %r10d                 # 4-byte Folded Reload
	setl	%dl
	andb	%bl, %dl
	leal	(%r10,%r9), %r15d
	imull	(%rsp), %r15d                   # 4-byte Folded Reload
	xorl	%r12d, %r12d
.LBB9_6:                                #   Parent Loop BB9_2 Depth=1
                                        #     Parent Loop BB9_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	cmpq	%r13, %r12
	setl	%bl
	andb	%dl, %bl
	cmpb	$1, %bl
	jne	.LBB9_20
# %bb.7:                                #   in Loop: Header=BB9_6 Depth=3
	movq	56(%rbp), %rbx
	leal	(%r11,%r12), %r14d
	movslq	%r14d, %r14
	movsd	(%rbx,%r14,8), %xmm0            # xmm0 = mem[0],zero
	jmp	.LBB9_21
.LBB9_20:                               #   in Loop: Header=BB9_6 Depth=3
	xorpd	%xmm0, %xmm0
.LBB9_21:                               #   in Loop: Header=BB9_6 Depth=3
	movl	%r12d, %ebx
	addl	%r15d, %ebx
	movslq	%ebx, %rbx
	movsd	%xmm0, (%rsi,%rbx,8)
	incq	%r12
	cmpq	%r12, %rax
	jne	.LBB9_6
.LBB9_18:                               # %._crit_edge
                                        #   in Loop: Header=BB9_4 Depth=2
	incl	%r10d
	addq	8(%rsp), %r11                   # 8-byte Folded Reload
	cmpl	%ecx, %r10d
	jne	.LBB9_4
.LBB9_19:                               # %._crit_edge195
                                        #   in Loop: Header=BB9_2 Depth=1
	incl	%r8d
	addq	40(%rsp), %rdi                  # 8-byte Folded Reload
	cmpl	24(%rsp), %r8d                  # 4-byte Folded Reload
	movq	64(%rsp), %r15                  # 8-byte Reload
	jne	.LBB9_2
# %bb.8:                                # %.preheader190
	cmpl	$0, 8(%rsp)                     # 4-byte Folded Reload
	movq	%rsi, %r12
	jle	.LBB9_15
# %bb.9:                                # %.preheader189.lr.ph
	movl	20(%rsp), %eax                  # 4-byte Reload
	cmpl	$2, %eax
	movl	$1, %edi
	movl	$1, %ecx
	cmovgel	%eax, %ecx
	movl	4(%rsp), %eax                   # 4-byte Reload
	cmpl	$2, %eax
	movl	$1, %edx
	cmovgel	%eax, %edx
	movl	(%rsp), %esi                    # 4-byte Reload
	cmpl	$2, %esi
	cmovgel	%esi, %edi
	movl	%edi, 24(%rsp)                  # 4-byte Spill
	movl	%r15d, %esi
	imull	8(%rsp), %esi                   # 4-byte Folded Reload
	shll	$2, %esi
	xorl	%edi, %edi
	xorpd	%xmm0, %xmm0
	xorl	%r8d, %r8d
	movq	56(%rsp), %rax                  # 8-byte Reload
.LBB9_10:                               # %.preheader189
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_12 Depth 2
                                        #       Child Loop BB9_45 Depth 3
	testl	%r15d, %r15d
	jle	.LBB9_14
# %bb.11:                               # %.preheader188.lr.ph
                                        #   in Loop: Header=BB9_10 Depth=1
	xorl	%r9d, %r9d
	movl	%edi, %r10d
.LBB9_12:                               # %.preheader188
                                        #   Parent Loop BB9_10 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB9_45 Depth 3
	movq	%rcx, %r11
	movl	%r10d, %ebx
	testl	%r13d, %r13d
	jle	.LBB9_13
.LBB9_45:                               #   Parent Loop BB9_10 Depth=1
                                        #     Parent Loop BB9_12 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movslq	%ebx, %rbx
	movq	%rbx, %r14
	shlq	$4, %r14
	movq	$0, 8(%rax,%r14)
	movsd	(%r12,%rbx,8), %xmm1            # xmm1 = mem[0],zero
	addsd	%xmm0, %xmm1
	movsd	%xmm1, (%rax,%r14)
	incl	%ebx
	decq	%r11
	jne	.LBB9_45
.LBB9_13:                               # %._crit_edge199
                                        #   in Loop: Header=BB9_12 Depth=2
	incl	%r9d
	addl	(%rsp), %r10d                   # 4-byte Folded Reload
	cmpl	%edx, %r9d
	jne	.LBB9_12
.LBB9_14:                               # %._crit_edge201
                                        #   in Loop: Header=BB9_10 Depth=1
	incl	%r8d
	addl	%esi, %edi
	cmpl	24(%rsp), %r8d                  # 4-byte Folded Reload
	jne	.LBB9_10
.LBB9_15:                               # %._crit_edge203
	leaq	48(%rsp), %r14
	movq	%r14, %rdi
	movq	144(%rsp), %rbx                 # 8-byte Reload
	movq	%rbx, %rsi
	callq	hipMalloc
	movq	(%r14), %rdi
	movq	56(%rsp), %rsi                  # 8-byte Reload
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	152(%rsp), %rdi
	movl	(%rsp), %esi                    # 4-byte Reload
	movl	4(%rsp), %edx                   # 4-byte Reload
	movl	20(%rsp), %ecx                  # 4-byte Reload
	movl	$105, %r8d
	callq	hipfftPlan3d
	testl	%eax, %eax
	jne	.LBB9_16
# %bb.22:
	movq	%r12, 168(%rsp)                 # 8-byte Spill
	movq	%rbp, 176(%rsp)                 # 8-byte Spill
	movq	152(%rsp), %rdi
	movq	48(%rsp), %rdx
	movq	%rdx, %rsi
	movl	$-1, %ecx
	callq	hipfftExecZ2Z
	testl	%eax, %eax
	jne	.LBB9_23
# %bb.24:
	movl	%r13d, %eax
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	movq	48(%rsp), %rsi
	movq	88(%rsp), %rdi                  # 8-byte Reload
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	callq	hipDeviceSynchronize
	movq	152(%rsp), %rdi
	callq	hipfftDestroy
	movq	48(%rsp), %rdi
	callq	hipFree
	cmpl	$0, 8(%rsp)                     # 4-byte Folded Reload
	jle	.LBB9_31
# %bb.25:                               # %.preheader187.lr.ph
	movl	20(%rsp), %eax                  # 4-byte Reload
	cmpl	$2, %eax
	movl	$1, %ecx
	movl	$1, %edx
	cmovgel	%eax, %edx
	movq	%rdx, 184(%rsp)                 # 8-byte Spill
	movl	4(%rsp), %eax                   # 4-byte Reload
	cmpl	$2, %eax
	movl	$1, %edx
	cmovgel	%eax, %edx
	movl	%edx, 120(%rsp)                 # 4-byte Spill
	movl	(%rsp), %eax                    # 4-byte Reload
	cmpl	$2, %eax
	cmovgel	%eax, %ecx
	movl	%ecx, 112(%rsp)                 # 4-byte Spill
	movl	%r15d, %eax
	imull	8(%rsp), %eax                   # 4-byte Folded Reload
	shll	$2, %eax
	movl	%eax, 108(%rsp)                 # 4-byte Spill
	movl	$0, 36(%rsp)                    # 4-byte Folded Spill
	leaq	128(%rsp), %rcx
	xorl	%edx, %edx
	movq	72(%rsp), %r12                  # 8-byte Reload
	movq	192(%rsp), %r13                 # 8-byte Reload
.LBB9_26:                               # %.preheader187
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_28 Depth 2
                                        #       Child Loop BB9_46 Depth 3
	movl	%edx, 116(%rsp)                 # 4-byte Spill
	testl	%r15d, %r15d
	jle	.LBB9_30
# %bb.27:                               # %.preheader186.lr.ph
                                        #   in Loop: Header=BB9_26 Depth=1
	xorl	%eax, %eax
	movl	36(%rsp), %edx                  # 4-byte Reload
.LBB9_28:                               # %.preheader186
                                        #   Parent Loop BB9_26 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB9_46 Depth 3
	movl	%eax, 40(%rsp)                  # 4-byte Spill
	movq	184(%rsp), %rbx                 # 8-byte Reload
	movl	%edx, 124(%rsp)                 # 4-byte Spill
	movl	%edx, %r14d
	cmpl	$0, 24(%rsp)                    # 4-byte Folded Reload
	jle	.LBB9_29
.LBB9_46:                               #   Parent Loop BB9_26 Depth=1
                                        #     Parent Loop BB9_28 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movslq	%r14d, %r14
	movq	%r14, %rbp
	shlq	$4, %rbp
	movq	%r13, %rsi
	addq	%rbp, %rsi
	movq	88(%rsp), %rax                  # 8-byte Reload
	movups	(%rax,%rbp), %xmm0
	movaps	%xmm0, 128(%rsp)
	movq	%rcx, %r15
	movq	%rcx, %rdi
	callq	_ZNSt7complexIdEmLIdEERS0_RKS_IT_E
	movq	%r15, %rcx
	movapd	128(%rsp), %xmm0
	movupd	%xmm0, (%r12,%rbp)
	incl	%r14d
	decq	%rbx
	jne	.LBB9_46
.LBB9_29:                               # %._crit_edge206
                                        #   in Loop: Header=BB9_28 Depth=2
	movl	40(%rsp), %eax                  # 4-byte Reload
	incl	%eax
	movl	124(%rsp), %edx                 # 4-byte Reload
	addl	(%rsp), %edx                    # 4-byte Folded Reload
	cmpl	120(%rsp), %eax                 # 4-byte Folded Reload
	jne	.LBB9_28
.LBB9_30:                               # %._crit_edge208
                                        #   in Loop: Header=BB9_26 Depth=1
	movl	116(%rsp), %edx                 # 4-byte Reload
	incl	%edx
	movl	36(%rsp), %eax                  # 4-byte Reload
	addl	108(%rsp), %eax                 # 4-byte Folded Reload
	movl	%eax, 36(%rsp)                  # 4-byte Spill
	cmpl	112(%rsp), %edx                 # 4-byte Folded Reload
	movq	64(%rsp), %r15                  # 8-byte Reload
	jne	.LBB9_26
.LBB9_31:                               # %._crit_edge210
	leaq	96(%rsp), %rdi
	movq	144(%rsp), %rbx                 # 8-byte Reload
	movq	%rbx, %rsi
	callq	hipMalloc
	movq	48(%rsp), %rdi
	movq	72(%rsp), %rsi                  # 8-byte Reload
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	128(%rsp), %rdi
	movl	(%rsp), %esi                    # 4-byte Reload
	movl	4(%rsp), %edx                   # 4-byte Reload
	movl	20(%rsp), %ecx                  # 4-byte Reload
	movl	$105, %r8d
	callq	hipfftPlan3d
	testl	%eax, %eax
	jne	.LBB9_16
# %bb.32:
	movq	128(%rsp), %rdi
	movq	96(%rsp), %rdx
	movq	%rdx, %rsi
	movl	$1, %ecx
	callq	hipfftExecZ2Z
	testl	%eax, %eax
	movq	176(%rsp), %r14                 # 8-byte Reload
	jne	.LBB9_23
# %bb.33:
	movq	96(%rsp), %rsi
	movq	80(%rsp), %rdi                  # 8-byte Reload
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	callq	hipDeviceSynchronize
	movq	128(%rsp), %rdi
	callq	hipfftDestroy
	movq	96(%rsp), %rdi
	callq	hipFree
	cmpl	$0, 8(%rsp)                     # 4-byte Folded Reload
	jle	.LBB9_44
# %bb.34:                               # %.preheader185.lr.ph
	movq	160(%rsp), %rax                 # 8-byte Reload
	shll	$3, %eax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	movl	%r15d, %eax
	imull	8(%rsp), %eax                   # 4-byte Folded Reload
	leal	(,%rax,4), %ecx
	movl	%ecx, 40(%rsp)                  # 4-byte Spill
	xorl	%edx, %edx
	movsd	.LCPI9_0(%rip), %xmm1           # xmm1 = mem[0],zero
	movapd	.LCPI9_1(%rip), %xmm2           # xmm2 = [NaN,NaN]
	xorpd	%xmm3, %xmm3
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	movq	80(%rsp), %rbp                  # 8-byte Reload
.LBB9_35:                               # %.preheader185
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_37 Depth 2
                                        #       Child Loop BB9_39 Depth 3
	testl	%r15d, %r15d
	jle	.LBB9_43
# %bb.36:                               # %.preheader.lr.ph
                                        #   in Loop: Header=BB9_35 Depth=1
	xorl	%r8d, %r8d
	movl	%edx, %r9d
	movl	%ecx, %esi
.LBB9_37:                               # %.preheader
                                        #   Parent Loop BB9_35 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB9_39 Depth 3
	cmpl	$0, 24(%rsp)                    # 4-byte Folded Reload
	jle	.LBB9_42
# %bb.38:                               # %.lr.ph212
                                        #   in Loop: Header=BB9_37 Depth=2
	movq	48(%r14), %r11
	movq	24(%rsp), %r12                  # 8-byte Reload
	movl	%r9d, %r13d
	movl	%esi, %r10d
.LBB9_39:                               #   Parent Loop BB9_35 Depth=1
                                        #     Parent Loop BB9_37 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movslq	%r10d, %rbx
	shlq	$4, %rbx
	movsd	(%rbp,%rbx), %xmm5              # xmm5 = mem[0],zero
	movsd	8(%rbp,%rbx), %xmm6             # xmm6 = mem[0],zero
	movapd	%xmm5, %xmm7
	andpd	%xmm2, %xmm7
	movapd	%xmm6, %xmm4
	andpd	%xmm2, %xmm4
	maxsd	%xmm7, %xmm4
	ucomisd	%xmm3, %xmm4
	jne	.LBB9_40
	jnp	.LBB9_41
.LBB9_40:                               #   in Loop: Header=BB9_39 Depth=3
	divsd	%xmm4, %xmm5
	divsd	%xmm4, %xmm6
	mulsd	%xmm5, %xmm5
	mulsd	%xmm6, %xmm6
	addsd	%xmm5, %xmm6
	xorps	%xmm5, %xmm5
	sqrtsd	%xmm6, %xmm5
	mulsd	%xmm5, %xmm4
.LBB9_41:                               # %_ZSt3absIdET_RKSt7complexIS0_E.exit
                                        #   in Loop: Header=BB9_39 Depth=3
	movapd	%xmm1, %xmm5
	divsd	24(%r14), %xmm5
	divsd	%xmm0, %xmm5
	mulsd	%xmm4, %xmm5
	movslq	%r13d, %r13
	movsd	%xmm5, (%r11,%r13,8)
	incl	%r10d
	incl	%r13d
	decq	%r12
	jne	.LBB9_39
.LBB9_42:                               # %._crit_edge213
                                        #   in Loop: Header=BB9_37 Depth=2
	incl	%r8d
	addl	(%rsp), %esi                    # 4-byte Folded Reload
	addl	8(%rsp), %r9d                   # 4-byte Folded Reload
	cmpl	%r15d, %r8d
	jne	.LBB9_37
.LBB9_43:                               # %._crit_edge215
                                        #   in Loop: Header=BB9_35 Depth=1
	incl	%edi
	addl	40(%rsp), %ecx                  # 4-byte Folded Reload
	addl	%eax, %edx
	cmpl	8(%rsp), %edi                   # 4-byte Folded Reload
	jne	.LBB9_35
.LBB9_44:                               # %._crit_edge217
	movq	%r14, %rdi
	callq	_Z23_2nd_order_diff_3d_cudaP6grid3D
	movq	168(%rsp), %rdi                 # 8-byte Reload
	callq	free
	movq	56(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	88(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	72(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	80(%rsp), %rdi                  # 8-byte Reload
	callq	free
	addq	$200, %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
.LBB9_16:
	.cfi_def_cfa_offset 256
	movl	$.Lstr.9, %edi
	jmp	.LBB9_17
.LBB9_23:
	movl	$.Lstr.8, %edi
.LBB9_17:
	callq	puts@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end9:
	.size	_Z17isolatedPotentialP6grid3DPSt7complexIdE, .Lfunc_end9-_Z17isolatedPotentialP6grid3DPSt7complexIdE
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z11WeightForceP6grid3DP10particle3Di
.LCPI10_0:
	.quad	0xbfe0000000000000              # double -0.5
.LCPI10_1:
	.quad	0x3fe0000000000000              # double 0.5
.LCPI10_3:
	.quad	0x3fe8000000000000              # double 0.75
.LCPI10_4:
	.quad	0x4008000000000000              # double 3
.LCPI10_5:
	.quad	0x3ff8000000000000              # double 1.5
.LCPI10_6:
	.quad	0x3ff0000000000000              # double 1
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI10_2:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.text
	.globl	_Z11WeightForceP6grid3DP10particle3Di
	.type	_Z11WeightForceP6grid3DP10particle3Di,@function
_Z11WeightForceP6grid3DP10particle3Di:  # @_Z11WeightForceP6grid3DP10particle3Di
	.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	$216, %rsp
	.cfi_def_cfa_offset 272
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	(%rsi), %ebx
	testl	%ebx, %ebx
	jle	.LBB10_38
# %bb.1:                                # %.lr.ph
	movq	%rsi, %r15
	movq	%rdi, %rbp
	movq	24(%rsi), %r8
	movq	32(%rsi), %rsi
	movq	40(%r15), %r9
	movq	48(%r15), %r10
	movq	56(%r15), %r11
	xorl	%edi, %edi
	movsd	.LCPI10_1(%rip), %xmm7          # xmm7 = mem[0],zero
	movsd	.LCPI10_6(%rip), %xmm8          # xmm8 = mem[0],zero
	movapd	.LCPI10_2(%rip), %xmm9          # xmm9 = [NaN,NaN]
	movsd	.LCPI10_4(%rip), %xmm10         # xmm10 = mem[0],zero
	movsd	.LCPI10_5(%rip), %xmm11         # xmm11 = mem[0],zero
	movsd	.LCPI10_3(%rip), %xmm12         # xmm12 = mem[0],zero
	movapd	.LCPI10_2(%rip), %xmm13         # xmm13 = [NaN,NaN]
	xorl	%r13d, %r13d
	movl	%edx, 44(%rsp)                  # 4-byte Spill
	movq	%r15, 104(%rsp)                 # 8-byte Spill
	movq	%rbp, 72(%rsp)                  # 8-byte Spill
.LBB10_2:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB10_6 Depth 2
                                        #       Child Loop BB10_7 Depth 3
                                        #     Child Loop BB10_11 Depth 2
                                        #     Child Loop BB10_18 Depth 2
                                        #     Child Loop BB10_24 Depth 2
                                        #     Child Loop BB10_30 Depth 2
                                        #       Child Loop BB10_31 Depth 3
                                        #         Child Loop BB10_32 Depth 4
	movsd	(%rbp), %xmm14                  # xmm14 = mem[0],zero
	mulsd	.LCPI10_0(%rip), %xmm14
	movq	16(%r15), %r14
	movsd	(%r14,%r13,8), %xmm0            # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	divsd	24(%rbp), %xmm0
	cvttsd2si	%xmm0, %r12d
	movsd	(%r8,%r13,8), %xmm0             # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	divsd	32(%rbp), %xmm0
	cvttsd2si	%xmm0, %ecx
	movsd	(%rsi,%r13,8), %xmm0            # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	divsd	40(%rbp), %xmm0
	cvttsd2si	%xmm0, %eax
	movl	%eax, 48(%rsp)                  # 4-byte Spill
	movq	%rdi, (%r9,%r13,8)
	movq	%rdi, (%r10,%r13,8)
	movq	%rdi, (%r11,%r13,8)
	testl	%edx, %edx
	je	.LBB10_36
# %bb.3:                                #   in Loop: Header=BB10_2 Depth=1
	cmpl	$2, %edx
	je	.LBB10_10
# %bb.4:                                #   in Loop: Header=BB10_2 Depth=1
	cmpl	$1, %edx
	jne	.LBB10_37
# %bb.5:                                # %.preheader275
                                        #   in Loop: Header=BB10_2 Depth=1
	movq	%r14, 120(%rsp)                 # 8-byte Spill
	movl	%ecx, 32(%rsp)                  # 4-byte Spill
	movl	%r12d, 64(%rsp)                 # 4-byte Spill
	movl	%ebx, 12(%rsp)                  # 4-byte Spill
	movq	%rsi, 16(%rsp)                  # 8-byte Spill
	movq	%r8, 56(%rsp)                   # 8-byte Spill
	movl	8(%rbp), %eax
	movl	%eax, 24(%rsp)                  # 4-byte Spill
	movl	12(%rbp), %eax
	movl	%eax, 100(%rsp)                 # 4-byte Spill
	movq	64(%rbp), %rax
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	movq	8(%r15), %r14
	movq	72(%rbp), %rsi
	movq	80(%rbp), %rbp
	xorl	%r8d, %r8d
	movb	$1, %al
.LBB10_6:                               # %.preheader273
                                        #   Parent Loop BB10_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB10_7 Depth 3
	movl	%eax, 80(%rsp)                  # 4-byte Spill
	addl	48(%rsp), %r8d                  # 4-byte Folded Reload
	xorps	%xmm0, %xmm0
	cvtsi2sd	%r8d, %xmm0
	xorl	%edx, %edx
	movq	72(%rsp), %r12                  # 8-byte Reload
	movl	64(%rsp), %eax                  # 4-byte Reload
	movq	120(%rsp), %rdi                 # 8-byte Reload
	movl	100(%rsp), %ebx                 # 4-byte Reload
.LBB10_7:                               #   Parent Loop BB10_2 Depth=1
                                        #     Parent Loop BB10_6 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	%edx, %r15d
	movl	%edx, %ecx
	shrl	%r15d
	andl	$1, %ecx
	addl	%eax, %r15d
	xorps	%xmm1, %xmm1
	cvtsi2sd	%r15d, %xmm1
	addl	32(%rsp), %ecx                  # 4-byte Folded Reload
	xorps	%xmm2, %xmm2
	cvtsi2sd	%ecx, %xmm2
	imull	%ebx, %r15d
	addl	%ecx, %r15d
	movsd	(%rdi,%r13,8), %xmm3            # xmm3 = mem[0],zero
	movsd	24(%r12), %xmm4                 # xmm4 = mem[0],zero
	subsd	%xmm14, %xmm3
	movsd	32(%r12), %xmm5                 # xmm5 = mem[0],zero
	mulsd	%xmm4, %xmm1
	subsd	%xmm1, %xmm3
	andpd	%xmm13, %xmm3
	movapd	%xmm8, %xmm1
	movq	56(%rsp), %rcx                  # 8-byte Reload
	movsd	(%rcx,%r13,8), %xmm6            # xmm6 = mem[0],zero
	subsd	%xmm14, %xmm6
	divsd	%xmm4, %xmm3
	mulsd	%xmm5, %xmm2
	subsd	%xmm2, %xmm6
	andpd	%xmm13, %xmm6
	divsd	%xmm5, %xmm6
	movapd	%xmm8, %xmm2
	movq	16(%rsp), %rcx                  # 8-byte Reload
	movsd	(%rcx,%r13,8), %xmm4            # xmm4 = mem[0],zero
	subsd	%xmm14, %xmm4
	subsd	%xmm3, %xmm1
	movsd	40(%r12), %xmm3                 # xmm3 = mem[0],zero
	movapd	%xmm3, %xmm5
	mulsd	%xmm0, %xmm5
	subsd	%xmm6, %xmm2
	subsd	%xmm5, %xmm4
	andpd	%xmm13, %xmm4
	divsd	%xmm3, %xmm4
	mulsd	%xmm1, %xmm2
	movapd	%xmm8, %xmm1
	subsd	%xmm4, %xmm1
	imull	24(%rsp), %r15d                 # 4-byte Folded Reload
	mulsd	%xmm2, %xmm1
	addl	%r8d, %r15d
	movslq	%r15d, %rcx
	movq	88(%rsp), %r15                  # 8-byte Reload
	movsd	(%r15,%rcx,8), %xmm2            # xmm2 = mem[0],zero
	mulsd	%xmm1, %xmm2
	mulsd	(%r14,%r13,8), %xmm2
	addsd	(%r9,%r13,8), %xmm2
	movsd	%xmm2, (%r9,%r13,8)
	movsd	(%rsi,%rcx,8), %xmm2            # xmm2 = mem[0],zero
	mulsd	%xmm1, %xmm2
	mulsd	(%r14,%r13,8), %xmm2
	addsd	(%r10,%r13,8), %xmm2
	movsd	%xmm2, (%r10,%r13,8)
	mulsd	(%rbp,%rcx,8), %xmm1
	mulsd	(%r14,%r13,8), %xmm1
	addsd	(%r11,%r13,8), %xmm1
	movsd	%xmm1, (%r11,%r13,8)
	incl	%edx
	cmpl	$4, %edx
	jne	.LBB10_7
# %bb.8:                                #   in Loop: Header=BB10_6 Depth=2
	movl	$1, %r8d
	testb	$1, 80(%rsp)                    # 1-byte Folded Reload
	movl	$0, %eax
	jne	.LBB10_6
# %bb.9:                                #   in Loop: Header=BB10_2 Depth=1
	movl	44(%rsp), %edx                  # 4-byte Reload
	movq	104(%rsp), %r15                 # 8-byte Reload
	movq	72(%rsp), %rbp                  # 8-byte Reload
	xorl	%edi, %edi
	movq	56(%rsp), %r8                   # 8-byte Reload
	movq	16(%rsp), %rsi                  # 8-byte Reload
	movl	12(%rsp), %ebx                  # 4-byte Reload
	jmp	.LBB10_37
.LBB10_10:                              #   in Loop: Header=BB10_2 Depth=1
	movsd	(%r14,%r13,8), %xmm0            # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	movsd	24(%rbp), %xmm1                 # xmm1 = mem[0],zero
	movapd	%xmm1, %xmm2
	mulsd	%xmm7, %xmm2
	addsd	%xmm0, %xmm2
	divsd	%xmm1, %xmm2
	cvttsd2si	%xmm2, %ecx
	movsd	32(%rbp), %xmm0                 # xmm0 = mem[0],zero
	movsd	(%r8,%r13,8), %xmm1             # xmm1 = mem[0],zero
	subsd	%xmm14, %xmm1
	movapd	%xmm0, %xmm2
	mulsd	%xmm7, %xmm2
	addsd	%xmm1, %xmm2
	divsd	%xmm0, %xmm2
	movsd	%xmm2, 24(%rsp)                 # 8-byte Spill
	movsd	(%rsi,%r13,8), %xmm0            # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	movsd	40(%rbp), %xmm1                 # xmm1 = mem[0],zero
	movapd	%xmm1, %xmm2
	mulsd	%xmm7, %xmm2
	addsd	%xmm0, %xmm2
	divsd	%xmm1, %xmm2
	movsd	%xmm2, 32(%rsp)                 # 8-byte Spill
	movq	%rcx, %rax
	movq	%rcx, 64(%rsp)                  # 8-byte Spill
	leal	-1(%rcx), %ebx
	xorl	%r14d, %r14d
	movsd	%xmm14, 112(%rsp)               # 8-byte Spill
.LBB10_11:                              #   Parent Loop BB10_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	16(%r15), %rax
	movsd	(%rax,%r13,8), %xmm0            # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	leal	(%rbx,%r14), %eax
	xorps	%xmm2, %xmm2
	cvtsi2sd	%eax, %xmm2
	movsd	24(%rbp), %xmm1                 # xmm1 = mem[0],zero
	mulsd	%xmm1, %xmm2
	subsd	%xmm2, %xmm0
	andpd	%xmm9, %xmm0
	movapd	%xmm1, %xmm2
	mulsd	%xmm7, %xmm2
	ucomisd	%xmm0, %xmm2
	jae	.LBB10_12
# %bb.13:                               #   in Loop: Header=BB10_11 Depth=2
	mulsd	%xmm10, %xmm2
	ucomisd	%xmm0, %xmm2
	jae	.LBB10_14
# %bb.15:                               #   in Loop: Header=BB10_11 Depth=2
	movl	$.L.str.12, %edi
	xorl	%eax, %eax
	callq	printf
	movsd	112(%rsp), %xmm14               # 8-byte Reload
                                        # xmm14 = mem[0],zero
	movapd	.LCPI10_2(%rip), %xmm13         # xmm13 = [NaN,NaN]
	movsd	.LCPI10_3(%rip), %xmm12         # xmm12 = mem[0],zero
	movsd	.LCPI10_5(%rip), %xmm11         # xmm11 = mem[0],zero
	movsd	.LCPI10_4(%rip), %xmm10         # xmm10 = mem[0],zero
	movapd	.LCPI10_2(%rip), %xmm9          # xmm9 = [NaN,NaN]
	movsd	.LCPI10_6(%rip), %xmm8          # xmm8 = mem[0],zero
	movsd	.LCPI10_1(%rip), %xmm7          # xmm7 = mem[0],zero
	xorpd	%xmm1, %xmm1
	jmp	.LBB10_16
.LBB10_12:                              #   in Loop: Header=BB10_11 Depth=2
	divsd	%xmm1, %xmm0
	mulsd	%xmm0, %xmm0
	movapd	%xmm12, %xmm1
	subsd	%xmm0, %xmm1
	jmp	.LBB10_16
.LBB10_14:                              #   in Loop: Header=BB10_11 Depth=2
	divsd	%xmm1, %xmm0
	movapd	%xmm11, %xmm1
	subsd	%xmm0, %xmm1
	mulsd	%xmm1, %xmm1
	mulsd	%xmm7, %xmm1
.LBB10_16:                              #   in Loop: Header=BB10_11 Depth=2
	movsd	%xmm1, 192(%rsp,%r14,8)
	incq	%r14
	cmpq	$3, %r14
	jne	.LBB10_11
# %bb.17:                               # %.preheader278
                                        #   in Loop: Header=BB10_2 Depth=1
	cvttsd2si	24(%rsp), %ecx          # 8-byte Folded Reload
	movq	24(%r15), %rdi
	movsd	(%rdi,%r13,8), %xmm0            # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	movsd	32(%rbp), %xmm1                 # xmm1 = mem[0],zero
	movapd	%xmm1, %xmm2
	mulsd	%xmm7, %xmm2
	movapd	%xmm2, %xmm3
	mulsd	%xmm10, %xmm3
	movq	%rcx, %rax
	movq	%rcx, 80(%rsp)                  # 8-byte Spill
	leal	-1(%rcx), %eax
	xorl	%ecx, %ecx
.LBB10_18:                              #   Parent Loop BB10_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leal	(%rax,%rcx), %edx
	xorps	%xmm5, %xmm5
	cvtsi2sd	%edx, %xmm5
	mulsd	%xmm1, %xmm5
	movapd	%xmm0, %xmm4
	subsd	%xmm5, %xmm4
	andpd	%xmm9, %xmm4
	ucomisd	%xmm4, %xmm2
	jae	.LBB10_19
# %bb.20:                               #   in Loop: Header=BB10_18 Depth=2
	xorpd	%xmm5, %xmm5
	ucomisd	%xmm4, %xmm3
	jb	.LBB10_22
# %bb.21:                               #   in Loop: Header=BB10_18 Depth=2
	divsd	%xmm1, %xmm4
	movapd	%xmm11, %xmm5
	subsd	%xmm4, %xmm5
	mulsd	%xmm5, %xmm5
	mulsd	%xmm7, %xmm5
	jmp	.LBB10_22
.LBB10_19:                              #   in Loop: Header=BB10_18 Depth=2
	divsd	%xmm1, %xmm4
	mulsd	%xmm4, %xmm4
	movapd	%xmm12, %xmm5
	subsd	%xmm4, %xmm5
.LBB10_22:                              #   in Loop: Header=BB10_18 Depth=2
	movsd	%xmm5, 160(%rsp,%rcx,8)
	incq	%rcx
	cmpq	$3, %rcx
	jne	.LBB10_18
# %bb.23:                               # %.preheader277
                                        #   in Loop: Header=BB10_2 Depth=1
	cvttsd2si	32(%rsp), %eax          # 8-byte Folded Reload
	movq	32(%r15), %r8
	movsd	(%r8,%r13,8), %xmm0             # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	movsd	40(%rbp), %xmm1                 # xmm1 = mem[0],zero
	movapd	%xmm1, %xmm2
	mulsd	%xmm7, %xmm2
	movapd	%xmm2, %xmm3
	mulsd	%xmm10, %xmm3
	leal	-1(%rax), %ecx
	xorl	%edx, %edx
.LBB10_24:                              #   Parent Loop BB10_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leal	(%rcx,%rdx), %esi
	xorps	%xmm5, %xmm5
	cvtsi2sd	%esi, %xmm5
	mulsd	%xmm1, %xmm5
	movapd	%xmm0, %xmm4
	subsd	%xmm5, %xmm4
	andpd	%xmm9, %xmm4
	ucomisd	%xmm4, %xmm2
	jae	.LBB10_25
# %bb.26:                               #   in Loop: Header=BB10_24 Depth=2
	xorpd	%xmm5, %xmm5
	ucomisd	%xmm4, %xmm3
	jb	.LBB10_28
# %bb.27:                               #   in Loop: Header=BB10_24 Depth=2
	divsd	%xmm1, %xmm4
	movapd	%xmm11, %xmm5
	subsd	%xmm4, %xmm5
	mulsd	%xmm5, %xmm5
	mulsd	%xmm7, %xmm5
	jmp	.LBB10_28
.LBB10_25:                              #   in Loop: Header=BB10_24 Depth=2
	divsd	%xmm1, %xmm4
	mulsd	%xmm4, %xmm4
	movapd	%xmm12, %xmm5
	subsd	%xmm4, %xmm5
.LBB10_28:                              #   in Loop: Header=BB10_24 Depth=2
	movsd	%xmm5, 128(%rsp,%rdx,8)
	incq	%rdx
	cmpq	$3, %rdx
	jne	.LBB10_24
# %bb.29:                               # %.preheader276
                                        #   in Loop: Header=BB10_2 Depth=1
	movq	%r8, 16(%rsp)                   # 8-byte Spill
	movq	%rdi, 56(%rsp)                  # 8-byte Spill
	movl	8(%rbp), %ecx
	movl	%ecx, 32(%rsp)                  # 4-byte Spill
	movl	12(%rbp), %ecx
	movl	%ecx, 24(%rsp)                  # 4-byte Spill
	movl	16(%rbp), %ebx
	movq	64(%rbp), %r14
	movq	%rbp, %rdx
	movq	8(%r15), %rbp
	movq	40(%r15), %r9
	movq	72(%rdx), %r12
	movq	48(%r15), %r10
	movq	%r15, %rcx
	movq	80(%rdx), %r15
	movq	56(%rcx), %r11
	leal	(%rax,%rbx), %edi
	decl	%edi
	movq	$-1, %rsi
.LBB10_30:                              # %.preheader274
                                        #   Parent Loop BB10_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB10_31 Depth 3
                                        #         Child Loop BB10_32 Depth 4
	movq	64(%rsp), %rax                  # 8-byte Reload
	addl	%esi, %eax
	movl	32(%rsp), %ecx                  # 4-byte Reload
	addl	%ecx, %eax
	cltd
	idivl	%ecx
	imull	24(%rsp), %edx                  # 4-byte Folded Reload
	movl	%edx, 88(%rsp)                  # 4-byte Spill
	movsd	200(%rsp,%rsi,8), %xmm0         # xmm0 = mem[0],zero
	incq	%rsi
	movq	%rsi, 48(%rsp)                  # 8-byte Spill
	movq	$-1, %rcx
.LBB10_31:                              # %.preheader
                                        #   Parent Loop BB10_2 Depth=1
                                        #     Parent Loop BB10_30 Depth=2
                                        # =>    This Loop Header: Depth=3
                                        #         Child Loop BB10_32 Depth 4
	movq	80(%rsp), %rax                  # 8-byte Reload
	addl	%ecx, %eax
	movl	24(%rsp), %esi                  # 4-byte Reload
	addl	%esi, %eax
	cltd
	idivl	%esi
	movl	%edx, %esi
	addl	88(%rsp), %esi                  # 4-byte Folded Reload
	imull	32(%rsp), %esi                  # 4-byte Folded Reload
	movsd	168(%rsp,%rcx,8), %xmm1         # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	incq	%rcx
	xorl	%r8d, %r8d
.LBB10_32:                              #   Parent Loop BB10_2 Depth=1
                                        #     Parent Loop BB10_30 Depth=2
                                        #       Parent Loop BB10_31 Depth=3
                                        # =>      This Inner Loop Header: Depth=4
	leal	(%rdi,%r8), %eax
	cltd
	idivl	%ebx
	movsd	128(%rsp,%r8,8), %xmm2          # xmm2 = mem[0],zero
	addl	%esi, %edx
	mulsd	%xmm1, %xmm2
	movslq	%edx, %rax
	movsd	(%r14,%rax,8), %xmm3            # xmm3 = mem[0],zero
	mulsd	%xmm2, %xmm3
	mulsd	(%rbp,%r13,8), %xmm3
	addsd	(%r9,%r13,8), %xmm3
	movsd	%xmm3, (%r9,%r13,8)
	movsd	(%r12,%rax,8), %xmm3            # xmm3 = mem[0],zero
	mulsd	%xmm2, %xmm3
	mulsd	(%rbp,%r13,8), %xmm3
	addsd	(%r10,%r13,8), %xmm3
	movsd	%xmm3, (%r10,%r13,8)
	mulsd	(%r15,%rax,8), %xmm2
	mulsd	(%rbp,%r13,8), %xmm2
	addsd	(%r11,%r13,8), %xmm2
	movsd	%xmm2, (%r11,%r13,8)
	incq	%r8
	cmpq	$3, %r8
	jne	.LBB10_32
# %bb.33:                               #   in Loop: Header=BB10_31 Depth=3
	cmpq	$2, %rcx
	jne	.LBB10_31
# %bb.34:                               #   in Loop: Header=BB10_30 Depth=2
	movq	48(%rsp), %rsi                  # 8-byte Reload
	cmpq	$2, %rsi
	jne	.LBB10_30
# %bb.35:                               #   in Loop: Header=BB10_2 Depth=1
	movq	104(%rsp), %r15                 # 8-byte Reload
	movl	(%r15), %ebx
	movl	44(%rsp), %edx                  # 4-byte Reload
	movq	72(%rsp), %rbp                  # 8-byte Reload
	xorl	%edi, %edi
	movq	56(%rsp), %r8                   # 8-byte Reload
	movq	16(%rsp), %rsi                  # 8-byte Reload
	jmp	.LBB10_37
.LBB10_36:                              #   in Loop: Header=BB10_2 Depth=1
	movsd	(%r14,%r13,8), %xmm0            # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	xorps	%xmm1, %xmm1
	cvtsi2sd	%r12d, %xmm1
	movsd	24(%rbp), %xmm2                 # xmm2 = mem[0],zero
	mulsd	%xmm2, %xmm1
	subsd	%xmm1, %xmm0
	mulsd	%xmm7, %xmm2
	subsd	%xmm2, %xmm0
	addsd	%xmm8, %xmm0
	cvttsd2si	%xmm0, %eax
	movsd	32(%rbp), %xmm0                 # xmm0 = mem[0],zero
	movsd	(%r8,%r13,8), %xmm1             # xmm1 = mem[0],zero
	xorps	%xmm2, %xmm2
	cvtsi2sd	%ecx, %xmm2
	subsd	%xmm14, %xmm1
	mulsd	%xmm0, %xmm2
	subsd	%xmm2, %xmm1
	mulsd	%xmm7, %xmm0
	subsd	%xmm0, %xmm1
	addsd	%xmm8, %xmm1
	movl	%ecx, %r14d
	cvttsd2si	%xmm1, %ecx
	movsd	(%rsi,%r13,8), %xmm0            # xmm0 = mem[0],zero
	subsd	%xmm14, %xmm0
	movl	%ebx, 12(%rsp)                  # 4-byte Spill
	movl	48(%rsp), %ebx                  # 4-byte Reload
	xorps	%xmm1, %xmm1
	cvtsi2sd	%ebx, %xmm1
	movsd	40(%rbp), %xmm2                 # xmm2 = mem[0],zero
	mulsd	%xmm2, %xmm1
	subsd	%xmm1, %xmm0
	mulsd	%xmm7, %xmm2
	subsd	%xmm2, %xmm0
	addsd	%xmm8, %xmm0
	movq	%rsi, 16(%rsp)                  # 8-byte Spill
	cvttsd2si	%xmm0, %esi
	addl	%r12d, %eax
	imull	12(%rbp), %eax
	addl	%r14d, %ecx
	addl	%eax, %ecx
	imull	8(%rbp), %ecx
	addl	%ebx, %esi
	movl	12(%rsp), %ebx                  # 4-byte Reload
	addl	%ecx, %esi
	movq	64(%rbp), %rax
	movslq	%esi, %rcx
	movsd	(%rax,%rcx,8), %xmm0            # xmm0 = mem[0],zero
	movq	8(%r15), %rax
	mulsd	(%rax,%r13,8), %xmm0
	movsd	%xmm0, (%r9,%r13,8)
	movq	72(%rbp), %rsi
	movsd	(%rsi,%rcx,8), %xmm0            # xmm0 = mem[0],zero
	mulsd	(%rax,%r13,8), %xmm0
	movsd	%xmm0, (%r10,%r13,8)
	movq	80(%rbp), %rsi
	movsd	(%rsi,%rcx,8), %xmm0            # xmm0 = mem[0],zero
	movq	16(%rsp), %rsi                  # 8-byte Reload
	mulsd	(%rax,%r13,8), %xmm0
	movsd	%xmm0, (%r11,%r13,8)
.LBB10_37:                              # %.loopexit
                                        #   in Loop: Header=BB10_2 Depth=1
	incq	%r13
	movslq	%ebx, %rax
	cmpq	%rax, %r13
	jl	.LBB10_2
.LBB10_38:                              # %._crit_edge
	addq	$216, %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_end10:
	.size	_Z11WeightForceP6grid3DP10particle3Di, .Lfunc_end10-_Z11WeightForceP6grid3DP10particle3Di
	.cfi_endproc
                                        # -- End function
	.globl	_Z4kickP10particle3Dd           # -- Begin function _Z4kickP10particle3Dd
	.type	_Z4kickP10particle3Dd,@function
_Z4kickP10particle3Dd:                  # @_Z4kickP10particle3Dd
	.cfi_startproc
# %bb.0:
	movl	(%rdi), %eax
	testl	%eax, %eax
	jle	.LBB11_3
# %bb.1:                                # %.lr.ph
	movq	8(%rdi), %rcx
	movq	40(%rdi), %rdx
	movq	48(%rdi), %rsi
	movq	56(%rdi), %r8
	movq	64(%rdi), %r9
	movq	72(%rdi), %r10
	movq	80(%rdi), %rdi
	xorl	%r11d, %r11d
.LBB11_2:                               # =>This Inner Loop Header: Depth=1
	movsd	(%rdx,%r11,8), %xmm1            # xmm1 = mem[0],zero
	movsd	(%rcx,%r11,8), %xmm2            # xmm2 = mem[0],zero
	divsd	%xmm2, %xmm1
	movsd	(%rsi,%r11,8), %xmm3            # xmm3 = mem[0],zero
	divsd	%xmm2, %xmm3
	movsd	(%r8,%r11,8), %xmm4             # xmm4 = mem[0],zero
	divsd	%xmm2, %xmm4
	mulsd	%xmm0, %xmm1
	addsd	(%r9,%r11,8), %xmm1
	movsd	%xmm1, (%r9,%r11,8)
	mulsd	%xmm0, %xmm3
	addsd	(%r10,%r11,8), %xmm3
	movsd	%xmm3, (%r10,%r11,8)
	mulsd	%xmm0, %xmm4
	addsd	(%rdi,%r11,8), %xmm4
	movsd	%xmm4, (%rdi,%r11,8)
	incq	%r11
	cmpq	%r11, %rax
	jne	.LBB11_2
.LBB11_3:                               # %._crit_edge
	retq
.Lfunc_end11:
	.size	_Z4kickP10particle3Dd, .Lfunc_end11-_Z4kickP10particle3Dd
	.cfi_endproc
                                        # -- End function
	.globl	_Z5driftP10particle3Dd          # -- Begin function _Z5driftP10particle3Dd
	.type	_Z5driftP10particle3Dd,@function
_Z5driftP10particle3Dd:                 # @_Z5driftP10particle3Dd
	.cfi_startproc
# %bb.0:
	movl	(%rdi), %eax
	testl	%eax, %eax
	jle	.LBB12_3
# %bb.1:                                # %.lr.ph
	movq	64(%rdi), %rcx
	movq	16(%rdi), %rdx
	movq	24(%rdi), %rsi
	movq	72(%rdi), %r8
	movq	80(%rdi), %r9
	movq	32(%rdi), %rdi
	xorl	%r10d, %r10d
.LBB12_2:                               # =>This Inner Loop Header: Depth=1
	movsd	(%rcx,%r10,8), %xmm1            # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	addsd	(%rdx,%r10,8), %xmm1
	movsd	%xmm1, (%rdx,%r10,8)
	movsd	(%r8,%r10,8), %xmm1             # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	addsd	(%rsi,%r10,8), %xmm1
	movsd	%xmm1, (%rsi,%r10,8)
	movsd	(%r9,%r10,8), %xmm1             # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	addsd	(%rdi,%r10,8), %xmm1
	movsd	%xmm1, (%rdi,%r10,8)
	incq	%r10
	cmpq	%r10, %rax
	jne	.LBB12_2
.LBB12_3:                               # %._crit_edge
	retq
.Lfunc_end12:
	.size	_Z5driftP10particle3Dd, .Lfunc_end12-_Z5driftP10particle3Dd
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z14boundary_checkiP10particle3Dd
.LCPI13_0:
	.quad	0x3fe0000000000000              # double 0.5
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI13_1:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.text
	.globl	_Z14boundary_checkiP10particle3Dd
	.type	_Z14boundary_checkiP10particle3Dd,@function
_Z14boundary_checkiP10particle3Dd:      # @_Z14boundary_checkiP10particle3Dd
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	movq	%rsi, %rbx
	testl	%edi, %edi
	je	.LBB13_9
# %bb.1:
	cmpl	$1, %edi
	jne	.LBB13_18
# %bb.2:                                # %.preheader39
	movl	(%rbx), %eax
	testl	%eax, %eax
	jle	.LBB13_18
# %bb.3:                                # %.lr.ph
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	mulsd	.LCPI13_0(%rip), %xmm0
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	xorl	%r14d, %r14d
	movapd	.LCPI13_1(%rip), %xmm1          # xmm1 = [NaN,NaN]
	movl	$_ZSt4cout, %r15d
.LBB13_4:                               # =>This Inner Loop Header: Depth=1
	movq	16(%rbx), %rcx
	movsd	(%rcx,%r14,8), %xmm0            # xmm0 = mem[0],zero
	andpd	%xmm1, %xmm0
	ucomisd	(%rsp), %xmm0                   # 8-byte Folded Reload
	ja	.LBB13_7
# %bb.5:                                #   in Loop: Header=BB13_4 Depth=1
	movq	24(%rbx), %rcx
	movsd	(%rcx,%r14,8), %xmm0            # xmm0 = mem[0],zero
	andpd	%xmm1, %xmm0
	ucomisd	(%rsp), %xmm0                   # 8-byte Folded Reload
	ja	.LBB13_7
# %bb.6:                                #   in Loop: Header=BB13_4 Depth=1
	movq	32(%rbx), %rcx
	movsd	(%rcx,%r14,8), %xmm0            # xmm0 = mem[0],zero
	andpd	%xmm1, %xmm0
	ucomisd	(%rsp), %xmm0                   # 8-byte Folded Reload
	jbe	.LBB13_8
.LBB13_7:                               #   in Loop: Header=BB13_4 Depth=1
	movq	8(%rbx), %rax
	movq	$0, (%rax,%r14,8)
	movl	$_ZSt4cout, %edi
	movl	$.L.str.13, %esi
	movl	$32, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movapd	.LCPI13_1(%rip), %xmm1          # xmm1 = [NaN,NaN]
	movl	(%rbx), %eax
.LBB13_8:                               #   in Loop: Header=BB13_4 Depth=1
	incq	%r14
	movslq	%eax, %rcx
	cmpq	%rcx, %r14
	jl	.LBB13_4
	jmp	.LBB13_18
.LBB13_9:                               # %.preheader
	cmpl	$0, (%rbx)
	jle	.LBB13_18
# %bb.10:                               # %.lr.ph43
	movsd	.LCPI13_0(%rip), %xmm2          # xmm2 = mem[0],zero
	mulsd	(%rsp), %xmm2                   # 8-byte Folded Reload
	xorl	%r14d, %r14d
	movapd	.LCPI13_1(%rip), %xmm3          # xmm3 = [NaN,NaN]
	movsd	%xmm2, 8(%rsp)                  # 8-byte Spill
.LBB13_11:                              # =>This Inner Loop Header: Depth=1
	movq	16(%rbx), %rax
	movsd	(%rax,%r14,8), %xmm0            # xmm0 = mem[0],zero
	movapd	%xmm0, %xmm1
	andpd	%xmm3, %xmm1
	ucomisd	%xmm2, %xmm1
	jbe	.LBB13_13
# %bb.12:                               #   in Loop: Header=BB13_11 Depth=1
	movsd	(%rsp), %xmm1                   # 8-byte Reload
                                        # xmm1 = mem[0],zero
	callq	_Z17periodic_boundarydd
	movapd	.LCPI13_1(%rip), %xmm3          # xmm3 = [NaN,NaN]
	movsd	8(%rsp), %xmm2                  # 8-byte Reload
                                        # xmm2 = mem[0],zero
.LBB13_13:                              #   in Loop: Header=BB13_11 Depth=1
	movq	24(%rbx), %rax
	movsd	(%rax,%r14,8), %xmm0            # xmm0 = mem[0],zero
	movapd	%xmm0, %xmm1
	andpd	%xmm3, %xmm1
	ucomisd	%xmm2, %xmm1
	jbe	.LBB13_15
# %bb.14:                               #   in Loop: Header=BB13_11 Depth=1
	movsd	(%rsp), %xmm1                   # 8-byte Reload
                                        # xmm1 = mem[0],zero
	callq	_Z17periodic_boundarydd
	movapd	.LCPI13_1(%rip), %xmm3          # xmm3 = [NaN,NaN]
	movsd	8(%rsp), %xmm2                  # 8-byte Reload
                                        # xmm2 = mem[0],zero
.LBB13_15:                              #   in Loop: Header=BB13_11 Depth=1
	movq	32(%rbx), %rax
	movsd	(%rax,%r14,8), %xmm0            # xmm0 = mem[0],zero
	movapd	%xmm0, %xmm1
	andpd	%xmm3, %xmm1
	ucomisd	%xmm2, %xmm1
	jbe	.LBB13_17
# %bb.16:                               #   in Loop: Header=BB13_11 Depth=1
	movsd	(%rsp), %xmm1                   # 8-byte Reload
                                        # xmm1 = mem[0],zero
	callq	_Z17periodic_boundarydd
	movapd	.LCPI13_1(%rip), %xmm3          # xmm3 = [NaN,NaN]
	movsd	8(%rsp), %xmm2                  # 8-byte Reload
                                        # xmm2 = mem[0],zero
.LBB13_17:                              #   in Loop: Header=BB13_11 Depth=1
	incq	%r14
	movslq	(%rbx), %rax
	cmpq	%rax, %r14
	jl	.LBB13_11
.LBB13_18:                              # %.loopexit
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end13:
	.size	_Z14boundary_checkiP10particle3Dd, .Lfunc_end13-_Z14boundary_checkiP10particle3Dd
	.cfi_endproc
                                        # -- End function
	.globl	_Z8init_rk4P10particle3DS0_P5rk43D # -- Begin function _Z8init_rk4P10particle3DS0_P5rk43D
	.type	_Z8init_rk4P10particle3DS0_P5rk43D,@function
_Z8init_rk4P10particle3DS0_P5rk43D:     # @_Z8init_rk4P10particle3DS0_P5rk43D
	.cfi_startproc
# %bb.0:
	movl	(%rdi), %ecx
	testl	%ecx, %ecx
	jle	.LBB14_4
# %bb.1:                                # %.lr.ph
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rcx, %rax
	movq	64(%rdi), %rcx
	movq	%rcx, -8(%rsp)                  # 8-byte Spill
	movq	64(%rsi), %rcx
	movq	%rcx, -16(%rsp)                 # 8-byte Spill
	movq	72(%rdi), %rcx
	movq	%rcx, -24(%rsp)                 # 8-byte Spill
	movq	72(%rsi), %rcx
	movq	%rcx, -32(%rsp)                 # 8-byte Spill
	movq	80(%rdi), %rcx
	movq	%rcx, -40(%rsp)                 # 8-byte Spill
	movq	80(%rsi), %rcx
	movq	%rcx, -48(%rsp)                 # 8-byte Spill
	movq	40(%rdi), %rcx
	movq	%rcx, -56(%rsp)                 # 8-byte Spill
	movq	48(%rdi), %r15
	movq	40(%rsi), %r12
	movq	48(%rsi), %r13
	movq	56(%rdi), %rdi
	movq	56(%rsi), %rsi
	movq	8(%rdx), %rbp
	movq	16(%rdx), %rcx
	movq	24(%rdx), %rbx
	movq	%rax, %r10
	shlq	$3, %r10
	movq	32(%rdx), %r8
	movq	40(%rdx), %r9
	movq	%rdx, -64(%rsp)                 # 8-byte Spill
	movq	48(%rdx), %rax
	movq	%r10, %rdx
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
.LBB14_2:                               # =>This Inner Loop Header: Depth=1
	movq	-8(%rsp), %r14                  # 8-byte Reload
	movsd	(%r14,%r11), %xmm0              # xmm0 = mem[0],zero
	movq	-16(%rsp), %r14                 # 8-byte Reload
	movsd	%xmm0, (%r14,%r11)
	movq	-24(%rsp), %r14                 # 8-byte Reload
	movsd	(%r14,%r11), %xmm0              # xmm0 = mem[0],zero
	movq	-32(%rsp), %r14                 # 8-byte Reload
	movsd	%xmm0, (%r14,%r11)
	movq	-40(%rsp), %r14                 # 8-byte Reload
	movsd	(%r14,%r11), %xmm0              # xmm0 = mem[0],zero
	movq	-48(%rsp), %r14                 # 8-byte Reload
	movsd	%xmm0, (%r14,%r11)
	movq	-56(%rsp), %r14                 # 8-byte Reload
	movsd	(%r14,%r11), %xmm0              # xmm0 = mem[0],zero
	movsd	%xmm0, (%r12,%r11)
	movsd	(%r15,%r11), %xmm0              # xmm0 = mem[0],zero
	movsd	%xmm0, (%r13,%r11)
	movsd	(%rdi,%r11), %xmm0              # xmm0 = mem[0],zero
	movsd	%xmm0, (%rsi,%r11)
	movq	%r10, (%rbp,%r11)
	movq	%r10, (%rcx,%r11)
	movq	%r10, (%rbx,%r11)
	movq	%r10, (%r8,%r11)
	movq	%r10, (%r9,%r11)
	movq	%r10, (%rax,%r11)
	addq	$8, %r11
	cmpq	%r11, %rdx
	jne	.LBB14_2
# %bb.3:                                # %._crit_edge
	movabsq	$4294967296, %rax               # imm = 0x100000000
	movq	-64(%rsp), %rcx                 # 8-byte Reload
	movq	%rax, (%rcx)
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
.LBB14_4:
	retq
.Lfunc_end14:
	.size	_Z8init_rk4P10particle3DS0_P5rk43D, .Lfunc_end14-_Z8init_rk4P10particle3DS0_P5rk43D
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z7rk4_midP10particle3DS0_P5rk43Ddi
.LCPI15_0:
	.quad	0x4018000000000000              # double 6
.LCPI15_1:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z7rk4_midP10particle3DS0_P5rk43Ddi
	.type	_Z7rk4_midP10particle3DS0_P5rk43Ddi,@function
_Z7rk4_midP10particle3DS0_P5rk43Ddi:    # @_Z7rk4_midP10particle3DS0_P5rk43Ddi
	.cfi_startproc
# %bb.0:
	movl	%ecx, %r9d
	movl	(%rdi), %ecx
	testl	%ecx, %ecx
	jle	.LBB15_4
# %bb.1:                                # %.lr.ph
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rcx, %rax
	movq	40(%rsi), %r8
	movq	40(%rdi), %rcx
	movq	%rcx, -8(%rsp)                  # 8-byte Spill
	movq	48(%rsi), %r10
	movq	48(%rdi), %rcx
	movq	%rcx, -16(%rsp)                 # 8-byte Spill
	movq	56(%rsi), %rbx
	movq	56(%rdi), %rcx
	movq	%rcx, -24(%rsp)                 # 8-byte Spill
	movq	8(%rdi), %r15
	movq	16(%rdi), %rcx
	movq	%rcx, -32(%rsp)                 # 8-byte Spill
	movq	64(%rsi), %r13
	movq	16(%rsi), %rcx
	movq	%rcx, -40(%rsp)                 # 8-byte Spill
	movq	24(%rsi), %rcx
	movq	%rcx, -48(%rsp)                 # 8-byte Spill
	movq	72(%rsi), %rcx
	cvtsi2sd	%r9d, %xmm1
	movq	80(%rsi), %r9
	movq	32(%rsi), %rsi
	movq	%rsi, -56(%rsp)                 # 8-byte Spill
	divsd	.LCPI15_0(%rip), %xmm1
	cvtsi2sdl	(%rdx), %xmm3
	movq	24(%rdi), %rsi
	movq	%rsi, -64(%rsp)                 # 8-byte Spill
	movq	32(%rdi), %rsi
	movq	%rsi, -72(%rsp)                 # 8-byte Spill
	movq	64(%rdi), %rsi
	movq	%rsi, -80(%rsp)                 # 8-byte Spill
	movq	72(%rdi), %rsi
	movq	%rsi, -88(%rsp)                 # 8-byte Spill
	movq	80(%rdi), %rsi
	movq	%rsi, -96(%rsp)                 # 8-byte Spill
	cvtsi2sdl	4(%rdx), %xmm4
	shlq	$3, %rax
	movq	%rax, -104(%rsp)                # 8-byte Spill
	movsd	.LCPI15_1(%rip), %xmm2          # xmm2 = mem[0],zero
	movq	8(%rdx), %rdi
	movq	16(%rdx), %rax
	movq	24(%rdx), %rsi
	movq	32(%rdx), %r11
	movq	40(%rdx), %r14
	movq	%rdx, -112(%rsp)                # 8-byte Spill
	movq	48(%rdx), %r12
	xorl	%ebp, %ebp
.LBB15_2:                               # =>This Inner Loop Header: Depth=1
	movsd	(%r8,%rbp), %xmm5               # xmm5 = mem[0],zero
	mulsd	%xmm3, %xmm5
	movq	-8(%rsp), %rdx                  # 8-byte Reload
	movsd	(%rdx,%rbp), %xmm6              # xmm6 = mem[0],zero
	mulsd	%xmm4, %xmm6
	addsd	%xmm5, %xmm6
	movsd	%xmm6, (%r8,%rbp)
	movsd	(%r10,%rbp), %xmm5              # xmm5 = mem[0],zero
	mulsd	%xmm3, %xmm5
	movq	-16(%rsp), %rdx                 # 8-byte Reload
	movsd	(%rdx,%rbp), %xmm6              # xmm6 = mem[0],zero
	mulsd	%xmm4, %xmm6
	addsd	%xmm5, %xmm6
	movsd	%xmm6, (%r10,%rbp)
	mulsd	(%rbx,%rbp), %xmm3
	movq	-24(%rsp), %rdx                 # 8-byte Reload
	mulsd	(%rdx,%rbp), %xmm4
	addsd	%xmm3, %xmm4
	movsd	%xmm4, (%rbx,%rbp)
	movsd	(%r13,%rbp), %xmm3              # xmm3 = mem[0],zero
	mulsd	%xmm0, %xmm3
	movq	-32(%rsp), %rdx                 # 8-byte Reload
	addsd	(%rdx,%rbp), %xmm3
	movq	-40(%rsp), %rdx                 # 8-byte Reload
	movsd	%xmm3, (%rdx,%rbp)
	movsd	(%rcx,%rbp), %xmm3              # xmm3 = mem[0],zero
	mulsd	%xmm0, %xmm3
	movq	-64(%rsp), %rdx                 # 8-byte Reload
	addsd	(%rdx,%rbp), %xmm3
	movq	-48(%rsp), %rdx                 # 8-byte Reload
	movsd	%xmm3, (%rdx,%rbp)
	movsd	(%r9,%rbp), %xmm3               # xmm3 = mem[0],zero
	mulsd	%xmm0, %xmm3
	movq	-72(%rsp), %rdx                 # 8-byte Reload
	addsd	(%rdx,%rbp), %xmm3
	movq	-56(%rsp), %rdx                 # 8-byte Reload
	movsd	%xmm3, (%rdx,%rbp)
	movsd	(%r8,%rbp), %xmm3               # xmm3 = mem[0],zero
	mulsd	%xmm1, %xmm3
	divsd	(%r15,%rbp), %xmm3
	addsd	(%rdi,%rbp), %xmm3
	movsd	%xmm3, (%rdi,%rbp)
	movsd	(%r10,%rbp), %xmm3              # xmm3 = mem[0],zero
	mulsd	%xmm1, %xmm3
	divsd	(%r15,%rbp), %xmm3
	addsd	(%rax,%rbp), %xmm3
	movsd	%xmm3, (%rax,%rbp)
	movsd	(%rbx,%rbp), %xmm3              # xmm3 = mem[0],zero
	mulsd	%xmm1, %xmm3
	divsd	(%r15,%rbp), %xmm3
	addsd	(%rsi,%rbp), %xmm3
	movsd	%xmm3, (%rsi,%rbp)
	movsd	(%r13,%rbp), %xmm3              # xmm3 = mem[0],zero
	mulsd	%xmm1, %xmm3
	addsd	(%r11,%rbp), %xmm3
	movsd	%xmm3, (%r11,%rbp)
	movsd	(%rcx,%rbp), %xmm3              # xmm3 = mem[0],zero
	mulsd	%xmm1, %xmm3
	addsd	(%r14,%rbp), %xmm3
	movsd	%xmm3, (%r14,%rbp)
	movsd	(%r9,%rbp), %xmm3               # xmm3 = mem[0],zero
	mulsd	%xmm1, %xmm3
	addsd	(%r12,%rbp), %xmm3
	movsd	%xmm3, (%r12,%rbp)
	movsd	(%r8,%rbp), %xmm3               # xmm3 = mem[0],zero
	divsd	(%r15,%rbp), %xmm3
	mulsd	%xmm0, %xmm3
	movq	-80(%rsp), %rdx                 # 8-byte Reload
	addsd	(%rdx,%rbp), %xmm3
	movsd	%xmm3, (%r13,%rbp)
	movsd	(%r10,%rbp), %xmm3              # xmm3 = mem[0],zero
	divsd	(%r15,%rbp), %xmm3
	mulsd	%xmm0, %xmm3
	movq	-88(%rsp), %rdx                 # 8-byte Reload
	addsd	(%rdx,%rbp), %xmm3
	movsd	%xmm3, (%rcx,%rbp)
	movsd	(%rbx,%rbp), %xmm3              # xmm3 = mem[0],zero
	divsd	(%r15,%rbp), %xmm3
	mulsd	%xmm0, %xmm3
	movq	-96(%rsp), %rdx                 # 8-byte Reload
	addsd	(%rdx,%rbp), %xmm3
	movsd	%xmm3, (%r9,%rbp)
	addq	$8, %rbp
	xorpd	%xmm4, %xmm4
	movapd	%xmm2, %xmm3
	cmpq	%rbp, -104(%rsp)                # 8-byte Folded Reload
	jne	.LBB15_2
# %bb.3:                                # %._crit_edge
	movq	-112(%rsp), %rax                # 8-byte Reload
	movq	$1, (%rax)
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
.LBB15_4:
	retq
.Lfunc_end15:
	.size	_Z7rk4_midP10particle3DS0_P5rk43Ddi, .Lfunc_end15-_Z7rk4_midP10particle3DS0_P5rk43Ddi
	.cfi_endproc
                                        # -- End function
	.globl	_Z7rk4_endP10particle3DP5rk43Dd # -- Begin function _Z7rk4_endP10particle3DP5rk43Dd
	.type	_Z7rk4_endP10particle3DP5rk43Dd,@function
_Z7rk4_endP10particle3DP5rk43Dd:        # @_Z7rk4_endP10particle3DP5rk43Dd
	.cfi_startproc
# %bb.0:
	movl	(%rdi), %eax
	testl	%eax, %eax
	jle	.LBB16_4
# %bb.1:                                # %.lr.ph
	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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	32(%rsi), %rcx
	movq	16(%rdi), %rdx
	movq	24(%rdi), %r8
	movq	40(%rsi), %r9
	movq	48(%rsi), %r10
	movq	32(%rdi), %r11
	movq	8(%rsi), %rbx
	movq	16(%rsi), %r14
	movq	64(%rdi), %r15
	movq	72(%rdi), %r12
	movq	24(%rsi), %rsi
	movq	80(%rdi), %rdi
	shlq	$3, %rax
	xorl	%r13d, %r13d
.LBB16_2:                               # =>This Inner Loop Header: Depth=1
	movsd	(%rcx,%r13), %xmm1              # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	addsd	(%rdx,%r13), %xmm1
	movsd	%xmm1, (%rdx,%r13)
	movsd	(%r9,%r13), %xmm1               # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	addsd	(%r8,%r13), %xmm1
	movsd	%xmm1, (%r8,%r13)
	movsd	(%r10,%r13), %xmm1              # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	addsd	(%r11,%r13), %xmm1
	movsd	%xmm1, (%r11,%r13)
	movsd	(%rbx,%r13), %xmm1              # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	addsd	(%r15,%r13), %xmm1
	movsd	%xmm1, (%r15,%r13)
	movsd	(%r14,%r13), %xmm1              # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	addsd	(%r12,%r13), %xmm1
	movsd	%xmm1, (%r12,%r13)
	movsd	(%rsi,%r13), %xmm1              # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	addsd	(%rdi,%r13), %xmm1
	movsd	%xmm1, (%rdi,%r13)
	addq	$8, %r13
	cmpq	%r13, %rax
	jne	.LBB16_2
# %bb.3:
	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
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
.LBB16_4:                               # %._crit_edge
	retq
.Lfunc_end16:
	.size	_Z7rk4_endP10particle3DP5rk43Dd, .Lfunc_end16-_Z7rk4_endP10particle3DP5rk43Dd
	.cfi_endproc
                                        # -- End function
	.globl	_Z14freeMemoryGridP6grid3D      # -- Begin function _Z14freeMemoryGridP6grid3D
	.type	_Z14freeMemoryGridP6grid3D,@function
_Z14freeMemoryGridP6grid3D:             # @_Z14freeMemoryGridP6grid3D
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movq	56(%rdi), %rdi
	callq	free
	movq	48(%rbx), %rdi
	callq	free
	movq	64(%rbx), %rdi
	callq	free
	movq	72(%rbx), %rdi
	callq	free
	movq	80(%rbx), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	free                            # TAILCALL
.Lfunc_end17:
	.size	_Z14freeMemoryGridP6grid3D, .Lfunc_end17-_Z14freeMemoryGridP6grid3D
	.cfi_endproc
                                        # -- End function
	.globl	_Z18freeMemoryParticleP10particle3D # -- Begin function _Z18freeMemoryParticleP10particle3D
	.type	_Z18freeMemoryParticleP10particle3D,@function
_Z18freeMemoryParticleP10particle3D:    # @_Z18freeMemoryParticleP10particle3D
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movq	8(%rdi), %rdi
	callq	free
	movq	16(%rbx), %rdi
	callq	free
	movq	24(%rbx), %rdi
	callq	free
	movq	32(%rbx), %rdi
	callq	free
	movq	40(%rbx), %rdi
	callq	free
	movq	48(%rbx), %rdi
	callq	free
	movq	56(%rbx), %rdi
	callq	free
	movq	64(%rbx), %rdi
	callq	free
	movq	72(%rbx), %rdi
	callq	free
	movq	80(%rbx), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	free                            # TAILCALL
.Lfunc_end18:
	.size	_Z18freeMemoryParticleP10particle3D, .Lfunc_end18-_Z18freeMemoryParticleP10particle3D
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z18_2nd_order_diff_3dP6grid3Diii
.LCPI19_0:
	.quad	0xbff0000000000000              # double -1
	.text
	.globl	_Z18_2nd_order_diff_3dP6grid3Diii
	.type	_Z18_2nd_order_diff_3dP6grid3Diii,@function
_Z18_2nd_order_diff_3dP6grid3Diii:      # @_Z18_2nd_order_diff_3dP6grid3Diii
	.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	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
                                        # kill: def $ecx killed $ecx def $rcx
	movl	%edx, %r8d
                                        # kill: def $esi killed $esi def $rsi
	movsd	24(%rdi), %xmm1                 # xmm1 = mem[0],zero
	addsd	%xmm1, %xmm1
	movsd	.LCPI19_0(%rip), %xmm0          # xmm0 = mem[0],zero
	movapd	%xmm0, %xmm3
	divsd	%xmm1, %xmm3
	movsd	32(%rdi), %xmm1                 # xmm1 = mem[0],zero
	addsd	%xmm1, %xmm1
	movapd	%xmm0, %xmm2
	divsd	%xmm1, %xmm2
	movsd	40(%rdi), %xmm1                 # xmm1 = mem[0],zero
	movl	8(%rdi), %ebx
	movl	12(%rdi), %r14d
	movl	16(%rdi), %r9d
	movq	48(%rdi), %r10
	leal	(%rbx,%rsi), %eax
	incl	%eax
	cltd
	idivl	%ebx
	movl	%r14d, %r11d
	imull	%ebx, %r11d
	imull	%r11d, %edx
	movl	%ebx, %r15d
	imull	%r8d, %r15d
	leal	(%r15,%rcx), %ebp
	addl	%ebp, %edx
	movslq	%edx, %rax
	movsd	(%r10,%rax,8), %xmm4            # xmm4 = mem[0],zero
	leal	(%rbx,%rsi), %eax
	decl	%eax
	cltd
	idivl	%ebx
	imull	%r11d, %edx
	addl	%ebp, %edx
	movslq	%edx, %rax
	subsd	(%r10,%rax,8), %xmm4
	mulsd	%xmm3, %xmm4
	addsd	%xmm1, %xmm1
	movl	%r14d, %eax
	imull	%esi, %eax
	addl	%r8d, %eax
	imull	%r9d, %eax
	addl	%ecx, %eax
	movq	64(%rdi), %rdx
	movslq	%eax, %r12
	movsd	%xmm4, (%rdx,%r12,8)
	imull	%esi, %r11d
	leal	(%r14,%r8), %eax
	incl	%eax
	cltd
	idivl	%r14d
	imull	%ebx, %edx
	leal	(%r11,%rcx), %esi
	addl	%esi, %edx
	movslq	%edx, %rax
	movsd	(%r10,%rax,8), %xmm3            # xmm3 = mem[0],zero
	leal	(%r14,%r8), %eax
	decl	%eax
	cltd
	idivl	%r14d
	imull	%ebx, %edx
	addl	%esi, %edx
	movslq	%edx, %rax
	subsd	(%r10,%rax,8), %xmm3
	mulsd	%xmm2, %xmm3
	movq	72(%rdi), %rax
	movsd	%xmm3, (%rax,%r12,8)
	addl	%r15d, %r11d
	leal	(%r9,%rcx), %eax
	incl	%eax
	cltd
	idivl	%r9d
	addl	%r11d, %edx
	movslq	%edx, %rax
	movsd	(%r10,%rax,8), %xmm2            # xmm2 = mem[0],zero
	leal	(%r9,%rcx), %eax
	decl	%eax
	cltd
	idivl	%r9d
	addl	%r11d, %edx
	movslq	%edx, %rax
	subsd	(%r10,%rax,8), %xmm2
	divsd	%xmm1, %xmm0
	mulsd	%xmm0, %xmm2
	movq	80(%rdi), %rax
	movsd	%xmm2, (%rax,%r12,8)
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.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_end19:
	.size	_Z18_2nd_order_diff_3dP6grid3Diii, .Lfunc_end19-_Z18_2nd_order_diff_3dP6grid3Diii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z23_2nd_order_diff_3d_cudaP6grid3D
.LCPI20_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z23_2nd_order_diff_3d_cudaP6grid3D
	.type	_Z23_2nd_order_diff_3d_cudaP6grid3D,@function
_Z23_2nd_order_diff_3d_cudaP6grid3D:    # @_Z23_2nd_order_diff_3d_cudaP6grid3D
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %r14
	movl	20(%rdi), %eax
	shll	$3, %eax
	movslq	%eax, %rbx
	leaq	24(%rsp), %r15
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	leaq	16(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	leaq	8(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	movq	%rsp, %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	movq	(%r15), %rdi
	movq	48(%r14), %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movabsq	$4294967424, %rdi               # imm = 0x100000080
	movl	$1, %esi
	movq	%rdi, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB20_2
# %bb.1:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movq	(%rsp), %rcx
	movl	8(%r14), %r8d
	movsd	(%r14), %xmm0                   # xmm0 = mem[0],zero
	movsd	.LCPI20_0(%rip), %xmm1          # xmm1 = mem[0],zero
	callq	_Z25__device_stub__phiToForcePdS_S_S_idd
.LBB20_2:
	callq	hipDeviceSynchronize
	movq	64(%r14), %rdi
	movq	16(%rsp), %rsi
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	72(%r14), %rdi
	movq	8(%rsp), %rsi
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	80(%r14), %rdi
	movq	(%rsp), %rsi
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	(%rsp), %rdi
	callq	hipFree
	addq	$32, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end20:
	.size	_Z23_2nd_order_diff_3d_cudaP6grid3D, .Lfunc_end20-_Z23_2nd_order_diff_3d_cudaP6grid3D
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z17periodic_boundarydd
.LCPI21_0:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI21_1:
	.quad	0x3fe0000000000000              # double 0.5
	.text
	.globl	_Z17periodic_boundarydd
	.type	_Z17periodic_boundarydd,@function
_Z17periodic_boundarydd:                # @_Z17periodic_boundarydd
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movapd	.LCPI21_0(%rip), %xmm2          # xmm2 = [NaN,NaN]
	movapd	%xmm0, %xmm3
	andpd	%xmm2, %xmm3
	movapd	%xmm0, %xmm4
	divsd	%xmm3, %xmm4
	cvttpd2dq	%xmm4, %xmm3
	cvtdq2pd	%xmm3, %xmm3
	mulsd	%xmm1, %xmm3
	mulsd	.LCPI21_1(%rip), %xmm3
	addsd	%xmm3, %xmm0
	andpd	%xmm2, %xmm0
	callq	remainder
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.13, %esi
	movl	$32, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	_ZNSo5flushEv                   # TAILCALL
.Lfunc_end21:
	.size	_Z17periodic_boundarydd, .Lfunc_end21-_Z17periodic_boundarydd
	.cfi_endproc
                                        # -- End function
	.globl	_Z13freeMemoryRk4P5rk43D        # -- Begin function _Z13freeMemoryRk4P5rk43D
	.type	_Z13freeMemoryRk4P5rk43D,@function
_Z13freeMemoryRk4P5rk43D:               # @_Z13freeMemoryRk4P5rk43D
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movq	8(%rdi), %rdi
	callq	free
	movq	16(%rbx), %rdi
	callq	free
	movq	24(%rbx), %rdi
	callq	free
	movq	32(%rbx), %rdi
	callq	free
	movq	40(%rbx), %rdi
	callq	free
	movq	48(%rbx), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	free                            # TAILCALL
.Lfunc_end22:
	.size	_Z13freeMemoryRk4P5rk43D, .Lfunc_end22-_Z13freeMemoryRk4P5rk43D
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7complexIdEmLIdEERS0_RKS_IT_E,"axG",@progbits,_ZNSt7complexIdEmLIdEERS0_RKS_IT_E,comdat
	.weak	_ZNSt7complexIdEmLIdEERS0_RKS_IT_E # -- Begin function _ZNSt7complexIdEmLIdEERS0_RKS_IT_E
	.p2align	1, 0x90
	.type	_ZNSt7complexIdEmLIdEERS0_RKS_IT_E,@function
_ZNSt7complexIdEmLIdEERS0_RKS_IT_E:     # @_ZNSt7complexIdEmLIdEERS0_RKS_IT_E
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movsd	(%rsi), %xmm2                   # xmm2 = mem[0],zero
	movsd	8(%rsi), %xmm3                  # xmm3 = mem[0],zero
	movsd	(%rdi), %xmm4                   # xmm4 = mem[0],zero
	movsd	8(%rdi), %xmm5                  # xmm5 = mem[0],zero
	movapd	%xmm2, %xmm0
	mulsd	%xmm4, %xmm0
	movapd	%xmm3, %xmm1
	mulsd	%xmm5, %xmm1
	subsd	%xmm1, %xmm0
	movapd	%xmm3, %xmm6
	mulsd	%xmm4, %xmm6
	movapd	%xmm2, %xmm1
	mulsd	%xmm5, %xmm1
	addsd	%xmm6, %xmm1
	ucomisd	%xmm0, %xmm0
	jp	.LBB23_1
.LBB23_3:
	movsd	%xmm0, (%rbx)
	movsd	%xmm1, 8(%rbx)
	movq	%rbx, %rax
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.LBB23_1:
	.cfi_def_cfa_offset 16
	ucomisd	%xmm1, %xmm1
	jnp	.LBB23_3
# %bb.2:
	movapd	%xmm4, %xmm0
	movapd	%xmm5, %xmm1
	callq	__muldc3
	jmp	.LBB23_3
.Lfunc_end23:
	.size	_ZNSt7complexIdEmLIdEERS0_RKS_IT_E, .Lfunc_end23-_ZNSt7complexIdEmLIdEERS0_RKS_IT_E
	.cfi_endproc
                                        # -- End function
	.text
	.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	.LBB24_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB24_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10phiToForcePdS_S_S_idd, %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	$_Z6overk2Pdiii, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end24:
	.size	__hip_module_ctor, .Lfunc_end24-__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	.LBB25_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
.LBB25_2:
	retq
.Lfunc_end25:
	.size	__hip_module_dtor, .Lfunc_end25-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z10phiToForcePdS_S_S_idd,@object # @_Z10phiToForcePdS_S_S_idd
	.section	.rodata,"a",@progbits
	.globl	_Z10phiToForcePdS_S_S_idd
	.p2align	3, 0x0
_Z10phiToForcePdS_S_S_idd:
	.quad	_Z25__device_stub__phiToForcePdS_S_S_idd
	.size	_Z10phiToForcePdS_S_S_idd, 8

	.type	_Z6overk2Pdiii,@object          # @_Z6overk2Pdiii
	.globl	_Z6overk2Pdiii
	.p2align	3, 0x0
_Z6overk2Pdiii:
	.quad	_Z21__device_stub__overk2Pdiii
	.size	_Z6overk2Pdiii, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"result.txt"
	.size	.L.str, 11

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

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Step:%d\n"
	.size	.L.str.3, 9

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"%f\t%f\t"
	.size	.L.str.4, 7

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

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Total time : %f\n"
	.size	.L.str.6, 17

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Should not be here"
	.size	.L.str.12, 19

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"A particle reaches the boundary."
	.size	.L.str.13, 33

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z10phiToForcePdS_S_S_idd"
	.size	.L__unnamed_1, 26

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z6overk2Pdiii"
	.size	.L__unnamed_2, 15

	.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.2,@object                 # @str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr.2:
	.asciz	"CUFFT error: ExecZ2D  failed."
	.size	.Lstr.2, 30

	.type	.Lstr.4,@object                 # @str.4
.Lstr.4:
	.asciz	"CUFFT error: ExecD2Z forward failed."
	.size	.Lstr.4, 37

	.type	.Lstr.5,@object                 # @str.5
.Lstr.5:
	.asciz	"CUFFT error: Plan D2Z creation failed."
	.size	.Lstr.5, 39

	.type	.Lstr.8,@object                 # @str.8
.Lstr.8:
	.asciz	"CUFFT error: ExecZ2Z forward failed."
	.size	.Lstr.8, 37

	.type	.Lstr.9,@object                 # @str.9
.Lstr.9:
	.asciz	"CUFFT error: Plan creation failed."
	.size	.Lstr.9, 35

	.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 _Z25__device_stub__phiToForcePdS_S_S_idd
	.addrsig_sym _Z21__device_stub__overk2Pdiii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z10phiToForcePdS_S_S_idd
	.addrsig_sym _Z6overk2Pdiii
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z10phiToForcePdS_S_S_idd ; -- Begin function _Z10phiToForcePdS_S_S_idd
	.globl	_Z10phiToForcePdS_S_S_idd
	.p2align	8
	.type	_Z10phiToForcePdS_S_S_idd,@function
_Z10phiToForcePdS_S_S_idd:              ; @_Z10phiToForcePdS_S_S_idd
; %bb.0:
	s_clause 0x1
	s_load_b32 s3, s[0:1], 0x44
	s_load_b32 s2, s[0:1], 0x20
	s_add_u32 s4, s0, 56
	s_addc_u32 s5, s1, 0
	s_mov_b32 s6, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s16, s3, 0xffff
	s_mul_i32 s3, s2, s2
	v_mad_u64_u32 v[2:3], null, s15, s16, v[0:1]
	s_mul_i32 s12, s3, s2
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_cmpx_gt_i32_e64 s12, v2
	s_cbranch_execz .LBB0_3
; %bb.1:                                ; %.lr.ph
	v_cvt_f64_i32_e32 v[0:1], s2
	s_load_b128 s[8:11], s[0:1], 0x28
	s_ashr_i32 s13, s2, 31
	s_load_b32 s15, s[4:5], 0x0
	s_add_i32 s6, s2, s13
	s_sub_i32 s4, 0, s3
	s_xor_b32 s14, s6, s13
	v_add_nc_u32_e32 v2, 1, v2
	s_sub_i32 s5, 0, s14
	s_sub_i32 s17, 0, s2
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s15, s15, s16
	s_mov_b32 s16, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f64 v[3:4], null, v[0:1], v[0:1], s[8:9]
	v_div_scale_f64 v[9:10], vcc_lo, s[8:9], v[0:1], s[8:9]
	v_rcp_f64_e32 v[5:6], v[3:4]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[7:8], -v[3:4], v[5:6], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[5:6], v[5:6], v[7:8], v[5:6]
	v_fma_f64 v[7:8], -v[3:4], v[5:6], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[5:6], v[5:6], v[7:8], v[5:6]
	v_mul_f64 v[7:8], v[9:10], v[5:6]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[3:4], -v[3:4], v[7:8], v[9:10]
	v_div_fmas_f64 v[3:4], v[3:4], v[5:6], v[7:8]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f64 v[0:1], v[3:4], v[0:1], s[8:9]
	v_add_f64 v[0:1], v[0:1], v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_scale_f64 v[3:4], null, v[0:1], v[0:1], -1.0
	v_rcp_f64_e32 v[5:6], v[3:4]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[7:8], -v[3:4], v[5:6], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[5:6], v[5:6], v[7:8], v[5:6]
	v_fma_f64 v[7:8], -v[3:4], v[5:6], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f64 v[5:6], v[5:6], v[7:8], v[5:6]
	v_div_scale_f64 v[7:8], vcc_lo, -1.0, v[0:1], -1.0
	v_mul_f64 v[9:10], v[7:8], v[5:6]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[3:4], -v[3:4], v[9:10], v[7:8]
	v_div_fmas_f64 v[3:4], v[3:4], v[5:6], v[9:10]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_div_fixup_f64 v[0:1], v[3:4], v[0:1], -1.0
	v_cvt_f32_u32_e32 v3, s3
	v_cvt_f32_u32_e32 v4, s14
	v_rcp_iflag_f32_e32 v3, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v4, v4
	s_waitcnt_depctr 0xfff
	v_dual_mul_f32 v3, 0x4f7ffffe, v3 :: v_dual_mul_f32 v4, 0x4f7ffffe, v4
	v_cvt_u32_f32_e32 v3, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cvt_u32_f32_e32 v4, v4
	v_mul_lo_u32 v5, s4, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v6, s5, v4
	v_mul_hi_u32 v5, v3, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_mul_hi_u32 v6, v4, v6
	v_mul_f64 v[0:1], v[0:1], s[10:11]
	s_load_b256 s[4:11], s[0:1], 0x0
	s_add_i32 s1, s2, -1
	v_add_nc_u32_e32 v3, v3, v5
	s_delay_alu instid0(VALU_DEP_3)
	v_add_nc_u32_e32 v4, v4, v6
.LBB0_2:                                ; =>This Inner Loop Header: Depth=1
	v_add_nc_u32_e32 v5, -1, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v6, 31, v5
	v_add_nc_u32_e32 v7, v5, v6
	v_xor_b32_e32 v17, s13, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v7, v7, v6
	v_mul_hi_u32 v8, v7, v3
	v_mul_hi_u32 v9, v7, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v10, v8, s3
	v_mul_lo_u32 v11, v9, s14
	v_add_nc_u32_e32 v12, 1, v8
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_nc_u32_e32 v10, v7, v10
	v_sub_nc_u32_e32 v7, v7, v11
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_cmp_le_u32_e32 vcc_lo, s3, v10
	v_subrev_nc_u32_e32 v11, s3, v10
	v_cmp_le_u32_e64 s0, s14, v7
	v_cndmask_b32_e32 v8, v8, v12, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v10, v10, v11, vcc_lo
	v_subrev_nc_u32_e32 v12, s14, v7
	v_add_nc_u32_e32 v11, 1, v8
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_cmp_le_u32_e32 vcc_lo, s3, v10
	v_add_nc_u32_e32 v13, 1, v9
	v_cndmask_b32_e64 v7, v7, v12, s0
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v8, v8, v11, vcc_lo
	v_cndmask_b32_e64 v9, v9, v13, s0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cmp_le_u32_e32 vcc_lo, s14, v7
	v_xor_b32_e32 v8, v8, v6
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v12, 1, v9
	v_sub_nc_u32_e32 v15, v8, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_cndmask_b32 v7, v9, v12 :: v_dual_add_nc_u32 v8, s1, v15
	v_xor_b32_e32 v18, v7, v17
	v_mul_lo_u32 v21, v15, s2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_ashrrev_i32_e32 v11, 31, v8
	v_sub_nc_u32_e32 v19, v18, v17
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v8, v8, v11
	v_ashrrev_i32_e32 v16, 31, v19
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v8, v8, v11
	v_add_nc_u32_e32 v10, v19, v16
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_hi_u32 v14, v8, v4
	v_xor_b32_e32 v10, v10, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_hi_u32 v12, v10, v4
	v_mul_lo_u32 v14, v14, s14
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v12, v12, s14
	v_sub_nc_u32_e32 v8, v8, v14
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v10, v10, v12
	v_subrev_nc_u32_e32 v12, s14, v10
	v_cmp_le_u32_e32 vcc_lo, s14, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_cndmask_b32 v10, v10, v12 :: v_dual_add_nc_u32 v7, 1, v15
	v_ashrrev_i32_e32 v9, 31, v7
	v_subrev_nc_u32_e32 v12, s14, v8
	v_cmp_le_u32_e32 vcc_lo, s14, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_dual_cndmask_b32 v8, v8, v12 :: v_dual_add_nc_u32 v7, v7, v9
	v_cmp_le_u32_e32 vcc_lo, s14, v10
	v_xor_b32_e32 v7, v7, v9
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v13, v7, v4
	v_mul_lo_u32 v13, v13, s14
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v7, v7, v13
	v_subrev_nc_u32_e32 v13, s14, v7
	v_cmp_le_u32_e64 s0, s14, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v7, v7, v13, s0
	v_subrev_nc_u32_e32 v13, s14, v10
	v_subrev_nc_u32_e32 v12, s14, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_4)
	v_cndmask_b32_e32 v10, v10, v13, vcc_lo
	v_cmp_le_u32_e64 s0, s14, v7
	v_subrev_nc_u32_e32 v13, s14, v8
	v_cmp_le_u32_e32 vcc_lo, s14, v8
	v_xor_b32_e32 v20, v10, v16
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v7, v7, v12, s0
	v_xor_b32_e32 v10, v7, v9
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_add_nc_u32_e32 v7, v20, v17
	v_sub_nc_u32_e32 v20, v20, v16
	v_cndmask_b32_e32 v8, v8, v13, vcc_lo
	v_sub_nc_u32_e32 v10, v10, v9
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v15, s1, v20
	v_xor_b32_e32 v8, v8, v11
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v22, 31, v15
	v_sub_nc_u32_e32 v11, v8, v11
	v_mad_u64_u32 v[8:9], null, v10, s2, v[7:8]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v15, v15, v22
	v_mad_u64_u32 v[9:10], null, v11, s2, v[7:8]
	v_sub_nc_u32_e32 v7, v8, v18
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_xor_b32_e32 v15, v15, v22
	v_sub_nc_u32_e32 v8, v9, v18
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_nc_u32_e32 v9, v7, v16
	v_mul_hi_u32 v24, v15, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_nc_u32_e32 v11, v8, v16
	v_mad_u64_u32 v[7:8], null, s2, v9, v[5:6]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_mad_u64_u32 v[9:10], null, s2, v11, v[5:6]
	v_lshlrev_b64 v[11:12], 3, v[5:6]
	v_add_nc_u32_e32 v6, 1, v20
	v_ashrrev_i32_e32 v8, 31, v7
	v_mul_lo_u32 v24, v24, s14
	v_ashrrev_i32_e32 v10, 31, v9
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[7:8], 3, v[7:8]
	v_ashrrev_i32_e32 v16, 31, v6
	v_lshlrev_b64 v[9:10], 3, v[9:10]
	v_sub_nc_u32_e32 v15, v15, v24
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_add_co_u32 v7, vcc_lo, s4, v7
	v_add_co_ci_u32_e32 v8, vcc_lo, s5, v8, vcc_lo
	v_add_co_u32 v9, vcc_lo, s4, v9
	v_add_co_ci_u32_e32 v10, vcc_lo, s5, v10, vcc_lo
	s_clause 0x1
	global_load_b64 v[7:8], v[7:8], off
	global_load_b64 v[9:10], v[9:10], off
	v_add_nc_u32_e32 v6, v6, v16
	v_add_co_u32 v13, vcc_lo, s6, v11
	v_add_co_ci_u32_e32 v14, vcc_lo, s7, v12, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v6, v6, v16
	v_cmp_le_u32_e32 vcc_lo, s14, v15
	v_mul_hi_u32 v23, v6, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v23, v23, s14
	v_sub_nc_u32_e32 v23, v6, v23
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_2)
	v_cmp_le_u32_e64 s0, s14, v23
	s_waitcnt vmcnt(0)
	v_add_f64 v[6:7], v[7:8], -v[9:10]
	v_subrev_nc_u32_e32 v8, s14, v23
	v_subrev_nc_u32_e32 v9, s14, v15
	v_cndmask_b32_e64 v8, v23, v8, s0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v9, v15, v9, vcc_lo
	v_subrev_nc_u32_e32 v10, s14, v8
	v_cmp_le_u32_e64 s0, s14, v8
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_subrev_nc_u32_e32 v15, s14, v9
	v_cmp_le_u32_e32 vcc_lo, s14, v9
	v_cndmask_b32_e64 v8, v8, v10, s0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v9, v9, v15, vcc_lo
	v_xor_b32_e32 v8, v8, v16
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v9, v9, v22
	v_add3_u32 v8, v8, v17, v21
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add3_u32 v9, v9, v17, v21
	v_sub_nc_u32_e32 v8, v8, v18
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v9, v9, v18
	v_sub_nc_u32_e32 v10, v8, v16
	v_mul_f64 v[6:7], v[0:1], v[6:7]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v22, v9, v22
	v_mad_u64_u32 v[8:9], null, s2, v10, v[5:6]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[15:16], null, s2, v22, v[5:6]
	global_store_b64 v[13:14], v[6:7], off
	v_ashrrev_i32_e32 v9, 31, v8
	v_ashrrev_i32_e32 v16, 31, v15
	v_lshlrev_b64 v[8:9], 3, v[8:9]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[15:16], 3, v[15:16]
	v_add_co_u32 v8, vcc_lo, s4, v8
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v9, vcc_lo, s5, v9, vcc_lo
	v_add_co_u32 v15, vcc_lo, s4, v15
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_ci_u32_e32 v16, vcc_lo, s5, v16, vcc_lo
	s_clause 0x1
	global_load_b64 v[5:6], v[8:9], off
	global_load_b64 v[7:8], v[15:16], off
	v_sub_nc_u32_e32 v15, v17, v18
	v_add_co_u32 v9, vcc_lo, s8, v11
	v_add_co_ci_u32_e32 v10, vcc_lo, s9, v12, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_mad_u64_u32 v[13:14], null, s2, v15, s[2:3]
	v_mad_u64_u32 v[14:15], null, s17, v19, v[2:3]
	v_mul_lo_u32 v15, v19, s2
	v_add3_u32 v16, v2, v13, -2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v14, 31, v14
	v_ashrrev_i32_e32 v16, 31, v16
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v15, v14, v15
	v_add_nc_u32_e32 v13, v16, v13
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v15, v2, v15
	v_add3_u32 v13, v2, v13, -2
	v_add_nc_u32_e32 v2, s15, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_xor_b32_e32 v15, v15, v14
	v_xor_b32_e32 v13, v13, v16
	s_waitcnt vmcnt(0)
	v_add_f64 v[5:6], v[5:6], -v[7:8]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_hi_u32 v7, v15, v4
	v_mul_hi_u32 v8, v13, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v7, v7, s14
	v_mul_lo_u32 v8, v8, s14
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v7, v15, v7
	v_sub_nc_u32_e32 v8, v13, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_subrev_nc_u32_e32 v15, s14, v7
	v_cmp_le_u32_e32 vcc_lo, s14, v7
	v_subrev_nc_u32_e32 v13, s14, v8
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v7, v7, v15, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s14, v8
	v_subrev_nc_u32_e32 v15, s14, v7
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v8, v8, v13, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s14, v7
	v_mul_f64 v[5:6], v[0:1], v[5:6]
	v_subrev_nc_u32_e32 v13, s14, v8
	v_cndmask_b32_e32 v7, v7, v15, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s14, v8
	v_add_nc_u32_e32 v15, v20, v21
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_xor_b32_e32 v7, v7, v14
	v_cndmask_b32_e32 v8, v8, v13, vcc_lo
	v_mul_lo_u32 v13, v15, s2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_nc_u32_e32 v7, v7, v14
	v_xor_b32_e32 v8, v8, v16
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v7, v7, v13
	v_sub_nc_u32_e32 v8, v8, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v13, v8, v13
	v_ashrrev_i32_e32 v8, 31, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v14, 31, v13
	v_lshlrev_b64 v[7:8], 3, v[7:8]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[13:14], 3, v[13:14]
	v_add_co_u32 v7, vcc_lo, s4, v7
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v8, vcc_lo, s5, v8, vcc_lo
	v_add_co_u32 v13, vcc_lo, s4, v13
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_ci_u32_e32 v14, vcc_lo, s5, v14, vcc_lo
	global_store_b64 v[9:10], v[5:6], off
	s_clause 0x1
	global_load_b64 v[5:6], v[7:8], off
	global_load_b64 v[7:8], v[13:14], off
	s_waitcnt vmcnt(0)
	v_add_f64 v[5:6], v[5:6], -v[7:8]
	v_add_nc_u32_e32 v8, -1, v2
	v_add_co_u32 v7, vcc_lo, s10, v11
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cmp_le_i32_e64 s0, s12, v8
	v_add_co_ci_u32_e32 v8, vcc_lo, s11, v12, vcc_lo
	s_or_b32 s16, s0, s16
	v_mul_f64 v[5:6], v[0:1], v[5:6]
	global_store_b64 v[7:8], v[5:6], off
	s_and_not1_b32 exec_lo, exec_lo, s16
	s_cbranch_execnz .LBB0_2
.LBB0_3:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10phiToForcePdS_S_S_idd
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 312
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 25
		.amdhsa_next_free_sgpr 18
		.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	_Z10phiToForcePdS_S_S_idd, .Lfunc_end0-_Z10phiToForcePdS_S_S_idd
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1948
; NumSgprs: 20
; NumVgprs: 25
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 3
; NumSGPRsForWavesPerEU: 20
; NumVGPRsForWavesPerEU: 25
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z6overk2Pdiii          ; -- Begin function _Z6overk2Pdiii
	.globl	_Z6overk2Pdiii
	.p2align	8
	.type	_Z6overk2Pdiii,@function
_Z6overk2Pdiii:                         ; @_Z6overk2Pdiii
; %bb.0:
	s_clause 0x1
	s_load_b32 s8, s[0:1], 0x24
	s_load_b128 s[4:7], s[0:1], 0x8
	s_add_u32 s2, s0, 24
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s13, s8, 0xffff
	s_mul_i32 s11, s6, s5
	v_mad_u64_u32 v[1:2], null, s15, s13, v[0:1]
	s_mul_i32 s7, s11, s4
	s_mov_b32 s8, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s7, v1
	s_cbranch_execz .LBB1_5
; %bb.1:                                ; %.lr.ph
	s_ashr_i32 s8, s6, 31
	s_ashr_i32 s12, s5, 31
	s_ashr_i32 s9, s11, 31
	s_add_i32 s10, s6, s8
	s_add_i32 s14, s5, s12
	s_add_i32 s15, s11, s9
	s_xor_b32 s10, s10, s8
	s_xor_b32 s11, s14, s12
	s_xor_b32 s12, s15, s9
	v_cvt_f32_u32_e32 v0, s10
	v_cvt_f32_u32_e32 v2, s11
	v_cvt_f32_u32_e32 v3, s12
	s_load_b32 s14, s[2:3], 0x0
	s_sub_i32 s2, 0, s10
	v_rcp_iflag_f32_e32 v0, v0
	v_rcp_iflag_f32_e32 v2, v2
	v_rcp_iflag_f32_e32 v3, v3
	s_sub_i32 s3, 0, s11
	s_sub_i32 s15, 0, s12
	s_sub_i32 s6, 0, s6
	s_delay_alu instid0(TRANS32_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_mul_f32_e32 v0, 0x4f7ffffe, v0
	s_waitcnt_depctr 0xfff
	v_dual_mul_f32 v2, 0x4f7ffffe, v2 :: v_dual_mul_f32 v3, 0x4f7ffffe, v3
	v_cvt_u32_f32_e32 v0, v0
	v_cvt_u32_f32_e32 v2, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_u32_f32_e32 v3, v3
	v_mul_lo_u32 v4, s2, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_lo_u32 v5, s3, v2
	v_mul_lo_u32 v6, s15, v3
	s_load_b64 s[2:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s1, s14, s13
	s_mov_b32 s13, 0
	s_lshl_b32 s14, s1, 1
	v_mul_hi_u32 v4, v0, v4
	v_mul_hi_u32 v5, v2, v5
	v_mul_hi_u32 v6, v3, v6
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v0, v0, v4
	v_add_nc_u32_e32 v4, v2, v5
	s_delay_alu instid0(VALU_DEP_3)
	v_add_nc_u32_e32 v5, v3, v6
	v_lshlrev_b32_e32 v2, 1, v1
.LBB1_2:                                ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s15, exec_lo
	v_cmpx_ne_u32_e32 0, v1
	s_cbranch_execz .LBB1_4
; %bb.3:                                ;   in Loop: Header=BB1_2 Depth=1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[6:7], 3, v[2:3]
	v_ashrrev_i32_e32 v3, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v12, v1, v3
	v_add_co_u32 v10, vcc_lo, s2, v6
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v11, vcc_lo, s3, v7, vcc_lo
	v_xor_b32_e32 v12, v12, v3
	v_xor_b32_e32 v17, s8, v3
	v_xor_b32_e32 v3, s9, v3
	global_load_b128 v[6:9], v[10:11], off
	v_mul_hi_u32 v13, v12, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v14, v13, s10
	v_sub_nc_u32_e32 v14, v12, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v16, s10, v14
	v_cmp_le_u32_e32 vcc_lo, s10, v14
	v_dual_cndmask_b32 v14, v14, v16 :: v_dual_add_nc_u32 v15, 1, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v13, v13, v15, vcc_lo
	v_mul_hi_u32 v15, v12, v5
	v_cmp_le_u32_e32 vcc_lo, s10, v14
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v16, 1, v13
	v_mul_lo_u32 v14, v15, s12
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v13, v13, v16, vcc_lo
	v_xor_b32_e32 v13, v13, v17
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v12, v12, v14
	v_sub_nc_u32_e32 v18, v13, v17
	v_add_nc_u32_e32 v13, 1, v15
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_subrev_nc_u32_e32 v14, s12, v12
	v_cmp_le_u32_e32 vcc_lo, s12, v12
	v_ashrrev_i32_e32 v16, 31, v18
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_cndmask_b32 v13, v15, v13 :: v_dual_cndmask_b32 v12, v12, v14
	v_add_nc_u32_e32 v14, 1, v13
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_le_u32_e32 vcc_lo, s12, v12
	v_dual_cndmask_b32 v12, v13, v14 :: v_dual_add_nc_u32 v15, v18, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v15, v15, v16
	v_xor_b32_e32 v12, v12, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_hi_u32 v13, v15, v4
	v_sub_nc_u32_e32 v3, v12, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v12, v13, s11
	v_lshlrev_b32_e32 v13, 1, v3
	v_sub_nc_u32_e32 v14, s4, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_cmp_gt_i32_e32 vcc_lo, s4, v13
	v_sub_nc_u32_e32 v15, v15, v12
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v3, v14, v3, vcc_lo
	v_subrev_nc_u32_e32 v14, s11, v15
	v_cmp_le_u32_e32 vcc_lo, s11, v15
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_f64_i32_e32 v[12:13], v3
	v_cndmask_b32_e32 v3, v15, v14, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v14, s11, v3
	v_cmp_le_u32_e32 vcc_lo, s11, v3
	v_cndmask_b32_e32 v3, v3, v14, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v3, v3, v16
	v_sub_nc_u32_e32 v3, v3, v16
	v_mad_u64_u32 v[16:17], null, s6, v18, v[1:2]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_lshlrev_b32_e32 v14, 1, v3
	v_sub_nc_u32_e32 v15, s5, v3
	v_cvt_f64_i32_e32 v[16:17], v16
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_cmp_gt_i32_e32 vcc_lo, s5, v14
	v_mul_f64 v[12:13], v[12:13], v[12:13]
	v_cndmask_b32_e32 v3, v15, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f64_i32_e32 v[14:15], v3
	v_fma_f64 v[12:13], v[14:15], v[14:15], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f64 v[12:13], v[16:17], v[16:17], v[12:13]
	s_waitcnt vmcnt(0)
	v_div_scale_f64 v[14:15], null, v[12:13], v[12:13], v[6:7]
	v_div_scale_f64 v[16:17], null, v[12:13], v[12:13], v[8:9]
	v_div_scale_f64 v[26:27], vcc_lo, v[6:7], v[12:13], v[6:7]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_rcp_f64_e32 v[18:19], v[14:15]
	v_rcp_f64_e32 v[20:21], v[16:17]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[22:23], -v[14:15], v[18:19], 1.0
	v_fma_f64 v[24:25], -v[16:17], v[20:21], 1.0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[18:19], v[18:19], v[22:23], v[18:19]
	v_fma_f64 v[20:21], v[20:21], v[24:25], v[20:21]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[22:23], -v[14:15], v[18:19], 1.0
	v_fma_f64 v[24:25], -v[16:17], v[20:21], 1.0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_fma_f64 v[18:19], v[18:19], v[22:23], v[18:19]
	v_div_scale_f64 v[22:23], s0, v[8:9], v[12:13], v[8:9]
	v_fma_f64 v[20:21], v[20:21], v[24:25], v[20:21]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f64 v[24:25], v[26:27], v[18:19]
	v_mul_f64 v[28:29], v[22:23], v[20:21]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[14:15], -v[14:15], v[24:25], v[26:27]
	v_fma_f64 v[16:17], -v[16:17], v[28:29], v[22:23]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_fmas_f64 v[14:15], v[14:15], v[18:19], v[24:25]
	s_mov_b32 vcc_lo, s0
	v_div_fmas_f64 v[16:17], v[16:17], v[20:21], v[28:29]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_div_fixup_f64 v[6:7], v[14:15], v[12:13], v[6:7]
	v_div_fixup_f64 v[8:9], v[16:17], v[12:13], v[8:9]
	global_store_b128 v[10:11], v[6:9], off
.LBB1_4:                                ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s15
	v_add_nc_u32_e32 v1, s1, v1
	v_add_nc_u32_e32 v2, s14, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_le_i32_e32 vcc_lo, s7, v1
	s_or_b32 s13, vcc_lo, s13
	s_and_not1_b32 exec_lo, exec_lo, s13
	s_cbranch_execnz .LBB1_2
.LBB1_5:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6overk2Pdiii
		.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 30
		.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	_Z6overk2Pdiii, .Lfunc_end1-_Z6overk2Pdiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 988
; NumSgprs: 18
; NumVgprs: 30
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 3
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 30
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           8
        .value_kind:     by_value
      - .offset:         48
        .size:           8
        .value_kind:     by_value
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         60
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         64
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         68
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         70
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         72
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         74
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         76
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         78
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         120
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 312
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10phiToForcePdS_S_S_idd
    .private_segment_fixed_size: 0
    .sgpr_count:     20
    .sgpr_spill_count: 0
    .symbol:         _Z10phiToForcePdS_S_S_idd.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     25
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .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:           _Z6overk2Pdiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z6overk2Pdiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     30
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
