#include <stdio.h>
#include <string.h>
#include <cmath>
#include <iostream>
#include <fstream>

#include <ctime>
#include <random>
using namespace std;

//use seed from time to generate random values
std::mt19937 rng(time(0));

//used to set time to collision as a high value to indicate no collision
int const NO_VALUE = std::numeric_limits<int>::max();

//type of collision
enum CollType{NOCOLL, LEFTWALL, RIGHTWALL, TOPWALL, BOTTOMWALL, PARTCOLL};

//used to return what kind of collision happened with default values if
//a collision did not happen
struct Collision{
    //colliding particle #1 (only one colliding if hitting a wall)
    int partId1 = NO_VALUE;
    //colliding particle #2
    int partId2 = NO_VALUE;
    //tells if we collided with a particle, with which wall
    //or didn't collide
    CollType type = NOCOLL;
    //time it took to collide
    double t = NO_VALUE;
};

typedef enum {
    MODE_PRINT,
    MODE_PERF
} simulation_mode_t;

//used to present particles in the simulation
struct particle_t {
    int i = -1;
    double x = NO_VALUE;
    double y = NO_VALUE;
    double vx = NO_VALUE;
    double vy = NO_VALUE;
    int p_collisions = 0;
    int w_collisions = 0;
    bool collided = false ;
    bool stopPart = false;
};


__constant__ int l, r, s;
__constant__ int n;

__managed__ particle_t* particles;
__managed__ Collision wallCol;
__managed__ Collision partCol;
 
int host_n;

// device method to atomically set minimum float value
__device__ __forceinline__ float atomicMinD (float * addr, float value) {
        float old;
        old = (value >= 0) ? __int_as_float(atomicMin((int *)addr, __float_as_int(value))) :
             __uint_as_float(atomicMax((unsigned int *)addr, __float_as_uint(value)));

        return old;
} 
// device method to calculate wall collision time
__device__ Collision calcCollisionTime(particle_t &p1, int iL, int iR,  double t){
	   Collision rCol;
	   double l = iL;
	   double r = iR;
	   if(p1.vx < 0){
	   	   double t_help = (l - r - (l - p1.x))/(-p1.vx);
		   if(t_help >= 0. && t_help < t){
		   	     rCol.t = t_help;
			     rCol.type = LEFTWALL;
			     rCol.partId1 = p1.i;
		   }
	   }
	   if(p1.vx > 0){
	   	    double t_help = (l - r - p1.x)/p1.vx;
		    if(t_help >= 0. && t_help < t){
		    	      rCol.t = t_help;
			      rCol.type = RIGHTWALL;
			      rCol.partId1 = p1.i;
		    }
	   }
	   if(p1.vy < 0){
	   	    double t_help = (l - r - (l - p1.y))/(-p1.vy);
		    if(t_help >= 0. && t_help < t && t_help < rCol.t){
		    	      rCol.t = t_help;
			      rCol.type = BOTTOMWALL;
			      rCol.partId1 = p1.i;
		    }
	   }
	   if(p1.vy > 0){
	   	    double t_help = (l - r - p1.y)/p1.y;
		    if(t_help >= 0. && t_help < t && t_help < rCol.t){
		    	      rCol.t = t_help;
			      rCol.type = TOPWALL;
			      rCol.partId1 = p1.i;
		    }
	   }
	   return rCol;
}

// device method to calculate particle collision time
__device__ Collision calcCollisionTime(particle_t &p1, particle_t &p2, double t){
	   Collision rCol;
	   double a = (p2.vx-p1.vx)*(p2.vx-p1.vy) + (p2.vy-p1.vy)*(p2.vy-p1.vy);
	   double b = 2.0*((p2.x-p1.x)*(p2.vx-p1.vx) + (p2.y-p1.y)*(p2.vy-p1.vy));
	   double c = (p2.x-p1.x)*(p2.x-p1.x) + (p2.y-p1.y)*(p2.y-p1.y) - (2*r)*(2*r);
	   double det = b*b - 4*a*c;
	   if (a != 0){
	      double t_help = (-b - sqrt(det))/(2.0*a);
	      if (t_help >= 0. && t_help < t){
	      	 rCol.type = PARTCOLL;
		 rCol.t = t_help;
		 rCol.partId1 = p1.i;
		 rCol.partId2 = p2.i;
	      }
     	   }
	   return rCol;
}

// Method updates fastest wall or particle collision depending on thread block
__global__ void find_first_collisions(int num_threads, double t, int offset)
{
    __shared__ int helpN; // collision indexes that only gets a value in block 2
    int newN = NO_VALUE;

    Collision retCol; // fastest collision within thread

    __shared__ float blocktime; // fastest time in block
    if (threadIdx.x == 0)
	blocktime = NO_VALUE;
	helpN = NO_VALUE;
    //barrier to ensure blocktime is initialized to a comparable default before continuing
    __syncthreads();

    int index = threadIdx.x;
    if (n > num_threads){
        index += offset;
    }

    //wall collision, checked by 1st block
    if(blockIdx.x == 0 && index < n){
        //If particle is stopped at a wall it can be ignored
        if(!particles[index].stopPart){
            retCol = calcCollisionTime(particles[index], l, r, t);

	    // comparing to remove collisions that are too slow to need atomic comparing
            if (retCol.type != NOCOLL && (float) retCol.t < blocktime) {
                atomicMinD(&blocktime, (float) retCol.t);
            }
        }
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////
    //Block2 used to calculate particle-particle collisions
    else if(blockIdx.x == 1 && index < n){

        //if hasn't collided yet
        if(!particles[index].collided){

            //find collision time with each particle
            for(int j=0; j<n; j++){
		if (particles[index].i == particles[j].i) {
		    continue;
		}
                //neither particle has collided yet
                if(!particles[index].collided && !particles[j].collided){
		    retCol = calcCollisionTime(particles[index], particles[j], t);
                }
            }
        }

        if (retCol.type == PARTCOLL && (float) retCol.t < blocktime){
            // atomic compare & replace fastest block time to found time if sooner
            // float conversion needed to further convert into int for atomicMin
            atomicMinD(&blocktime, (float) retCol.t);
        }
    }
    // barrier must be done outside of conditional
    __syncthreads();

    // if there was a particle collision
    // and this thread's collision time = the block minimum
    if(retCol.type == PARTCOLL && (float) retCol.t == blocktime){
        // calculate and compare index of collision
        newN = retCol.partId1 + retCol.partId2;
	//if new N is the same as current (reverse of existing collision or different collision with the same col index), void N 
        if(atomicMin(&helpN, newN) == newN){
	    newN = NO_VALUE;
	} else {
	  //printf("th%i p%i t%f N%i compared with N%i\n", threadIdx.x, index, blocktime, newN, helpN);
	}
    }
    // else if particle did collide with a wall (retCol has a value)
    // and thread's collision time = the block minimum
    else if (retCol.type != NOCOLL && (float) retCol.t == blocktime){
        // if kernel is being run the first time (shortcircuits to save global access)
        // or global wall collision is later
        if(offset == 0 || wallCol.t > retCol.t){
            // update rest of wallCol struct
	    wallCol.t = retCol.t;
            wallCol.type = retCol.type;
            wallCol.partId1 = retCol.partId1;
        }
    }
    // make sure all the fastest threads in particle block have compared indexes
    __syncthreads();
    // if this thread has a collision index and it's the chosen one
    // not accounting for identical indexes here, only 1 col should execute
    if (newN != NO_VALUE && newN == helpN) {
        // if kernel is being run the first time (shortcircuits to save global access)
        // or global particle collision is later
        if(offset == 0 || partCol.t > retCol.t){
            // update partCol
            partCol.type = PARTCOLL;
            partCol.t = retCol.t;
	    partCol.partId1 = retCol.partId1;
	    partCol.partId2 = retCol.partId2;
	    //printf("partCol updated\n");
        }
    }
}

// advances particles in parallel
__global__ void advanceParticlesP(int num_threads, double t, int offset){
    int i = threadIdx.x + blockIdx.x*num_threads + offset;
    if (i < n && !particles[i].stopPart){
        particles[i].y += particles[i].vy*t;	
        particles[i].x += particles[i].vx*t;
    }
}

__host__ void checkCudaErrors() {
    cudaError_t rc;
    rc = cudaGetLastError();
    if (rc != cudaSuccess)
    {
        printf("Last CUDA error %s\n", cudaGetErrorString(rc));
    }
}

__host__ void print_particles(int step)
{
    int i;
    for (i = 0; i < host_n; i++) {
        printf("%d %d %f %f %f %f\n", step, i, particles[i].x, particles[i].y,
               particles[i].vx, particles[i].vy);
    }
}

__host__ void print_statistics(int num_step)
{
    int i;
    for (i = 0; i < host_n; i++) {
        printf("%d %d %f %f %f %f %d %d\n", num_step, i, particles[i].x,
               particles[i].y, particles[i].vx, particles[i].vy,
               particles[i].p_collisions, particles[i].w_collisions);
    }
}

// returns soonest out of fastest wall and particle collisions
__host__ Collision whichCollision()
{
    //If both collisions happen, choose the earlier one
    if(wallCol.type != NOCOLL && partCol.type == PARTCOLL){

        //NOW WE PREFER WALLCOL IF BOTH T ARE SAME
        if(wallCol.t <= partCol.t){
            return wallCol;
        }
        else {
            return partCol;
        }
    }

    //only one happened
    if(wallCol.type != NOCOLL){
        return wallCol;
    }
    return partCol;

    //if no collisions happened the returned partCol
    //will have default info, this is checked later and no collision is done
}

__host__ void resetUnifiedCols(){
    wallCol.type = NOCOLL;
    wallCol.t = NO_VALUE;
    wallCol.partId1 = NO_VALUE;
    partCol.type = NOCOLL;
    partCol.t = NO_VALUE;
    partCol.partId1 = NO_VALUE;
    partCol.partId2 = NO_VALUE;
}

__host__ void collideParticles(particle_t &p1, particle_t &p2)
{
    //printf("colliding particles %i and %i, at %fx%f and %fx%f\n", p1.i, p2.i, p1.x, p1.y, p2.x, p2.y);

    //projecting the velocity unit normal and unit tangent vectors onto the unit
    //normal and unit tangent vectors, which is done by taking the dot product
    double vnx = (p2.x - p1.x);
    double vny = (p2.y - p1.y);
    double length = std::sqrt(vnx*vnx + vny*vny);
    double vunx = 0;
    double vuny = 0;
    if (length != 0){
    	vunx = vnx/length;
    	vuny = vny/length;
    }
    double vutx = -vuny;
    double vuty = vunx;
    //printf("normal unit %fx%f, length %f, tangent unit %fx%f\n", vunx, vuny, length, vutx, vuty);
    //dot products
    double v1n = vunx*p1.vx + vuny*p1.vy;
    double v2n = vunx*p2.vx + vuny*p2.vy;
    double v1t = vutx*p1.vx + vuty*p1.vy;
    double v2t = vutx*p2.vx + vuty*p2.vy;
    //double v1n = vun.dot(p1.v);
    //double v2n = vun.dot(p2.v);
    //double v1t = vut.dot(p1.v);
    //double v2t = vut.dot(p2.v);

    //find the new tangential velocities (after the collision).
    double v1tPrime = v1t;
    double v2tPrime = v2t;

    //find the new normal velocities.
    //this is where we use the one-dimensional collision formulas.
    //for m1 = m2 we get
    double v1nPrime = v2n;
    double v2nPrime = v1n;

    //convert the scalar normal and tangential velocities into vectors.
    //multiply the unit normal vector by the scalar normal velocity
    double v_v1nPrimex = v1nPrime*vunx;
    double v_v1nPrimey = v1nPrime*vuny;
    double v_v2nPrimex = v2nPrime*vunx;
    double v_v2nPrimey = v2nPrime*vuny;

    double v_v1tPrimex = v1tPrime*vutx;
    double v_v1tPrimey = v1tPrime*vuty;
    double v_v2tPrimex = v2tPrime*vutx;
    double v_v2tPrimey = v2tPrime*vuty;

    //the final velocity vectors by adding the normal and tangential
    //components for each object
    p1.vx = v_v1nPrimex + v_v1tPrimex;
    p1.vy = v_v1nPrimey + v_v1tPrimey;
    p2.vx = v_v2nPrimex + v_v2tPrimex;
    p2.vy = v_v2nPrimey + v_v2tPrimey;

    //info that collided in cycle and up the collision count
    p1.collided = true;
    p1.p_collisions += 1;
    p2.collided = true;
    p2.p_collisions += 1;
}


//collides given particle with the given wall (changes the velociy)
__host__ void collideWall(int i, CollType col)
{
    //info that collided in cycle and up the collision count
    particles[i].collided = true;
    particles[i].w_collisions += 1;

    //fabs returns the absolute value
    //depending on which wall is hit, either vx or vy will
    //change sign
    if(col == LEFTWALL){
        particles[i].vx = fabs(particles[i].vx);
    }

    else if (col == RIGHTWALL){
        particles[i].vx = -fabs(particles[i].vx);
    }

    else if (col == TOPWALL){
        particles[i].vy = -fabs(particles[i].vy);
    }

    else if (col == BOTTOMWALL){
        particles[i].vy = fabs(particles[i].vy);
    }

}

///////////////////////////////////////////////////////////////
int main(int argc, char** argv)
{
    int i, x, y, vx, vy;
    int num_blocks, num_threads;
    int step, offset;
    int host_l, host_r, host_s;
    simulation_mode_t mode;
    char mode_buf[6];

    if (argc == 2){
    	num_threads = atoi(argv[1]);
    } else if (argc == 1){
	num_threads = 512;
    } else {
        printf("Usage:\n%s (optional) num_threads < input\n", argv[0]);
        return 1;
    }

    scanf("%d", &host_n);
    scanf("%d", &host_l);
    scanf("%d", &host_r);
    scanf("%d", &host_s);
    scanf("%5s", mode_buf);

    // blocks to address all particles with the given number of threads = ratio rounded up
    num_blocks = ceil((float)num_threads/(float)host_n);

    printf("%d particles, %d threads per block, %d blocks.\n", host_n, num_threads, num_blocks);

    cudaMallocManaged(&particles, sizeof(particle_t) * host_n);

    for (i = 0; i < host_n; i++) {
        particles[i].i = -1;
        particles[i].p_collisions = 0;
        particles[i].w_collisions = 0;
    }

    i = 0; //added
    while (scanf("%d %d %d %d %d", &i, &x, &y, &vx, &vy) != EOF) {
        particles[i].i = i;
        particles[i].x = x;
        particles[i].y = y;
        particles[i].vx = vx;
        particles[i].vy = vy;
    }

    if (particles[0].i == -1) {
        //generate a distribution for random values in given range
        std::uniform_int_distribution<int> dist_pos(host_r,host_l-host_r);

        std::uniform_int_distribution<int> dist_v(host_l/(8*host_r), host_l/4);

        //Generate particles and store into data structure
        for(int j = 0; j < host_n; j++){

            x=dist_pos(rng);
            y=dist_pos(rng);
            vx=dist_v(rng);
            vy=dist_v(rng);

            particles[j].i = j;
            particles[j].x = x;
            particles[j].y = y;
            particles[j].vx = vx;
            particles[j].vy = vy;
        }
    }

    mode = strcmp(mode_buf, "print") == 0 ? MODE_PRINT : MODE_PERF;

        /* Copy to GPU constant memory */
    cudaMemcpyToSymbol(n, &host_n, sizeof(n));
    cudaMemcpyToSymbol(l, &host_l, sizeof(l));
    cudaMemcpyToSymbol(r, &host_r, sizeof(r));
    cudaMemcpyToSymbol(s, &host_s, sizeof(s));

    //printf("particles%i size%i radius%i steps%i\n", host_n, host_l, host_r, host_s);
        //simulation of step
    for (step = 0; step < host_s; step++) {
        if (mode == MODE_PRINT || step == 0) {
           print_particles(step);
        }

        for (i = 0; i < host_n; i++) {
      	  particles[i].collided = false;
          particles[i].stopPart = false;
        }

        double tMoved = 0.0;
        Collision deviceCol;

            //loop while within the step
        while(tMoved < 1.0){

            // if number of particles is less than threads:
        
            // one block for each calculation will suffice
            // one block of N threads for wall collisions, one for particle
            // kernel is called with 2 blocks, numthreads in 1D each block
            // if block1/block2 statement seperates wall and particle collisions
            // syncthreads breaks up block seperation, then it returns to update wall/partCol

            // if particles exceeds threads:
            // a new grid is created with code to start at offset of particles already addressed.
            // each section of [numthreads] particles is calculated sequentially.
            for (offset = 0; offset < host_n; offset += num_threads) {
                /* Call the kernel */
                find_first_collisions<<<2, num_threads>>>(num_threads, 1.0-tMoved, offset);
                //printf("Step %i tMoved %lf\n", step, tMoved);
                /* Barrier */
                cudaDeviceSynchronize();
		        checkCudaErrors();
            }

            deviceCol = whichCollision();
	    resetUnifiedCols();

            //we had a collision
            if(deviceCol.type != NOCOLL && deviceCol.t >= 0){

	    	    //printf("returned collision type %i in %f\n", deviceCol.type, deviceCol.t);

                //move particles until collision time, using particle index offset if threads < n
                for (offset = 0; offset < host_n; offset += num_blocks*num_threads){
                    advanceParticlesP<<<num_blocks, num_threads>>>(num_threads, deviceCol.t, offset);
                    cudaDeviceSynchronize();
                    checkCudaErrors();
//printf("advancing: t%d b%d time%lf, offset%d\n", num_threads, num_blocks, deviceCol.t, offset);
                }
		//advanceParticles(deviceCol.t);
                tMoved += deviceCol.t;

                    //Collision between 2 particles
                if(deviceCol.type == PARTCOLL){
                    collideParticles(particles[deviceCol.partId1], particles[deviceCol.partId2]);
                }

                    //wall collision
                else {
                    //If particle hasn't collided yet
                    if(!particles[deviceCol.partId1].collided){
                        collideWall(deviceCol.partId1, deviceCol.type);
                    }

                    //If it has, we need to stop it's movement at the wall
                    else{
                        particles[deviceCol.partId1].stopPart = true;
                    }
                }
            }
            else {
                //no remaining collisions so advance to end of step
		for (offset = 0; offset < host_n; offset += num_blocks*num_threads){
                    advanceParticlesP<<<num_blocks, num_threads>>>(num_threads, 1 - tMoved, offset);
                    cudaDeviceSynchronize();
                    checkCudaErrors();
            	}
		tMoved = 1;
            }
    	}
    }
    print_statistics(host_s);
    return 0;
}










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

#NO_APP
	.type	_ZL20__nv_init_managed_rtv, @function
_ZL20__nv_init_managed_rtv:
.LFB1:
	.cfi_startproc
	movb	_ZL22__nv_inited_managed_rt(%rip), %al
	testb	%al, %al
	jne	.L4
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	_ZL32__nv_fatbinhandle_for_managed_rt(%rip), %rdi
	call	__cudaInitModule@PLT
	movb	%al, _ZL22__nv_inited_managed_rt(%rip)
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
.L4:
	movb	%al, _ZL22__nv_inited_managed_rt(%rip)
	ret
	.cfi_endproc
.LFE1:
	.size	_ZL20__nv_init_managed_rtv, .-_ZL20__nv_init_managed_rtv
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4866:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4866:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z17calcCollisionTimeR10particle_tiid
	.type	_Z17calcCollisionTimeR10particle_tiid, @function
_Z17calcCollisionTimeR10particle_tiid:
.LFB4851:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4851:
	.size	_Z17calcCollisionTimeR10particle_tiid, .-_Z17calcCollisionTimeR10particle_tiid
	.globl	_Z17calcCollisionTimeR10particle_tS0_d
	.type	_Z17calcCollisionTimeR10particle_tS0_d, @function
_Z17calcCollisionTimeR10particle_tS0_d:
.LFB4852:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4852:
	.size	_Z17calcCollisionTimeR10particle_tS0_d, .-_Z17calcCollisionTimeR10particle_tS0_d
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Last CUDA error %s\n"
	.text
	.globl	_Z15checkCudaErrorsv
	.type	_Z15checkCudaErrorsv, @function
_Z15checkCudaErrorsv:
.LFB4853:
	.cfi_startproc
	endbr64
	pushq	%rsi
	.cfi_def_cfa_offset 16
	call	cudaGetLastError@PLT
	testl	%eax, %eax
	je	.L13
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	popq	%rcx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	movq	%rax, %rdx
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
.L13:
	.cfi_restore_state
	popq	%rax
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4853:
	.size	_Z15checkCudaErrorsv, .-_Z15checkCudaErrorsv
	.section	.rodata.str1.1
.LC1:
	.string	"%d %d %f %f %f %f\n"
	.text
	.globl	_Z15print_particlesi
	.type	_Z15print_particlesi, @function
_Z15print_particlesi:
.LFB4854:
	.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
	leaq	.LC1(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%edi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
.L17:
	cmpl	%ebx, host_n(%rip)
	movl	%ebx, %r13d
	jle	.L24
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L18
	call	_ZL20__nv_init_managed_rtv
.L18:
	movq	_ZL9particles(%rip), %rax
	imulq	$56, %rbx, %rbp
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movsd	32(%rax,%rbp), %xmm4
	movq	%xmm4, %r15
	jne	.L19
	call	_ZL20__nv_init_managed_rtv
.L19:
	movq	_ZL9particles(%rip), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movsd	24(%rax,%rbp), %xmm2
	jne	.L20
	movsd	%xmm2, (%rsp)
	call	_ZL20__nv_init_managed_rtv
	movsd	(%rsp), %xmm2
.L20:
	movq	_ZL9particles(%rip), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movsd	16(%rax,%rbp), %xmm1
	jne	.L21
	movsd	%xmm1, 8(%rsp)
	movsd	%xmm2, (%rsp)
	call	_ZL20__nv_init_managed_rtv
	movsd	8(%rsp), %xmm1
	movsd	(%rsp), %xmm2
.L21:
	movq	_ZL9particles(%rip), %rax
	movl	%r13d, %ecx
	movl	%r12d, %edx
	movq	%r14, %rsi
	movq	%r15, %xmm3
	movl	$2, %edi
	incq	%rbx
	movq	(%rax), %rax
	movsd	8(%rax,%rbp), %xmm0
	movb	$4, %al
	call	__printf_chk@PLT
	jmp	.L17
.L24:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4854:
	.size	_Z15print_particlesi, .-_Z15print_particlesi
	.section	.rodata.str1.1
.LC2:
	.string	"%d %d %f %f %f %f %d %d\n"
	.text
	.globl	_Z16print_statisticsi
	.type	_Z16print_statisticsi, @function
_Z16print_statisticsi:
.LFB4855:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edi, %r15d
	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
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
.L26:
	cmpl	%ebp, host_n(%rip)
	movl	%ebp, 12(%rsp)
	jle	.L35
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L27
	call	_ZL20__nv_init_managed_rtv
.L27:
	movq	_ZL9particles(%rip), %rax
	imulq	$56, %rbp, %rbx
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movl	44(%rax,%rbx), %r14d
	jne	.L28
	call	_ZL20__nv_init_managed_rtv
.L28:
	movq	_ZL9particles(%rip), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movl	40(%rax,%rbx), %r13d
	jne	.L29
	call	_ZL20__nv_init_managed_rtv
.L29:
	movq	_ZL9particles(%rip), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movsd	32(%rax,%rbx), %xmm4
	movsd	%xmm4, (%rsp)
	jne	.L30
	call	_ZL20__nv_init_managed_rtv
.L30:
	movq	_ZL9particles(%rip), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movsd	24(%rax,%rbx), %xmm2
	jne	.L31
	movsd	%xmm2, 16(%rsp)
	call	_ZL20__nv_init_managed_rtv
	movsd	16(%rsp), %xmm2
.L31:
	movq	_ZL9particles(%rip), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movsd	16(%rax,%rbx), %xmm1
	jne	.L32
	movsd	%xmm1, 24(%rsp)
	movsd	%xmm2, 16(%rsp)
	call	_ZL20__nv_init_managed_rtv
	movsd	24(%rsp), %xmm1
	movsd	16(%rsp), %xmm2
.L32:
	movq	_ZL9particles(%rip), %rax
	movl	%r14d, %r9d
	movl	%r13d, %r8d
	movl	%r15d, %edx
	movsd	(%rsp), %xmm3
	movl	12(%rsp), %ecx
	movq	%r12, %rsi
	incq	%rbp
	movq	(%rax), %rax
	movl	$2, %edi
	movsd	8(%rax,%rbx), %xmm0
	movb	$4, %al
	call	__printf_chk@PLT
	jmp	.L26
.L35:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4855:
	.size	_Z16print_statisticsi, .-_Z16print_statisticsi
	.globl	_Z14whichCollisionv
	.type	_Z14whichCollisionv, @function
_Z14whichCollisionv:
.LFB4856:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L37
	call	_ZL20__nv_init_managed_rtv
.L37:
	movq	_ZL7wallCol(%rip), %rdx
	movb	_ZL22__nv_inited_managed_rt(%rip), %al
	cmpl	$0, 8(%rdx)
	je	.L38
	testb	%al, %al
	jne	.L39
	call	_ZL20__nv_init_managed_rtv
.L39:
	movq	_ZL7partCol(%rip), %rdx
	movb	_ZL22__nv_inited_managed_rt(%rip), %al
	cmpl	$5, 8(%rdx)
	jne	.L38
	testb	%al, %al
	jne	.L40
	call	_ZL20__nv_init_managed_rtv
	jmp	.L40
.L38:
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L42
	call	_ZL20__nv_init_managed_rtv
	jmp	.L42
.L40:
	movq	_ZL7wallCol(%rip), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movsd	16(%rax), %xmm1
	movsd	%xmm1, 8(%rsp)
	jne	.L44
	call	_ZL20__nv_init_managed_rtv
.L44:
	movq	_ZL7partCol(%rip), %rdx
	movb	_ZL22__nv_inited_managed_rt(%rip), %al
	movsd	16(%rdx), %xmm0
	comisd	8(%rsp), %xmm0
	jb	.L56
	testb	%al, %al
	jne	.L47
	call	_ZL20__nv_init_managed_rtv
.L47:
	movq	_ZL7wallCol(%rip), %rax
	movups	(%rax), %xmm3
	movups	%xmm3, (%rbx)
	jmp	.L58
.L56:
	testb	%al, %al
	jne	.L49
	call	_ZL20__nv_init_managed_rtv
.L49:
	movq	_ZL7partCol(%rip), %rax
	movups	(%rax), %xmm4
	movups	%xmm4, (%rbx)
	jmp	.L58
.L42:
	movq	_ZL7wallCol(%rip), %rdx
	movb	_ZL22__nv_inited_managed_rt(%rip), %al
	cmpl	$0, 8(%rdx)
	je	.L50
	testb	%al, %al
	jne	.L51
	call	_ZL20__nv_init_managed_rtv
.L51:
	movq	_ZL7wallCol(%rip), %rax
	movups	(%rax), %xmm5
	movups	%xmm5, (%rbx)
	jmp	.L58
.L50:
	testb	%al, %al
	jne	.L52
	call	_ZL20__nv_init_managed_rtv
.L52:
	movq	_ZL7partCol(%rip), %rax
	movups	(%rax), %xmm6
	movups	%xmm6, (%rbx)
.L58:
	movq	16(%rax), %rax
	movq	%rax, 16(%rbx)
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4856:
	.size	_Z14whichCollisionv, .-_Z14whichCollisionv
	.globl	_Z16resetUnifiedColsv
	.type	_Z16resetUnifiedColsv, @function
_Z16resetUnifiedColsv:
.LFB4857:
	.cfi_startproc
	endbr64
	pushq	%rsi
	.cfi_def_cfa_offset 16
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L60
	call	_ZL20__nv_init_managed_rtv
.L60:
	movq	_ZL7wallCol(%rip), %rax
	xorl	%ecx, %ecx
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movl	%ecx, 8(%rax)
	jne	.L61
	call	_ZL20__nv_init_managed_rtv
.L61:
	movq	_ZL7wallCol(%rip), %rax
	movq	.LC3(%rip), %rdx
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	%rdx, 16(%rax)
	jne	.L62
	call	_ZL20__nv_init_managed_rtv
.L62:
	movq	_ZL7wallCol(%rip), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movl	$2147483647, (%rax)
	jne	.L63
	call	_ZL20__nv_init_managed_rtv
.L63:
	movq	_ZL7partCol(%rip), %rax
	xorl	%edx, %edx
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movl	%edx, 8(%rax)
	jne	.L64
	call	_ZL20__nv_init_managed_rtv
.L64:
	movq	_ZL7partCol(%rip), %rax
	movq	.LC3(%rip), %rcx
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	%rcx, 16(%rax)
	jne	.L65
	call	_ZL20__nv_init_managed_rtv
.L65:
	movq	_ZL7partCol(%rip), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movl	$2147483647, (%rax)
	jne	.L66
	call	_ZL20__nv_init_managed_rtv
.L66:
	movq	_ZL7partCol(%rip), %rax
	movl	$2147483647, 4(%rax)
	popq	%rax
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4857:
	.size	_Z16resetUnifiedColsv, .-_Z16resetUnifiedColsv
	.globl	_Z16collideParticlesR10particle_tS0_
	.type	_Z16collideParticlesR10particle_tS0_, @function
_Z16collideParticlesR10particle_tS0_:
.LFB4858:
	.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
	movq	%rsi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movsd	8(%rsi), %xmm1
	movsd	16(%rsi), %xmm2
	subsd	8(%rdi), %xmm1
	subsd	16(%rdi), %xmm2
	movaps	%xmm1, %xmm0
	movaps	%xmm2, %xmm3
	movsd	%xmm1, 8(%rsp)
	mulsd	%xmm2, %xmm3
	movsd	%xmm2, (%rsp)
	mulsd	%xmm1, %xmm0
	addsd	%xmm3, %xmm0
	call	sqrt@PLT
	xorps	%xmm3, %xmm3
	movsd	(%rsp), %xmm2
	movsd	8(%rsp), %xmm1
	ucomisd	%xmm3, %xmm0
	jp	.L72
	je	.L71
.L72:
	divsd	%xmm0, %xmm1
	divsd	%xmm0, %xmm2
	jmp	.L69
.L71:
	xorps	%xmm2, %xmm2
	movaps	%xmm2, %xmm1
.L69:
	movsd	24(%rbp), %xmm0
	movsd	32(%rbp), %xmm8
	movaps	%xmm2, %xmm7
	movsd	24(%rbx), %xmm4
	movsd	32(%rbx), %xmm5
	movaps	%xmm0, %xmm6
	movaps	%xmm8, %xmm3
	xorps	.LC5(%rip), %xmm7
	mulsd	%xmm2, %xmm3
	movaps	%xmm5, %xmm9
	mulsd	%xmm1, %xmm6
	mulsd	%xmm1, %xmm8
	mulsd	%xmm2, %xmm9
	mulsd	%xmm7, %xmm0
	mulsd	%xmm1, %xmm5
	addsd	%xmm3, %xmm6
	movaps	%xmm4, %xmm3
	mulsd	%xmm1, %xmm3
	mulsd	%xmm7, %xmm4
	addsd	%xmm8, %xmm0
	movaps	%xmm7, %xmm8
	addsd	%xmm9, %xmm3
	mulsd	%xmm0, %xmm8
	addsd	%xmm5, %xmm4
	mulsd	%xmm1, %xmm0
	movaps	%xmm1, %xmm5
	mulsd	%xmm3, %xmm5
	mulsd	%xmm2, %xmm3
	mulsd	%xmm4, %xmm7
	mulsd	%xmm6, %xmm2
	addsd	%xmm8, %xmm5
	addsd	%xmm0, %xmm3
	movsd	%xmm5, 24(%rbp)
	movsd	%xmm3, 32(%rbp)
	movaps	%xmm1, %xmm3
	mulsd	%xmm6, %xmm3
	mulsd	%xmm4, %xmm1
	addsd	%xmm7, %xmm3
	addsd	%xmm1, %xmm2
	movsd	%xmm3, 24(%rbx)
	movsd	%xmm2, 32(%rbx)
	incl	40(%rbp)
	movb	$1, 48(%rbp)
	incl	40(%rbx)
	movb	$1, 48(%rbx)
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4858:
	.size	_Z16collideParticlesR10particle_tS0_, .-_Z16collideParticlesR10particle_tS0_
	.globl	_Z11collideWalli8CollType
	.type	_Z11collideWalli8CollType, @function
_Z11collideWalli8CollType:
.LFB4859:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%edi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L75
	call	_ZL20__nv_init_managed_rtv
.L75:
	movq	_ZL9particles(%rip), %rax
	imulq	$56, %rbx, %rbx
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movb	$1, 48(%rax,%rbx)
	jne	.L76
	call	_ZL20__nv_init_managed_rtv
.L76:
	movq	_ZL9particles(%rip), %rax
	movq	(%rax), %rdx
	addq	%rbx, %rdx
	incl	44(%rdx)
	cmpl	$1, %ebp
	jne	.L77
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L78
	call	_ZL20__nv_init_managed_rtv
.L78:
	movq	_ZL9particles(%rip), %rax
	movq	(%rax), %rax
	movsd	24(%rax,%rbx), %xmm0
	andps	.LC6(%rip), %xmm0
	jmp	.L91
.L77:
	cmpl	$2, %ebp
	jne	.L81
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L82
	call	_ZL20__nv_init_managed_rtv
.L82:
	movq	_ZL9particles(%rip), %rax
	movq	(%rax), %rax
	movsd	24(%rax,%rbx), %xmm0
	orps	.LC5(%rip), %xmm0
.L91:
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L83
	movsd	%xmm0, 8(%rsp)
	call	_ZL20__nv_init_managed_rtv
	movsd	8(%rsp), %xmm0
.L83:
	movq	_ZL9particles(%rip), %rax
	movq	(%rax), %rax
	movsd	%xmm0, 24(%rax,%rbx)
	jmp	.L74
.L81:
	cmpl	$3, %ebp
	jne	.L84
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L85
	call	_ZL20__nv_init_managed_rtv
.L85:
	movq	_ZL9particles(%rip), %rax
	movq	(%rax), %rax
	movsd	32(%rax,%rbx), %xmm0
	orps	.LC5(%rip), %xmm0
	jmp	.L93
.L84:
	cmpl	$4, %ebp
	jne	.L74
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L87
	call	_ZL20__nv_init_managed_rtv
.L87:
	movq	_ZL9particles(%rip), %rax
	movq	(%rax), %rax
	movsd	32(%rax,%rbx), %xmm0
	andps	.LC6(%rip), %xmm0
.L93:
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L88
	movsd	%xmm0, 8(%rsp)
	call	_ZL20__nv_init_managed_rtv
	movsd	8(%rsp), %xmm0
.L88:
	movq	_ZL9particles(%rip), %rax
	movq	(%rax), %rax
	movsd	%xmm0, 32(%rax,%rbx)
.L74:
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4859:
	.size	_Z11collideWalli8CollType, .-_Z11collideWalli8CollType
	.globl	_Z42__device_stub__Z21find_first_collisionsidiidi
	.type	_Z42__device_stub__Z21find_first_collisionsidiidi, @function
_Z42__device_stub__Z21find_first_collisionsidiidi:
.LFB4888:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movl	%edi, 12(%rsp)
	leaq	24(%rsp), %rcx
	leaq	16(%rsp), %rdx
	movl	%esi, 8(%rsp)
	leaq	32(%rsp), %rdi
	leaq	44(%rsp), %rsi
	movsd	%xmm0, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rax
	movl	$1, 40(%rsp)
	movq	%rax, 80(%rsp)
	movq	%rsp, %rax
	movq	%rax, 88(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L94
	pushq	24(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z21find_first_collisionsidi(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 144
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L94:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L96
	call	__stack_chk_fail@PLT
.L96:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4888:
	.size	_Z42__device_stub__Z21find_first_collisionsidiidi, .-_Z42__device_stub__Z21find_first_collisionsidiidi
	.globl	_Z21find_first_collisionsidi
	.type	_Z21find_first_collisionsidi, @function
_Z21find_first_collisionsidi:
.LFB4889:
	.cfi_startproc
	endbr64
	jmp	_Z42__device_stub__Z21find_first_collisionsidiidi
	.cfi_endproc
.LFE4889:
	.size	_Z21find_first_collisionsidi, .-_Z21find_first_collisionsidi
	.globl	_Z38__device_stub__Z17advanceParticlesPidiidi
	.type	_Z38__device_stub__Z17advanceParticlesPidiidi, @function
_Z38__device_stub__Z17advanceParticlesPidiidi:
.LFB4890:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movl	%edi, 12(%rsp)
	leaq	24(%rsp), %rcx
	leaq	16(%rsp), %rdx
	movl	%esi, 8(%rsp)
	leaq	32(%rsp), %rdi
	leaq	44(%rsp), %rsi
	movsd	%xmm0, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rax
	movl	$1, 40(%rsp)
	movq	%rax, 80(%rsp)
	movq	%rsp, %rax
	movq	%rax, 88(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L99
	pushq	24(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z17advanceParticlesPidi(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 144
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L99:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L101
	call	__stack_chk_fail@PLT
.L101:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4890:
	.size	_Z38__device_stub__Z17advanceParticlesPidiidi, .-_Z38__device_stub__Z17advanceParticlesPidiidi
	.globl	_Z17advanceParticlesPidi
	.type	_Z17advanceParticlesPidi, @function
_Z17advanceParticlesPidi:
.LFB4891:
	.cfi_startproc
	endbr64
	jmp	_Z38__device_stub__Z17advanceParticlesPidiidi
	.cfi_endproc
.LFE4891:
	.size	_Z17advanceParticlesPidi, .-_Z17advanceParticlesPidi
	.section	.rodata.str1.1
.LC7:
	.string	"_Z17advanceParticlesPidi"
.LC8:
	.string	"_Z21find_first_collisionsidi"
.LC9:
	.string	"l"
.LC10:
	.string	"r"
.LC11:
	.string	"s"
.LC12:
	.string	"n"
.LC13:
	.string	"particles"
.LC14:
	.string	"wallCol"
.LC15:
	.string	"partCol"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4893:
	.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	.LC7(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z17advanceParticlesPidi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	movq	%rax, _ZL32__nv_fatbinhandle_for_managed_rt(%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	.LC8(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z21find_first_collisionsidi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC9(%rip), %rdx
	movl	$4, %r9d
	leaq	_ZL1l(%rip), %rsi
	pushq	$1
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC10(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL1r(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC11(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL1s(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rdi
	.cfi_def_cfa_offset 24
	popq	%r8
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC12(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL1n(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%r9
	.cfi_def_cfa_offset 24
	popq	%r10
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC13(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$8, %r9d
	leaq	_ZL9particles(%rip), %rsi
	call	__cudaRegisterManagedVar@PLT
	popq	%r11
	.cfi_def_cfa_offset 24
	popq	%rax
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC14(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$24, %r9d
	leaq	_ZL7wallCol(%rip), %rsi
	call	__cudaRegisterManagedVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC15(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$24, %r9d
	leaq	_ZL7partCol(%rip), %rsi
	call	__cudaRegisterManagedVar@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.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
.LFE4893:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv,"axG",@progbits,_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv,comdat
	.align 2
	.weak	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv
	.type	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv, @function
_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv:
.LFB5557:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	xorl	%edx, %edx
	movl	$2567483615, %edi
.L108:
	movq	(%rax,%rdx,8), %rsi
	incq	%rdx
	movq	(%rax,%rdx,8), %rcx
	andq	$-2147483648, %rsi
	andl	$2147483647, %ecx
	orq	%rsi, %rcx
	movq	%rcx, %rsi
	shrq	%rsi
	xorq	3168(%rax,%rdx,8), %rsi
	andl	$1, %ecx
	je	.L107
	movq	%rdi, %rcx
.L107:
	xorq	%rsi, %rcx
	movq	%rcx, -8(%rax,%rdx,8)
	cmpq	$227, %rdx
	jne	.L108
	movl	$2567483615, %edi
.L110:
	movq	(%rax,%rdx,8), %rsi
	incq	%rdx
	movq	(%rax,%rdx,8), %rcx
	andq	$-2147483648, %rsi
	andl	$2147483647, %ecx
	orq	%rsi, %rcx
	movq	%rcx, %rsi
	shrq	%rsi
	xorq	-1824(%rax,%rdx,8), %rsi
	andl	$1, %ecx
	je	.L109
	movq	%rdi, %rcx
.L109:
	xorq	%rsi, %rcx
	movq	%rcx, -8(%rax,%rdx,8)
	cmpq	$623, %rdx
	jne	.L110
	movq	4984(%rax), %rdx
	movq	(%rax), %rcx
	andq	$-2147483648, %rdx
	andl	$2147483647, %ecx
	orq	%rcx, %rdx
	movq	%rdx, %rcx
	shrq	%rcx
	xorq	3168(%rax), %rcx
	andl	$1, %edx
	je	.L111
	movl	$2567483615, %edx
.L111:
	xorq	%rcx, %rdx
	movq	%rdx, 4984(%rax)
	xorl	%edx, %edx
	movq	%rdx, 4992(%rax)
	ret
	.cfi_endproc
.LFE5557:
	.size	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv, .-_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv
	.section	.text._ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv,"axG",@progbits,_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv,comdat
	.align 2
	.weak	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	.type	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv, @function
_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv:
.LFB5494:
	.cfi_startproc
	endbr64
	cmpq	$623, 4992(%rdi)
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	jbe	.L124
	call	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv
.L124:
	movq	4992(%rbx), %rax
	leaq	1(%rax), %rdx
	movq	(%rbx,%rax,8), %rax
	movq	%rdx, 4992(%rbx)
	popq	%rbx
	.cfi_def_cfa_offset 8
	movq	%rax, %rdx
	shrq	$11, %rdx
	movl	%edx, %edx
	xorq	%rax, %rdx
	movq	%rdx, %rax
	salq	$7, %rax
	andl	$2636928640, %eax
	xorq	%rdx, %rax
	movq	%rax, %rdx
	salq	$15, %rdx
	andl	$4022730752, %edx
	xorq	%rax, %rdx
	movq	%rdx, %rax
	shrq	$18, %rax
	xorq	%rdx, %rax
	ret
	.cfi_endproc
.LFE5494:
	.size	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv, .-_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	.text
	.align 2
	.type	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE.isra.0, @function
_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE.isra.0:
.LFB5594:
	.cfi_startproc
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movslq	%esi, %rax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rax, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movslq	%edx, %rbx
	subq	%rax, %rbx
	movl	$4294967294, %eax
	movq	%rbx, %r13
	cmpq	%rbx, %rax
	jb	.L127
	call	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	leaq	1(%rbx), %rbx
	imulq	%rbx, %rax
	movq	%rax, %rcx
	movl	%eax, %esi
	cmpl	%ebx, %eax
	jnb	.L128
	movl	%ebx, %eax
	xorl	%edx, %edx
	negl	%eax
	divl	%ebx
	movl	%edx, %r14d
.L129:
	cmpl	%r14d, %esi
	jnb	.L128
	movq	%rbp, %rdi
	call	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	imulq	%rbx, %rax
	movq	%rax, %rcx
	movl	%eax, %esi
	jmp	.L129
.L128:
	shrq	$32, %rcx
	jmp	.L131
.L127:
	movl	$4294967295, %eax
	cmpq	%rax, %rbx
	je	.L132
.L136:
	orl	$-1, %edx
	xorl	%esi, %esi
	movq	%rbp, %rdi
	call	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE.isra.0
	movq	%rbp, %rdi
	movl	%eax, %ebx
	call	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	movq	%rbx, %rcx
	salq	$32, %rcx
	addq	%rax, %rcx
	setc	%al
	movzbl	%al, %eax
	cmpq	%rcx, %r13
	jb	.L136
	testq	%rax, %rax
	jne	.L136
	jmp	.L131
.L132:
	call	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	movq	%rax, %rcx
.L131:
	popq	%rbx
	.cfi_def_cfa_offset 40
	leal	(%r12,%rcx), %eax
	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
.LFE5594:
	.size	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE.isra.0, .-_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE.isra.0
	.section	.rodata.str1.1
.LC16:
	.string	"Usage:\n%s (optional) num_threads < input\n"
.LC17:
	.string	"%d"
.LC18:
	.string	"%5s"
.LC19:
	.string	"%d particles, %d threads per block, %d blocks.\n"
.LC20:
	.string	"%d %d %d %d %d"
.LC21:
	.string	"print"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4860:
	.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	$152, %rsp
	.cfi_def_cfa_offset 208
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	cmpl	$2, %edi
	jne	.L139
	movq	8(%rsi), %rdi
	call	atoi@PLT
	movl	%eax, %ebx
	jmp	.L140
.L139:
	decl	%edi
	movl	$512, %ebx
	je	.L140
	movq	(%rsi), %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC16(%rip), %rsi
	call	__printf_chk@PLT
	movl	$1, %eax
	jmp	.L138
.L140:
	leaq	.LC17(%rip), %rbp
	leaq	host_n(%rip), %rsi
	xorl	%eax, %eax
	movq	%rbp, %rdi
	call	__isoc23_scanf@PLT
	leaq	68(%rsp), %rax
	movq	%rbp, %rdi
	movq	%rax, %rsi
	movq	%rax, 16(%rsp)
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	leaq	72(%rsp), %rax
	movq	%rbp, %rdi
	movq	%rax, %rsi
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	movq	%rbp, %rdi
	leaq	76(%rsp), %rsi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	leaq	130(%rsp), %rax
	leaq	.LC18(%rip), %rdi
	movq	%rax, %rsi
	movq	%rax, 32(%rsp)
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	movl	host_n(%rip), %ebp
	cvtsi2ssl	%ebx, %xmm0
	cvtsi2ssl	%ebp, %xmm1
	divss	%xmm1, %xmm0
	call	ceilf@PLT
	movl	%ebp, %edx
	movl	%ebx, %ecx
	leaq	.LC19(%rip), %rsi
	cvttss2sil	%xmm0, %eax
	movl	$2, %edi
	movl	%eax, 12(%rsp)
	movl	%eax, %r8d
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movslq	host_n(%rip), %rbp
	imulq	$56, %rbp, %rbp
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L142
	call	_ZL20__nv_init_managed_rtv
.L142:
	movq	_ZL9particles(%rip), %rdi
	movl	$1, %edx
	movq	%rbp, %rsi
	call	cudaMallocManaged@PLT
	xorl	%eax, %eax
.L143:
	cmpl	%eax, host_n(%rip)
	movl	%eax, 48(%rsp)
	jle	.L203
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L144
	call	_ZL20__nv_init_managed_rtv
.L144:
	movslq	48(%rsp), %rax
	movq	_ZL9particles(%rip), %rdx
	imulq	$56, %rax, %rax
	addq	(%rdx), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movl	$-1, (%rax)
	jne	.L145
	call	_ZL20__nv_init_managed_rtv
.L145:
	movslq	48(%rsp), %rax
	movq	_ZL9particles(%rip), %rdx
	xorl	%esi, %esi
	imulq	$56, %rax, %rax
	addq	(%rdx), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movl	%esi, 40(%rax)
	jne	.L146
	call	_ZL20__nv_init_managed_rtv
.L146:
	movslq	48(%rsp), %rdx
	movq	_ZL9particles(%rip), %rcx
	movq	%rdx, %rax
	imulq	$56, %rdx, %rdx
	addq	(%rcx), %rdx
	xorl	%ecx, %ecx
	movl	%ecx, 44(%rdx)
	incl	%eax
	jmp	.L143
.L203:
	xorl	%eax, %eax
	leaq	.LC20(%rip), %rbp
	movl	%eax, 48(%rsp)
.L148:
	xorl	%eax, %eax
	leaq	56(%rsp), %rcx
	leaq	52(%rsp), %rdx
	movq	%rbp, %rdi
	leaq	48(%rsp), %rsi
	leaq	64(%rsp), %r9
	leaq	60(%rsp), %r8
	call	__isoc23_scanf@PLT
	incl	%eax
	je	.L204
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movl	48(%rsp), %r12d
	jne	.L149
	call	_ZL20__nv_init_managed_rtv
.L149:
	cvtsi2sdl	52(%rsp), %xmm3
	movslq	48(%rsp), %rax
	movq	_ZL9particles(%rip), %rdx
	imulq	$56, %rax, %rax
	addq	(%rdx), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movl	%r12d, (%rax)
	movq	%xmm3, %r12
	jne	.L150
	call	_ZL20__nv_init_managed_rtv
.L150:
	cvtsi2sdl	56(%rsp), %xmm4
	movslq	48(%rsp), %rax
	movq	_ZL9particles(%rip), %rdx
	imulq	$56, %rax, %rax
	addq	(%rdx), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	%r12, 8(%rax)
	movq	%xmm4, %r12
	jne	.L151
	call	_ZL20__nv_init_managed_rtv
.L151:
	cvtsi2sdl	60(%rsp), %xmm5
	movslq	48(%rsp), %rax
	movq	_ZL9particles(%rip), %rdx
	imulq	$56, %rax, %rax
	addq	(%rdx), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	%r12, 16(%rax)
	movq	%xmm5, %r12
	jne	.L152
	call	_ZL20__nv_init_managed_rtv
.L152:
	cvtsi2sdl	64(%rsp), %xmm6
	movslq	48(%rsp), %rax
	movq	_ZL9particles(%rip), %rdx
	imulq	$56, %rax, %rax
	addq	(%rdx), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	%r12, 24(%rax)
	movq	%xmm6, %r12
	jne	.L153
	call	_ZL20__nv_init_managed_rtv
.L153:
	movslq	48(%rsp), %rax
	movq	_ZL9particles(%rip), %rdx
	imulq	$56, %rax, %rax
	addq	(%rdx), %rax
	movq	%r12, 32(%rax)
	jmp	.L148
.L204:
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L155
	call	_ZL20__nv_init_managed_rtv
.L155:
	movq	_ZL9particles(%rip), %rax
	movq	(%rax), %rax
	cmpl	$-1, (%rax)
	je	.L156
.L165:
	movq	32(%rsp), %rdi
	xorl	%r12d, %r12d
	leaq	.LC21(%rip), %rsi
	movabsq	$4294967297, %r13
	call	strcmp@PLT
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	host_n(%rip), %rsi
	leaq	_ZL1n(%rip), %rdi
	movl	%eax, 40(%rsp)
	call	cudaMemcpyToSymbol@PLT
	movq	16(%rsp), %rsi
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	_ZL1l(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movq	24(%rsp), %rsi
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	_ZL1r(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	leaq	76(%rsp), %rsi
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	_ZL1s(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	12(%rsp), %r15d
	imull	%ebx, %r15d
	jmp	.L157
.L156:
	movl	72(%rsp), %r13d
	movl	68(%rsp), %eax
	movl	$4, %ecx
	xorl	%ebp, %ebp
	leaq	rng(%rip), %r15
	subl	%r13d, %eax
	movl	%eax, (%rsp)
	movl	68(%rsp), %eax
	cltd
	idivl	%ecx
	leal	0(,%r13,8), %ecx
	movl	%eax, 40(%rsp)
	movl	68(%rsp), %eax
	cltd
	idivl	%ecx
	movl	%eax, 44(%rsp)
.L158:
	cmpl	%ebp, host_n(%rip)
	movl	%ebp, %r14d
	jle	.L165
	movl	(%rsp), %edx
	movl	%r13d, %esi
	movq	%r15, %rdi
	call	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE.isra.0
	movl	(%rsp), %edx
	movl	%r13d, %esi
	movq	%r15, %rdi
	movl	%eax, 52(%rsp)
	call	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE.isra.0
	movl	40(%rsp), %edx
	movl	44(%rsp), %esi
	movq	%r15, %rdi
	movl	%eax, 56(%rsp)
	call	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE.isra.0
	movl	40(%rsp), %edx
	movl	44(%rsp), %esi
	movq	%r15, %rdi
	movl	%eax, 60(%rsp)
	call	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE.isra.0
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movl	%eax, 64(%rsp)
	jne	.L159
	call	_ZL20__nv_init_managed_rtv
.L159:
	movq	_ZL9particles(%rip), %rax
	cvtsi2sdl	52(%rsp), %xmm7
	imulq	$56, %rbp, %r12
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movl	%r14d, (%rax,%r12)
	movq	%xmm7, %r14
	jne	.L160
	call	_ZL20__nv_init_managed_rtv
.L160:
	cvtsi2sdl	56(%rsp), %xmm1
	movq	_ZL9particles(%rip), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movq	%r14, 8(%rax,%r12)
	movq	%xmm1, %r14
	jne	.L161
	call	_ZL20__nv_init_managed_rtv
.L161:
	cvtsi2sdl	60(%rsp), %xmm3
	movq	_ZL9particles(%rip), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movq	%r14, 16(%rax,%r12)
	movq	%xmm3, %r14
	jne	.L162
	call	_ZL20__nv_init_managed_rtv
.L162:
	cvtsi2sdl	64(%rsp), %xmm4
	movq	_ZL9particles(%rip), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movq	(%rax), %rax
	movq	%r14, 24(%rax,%r12)
	movq	%xmm4, %r14
	jne	.L163
	call	_ZL20__nv_init_managed_rtv
.L163:
	movq	_ZL9particles(%rip), %rax
	incq	%rbp
	movq	(%rax), %rax
	movq	%r14, 32(%rax,%r12)
	jmp	.L158
.L174:
	movq	%r13, 96(%rsp)
	movl	$2147483649, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	%ebx, 92(%rsp)
	movl	100(%rsp), %ecx
	addq	%rdi, %rdi
	movl	$1, %esi
	movq	92(%rsp), %rdx
	movq	%rdi, 80(%rsp)
	movl	$1, 88(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L173
	movsd	.LC22(%rip), %xmm0
	subsd	(%rsp), %xmm0
	movl	%ebp, %esi
	movl	%ebx, %edi
	call	_Z42__device_stub__Z21find_first_collisionsidiidi
.L173:
	call	cudaDeviceSynchronize@PLT
	addl	%ebx, %ebp
	call	_Z15checkCudaErrorsv
.L192:
	cmpl	%ebp, host_n(%rip)
	jg	.L174
	leaq	104(%rsp), %rdi
	call	_Z14whichCollisionv
	movl	104(%rsp), %eax
	movl	112(%rsp), %r14d
	movsd	120(%rsp), %xmm6
	movl	%eax, 24(%rsp)
	movl	108(%rsp), %eax
	movsd	%xmm6, 16(%rsp)
	movl	%eax, 32(%rsp)
	call	_Z16resetUnifiedColsv
	testl	%r14d, %r14d
	jne	.L175
	xorl	%ebp, %ebp
.L176:
	cmpl	%ebp, host_n(%rip)
	jg	.L189
.L190:
	incl	%r12d
.L157:
	movl	76(%rsp), %edi
	cmpl	%r12d, %edi
	jle	.L205
	cmpl	$0, 40(%rsp)
	je	.L197
	testl	%r12d, %r12d
	jne	.L166
.L197:
	movl	%r12d, %edi
	call	_Z15print_particlesi
.L166:
	xorl	%eax, %eax
.L168:
	cmpl	%eax, host_n(%rip)
	movl	%eax, 48(%rsp)
	jle	.L206
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L169
	call	_ZL20__nv_init_managed_rtv
.L169:
	movslq	48(%rsp), %rax
	movq	_ZL9particles(%rip), %rdx
	imulq	$56, %rax, %rax
	addq	(%rdx), %rax
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	movb	$0, 48(%rax)
	jne	.L170
	call	_ZL20__nv_init_managed_rtv
.L170:
	movslq	48(%rsp), %rdx
	movq	_ZL9particles(%rip), %rcx
	movq	%rdx, %rax
	imulq	$56, %rdx, %rdx
	addq	(%rcx), %rdx
	movb	$0, 49(%rdx)
	incl	%eax
	jmp	.L168
.L206:
	movq	$0x000000000, (%rsp)
.L172:
	xorl	%ebp, %ebp
	jmp	.L192
.L175:
	movsd	16(%rsp), %xmm7
	xorps	%xmm0, %xmm0
	xorl	%ebp, %ebp
	comisd	%xmm0, %xmm7
	jb	.L176
.L177:
	cmpl	%ebp, host_n(%rip)
	jle	.L207
	movl	12(%rsp), %eax
	movq	%r13, 96(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r13, 84(%rsp)
	movl	100(%rsp), %ecx
	movl	%ebx, 92(%rsp)
	movl	88(%rsp), %esi
	movl	%eax, 80(%rsp)
	movq	92(%rsp), %rdx
	movq	80(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L179
	movsd	16(%rsp), %xmm0
	movl	%ebp, %esi
	movl	%ebx, %edi
	call	_Z38__device_stub__Z17advanceParticlesPidiidi
.L179:
	call	cudaDeviceSynchronize@PLT
	addl	%r15d, %ebp
	call	_Z15checkCudaErrorsv
	jmp	.L177
.L207:
	movsd	(%rsp), %xmm2
	addsd	16(%rsp), %xmm2
	cmpl	$5, %r14d
	movb	_ZL22__nv_inited_managed_rt(%rip), %al
	movslq	24(%rsp), %rbp
	movsd	%xmm2, (%rsp)
	jne	.L181
	testb	%al, %al
	jne	.L182
	call	_ZL20__nv_init_managed_rtv
.L182:
	movslq	32(%rsp), %r14
	movq	_ZL9particles(%rip), %rax
	imulq	$56, %r14, %r14
	addq	(%rax), %r14
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L183
	call	_ZL20__nv_init_managed_rtv
.L183:
	movq	_ZL9particles(%rip), %rax
	imulq	$56, %rbp, %rdi
	movq	%r14, %rsi
	addq	(%rax), %rdi
	call	_Z16collideParticlesR10particle_tS0_
	jmp	.L184
.L181:
	testb	%al, %al
	jne	.L185
	call	_ZL20__nv_init_managed_rtv
.L185:
	movq	_ZL9particles(%rip), %rax
	imulq	$56, %rbp, %rbp
	movq	(%rax), %rax
	cmpb	$0, 48(%rax,%rbp)
	jne	.L186
	movl	24(%rsp), %edi
	movl	%r14d, %esi
	call	_Z11collideWalli8CollType
	jmp	.L184
.L186:
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L187
	call	_ZL20__nv_init_managed_rtv
.L187:
	movq	_ZL9particles(%rip), %rax
	movq	(%rax), %rax
	movb	$1, 49(%rax,%rbp)
	jmp	.L184
.L189:
	movl	12(%rsp), %eax
	movq	%r13, 96(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r13, 84(%rsp)
	movl	100(%rsp), %ecx
	movl	%ebx, 92(%rsp)
	movl	88(%rsp), %esi
	movl	%eax, 80(%rsp)
	movq	92(%rsp), %rdx
	movq	80(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L188
	movsd	.LC22(%rip), %xmm0
	subsd	(%rsp), %xmm0
	movl	%ebp, %esi
	movl	%ebx, %edi
	call	_Z38__device_stub__Z17advanceParticlesPidiidi
.L188:
	call	cudaDeviceSynchronize@PLT
	addl	%r15d, %ebp
	call	_Z15checkCudaErrorsv
	jmp	.L176
.L184:
	movsd	.LC22(%rip), %xmm0
	comisd	(%rsp), %xmm0
	ja	.L172
	jmp	.L190
.L205:
	call	_Z16print_statisticsi
	xorl	%eax, %eax
.L138:
	movq	136(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L194
	call	__stack_chk_fail@PLT
.L194:
	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
.LFE4860:
	.size	main, .-main
	.type	_GLOBAL__sub_I_rng, @function
_GLOBAL__sub_I_rng:
.LFB5592:
	.cfi_startproc
	endbr64
	pushq	%rdx
	.cfi_def_cfa_offset 16
	xorl	%edi, %edi
	call	time@PLT
	leaq	-8+rng(%rip), %rdi
	movl	$1, %edx
	movl	%eax, %eax
	leaq	8(%rdi), %rcx
	movq	%rax, rng(%rip)
.L209:
	movq	(%rdi,%rdx,8), %rax
	movq	%rax, %rsi
	shrq	$30, %rsi
	xorq	%rsi, %rax
	imulq	$1812433253, %rax, %rax
	addl	%edx, %eax
	movq	%rax, (%rcx,%rdx,8)
	incq	%rdx
	cmpq	$624, %rdx
	jne	.L209
	movq	$624, 4992+rng(%rip)
	popq	%rax
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE5592:
	.size	_GLOBAL__sub_I_rng, .-_GLOBAL__sub_I_rng
	.section	.init_array
	.align 8
	.quad	_GLOBAL__sub_I_rng
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.globl	host_n
	.bss
	.align 4
	.type	host_n, @object
	.size	host_n, 4
host_n:
	.zero	4
	.section	__nv_managed_data__,"aw"
	.align 8
	.type	_ZL7partCol, @object
	.size	_ZL7partCol, 8
_ZL7partCol:
	.zero	8
	.align 8
	.type	_ZL7wallCol, @object
	.size	_ZL7wallCol, 8
_ZL7wallCol:
	.zero	8
	.align 8
	.type	_ZL9particles, @object
	.size	_ZL9particles, 8
_ZL9particles:
	.zero	8
	.local	_ZL1n
	.comm	_ZL1n,4,4
	.local	_ZL1s
	.comm	_ZL1s,4,4
	.local	_ZL1r
	.comm	_ZL1r,4,4
	.local	_ZL1l
	.comm	_ZL1l,4,4
	.globl	rng
	.bss
	.align 32
	.type	rng, @object
	.size	rng, 5000
rng:
	.zero	5000
	.local	_ZL32__nv_fatbinhandle_for_managed_rt
	.comm	_ZL32__nv_fatbinhandle_for_managed_rt,8,8
	.local	_ZL22__nv_inited_managed_rt
	.comm	_ZL22__nv_inited_managed_rt,1,1
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC3:
	.long	-4194304
	.long	1105199103
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC5:
	.long	0
	.long	-2147483648
	.long	0
	.long	0
	.align 16
.LC6:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC22:
	.long	0
	.long	1072693248
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <iostream>
#include <fstream>

#include <ctime>
#include <random>
using namespace std;

//use seed from time to generate random values
std::mt19937 rng(time(0));

//used to set time to collision as a high value to indicate no collision
int const NO_VALUE = std::numeric_limits<int>::max();

//type of collision
enum CollType{NOCOLL, LEFTWALL, RIGHTWALL, TOPWALL, BOTTOMWALL, PARTCOLL};

//used to return what kind of collision happened with default values if
//a collision did not happen
struct Collision{
    //colliding particle #1 (only one colliding if hitting a wall)
    int partId1 = NO_VALUE;
    //colliding particle #2
    int partId2 = NO_VALUE;
    //tells if we collided with a particle, with which wall
    //or didn't collide
    CollType type = NOCOLL;
    //time it took to collide
    double t = NO_VALUE;
};

typedef enum {
    MODE_PRINT,
    MODE_PERF
} simulation_mode_t;

//used to present particles in the simulation
struct particle_t {
    int i = -1;
    double x = NO_VALUE;
    double y = NO_VALUE;
    double vx = NO_VALUE;
    double vy = NO_VALUE;
    int p_collisions = 0;
    int w_collisions = 0;
    bool collided = false ;
    bool stopPart = false;
};


__constant__ int l, r, s;
__constant__ int n;

__managed__ particle_t* particles;
__managed__ Collision wallCol;
__managed__ Collision partCol;
 
int host_n;

// device method to atomically set minimum float value
__device__ __forceinline__ float atomicMinD (float * addr, float value) {
        float old;
        old = (value >= 0) ? __int_as_float(atomicMin((int *)addr, __float_as_int(value))) :
             __uint_as_float(atomicMax((unsigned int *)addr, __float_as_uint(value)));

        return old;
} 
// device method to calculate wall collision time
__device__ Collision calcCollisionTime(particle_t &p1, int iL, int iR,  double t){
	   Collision rCol;
	   double l = iL;
	   double r = iR;
	   if(p1.vx < 0){
	   	   double t_help = (l - r - (l - p1.x))/(-p1.vx);
		   if(t_help >= 0. && t_help < t){
		   	     rCol.t = t_help;
			     rCol.type = LEFTWALL;
			     rCol.partId1 = p1.i;
		   }
	   }
	   if(p1.vx > 0){
	   	    double t_help = (l - r - p1.x)/p1.vx;
		    if(t_help >= 0. && t_help < t){
		    	      rCol.t = t_help;
			      rCol.type = RIGHTWALL;
			      rCol.partId1 = p1.i;
		    }
	   }
	   if(p1.vy < 0){
	   	    double t_help = (l - r - (l - p1.y))/(-p1.vy);
		    if(t_help >= 0. && t_help < t && t_help < rCol.t){
		    	      rCol.t = t_help;
			      rCol.type = BOTTOMWALL;
			      rCol.partId1 = p1.i;
		    }
	   }
	   if(p1.vy > 0){
	   	    double t_help = (l - r - p1.y)/p1.y;
		    if(t_help >= 0. && t_help < t && t_help < rCol.t){
		    	      rCol.t = t_help;
			      rCol.type = TOPWALL;
			      rCol.partId1 = p1.i;
		    }
	   }
	   return rCol;
}

// device method to calculate particle collision time
__device__ Collision calcCollisionTime(particle_t &p1, particle_t &p2, double t){
	   Collision rCol;
	   double a = (p2.vx-p1.vx)*(p2.vx-p1.vy) + (p2.vy-p1.vy)*(p2.vy-p1.vy);
	   double b = 2.0*((p2.x-p1.x)*(p2.vx-p1.vx) + (p2.y-p1.y)*(p2.vy-p1.vy));
	   double c = (p2.x-p1.x)*(p2.x-p1.x) + (p2.y-p1.y)*(p2.y-p1.y) - (2*r)*(2*r);
	   double det = b*b - 4*a*c;
	   if (a != 0){
	      double t_help = (-b - sqrt(det))/(2.0*a);
	      if (t_help >= 0. && t_help < t){
	      	 rCol.type = PARTCOLL;
		 rCol.t = t_help;
		 rCol.partId1 = p1.i;
		 rCol.partId2 = p2.i;
	      }
     	   }
	   return rCol;
}

// Method updates fastest wall or particle collision depending on thread block
__global__ void find_first_collisions(int num_threads, double t, int offset)
{
    __shared__ int helpN; // collision indexes that only gets a value in block 2
    int newN = NO_VALUE;

    Collision retCol; // fastest collision within thread

    __shared__ float blocktime; // fastest time in block
    if (threadIdx.x == 0)
	blocktime = NO_VALUE;
	helpN = NO_VALUE;
    //barrier to ensure blocktime is initialized to a comparable default before continuing
    __syncthreads();

    int index = threadIdx.x;
    if (n > num_threads){
        index += offset;
    }

    //wall collision, checked by 1st block
    if(blockIdx.x == 0 && index < n){
        //If particle is stopped at a wall it can be ignored
        if(!particles[index].stopPart){
            retCol = calcCollisionTime(particles[index], l, r, t);

	    // comparing to remove collisions that are too slow to need atomic comparing
            if (retCol.type != NOCOLL && (float) retCol.t < blocktime) {
                atomicMinD(&blocktime, (float) retCol.t);
            }
        }
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////
    //Block2 used to calculate particle-particle collisions
    else if(blockIdx.x == 1 && index < n){

        //if hasn't collided yet
        if(!particles[index].collided){

            //find collision time with each particle
            for(int j=0; j<n; j++){
		if (particles[index].i == particles[j].i) {
		    continue;
		}
                //neither particle has collided yet
                if(!particles[index].collided && !particles[j].collided){
		    retCol = calcCollisionTime(particles[index], particles[j], t);
                }
            }
        }

        if (retCol.type == PARTCOLL && (float) retCol.t < blocktime){
            // atomic compare & replace fastest block time to found time if sooner
            // float conversion needed to further convert into int for atomicMin
            atomicMinD(&blocktime, (float) retCol.t);
        }
    }
    // barrier must be done outside of conditional
    __syncthreads();

    // if there was a particle collision
    // and this thread's collision time = the block minimum
    if(retCol.type == PARTCOLL && (float) retCol.t == blocktime){
        // calculate and compare index of collision
        newN = retCol.partId1 + retCol.partId2;
	//if new N is the same as current (reverse of existing collision or different collision with the same col index), void N 
        if(atomicMin(&helpN, newN) == newN){
	    newN = NO_VALUE;
	} else {
	  //printf("th%i p%i t%f N%i compared with N%i\n", threadIdx.x, index, blocktime, newN, helpN);
	}
    }
    // else if particle did collide with a wall (retCol has a value)
    // and thread's collision time = the block minimum
    else if (retCol.type != NOCOLL && (float) retCol.t == blocktime){
        // if kernel is being run the first time (shortcircuits to save global access)
        // or global wall collision is later
        if(offset == 0 || wallCol.t > retCol.t){
            // update rest of wallCol struct
	    wallCol.t = retCol.t;
            wallCol.type = retCol.type;
            wallCol.partId1 = retCol.partId1;
        }
    }
    // make sure all the fastest threads in particle block have compared indexes
    __syncthreads();
    // if this thread has a collision index and it's the chosen one
    // not accounting for identical indexes here, only 1 col should execute
    if (newN != NO_VALUE && newN == helpN) {
        // if kernel is being run the first time (shortcircuits to save global access)
        // or global particle collision is later
        if(offset == 0 || partCol.t > retCol.t){
            // update partCol
            partCol.type = PARTCOLL;
            partCol.t = retCol.t;
	    partCol.partId1 = retCol.partId1;
	    partCol.partId2 = retCol.partId2;
	    //printf("partCol updated\n");
        }
    }
}

// advances particles in parallel
__global__ void advanceParticlesP(int num_threads, double t, int offset){
    int i = threadIdx.x + blockIdx.x*num_threads + offset;
    if (i < n && !particles[i].stopPart){
        particles[i].y += particles[i].vy*t;	
        particles[i].x += particles[i].vx*t;
    }
}

__host__ void checkCudaErrors() {
    hipError_t rc;
    rc = hipGetLastError();
    if (rc != hipSuccess)
    {
        printf("Last CUDA error %s\n", hipGetErrorString(rc));
    }
}

__host__ void print_particles(int step)
{
    int i;
    for (i = 0; i < host_n; i++) {
        printf("%d %d %f %f %f %f\n", step, i, particles[i].x, particles[i].y,
               particles[i].vx, particles[i].vy);
    }
}

__host__ void print_statistics(int num_step)
{
    int i;
    for (i = 0; i < host_n; i++) {
        printf("%d %d %f %f %f %f %d %d\n", num_step, i, particles[i].x,
               particles[i].y, particles[i].vx, particles[i].vy,
               particles[i].p_collisions, particles[i].w_collisions);
    }
}

// returns soonest out of fastest wall and particle collisions
__host__ Collision whichCollision()
{
    //If both collisions happen, choose the earlier one
    if(wallCol.type != NOCOLL && partCol.type == PARTCOLL){

        //NOW WE PREFER WALLCOL IF BOTH T ARE SAME
        if(wallCol.t <= partCol.t){
            return wallCol;
        }
        else {
            return partCol;
        }
    }

    //only one happened
    if(wallCol.type != NOCOLL){
        return wallCol;
    }
    return partCol;

    //if no collisions happened the returned partCol
    //will have default info, this is checked later and no collision is done
}

__host__ void resetUnifiedCols(){
    wallCol.type = NOCOLL;
    wallCol.t = NO_VALUE;
    wallCol.partId1 = NO_VALUE;
    partCol.type = NOCOLL;
    partCol.t = NO_VALUE;
    partCol.partId1 = NO_VALUE;
    partCol.partId2 = NO_VALUE;
}

__host__ void collideParticles(particle_t &p1, particle_t &p2)
{
    //printf("colliding particles %i and %i, at %fx%f and %fx%f\n", p1.i, p2.i, p1.x, p1.y, p2.x, p2.y);

    //projecting the velocity unit normal and unit tangent vectors onto the unit
    //normal and unit tangent vectors, which is done by taking the dot product
    double vnx = (p2.x - p1.x);
    double vny = (p2.y - p1.y);
    double length = std::sqrt(vnx*vnx + vny*vny);
    double vunx = 0;
    double vuny = 0;
    if (length != 0){
    	vunx = vnx/length;
    	vuny = vny/length;
    }
    double vutx = -vuny;
    double vuty = vunx;
    //printf("normal unit %fx%f, length %f, tangent unit %fx%f\n", vunx, vuny, length, vutx, vuty);
    //dot products
    double v1n = vunx*p1.vx + vuny*p1.vy;
    double v2n = vunx*p2.vx + vuny*p2.vy;
    double v1t = vutx*p1.vx + vuty*p1.vy;
    double v2t = vutx*p2.vx + vuty*p2.vy;
    //double v1n = vun.dot(p1.v);
    //double v2n = vun.dot(p2.v);
    //double v1t = vut.dot(p1.v);
    //double v2t = vut.dot(p2.v);

    //find the new tangential velocities (after the collision).
    double v1tPrime = v1t;
    double v2tPrime = v2t;

    //find the new normal velocities.
    //this is where we use the one-dimensional collision formulas.
    //for m1 = m2 we get
    double v1nPrime = v2n;
    double v2nPrime = v1n;

    //convert the scalar normal and tangential velocities into vectors.
    //multiply the unit normal vector by the scalar normal velocity
    double v_v1nPrimex = v1nPrime*vunx;
    double v_v1nPrimey = v1nPrime*vuny;
    double v_v2nPrimex = v2nPrime*vunx;
    double v_v2nPrimey = v2nPrime*vuny;

    double v_v1tPrimex = v1tPrime*vutx;
    double v_v1tPrimey = v1tPrime*vuty;
    double v_v2tPrimex = v2tPrime*vutx;
    double v_v2tPrimey = v2tPrime*vuty;

    //the final velocity vectors by adding the normal and tangential
    //components for each object
    p1.vx = v_v1nPrimex + v_v1tPrimex;
    p1.vy = v_v1nPrimey + v_v1tPrimey;
    p2.vx = v_v2nPrimex + v_v2tPrimex;
    p2.vy = v_v2nPrimey + v_v2tPrimey;

    //info that collided in cycle and up the collision count
    p1.collided = true;
    p1.p_collisions += 1;
    p2.collided = true;
    p2.p_collisions += 1;
}


//collides given particle with the given wall (changes the velociy)
__host__ void collideWall(int i, CollType col)
{
    //info that collided in cycle and up the collision count
    particles[i].collided = true;
    particles[i].w_collisions += 1;

    //fabs returns the absolute value
    //depending on which wall is hit, either vx or vy will
    //change sign
    if(col == LEFTWALL){
        particles[i].vx = fabs(particles[i].vx);
    }

    else if (col == RIGHTWALL){
        particles[i].vx = -fabs(particles[i].vx);
    }

    else if (col == TOPWALL){
        particles[i].vy = -fabs(particles[i].vy);
    }

    else if (col == BOTTOMWALL){
        particles[i].vy = fabs(particles[i].vy);
    }

}

///////////////////////////////////////////////////////////////
int main(int argc, char** argv)
{
    int i, x, y, vx, vy;
    int num_blocks, num_threads;
    int step, offset;
    int host_l, host_r, host_s;
    simulation_mode_t mode;
    char mode_buf[6];

    if (argc == 2){
    	num_threads = atoi(argv[1]);
    } else if (argc == 1){
	num_threads = 512;
    } else {
        printf("Usage:\n%s (optional) num_threads < input\n", argv[0]);
        return 1;
    }

    scanf("%d", &host_n);
    scanf("%d", &host_l);
    scanf("%d", &host_r);
    scanf("%d", &host_s);
    scanf("%5s", mode_buf);

    // blocks to address all particles with the given number of threads = ratio rounded up
    num_blocks = ceil((float)num_threads/(float)host_n);

    printf("%d particles, %d threads per block, %d blocks.\n", host_n, num_threads, num_blocks);

    hipMallocManaged(&particles, sizeof(particle_t) * host_n);

    for (i = 0; i < host_n; i++) {
        particles[i].i = -1;
        particles[i].p_collisions = 0;
        particles[i].w_collisions = 0;
    }

    i = 0; //added
    while (scanf("%d %d %d %d %d", &i, &x, &y, &vx, &vy) != EOF) {
        particles[i].i = i;
        particles[i].x = x;
        particles[i].y = y;
        particles[i].vx = vx;
        particles[i].vy = vy;
    }

    if (particles[0].i == -1) {
        //generate a distribution for random values in given range
        std::uniform_int_distribution<int> dist_pos(host_r,host_l-host_r);

        std::uniform_int_distribution<int> dist_v(host_l/(8*host_r), host_l/4);

        //Generate particles and store into data structure
        for(int j = 0; j < host_n; j++){

            x=dist_pos(rng);
            y=dist_pos(rng);
            vx=dist_v(rng);
            vy=dist_v(rng);

            particles[j].i = j;
            particles[j].x = x;
            particles[j].y = y;
            particles[j].vx = vx;
            particles[j].vy = vy;
        }
    }

    mode = strcmp(mode_buf, "print") == 0 ? MODE_PRINT : MODE_PERF;

        /* Copy to GPU constant memory */
    hipMemcpyToSymbol(HIP_SYMBOL(n), &host_n, sizeof(n));
    hipMemcpyToSymbol(HIP_SYMBOL(l), &host_l, sizeof(l));
    hipMemcpyToSymbol(HIP_SYMBOL(r), &host_r, sizeof(r));
    hipMemcpyToSymbol(HIP_SYMBOL(s), &host_s, sizeof(s));

    //printf("particles%i size%i radius%i steps%i\n", host_n, host_l, host_r, host_s);
        //simulation of step
    for (step = 0; step < host_s; step++) {
        if (mode == MODE_PRINT || step == 0) {
           print_particles(step);
        }

        for (i = 0; i < host_n; i++) {
      	  particles[i].collided = false;
          particles[i].stopPart = false;
        }

        double tMoved = 0.0;
        Collision deviceCol;

            //loop while within the step
        while(tMoved < 1.0){

            // if number of particles is less than threads:
        
            // one block for each calculation will suffice
            // one block of N threads for wall collisions, one for particle
            // kernel is called with 2 blocks, numthreads in 1D each block
            // if block1/block2 statement seperates wall and particle collisions
            // syncthreads breaks up block seperation, then it returns to update wall/partCol

            // if particles exceeds threads:
            // a new grid is created with code to start at offset of particles already addressed.
            // each section of [numthreads] particles is calculated sequentially.
            for (offset = 0; offset < host_n; offset += num_threads) {
                /* Call the kernel */
                find_first_collisions<<<2, num_threads>>>(num_threads, 1.0-tMoved, offset);
                //printf("Step %i tMoved %lf\n", step, tMoved);
                /* Barrier */
                hipDeviceSynchronize();
		        checkCudaErrors();
            }

            deviceCol = whichCollision();
	    resetUnifiedCols();

            //we had a collision
            if(deviceCol.type != NOCOLL && deviceCol.t >= 0){

	    	    //printf("returned collision type %i in %f\n", deviceCol.type, deviceCol.t);

                //move particles until collision time, using particle index offset if threads < n
                for (offset = 0; offset < host_n; offset += num_blocks*num_threads){
                    advanceParticlesP<<<num_blocks, num_threads>>>(num_threads, deviceCol.t, offset);
                    hipDeviceSynchronize();
                    checkCudaErrors();
//printf("advancing: t%d b%d time%lf, offset%d\n", num_threads, num_blocks, deviceCol.t, offset);
                }
		//advanceParticles(deviceCol.t);
                tMoved += deviceCol.t;

                    //Collision between 2 particles
                if(deviceCol.type == PARTCOLL){
                    collideParticles(particles[deviceCol.partId1], particles[deviceCol.partId2]);
                }

                    //wall collision
                else {
                    //If particle hasn't collided yet
                    if(!particles[deviceCol.partId1].collided){
                        collideWall(deviceCol.partId1, deviceCol.type);
                    }

                    //If it has, we need to stop it's movement at the wall
                    else{
                        particles[deviceCol.partId1].stopPart = true;
                    }
                }
            }
            else {
                //no remaining collisions so advance to end of step
		for (offset = 0; offset < host_n; offset += num_blocks*num_threads){
                    advanceParticlesP<<<num_blocks, num_threads>>>(num_threads, 1 - tMoved, offset);
                    hipDeviceSynchronize();
                    checkCudaErrors();
            	}
		tMoved = 1;
            }
    	}
    }
    print_statistics(host_s);
    return 0;
}










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

                                        # End of file scope inline assembly
	.globl	_Z36__device_stub__find_first_collisionsidi # -- Begin function _Z36__device_stub__find_first_collisionsidi
	.type	_Z36__device_stub__find_first_collisionsidi,@function
_Z36__device_stub__find_first_collisionsidi: # @_Z36__device_stub__find_first_collisionsidi
	.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	$96, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	4(%rsp), %rax
	movl	%edi, (%rax)
	leaq	24(%rsp), %rcx
	movsd	%xmm0, (%rcx)
	movq	%rsp, %rdx
	movl	%esi, (%rdx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rdx, 16(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z21find_first_collisionsidi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$112, %rsp
	.cfi_adjust_cfa_offset -112
	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	_Z36__device_stub__find_first_collisionsidi, .Lfunc_end0-_Z36__device_stub__find_first_collisionsidi
	.cfi_endproc
                                        # -- End function
	.globl	_Z32__device_stub__advanceParticlesPidi # -- Begin function _Z32__device_stub__advanceParticlesPidi
	.type	_Z32__device_stub__advanceParticlesPidi,@function
_Z32__device_stub__advanceParticlesPidi: # @_Z32__device_stub__advanceParticlesPidi
	.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	$96, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	4(%rsp), %rax
	movl	%edi, (%rax)
	leaq	24(%rsp), %rcx
	movsd	%xmm0, (%rcx)
	movq	%rsp, %rdx
	movl	%esi, (%rdx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rdx, 16(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z17advanceParticlesPidi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$112, %rsp
	.cfi_adjust_cfa_offset -112
	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	_Z32__device_stub__advanceParticlesPidi, .Lfunc_end1-_Z32__device_stub__advanceParticlesPidi
	.cfi_endproc
                                        # -- End function
	.globl	_Z15checkCudaErrorsv            # -- Begin function _Z15checkCudaErrorsv
	.type	_Z15checkCudaErrorsv,@function
_Z15checkCudaErrorsv:                   # @_Z15checkCudaErrorsv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	hipGetLastError
	testl	%eax, %eax
	je	.LBB2_1
# %bb.2:
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	popq	%rcx
	.cfi_def_cfa_offset 8
	jmp	printf                          # TAILCALL
.LBB2_1:
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z15checkCudaErrorsv, .Lfunc_end2-_Z15checkCudaErrorsv
	.cfi_endproc
                                        # -- End function
	.globl	_Z15print_particlesi            # -- Begin function _Z15print_particlesi
	.type	_Z15print_particlesi,@function
_Z15print_particlesi:                   # @_Z15print_particlesi
	.cfi_startproc
# %bb.0:
	cmpl	$0, host_n(%rip)
	jle	.LBB3_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	%edi, %ebx
	movl	$32, %r15d
	xorl	%r14d, %r14d
.LBB3_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movsd	-24(%rax,%r15), %xmm0           # xmm0 = mem[0],zero
	movsd	-16(%rax,%r15), %xmm1           # xmm1 = mem[0],zero
	movsd	-8(%rax,%r15), %xmm2            # xmm2 = mem[0],zero
	movsd	(%rax,%r15), %xmm3              # xmm3 = mem[0],zero
	movl	$.L.str.1, %edi
	movl	%ebx, %esi
	movl	%r14d, %edx
	movb	$4, %al
	callq	printf
	incq	%r14
	movslq	host_n(%rip), %rax
	addq	$56, %r15
	cmpq	%rax, %r14
	jl	.LBB3_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB3_4:                                # %._crit_edge
	retq
.Lfunc_end3:
	.size	_Z15print_particlesi, .Lfunc_end3-_Z15print_particlesi
	.cfi_endproc
                                        # -- End function
	.globl	_Z16print_statisticsi           # -- Begin function _Z16print_statisticsi
	.type	_Z16print_statisticsi,@function
_Z16print_statisticsi:                  # @_Z16print_statisticsi
	.cfi_startproc
# %bb.0:
	cmpl	$0, host_n(%rip)
	jle	.LBB4_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	%edi, %ebx
	movl	$44, %r15d
	xorl	%r14d, %r14d
.LBB4_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movsd	-36(%rax,%r15), %xmm0           # xmm0 = mem[0],zero
	movsd	-28(%rax,%r15), %xmm1           # xmm1 = mem[0],zero
	movsd	-20(%rax,%r15), %xmm2           # xmm2 = mem[0],zero
	movsd	-12(%rax,%r15), %xmm3           # xmm3 = mem[0],zero
	movl	-4(%rax,%r15), %ecx
	movl	(%rax,%r15), %r8d
	movl	$.L.str.2, %edi
	movl	%ebx, %esi
	movl	%r14d, %edx
	movb	$4, %al
	callq	printf
	incq	%r14
	movslq	host_n(%rip), %rax
	addq	$56, %r15
	cmpq	%rax, %r14
	jl	.LBB4_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB4_4:                                # %._crit_edge
	retq
.Lfunc_end4:
	.size	_Z16print_statisticsi, .Lfunc_end4-_Z16print_statisticsi
	.cfi_endproc
                                        # -- End function
	.globl	_Z14whichCollisionv             # -- Begin function _Z14whichCollisionv
	.type	_Z14whichCollisionv,@function
_Z14whichCollisionv:                    # @_Z14whichCollisionv
	.cfi_startproc
# %bb.0:
	movq	%rdi, %rax
	movq	wallCol(%rip), %rdx
	cmpl	$0, 8(%rdx)
	movq	partCol(%rip), %rcx
	je	.LBB5_4
# %bb.1:
	cmpl	$5, 8(%rcx)
	jne	.LBB5_2
# %bb.3:
	movsd	16(%rcx), %xmm0                 # xmm0 = mem[0],zero
	ucomisd	16(%rdx), %xmm0
	cmovaeq	%rdx, %rcx
	jmp	.LBB5_4
.LBB5_2:
	movq	%rdx, %rcx
.LBB5_4:
	movq	16(%rcx), %rdx
	movq	%rdx, 16(%rax)
	movups	(%rcx), %xmm0
	movups	%xmm0, (%rax)
	retq
.Lfunc_end5:
	.size	_Z14whichCollisionv, .Lfunc_end5-_Z14whichCollisionv
	.cfi_endproc
                                        # -- End function
	.globl	_Z16resetUnifiedColsv           # -- Begin function _Z16resetUnifiedColsv
	.type	_Z16resetUnifiedColsv,@function
_Z16resetUnifiedColsv:                  # @_Z16resetUnifiedColsv
	.cfi_startproc
# %bb.0:
	movq	wallCol(%rip), %rax
	xorl	%ecx, %ecx
	movl	%ecx, 8(%rax)
	movabsq	$4746794007244308480, %rdx      # imm = 0x41DFFFFFFFC00000
	movq	%rdx, 16(%rax)
	movl	$2147483647, %esi               # imm = 0x7FFFFFFF
	movl	%esi, (%rax)
	movq	partCol(%rip), %rax
	movl	%ecx, 8(%rax)
	movq	%rdx, 16(%rax)
	movl	%esi, (%rax)
	movq	partCol(%rip), %rax
	movl	%esi, 4(%rax)
	retq
.Lfunc_end6:
	.size	_Z16resetUnifiedColsv, .Lfunc_end6-_Z16resetUnifiedColsv
	.cfi_endproc
                                        # -- End function
	.globl	_Z16collideParticlesR10particle_tS0_ # -- Begin function _Z16collideParticlesR10particle_tS0_
	.type	_Z16collideParticlesR10particle_tS0_,@function
_Z16collideParticlesR10particle_tS0_:   # @_Z16collideParticlesR10particle_tS0_
	.cfi_startproc
# %bb.0:
	movsd	8(%rsi), %xmm0                  # xmm0 = mem[0],zero
	movsd	16(%rsi), %xmm1                 # xmm1 = mem[0],zero
	subsd	8(%rdi), %xmm0
	subsd	16(%rdi), %xmm1
	movapd	%xmm0, %xmm2
	mulsd	%xmm0, %xmm2
	movapd	%xmm1, %xmm3
	mulsd	%xmm1, %xmm3
	addsd	%xmm2, %xmm3
	xorps	%xmm2, %xmm2
	sqrtsd	%xmm3, %xmm2
	xorpd	%xmm3, %xmm3
	ucomisd	%xmm3, %xmm2
	divsd	%xmm2, %xmm1
	jne	.LBB7_3
# %bb.1:
	jp	.LBB7_3
# %bb.2:
	xorpd	%xmm1, %xmm1
.LBB7_3:
	divsd	%xmm2, %xmm0
	jne	.LBB7_6
# %bb.4:
	jp	.LBB7_6
# %bb.5:
	xorpd	%xmm0, %xmm0
.LBB7_6:
	movsd	24(%rdi), %xmm5                 # xmm5 = mem[0],zero
	movsd	32(%rdi), %xmm2                 # xmm2 = mem[0],zero
	movapd	%xmm5, %xmm3
	mulsd	%xmm0, %xmm3
	movapd	%xmm2, %xmm4
	mulsd	%xmm1, %xmm4
	addsd	%xmm3, %xmm4
	movsd	24(%rsi), %xmm6                 # xmm6 = mem[0],zero
	movapd	%xmm6, %xmm7
	mulsd	%xmm0, %xmm7
	movsd	32(%rsi), %xmm3                 # xmm3 = mem[0],zero
	movapd	%xmm3, %xmm8
	mulsd	%xmm1, %xmm8
	addsd	%xmm7, %xmm8
	mulsd	%xmm0, %xmm2
	mulsd	%xmm1, %xmm5
	subsd	%xmm5, %xmm2
	mulsd	%xmm0, %xmm3
	mulsd	%xmm1, %xmm6
	subsd	%xmm6, %xmm3
	movapd	%xmm0, %xmm5
	mulsd	%xmm8, %xmm5
	mulsd	%xmm1, %xmm8
	movapd	%xmm0, %xmm6
	mulsd	%xmm4, %xmm6
	mulsd	%xmm1, %xmm4
	movapd	%xmm0, %xmm7
	mulsd	%xmm2, %xmm7
	addsd	%xmm8, %xmm7
	mulsd	%xmm3, %xmm0
	addsd	%xmm4, %xmm0
	mulsd	%xmm1, %xmm2
	subsd	%xmm2, %xmm5
	movsd	%xmm5, 24(%rdi)
	movsd	%xmm7, 32(%rdi)
	mulsd	%xmm1, %xmm3
	subsd	%xmm3, %xmm6
	movsd	%xmm6, 24(%rsi)
	movsd	%xmm0, 32(%rsi)
	movb	$1, %al
	movb	%al, 48(%rdi)
	incl	40(%rdi)
	movb	%al, 48(%rsi)
	incl	40(%rsi)
	retq
.Lfunc_end7:
	.size	_Z16collideParticlesR10particle_tS0_, .Lfunc_end7-_Z16collideParticlesR10particle_tS0_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z11collideWalli8CollType
.LCPI8_0:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
.LCPI8_1:
	.quad	0x8000000000000000              # double -0
	.quad	0x8000000000000000              # double -0
	.text
	.globl	_Z11collideWalli8CollType
	.type	_Z11collideWalli8CollType,@function
_Z11collideWalli8CollType:              # @_Z11collideWalli8CollType
	.cfi_startproc
# %bb.0:
	movq	particles(%rip), %rax
	movq	(%rax), %rcx
	movslq	%edi, %rax
	imulq	$56, %rax, %rax
	movb	$1, 48(%rcx,%rax)
	movq	particles(%rip), %rcx
	movq	(%rcx), %rcx
	incl	44(%rcx,%rax)
                                        # kill: def $esi killed $esi def $rsi
	decl	%esi
	cmpl	$3, %esi
	ja	.LBB8_7
# %bb.1:
	jmpq	*.LJTI8_0(,%rsi,8)
.LBB8_2:
	movq	particles(%rip), %rcx
	movq	(%rcx), %rcx
	movsd	24(%rcx,%rax), %xmm0            # xmm0 = mem[0],zero
	andps	.LCPI8_0(%rip), %xmm0
	jmp	.LBB8_3
.LBB8_4:
	movq	particles(%rip), %rcx
	movq	(%rcx), %rcx
	movsd	32(%rcx,%rax), %xmm0            # xmm0 = mem[0],zero
	orps	.LCPI8_1(%rip), %xmm0
	jmp	.LBB8_6
.LBB8_5:
	movq	particles(%rip), %rcx
	movq	(%rcx), %rcx
	movsd	32(%rcx,%rax), %xmm0            # xmm0 = mem[0],zero
	andps	.LCPI8_0(%rip), %xmm0
.LBB8_6:
	movlps	%xmm0, 32(%rcx,%rax)
.LBB8_7:
	retq
.LBB8_8:
	movq	particles(%rip), %rcx
	movq	(%rcx), %rcx
	movsd	24(%rcx,%rax), %xmm0            # xmm0 = mem[0],zero
	orps	.LCPI8_1(%rip), %xmm0
.LBB8_3:
	movlps	%xmm0, 24(%rcx,%rax)
	retq
.Lfunc_end8:
	.size	_Z11collideWalli8CollType, .Lfunc_end8-_Z11collideWalli8CollType
	.cfi_endproc
	.section	.rodata,"a",@progbits
	.p2align	3, 0x0
.LJTI8_0:
	.quad	.LBB8_2
	.quad	.LBB8_8
	.quad	.LBB8_4
	.quad	.LBB8_5
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI9_0:
	.quad	0x3ff0000000000000              # double 1
.LCPI9_1:
	.quad	0x0000000000000000              # double 0
	.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	$104, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	cmpl	$1, %edi
	je	.LBB9_1
# %bb.2:
	cmpl	$2, %edi
	jne	.LBB9_54
# %bb.3:
	movq	8(%rsi), %rdi
	callq	atoi
	movl	%eax, %ebx
	jmp	.LBB9_4
.LBB9_1:
	movl	$512, %ebx                      # imm = 0x200
.LBB9_4:
	xorl	%r14d, %r14d
	movl	$.L.str.4, %edi
	movl	$host_n, %esi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	leaq	44(%rsp), %rsi
	movl	$.L.str.4, %edi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	leaq	40(%rsp), %rsi
	movl	$.L.str.4, %edi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	leaq	36(%rsp), %rsi
	movl	$.L.str.4, %edi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	leaq	66(%rsp), %rsi
	movl	$.L.str.5, %edi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	cvtsi2ss	%ebx, %xmm0
	movl	host_n(%rip), %ebp
	cvtsi2ss	%ebp, %xmm1
	divss	%xmm1, %xmm0
	callq	ceilf@PLT
	cvttss2si	%xmm0, %ecx
	movl	$.L.str.6, %edi
	movl	%ebp, %esi
	movl	%ebx, 4(%rsp)                   # 4-byte Spill
	movl	%ebx, %edx
	movl	%ecx, 24(%rsp)                  # 4-byte Spill
	xorl	%eax, %eax
	callq	printf
	movslq	host_n(%rip), %rax
	imulq	$56, %rax, %rsi
	movq	particles(%rip), %rdi
	movl	$1, %edx
	callq	hipMallocManaged
	movl	$0, (%rsp)
	cmpl	$0, host_n(%rip)
	jle	.LBB9_7
# %bb.5:                                # %.lr.ph.preheader
	xorl	%eax, %eax
.LBB9_6:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	particles(%rip), %rcx
	movq	(%rcx), %rcx
	cltq
	imulq	$56, %rax, %rax
	movl	$-1, (%rcx,%rax)
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movslq	(%rsp), %rcx
	imulq	$56, %rcx, %rcx
	movl	%r14d, 40(%rax,%rcx)
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movslq	(%rsp), %rcx
	imulq	$56, %rcx, %rcx
	movl	%r14d, 44(%rax,%rcx)
	movl	(%rsp), %eax
	incl	%eax
	movl	%eax, (%rsp)
	cmpl	host_n(%rip), %eax
	jl	.LBB9_6
.LBB9_7:                                # %._crit_edge
	movq	%rsp, %rsi
	movl	$0, (%rsi)
	leaq	20(%rsp), %rdx
	leaq	16(%rsp), %rcx
	leaq	12(%rsp), %r8
	leaq	8(%rsp), %r9
	movl	$.L.str.7, %edi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	cmpl	$-1, %eax
	je	.LBB9_10
# %bb.8:                                # %.lr.ph105.preheader
	movq	%rsp, %r14
	leaq	20(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	12(%rsp), %r13
	leaq	8(%rsp), %rbp
.LBB9_9:                                # %.lr.ph105
                                        # =>This Inner Loop Header: Depth=1
	movslq	(%rsp), %rax
	movq	particles(%rip), %rcx
	movq	(%rcx), %rcx
	imulq	$56, %rax, %rdx
	movl	%eax, (%rcx,%rdx)
	xorps	%xmm0, %xmm0
	cvtsi2sdl	20(%rsp), %xmm0
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movsd	%xmm0, 8(%rax,%rdx)
	xorps	%xmm0, %xmm0
	cvtsi2sdl	16(%rsp), %xmm0
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movsd	%xmm0, 16(%rax,%rdx)
	xorps	%xmm0, %xmm0
	cvtsi2sdl	12(%rsp), %xmm0
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movsd	%xmm0, 24(%rax,%rdx)
	xorps	%xmm0, %xmm0
	cvtsi2sdl	8(%rsp), %xmm0
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movsd	%xmm0, 32(%rax,%rdx)
	movl	$.L.str.7, %edi
	movq	%r14, %rsi
	movq	%r15, %rdx
	movq	%r12, %rcx
	movq	%r13, %r8
	movq	%rbp, %r9
	xorl	%eax, %eax
	callq	__isoc23_scanf
	cmpl	$-1, %eax
	jne	.LBB9_9
.LBB9_10:                               # %._crit_edge106
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	cmpl	$-1, (%rax)
	jne	.LBB9_14
# %bb.11:
	movl	40(%rsp), %esi
	movl	44(%rsp), %ecx
	movl	%ecx, %eax
	subl	%esi, %eax
	movl	%esi, 88(%rsp)
	movl	%eax, 92(%rsp)
	shll	$3, %esi
	movl	%ecx, %eax
	cltd
	idivl	%esi
	leal	3(%rcx), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	sarl	$2, %edx
	movl	%eax, 80(%rsp)
	movl	%edx, 84(%rsp)
	cmpl	$0, host_n(%rip)
	jle	.LBB9_14
# %bb.12:                               # %.lr.ph109.preheader
	xorl	%r12d, %r12d
	leaq	88(%rsp), %r14
	leaq	80(%rsp), %r15
	xorl	%r13d, %r13d
.LBB9_13:                               # %.lr.ph109
                                        # =>This Inner Loop Header: Depth=1
	movl	$rng, %esi
	movq	%r14, %rdi
	movq	%r14, %rdx
	callq	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE
	movl	%eax, 20(%rsp)
	movl	$rng, %esi
	movq	%r14, %rdi
	movq	%r14, %rdx
	callq	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE
	movl	%eax, 16(%rsp)
	movl	$rng, %esi
	movq	%r15, %rdi
	movq	%r15, %rdx
	callq	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE
	movl	%eax, 12(%rsp)
	movl	$rng, %esi
	movq	%r15, %rdi
	movq	%r15, %rdx
	callq	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE
	movl	%eax, 8(%rsp)
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movl	%r13d, (%rax,%r12)
	xorps	%xmm0, %xmm0
	cvtsi2sdl	20(%rsp), %xmm0
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movsd	%xmm0, 8(%rax,%r12)
	xorps	%xmm0, %xmm0
	cvtsi2sdl	16(%rsp), %xmm0
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movsd	%xmm0, 16(%rax,%r12)
	xorps	%xmm0, %xmm0
	cvtsi2sdl	12(%rsp), %xmm0
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movsd	%xmm0, 24(%rax,%r12)
	xorps	%xmm0, %xmm0
	cvtsi2sdl	8(%rsp), %xmm0
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	movsd	%xmm0, 32(%rax,%r12)
	incq	%r13
	movslq	host_n(%rip), %rax
	addq	$56, %r12
	cmpq	%rax, %r13
	jl	.LBB9_13
.LBB9_14:
	movl	$1852404336, %eax               # imm = 0x6E697270
	xorl	66(%rsp), %eax
	movzwl	70(%rsp), %ecx
	xorl	$116, %ecx
	movl	$0, 32(%rsp)                    # 4-byte Folded Spill
	orl	%eax, %ecx
	setne	%bpl
	movl	$n, %edi
	movl	$host_n, %esi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	leaq	44(%rsp), %rsi
	movl	$l, %edi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	leaq	40(%rsp), %rsi
	movl	$r, %edi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	leaq	36(%rsp), %r14
	movl	$s, %edi
	movl	$4, %edx
	movq	%r14, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	movl	(%r14), %edi
	testl	%edi, %edi
	movl	4(%rsp), %r14d                  # 4-byte Reload
	jle	.LBB9_52
# %bb.15:                               # %.lr.ph125
	movl	32(%rsp), %eax                  # 4-byte Reload
	movb	%bpl, %al
	movl	%eax, 32(%rsp)                  # 4-byte Spill
	movabsq	$4294967296, %r15               # imm = 0x100000000
	movl	%r14d, %r12d
	btsq	$32, %r12
	movl	24(%rsp), %ebx                  # 4-byte Reload
	movl	%ebx, %r13d
	btsq	$32, %r13
	imull	%r14d, %ebx
	addq	$2, %r15
	xorl	%ebp, %ebp
.LBB9_16:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_30 Depth 2
                                        #     Child Loop BB9_22 Depth 2
                                        #       Child Loop BB9_24 Depth 3
                                        #       Child Loop BB9_42 Depth 3
                                        #     Child Loop BB9_37 Depth 2
	cmpl	$0, 32(%rsp)                    # 4-byte Folded Reload
	je	.LBB9_18
# %bb.17:                               #   in Loop: Header=BB9_16 Depth=1
	testl	%ebp, %ebp
	jne	.LBB9_19
.LBB9_18:                               #   in Loop: Header=BB9_16 Depth=1
	movl	%ebp, %edi
	callq	_Z15print_particlesi
.LBB9_19:                               #   in Loop: Header=BB9_16 Depth=1
	movl	host_n(%rip), %eax
	testl	%eax, %eax
	movl	%ebp, 60(%rsp)                  # 4-byte Spill
	jle	.LBB9_20
# %bb.29:                               # %.lr.ph113.preheader
                                        #   in Loop: Header=BB9_16 Depth=1
	imulq	$56, %rax, %rcx
	xorl	%edx, %edx
	xorl	%edi, %edi
.LBB9_30:                               # %.lr.ph113
                                        #   Parent Loop BB9_16 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	particles(%rip), %rsi
	movq	(%rsi), %rsi
	movb	%dil, 48(%rsi,%rdx)
	movq	particles(%rip), %rsi
	movq	(%rsi), %rsi
	movb	%dil, 49(%rsi,%rdx)
	addq	$56, %rdx
	cmpq	%rdx, %rcx
	jne	.LBB9_30
	jmp	.LBB9_21
.LBB9_20:                               #   in Loop: Header=BB9_16 Depth=1
	xorl	%eax, %eax
.LBB9_21:                               # %.preheader101
                                        #   in Loop: Header=BB9_16 Depth=1
	movl	%eax, (%rsp)
	xorps	%xmm0, %xmm0
	movsd	%xmm0, 48(%rsp)                 # 8-byte Spill
.LBB9_22:                               # %.preheader100
                                        #   Parent Loop BB9_16 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB9_24 Depth 3
                                        #       Child Loop BB9_42 Depth 3
	cmpl	$0, host_n(%rip)
	jle	.LBB9_27
# %bb.23:                               # %.lr.ph115
                                        #   in Loop: Header=BB9_22 Depth=2
	movsd	.LCPI9_0(%rip), %xmm0           # xmm0 = mem[0],zero
	subsd	48(%rsp), %xmm0                 # 8-byte Folded Reload
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	xorl	%ebp, %ebp
.LBB9_24:                               #   Parent Loop BB9_16 Depth=1
                                        #     Parent Loop BB9_22 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_26
# %bb.25:                               #   in Loop: Header=BB9_24 Depth=3
	movl	%r14d, %edi
	movsd	24(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movl	%ebp, %esi
	callq	_Z36__device_stub__find_first_collisionsidi
.LBB9_26:                               #   in Loop: Header=BB9_24 Depth=3
	callq	hipDeviceSynchronize
	callq	_Z15checkCudaErrorsv
	addl	%r14d, %ebp
	cmpl	host_n(%rip), %ebp
	jl	.LBB9_24
.LBB9_27:                               # %._crit_edge116
                                        #   in Loop: Header=BB9_22 Depth=2
	movq	wallCol(%rip), %rax
	cmpl	$0, 8(%rax)
	movq	partCol(%rip), %rcx
	je	.LBB9_28
# %bb.31:                               #   in Loop: Header=BB9_22 Depth=2
	cmpl	$5, 8(%rcx)
	movq	%rax, %rdx
	movl	$0, %esi
	jne	.LBB9_33
# %bb.32:                               #   in Loop: Header=BB9_22 Depth=2
	movsd	16(%rcx), %xmm0                 # xmm0 = mem[0],zero
	ucomisd	16(%rax), %xmm0
	cmovaeq	%rax, %rcx
	movq	%rcx, %rdx
	jmp	.LBB9_33
.LBB9_28:                               #   in Loop: Header=BB9_22 Depth=2
	movq	%rcx, %rdx
	xorl	%esi, %esi
.LBB9_33:                               # %_Z14whichCollisionv.exit
                                        #   in Loop: Header=BB9_22 Depth=2
	movslq	(%rdx), %rdi
	movslq	4(%rdx), %r8
	movl	8(%rdx), %ebp
	movsd	16(%rdx), %xmm0                 # xmm0 = mem[0],zero
	movl	%esi, 8(%rax)
	movabsq	$4746794007244308480, %rcx      # imm = 0x41DFFFFFFFC00000
	movq	%rcx, 16(%rax)
	movl	$2147483647, %edx               # imm = 0x7FFFFFFF
	movl	%edx, (%rax)
	movq	partCol(%rip), %rax
	movl	%esi, 8(%rax)
	movq	%rcx, 16(%rax)
	movl	%edx, (%rax)
	movq	partCol(%rip), %rax
	movl	%edx, 4(%rax)
	movl	host_n(%rip), %eax
	testl	%ebp, %ebp
	je	.LBB9_35
# %bb.34:                               # %_Z14whichCollisionv.exit
                                        #   in Loop: Header=BB9_22 Depth=2
	ucomisd	.LCPI9_1(%rip), %xmm0
	jb	.LBB9_35
# %bb.40:                               # %.preheader
                                        #   in Loop: Header=BB9_22 Depth=2
	movq	%r8, 96(%rsp)                   # 8-byte Spill
	movq	%rdi, 72(%rsp)                  # 8-byte Spill
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	testl	%eax, %eax
	jle	.LBB9_45
# %bb.41:                               # %.lr.ph120.preheader
                                        #   in Loop: Header=BB9_22 Depth=2
	xorl	%r14d, %r14d
.LBB9_42:                               # %.lr.ph120
                                        #   Parent Loop BB9_16 Depth=1
                                        #     Parent Loop BB9_22 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_44
# %bb.43:                               #   in Loop: Header=BB9_42 Depth=3
	movl	4(%rsp), %edi                   # 4-byte Reload
	movsd	24(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movl	%r14d, %esi
	callq	_Z32__device_stub__advanceParticlesPidi
.LBB9_44:                               #   in Loop: Header=BB9_42 Depth=3
	callq	hipDeviceSynchronize
	callq	_Z15checkCudaErrorsv
	addl	%ebx, %r14d
	cmpl	host_n(%rip), %r14d
	jl	.LBB9_42
.LBB9_45:                               # %._crit_edge121
                                        #   in Loop: Header=BB9_22 Depth=2
	movq	particles(%rip), %rax
	movq	(%rax), %rax
	cmpl	$5, %ebp
	jne	.LBB9_47
# %bb.46:                               #   in Loop: Header=BB9_22 Depth=2
	imulq	$56, 72(%rsp), %rdi             # 8-byte Folded Reload
	addq	%rax, %rdi
	imulq	$56, 96(%rsp), %rsi             # 8-byte Folded Reload
	addq	%rax, %rsi
	callq	_Z16collideParticlesR10particle_tS0_
	movl	4(%rsp), %r14d                  # 4-byte Reload
	jmp	.LBB9_50
.LBB9_47:                               #   in Loop: Header=BB9_22 Depth=2
	movq	72(%rsp), %rdi                  # 8-byte Reload
	imulq	$56, %rdi, %rcx
	cmpb	$0, 48(%rax,%rcx)
	movl	4(%rsp), %r14d                  # 4-byte Reload
	je	.LBB9_48
# %bb.49:                               #   in Loop: Header=BB9_22 Depth=2
	movb	$1, 49(%rax,%rcx)
	jmp	.LBB9_50
.LBB9_48:                               #   in Loop: Header=BB9_22 Depth=2
                                        # kill: def $edi killed $edi killed $rdi
	movl	%ebp, %esi
	callq	_Z11collideWalli8CollType
.LBB9_50:                               # %.loopexit
                                        #   in Loop: Header=BB9_22 Depth=2
	movsd	48(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	addsd	24(%rsp), %xmm1                 # 8-byte Folded Reload
	movsd	.LCPI9_0(%rip), %xmm0           # xmm0 = mem[0],zero
	movsd	%xmm1, 48(%rsp)                 # 8-byte Spill
	ucomisd	%xmm1, %xmm0
	ja	.LBB9_22
	jmp	.LBB9_51
.LBB9_35:                               # %.preheader99
                                        #   in Loop: Header=BB9_16 Depth=1
	testl	%eax, %eax
	jle	.LBB9_51
# %bb.36:                               # %.lr.ph118
                                        #   in Loop: Header=BB9_16 Depth=1
	movsd	.LCPI9_0(%rip), %xmm0           # xmm0 = mem[0],zero
	subsd	48(%rsp), %xmm0                 # 8-byte Folded Reload
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	xorl	%ebp, %ebp
.LBB9_37:                               #   Parent Loop BB9_16 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_39
# %bb.38:                               #   in Loop: Header=BB9_37 Depth=2
	movl	%r14d, %edi
	movsd	24(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movl	%ebp, %esi
	callq	_Z32__device_stub__advanceParticlesPidi
.LBB9_39:                               #   in Loop: Header=BB9_37 Depth=2
	callq	hipDeviceSynchronize
	callq	_Z15checkCudaErrorsv
	addl	%ebx, %ebp
	cmpl	host_n(%rip), %ebp
	jl	.LBB9_37
.LBB9_51:                               # %.loopexit.thread
                                        #   in Loop: Header=BB9_16 Depth=1
	movl	60(%rsp), %ebp                  # 4-byte Reload
	incl	%ebp
	movl	36(%rsp), %edi
	cmpl	%edi, %ebp
	jl	.LBB9_16
.LBB9_52:                               # %._crit_edge126
	callq	_Z16print_statisticsi
	xorl	%eax, %eax
	jmp	.LBB9_53
.LBB9_54:
	movq	(%rsi), %rsi
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$1, %eax
.LBB9_53:
                                        # kill: def $eax killed $eax killed $rax
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end9:
	.size	main, .Lfunc_end9-main
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE,"axG",@progbits,_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE,comdat
	.weak	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE # -- Begin function _ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE
	.p2align	1, 0x90
	.type	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE,@function
_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE: # @_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r14
	movslq	4(%rdx), %r15
	movq	%rdx, 8(%rsp)                   # 8-byte Spill
	movslq	(%rdx), %rax
	subq	%rax, %r15
	movl	$4294967294, %eax               # imm = 0xFFFFFFFE
	cmpq	%rax, %r15
	ja	.LBB10_2
# %bb.1:
	incl	%r15d
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_ZNSt24uniform_int_distributionIiE5_S_ndImSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEjEET1_RT0_S4_
	movl	%eax, %eax
	jmp	.LBB10_7
.LBB10_2:
	movl	$4294967295, %eax               # imm = 0xFFFFFFFF
	cmpq	%rax, %r15
	jne	.LBB10_3
# %bb.6:
	movq	%r14, %rdi
	callq	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	jmp	.LBB10_7
.LBB10_3:                               # %.preheader
	movq	%rdi, %r12
	movabsq	$-4294967296, %rbx              # imm = 0xFFFFFFFF00000000
	leaq	16(%rsp), %r13
.LBB10_4:                               # =>This Inner Loop Header: Depth=1
	movq	%rbx, 16(%rsp)
	movq	%r12, %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	callq	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE
	movl	%eax, %ebp
	shlq	$32, %rbp
	movq	%r14, %rdi
	callq	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	addq	%rbp, %rax
	setb	%cl
	cmpq	%r15, %rax
	ja	.LBB10_4
# %bb.5:                                #   in Loop: Header=BB10_4 Depth=1
	testb	%cl, %cl
	jne	.LBB10_4
.LBB10_7:                               # %.loopexit
	movq	8(%rsp), %rcx                   # 8-byte Reload
	addl	(%rcx), %eax
                                        # kill: def $eax killed $eax killed $rax
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end10:
	.size	_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE, .Lfunc_end10-_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_RKNS0_10param_typeE
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt24uniform_int_distributionIiE5_S_ndImSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEjEET1_RT0_S4_,"axG",@progbits,_ZNSt24uniform_int_distributionIiE5_S_ndImSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEjEET1_RT0_S4_,comdat
	.weak	_ZNSt24uniform_int_distributionIiE5_S_ndImSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEjEET1_RT0_S4_ # -- Begin function _ZNSt24uniform_int_distributionIiE5_S_ndImSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEjEET1_RT0_S4_
	.p2align	1, 0x90
	.type	_ZNSt24uniform_int_distributionIiE5_S_ndImSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEjEET1_RT0_S4_,@function
_ZNSt24uniform_int_distributionIiE5_S_ndImSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEjEET1_RT0_S4_: # @_ZNSt24uniform_int_distributionIiE5_S_ndImSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEjEET1_RT0_S4_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebp
	movq	%rdi, %rbx
	callq	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	movq	%rax, %rcx
	movl	%ebp, %r14d
	imulq	%r14, %rcx
	cmpl	%ebp, %ecx
	jae	.LBB11_4
# %bb.1:
	movl	%ebp, %eax
	negl	%eax
	xorl	%edx, %edx
	divl	%ebp
	cmpl	%ecx, %edx
	jbe	.LBB11_4
# %bb.2:                                # %.lr.ph.preheader
	movl	%edx, %ebp
.LBB11_3:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	movq	%rax, %rcx
	imulq	%r14, %rcx
	cmpl	%ecx, %ebp
	ja	.LBB11_3
.LBB11_4:                               # %.loopexit
	shrq	$32, %rcx
	movl	%ecx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end11:
	.size	_ZNSt24uniform_int_distributionIiE5_S_ndImSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEjEET1_RT0_S4_, .Lfunc_end11-_ZNSt24uniform_int_distributionIiE5_S_ndImSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEjEET1_RT0_S4_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv,"axG",@progbits,_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv,comdat
	.weak	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv # -- Begin function _ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	.p2align	1, 0x90
	.type	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv,@function
_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv: # @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movq	4992(%rdi), %rax
	cmpq	$624, %rax                      # imm = 0x270
	jb	.LBB12_2
# %bb.1:
	movq	%rbx, %rdi
	callq	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv
	movq	4992(%rbx), %rax
.LBB12_2:
	leaq	1(%rax), %rcx
	movq	%rcx, 4992(%rbx)
	movq	(%rbx,%rax,8), %rax
	movq	%rax, %rcx
	shrq	$11, %rcx
	movl	%ecx, %ecx
	xorq	%rax, %rcx
	movl	%ecx, %eax
	shll	$7, %eax
	andl	$-1658038656, %eax              # imm = 0x9D2C5680
	xorq	%rcx, %rax
	movl	%eax, %ecx
	shll	$15, %ecx
	andl	$-272236544, %ecx               # imm = 0xEFC60000
	xorq	%rax, %rcx
	movq	%rcx, %rax
	shrq	$18, %rax
	xorq	%rcx, %rax
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end12:
	.size	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv, .Lfunc_end12-_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv,"axG",@progbits,_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv,comdat
	.weak	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv # -- Begin function _ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv
	.p2align	1, 0x90
	.type	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv,@function
_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv: # @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv
	.cfi_startproc
# %bb.0:
	movl	$2567483615, %eax               # imm = 0x9908B0DF
	movq	(%rdi), %rdx
	xorl	%ecx, %ecx
.LBB13_1:                               # =>This Inner Loop Header: Depth=1
	andq	$-2147483648, %rdx              # imm = 0x80000000
	movq	8(%rdi,%rcx,8), %rsi
	movl	%esi, %r8d
	andl	$2147483646, %r8d               # imm = 0x7FFFFFFE
	orq	%rdx, %r8
	shrq	%r8
	xorq	3176(%rdi,%rcx,8), %r8
	movq	%rsi, %rdx
                                        # kill: def $esi killed $esi killed $rsi def $rsi
	andl	$1, %esi
	negl	%esi
	andl	%eax, %esi
	xorq	%r8, %rsi
	movq	%rsi, (%rdi,%rcx,8)
	leaq	1(%rcx), %rsi
	movq	%rsi, %rcx
	cmpq	$227, %rsi
	jne	.LBB13_1
# %bb.2:                                # %.preheader.preheader
	movq	1816(%rdi), %rdx
	movl	$228, %ecx
.LBB13_3:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	andq	$-2147483648, %rdx              # imm = 0x80000000
	movq	(%rdi,%rcx,8), %rsi
	movl	%esi, %r8d
	andl	$2147483646, %r8d               # imm = 0x7FFFFFFE
	orq	%rdx, %r8
	shrq	%r8
	xorq	-1824(%rdi,%rcx,8), %r8
	movq	%rsi, %rdx
                                        # kill: def $esi killed $esi killed $rsi def $rsi
	andl	$1, %esi
	negl	%esi
	andl	%eax, %esi
	xorq	%r8, %rsi
	movq	%rsi, -8(%rdi,%rcx,8)
	incq	%rcx
	cmpq	$624, %rcx                      # imm = 0x270
	jne	.LBB13_3
# %bb.4:
	movq	$-2147483648, %rcx              # imm = 0x80000000
	andq	4984(%rdi), %rcx
	movq	(%rdi), %rdx
	movl	%edx, %esi
	andl	$2147483646, %esi               # imm = 0x7FFFFFFE
	orq	%rcx, %rsi
	shrq	%rsi
	xorq	3168(%rdi), %rsi
	andl	$1, %edx
	negl	%edx
	andl	%eax, %edx
	xorq	%rsi, %rdx
	movq	%rdx, 4984(%rdi)
	movq	$0, 4992(%rdi)
	retq
.Lfunc_end13:
	.size	_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv, .Lfunc_end13-_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE11_M_gen_randEv
	.cfi_endproc
                                        # -- End function
	.section	.text.startup,"ax",@progbits
	.type	_GLOBAL__sub_I_main.hip,@function # -- Begin function _GLOBAL__sub_I_main.hip
_GLOBAL__sub_I_main.hip:                # @_GLOBAL__sub_I_main.hip
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	xorl	%edi, %edi
	callq	time
	movl	%eax, %eax
	movq	%rax, rng(%rip)
	movl	$1, %ecx
.LBB14_1:                               # =>This Inner Loop Header: Depth=1
	movq	%rax, %rdx
	shrq	$30, %rdx
	xorl	%eax, %edx
	imull	$1812433253, %edx, %eax         # imm = 0x6C078965
	addl	%ecx, %eax
	movq	%rax, rng(,%rcx,8)
	incq	%rcx
	cmpq	$624, %rcx                      # imm = 0x270
	jne	.LBB14_1
# %bb.2:                                # %__cxx_global_var_init.exit
	movq	$624, rng+4992(%rip)            # imm = 0x270
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end14:
	.size	_GLOBAL__sub_I_main.hip, .Lfunc_end14-_GLOBAL__sub_I_main.hip
	.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
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB15_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB15_2:
	subq	$32, %rsp
	.cfi_adjust_cfa_offset 32
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z21find_first_collisionsidi, %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	$_Z17advanceParticlesPidi, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	addq	$32, %rsp
	.cfi_adjust_cfa_offset -32
	movl	$l, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$r, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$s, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$n, %esi
	movl	$.L__unnamed_6, %edx
	movl	$.L__unnamed_6, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$particles, %esi
	movl	$particles.managed, %edx
	movl	$.L__unnamed_7, %ecx
	movl	$8, %r8d
	movq	%rbx, %rdi
	movl	$8, %r9d
	callq	__hipRegisterManagedVar
	movl	$wallCol, %esi
	movl	$wallCol.managed, %edx
	movl	$.L__unnamed_8, %ecx
	movl	$24, %r8d
	movq	%rbx, %rdi
	movl	$8, %r9d
	callq	__hipRegisterManagedVar
	movl	$partCol, %esi
	movl	$partCol.managed, %edx
	movl	$.L__unnamed_9, %ecx
	movl	$24, %r8d
	movq	%rbx, %rdi
	movl	$8, %r9d
	callq	__hipRegisterManagedVar
	movl	$__hip_module_dtor, %edi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end15:
	.size	__hip_module_ctor, .Lfunc_end15-__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	.LBB16_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
.LBB16_2:
	retq
.Lfunc_end16:
	.size	__hip_module_dtor, .Lfunc_end16-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	rng,@object                     # @rng
	.bss
	.globl	rng
	.p2align	3, 0x0
rng:
	.zero	5000
	.size	rng, 5000

	.type	l,@object                       # @l
	.local	l
	.comm	l,4,4
	.type	r,@object                       # @r
	.local	r
	.comm	r,4,4
	.type	s,@object                       # @s
	.local	s
	.comm	s,4,4
	.type	n,@object                       # @n
	.local	n
	.comm	n,4,4
	.type	particles.managed,@object       # @particles.managed
	.local	particles.managed
	.comm	particles.managed,8,8
	.type	wallCol.managed,@object         # @wallCol.managed
	.data
	.p2align	3, 0x0
wallCol.managed:
	.long	2147483647                      # 0x7fffffff
	.long	2147483647                      # 0x7fffffff
	.long	0                               # 0x0
	.zero	4
	.quad	0x41dfffffffc00000              # double 2147483647
	.size	wallCol.managed, 24

	.type	partCol.managed,@object         # @partCol.managed
	.p2align	3, 0x0
partCol.managed:
	.long	2147483647                      # 0x7fffffff
	.long	2147483647                      # 0x7fffffff
	.long	0                               # 0x0
	.zero	4
	.quad	0x41dfffffffc00000              # double 2147483647
	.size	partCol.managed, 24

	.type	host_n,@object                  # @host_n
	.bss
	.globl	host_n
	.p2align	2, 0x0
host_n:
	.long	0                               # 0x0
	.size	host_n, 4

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

	.type	_Z17advanceParticlesPidi,@object # @_Z17advanceParticlesPidi
	.globl	_Z17advanceParticlesPidi
	.p2align	3, 0x0
_Z17advanceParticlesPidi:
	.quad	_Z32__device_stub__advanceParticlesPidi
	.size	_Z17advanceParticlesPidi, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Last CUDA error %s\n"
	.size	.L.str, 20

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"%d %d %f %f %f %f\n"
	.size	.L.str.1, 19

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Usage:\n%s (optional) num_threads < input\n"
	.size	.L.str.3, 42

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"%d"
	.size	.L.str.4, 3

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"%5s"
	.size	.L.str.5, 4

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"%d particles, %d threads per block, %d blocks.\n"
	.size	.L.str.6, 48

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"%d %d %d %d %d"
	.size	.L.str.7, 15

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"print"
	.size	.L.str.8, 6

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z21find_first_collisionsidi"
	.size	.L__unnamed_1, 29

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z17advanceParticlesPidi"
	.size	.L__unnamed_2, 25

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

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"r"
	.size	.L__unnamed_4, 2

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"s"
	.size	.L__unnamed_5, 2

	.type	.L__unnamed_6,@object           # @5
.L__unnamed_6:
	.asciz	"n"
	.size	.L__unnamed_6, 2

	.type	.L__unnamed_7,@object           # @6
.L__unnamed_7:
	.asciz	"particles"
	.size	.L__unnamed_7, 10

	.type	particles,@object               # @particles
	.local	particles
	.comm	particles,8,8
	.type	.L__unnamed_8,@object           # @7
.L__unnamed_8:
	.asciz	"wallCol"
	.size	.L__unnamed_8, 8

	.type	wallCol,@object                 # @wallCol
	.local	wallCol
	.comm	wallCol,8,8
	.type	.L__unnamed_9,@object           # @8
.L__unnamed_9:
	.asciz	"partCol"
	.size	.L__unnamed_9, 8

	.type	partCol,@object                 # @partCol
	.local	partCol
	.comm	partCol,8,8
	.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	_GLOBAL__sub_I_main.hip
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z36__device_stub__find_first_collisionsidi
	.addrsig_sym _Z32__device_stub__advanceParticlesPidi
	.addrsig_sym _GLOBAL__sub_I_main.hip
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym rng
	.addrsig_sym l
	.addrsig_sym r
	.addrsig_sym s
	.addrsig_sym n
	.addrsig_sym particles.managed
	.addrsig_sym wallCol.managed
	.addrsig_sym partCol.managed
	.addrsig_sym host_n
	.addrsig_sym _Z21find_first_collisionsidi
	.addrsig_sym _Z17advanceParticlesPidi
	.addrsig_sym particles
	.addrsig_sym wallCol
	.addrsig_sym partCol
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z21find_first_collisionsidi ; -- Begin function _Z21find_first_collisionsidi
	.globl	_Z21find_first_collisionsidi
	.p2align	8
	.type	_Z21find_first_collisionsidi,@function
_Z21find_first_collisionsidi:           ; @_Z21find_first_collisionsidi
; %bb.0:
	s_mov_b32 s2, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB0_2
; %bb.1:
	v_dual_mov_b32 v1, 0x4f000000 :: v_dual_mov_b32 v2, 0
	ds_store_b32 v2, v1 offset:4
.LBB0_2:
	s_or_b32 exec_lo, exec_lo, s2
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, n@rel32@lo+4
	s_addc_u32 s3, s3, n@rel32@hi+12
	v_bfrev_b32_e32 v14, -2
	s_load_b32 s4, s[0:1], 0x0
	s_load_b32 s11, s[2:3], 0x0
	s_clause 0x1
	s_load_b32 s8, s[0:1], 0x10
	s_load_b64 s[2:3], s[0:1], 0x8
	v_mov_b32_e32 v16, 0
                                        ; implicit-def: $vgpr15
	ds_store_b32 v16, v14
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cmp_gt_i32 s11, s4
	s_cselect_b32 s0, s8, 0
	s_cmp_lg_u32 s15, 0
	v_add_nc_u32_e32 v4, s0, v0
	s_cselect_b32 s1, -1, 0
                                        ; implicit-def: $vgpr0_vgpr1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cmp_le_i32_e64 s0, s11, v4
	v_cmp_gt_i32_e32 vcc_lo, s11, v4
	s_or_b32 s0, s1, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_saveexec_b32 s1, s0
	s_xor_b32 s9, exec_lo, s1
	s_cbranch_execz .LBB0_33
; %bb.3:
	s_mov_b32 s0, 0xffc00000
	s_mov_b32 s1, 0x41dfffff
	s_cmp_eq_u32 s15, 1
	v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
	v_bfrev_b32_e32 v15, -2
	s_cselect_b32 s4, -1, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s4, s4, vcc_lo
	s_and_saveexec_b32 s10, s4
	s_cbranch_execz .LBB0_32
; %bb.4:
	s_getpc_b64 s[4:5]
	s_add_u32 s4, s4, particles@rel32@lo+4
	s_addc_u32 s5, s5, particles@rel32@hi+12
	s_cmp_gt_i32 s11, 0
	s_load_b64 s[4:5], s[4:5], 0x0
	v_bfrev_b32_e32 v14, -2
	v_mov_b32_e32 v16, 0
	v_bfrev_b32_e32 v15, -2
	s_waitcnt lgkmcnt(0)
	s_load_b64 s[4:5], s[4:5], 0x0
	s_waitcnt lgkmcnt(0)
	v_mad_i64_i32 v[6:7], null, v4, 56, s[4:5]
	flat_load_u8 v0, v[6:7] offset:48
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_cmp_eq_u16_e32 vcc_lo, 0, v0
	v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
	s_cselect_b32 s0, -1, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s0, vcc_lo, s0
	s_and_saveexec_b32 s1, s0
	s_cbranch_execz .LBB0_15
; %bb.5:                                ; %.lr.ph
	flat_load_b32 v17, v[6:7]
	s_getpc_b64 s[6:7]
	s_add_u32 s6, s6, r@rel32@lo+4
	s_addc_u32 s7, s7, r@rel32@hi+12
	v_add_co_u32 v4, vcc_lo, v6, 24
	s_load_b32 s0, s[6:7], 0x0
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v7, vcc_lo
	s_mov_b32 s6, 0xffc00000
	v_add_co_u32 v6, vcc_lo, v6, 8
	s_mov_b32 s7, 0x41dfffff
	v_mov_b32_e32 v0, s6
	v_add_co_ci_u32_e32 v7, vcc_lo, 0, v7, vcc_lo
	v_bfrev_b32_e32 v14, -2
	v_dual_mov_b32 v16, 0 :: v_dual_mov_b32 v1, s7
	v_bfrev_b32_e32 v15, -2
	s_waitcnt lgkmcnt(0)
	s_lshl_b32 s0, s0, 1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s0, s0, s0
	v_cvt_f64_i32_e32 v[2:3], s0
.LBB0_6:                                ; =>This Inner Loop Header: Depth=1
	v_dual_mov_b32 v9, s5 :: v_dual_mov_b32 v8, s4
	s_mov_b32 s12, exec_lo
	flat_load_b32 v18, v[8:9]
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_cmpx_ne_u32_e64 v17, v18
	s_cbranch_execz .LBB0_14
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	v_dual_mov_b32 v9, s5 :: v_dual_mov_b32 v8, s4
	s_mov_b32 s13, exec_lo
	flat_load_u8 v8, v[8:9] offset:48
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_cmpx_eq_u16_e32 0, v8
	s_cbranch_execz .LBB0_13
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	v_dual_mov_b32 v0, s4 :: v_dual_mov_b32 v1, s5
	v_bfrev_b32_e32 v14, -2
	v_mov_b32_e32 v16, 0
	v_bfrev_b32_e32 v15, -2
	flat_load_b128 v[8:11], v[0:1] offset:24
	flat_load_b128 v[19:22], v[4:5]
	s_mov_b32 s14, exec_lo
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_f64 v[12:13], v[10:11], -v[21:22]
	v_add_f64 v[10:11], v[8:9], -v[19:20]
	v_add_f64 v[0:1], v[8:9], -v[21:22]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[8:9], v[12:13], v[12:13]
	v_fma_f64 v[8:9], v[10:11], v[0:1], v[8:9]
	v_dual_mov_b32 v0, s6 :: v_dual_mov_b32 v1, s7
	s_delay_alu instid0(VALU_DEP_2)
	v_cmpx_neq_f64_e32 0, v[8:9]
	s_cbranch_execz .LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	v_dual_mov_b32 v0, s4 :: v_dual_mov_b32 v1, s5
	v_mov_b32_e32 v16, 0
	flat_load_b128 v[19:22], v[6:7]
	flat_load_b128 v[23:26], v[0:1] offset:8
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_f64 v[0:1], v[25:26], -v[21:22]
	v_add_f64 v[14:15], v[23:24], -v[19:20]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_f64 v[19:20], v[0:1], v[0:1]
	v_mul_f64 v[0:1], v[12:13], v[0:1]
	v_fma_f64 v[12:13], v[14:15], v[14:15], v[19:20]
	v_mul_f64 v[19:20], v[8:9], -4.0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_fma_f64 v[0:1], v[10:11], v[14:15], v[0:1]
	v_add_f64 v[8:9], v[8:9], v[8:9]
	v_add_f64 v[10:11], v[12:13], -v[2:3]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[12:13], v[0:1], v[0:1]
	v_mul_f64 v[10:11], v[19:20], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], v[12:13], v[12:13], v[10:11]
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[10:11]
	v_cndmask_b32_e64 v12, 0, 1, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b32_e32 v12, 8, v12
	v_ldexp_f64 v[10:11], v[10:11], v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_rsq_f64_e32 v[12:13], v[10:11]
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[14:15], v[10:11], v[12:13]
	v_mul_f64 v[12:13], v[12:13], 0.5
	v_fma_f64 v[19:20], -v[12:13], v[14:15], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[14:15], v[14:15], v[19:20], v[14:15]
	v_fma_f64 v[12:13], v[12:13], v[19:20], v[12:13]
	v_fma_f64 v[19:20], -v[14:15], v[14:15], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[14:15], v[19:20], v[12:13], v[14:15]
	v_fma_f64 v[19:20], -v[14:15], v[14:15], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_fma_f64 v[12:13], v[19:20], v[12:13], v[14:15]
	v_cndmask_b32_e64 v14, 0, 0xffffff80, vcc_lo
	v_cmp_class_f64_e64 vcc_lo, v[10:11], 0x260
	v_ldexp_f64 v[12:13], v[12:13], v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_cndmask_b32 v11, v13, v11 :: v_dual_cndmask_b32 v10, v12, v10
	v_fma_f64 v[0:1], v[0:1], -2.0, -v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f64 v[10:11], null, v[8:9], v[8:9], v[0:1]
	v_div_scale_f64 v[19:20], vcc_lo, v[0:1], v[8:9], v[0:1]
	v_rcp_f64_e32 v[12:13], v[10:11]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[14:15], -v[10:11], v[12:13], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[12:13], v[12:13], v[14:15], v[12:13]
	v_fma_f64 v[14:15], -v[10:11], v[12:13], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[12:13], v[12:13], v[14:15], v[12:13]
	v_mul_f64 v[14:15], v[19:20], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], -v[10:11], v[14:15], v[19:20]
	v_div_fmas_f64 v[10:11], v[10:11], v[12:13], v[14:15]
	v_bfrev_b32_e32 v14, -2
	v_bfrev_b32_e32 v15, -2
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_fixup_f64 v[8:9], v[10:11], v[8:9], v[0:1]
	v_dual_mov_b32 v0, s6 :: v_dual_mov_b32 v1, s7
	v_cmp_le_f64_e32 vcc_lo, 0, v[8:9]
	v_cmp_gt_f64_e64 s0, s[2:3], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s15, vcc_lo, s0
	s_and_saveexec_b32 s0, s15
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	v_dual_mov_b32 v16, 5 :: v_dual_mov_b32 v15, v18
	v_mov_b32_e32 v14, v17
	v_dual_mov_b32 v0, v8 :: v_dual_mov_b32 v1, v9
; %bb.11:                               ; %Flow127
                                        ;   in Loop: Header=BB0_6 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
.LBB0_12:                               ; %Flow128
                                        ;   in Loop: Header=BB0_6 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s14
.LBB0_13:                               ; %Flow129
                                        ;   in Loop: Header=BB0_6 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s13
.LBB0_14:                               ; %_Z17calcCollisionTimeR10particle_tS0_d.exit
                                        ;   in Loop: Header=BB0_6 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s12
	s_add_i32 s11, s11, -1
	s_add_u32 s4, s4, 56
	s_addc_u32 s5, s5, 0
	s_cmp_lg_u32 s11, 0
	s_cbranch_scc1 .LBB0_6
.LBB0_15:                               ; %Flow132
	s_or_b32 exec_lo, exec_lo, s1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_eq_u32_e32 5, v16
	s_cbranch_execz .LBB0_31
; %bb.16:
	v_cvt_f32_f64_e32 v2, v[0:1]
	v_dual_mov_b32 v3, 0 :: v_dual_mov_b32 v16, 5
	s_mov_b32 s1, exec_lo
	ds_load_b32 v3, v3 offset:4
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_f32_e32 v3, v2
	s_cbranch_execz .LBB0_30
; %bb.17:
	s_mov_b32 s4, exec_lo
                                        ; implicit-def: $sgpr5
	v_cmpx_le_f32_e32 0, v2
	s_xor_b32 s4, exec_lo, s4
	s_cbranch_execz .LBB0_23
; %bb.18:
	s_mov_b32 s6, exec_lo
	s_brev_b32 s5, -2
.LBB0_19:                               ; %ComputeLoop80
                                        ; =>This Inner Loop Header: Depth=1
	s_ctz_i32_b32 s7, s6
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_readlane_b32 s11, v2, s7
	s_lshl_b32 s7, 1, s7
	s_and_not1_b32 s6, s6, s7
	s_delay_alu instid0(VALU_DEP_1)
	s_min_i32 s5, s5, s11
	s_cmp_lg_u32 s6, 0
	s_cbranch_scc1 .LBB0_19
; %bb.20:                               ; %ComputeEnd81
	v_mbcnt_lo_u32_b32 v2, exec_lo, 0
	s_mov_b32 s6, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v2
	s_xor_b32 s6, exec_lo, s6
	s_cbranch_execz .LBB0_22
; %bb.21:
	v_dual_mov_b32 v2, 0 :: v_dual_mov_b32 v3, s5
	ds_min_i32 v2, v3 offset:4
.LBB0_22:                               ; %Flow120
	s_or_b32 exec_lo, exec_lo, s6
	s_mov_b32 s5, 5
                                        ; implicit-def: $vgpr2
.LBB0_23:                               ; %Flow123
	s_or_saveexec_b32 s4, s4
	v_mov_b32_e32 v16, s5
	s_xor_b32 exec_lo, exec_lo, s4
	s_cbranch_execz .LBB0_29
; %bb.24:
	s_mov_b32 s6, exec_lo
	s_mov_b32 s5, 0
.LBB0_25:                               ; %ComputeLoop84
                                        ; =>This Inner Loop Header: Depth=1
	s_ctz_i32_b32 s7, s6
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_readlane_b32 s11, v2, s7
	s_lshl_b32 s7, 1, s7
	s_and_not1_b32 s6, s6, s7
	s_delay_alu instid0(VALU_DEP_1)
	s_max_u32 s5, s5, s11
	s_cmp_lg_u32 s6, 0
	s_cbranch_scc1 .LBB0_25
; %bb.26:                               ; %ComputeEnd85
	v_mbcnt_lo_u32_b32 v2, exec_lo, 0
	s_mov_b32 s6, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v2
	s_xor_b32 s6, exec_lo, s6
	s_cbranch_execz .LBB0_28
; %bb.27:
	v_dual_mov_b32 v2, 0 :: v_dual_mov_b32 v3, s5
	ds_max_u32 v2, v3 offset:4
.LBB0_28:                               ; %Flow121
	s_or_b32 exec_lo, exec_lo, s6
	v_mov_b32_e32 v16, 5
.LBB0_29:                               ; %Flow124
	s_or_b32 exec_lo, exec_lo, s4
.LBB0_30:                               ; %Flow125
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s1
.LBB0_31:                               ; %Flow126
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s0
.LBB0_32:                               ; %Flow133
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s10
                                        ; implicit-def: $vgpr4
.LBB0_33:                               ; %Flow146
	s_and_not1_saveexec_b32 s4, s9
	s_cbranch_execz .LBB0_69
; %bb.34:
	s_getpc_b64 s[0:1]
	s_add_u32 s0, s0, particles@rel32@lo+4
	s_addc_u32 s1, s1, particles@rel32@hi+12
	v_bfrev_b32_e32 v14, -2
	s_load_b64 s[0:1], s[0:1], 0x0
	v_bfrev_b32_e32 v15, -2
	s_mov_b32 s5, exec_lo
	s_waitcnt lgkmcnt(0)
	s_load_b64 s[0:1], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	v_mad_i64_i32 v[2:3], null, v4, 56, s[0:1]
	s_mov_b32 s0, 0xffc00000
	s_mov_b32 s1, 0x41dfffff
	v_mov_b32_e32 v0, s0
	v_dual_mov_b32 v16, 0 :: v_dual_mov_b32 v1, s1
	flat_load_u8 v4, v[2:3] offset:49
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_cmpx_eq_u16_e32 0, v4
	s_cbranch_execz .LBB0_68
; %bb.35:
	flat_load_b64 v[8:9], v[2:3] offset:24
	s_getpc_b64 s[6:7]
	s_add_u32 s6, s6, l@rel32@lo+4
	s_addc_u32 s7, s7, l@rel32@hi+12
	s_getpc_b64 s[10:11]
	s_add_u32 s10, s10, r@rel32@lo+4
	s_addc_u32 s11, s11, r@rel32@hi+12
	s_load_b32 s6, s[6:7], 0x0
	s_load_b32 s7, s[10:11], 0x0
	v_mov_b32_e32 v12, 0
	v_bfrev_b32_e32 v14, -2
	s_waitcnt lgkmcnt(0)
	v_cvt_f64_i32_e32 v[6:7], s6
	v_cvt_f64_i32_e32 v[0:1], s7
	s_delay_alu instid0(VALU_DEP_1)
	v_add_f64 v[4:5], v[6:7], -v[0:1]
	v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
	s_mov_b32 s1, exec_lo
	s_waitcnt vmcnt(0)
	v_cmpx_gt_f64_e32 0, v[8:9]
	s_cbranch_execz .LBB0_39
; %bb.36:
	flat_load_b64 v[0:1], v[2:3] offset:8
	s_mov_b32 s6, 0xffc00000
	s_mov_b32 s7, 0x41dfffff
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_f64 v[0:1], v[0:1], -v[6:7]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[0:1], v[4:5], v[0:1]
	v_div_scale_f64 v[10:11], null, -v[8:9], -v[8:9], v[0:1]
	v_div_scale_f64 v[16:17], vcc_lo, v[0:1], -v[8:9], v[0:1]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[12:13], v[10:11]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[14:15], -v[10:11], v[12:13], 1.0
	v_fma_f64 v[12:13], v[12:13], v[14:15], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[14:15], -v[10:11], v[12:13], 1.0
	v_fma_f64 v[12:13], v[12:13], v[14:15], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[14:15], v[16:17], v[12:13]
	v_fma_f64 v[10:11], -v[10:11], v[14:15], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_div_fmas_f64 v[10:11], v[10:11], v[12:13], v[14:15]
	v_bfrev_b32_e32 v14, -2
	v_mov_b32_e32 v12, 0
	v_div_fixup_f64 v[10:11], v[10:11], -v[8:9], v[0:1]
	v_dual_mov_b32 v0, s6 :: v_dual_mov_b32 v1, s7
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_le_f64_e32 vcc_lo, 0, v[10:11]
	v_cmp_gt_f64_e64 s0, s[2:3], v[10:11]
	s_and_b32 s6, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s0, s6
	s_cbranch_execz .LBB0_38
; %bb.37:
	flat_load_b32 v14, v[2:3]
	v_mov_b32_e32 v0, v10
	v_dual_mov_b32 v12, 1 :: v_dual_mov_b32 v1, v11
.LBB0_38:                               ; %Flow144
	s_or_b32 exec_lo, exec_lo, s0
.LBB0_39:
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s1
	s_mov_b32 s1, exec_lo
	v_cmpx_lt_f64_e32 0, v[8:9]
	s_cbranch_execz .LBB0_43
; %bb.40:
	flat_load_b64 v[10:11], v[2:3] offset:8
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_f64 v[10:11], v[4:5], -v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f64 v[15:16], null, v[8:9], v[8:9], v[10:11]
	v_div_scale_f64 v[21:22], vcc_lo, v[10:11], v[8:9], v[10:11]
	v_rcp_f64_e32 v[17:18], v[15:16]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[19:20], -v[15:16], v[17:18], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[17:18], v[17:18], v[19:20], v[17:18]
	v_fma_f64 v[19:20], -v[15:16], v[17:18], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[17:18], v[17:18], v[19:20], v[17:18]
	v_mul_f64 v[19:20], v[21:22], v[17:18]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[15:16], -v[15:16], v[19:20], v[21:22]
	v_div_fmas_f64 v[15:16], v[15:16], v[17:18], v[19:20]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f64 v[8:9], v[15:16], v[8:9], v[10:11]
	v_cmp_le_f64_e32 vcc_lo, 0, v[8:9]
	v_cmp_gt_f64_e64 s0, s[2:3], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s6, vcc_lo, s0
	s_and_saveexec_b32 s0, s6
	s_cbranch_execz .LBB0_42
; %bb.41:
	flat_load_b32 v14, v[2:3]
	v_mov_b32_e32 v0, v8
	v_dual_mov_b32 v12, 2 :: v_dual_mov_b32 v1, v9
.LBB0_42:                               ; %Flow143
	s_or_b32 exec_lo, exec_lo, s0
.LBB0_43:
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s1
	flat_load_b64 v[8:9], v[2:3] offset:32
	s_mov_b32 s6, exec_lo
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_cmpx_gt_f64_e32 0, v[8:9]
	s_cbranch_execz .LBB0_47
; %bb.44:
	flat_load_b64 v[10:11], v[2:3] offset:16
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_f64 v[6:7], v[10:11], -v[6:7]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[6:7], v[4:5], v[6:7]
	v_div_scale_f64 v[10:11], null, -v[8:9], -v[8:9], v[6:7]
	v_div_scale_f64 v[19:20], vcc_lo, v[6:7], -v[8:9], v[6:7]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[15:16], v[10:11]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[17:18], -v[10:11], v[15:16], 1.0
	v_fma_f64 v[15:16], v[15:16], v[17:18], v[15:16]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[17:18], -v[10:11], v[15:16], 1.0
	v_fma_f64 v[15:16], v[15:16], v[17:18], v[15:16]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[17:18], v[19:20], v[15:16]
	v_fma_f64 v[10:11], -v[10:11], v[17:18], v[19:20]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[10:11], v[10:11], v[15:16], v[17:18]
	v_div_fixup_f64 v[6:7], v[10:11], -v[8:9], v[6:7]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_cmp_gt_f64_e32 vcc_lo, s[2:3], v[6:7]
	v_cmp_lt_f64_e64 s0, v[6:7], v[0:1]
	v_cmp_le_f64_e64 s1, 0, v[6:7]
	s_and_b32 s0, vcc_lo, s0
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	s_and_b32 s1, s0, s1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s0, s1
	s_cbranch_execz .LBB0_46
; %bb.45:
	flat_load_b32 v14, v[2:3]
	v_mov_b32_e32 v0, v6
	v_dual_mov_b32 v12, 4 :: v_dual_mov_b32 v1, v7
.LBB0_46:                               ; %Flow142
	s_or_b32 exec_lo, exec_lo, s0
.LBB0_47:
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s6
	s_mov_b32 s6, exec_lo
	v_cmpx_lt_f64_e32 0, v[8:9]
	s_cbranch_execz .LBB0_51
; %bb.48:
	flat_load_b64 v[6:7], v[2:3] offset:16
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_f64 v[4:5], v[4:5], -v[6:7]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f64 v[8:9], null, v[6:7], v[6:7], v[4:5]
	v_div_scale_f64 v[17:18], vcc_lo, v[4:5], v[6:7], v[4:5]
	v_rcp_f64_e32 v[10:11], v[8:9]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[15:16], -v[8:9], v[10:11], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], v[10:11], v[15:16], v[10:11]
	v_fma_f64 v[15:16], -v[8:9], v[10:11], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], v[10:11], v[15:16], v[10:11]
	v_mul_f64 v[15:16], v[17:18], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[8:9], -v[8:9], v[15:16], v[17:18]
	v_div_fmas_f64 v[8:9], v[8:9], v[10:11], v[15:16]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f64 v[4:5], v[8:9], v[6:7], v[4:5]
	v_cmp_gt_f64_e32 vcc_lo, s[2:3], v[4:5]
	v_cmp_lt_f64_e64 s0, v[4:5], v[0:1]
	v_cmp_le_f64_e64 s1, 0, v[4:5]
	s_delay_alu instid0(VALU_DEP_2)
	s_and_b32 s0, vcc_lo, s0
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	s_and_b32 s1, s0, s1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s0, s1
	s_cbranch_execz .LBB0_50
; %bb.49:
	flat_load_b32 v14, v[2:3]
	v_mov_b32_e32 v0, v4
	v_dual_mov_b32 v12, 3 :: v_dual_mov_b32 v1, v5
.LBB0_50:                               ; %Flow141
	s_or_b32 exec_lo, exec_lo, s0
.LBB0_51:                               ; %_Z17calcCollisionTimeR10particle_tiid.exit
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s6
	v_bfrev_b32_e32 v15, -2
	v_mov_b32_e32 v16, 0
	s_mov_b32 s0, exec_lo
	v_cmpx_ne_u32_e32 0, v12
	s_cbranch_execz .LBB0_67
; %bb.52:
	v_cvt_f32_f64_e32 v2, v[0:1]
	v_mov_b32_e32 v3, 0
	v_bfrev_b32_e32 v15, -2
	s_mov_b32 s1, exec_lo
	ds_load_b32 v3, v3 offset:4
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_f32_e32 v3, v2
	s_cbranch_execz .LBB0_66
; %bb.53:
	s_mov_b32 s2, exec_lo
                                        ; implicit-def: $sgpr3
	v_cmpx_le_f32_e32 0, v2
	s_xor_b32 s2, exec_lo, s2
	s_cbranch_execz .LBB0_59
; %bb.54:
	s_mov_b32 s6, exec_lo
	s_brev_b32 s3, -2
.LBB0_55:                               ; %ComputeLoop
                                        ; =>This Inner Loop Header: Depth=1
	s_ctz_i32_b32 s7, s6
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_readlane_b32 s9, v2, s7
	s_lshl_b32 s7, 1, s7
	s_and_not1_b32 s6, s6, s7
	s_delay_alu instid0(VALU_DEP_1)
	s_min_i32 s3, s3, s9
	s_cmp_lg_u32 s6, 0
	s_cbranch_scc1 .LBB0_55
; %bb.56:                               ; %ComputeEnd
	v_mbcnt_lo_u32_b32 v2, exec_lo, 0
	s_mov_b32 s6, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v2
	s_xor_b32 s6, exec_lo, s6
	s_cbranch_execz .LBB0_58
; %bb.57:
	v_dual_mov_b32 v2, 0 :: v_dual_mov_b32 v3, s3
	ds_min_i32 v2, v3 offset:4
.LBB0_58:                               ; %Flow134
	s_or_b32 exec_lo, exec_lo, s6
	s_brev_b32 s3, -2
                                        ; implicit-def: $vgpr2
.LBB0_59:                               ; %Flow137
	s_or_saveexec_b32 s2, s2
	v_mov_b32_e32 v15, s3
	s_xor_b32 exec_lo, exec_lo, s2
	s_cbranch_execz .LBB0_65
; %bb.60:
	s_mov_b32 s6, exec_lo
	s_mov_b32 s3, 0
.LBB0_61:                               ; %ComputeLoop76
                                        ; =>This Inner Loop Header: Depth=1
	s_ctz_i32_b32 s7, s6
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_readlane_b32 s9, v2, s7
	s_lshl_b32 s7, 1, s7
	s_and_not1_b32 s6, s6, s7
	s_delay_alu instid0(VALU_DEP_1)
	s_max_u32 s3, s3, s9
	s_cmp_lg_u32 s6, 0
	s_cbranch_scc1 .LBB0_61
; %bb.62:                               ; %ComputeEnd77
	v_mbcnt_lo_u32_b32 v2, exec_lo, 0
	s_mov_b32 s6, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v2
	s_xor_b32 s6, exec_lo, s6
	s_cbranch_execz .LBB0_64
; %bb.63:
	v_dual_mov_b32 v2, 0 :: v_dual_mov_b32 v3, s3
	ds_max_u32 v2, v3 offset:4
.LBB0_64:                               ; %Flow135
	s_or_b32 exec_lo, exec_lo, s6
	v_bfrev_b32_e32 v15, -2
.LBB0_65:                               ; %Flow138
	s_or_b32 exec_lo, exec_lo, s2
.LBB0_66:                               ; %Flow139
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s1
	v_mov_b32_e32 v16, v12
.LBB0_67:                               ; %Flow140
	s_or_b32 exec_lo, exec_lo, s0
.LBB0_68:                               ; %Flow145
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s5
.LBB0_69:                               ; %_Z10atomicMinDPff.exit
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s4
	s_mov_b32 s2, 0
	s_mov_b32 s1, 0
	s_mov_b32 s0, exec_lo
	s_waitcnt vmcnt(0) lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
                                        ; implicit-def: $vgpr2
                                        ; implicit-def: $vgpr4
                                        ; implicit-def: $vgpr3
	v_cmpx_lt_i32_e32 4, v16
	s_xor_b32 s0, exec_lo, s0
	s_cbranch_execz .LBB0_79
; %bb.70:                               ; %LeafBlock108
	s_mov_b32 s2, -1
	s_mov_b32 s3, 0
	s_mov_b32 s1, exec_lo
                                        ; implicit-def: $vgpr2
                                        ; implicit-def: $vgpr4
                                        ; implicit-def: $vgpr3
	v_cmpx_eq_u32_e32 5, v16
	s_cbranch_execz .LBB0_78
; %bb.71:
	v_cvt_f32_f64_e32 v4, v[0:1]
	v_mov_b32_e32 v2, 0
	s_mov_b32 s3, -1
	s_mov_b32 s2, exec_lo
                                        ; implicit-def: $vgpr3
	ds_load_b32 v2, v2 offset:4
	s_waitcnt lgkmcnt(0)
	v_cmpx_eq_f32_e32 v2, v4
	s_cbranch_execz .LBB0_77
; %bb.72:
	v_add_nc_u32_e32 v3, v14, v15
	s_mov_b32 s4, exec_lo
	s_brev_b32 s3, -2
                                        ; implicit-def: $vgpr4
.LBB0_73:                               ; %ComputeLoop88
                                        ; =>This Inner Loop Header: Depth=1
	s_ctz_i32_b32 s5, s4
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_readlane_b32 s6, v3, s5
	s_lshl_b32 s7, 1, s5
	v_writelane_b32 v4, s3, s5
	s_and_not1_b32 s4, s4, s7
	s_delay_alu instid0(VALU_DEP_2)
	s_min_i32 s3, s3, s6
	s_cmp_lg_u32 s4, 0
	s_cbranch_scc1 .LBB0_73
; %bb.74:                               ; %ComputeEnd89
	v_mbcnt_lo_u32_b32 v5, exec_lo, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_eq_u32_e32 vcc_lo, 0, v5
                                        ; implicit-def: $vgpr5
	s_and_saveexec_b32 s4, vcc_lo
	s_xor_b32 s4, exec_lo, s4
	s_cbranch_execz .LBB0_76
; %bb.75:
	v_dual_mov_b32 v5, 0 :: v_dual_mov_b32 v6, s3
	ds_min_rtn_i32 v5, v5, v6
.LBB0_76:
	s_or_b32 exec_lo, exec_lo, s4
	s_waitcnt lgkmcnt(0)
	v_readfirstlane_b32 s3, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_min_i32_e32 v4, s3, v4
	s_xor_b32 s3, exec_lo, -1
	v_cmp_ne_u32_e32 vcc_lo, v4, v3
                                        ; implicit-def: $vgpr4
	v_cndmask_b32_e32 v3, 0x7fffffff, v3, vcc_lo
.LBB0_77:                               ; %Flow117
	s_or_b32 exec_lo, exec_lo, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 s3, s3, exec_lo
	s_xor_b32 s2, exec_lo, -1
.LBB0_78:                               ; %Flow116
	s_or_b32 exec_lo, exec_lo, s1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 s1, s3, exec_lo
	s_and_b32 s2, s2, exec_lo
.LBB0_79:                               ; %Flow115
	s_and_not1_saveexec_b32 s0, s0
; %bb.80:                               ; %LeafBlock
	v_cmp_ne_u32_e32 vcc_lo, 0, v16
	v_bfrev_b32_e32 v3, -2
	s_and_not1_b32 s2, s2, exec_lo
                                        ; implicit-def: $vgpr4
	s_and_b32 s3, vcc_lo, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s2, s2, s3
; %bb.81:                               ; %Flow118
	s_or_b32 exec_lo, exec_lo, s0
	s_and_saveexec_b32 s0, s2
	s_cbranch_execz .LBB0_83
; %bb.82:                               ; %_Z10atomicMinDPff.exit._crit_edge
	v_cvt_f32_f64_e32 v4, v[0:1]
	v_mov_b32_e32 v2, 0
	s_or_b32 s1, s1, exec_lo
                                        ; implicit-def: $vgpr3
	ds_load_b32 v2, v2 offset:4
.LBB0_83:                               ; %Flow119
	s_or_b32 exec_lo, exec_lo, s0
	s_and_saveexec_b32 s2, s1
	s_cbranch_execz .LBB0_92
; %bb.84:
	v_bfrev_b32_e32 v3, -2
	s_mov_b32 s3, exec_lo
	s_waitcnt lgkmcnt(0)
	v_cmpx_eq_f32_e32 v2, v4
	s_cbranch_execz .LBB0_91
; %bb.85:
	s_cmp_eq_u32 s8, 0
	s_cselect_b32 s4, -1, 0
	s_getpc_b64 s[0:1]
	s_add_u32 s0, s0, wallCol@rel32@lo+4
	s_addc_u32 s1, s1, wallCol@rel32@hi+12
	s_and_b32 vcc_lo, exec_lo, s4
	s_load_b64 s[0:1], s[0:1], 0x0
	s_cbranch_vccnz .LBB0_87
; %bb.86:
	s_waitcnt lgkmcnt(0)
	s_load_b64 s[6:7], s[0:1], 0x10
	s_and_not1_b32 s4, s4, exec_lo
	s_brev_b32 s5, -2
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_f64_e32 vcc_lo, s[6:7], v[0:1]
	s_and_b32 s6, vcc_lo, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s4, s4, s6
	s_branch .LBB0_88
.LBB0_87:
                                        ; implicit-def: $sgpr5
.LBB0_88:                               ; %Flow112
	v_mov_b32_e32 v3, s5
	s_and_saveexec_b32 s5, s4
	s_cbranch_execz .LBB0_90
; %bb.89:
	v_mov_b32_e32 v2, 0
	v_bfrev_b32_e32 v3, -2
	s_waitcnt lgkmcnt(0)
	s_clause 0x2
	global_store_b64 v2, v[0:1], s[0:1] offset:16
	global_store_b32 v2, v16, s[0:1] offset:8
	global_store_b32 v2, v14, s[0:1]
.LBB0_90:                               ; %Flow113
	s_or_b32 exec_lo, exec_lo, s5
.LBB0_91:                               ; %Flow114
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s3
.LBB0_92:
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s2
	s_waitcnt lgkmcnt(0)
	v_mov_b32_e32 v2, 0
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	v_cmp_ne_u32_e32 vcc_lo, 0x7fffffff, v3
	ds_load_b32 v4, v2
	s_waitcnt lgkmcnt(0)
	v_cmp_eq_u32_e64 s0, v3, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s0, vcc_lo, s0
	s_and_saveexec_b32 s1, s0
	s_cbranch_execz .LBB0_97
; %bb.93:
	s_cmp_eq_u32 s8, 0
	s_cselect_b32 s0, -1, 0
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, partCol@rel32@lo+4
	s_addc_u32 s3, s3, partCol@rel32@hi+12
	s_and_b32 vcc_lo, exec_lo, s0
	global_load_b64 v[2:3], v2, s[2:3]
	s_cbranch_vccnz .LBB0_95
; %bb.94:
	s_waitcnt vmcnt(0)
	global_load_b64 v[4:5], v[2:3], off offset:16
	s_and_not1_b32 s0, s0, exec_lo
	s_waitcnt vmcnt(0)
	v_cmp_gt_f64_e32 vcc_lo, v[4:5], v[0:1]
	s_and_b32 s1, vcc_lo, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s0, s0, s1
.LBB0_95:                               ; %Flow
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 exec_lo, exec_lo, s0
	s_cbranch_execz .LBB0_97
; %bb.96:
	v_mov_b32_e32 v4, 0
	s_getpc_b64 s[0:1]
	s_add_u32 s0, s0, partCol@rel32@lo+4
	s_addc_u32 s1, s1, partCol@rel32@hi+12
	s_waitcnt vmcnt(0)
	global_store_b32 v[2:3], v14, off
	v_mov_b32_e32 v6, 5
	global_load_b64 v[4:5], v4, s[0:1]
	s_clause 0x1
	global_store_b32 v[2:3], v6, off offset:8
	global_store_b64 v[2:3], v[0:1], off offset:16
	s_waitcnt vmcnt(0)
	global_store_b32 v[4:5], v15, off offset:4
.LBB0_97:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z21find_first_collisionsidi
		.amdhsa_group_segment_fixed_size 8
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 20
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 27
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z21find_first_collisionsidi, .Lfunc_end0-_Z21find_first_collisionsidi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 3720
; NumSgprs: 18
; NumVgprs: 27
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 8 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 3
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 27
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z17advanceParticlesPidi ; -- Begin function _Z17advanceParticlesPidi
	.globl	_Z17advanceParticlesPidi
	.p2align	8
	.type	_Z17advanceParticlesPidi,@function
_Z17advanceParticlesPidi:               ; @_Z17advanceParticlesPidi
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x0
	s_load_b32 s5, s[0:1], 0x10
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, n@rel32@lo+4
	s_addc_u32 s3, s3, n@rel32@hi+12
	s_load_b32 s2, s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s15, s15, s4
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add3_u32 v2, s5, s15, v0
	v_cmp_gt_i32_e32 vcc_lo, s2, v2
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB1_3
; %bb.1:
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, particles@rel32@lo+4
	s_addc_u32 s3, s3, particles@rel32@hi+12
	s_load_b64 s[4:5], s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	s_load_b64 s[4:5], s[4:5], 0x0
	s_waitcnt lgkmcnt(0)
	v_mad_i64_i32 v[0:1], null, v2, 56, s[4:5]
	flat_load_u8 v3, v[0:1] offset:49
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_cmp_eq_u16_e32 vcc_lo, 0, v3
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB1_3
; %bb.2:
	s_clause 0x1
	flat_load_b64 v[3:4], v[0:1] offset:32
	flat_load_b64 v[5:6], v[0:1] offset:16
	s_load_b64 s[0:1], s[0:1], 0x8
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_fma_f64 v[3:4], v[3:4], s[0:1], v[5:6]
	v_mov_b32_e32 v5, 0
	flat_store_b64 v[0:1], v[3:4] offset:16
	global_load_b64 v[0:1], v5, s[2:3]
	s_waitcnt vmcnt(0)
	v_readfirstlane_b32 s2, v0
	v_readfirstlane_b32 s3, v1
	s_load_b64 s[2:3], s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_mad_i64_i32 v[0:1], null, v2, 56, s[2:3]
	s_clause 0x1
	flat_load_b64 v[2:3], v[0:1] offset:24
	flat_load_b64 v[4:5], v[0:1] offset:8
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_fma_f64 v[2:3], v[2:3], s[0:1], v[4:5]
	flat_store_b64 v[0:1], v[2:3] offset:8
.LBB1_3:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17advanceParticlesPidi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 20
		.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 7
		.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	_Z17advanceParticlesPidi, .Lfunc_end1-_Z17advanceParticlesPidi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 296
; NumSgprs: 18
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 7
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.protected	l                       ; @l
	.type	l,@object
	.section	.bss,"aw",@nobits
	.globl	l
	.p2align	2, 0x0
l:
	.long	0                               ; 0x0
	.size	l, 4

	.protected	r                       ; @r
	.type	r,@object
	.globl	r
	.p2align	2, 0x0
r:
	.long	0                               ; 0x0
	.size	r, 4

	.protected	s                       ; @s
	.type	s,@object
	.globl	s
	.p2align	2, 0x0
s:
	.long	0                               ; 0x0
	.size	s, 4

	.protected	n                       ; @n
	.type	n,@object
	.globl	n
	.p2align	2, 0x0
n:
	.long	0                               ; 0x0
	.size	n, 4

	.protected	particles.managed       ; @particles.managed
	.type	particles.managed,@object
	.globl	particles.managed
	.p2align	3, 0x0
particles.managed:
	.quad	0
	.size	particles.managed, 8

	.protected	wallCol.managed         ; @wallCol.managed
	.type	wallCol.managed,@object
	.data
	.globl	wallCol.managed
	.p2align	3, 0x0
wallCol.managed:
	.long	2147483647                      ; 0x7fffffff
	.long	2147483647                      ; 0x7fffffff
	.long	0                               ; 0x0
	.zero	4
	.quad	0x41dfffffffc00000              ; double 2147483647
	.size	wallCol.managed, 24

	.protected	partCol.managed         ; @partCol.managed
	.type	partCol.managed,@object
	.globl	partCol.managed
	.p2align	3, 0x0
partCol.managed:
	.long	2147483647                      ; 0x7fffffff
	.long	2147483647                      ; 0x7fffffff
	.long	0                               ; 0x0
	.zero	4
	.quad	0x41dfffffffc00000              ; double 2147483647
	.size	partCol.managed, 24

	.protected	particles               ; @particles
	.type	particles,@object
	.section	.bss,"aw",@nobits
	.globl	particles
	.p2align	3, 0x0
particles:
	.quad	0
	.size	particles, 8

	.protected	wallCol                 ; @wallCol
	.type	wallCol,@object
	.globl	wallCol
	.p2align	3, 0x0
wallCol:
	.quad	0
	.size	wallCol, 8

	.protected	partCol                 ; @partCol
	.type	partCol,@object
	.globl	partCol
	.p2align	3, 0x0
partCol:
	.quad	0
	.size	partCol, 8

	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.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 l
	.addrsig_sym r
	.addrsig_sym s
	.addrsig_sym n
	.addrsig_sym particles.managed
	.addrsig_sym wallCol.managed
	.addrsig_sym partCol.managed
	.addrsig_sym particles
	.addrsig_sym wallCol
	.addrsig_sym partCol
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .offset:         8
        .size:           8
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 8
    .kernarg_segment_align: 8
    .kernarg_segment_size: 20
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z21find_first_collisionsidi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z21find_first_collisionsidi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     27
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .offset:         8
        .size:           8
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 20
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17advanceParticlesPidi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z17advanceParticlesPidi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
