#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cuda_runtime.h"
// #include "ray_tracing_GPU.h"

#define X 0
#define Y 1
#define Z 2

#define MY_CUDA_CHECK(call) {                                    \
    cudaError err = call;                                                    \
    if( cudaSuccess != err) {                                                \
        fprintf(stderr, "Cuda error in file '%s' in line %i : %s.\n",        \
                __FILE__, __LINE__, cudaGetErrorString( err) );              \
        exit(EXIT_FAILURE);                                                  \
    } }

 #define MY_CHECK_ERROR(errorMessage) {                                    \
    cudaError_t err = cudaGetLastError();                                    \
    if( cudaSuccess != err) {                                                \
        fprintf(stderr, "Cuda error: %s in file '%s' in line %i : %s.\n",    \
                errorMessage, __FILE__, __LINE__, cudaGetErrorString( err) );\
        exit(EXIT_FAILURE);                                                  \
    }                                                                        \
    }


#define CPROD(dest,v1,v2) \
dest[0]=v1[1]*v2[2]-v1[2]*v2[1]; \
dest[1]=v1[2]*v2[0]-v1[0]*v2[2]; \
dest[2]=v1[0]*v2[1]-v1[1]*v2[0]; 
    
    

    
    
#define DPROD(v1,v2) (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2])

// #define DPROD1(v1,v2) \
// return (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2]);

    
    
#define SUB(dest,v1,v2) \
    dest[0]=v1[0]-v2[0]; \
    dest[1]=v1[1]-v2[1]; \
    dest[2]=v1[2]-v2[2]; 
    
    
    
#define FINDMINMAX(x0,x1,x2,min,max) \
min = max = x0;   \
if(x1<min) min=x1;\
if(x1>max) max=x1;\
if(x2<min) min=x2;\
if(x2>max) max=x2;
    
    /******** X_AXIS test *********/
#define AXISTEST_X01(a, b, fa, fb)			   \
p0 = a*v0[Y] - b*v0[Z];			       	   \
p2 = a*v2[Y] - b*v2[Z];			       	   \
if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z];   \
if(min>rad || max<-rad) return 0;
    
    
#define AXISTEST_X2(a, b, fa, fb)			   \
p0 = a*v0[Y] - b*v0[Z];			           \
p1 = a*v1[Y] - b*v1[Z];			       	   \
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z];   \
if(min>rad || max<-rad) return 0;
    
    
/*********** Y_AXIS test ************/
#define AXISTEST_Y02(a, b, fa, fb)			   \
p0 = -a*v0[X] + b*v0[Z];		      	   \
p2 = -a*v2[X] + b*v2[Z];	       	       	   \
if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z];   \
if(min>rad || max<-rad) return 0;
    
    
#define AXISTEST_Y1(a, b, fa, fb)			   \
p0 = -a*v0[X] + b*v0[Z];		      	   \
p1 = -a*v1[X] + b*v1[Z];	     	       	   \
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z];   \
if(min>rad || max<-rad) return 0;
    
    
/***************** Z_AXIS test ************************/
    
    
#define AXISTEST_Z12(a, b, fa, fb)			   \
p1 = a*v1[X] - b*v1[Y];			           \
p2 = a*v2[X] - b*v2[Y];			       	   \
if(p2<p1) {min=p2; max=p1;} else {min=p1; max=p2;} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y];   \
if(min>rad || max<-rad) return 0;
    
    
    
#define AXISTEST_Z0(a, b, fa, fb)			   \
p0 = a*v0[X] - b*v0[Y];				   \
p1 = a*v1[X] - b*v1[Y];			           \
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y];   \
if(min>rad || max<-rad) return 0;
    
__device__ __host__ struct Point3D {
    double x;
    double y;
    double z;
};

__device__ __host__ struct Triangle {
    double v0[3];
    double v1[3];
    double v2[3];
};

__device__ __host__ struct Index
{
    int size;
    int count;
    int *ptr;

    __device__ __host__ Index()  
    { 
        ptr = (int *)malloc(sizeof(int) *100);
        size = 100;
        count = 0; 
    }

    __device__ __host__ void Insert(int value){
        if(count == size){
            // printf("Enters %p",ptr); 
            int *newptr = (int *)malloc(sizeof(int)*(size + 1));
            for (int index = 0; index<size; index++){
                newptr[index] = ptr[index];
            }
           // delete [] ptr;
            free(ptr);
            ptr = newptr;
            size+=1;
        }
        ptr[count] = value;
        count+=1;
    } 

};

__device__ __host__ struct Cube { 

    double xmin, xmax;
    double ymin, ymax;
    double zmin, zmax;
    double boxhalfsize[3];
    double center[3];
    int reference;
    int counter=0;
    int *triangleIndexes;
    // int triangleIndexes[12];
    int index =0;

};

__device__ __host__ struct Ray {
    //Rreze
    double orig[3];
    double dir[3];
    int intersectedCubes[4]={-1};
    int index;
    int intersects=0;
};
    
    

using namespace std;

/******************Declaring global variables ***************/
Ray *rays;
int numRays;
Cube boundingBox;
bool *isInside;
bool *isInPlane;
Triangle *triangles;
int numTriangles;

/****************** Declaring functions*********************/
__device__ __host__ double dot_product(double *v1, double *v2);
void  GETCENTER(Cube cube, double *center);
void GETHALFSIZE(Cube cube, double *boxhalfsize);
double into_double(char *str);
void getTriangles(Triangle *triangles);
void generateRandoms(double *direction, double *origin); 
void getRays(Ray *rays);
int getNumberOfCubes(Point3D lower, Point3D upper, double delta);
void createGrid3D(Cube *cubes, Point3D lower, Point3D upper, double delta, Index &frontGrid);
__device__ __host__  bool rayTriangleIntersect(Ray ray, Triangle tri);
__device__ __host__ int planeBoxOverlap(double *normal, double *vert, double *maxbox);
__device__ __host__ int triBoxOverlap(double *boxcenter, double *boxhalfsize, Triangle triverts);
__host__ __device__ double TriArea(double *P1, double *P2, double *P3);
__device__ __host__ bool IsInPlaneTest(Ray ray, Triangle tri, double epsilon);
__device__ __host__ bool  PointIsInSurface(Ray ray, Triangle tri, double epsilon);
__device__ __host__ int rayBoxIntersection_yaxis(double *rayorigin, Cube cube);
__global__ void TriangleCount_GPU(Triangle *triangles, Cube *cubes, int *numCubes, int *numTriangles, bool *CubeTriMapp);
__global__ void calcAlloc(Cube *cubes, int *frontGrid, int *cubesPerBlock, int *indexes, int *counter);
__global__ void calcAlloc(Cube *cubes, int *frontGrid, int *cubesPerBlock, int *indexes, int *counter);
__global__ void findUnique(Cube *cubes, int *end, int *cubesPerBlock, bool *CubeTriMapp, int *numTriangles, int *numCubes);
__global__ void appendTriangles(Cube *cubes, int *indexes, int *frontGrid, int *numTriangles, int *numCubes, bool *CubeTriMapp );
__global__ void getIntersectedCubes_GPU( Ray *rays, Cube *cubes, int *numrays, int *indexes,  Cube *boundingBox, int *frontGrid);
void IsInPlane(Ray *rays, Triangle *tri, bool *isInside, int nr_rays, int nr_triangles, double epsilon);
__global__ void IsInPlaneGPU(Ray *rays, Triangle *tri, bool *isInside, int *n_r, int *n_tr, Cube *cubes);
__global__  void ray_tracingGPU(Ray *ray, Triangle *tri, bool *results, int *n_r, int *n_tr, Cube *cubes);
extern "C" void SetRays(float *xyz_flat, int nr_rays);
extern "C" void SetTriangles(double *tri_coordinates, int nr_triangles);
extern "C" void  SetBoundingBox(double *x, double *y, double *z);
extern "C" bool *RayTracingGPU(int *numRays_, int *numTriangles);


/**************Defining the functions *****************/
__device__ __host__ double dot_product(double *v1, double *v2){

    double dot_prod=0;
    for (int i = 0; i< 3; i++){
        dot_prod += v1[i]*v2[i];
    }
    return dot_prod;
}


void  GETCENTER(Cube cube, double *center)
{
center[0] = (cube.xmax + cube.xmin)/2;
center[1] = (cube.ymax + cube.ymin)/2;
center[2] = (cube.zmax + cube.zmin)/2;

}


void GETHALFSIZE(Cube cube, double *boxhalfsize)
{
boxhalfsize[0] = (cube.xmax - cube.xmin)/2;
boxhalfsize[1] = (cube.ymax - cube.ymin)/2;
boxhalfsize[2] = (cube.zmax - cube.zmin)/2;

}



double into_double(char *str){
    char *ptr;
    double value;
    value = strtod(str, &ptr);
    return value;
}


void getTriangles(Triangle *triangles){

    char * line = NULL;
    size_t len = 0;
    ssize_t read;
    FILE *fp = fopen("/home/diko/MOBIUS/MOEBIUS/BACKEND/SCRIPTS/TEMP/triangles.txt","r");
    if(fp == NULL){
        perror(" unable to open file ");
        exit(1);
    }

    int index = 0;
    int nr_vec =0;
    
    while ((read = getline(&line, &len, fp)) != -1) {
        int j =0;
        char* token = strtok(line," ");
        while(token != NULL){
            token = strtok(NULL," ");
            if(nr_vec == 0){
                if(token != NULL){
                double token_ = into_double(token);
                    double r = 0;

                    if(token_ < 0){
                        token_ = token_ - r;
                    }
                    else token_ = token_ +r;
                triangles[index].v0[j] = token_;
               
                j = j+1;
                }
            }
            else if(nr_vec == 1){
                if(token != NULL){
                double token_ = into_double(token);
                    double r = 0;

                    if(token_ < 0){
                        token_ = token_ - r;
                    }
                    else token_ = token_ +r;
                triangles[index].v1[j] = token_;
               
                j = j+1;
                }
            }
            else{
                if(token != NULL){
                double token_ = into_double(token);
                    double r = 0;
                    if(token_ < 0){
                        token_ = token_ - r;
                    }
                    else token_ = token_ +r;
                triangles[index].v2[j] = token_;
                j = j+1;
                }
            }

        }
        if(nr_vec == 2){
            index+=1;
            nr_vec=0;
        }
        else nr_vec+=1;
        }
   

    fclose(fp);
    if (line)
        free(line);
}


 void generateRandoms(double *direction, double *origin) 
{ 
    
	direction[0] = 0.0002;
	direction[1] = 1.0;
	direction[2] = 0.0002;

} 

 void getRays(Ray *rays){
    char * line = NULL;
    size_t len = 0;
    ssize_t read;
    FILE *fp = fopen("/home/diko/MOBIUS/MOEBIUS/BACKEND/SCRIPTS/TEMP/points.txt","r");
    if(fp == NULL){
        perror(" unable to open file ");
        exit(1);
    }
    int index = 0;
    while ((read = getline(&line, &len, fp)) != -1) {
        int j =0;
        char* token = strtok(line," ");            
        
        while(token != NULL && j < 3){
            rays[index].orig[j] =into_double(token);
            //printf("\n token %d %d is : %.5lf",index,j,rays[index].orig[j]);
            token = strtok(NULL," ");
            j = j+1;
        }
        generateRandoms(rays[index].dir, rays[index].orig);
        index+=1;
    }    
    fclose(fp);
    if (line)
        free(line);
    
}


int getNumberOfCubes(Point3D lower, Point3D upper, double delta){


    int xn = ceil((upper.x - lower.x)/delta);
    int yn = ceil((upper.y - lower.y)/delta);
    int zn = ceil((upper.z - lower.z)/delta);

    int num_BB = xn * yn * zn;

    return num_BB;
}


void createGrid3D(Cube *cubes, Point3D lower, Point3D upper, double delta, Index &frontGrid){

    /***********************************************
    Input: Empty allocated memory for cubes, lower point and upper point
    Outpu: It is a void function, will modify the array of cubes
    ***********************************************/
    // double Y_MAX = upper.y;

    const int xn = ceil((upper.x - lower.x)/delta);
    const int yn = ceil((upper.y - lower.y)/delta);
    const int zn = ceil((upper.z - lower.z)/delta);


    double x = 0;
    double y = 0;
    double z = 0;
    int block = 0;
    int index = 0;
    for(int i = 0; i<xn; i++){
        x = lower.x;
        x = x+delta*i;

        for(int j = 0; j<zn; j++){
            z = lower.z;
            z = z+delta*j;

            for(int k =0; k<yn; k++){
                y = lower.y;
                y = y + delta*k;

                cubes[index].xmax = x+delta;
                cubes[index].ymax = y+delta;
                cubes[index].zmax = z+delta;
                cubes[index].xmin = x;
                cubes[index].ymin = y;
                cubes[index].zmin = z;

                GETCENTER(cubes[index], cubes[index].center);
                GETHALFSIZE(cubes[index], cubes[index].boxhalfsize);

                if(k== yn-1) 
                {
                    frontGrid.Insert(index);
                }
                cubes[index].reference = (block+1)*yn -1;
                index +=1;
                
                
            }
            block+=1;
    
        }
    }

}



__device__ __host__  bool rayTriangleIntersect(Ray ray, Triangle tri){
   
    double ZERO = 0.0;
    double ONE = 1.0;

    const double epsilon = 1.e-10;
    double edge1[3] ={}; double edge2[3] ={} ; double pvec[3]={};double tvec[3] = {}; double qvec[3] = {};
    
    //Calculate edges
    SUB(edge1,tri.v1, tri.v0); 
    SUB(edge2,tri.v2, tri.v0);
    CPROD(pvec,ray.dir, edge2); 
    
    
    //Calculate the determinant 
    double det = dot_product(edge1, pvec); 
    
    if( det>-epsilon && det < epsilon) return false; //It is parallel with the triangle

    //Calculate the inverse determinant
    double invDet = ONE / det; // f
    //calculate the 'u' of baycentric 
    SUB(tvec,ray.orig, tri.v0); //s
    double prod = dot_product(tvec, pvec); // s dot prod h
    double u = prod *  invDet; //f * s dot prod h

    //Check if u is inside the allowed bounds
    if(u < ZERO || u > ONE) return false;

    //calculate the 'v' of baycentric coordinates and check if it is inside the desired interval to continue 
    CPROD(qvec,tvec, edge1);
    double prod1 = dot_product(ray.dir, qvec);
    double v = prod1 * invDet;

    if(v < ZERO || u + v > ONE ) return false;

    double t_prod = dot_product(edge2, qvec); 
    double t =t_prod * invDet;

    return (t>epsilon);

}



__device__ __host__ int planeBoxOverlap(double *normal, double *vert, double *maxbox)	
{

    int q;
    double vmin[3],vmax[3],v;
    for(q=X;q<=Z;q++)
    {
        v=vert[q];
        
        int isBigger = (int) (normal[q]>0.0f);
        
        vmin[q]=isBigger*(-maxbox[q] - v) + !isBigger*(maxbox[q] - v);	
        vmax[q]= isBigger*(maxbox[q] - v) + !isBigger *(-maxbox[q] - v) ;	
       
    }

    return !(DPROD(normal,vmin)>0.0f) * (DPROD(normal,vmax)>=0.0f);

}


__device__ __host__ int triBoxOverlap(double *boxcenter, double *boxhalfsize, Triangle triverts)
{

double v0[3]={0};
double v1[3]={0};
double v2[3]={0};

double min=1000000,max=-10000000,p0=0,p1=0,p2=0,rad=0,fex=0,fey=0,fez=0;	

double normal[3]={0};
double e0[3]={0};
double e1[3]={0};
double e2[3]={0};

SUB(v0,triverts.v0,boxcenter);
SUB(v1,triverts.v1,boxcenter);
SUB(v2,triverts.v2,boxcenter);

SUB(e0,v1,v0);     
SUB(e1,v2,v1);      
SUB(e2,v0,v2);     

CPROD(normal,e0,e1);
return planeBoxOverlap(normal, v0, boxhalfsize);

}

__host__ __device__ double TriArea(double *P1, double *P2, double *P3)
{
    double P1P2[3];
    double P1P3[3];
    double CP[3];

    SUB(P1P2, P2, P1);
    SUB(P1P3, P3, P1);
    CPROD(CP,P1P2, P1P3)

    double triArea = sqrt(CP[0]*CP[0] + CP[1]*CP[1] +CP[2]*CP[2])/2;
    return triArea;

}

__device__ __host__ bool IsInPlaneTest(Ray ray, Triangle tri, double epsilon)
{
    //Find the plane equation starting with coordinates a, b, c and then distance d

    double a1, b1, c1;
    double a2, b2, c2;
    double a, b, c; //rate of normal vector of the plane
    double d; //distance

    a1 = tri.v1[0] -tri.v0[0];
    b1 = tri.v1[1] -tri.v0[1];
    c1 = tri.v1[2] -tri.v0[2];

    a2 = tri.v2[0] -tri.v0[0];
    b2 = tri.v2[1] -tri.v0[1];
    c2 = tri.v2[2] -tri.v0[2];

    a = b1 * c2 - b2 * c1;
    b = a2 * c1 - a1 * c2;
    c = a1 * b2 - b1 * a2; 

    d = (- a * tri.v0[0] - b * tri.v0[1] - c * tri.v0[2]);

    //Check if point is in plane
    return (a*ray.orig[0]+b*ray.orig[1]+c*ray.orig[2]+d<=0+epsilon && a*ray.orig[0]+b*ray.orig[1]+c*ray.orig[2]+d>=0-epsilon );
    // return (a*ray.orig[0]+b*ray.orig[1]+c*ray.orig[2]+d==0 );

}

__device__ __host__ bool  PointIsInSurface(Ray ray, Triangle tri, double epsilon)
{
    // const double epsilon = 1.e-7;
    double tri0, tri1, tri2, tri3;
    tri0 = TriArea(tri.v0, tri.v1, tri.v2);
    tri1 = TriArea(ray.orig, tri.v0, tri.v1);
    tri2 = TriArea(ray.orig, tri.v0, tri.v2);
    tri3 = TriArea(ray.orig, tri.v1, tri.v2);

    double sum = tri1 + tri2 +tri3;
    double res = sqrt(sum)/sqrt(tri0)-1;
    return(res <= epsilon && res >= -epsilon);
    // return sum == tri0;
  

}


__device__ __host__ int rayBoxIntersection_yaxis(double *rayorigin, Cube cube)
{

    // const double epsilon = 1.e-5;
    double xmin = cube.xmin;
    double xmax = cube.xmax;
    double zmin = cube.zmin;
    double zmax = cube.zmax;
    double ymax = cube.ymax;
    double ymin = cube.ymin;
    return !(rayorigin[0]<xmin || rayorigin[0] >xmax || rayorigin[2]<zmin || rayorigin[2]>zmax || rayorigin[1]>ymax);
    // return !(rayorigin[0]<xmin || rayorigin[0] >xmax || rayorigin[2]<zmin || rayorigin[2]>zmax || rayorigin[1]>ymax || rayorigin[1]<ymin);

    // return !(rayorigin[0]<xmin-epsilon || rayorigin[0] >xmax+epsilon || rayorigin[2]<zmin-epsilon || rayorigin[2]>zmax+epsilon);

}



__global__ void TriangleCount_GPU(Triangle *triangles, Cube *cubes, int *numCubes, int *numTriangles, bool *CubeTriMapp)
    {
        int idx = threadIdx.x + blockIdx.x*blockDim.x;
        const unsigned int num_threads = gridDim.x * blockDim.x;

        for (int i=idx; i<(*numCubes)*(*numTriangles) ; i+=num_threads)
        {               
            int triIndex = (int)i/(*numCubes);
            int cubeIndex = i%(*numCubes);
            int intersects = (int) (triBoxOverlap(cubes[cubeIndex].center, cubes[cubeIndex].boxhalfsize, triangles[triIndex])==1);
            CubeTriMapp[i]=(intersects>0);
            atomicAdd(&cubes[cubeIndex].counter, intersects);
        }

    }


__global__ void calcAlloc(Cube *cubes, int *frontGrid, int *cubesPerBlock, int *indexes, int *counter)
{
    int idx = threadIdx.x + blockIdx.x*blockDim.x;
    const unsigned int num_threads = gridDim.x * blockDim.x;
    for(int i=idx; i<*frontGrid; i+=num_threads)
    {
        int end = indexes[i];
        int start = end - (*cubesPerBlock-1);

        for(int j=start; j<end; j++)
        {
            cubes[end].counter+=cubes[j].counter;
        }


    }
    
}

__global__ void findUnique(Cube *cubes, int *end, int *cubesPerBlock, bool *CubeTriMapp, int *numTriangles, int *numCubes)
{
    int idx = threadIdx.x + blockIdx.x*blockDim.x;
    const unsigned int num_threads = gridDim.x * blockDim.x;
    int start = *end -(*cubesPerBlock-1);
    
    for(int triIndex=idx; triIndex<*numTriangles; triIndex+=num_threads)
    {
        for(int cubeIndex=start; cubeIndex<*end; cubeIndex++)
        {
            CubeTriMapp[triIndex*(*numCubes)+(*end)]|=CubeTriMapp[triIndex*(*numCubes)+cubeIndex];
        }
        atomicAdd(&cubes[*end].index,(int)(CubeTriMapp[triIndex*(*numCubes)+(*end)]==true));
    }

}



__global__ void appendTriangles(Cube *cubes, int *indexes, int *frontGrid, int *numTriangles, int *numCubes, bool *CubeTriMapp )
    {
        int idx = threadIdx.x + blockIdx.x*blockDim.x;
        const unsigned int num_threads = gridDim.x * blockDim.x;

        for(int i=idx; i<*frontGrid; i+=num_threads)
        {
            int cubeIndex=indexes[i];
            // int counter = 0;
            cubes[cubeIndex].index=0;
            for(int triIndex=0; triIndex<*numTriangles; triIndex+=1)
            {   

                int index = triIndex*(*numCubes) + cubeIndex;
                cubes[cubeIndex].triangleIndexes[cubes[cubeIndex].index] = triIndex;
                cubes[cubeIndex].index+=1*(int)(CubeTriMapp[index]==true);
                
            }
        }

        
    }


__global__ void getIntersectedCubes_GPU( Ray *rays, Cube *cubes, int *numrays, int *indexes,  Cube *boundingBox, int *frontGrid)
    {   
        int idx = threadIdx.x + blockIdx.x * blockDim.x;
        const unsigned int num_threads = gridDim.x*blockDim.x;


        for(int index = idx; index<*numrays; index+=num_threads)
        {
            rays[index].index = 0;            
            for(int frontGridIndex=0; frontGridIndex<*frontGrid; frontGridIndex++)
            {
                    int intersects = (int)rayBoxIntersection_yaxis(rays[index].orig, cubes[indexes[frontGridIndex]]);
                    rays[index].intersectedCubes[rays[index].index] = indexes[frontGridIndex];
                    rays[index].index+=1*intersects;
            }


 
        }

    }



    
 __global__  void ray_tracingGPU(Ray *ray, Triangle *tri, bool *results, int *n_r, int *n_tr, Cube *cubes){

        int idx = threadIdx.x + blockIdx.x * blockDim.x;
        const unsigned int num_threads = gridDim.x*blockDim.x;
        
        for(int rayIndex = idx; rayIndex <*n_r; rayIndex+=num_threads)
        {       
            int count = 0;
            if(ray[rayIndex].index > 0)
            {
                for (int j = 0; j<cubes[ray[rayIndex].intersectedCubes[0]].index; j=j+1){
                        count += (int)rayTriangleIntersect(ray[rayIndex],tri[cubes[ray[rayIndex].intersectedCubes[0]].triangleIndexes[j]]);
                }
 
                results[rayIndex] = (count % 2 !=0);       
               
            }
        
    }

    }

    __global__ void IsInPlaneGPU(Ray *rays, Triangle *tri, bool *isInside, int *n_r, int *n_tr, Cube *cubes)
    {
        int idx = threadIdx.x + blockIdx.x * blockDim.x;
        const unsigned int num_threads = gridDim.x*blockDim.x;
        const double epsilon = 1.e-10;
        for(int rayIndex=idx; rayIndex<*n_r; rayIndex+=num_threads)
        {
            if(rays[rayIndex].index > 0)
            {
                int counter = 0;
                    for(int j=0; j<cubes[rays[rayIndex].intersectedCubes[0]].index;)
                    {
    
                            counter+=(int)(PointIsInSurface(rays[rayIndex], tri[cubes[rays[rayIndex].intersectedCubes[0]].triangleIndexes[j]], epsilon)==true);
                            j+=1+counter*cubes[rays[rayIndex].intersectedCubes[0]].index;
    
                    }
                    isInside[rayIndex]=(counter>0);
            }
        }
    }
    
    

__global__ void appendALL(Cube *cubes,int *numCubes,int *numTriangles, bool *CubeTriMapp, Triangle *triangles)
    {
        int idx = threadIdx.x + blockIdx.x*blockDim.x;
        const unsigned int num_threads = gridDim.x * blockDim.x;
    
        for(int cubeIndex=idx; cubeIndex<*numCubes; cubeIndex+=num_threads)
        {
            // cubes[cubeIndex].index = 0;
            for(int triIndex=0; triIndex<*numTriangles; triIndex+=1)
            {   
                int index = triIndex*(*numCubes) + cubeIndex;
                // if(cubeIndex == 0) printf("Index: %d", index);
                cubes[cubeIndex].triangleIndexes[cubes[cubeIndex].index] = triIndex;
                int intersects = CubeTriMapp[index];
                cubes[cubeIndex].index+=1*intersects;
                // atomicAdd(&cubes[cubeIndex].index, intersects);
                
            }
        }
        
    }
    
    
__global__ void firstCube(Cube *cubes, Ray *rays, Triangle *triangles,int *numRays, int *numCubes)
    {
        int idx = threadIdx.x + blockIdx.x*blockDim.x;
        const unsigned int num_threads = gridDim.x * blockDim.x;
        for(int rayIndex=idx; rayIndex<*numRays; rayIndex+=num_threads)
        {
            rays[rayIndex].index=0;
    
            for(int cubeIndex=0; cubeIndex<*numCubes;)
            {
                if(rayBoxIntersection_yaxis(rays[rayIndex].orig, cubes[cubeIndex]))
                {
                    rays[rayIndex].intersectedCubes[rays[rayIndex].index] = cubeIndex;
                    rays[rayIndex].index +=1;
                    cubeIndex+=*numCubes;
                }
                cubeIndex+=1;
            }
            // printf("RayIndex: %d \n",rays[rayIndex].index);
        }  
    }
    


/************************ END of GPU FUNCTIONS ************************************/


extern "C" void SetRays(float *xyz_flat, int nr_rays)
    {
        numRays = nr_rays;
        rays = (Ray *)malloc(sizeof(Ray)*numRays);

        for(int i=0; i<nr_rays; i+=1)
        {
            rays[i].orig[0] = xyz_flat[0+i*3];
            rays[i].orig[1] = xyz_flat[1+i*3];
            rays[i].orig[2] = xyz_flat[2+i*3];
            generateRandoms(rays[i].dir, rays[i].orig);
           
        }
    }

    

extern "C" void SetTriangles(double *tri_coordinates, int nr_triangles)
    {
        numTriangles = nr_triangles;
        triangles = (Triangle *)malloc(sizeof(Triangle)*nr_triangles);

        for(int i=0; i<nr_triangles; i+=1)
        {
            // int tri_index = int(i/9);
            triangles[i].v0[0] = tri_coordinates[i*9];
            triangles[i].v0[1] = tri_coordinates[i*9+1];
            triangles[i].v0[2] = tri_coordinates[i*9+2];
            triangles[i].v1[0] = tri_coordinates[i*9+3];
            triangles[i].v1[1] = tri_coordinates[i*9+4];
            triangles[i].v1[2] = tri_coordinates[i*9+5];
            triangles[i].v2[0] = tri_coordinates[i*9+6];
            triangles[i].v2[1] = tri_coordinates[i*9+7];
            triangles[i].v2[2] = tri_coordinates[i*9+8];

        }
    }

// extern "C" void printTriangles()
void printTriangles()
{
    for(int i=0; i<numTriangles; i++)
    {
        printf("Triangle:%d %lf %lf %lf \n",i, triangles[i].v0[0],triangles[i].v0[1],triangles[i].v0[2]);
        printf("Triangle:%d %lf %lf %lf \n",i, triangles[i].v1[0],triangles[i].v1[1],triangles[i].v1[2]);
        printf("Triangle:%d %lf %lf %lf \n",i, triangles[i].v2[0],triangles[i].v2[1],triangles[i].v2[2]);

    }
}



extern "C" void  SetBoundingBox(double *x, double *y, double *z)
// extern "C" void  SetBoundingBox(int *mesh_bounds)
{
    boundingBox.xmin = x[0];
    boundingBox.xmax = x[1];
    boundingBox.ymin = y[0];
    boundingBox.ymax = y[1];
    boundingBox.zmin = z[0];
    boundingBox.zmax = z[1];
    // printf("XMIN: %lf  XMAX: %lf",boundingBox.xmin,boundingBox.xmax);
    // printf("yMIN: %lf  yMAX: %lf",boundingBox.ymin,boundingBox.ymax);
    // printf("zMIN: %lf  zMAX: %lf",boundingBox.zmin,boundingBox.zmax);


}


/*************** CPU VERSION OF IS IN SURFACE *****************/


void TriangleCount(Triangle *triangles, Cube *cubes, int numCubes, int numTriangles, bool *CubeTriMapp)
    {
        for(int i=0; i<numCubes; i++)
        {
            cubes[i].counter=0;
            for(int j=0; j<numTriangles; j++)
            {
                int index = j*numCubes + i;
                int intersects = triBoxOverlap(cubes[i].center, cubes[i].boxhalfsize, triangles[j]);
                CubeTriMapp[index] =(intersects>0);
                cubes[i].counter+=intersects;
                
            }
        }

    }


 void appendALL_CPU(Cube *cubes,int numCubes,int numTriangles, bool *CubeTriMapp, Triangle *triangles)
    {
        for(int cubeIndex=0; cubeIndex<numCubes; cubeIndex+=1)
        {
            cubes[cubeIndex].index = 0;
            for(int triIndex=0; triIndex<numTriangles; triIndex+=1)
            {   
                int index = triIndex*numCubes + cubeIndex;
                cubes[cubeIndex].triangleIndexes[cubes[cubeIndex].index] = triIndex;
                int intersects = CubeTriMapp[index];
                cubes[cubeIndex].index+=1*intersects;
                
            }
        }
        
    }


void firstCube_CPU(Cube *cubes, Ray *rays, Triangle *triangles,int numRays, int numCubes)
    {

        for(int rayIndex=0; rayIndex<numRays; rayIndex+=1)
        {
            rays[rayIndex].index=0;
    
            for(int cubeIndex=0; cubeIndex<numCubes;)
            {
                if(rayBoxIntersection_yaxis(rays[rayIndex].orig, cubes[cubeIndex]))
                {
                    rays[rayIndex].intersectedCubes[rays[rayIndex].index] = cubeIndex;
                    rays[rayIndex].index +=1;
                    cubeIndex+=numCubes;
                }
                cubeIndex+=1;
            }
        }  
    }


void IsInPlane(Ray *rays, Triangle *tri, bool *isInside, int nr_rays,  Cube *cubes)
{

    const double epsilon = 1.e-10;
    for(int rayIndex=0; rayIndex<nr_rays; rayIndex+=1)
    {
        if(rays[rayIndex].index > 0)
        {
            int counter = 0;
            for(int j=0; j<cubes[rays[rayIndex].intersectedCubes[0]].index;)
            {   
                counter+=(int)(PointIsInSurface(rays[rayIndex], tri[cubes[rays[rayIndex].intersectedCubes[0]].triangleIndexes[j]], epsilon)==true);
                j+=1+counter*cubes[rays[rayIndex].intersectedCubes[0]].index;
    
            }
            isInside[rayIndex]=(counter>0);
        }
    }

}

void findUnique_CPU(Cube *cubes, int end, int cubesPerBlock, bool *CubeTriMapp, int numTriangles, int numCubes)
{
    int start = end -(cubesPerBlock-1);   
    for(int triIndex=0; triIndex<numTriangles; triIndex+=1)
    {
        for(int cubeIndex=start; cubeIndex<end; cubeIndex++)
        {
            CubeTriMapp[triIndex*(numCubes)+(end)]|=CubeTriMapp[triIndex*(numCubes)+cubeIndex];
        }
        cubes[end].index+=(int)CubeTriMapp[triIndex*(numCubes)+(end)];
    }

}

void appendTriangles_CPU(Cube *cubes, int *indexes, int frontGrid, int numTriangles, int numCubes, bool *CubeTriMapp )
    {
        for(int i=0; i<frontGrid; i+=1)
        {
            int cubeIndex=indexes[i];
            cubes[cubeIndex].index=0;
            for(int triIndex=0; triIndex<numTriangles; triIndex+=1)
            {   

                int index = triIndex*numCubes + cubeIndex;
                cubes[cubeIndex].triangleIndexes[cubes[cubeIndex].index] = triIndex;
                cubes[cubeIndex].index+=1*(int)CubeTriMapp[index];
                
            }
        }

        
    }
// void IsInPlane(Ray *rays, Triangle *tri, bool *isInside, int nr_rays, int nr_triangles, double epsilon)
// {
//     for(int rayIndex=0; rayIndex<nr_rays; rayIndex+=1)
//     {
//         if(rays[rayIndex].index > 0)
//         {
//             int counter = 0;
//             for(int j=0; j<nr_triangles; j=j+1)
//             {

//                     counter+=(PointIsInSurface(rays[rayIndex], tri[j], epsilon)==true);
//                     // counter+=(IsInPlaneTest(rays[rayIndex], tri[j], epsilon)==true);

//                     // counter+=(SameSide(rays[rayIndex], tri[j])==true);


//             }
//             isInside[rayIndex]=(counter>0);
//         }
//     }

// }

void getIntersectedCubes(Ray *rays, Cube *cubes, int numrays, int *indexes,  Cube boundingBox, int frontGrid)
    {   
        for(int index = 0; index<numrays; index+=1)
        {
            rays[index].index = 0;            
            for(int frontGridIndex=0; frontGridIndex<frontGrid; frontGridIndex++)
            {
                    int intersects = (int)rayBoxIntersection_yaxis(rays[index].orig, cubes[indexes[frontGridIndex]]);
                    rays[index].intersectedCubes[rays[index].index] = indexes[frontGridIndex];
                    rays[index].index+=1*intersects;
            }


 
        }

    }

void ray_tracing(Ray *ray, Triangle *tri, bool *results, int n_r, int n_tr, Cube *cubes)
{
        for(int rayIndex = 0; rayIndex <n_r; rayIndex+=1)
        {       
            int count = 0;
            if(ray[rayIndex].index > 0)
            {
                for (int j = 0; j<cubes[ray[rayIndex].intersectedCubes[0]].index; j=j+1)
                {
                        count += (int)rayTriangleIntersect(ray[rayIndex],tri[cubes[ray[rayIndex].intersectedCubes[0]].triangleIndexes[j]]);
                }
 
                results[rayIndex] = (count % 2 !=0);       
               
            }
        
    }

    }
/*************** END OF CPU VERSION OF IS IN SURFACE *****************/


// extern "C" void RayTracingGPU(int *numRays, int *numTriangles, bool *isInside, bool *isInPlane){
extern "C" bool *RayTracingGPU(int *numRays_, int *numTriangles){



    // bool GPU = true;
    bool GPU = false;
    int nr_rays = *numRays_;
    int nr_triangles = *numTriangles;

    Point3D upper = {boundingBox.xmax, boundingBox.ymax, boundingBox.zmax};
    Point3D lower = {boundingBox.xmin, boundingBox.ymin, boundingBox.zmin};

    double delta = ((upper.x-lower.x) * (upper.z-lower.z)) / 500;
    delta = sqrt(delta);

    //number of cubes per each block
    int cubesPerBlock = ceil((upper.y - lower.y)/delta);
    int num = getNumberOfCubes(lower, upper,delta);

    Cube *cubes_d;
    if (GPU)
        cudaMallocManaged((void**)&cubes_d, sizeof(Cube)*num);
    else
        cubes_d = (Cube *)malloc(sizeof(Cube)*num);

    Index frontGrid;
    // createGrid3D(cubes, lower, upper, delta,frontGrid);
    createGrid3D(cubes_d, lower, upper, delta,frontGrid);

    bool *CubeTriMapp = (bool *)malloc(sizeof(bool)*nr_triangles*num);

    int frontGridSize = frontGrid.count;
    int *indexes = new int[frontGrid.count];

    //Copy indexes in array
    for(int i = 0; i<frontGrid.count; i++)
    {
        indexes[i] = frontGrid.ptr[i];
    }

    printf("Num cubes: %d \n",num);
    printf("Num Triangles: %d \n",nr_triangles);
    printf("Num Rays: %d \n",nr_rays);

    const double epsilon = 1.e-15 * (boundingBox.xmax - boundingBox.xmin);
  
    /******************* Device memory allocation ********************/
    Triangle *tri_d;
    MY_CUDA_CHECK(cudaMalloc((void**)&tri_d, sizeof(Triangle)*nr_triangles));
    MY_CUDA_CHECK(cudaMemcpy(tri_d, triangles,sizeof(Triangle)*nr_triangles,cudaMemcpyHostToDevice));

    Ray *ray_d;
    MY_CUDA_CHECK(cudaMalloc((void**)&ray_d, sizeof(Ray)*nr_rays));
    MY_CUDA_CHECK(cudaMemcpy(ray_d, rays, sizeof(Ray)*nr_rays, cudaMemcpyHostToDevice));

    bool *CubeTriMapp_d;
    MY_CUDA_CHECK(cudaMalloc((void**)&CubeTriMapp_d, sizeof(bool)*num*nr_triangles));
    MY_CUDA_CHECK(cudaMemcpy(CubeTriMapp_d, CubeTriMapp,sizeof(bool)*num*nr_triangles , cudaMemcpyHostToDevice));

    int *cubesPerBlock_d;
    MY_CUDA_CHECK(cudaMalloc((void**)&cubesPerBlock_d, sizeof(int)));
    MY_CUDA_CHECK(cudaMemcpy(cubesPerBlock_d, &cubesPerBlock, sizeof(int),cudaMemcpyHostToDevice));

    int *frontGridSize_d;
    MY_CUDA_CHECK(cudaMalloc((void**)&frontGridSize_d, sizeof(int)));
    MY_CUDA_CHECK(cudaMemcpy(frontGridSize_d, &frontGridSize, sizeof(int),cudaMemcpyHostToDevice));

    int *indexes_d;
    MY_CUDA_CHECK(cudaMalloc((void**)&indexes_d, sizeof(int)*frontGridSize));
    MY_CUDA_CHECK(cudaMemcpy(indexes_d, indexes, sizeof(int)*frontGridSize,cudaMemcpyHostToDevice));

    int *numRays_d;
    MY_CUDA_CHECK(cudaMalloc((void**)&numRays_d, sizeof(int)));
    MY_CUDA_CHECK(cudaMemcpy(numRays_d, &nr_rays, sizeof(int),cudaMemcpyHostToDevice));

    int *nr_triangles_d;
    MY_CUDA_CHECK(cudaMalloc((void**)&nr_triangles_d, sizeof(int)));
    MY_CUDA_CHECK(cudaMemcpy(nr_triangles_d, &nr_triangles, sizeof(int),cudaMemcpyHostToDevice));

    int *num_cubes_d;
    MY_CUDA_CHECK(cudaMalloc((void**)&num_cubes_d, sizeof(int)));
    MY_CUDA_CHECK(cudaMemcpy(num_cubes_d, &num, sizeof(int),cudaMemcpyHostToDevice));

    Cube *cube3d_d;
    MY_CUDA_CHECK(cudaMalloc((void**)&cube3d_d, sizeof(Cube)));
    MY_CUDA_CHECK(cudaMemcpy(cube3d_d, &boundingBox, sizeof(Cube),cudaMemcpyHostToDevice));

    int *pointsInside;
    MY_CUDA_CHECK(cudaMalloc((void**)&pointsInside, sizeof(int)));

    int *countTri;
    MY_CUDA_CHECK(cudaMalloc((void**)&countTri, sizeof(int)));

    bool *results;
    MY_CUDA_CHECK(cudaMalloc((void**)&results, sizeof(bool)*nr_rays*2));

    bool *isInside_d;
    MY_CUDA_CHECK(cudaMalloc((void**)&isInside_d, sizeof(bool)*nr_rays));

    int *triCubMapp_d;
    MY_CUDA_CHECK(cudaMalloc((void**)&triCubMapp_d, sizeof(int)*num));

    /**************** End of device memory allocation *****************/ 

    isInside = (bool *)malloc(2*nr_rays*sizeof(bool));
    isInPlane = (bool *)malloc(nr_rays*sizeof(bool));

    
    /**************** Begining of computations *****************/ 
    

    if(GPU){

        clock_t begin = clock();

        TriangleCount_GPU<<<256,512>>>(tri_d, cubes_d, num_cubes_d, nr_triangles_d, CubeTriMapp_d); //Count number of triangles per cube
        cudaDeviceSynchronize();

        for(int i=0; i<num; i++)
        {
            MY_CUDA_CHECK(cudaMallocManaged((void**)&cubes_d[i].triangleIndexes, sizeof(int)*cubes_d[i].counter+1));

        }

        appendALL<<<256,256>>>(cubes_d, num_cubes_d, nr_triangles_d, CubeTriMapp_d,tri_d);
        cudaDeviceSynchronize();


        firstCube<<<256,256>>>(cubes_d, ray_d, tri_d, numRays_d, num_cubes_d);
        cudaDeviceSynchronize();
        // exit(0);


        IsInPlaneGPU<<<256,256>>>(ray_d, tri_d, results, numRays_d, nr_triangles_d, cubes_d);    //Find surface points
        cudaDeviceSynchronize(); 

        cudaStream_t streams_u[frontGridSize]; //using cuda streams to parallelise kernel execution
        for(int i=0;i<frontGridSize; i++)
        {
            cudaStreamCreate(&streams_u[i]);
            int reference = indexes[i];
            int *cubeIndex;
            MY_CUDA_CHECK(cudaMalloc((void**)&cubeIndex, sizeof(int)));
            MY_CUDA_CHECK(cudaMemcpy(cubeIndex, &reference, sizeof(int),cudaMemcpyHostToDevice));

            findUnique<<<8,256,0,streams_u[i]>>>(cubes_d,cubeIndex,cubesPerBlock_d, CubeTriMapp_d, nr_triangles_d, num_cubes_d);//find unique triangles per cube

        }
        cudaDeviceSynchronize();

        for(int i=0;i<frontGridSize; i++)
        {
            cudaStreamDestroy(streams_u[i]); //Cuda streams must be destroyed at the end of execution
        }


        for(int i=0; i<frontGridSize; i++)
        {
            MY_CUDA_CHECK(cudaMalloc((void**)&cubes_d[indexes[i]].triangleIndexes, sizeof(int)*cubes_d[indexes[i]].index));
        }
        
        int numThreads = (frontGridSize + 32 - (frontGridSize%32))/2;
        appendTriangles<<<2,196>>>(cubes_d,indexes_d, frontGridSize_d,nr_triangles_d, num_cubes_d, CubeTriMapp_d); //append triangles to cubes
        cudaDeviceSynchronize();
    
        getIntersectedCubes_GPU<<<32,256>>>(ray_d, cubes_d, numRays_d , indexes_d, cube3d_d, frontGridSize_d); //ray cube intersection 
        cudaDeviceSynchronize();
        
        ray_tracingGPU<<<256,256>>>(ray_d, tri_d, isInside_d, numRays_d, nr_triangles_d, cubes_d);    // ray tracing - ray triangle intersection Moller algorithm
        cudaDeviceSynchronize();   



        clock_t end = clock();
        double time_spent = (double)(end-begin)/ CLOCKS_PER_SEC;

        MY_CUDA_CHECK(cudaMemcpy(isInside, results, sizeof(bool)*nr_rays,cudaMemcpyDeviceToHost));
        MY_CUDA_CHECK(cudaMemcpy(isInPlane, isInside_d, sizeof(bool)*nr_rays,cudaMemcpyDeviceToHost));

        // printf("\n time spent: %.10f\n",time_spent);
    }

    else{

        clock_t begin1 = clock();
        
        TriangleCount(triangles, cubes_d, num, nr_triangles, CubeTriMapp);

        for(int i=0; i<num; i++)
        {
            cubes_d[i].triangleIndexes = (int *)malloc(sizeof(int)*cubes_d[i].counter+1);
        }

        appendALL_CPU(cubes_d,num, nr_triangles, CubeTriMapp, triangles);   
        firstCube_CPU(cubes_d, rays, triangles, nr_rays, num);

        clock_t end1 = clock();
        double time_spent1 = (double)(end1-begin1)/ CLOCKS_PER_SEC;
        printf(" \n time spent for preprocessing: %.10f\n",time_spent1);

        clock_t begin2 = clock();
        IsInPlane(rays, triangles, isInside, nr_rays,  cubes_d);

        clock_t end2 = clock();
        double time_spent2 = (double)(end2-begin2)/ CLOCKS_PER_SEC;
        printf("time spent for Is In plane: %.10f\n",time_spent2);

        for(int i=0;i<frontGridSize; i++)
        {
            int reference = indexes[i];
            findUnique_CPU(cubes_d, reference, cubesPerBlock, CubeTriMapp, nr_triangles, num);
        }

        for(int i=0; i<frontGridSize; i++)
        {
            cubes_d[indexes[i]].triangleIndexes =(int *)malloc(sizeof(int)*cubes_d[indexes[i]].index);
        }

        clock_t begin3 = clock();

        appendTriangles_CPU(cubes_d, indexes, frontGridSize, nr_triangles, num, CubeTriMapp);
        getIntersectedCubes(rays, cubes_d, nr_rays, indexes,  boundingBox, frontGridSize);
        clock_t end3 = clock();
        double time_spent3 = (double)(end3-begin3)/ CLOCKS_PER_SEC;
        printf("time spent for pre-raytracing: %.10f\n",time_spent3);

        clock_t begin4 = clock();

        ray_tracing(rays, triangles, isInPlane, nr_rays, nr_triangles, cubes_d);

        clock_t end4 = clock();
        double time_spent4 = (double)(end4-begin4)/ CLOCKS_PER_SEC;
        printf("time spent for raytracing: %.10f\n",time_spent4);

    }

    /**************** End of Computations*****************/ 


    for(int i=0; i<nr_rays;i++){
        isInside[i+nr_rays]= isInPlane[i]; //Copying the results to one unique array of size 2 x number of rays
    }

    for(int i=0; i<nr_rays;i++){
        if (isInside[i]==true) isInside[nr_rays+i]= false; //Removing redundance
    }
    // int counter=0;

    // for(int i=0; i<nr_rays;i++){
    //     if (isInside[i]==true) counter+=1;
    // }
    // printf("Counter C: %d \n",counter);

//    FILE *fptr;

//    // use appropriate location if you are using MacOS or Linux
//    if (GPU)
//    fptr = fopen("/home/diko/Desktop/programGPU.txt","w");

//    else
//    fptr = fopen("/home/diko/Desktop/programCPU.txt","w");

//    if(fptr == NULL)
//    {
//       printf("Error!");   
//       exit(1);             
//    }

//    for(int i=0; i<nr_rays; i++){

//     if (isInside[i]==true) fprintf(fptr,"%d\n",i);
//    }
//    fclose(fptr);

//    printf("Ray: %lf %lf %lf",rays[20182].orig[0],rays[20182].orig[1],rays[20182].orig[2]);

    
    free(rays);
    free(triangles);
    free(isInPlane);
    cudaFree(ray_d);
    cudaFree(tri_d);
    cudaFree(results);
    cudaFree(pointsInside);
    cudaFree(cube3d_d);
    cudaFree(cubes_d);
    cudaFree(cubesPerBlock_d);
    cudaFree(indexes_d);
    cudaFree(frontGridSize_d);
    cudaFree(numRays_d);
    cudaFree(triCubMapp_d);
    cudaFree(isInside_d);

    return isInside;

}

	.file	"tmpxft_0034e0f5_00000000-6_ray_tracingGPU.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3927:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3927:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z11dot_productPdS_
	.type	_Z11dot_productPdS_, @function
_Z11dot_productPdS_:
.LFB3896:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	xorps	%xmm0, %xmm0
.L3:
	movsd	(%rdi,%rax), %xmm1
	mulsd	(%rsi,%rax), %xmm1
	addq	$8, %rax
	addsd	%xmm1, %xmm0
	cmpq	$24, %rax
	jne	.L3
	ret
	.cfi_endproc
.LFE3896:
	.size	_Z11dot_productPdS_, .-_Z11dot_productPdS_
	.globl	_Z9GETCENTER4CubePd
	.type	_Z9GETCENTER4CubePd, @function
_Z9GETCENTER4CubePd:
.LFB3897:
	.cfi_startproc
	endbr64
	movsd	16(%rsp), %xmm0
	addsd	8(%rsp), %xmm0
	movsd	.LC1(%rip), %xmm1
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, (%rdi)
	movsd	32(%rsp), %xmm0
	addsd	24(%rsp), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, 8(%rdi)
	movsd	48(%rsp), %xmm0
	addsd	40(%rsp), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, 16(%rdi)
	ret
	.cfi_endproc
.LFE3897:
	.size	_Z9GETCENTER4CubePd, .-_Z9GETCENTER4CubePd
	.globl	_Z11GETHALFSIZE4CubePd
	.type	_Z11GETHALFSIZE4CubePd, @function
_Z11GETHALFSIZE4CubePd:
.LFB3898:
	.cfi_startproc
	endbr64
	movsd	16(%rsp), %xmm0
	subsd	8(%rsp), %xmm0
	movsd	.LC1(%rip), %xmm1
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, (%rdi)
	movsd	32(%rsp), %xmm0
	subsd	24(%rsp), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, 8(%rdi)
	movsd	48(%rsp), %xmm0
	subsd	40(%rsp), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, 16(%rdi)
	ret
	.cfi_endproc
.LFE3898:
	.size	_Z11GETHALFSIZE4CubePd, .-_Z11GETHALFSIZE4CubePd
	.globl	_Z11into_doublePc
	.type	_Z11into_doublePc, @function
_Z11into_doublePc:
.LFB3899:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	strtod@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3899:
	.size	_Z11into_doublePc, .-_Z11into_doublePc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"r"
.LC3:
	.string	"/home/diko/MOBIUS/MOEBIUS/BACKEND/SCRIPTS/TEMP/triangles.txt"
.LC4:
	.string	" unable to open file "
.LC5:
	.string	" "
	.text
	.globl	_Z12getTrianglesP8Triangle
	.type	_Z12getTrianglesP8Triangle, @function
_Z12getTrianglesP8Triangle:
.LFB3900:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC2(%rip), %rsi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	leaq	.LC3(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	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
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)
	movq	%rax, 16(%rsp)
	call	fopen@PLT
	movq	%rax, %r12
	testq	%rax, %rax
	jne	.L12
	leaq	.LC4(%rip), %rdi
	call	perror@PLT
	movl	$1, %edi
	call	exit@PLT
.L41:
	testq	%rax, %rax
	je	.L16
	movq	%rax, %rdi
	call	_Z11into_doublePc
	xorps	%xmm1, %xmm1
	comisd	%xmm0, %xmm1
	ja	.L18
	addsd	%xmm1, %xmm0
.L18:
	movsd	%xmm0, (%rbx)
.L19:
	addq	$8, %rbx
.L13:
	testq	%r15, %r15
	je	.L22
	leaq	.LC5(%rip), %rsi
	xorl	%edi, %edi
	call	strtok@PLT
	movq	%rax, %r15
	testl	%ebp, %ebp
	je	.L41
	cmpl	$1, %ebp
	je	.L42
	testq	%rax, %rax
	jne	.L43
.L22:
	cmpl	$2, %ebp
	jne	.L16
	incl	%r13d
	xorl	%ebp, %ebp
.L12:
	leaq	16(%rsp), %rsi
	leaq	8(%rsp), %rdi
	movq	%r12, %rdx
	call	getline@PLT
	incq	%rax
	je	.L44
	movslq	%r13d, %rbx
	movq	8(%rsp), %rdi
	leaq	.LC5(%rip), %rsi
	imulq	$72, %rbx, %rbx
	call	strtok@PLT
	movq	%rax, %r15
	addq	%r14, %rbx
	jmp	.L13
.L42:
	testq	%rax, %rax
	je	.L16
	movq	%rax, %rdi
	call	_Z11into_doublePc
	xorps	%xmm3, %xmm3
	comisd	%xmm0, %xmm3
	ja	.L21
	addsd	%xmm3, %xmm0
.L21:
	movsd	%xmm0, 24(%rbx)
	jmp	.L19
.L43:
	movq	%rax, %rdi
	call	_Z11into_doublePc
	xorps	%xmm5, %xmm5
	comisd	%xmm0, %xmm5
	ja	.L23
	addsd	%xmm5, %xmm0
.L23:
	movsd	%xmm0, 48(%rbx)
	jmp	.L19
.L16:
	incl	%ebp
	jmp	.L12
.L44:
	movq	%r12, %rdi
	call	fclose@PLT
	movq	8(%rsp), %rdi
	testq	%rdi, %rdi
	je	.L11
	call	free@PLT
.L11:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	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
.LFE3900:
	.size	_Z12getTrianglesP8Triangle, .-_Z12getTrianglesP8Triangle
	.globl	_Z15generateRandomsPdS_
	.type	_Z15generateRandomsPdS_, @function
_Z15generateRandomsPdS_:
.LFB3901:
	.cfi_startproc
	endbr64
	movsd	.LC6(%rip), %xmm0
	movq	.LC7(%rip), %rax
	movsd	%xmm0, (%rdi)
	movq	%rax, 8(%rdi)
	movsd	%xmm0, 16(%rdi)
	ret
	.cfi_endproc
.LFE3901:
	.size	_Z15generateRandomsPdS_, .-_Z15generateRandomsPdS_
	.section	.rodata.str1.1
.LC8:
	.string	"/home/diko/MOBIUS/MOEBIUS/BACKEND/SCRIPTS/TEMP/points.txt"
	.text
	.globl	_Z7getRaysP3Ray
	.type	_Z7getRaysP3Ray, @function
_Z7getRaysP3Ray:
.LFB3902:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC2(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC5(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	leaq	.LC8(%rip), %rdi
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)
	movq	%rax, 16(%rsp)
	call	fopen@PLT
	movq	%rax, %rbp
	testq	%rax, %rax
	jne	.L48
	leaq	.LC4(%rip), %rdi
	call	perror@PLT
	movl	$1, %edi
	call	exit@PLT
.L63:
	cmpl	$2, %r13d
	jg	.L55
	movq	%rax, %rdi
	call	_Z11into_doublePc
	movq	%r12, %rsi
	xorl	%edi, %edi
	movsd	%xmm0, (%rbx,%r13,8)
	incq	%r13
	call	strtok@PLT
.L49:
	testq	%rax, %rax
	jne	.L63
.L55:
	movsd	.LC6(%rip), %xmm0
	movq	.LC7(%rip), %rax
	addq	$72, %rbx
	movq	%rax, -40(%rbx)
	movsd	%xmm0, -48(%rbx)
	movsd	%xmm0, -32(%rbx)
.L48:
	leaq	16(%rsp), %rsi
	leaq	8(%rsp), %rdi
	movq	%rbp, %rdx
	call	getline@PLT
	incq	%rax
	je	.L64
	movq	8(%rsp), %rdi
	movq	%r12, %rsi
	xorl	%r13d, %r13d
	call	strtok@PLT
	jmp	.L49
.L64:
	movq	%rbp, %rdi
	call	fclose@PLT
	movq	8(%rsp), %rdi
	testq	%rdi, %rdi
	je	.L46
	call	free@PLT
.L46:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L54
	call	__stack_chk_fail@PLT
.L54:
	addq	$40, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3902:
	.size	_Z7getRaysP3Ray, .-_Z7getRaysP3Ray
	.globl	_Z16getNumberOfCubes7Point3DS_d
	.type	_Z16getNumberOfCubes7Point3DS_d, @function
_Z16getNumberOfCubes7Point3DS_d:
.LFB3903:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movsd	%xmm0, 8(%rsp)
	movsd	72(%rsp), %xmm0
	subsd	48(%rsp), %xmm0
	divsd	8(%rsp), %xmm0
	call	ceil@PLT
	movsd	%xmm0, 24(%rsp)
	movsd	80(%rsp), %xmm0
	subsd	56(%rsp), %xmm0
	divsd	8(%rsp), %xmm0
	call	ceil@PLT
	movsd	%xmm0, 16(%rsp)
	movsd	88(%rsp), %xmm0
	subsd	64(%rsp), %xmm0
	divsd	8(%rsp), %xmm0
	call	ceil@PLT
	movsd	24(%rsp), %xmm2
	movsd	16(%rsp), %xmm1
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	cvttsd2sil	%xmm1, %edx
	cvttsd2sil	%xmm2, %eax
	imull	%edx, %eax
	cvttsd2sil	%xmm0, %edx
	imull	%edx, %eax
	ret
	.cfi_endproc
.LFE3903:
	.size	_Z16getNumberOfCubes7Point3DS_d, .-_Z16getNumberOfCubes7Point3DS_d
	.globl	_Z12createGrid3DP4Cube7Point3DS1_dR5Index
	.type	_Z12createGrid3DP4Cube7Point3DS1_dR5Index, @function
_Z12createGrid3DP4Cube7Point3DS1_dR5Index:
.LFB3904:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movsd	160(%rsp), %xmm2
	movsd	%xmm0, 8(%rsp)
	movsd	168(%rsp), %xmm3
	movsd	176(%rsp), %xmm4
	movq	%rdi, 72(%rsp)
	movsd	184(%rsp), %xmm0
	movsd	%xmm2, 24(%rsp)
	movsd	%xmm3, 32(%rsp)
	subsd	%xmm2, %xmm0
	movsd	%xmm4, 40(%rsp)
	divsd	8(%rsp), %xmm0
	call	ceil@PLT
	cvttsd2sil	%xmm0, %eax
	movsd	192(%rsp), %xmm0
	subsd	32(%rsp), %xmm0
	divsd	8(%rsp), %xmm0
	movl	%eax, 80(%rsp)
	call	ceil@PLT
	cvttsd2sil	%xmm0, %ebx
	movsd	200(%rsp), %xmm0
	subsd	40(%rsp), %xmm0
	divsd	8(%rsp), %xmm0
	call	ceil@PLT
	xorl	%eax, %eax
	movl	%eax, 20(%rsp)
	cvttsd2sil	%xmm0, %r15d
	movl	%eax, 16(%rsp)
	movl	%eax, 64(%rsp)
	leal	-1(%rbx), %eax
	movl	%eax, 84(%rsp)
.L68:
	movl	80(%rsp), %edx
	cmpl	%edx, 20(%rsp)
	jge	.L79
	movl	64(%rsp), %eax
	cvtsi2sdl	20(%rsp), %xmm0
	xorl	%r14d, %r14d
	mulsd	8(%rsp), %xmm0
	incl	%eax
	addsd	24(%rsp), %xmm0
	imull	%ebx, %eax
	movsd	%xmm0, 48(%rsp)
	decl	%eax
	movl	%eax, 68(%rsp)
.L69:
	cmpl	%r15d, %r14d
	jge	.L80
	movslq	16(%rsp), %rdx
	cvtsi2sdl	%r14d, %xmm0
	mulsd	8(%rsp), %xmm0
	xorl	%ebp, %ebp
	addsd	40(%rsp), %xmm0
	movq	72(%rsp), %rax
	imulq	$120, %rdx, %rdx
	movsd	%xmm0, 56(%rsp)
	leaq	(%rax,%rdx), %r13
.L70:
	cmpl	%ebx, %ebp
	jge	.L81
	cvtsi2sdl	%ebp, %xmm0
	movsd	8(%rsp), %xmm1
	addsd	48(%rsp), %xmm1
	addq	$-128, %rsp
	.cfi_def_cfa_offset 288
	mulsd	136(%rsp), %xmm0
	movl	$30, %ecx
	leaq	72(%r13), %rax
	movq	%r13, %rsi
	addsd	160(%rsp), %xmm0
	movsd	176(%rsp), %xmm7
	movsd	184(%rsp), %xmm2
	movsd	%xmm1, 8(%r13)
	movsd	136(%rsp), %xmm1
	movsd	%xmm7, 0(%r13)
	addsd	%xmm0, %xmm1
	movsd	%xmm0, 16(%r13)
	movsd	%xmm2, 32(%r13)
	movsd	%xmm1, 24(%r13)
	movsd	136(%rsp), %xmm1
	addsd	184(%rsp), %xmm1
	movq	%rsp, %rdi
	movsd	%xmm1, 40(%r13)
	rep movsl
	movq	%rax, %rdi
	movl	$30, %ecx
	movq	%r13, %rsi
	leaq	48(%r13), %rax
	call	_Z9GETCENTER4CubePd
	movq	%rsp, %rdi
	rep movsl
	movq	%rax, %rdi
	call	_Z11GETHALFSIZE4CubePd
	subq	$-128, %rsp
	.cfi_def_cfa_offset 160
	cmpl	%ebp, 84(%rsp)
	jne	.L71
	movl	(%r12), %esi
	cmpl	%esi, 4(%r12)
	jne	.L72
	leal	1(%rsi), %edi
	movl	%esi, 88(%rsp)
	movslq	%edi, %rdi
	salq	$2, %rdi
	call	malloc@PLT
	movq	8(%r12), %rdi
	movl	88(%rsp), %esi
	xorl	%ecx, %ecx
.L73:
	cmpl	%ecx, %esi
	jle	.L82
	movl	(%rdi,%rcx,4), %r9d
	movl	%r9d, (%rax,%rcx,4)
	incq	%rcx
	jmp	.L73
.L82:
	movq	%rax, 88(%rsp)
	call	free@PLT
	movq	88(%rsp), %rax
	incl	(%r12)
	movq	%rax, 8(%r12)
.L72:
	movl	16(%rsp), %eax
	movslq	4(%r12), %rcx
	leal	(%rax,%rbp), %esi
	movq	8(%r12), %rax
	movl	%esi, (%rax,%rcx,4)
	incl	4(%r12)
.L71:
	movl	68(%rsp), %eax
	incl	%ebp
	addq	$120, %r13
	movl	%eax, -24(%r13)
	jmp	.L70
.L81:
	xorl	%eax, %eax
	testl	%ebx, %ebx
	cmovns	%ebx, %eax
	addl	%ebx, 68(%rsp)
	incl	%r14d
	addl	%eax, 16(%rsp)
	jmp	.L69
.L80:
	xorl	%eax, %eax
	testl	%r15d, %r15d
	cmovns	%r15d, %eax
	incl	20(%rsp)
	addl	%eax, 64(%rsp)
	jmp	.L68
.L79:
	addq	$104, %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
.LFE3904:
	.size	_Z12createGrid3DP4Cube7Point3DS1_dR5Index, .-_Z12createGrid3DP4Cube7Point3DS1_dR5Index
	.globl	_Z20rayTriangleIntersect3Ray8Triangle
	.type	_Z20rayTriangleIntersect3Ray8Triangle, @function
_Z20rayTriangleIntersect3Ray8Triangle:
.LFB3905:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movl	$6, %ecx
	movsd	224(%rsp), %xmm9
	leaq	72(%rsp), %rdi
	movsd	232(%rsp), %xmm4
	leaq	48(%rsp), %rsi
	movsd	272(%rsp), %xmm0
	leaq	96(%rsp), %rdx
	movsd	280(%rsp), %xmm3
	movsd	176(%rsp), %xmm11
	movsd	184(%rsp), %xmm7
	subsd	%xmm9, %xmm0
	subsd	%xmm4, %xmm3
	movsd	216(%rsp), %xmm10
	movsd	264(%rsp), %xmm1
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	movsd	240(%rsp), %xmm5
	movsd	248(%rsp), %xmm2
	movsd	256(%rsp), %xmm6
	subsd	%xmm10, %xmm1
	movaps	%xmm3, %xmm8
	movaps	%xmm0, %xmm12
	subsd	%xmm10, %xmm5
	movsd	%xmm0, 32(%rsp)
	mulsd	%xmm7, %xmm12
	movsd	%xmm3, 40(%rsp)
	subsd	%xmm9, %xmm2
	subsd	%xmm4, %xmm6
	mulsd	%xmm11, %xmm8
	movsd	%xmm1, 24(%rsp)
	mulsd	%xmm1, %xmm7
	movsd	%xmm5, (%rsp)
	rep stosl
	mulsd	%xmm11, %xmm1
	leaq	96(%rsp), %rdi
	movl	$6, %ecx
	rep stosl
	movq	%rsp, %rdi
	movsd	%xmm2, 8(%rsp)
	movsd	%xmm6, 16(%rsp)
	subsd	%xmm12, %xmm8
	movsd	%xmm8, 48(%rsp)
	movsd	168(%rsp), %xmm8
	mulsd	%xmm8, %xmm3
	mulsd	%xmm8, %xmm0
	subsd	%xmm3, %xmm7
	subsd	%xmm1, %xmm0
	movsd	%xmm7, 56(%rsp)
	movsd	%xmm0, 64(%rsp)
	call	_Z11dot_productPdS_
	comisd	.LC9(%rip), %xmm0
	jbe	.L84
	movsd	.LC10(%rip), %xmm1
	comisd	%xmm0, %xmm1
	jbe	.L84
.L88:
	xorl	%eax, %eax
	jmp	.L83
.L84:
	movsd	.LC7(%rip), %xmm8
	leaq	72(%rsp), %rdi
	movsd	144(%rsp), %xmm11
	movsd	160(%rsp), %xmm3
	movaps	%xmm8, %xmm7
	subsd	%xmm10, %xmm11
	movsd	152(%rsp), %xmm10
	divsd	%xmm0, %xmm7
	subsd	%xmm4, %xmm3
	subsd	%xmm9, %xmm10
	xorps	%xmm9, %xmm9
	movsd	%xmm11, 72(%rsp)
	movsd	%xmm3, 88(%rsp)
	movsd	%xmm10, 80(%rsp)
	call	_Z11dot_productPdS_
	movaps	%xmm0, %xmm4
	mulsd	%xmm7, %xmm4
	comisd	%xmm4, %xmm9
	ja	.L88
	comisd	%xmm8, %xmm4
	ja	.L88
	movaps	%xmm6, %xmm0
	movaps	%xmm2, %xmm1
	leaq	168(%rsp), %rdi
	movq	%rdx, %rsi
	mulsd	%xmm3, %xmm1
	mulsd	%xmm10, %xmm0
	mulsd	%xmm5, %xmm3
	mulsd	%xmm11, %xmm6
	mulsd	%xmm11, %xmm2
	mulsd	%xmm10, %xmm5
	subsd	%xmm1, %xmm0
	subsd	%xmm6, %xmm3
	movsd	%xmm0, 96(%rsp)
	subsd	%xmm5, %xmm2
	movsd	%xmm3, 104(%rsp)
	movsd	%xmm2, 112(%rsp)
	call	_Z11dot_productPdS_
	mulsd	%xmm7, %xmm0
	comisd	%xmm0, %xmm9
	ja	.L88
	addsd	%xmm0, %xmm4
	comisd	%xmm8, %xmm4
	ja	.L88
	leaq	24(%rsp), %rdi
	call	_Z11dot_productPdS_
	mulsd	%xmm0, %xmm7
	comisd	.LC10(%rip), %xmm7
	seta	%al
.L83:
	movq	120(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L89
	call	__stack_chk_fail@PLT
.L89:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3905:
	.size	_Z20rayTriangleIntersect3Ray8Triangle, .-_Z20rayTriangleIntersect3Ray8Triangle
	.globl	_Z15planeBoxOverlapPdS_S_
	.type	_Z15planeBoxOverlapPdS_S_, @function
_Z15planeBoxOverlapPdS_S_:
.LFB3906:
	.cfi_startproc
	endbr64
	subq	$72, %rsp
	.cfi_def_cfa_offset 80
	movq	.LC11(%rip), %xmm7
	movq	%rdi, %rcx
	xorps	%xmm5, %xmm5
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movsd	.LC7(%rip), %xmm6
.L94:
	movsd	(%rcx,%rax), %xmm8
	xorl	%edi, %edi
	movsd	(%rdx,%rax), %xmm3
	movaps	%xmm5, %xmm4
	movsd	(%rsi,%rax), %xmm9
	xorps	%xmm2, %xmm2
	comisd	%xmm5, %xmm8
	cmpltsd	%xmm8, %xmm4
	movaps	%xmm3, %xmm1
	xorps	%xmm7, %xmm1
	subsd	%xmm9, %xmm3
	subsd	%xmm9, %xmm1
	seta	%dil
	andps	%xmm4, %xmm2
	andnps	%xmm6, %xmm4
	cvtsi2sdl	%edi, %xmm0
	orps	%xmm4, %xmm2
	movaps	%xmm3, %xmm4
	mulsd	%xmm2, %xmm4
	movaps	%xmm0, %xmm10
	mulsd	%xmm1, %xmm10
	mulsd	%xmm3, %xmm0
	mulsd	%xmm2, %xmm1
	addsd	%xmm10, %xmm4
	addsd	%xmm1, %xmm0
	movsd	%xmm4, 8(%rsp,%rax)
	movsd	%xmm0, 32(%rsp,%rax)
	addq	$8, %rax
	cmpq	$24, %rax
	jne	.L94
	movsd	(%rcx), %xmm0
	movsd	8(%rcx), %xmm3
	movsd	8(%rsp), %xmm1
	movsd	16(%rsp), %xmm4
	movsd	16(%rcx), %xmm2
	mulsd	%xmm3, %xmm4
	mulsd	%xmm0, %xmm1
	mulsd	40(%rsp), %xmm3
	mulsd	32(%rsp), %xmm0
	addsd	%xmm4, %xmm1
	movsd	24(%rsp), %xmm4
	mulsd	%xmm2, %xmm4
	addsd	%xmm3, %xmm0
	mulsd	48(%rsp), %xmm2
	addsd	%xmm4, %xmm1
	xorps	%xmm4, %xmm4
	addsd	%xmm2, %xmm0
	comisd	%xmm4, %xmm1
	setbe	%dl
	xorl	%eax, %eax
	comisd	%xmm4, %xmm0
	setnb	%al
	andl	%edx, %eax
	movq	56(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L95
	call	__stack_chk_fail@PLT
.L95:
	addq	$72, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3906:
	.size	_Z15planeBoxOverlapPdS_S_, .-_Z15planeBoxOverlapPdS_S_
	.globl	_Z13triBoxOverlapPdS_8Triangle
	.type	_Z13triBoxOverlapPdS_8Triangle, @function
_Z13triBoxOverlapPdS_8Triangle:
.LFB3907:
	.cfi_startproc
	endbr64
	subq	$72, %rsp
	.cfi_def_cfa_offset 80
	movsd	(%rdi), %xmm10
	movsd	16(%rdi), %xmm7
	movq	%rsi, %rdx
	movsd	104(%rsp), %xmm0
	movsd	80(%rsp), %xmm4
	leaq	8(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movsd	120(%rsp), %xmm6
	movsd	96(%rsp), %xmm2
	subsd	%xmm10, %xmm0
	subsd	%xmm10, %xmm4
	movsd	8(%rdi), %xmm9
	movsd	112(%rsp), %xmm8
	subsd	%xmm7, %xmm6
	subsd	%xmm7, %xmm2
	movsd	88(%rsp), %xmm3
	subsd	%xmm9, %xmm8
	leaq	32(%rsp), %rdi
	movaps	%xmm0, %xmm1
	movsd	%xmm4, 8(%rsp)
	subsd	%xmm9, %xmm3
	subsd	%xmm4, %xmm1
	movaps	%xmm6, %xmm4
	movsd	%xmm2, 24(%rsp)
	subsd	%xmm2, %xmm4
	movaps	%xmm8, %xmm5
	movsd	128(%rsp), %xmm2
	subsd	%xmm3, %xmm5
	movsd	%xmm3, 16(%rsp)
	movsd	136(%rsp), %xmm3
	subsd	%xmm10, %xmm2
	subsd	%xmm9, %xmm3
	subsd	%xmm0, %xmm2
	movsd	144(%rsp), %xmm0
	subsd	%xmm8, %xmm3
	subsd	%xmm7, %xmm0
	movaps	%xmm4, %xmm7
	mulsd	%xmm2, %xmm4
	mulsd	%xmm3, %xmm7
	subsd	%xmm6, %xmm0
	movaps	%xmm5, %xmm6
	mulsd	%xmm2, %xmm5
	mulsd	%xmm0, %xmm6
	mulsd	%xmm1, %xmm0
	mulsd	%xmm3, %xmm1
	subsd	%xmm7, %xmm6
	subsd	%xmm0, %xmm4
	subsd	%xmm5, %xmm1
	movsd	%xmm6, 32(%rsp)
	movsd	%xmm4, 40(%rsp)
	movsd	%xmm1, 48(%rsp)
	call	_Z15planeBoxOverlapPdS_S_
	movq	56(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L100
	call	__stack_chk_fail@PLT
.L100:
	addq	$72, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3907:
	.size	_Z13triBoxOverlapPdS_8Triangle, .-_Z13triBoxOverlapPdS_8Triangle
	.globl	_Z7TriAreaPdS_S_
	.type	_Z7TriAreaPdS_S_, @function
_Z7TriAreaPdS_S_:
.LFB3908:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	movsd	(%rdi), %xmm6
	movsd	(%rdx), %xmm5
	movsd	(%rsi), %xmm2
	movsd	8(%rdi), %xmm4
	movsd	8(%rsi), %xmm3
	subsd	%xmm6, %xmm5
	subsd	%xmm6, %xmm2
	movsd	8(%rdx), %xmm6
	movsd	16(%rdi), %xmm0
	movsd	16(%rsi), %xmm1
	subsd	%xmm4, %xmm3
	subsd	%xmm4, %xmm6
	movsd	16(%rdx), %xmm4
	subsd	%xmm0, %xmm1
	subsd	%xmm0, %xmm4
	movaps	%xmm3, %xmm0
	mulsd	%xmm5, %xmm3
	movaps	%xmm1, %xmm7
	mulsd	%xmm4, %xmm0
	mulsd	%xmm6, %xmm7
	mulsd	%xmm2, %xmm4
	mulsd	%xmm5, %xmm1
	mulsd	%xmm6, %xmm2
	subsd	%xmm7, %xmm0
	subsd	%xmm4, %xmm1
	subsd	%xmm3, %xmm2
	mulsd	%xmm0, %xmm0
	mulsd	%xmm1, %xmm1
	mulsd	%xmm2, %xmm2
	addsd	%xmm1, %xmm0
	addsd	%xmm2, %xmm0
	call	sqrt@PLT
	mulsd	.LC1(%rip), %xmm0
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3908:
	.size	_Z7TriAreaPdS_S_, .-_Z7TriAreaPdS_S_
	.globl	_Z13IsInPlaneTest3Ray8Triangled
	.type	_Z13IsInPlaneTest3Ray8Triangled, @function
_Z13IsInPlaneTest3Ray8Triangled:
.LFB3909:
	.cfi_startproc
	endbr64
	movsd	88(%rsp), %xmm6
	movsd	112(%rsp), %xmm2
	movaps	%xmm0, %xmm3
	movsd	80(%rsp), %xmm7
	movsd	96(%rsp), %xmm5
	subsd	%xmm6, %xmm2
	movsd	104(%rsp), %xmm1
	movsd	120(%rsp), %xmm4
	movsd	128(%rsp), %xmm9
	movsd	136(%rsp), %xmm10
	subsd	%xmm7, %xmm1
	subsd	%xmm5, %xmm4
	movaps	%xmm2, %xmm8
	subsd	%xmm7, %xmm9
	subsd	%xmm6, %xmm10
	movsd	144(%rsp), %xmm2
	movaps	%xmm8, %xmm0
	subsd	%xmm5, %xmm2
	movaps	%xmm4, %xmm11
	mulsd	%xmm9, %xmm4
	mulsd	%xmm10, %xmm11
	mulsd	%xmm2, %xmm0
	mulsd	%xmm1, %xmm2
	mulsd	%xmm10, %xmm1
	subsd	%xmm11, %xmm0
	subsd	%xmm2, %xmm4
	movaps	%xmm8, %xmm2
	movsd	16(%rsp), %xmm8
	mulsd	%xmm9, %xmm2
	mulsd	%xmm4, %xmm8
	mulsd	%xmm6, %xmm4
	subsd	%xmm2, %xmm1
	movsd	8(%rsp), %xmm2
	mulsd	%xmm0, %xmm2
	xorps	.LC11(%rip), %xmm0
	mulsd	%xmm7, %xmm0
	addsd	%xmm8, %xmm2
	movsd	24(%rsp), %xmm8
	mulsd	%xmm1, %xmm8
	subsd	%xmm4, %xmm0
	mulsd	%xmm5, %xmm1
	addsd	%xmm8, %xmm2
	subsd	%xmm1, %xmm0
	xorps	%xmm1, %xmm1
	addsd	%xmm2, %xmm0
	movaps	%xmm3, %xmm2
	addsd	%xmm1, %xmm2
	comisd	%xmm0, %xmm2
	jb	.L109
	subsd	%xmm3, %xmm1
	comisd	%xmm1, %xmm0
	setnb	%al
	ret
.L109:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE3909:
	.size	_Z13IsInPlaneTest3Ray8Triangled, .-_Z13IsInPlaneTest3Ray8Triangled
	.globl	_Z16PointIsInSurface3Ray8Triangled
	.type	_Z16PointIsInSurface3Ray8Triangled, @function
_Z16PointIsInSurface3Ray8Triangled:
.LFB3910:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
	leaq	152(%rsp), %r12
	leaq	200(%rsp), %rbp
	movsd	%xmm0, 24(%rsp)
	leaq	176(%rsp), %rbx
	movq	%rbp, %rdx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	call	_Z7TriAreaPdS_S_
	movq	%rbx, %rdx
	movq	%r12, %rsi
	leaq	80(%rsp), %rdi
	movq	%xmm0, %r14
	call	_Z7TriAreaPdS_S_
	movq	%rbp, %rdx
	movq	%r12, %rsi
	leaq	80(%rsp), %rdi
	movsd	%xmm0, 8(%rsp)
	call	_Z7TriAreaPdS_S_
	movq	%rbp, %rdx
	movq	%rbx, %rsi
	leaq	80(%rsp), %rdi
	movsd	%xmm0, 16(%rsp)
	call	_Z7TriAreaPdS_S_
	movaps	%xmm0, %xmm1
	movsd	8(%rsp), %xmm0
	addsd	16(%rsp), %xmm0
	addsd	%xmm1, %xmm0
	call	sqrt@PLT
	movsd	%xmm0, 8(%rsp)
	movq	%r14, %xmm0
	call	sqrt@PLT
	movsd	8(%rsp), %xmm1
	movsd	24(%rsp), %xmm2
	xorl	%eax, %eax
	divsd	%xmm0, %xmm1
	subsd	.LC7(%rip), %xmm1
	comisd	%xmm1, %xmm2
	jb	.L110
	xorps	.LC11(%rip), %xmm2
	comisd	%xmm2, %xmm1
	setnb	%al
.L110:
	addq	$40, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3910:
	.size	_Z16PointIsInSurface3Ray8Triangled, .-_Z16PointIsInSurface3Ray8Triangled
	.globl	_Z24rayBoxIntersection_yaxisPd4Cube
	.type	_Z24rayBoxIntersection_yaxisPd4Cube, @function
_Z24rayBoxIntersection_yaxisPd4Cube:
.LFB3911:
	.cfi_startproc
	endbr64
	movsd	(%rdi), %xmm0
	movsd	8(%rsp), %xmm1
	xorl	%eax, %eax
	comisd	%xmm0, %xmm1
	ja	.L118
	comisd	16(%rsp), %xmm0
	ja	.L118
	movsd	16(%rdi), %xmm0
	movsd	40(%rsp), %xmm1
	comisd	%xmm0, %xmm1
	ja	.L118
	comisd	48(%rsp), %xmm0
	ja	.L118
	movsd	8(%rdi), %xmm0
	comisd	32(%rsp), %xmm0
	setbe	%al
.L118:
	movzbl	%al, %eax
	ret
	.cfi_endproc
.LFE3911:
	.size	_Z24rayBoxIntersection_yaxisPd4Cube, .-_Z24rayBoxIntersection_yaxisPd4Cube
	.globl	SetRays
	.type	SetRays, @function
SetRays:
.LFB3912:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	movslq	%esi, %rdi
	pushq	%rdx
	.cfi_def_cfa_offset 32
	movq	%rdi, %rbp
	movl	%edi, numRays(%rip)
	imulq	$72, %rdi, %rdi
	call	malloc@PLT
	movsd	.LC6(%rip), %xmm0
	movq	%rbx, %rdx
	xorl	%ecx, %ecx
	movq	%rax, rays(%rip)
	movsd	.LC7(%rip), %xmm1
.L124:
	cmpl	%ebp, %ecx
	jge	.L127
	cvtss2sd	(%rdx), %xmm2
	movsd	%xmm0, 24(%rax)
	incl	%ecx
	addq	$12, %rdx
	movsd	%xmm2, (%rax)
	cvtss2sd	-8(%rdx), %xmm2
	addq	$72, %rax
	movsd	%xmm2, -64(%rax)
	cvtss2sd	-4(%rdx), %xmm2
	movsd	%xmm1, -40(%rax)
	movsd	%xmm2, -56(%rax)
	movsd	%xmm0, -32(%rax)
	jmp	.L124
.L127:
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3912:
	.size	SetRays, .-SetRays
	.globl	SetTriangles
	.type	SetTriangles, @function
SetTriangles:
.LFB3913:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	movslq	%esi, %rdi
	pushq	%rdx
	.cfi_def_cfa_offset 32
	movq	%rdi, %rbp
	movl	%edi, numTriangles(%rip)
	imulq	$72, %rdi, %rdi
	call	malloc@PLT
	movq	%rbx, %rdx
	xorl	%ecx, %ecx
	movq	%rax, triangles(%rip)
.L129:
	cmpl	%ebp, %ecx
	jge	.L132
	movsd	(%rdx), %xmm0
	incl	%ecx
	addq	$72, %rdx
	addq	$72, %rax
	movsd	%xmm0, -72(%rax)
	movsd	-64(%rdx), %xmm0
	movsd	%xmm0, -64(%rax)
	movsd	-56(%rdx), %xmm0
	movsd	%xmm0, -56(%rax)
	movsd	-48(%rdx), %xmm0
	movsd	%xmm0, -48(%rax)
	movsd	-40(%rdx), %xmm0
	movsd	%xmm0, -40(%rax)
	movsd	-32(%rdx), %xmm0
	movsd	%xmm0, -32(%rax)
	movsd	-24(%rdx), %xmm0
	movsd	%xmm0, -24(%rax)
	movsd	-16(%rdx), %xmm0
	movsd	%xmm0, -16(%rax)
	movsd	-8(%rdx), %xmm0
	movsd	%xmm0, -8(%rax)
	jmp	.L129
.L132:
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3913:
	.size	SetTriangles, .-SetTriangles
	.section	.rodata.str1.1
.LC12:
	.string	"Triangle:%d %lf %lf %lf \n"
	.text
	.globl	_Z14printTrianglesv
	.type	_Z14printTrianglesv, @function
_Z14printTrianglesv:
.LFB3914:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC12(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	pushq	%rdx
	.cfi_def_cfa_offset 48
.L134:
	cmpl	%ebp, numTriangles(%rip)
	movl	%ebp, %r12d
	jle	.L137
	imulq	$72, %rbp, %rbx
	movl	%r12d, %edx
	movq	%r13, %rsi
	movl	$2, %edi
	movq	triangles(%rip), %rax
	incq	%rbp
	addq	%rbx, %rax
	movsd	16(%rax), %xmm2
	movsd	8(%rax), %xmm1
	movsd	(%rax), %xmm0
	movb	$3, %al
	call	__printf_chk@PLT
	movl	%r12d, %edx
	movq	%r13, %rsi
	movl	$2, %edi
	movq	triangles(%rip), %rax
	addq	%rbx, %rax
	movsd	24(%rax), %xmm0
	movsd	40(%rax), %xmm2
	movsd	32(%rax), %xmm1
	movb	$3, %al
	call	__printf_chk@PLT
	movl	%r12d, %edx
	movq	%r13, %rsi
	movl	$2, %edi
	addq	triangles(%rip), %rbx
	movb	$3, %al
	movsd	48(%rbx), %xmm0
	movsd	64(%rbx), %xmm2
	movsd	56(%rbx), %xmm1
	call	__printf_chk@PLT
	jmp	.L134
.L137:
	popq	%rax
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3914:
	.size	_Z14printTrianglesv, .-_Z14printTrianglesv
	.globl	SetBoundingBox
	.type	SetBoundingBox, @function
SetBoundingBox:
.LFB3915:
	.cfi_startproc
	endbr64
	movsd	(%rdi), %xmm0
	movsd	%xmm0, boundingBox(%rip)
	movsd	8(%rdi), %xmm0
	movsd	%xmm0, 8+boundingBox(%rip)
	movsd	(%rsi), %xmm0
	movsd	%xmm0, 16+boundingBox(%rip)
	movsd	8(%rsi), %xmm0
	movsd	%xmm0, 24+boundingBox(%rip)
	movsd	(%rdx), %xmm0
	movsd	%xmm0, 32+boundingBox(%rip)
	movsd	8(%rdx), %xmm0
	movsd	%xmm0, 40+boundingBox(%rip)
	ret
	.cfi_endproc
.LFE3915:
	.size	SetBoundingBox, .-SetBoundingBox
	.globl	_Z13TriangleCountP8TriangleP4CubeiiPb
	.type	_Z13TriangleCountP8TriangleP4CubeiiPb, @function
_Z13TriangleCountP8TriangleP4CubeiiPb:
.LFB3916:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edx, %r10
	movq	%r8, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%ecx, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r10, %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
	leaq	72(%rsi), %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%rdi, 8(%rsp)
.L140:
	cmpl	%ebp, %r12d
	jle	.L145
	leaq	-24(%rbx), %rax
	movq	8(%rsp), %r13
	leaq	(%r15,%rbp), %r9
	xorl	%r8d, %r8d
	movq	%rax, 16(%rsp)
	xorl	%edx, %edx
.L141:
	movl	%r8d, 28(%rbx)
	cmpl	%r14d, %edx
	jge	.L146
	movl	%edx, 24(%rsp)
	subq	$80, %rsp
	.cfi_def_cfa_offset 192
	movq	%r13, %rsi
	movl	$18, %ecx
	movq	%r10, 120(%rsp)
	movq	%r9, 112(%rsp)
	movl	%r8d, 108(%rsp)
	movq	%rsp, %rdi
	rep movsl
	movq	%rbx, %rdi
	movq	96(%rsp), %rsi
	call	_Z13triBoxOverlapPdS_8Triangle
	movq	112(%rsp), %r9
	movl	108(%rsp), %r8d
	addq	$80, %rsp
	.cfi_def_cfa_offset 112
	movl	24(%rsp), %edx
	movq	40(%rsp), %r10
	testl	%eax, %eax
	setg	(%r9)
	addl	%eax, %r8d
	addq	$72, %r13
	incl	%edx
	addq	%r10, %r9
	jmp	.L141
.L146:
	incq	%rbp
	addq	$120, %rbx
	jmp	.L140
.L145:
	addq	$56, %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
.LFE3916:
	.size	_Z13TriangleCountP8TriangleP4CubeiiPb, .-_Z13TriangleCountP8TriangleP4CubeiiPb
	.globl	_Z13appendALL_CPUP4CubeiiPbP8Triangle
	.type	_Z13appendALL_CPUP4CubeiiPbP8Triangle, @function
_Z13appendALL_CPUP4CubeiiPbP8Triangle:
.LFB3917:
	.cfi_startproc
	endbr64
	movslq	%esi, %r11
	xorl	%esi, %esi
	addq	$112, %rdi
	movq	%r11, %r8
	cmpl	%esi, %r11d
	jg	.L154
	ret
.L154:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
.L151:
	leaq	(%rcx,%rsi), %r10
	xorl	%eax, %eax
	xorl	%r9d, %r9d
.L149:
	movl	%eax, (%rdi)
	cmpl	%edx, %r9d
	jge	.L155
	movq	-8(%rdi), %rbx
	cltq
	movl	%r9d, (%rbx,%rax,4)
	movzbl	(%r10), %eax
	incl	%r9d
	addq	%r11, %r10
	addl	(%rdi), %eax
	jmp	.L149
.L155:
	incq	%rsi
	addq	$120, %rdi
	cmpl	%esi, %r8d
	jg	.L151
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3917:
	.size	_Z13appendALL_CPUP4CubeiiPbP8Triangle, .-_Z13appendALL_CPUP4CubeiiPbP8Triangle
	.globl	_Z13firstCube_CPUP4CubeP3RayP8Triangleii
	.type	_Z13firstCube_CPUP4CubeP3RayP8Triangleii, @function
_Z13firstCube_CPUP4CubeP3RayP8Triangleii:
.LFB3918:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %r11
	movl	%ecx, %r10d
	movq	%rsi, %rdx
	xorl	%ebx, %ebx
.L157:
	cmpl	%r10d, %ebx
	jge	.L166
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	movl	%eax, 64(%rdx)
.L158:
	cmpl	%r8d, %r9d
	jge	.L167
	movslq	%r9d, %rsi
	subq	$120, %rsp
	.cfi_def_cfa_offset 136
	movl	$30, %ecx
	imulq	$120, %rsi, %rsi
	movq	%rsp, %rdi
	addq	%r11, %rsi
	rep movsl
	movq	%rdx, %rdi
	call	_Z24rayBoxIntersection_yaxisPd4Cube
	addq	$120, %rsp
	.cfi_def_cfa_offset 16
	testl	%eax, %eax
	je	.L159
	movslq	64(%rdx), %rcx
	movq	%rcx, %rax
	movl	%r9d, 48(%rdx,%rcx,4)
	addl	%r8d, %r9d
	incl	%eax
	movl	%eax, 64(%rdx)
.L159:
	incl	%r9d
	jmp	.L158
.L167:
	incl	%ebx
	addq	$72, %rdx
	jmp	.L157
.L166:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3918:
	.size	_Z13firstCube_CPUP4CubeP3RayP8Triangleii, .-_Z13firstCube_CPUP4CubeP3RayP8Triangleii
	.globl	_Z9IsInPlaneP3RayP8TrianglePbiP4Cube
	.type	_Z9IsInPlaneP3RayP8TrianglePbiP4Cube, @function
_Z9IsInPlaneP3RayP8TrianglePbiP4Cube:
.LFB3919:
	.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
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	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
	movq	%rdi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movl	%ecx, 12(%rsp)
.L169:
	cmpl	%ebp, 12(%rsp)
	jle	.L176
	cmpl	$0, 64(%rbx)
	jle	.L171
	xorl	%r14d, %r14d
	xorl	%r12d, %r12d
.L170:
	movslq	48(%rbx), %rax
	imulq	$120, %rax, %rax
	addq	%r8, %rax
	movl	112(%rax), %r15d
	cmpl	%r14d, %r15d
	jle	.L177
	movq	104(%rax), %rax
	movslq	%r14d, %rcx
	movq	%r8, 24(%rsp)
	subq	$72, %rsp
	.cfi_def_cfa_offset 168
	movq	%rdx, 88(%rsp)
	movq	%rsp, %rdi
	subq	$72, %rsp
	.cfi_def_cfa_offset 240
	movsd	.LC10(%rip), %xmm0
	movslq	(%rax,%rcx,4), %rsi
	movl	$18, %ecx
	imulq	$72, %rsi, %rsi
	addq	%r13, %rsi
	rep movsl
	movq	%rsp, %rdi
	movl	$18, %ecx
	movq	%rbx, %rsi
	rep movsl
	call	_Z16PointIsInSurface3Ray8Triangled
	addq	$144, %rsp
	.cfi_def_cfa_offset 96
	movq	16(%rsp), %rdx
	movq	24(%rsp), %r8
	movzbl	%al, %eax
	addl	%eax, %r12d
	imull	%r12d, %r15d
	leal	1(%r14,%r15), %r14d
	jmp	.L170
.L177:
	testl	%r12d, %r12d
	setg	(%rdx,%rbp)
.L171:
	incq	%rbp
	addq	$72, %rbx
	jmp	.L169
.L176:
	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
.LFE3919:
	.size	_Z9IsInPlaneP3RayP8TrianglePbiP4Cube, .-_Z9IsInPlaneP3RayP8TrianglePbiP4Cube
	.globl	_Z14findUnique_CPUP4CubeiiPbii
	.type	_Z14findUnique_CPUP4CubeiiPbii, @function
_Z14findUnique_CPUP4CubeiiPbii:
.LFB3920:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	decl	%edx
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movslq	%r9d, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movl	%esi, %r12d
	subl	%edx, %r12d
	movslq	%esi, %rdx
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	xorl	%ebp, %ebp
	imulq	$120, %rdx, %rax
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	addq	%rcx, %rdx
	leaq	(%rdi,%rax), %r11
	xorl	%edi, %edi
.L179:
	cmpl	%r8d, %ebp
	jge	.L178
	leal	(%rsi,%rdi), %eax
	movslq	%edi, %rbx
	movslq	%r12d, %r10
	cltq
	addq	%rcx, %rbx
	addq	%rcx, %rax
.L182:
	cmpl	%r10d, %esi
	jle	.L184
	movb	(%rbx,%r10), %r14b
	incq	%r10
	orb	%r14b, (%rax)
	jmp	.L182
.L184:
	movzbl	(%rdx), %eax
	incl	%ebp
	addl	%eax, 112(%r11)
	addq	%r13, %rdx
	addl	%r9d, %edi
	jmp	.L179
.L178:
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3920:
	.size	_Z14findUnique_CPUP4CubeiiPbii, .-_Z14findUnique_CPUP4CubeiiPbii
	.globl	_Z19appendTriangles_CPUP4CubePiiiiPb
	.type	_Z19appendTriangles_CPUP4CubePiiiiPb, @function
_Z19appendTriangles_CPUP4CubePiiiiPb:
.LFB3921:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rsi, %r11
	movq	%rdi, %r10
	xorl	%esi, %esi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movslq	%r8d, %r8
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	%edx, %ebx
.L186:
	cmpl	%esi, %ebx
	jle	.L191
	movslq	(%r11,%rsi,4), %rdx
	xorl	%eax, %eax
	xorl	%edi, %edi
	imulq	$120, %rdx, %rcx
	addq	%r9, %rdx
	addq	%r10, %rcx
.L187:
	movl	%eax, 112(%rcx)
	cmpl	%ebp, %edi
	jge	.L192
	movq	104(%rcx), %r14
	cltq
	movl	%edi, (%r14,%rax,4)
	movzbl	(%rdx), %eax
	incl	%edi
	addq	%r8, %rdx
	addl	112(%rcx), %eax
	jmp	.L187
.L192:
	incq	%rsi
	jmp	.L186
.L191:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3921:
	.size	_Z19appendTriangles_CPUP4CubePiiiiPb, .-_Z19appendTriangles_CPUP4CubePiiiiPb
	.globl	_Z19getIntersectedCubesP3RayP4CubeiPiS1_i
	.type	_Z19getIntersectedCubesP3RayP4CubeiPiS1_i, @function
_Z19getIntersectedCubesP3RayP4CubeiPiS1_i:
.LFB3922:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%edx, %r11d
	movq	%rdi, %rdx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rcx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
.L194:
	cmpl	%r11d, %ebx
	jge	.L199
	xorl	%r9d, %r9d
	xorl	%r10d, %r10d
.L195:
	movl	%r10d, 64(%rdx)
	cmpl	%r9d, %r8d
	jle	.L200
	movslq	(%r12,%r9,4), %rsi
	subq	$120, %rsp
	.cfi_def_cfa_offset 160
	movl	$30, %ecx
	incq	%r9
	movq	%rsp, %rdi
	movq	%rsi, %r13
	imulq	$120, %rsi, %rsi
	addq	%rbp, %rsi
	rep movsl
	movq	%rdx, %rdi
	movslq	%r10d, %rcx
	call	_Z24rayBoxIntersection_yaxisPd4Cube
	addq	$120, %rsp
	.cfi_def_cfa_offset 40
	movl	%r13d, 48(%rdx,%rcx,4)
	addl	%eax, %r10d
	jmp	.L195
.L200:
	incl	%ebx
	addq	$72, %rdx
	jmp	.L194
.L199:
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3922:
	.size	_Z19getIntersectedCubesP3RayP4CubeiPiS1_i, .-_Z19getIntersectedCubesP3RayP4CubeiPiS1_i
	.globl	_Z11ray_tracingP3RayP8TrianglePbiiP4Cube
	.type	_Z11ray_tracingP3RayP8TrianglePbiiP4Cube, @function
_Z11ray_tracingP3RayP8TrianglePbiiP4Cube:
.LFB3923:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	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
	movq	%rdi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movl	%ecx, 12(%rsp)
.L202:
	cmpl	%ebp, 12(%rsp)
	jle	.L208
	cmpl	$0, 64(%rbx)
	jle	.L203
	movslq	48(%rbx), %r12
	xorl	%edx, %edx
	xorl	%r14d, %r14d
	imulq	$120, %r12, %r12
	addq	%r9, %r12
	movl	112(%r12), %eax
	movl	%eax, 8(%rsp)
.L204:
	cmpl	%edx, 8(%rsp)
	jle	.L209
	movq	104(%r12), %rax
	movq	%r9, 24(%rsp)
	subq	$72, %rsp
	.cfi_def_cfa_offset 168
	movl	$18, %ecx
	movq	%rdx, 88(%rsp)
	movq	%rsp, %rdi
	subq	$72, %rsp
	.cfi_def_cfa_offset 240
	movslq	(%rax,%rdx,4), %rsi
	imulq	$72, %rsi, %rsi
	addq	%r13, %rsi
	rep movsl
	movq	%rsp, %rdi
	movl	$18, %ecx
	movq	%rbx, %rsi
	rep movsl
	call	_Z20rayTriangleIntersect3Ray8Triangle
	movq	160(%rsp), %rdx
	addq	$144, %rsp
	.cfi_def_cfa_offset 96
	movq	24(%rsp), %r9
	movzbl	%al, %eax
	addl	%eax, %r14d
	incq	%rdx
	jmp	.L204
.L209:
	movb	%r14b, (%r15,%rbp)
	andb	$1, (%r15,%rbp)
.L203:
	incq	%rbp
	addq	$72, %rbx
	jmp	.L202
.L208:
	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
.LFE3923:
	.size	_Z11ray_tracingP3RayP8TrianglePbiiP4Cube, .-_Z11ray_tracingP3RayP8TrianglePbiiP4Cube
	.section	.rodata.str1.1
.LC14:
	.string	"Num cubes: %d \n"
.LC15:
	.string	"Num Triangles: %d \n"
.LC16:
	.string	"Num Rays: %d \n"
.LC17:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/ADiko1997/CUDA-optimized-ray-tracing/main/ray_tracingGPU.cu"
.LC18:
	.string	"Cuda error in file '%s' in line %i : %s.\n"
.LC20:
	.string	" \n time spent for preprocessing: %.10f\n"
.LC21:
	.string	"time spent for Is In plane: %.10f\n"
.LC22:
	.string	"time spent for pre-raytracing: %.10f\n"
.LC23:
	.string	"time spent for raytracing: %.10f\n"
	.text
	.globl	RayTracingGPU
	.type	RayTracingGPU, @function
RayTracingGPU:
.LFB3924:
	.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	$280, %rsp
	.cfi_def_cfa_offset 336
	movsd	8+boundingBox(%rip), %xmm2
	movsd	40+boundingBox(%rip), %xmm1
	movq	%fs:40, %rax
	movq	%rax, 264(%rsp)
	movl	(%rdi), %eax
	movsd	boundingBox(%rip), %xmm4
	movsd	32+boundingBox(%rip), %xmm3
	movaps	%xmm2, %xmm0
	movaps	%xmm1, %xmm5
	movsd	16+boundingBox(%rip), %xmm6
	movq	24+boundingBox(%rip), %rbx
	subsd	%xmm3, %xmm5
	subsd	%xmm4, %xmm0
	movsd	%xmm2, 40(%rsp)
	movsd	%xmm4, 32(%rsp)
	movsd	%xmm1, 24(%rsp)
	mulsd	%xmm5, %xmm0
	movsd	%xmm3, 16(%rsp)
	movl	%eax, 60(%rsp)
	movl	(%rsi), %eax
	divsd	.LC13(%rip), %xmm0
	movsd	%xmm6, 8(%rsp)
	movl	%eax, 64(%rsp)
	call	sqrt@PLT
	movsd	%xmm0, (%rsp)
	movq	%rbx, %xmm0
	subsd	8(%rsp), %xmm0
	divsd	(%rsp), %xmm0
	call	ceil@PLT
	movsd	32(%rsp), %xmm4
	subq	$48, %rsp
	.cfi_def_cfa_offset 384
	movsd	64(%rsp), %xmm3
	cvttsd2sil	%xmm0, %eax
	movsd	88(%rsp), %xmm2
	movsd	72(%rsp), %xmm1
	movq	%rbx, 272(%rsp)
	movsd	%xmm4, 288(%rsp)
	movsd	56(%rsp), %xmm7
	movsd	%xmm3, 304(%rsp)
	movsd	%xmm2, 264(%rsp)
	movsd	%xmm1, 280(%rsp)
	movl	%eax, 116(%rsp)
	movsd	%xmm7, 296(%rsp)
	movsd	48(%rsp), %xmm0
	movq	280(%rsp), %rax
	movups	264(%rsp), %xmm6
	movups	288(%rsp), %xmm7
	movq	%rax, 40(%rsp)
	movq	304(%rsp), %rax
	movups	%xmm6, 24(%rsp)
	movups	%xmm7, (%rsp)
	movq	%rax, 16(%rsp)
	call	_Z16getNumberOfCubes7Point3DS_d
	addq	$48, %rsp
	.cfi_def_cfa_offset 336
	movl	%eax, 72(%rsp)
	cltq
	imulq	$120, %rax, %rdi
	call	malloc@PLT
	movl	$400, %edi
	movq	%rax, %rbx
	call	malloc@PLT
	leaq	200(%rsp), %rsi
	movq	%rbx, %rdi
	movq	$100, 200(%rsp)
	movq	%rax, 208(%rsp)
	subq	$48, %rsp
	.cfi_def_cfa_offset 384
	movq	280(%rsp), %rax
	movups	264(%rsp), %xmm1
	movups	288(%rsp), %xmm2
	movsd	48(%rsp), %xmm0
	movq	%rax, 40(%rsp)
	movq	304(%rsp), %rax
	movups	%xmm1, 24(%rsp)
	movups	%xmm2, (%rsp)
	movq	%rax, 16(%rsp)
	call	_Z12createGrid3DP4Cube7Point3DS1_dR5Index
	movslq	112(%rsp), %rdi
	movslq	120(%rsp), %rax
	addq	$48, %rsp
	.cfi_def_cfa_offset 336
	imulq	%rax, %rdi
	call	malloc@PLT
	movslq	204(%rsp), %rdi
	movq	%rax, (%rsp)
	movabsq	$2305843009213693950, %rax
	movl	%edi, 76(%rsp)
	cmpq	%rdi, %rax
	jb	.L211
	movq	%rdi, %r13
	salq	$2, %rdi
	call	_Znam@PLT
	movq	208(%rsp), %rdx
	movq	%rax, %rbp
	xorl	%eax, %eax
	jmp	.L212
.L211:
	movq	264(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L253
	call	__cxa_throw_bad_array_new_length@PLT
.L212:
	cmpl	%eax, %r13d
	jle	.L255
	movl	(%rdx,%rax,4), %ecx
	movl	%ecx, 0(%rbp,%rax,4)
	incq	%rax
	jmp	.L212
.L255:
	movl	72(%rsp), %edx
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	64(%rsp), %edx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC15(%rip), %rsi
	call	__printf_chk@PLT
	movl	60(%rsp), %edx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC16(%rip), %rsi
	call	__printf_chk@PLT
	movslq	64(%rsp), %rsi
	leaq	80(%rsp), %rdi
	imulq	$72, %rsi, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L215
	call	cudaGetErrorString@PLT
	movl	$1120, %r8d
	movq	%rax, %r9
	jmp	.L254
.L215:
	movslq	64(%rsp), %rdx
	movq	80(%rsp), %rdi
	movl	$1, %ecx
	movq	triangles(%rip), %rsi
	imulq	$72, %rdx, %rdx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L216
	call	cudaGetErrorString@PLT
	movl	$1121, %r8d
	movq	%rax, %r9
.L254:
	movq	stderr(%rip), %rdi
	leaq	.LC17(%rip), %rcx
	leaq	.LC18(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L216:
	movslq	60(%rsp), %rsi
	leaq	88(%rsp), %rdi
	imulq	$72, %rsi, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L217
	call	cudaGetErrorString@PLT
	movl	$1124, %r8d
	movq	%rax, %r9
	jmp	.L254
.L217:
	movslq	60(%rsp), %rdx
	movq	88(%rsp), %rdi
	movl	$1, %ecx
	movq	rays(%rip), %rsi
	imulq	$72, %rdx, %rdx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L218
	call	cudaGetErrorString@PLT
	movl	$1125, %r8d
	movq	%rax, %r9
	jmp	.L254
.L218:
	movslq	72(%rsp), %rsi
	movslq	64(%rsp), %rax
	leaq	96(%rsp), %rdi
	imulq	%rax, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L219
	call	cudaGetErrorString@PLT
	movl	$1128, %r8d
	movq	%rax, %r9
	jmp	.L254
.L219:
	movslq	72(%rsp), %rdx
	movslq	64(%rsp), %rax
	movl	$1, %ecx
	movq	96(%rsp), %rdi
	movq	(%rsp), %rsi
	imulq	%rax, %rdx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L220
	call	cudaGetErrorString@PLT
	movl	$1129, %r8d
	movq	%rax, %r9
	jmp	.L254
.L220:
	leaq	104(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L221
	call	cudaGetErrorString@PLT
	movl	$1132, %r8d
	movq	%rax, %r9
	jmp	.L254
.L221:
	movq	104(%rsp), %rdi
	leaq	68(%rsp), %rsi
	movl	$1, %ecx
	movl	$4, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L222
	call	cudaGetErrorString@PLT
	movl	$1133, %r8d
	movq	%rax, %r9
	jmp	.L254
.L222:
	leaq	112(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L223
	call	cudaGetErrorString@PLT
	movl	$1136, %r8d
	movq	%rax, %r9
	jmp	.L254
.L223:
	movq	112(%rsp), %rdi
	leaq	76(%rsp), %rsi
	movl	$1, %ecx
	movl	$4, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L224
	call	cudaGetErrorString@PLT
	movl	$1137, %r8d
	movq	%rax, %r9
	jmp	.L254
.L224:
	movslq	76(%rsp), %rsi
	leaq	120(%rsp), %rdi
	salq	$2, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L225
	call	cudaGetErrorString@PLT
	movl	$1140, %r8d
	movq	%rax, %r9
	jmp	.L254
.L225:
	movslq	76(%rsp), %rdx
	movq	120(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	salq	$2, %rdx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L226
	call	cudaGetErrorString@PLT
	movl	$1141, %r8d
	movq	%rax, %r9
	jmp	.L254
.L226:
	leaq	128(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L227
	call	cudaGetErrorString@PLT
	movl	$1144, %r8d
	movq	%rax, %r9
	jmp	.L254
.L227:
	leaq	60(%rsp), %rsi
	movl	$1, %ecx
	movl	$4, %edx
	movq	128(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L228
	call	cudaGetErrorString@PLT
	movl	$1145, %r8d
	movq	%rax, %r9
	jmp	.L254
.L228:
	leaq	136(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L229
	call	cudaGetErrorString@PLT
	movl	$1148, %r8d
	movq	%rax, %r9
	jmp	.L254
.L229:
	leaq	64(%rsp), %rsi
	movl	$1, %ecx
	movl	$4, %edx
	movq	136(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L230
	call	cudaGetErrorString@PLT
	movl	$1149, %r8d
	movq	%rax, %r9
	jmp	.L254
.L230:
	leaq	144(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L231
	call	cudaGetErrorString@PLT
	movl	$1152, %r8d
	movq	%rax, %r9
	jmp	.L254
.L231:
	leaq	72(%rsp), %rsi
	movl	$1, %ecx
	movl	$4, %edx
	movq	144(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L232
	call	cudaGetErrorString@PLT
	movl	$1153, %r8d
	movq	%rax, %r9
	jmp	.L254
.L232:
	leaq	152(%rsp), %rdi
	movl	$120, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L233
	call	cudaGetErrorString@PLT
	movl	$1156, %r8d
	movq	%rax, %r9
	jmp	.L254
.L233:
	movq	152(%rsp), %rdi
	movl	$1, %ecx
	movl	$120, %edx
	leaq	boundingBox(%rip), %r13
	movq	%r13, %rsi
	call	cudaMemcpy@PLT
	movq	%r13, 24(%rsp)
	testl	%eax, %eax
	movl	%eax, %edi
	je	.L234
	call	cudaGetErrorString@PLT
	movl	$1157, %r8d
	movq	%rax, %r9
	jmp	.L254
.L234:
	leaq	160(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L235
	call	cudaGetErrorString@PLT
	movl	$1160, %r8d
	movq	%rax, %r9
	jmp	.L254
.L235:
	leaq	168(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L236
	call	cudaGetErrorString@PLT
	movl	$1163, %r8d
	movq	%rax, %r9
	jmp	.L254
.L236:
	movslq	60(%rsp), %rsi
	leaq	176(%rsp), %rdi
	addq	%rsi, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L237
	call	cudaGetErrorString@PLT
	movl	$1166, %r8d
	movq	%rax, %r9
	jmp	.L254
.L237:
	movslq	60(%rsp), %rsi
	leaq	184(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L238
	call	cudaGetErrorString@PLT
	movl	$1169, %r8d
	movq	%rax, %r9
	jmp	.L254
.L238:
	movslq	72(%rsp), %rsi
	leaq	192(%rsp), %rdi
	salq	$2, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L239
	call	cudaGetErrorString@PLT
	movl	$1172, %r8d
	movq	%rax, %r9
	jmp	.L254
.L239:
	movl	60(%rsp), %r13d
	leaq	100(%rbx), %r15
	xorl	%r12d, %r12d
	leal	(%r13,%r13), %edi
	movslq	%edi, %rdi
	call	malloc@PLT
	movslq	%r13d, %rdi
	movq	%rax, isInside(%rip)
	call	malloc@PLT
	movq	%rax, isInPlane(%rip)
	call	clock@PLT
	movl	72(%rsp), %r14d
	movq	(%rsp), %r8
	movq	%rbx, %rsi
	movq	%rax, %r13
	movl	64(%rsp), %eax
	movl	%r14d, %edx
	movl	%eax, 16(%rsp)
	movq	triangles(%rip), %rax
	movl	16(%rsp), %ecx
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	_Z13TriangleCountP8TriangleP4CubeiiPb
.L240:
	cmpl	%r12d, %r14d
	jle	.L256
	movslq	(%r15), %rax
	incl	%r12d
	addq	$120, %r15
	leaq	1(,%rax,4), %rdi
	call	malloc@PLT
	movq	%rax, -116(%r15)
	jmp	.L240
.L256:
	movq	8(%rsp), %r8
	movq	(%rsp), %rcx
	movl	%r14d, %esi
	movq	%rbx, %rdi
	movl	16(%rsp), %edx
	call	_Z13appendALL_CPUP4CubeiiPbP8Triangle
	movl	72(%rsp), %r8d
	movl	60(%rsp), %ecx
	movq	%rbx, %rdi
	movq	8(%rsp), %rdx
	movq	rays(%rip), %rsi
	call	_Z13firstCube_CPUP4CubeP3RayP8Triangleii
	call	clock@PLT
	leaq	.LC20(%rip), %rsi
	movl	$2, %edi
	subq	%r13, %rax
	cvtsi2sdq	%rax, %xmm0
	movb	$1, %al
	divsd	.LC19(%rip), %xmm0
	call	__printf_chk@PLT
	call	clock@PLT
	movl	60(%rsp), %ecx
	movq	%rbx, %r8
	movq	isInside(%rip), %rdx
	movq	triangles(%rip), %rsi
	movq	rays(%rip), %rdi
	movq	%rax, %r13
	call	_Z9IsInPlaneP3RayP8TrianglePbiP4Cube
	call	clock@PLT
	leaq	.LC21(%rip), %rsi
	movl	$2, %edi
	subq	%r13, %rax
	xorl	%r13d, %r13d
	cvtsi2sdq	%rax, %xmm0
	movb	$1, %al
	divsd	.LC19(%rip), %xmm0
	call	__printf_chk@PLT
.L242:
	movl	76(%rsp), %r15d
	cmpl	%r13d, %r15d
	jle	.L257
	movl	0(%rbp,%r13,4), %esi
	movl	72(%rsp), %r9d
	movq	%rbx, %rdi
	incq	%r13
	movl	64(%rsp), %r8d
	movq	(%rsp), %rcx
	movl	68(%rsp), %edx
	call	_Z14findUnique_CPUP4CubeiiPbii
	jmp	.L242
.L257:
	xorl	%r14d, %r14d
.L244:
	cmpl	%r14d, %r15d
	jle	.L258
	movslq	0(%rbp,%r14,4), %r13
	incq	%r14
	imulq	$120, %r13, %r13
	addq	%rbx, %r13
	movslq	112(%r13), %rdi
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, 104(%r13)
	jmp	.L244
.L258:
	call	clock@PLT
	movq	(%rsp), %r9
	movl	64(%rsp), %ecx
	movq	%rbp, %rsi
	movl	72(%rsp), %r8d
	movl	76(%rsp), %edx
	movq	%rbx, %rdi
	movq	%rax, %r13
	call	_Z19appendTriangles_CPUP4CubePiiiiPb
	addq	$-128, %rsp
	.cfi_def_cfa_offset 464
	movl	$30, %ecx
	movq	152(%rsp), %rsi
	movq	%rsp, %rdi
	rep movsl
	movq	%rbp, %rcx
	movq	%rbx, %rsi
	movl	188(%rsp), %edx
	movl	204(%rsp), %r8d
	movq	rays(%rip), %rdi
	call	_Z19getIntersectedCubesP3RayP4CubeiPiS1_i
	subq	$-128, %rsp
	.cfi_def_cfa_offset 336
	call	clock@PLT
	leaq	.LC22(%rip), %rsi
	movl	$2, %edi
	subq	%r13, %rax
	cvtsi2sdq	%rax, %xmm0
	movb	$1, %al
	divsd	.LC19(%rip), %xmm0
	call	__printf_chk@PLT
	call	clock@PLT
	movl	60(%rsp), %ecx
	movq	%rbx, %r9
	movq	isInPlane(%rip), %rdx
	movl	64(%rsp), %r8d
	movq	triangles(%rip), %rsi
	movq	%rax, %rbp
	movq	rays(%rip), %rdi
	call	_Z11ray_tracingP3RayP8TrianglePbiiP4Cube
	call	clock@PLT
	leaq	.LC23(%rip), %rsi
	movl	$2, %edi
	subq	%rbp, %rax
	cvtsi2sdq	%rax, %xmm0
	movb	$1, %al
	divsd	.LC19(%rip), %xmm0
	call	__printf_chk@PLT
	movslq	60(%rsp), %rsi
	movq	isInside(%rip), %rcx
	xorl	%eax, %eax
	movq	isInPlane(%rip), %rdi
	movq	%rsi, %rdx
	addq	%rcx, %rsi
.L246:
	cmpl	%eax, %edx
	jle	.L259
	movb	(%rdi,%rax), %r8b
	movb	%r8b, (%rsi,%rax)
	incq	%rax
	jmp	.L246
.L259:
	xorl	%eax, %eax
.L248:
	cmpl	%eax, %edx
	jle	.L260
	cmpb	$0, (%rcx,%rax)
	je	.L249
	leal	(%rdx,%rax), %esi
	movslq	%esi, %rsi
	movb	$0, (%rcx,%rsi)
.L249:
	incq	%rax
	jmp	.L248
.L260:
	movq	rays(%rip), %rdi
	call	free@PLT
	movq	triangles(%rip), %rdi
	call	free@PLT
	movq	isInPlane(%rip), %rdi
	call	free@PLT
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movq	176(%rsp), %rdi
	call	cudaFree@PLT
	movq	160(%rsp), %rdi
	call	cudaFree@PLT
	movq	152(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbx, %rdi
	call	cudaFree@PLT
	movq	104(%rsp), %rdi
	call	cudaFree@PLT
	movq	120(%rsp), %rdi
	call	cudaFree@PLT
	movq	112(%rsp), %rdi
	call	cudaFree@PLT
	movq	128(%rsp), %rdi
	call	cudaFree@PLT
	movq	192(%rsp), %rdi
	call	cudaFree@PLT
	movq	184(%rsp), %rdi
	call	cudaFree@PLT
	movq	isInside(%rip), %rax
	movq	264(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L251
.L253:
	call	__stack_chk_fail@PLT
.L251:
	addq	$280, %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
.LFE3924:
	.size	RayTracingGPU, .-RayTracingGPU
	.globl	_Z58__device_stub__Z17TriangleCount_GPUP8TriangleP4CubePiS3_PbP8TriangleP4CubePiS3_Pb
	.type	_Z58__device_stub__Z17TriangleCount_GPUP8TriangleP4CubePiS3_PbP8TriangleP4CubePiS3_Pb, @function
_Z58__device_stub__Z17TriangleCount_GPUP8TriangleP4CubePiS3_PbP8TriangleP4CubePiS3_Pb:
.LFB3949:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	56(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L261
	pushq	56(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 192
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L261:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L263
	call	__stack_chk_fail@PLT
.L263:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3949:
	.size	_Z58__device_stub__Z17TriangleCount_GPUP8TriangleP4CubePiS3_PbP8TriangleP4CubePiS3_Pb, .-_Z58__device_stub__Z17TriangleCount_GPUP8TriangleP4CubePiS3_PbP8TriangleP4CubePiS3_Pb
	.globl	_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb
	.type	_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb, @function
_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb:
.LFB3950:
	.cfi_startproc
	endbr64
	jmp	_Z58__device_stub__Z17TriangleCount_GPUP8TriangleP4CubePiS3_PbP8TriangleP4CubePiS3_Pb
	.cfi_endproc
.LFE3950:
	.size	_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb, .-_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb
	.globl	_Z43__device_stub__Z9calcAllocP4CubePiS1_S1_S1_P4CubePiS1_S1_S1_
	.type	_Z43__device_stub__Z9calcAllocP4CubePiS1_S1_S1_P4CubePiS1_S1_S1_, @function
_Z43__device_stub__Z9calcAllocP4CubePiS1_S1_S1_P4CubePiS1_S1_S1_:
.LFB3951:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	56(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L266
	pushq	56(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z9calcAllocP4CubePiS1_S1_S1_(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 192
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L266:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L268
	call	__stack_chk_fail@PLT
.L268:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3951:
	.size	_Z43__device_stub__Z9calcAllocP4CubePiS1_S1_S1_P4CubePiS1_S1_S1_, .-_Z43__device_stub__Z9calcAllocP4CubePiS1_S1_S1_P4CubePiS1_S1_S1_
	.globl	_Z9calcAllocP4CubePiS1_S1_S1_
	.type	_Z9calcAllocP4CubePiS1_S1_S1_, @function
_Z9calcAllocP4CubePiS1_S1_S1_:
.LFB3952:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z9calcAllocP4CubePiS1_S1_S1_P4CubePiS1_S1_S1_
	.cfi_endproc
.LFE3952:
	.size	_Z9calcAllocP4CubePiS1_S1_S1_, .-_Z9calcAllocP4CubePiS1_S1_S1_
	.globl	_Z47__device_stub__Z10findUniqueP4CubePiS1_PbS1_S1_P4CubePiS1_PbS1_S1_
	.type	_Z47__device_stub__Z10findUniqueP4CubePiS1_PbS1_S1_P4CubePiS1_PbS1_S1_, @function
_Z47__device_stub__Z10findUniqueP4CubePiS1_PbS1_S1_P4CubePiS1_PbS1_S1_:
.LFB3953:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	56(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	64(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%r9, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	%rsp, %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L271
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z10findUniqueP4CubePiS1_PbS1_S1_(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 208
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L271:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L273
	call	__stack_chk_fail@PLT
.L273:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3953:
	.size	_Z47__device_stub__Z10findUniqueP4CubePiS1_PbS1_S1_P4CubePiS1_PbS1_S1_, .-_Z47__device_stub__Z10findUniqueP4CubePiS1_PbS1_S1_P4CubePiS1_PbS1_S1_
	.globl	_Z10findUniqueP4CubePiS1_PbS1_S1_
	.type	_Z10findUniqueP4CubePiS1_PbS1_S1_, @function
_Z10findUniqueP4CubePiS1_PbS1_S1_:
.LFB3954:
	.cfi_startproc
	endbr64
	jmp	_Z47__device_stub__Z10findUniqueP4CubePiS1_PbS1_S1_P4CubePiS1_PbS1_S1_
	.cfi_endproc
.LFE3954:
	.size	_Z10findUniqueP4CubePiS1_PbS1_S1_, .-_Z10findUniqueP4CubePiS1_PbS1_S1_
	.globl	_Z52__device_stub__Z15appendTrianglesP4CubePiS1_S1_S1_PbP4CubePiS1_S1_S1_Pb
	.type	_Z52__device_stub__Z15appendTrianglesP4CubePiS1_S1_S1_PbP4CubePiS1_S1_S1_Pb, @function
_Z52__device_stub__Z15appendTrianglesP4CubePiS1_S1_S1_PbP4CubePiS1_S1_S1_Pb:
.LFB3955:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	56(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	64(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%r9, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	%rsp, %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L276
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z15appendTrianglesP4CubePiS1_S1_S1_Pb(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 208
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L276:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L278
	call	__stack_chk_fail@PLT
.L278:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3955:
	.size	_Z52__device_stub__Z15appendTrianglesP4CubePiS1_S1_S1_PbP4CubePiS1_S1_S1_Pb, .-_Z52__device_stub__Z15appendTrianglesP4CubePiS1_S1_S1_PbP4CubePiS1_S1_S1_Pb
	.globl	_Z15appendTrianglesP4CubePiS1_S1_S1_Pb
	.type	_Z15appendTrianglesP4CubePiS1_S1_S1_Pb, @function
_Z15appendTrianglesP4CubePiS1_S1_S1_Pb:
.LFB3956:
	.cfi_startproc
	endbr64
	jmp	_Z52__device_stub__Z15appendTrianglesP4CubePiS1_S1_S1_PbP4CubePiS1_S1_S1_Pb
	.cfi_endproc
.LFE3956:
	.size	_Z15appendTrianglesP4CubePiS1_S1_S1_Pb, .-_Z15appendTrianglesP4CubePiS1_S1_S1_Pb
	.globl	_Z63__device_stub__Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_P3RayP4CubePiS3_S2_S3_
	.type	_Z63__device_stub__Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_P3RayP4CubePiS3_S2_S3_, @function
_Z63__device_stub__Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_P3RayP4CubePiS3_S2_S3_:
.LFB3957:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	56(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	64(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%r9, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	%rsp, %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L281
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 208
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L281:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L283
	call	__stack_chk_fail@PLT
.L283:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3957:
	.size	_Z63__device_stub__Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_P3RayP4CubePiS3_S2_S3_, .-_Z63__device_stub__Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_P3RayP4CubePiS3_S2_S3_
	.globl	_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
	.type	_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_, @function
_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_:
.LFB3958:
	.cfi_startproc
	endbr64
	jmp	_Z63__device_stub__Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_P3RayP4CubePiS3_S2_S3_
	.cfi_endproc
.LFE3958:
	.size	_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_, .-_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
	.globl	_Z60__device_stub__Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4CubeP3RayP8TrianglePbPiS4_P4Cube
	.type	_Z60__device_stub__Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4CubeP3RayP8TrianglePbPiS4_P4Cube, @function
_Z60__device_stub__Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4CubeP3RayP8TrianglePbPiS4_P4Cube:
.LFB3959:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	56(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	64(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%r9, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	%rsp, %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L286
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 208
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L286:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L288
	call	__stack_chk_fail@PLT
.L288:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3959:
	.size	_Z60__device_stub__Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4CubeP3RayP8TrianglePbPiS4_P4Cube, .-_Z60__device_stub__Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4CubeP3RayP8TrianglePbPiS4_P4Cube
	.globl	_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
	.type	_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube, @function
_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube:
.LFB3960:
	.cfi_startproc
	endbr64
	jmp	_Z60__device_stub__Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4CubeP3RayP8TrianglePbPiS4_P4Cube
	.cfi_endproc
.LFE3960:
	.size	_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube, .-_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
	.globl	_Z58__device_stub__Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4CubeP3RayP8TrianglePbPiS4_P4Cube
	.type	_Z58__device_stub__Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4CubeP3RayP8TrianglePbPiS4_P4Cube, @function
_Z58__device_stub__Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4CubeP3RayP8TrianglePbPiS4_P4Cube:
.LFB3961:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	56(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	64(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%r9, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	%rsp, %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L291
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 208
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L291:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L293
	call	__stack_chk_fail@PLT
.L293:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3961:
	.size	_Z58__device_stub__Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4CubeP3RayP8TrianglePbPiS4_P4Cube, .-_Z58__device_stub__Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4CubeP3RayP8TrianglePbPiS4_P4Cube
	.globl	_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
	.type	_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube, @function
_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube:
.LFB3962:
	.cfi_startproc
	endbr64
	jmp	_Z58__device_stub__Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4CubeP3RayP8TrianglePbPiS4_P4Cube
	.cfi_endproc
.LFE3962:
	.size	_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube, .-_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
	.globl	_Z49__device_stub__Z9appendALLP4CubePiS1_PbP8TriangleP4CubePiS1_PbP8Triangle
	.type	_Z49__device_stub__Z9appendALLP4CubePiS1_PbP8TriangleP4CubePiS1_PbP8Triangle, @function
_Z49__device_stub__Z9appendALLP4CubePiS1_PbP8TriangleP4CubePiS1_PbP8Triangle:
.LFB3963:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	56(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L296
	pushq	56(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z9appendALLP4CubePiS1_PbP8Triangle(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 192
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L296:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L298
	call	__stack_chk_fail@PLT
.L298:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3963:
	.size	_Z49__device_stub__Z9appendALLP4CubePiS1_PbP8TriangleP4CubePiS1_PbP8Triangle, .-_Z49__device_stub__Z9appendALLP4CubePiS1_PbP8TriangleP4CubePiS1_PbP8Triangle
	.globl	_Z9appendALLP4CubePiS1_PbP8Triangle
	.type	_Z9appendALLP4CubePiS1_PbP8Triangle, @function
_Z9appendALLP4CubePiS1_PbP8Triangle:
.LFB3964:
	.cfi_startproc
	endbr64
	jmp	_Z49__device_stub__Z9appendALLP4CubePiS1_PbP8TriangleP4CubePiS1_PbP8Triangle
	.cfi_endproc
.LFE3964:
	.size	_Z9appendALLP4CubePiS1_PbP8Triangle, .-_Z9appendALLP4CubePiS1_PbP8Triangle
	.globl	_Z52__device_stub__Z9firstCubeP4CubeP3RayP8TrianglePiS5_P4CubeP3RayP8TrianglePiS5_
	.type	_Z52__device_stub__Z9firstCubeP4CubeP3RayP8TrianglePiS5_P4CubeP3RayP8TrianglePiS5_, @function
_Z52__device_stub__Z9firstCubeP4CubeP3RayP8TrianglePiS5_P4CubeP3RayP8TrianglePiS5_:
.LFB3965:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	56(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L301
	pushq	56(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z9firstCubeP4CubeP3RayP8TrianglePiS5_(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 192
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L301:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L303
	call	__stack_chk_fail@PLT
.L303:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3965:
	.size	_Z52__device_stub__Z9firstCubeP4CubeP3RayP8TrianglePiS5_P4CubeP3RayP8TrianglePiS5_, .-_Z52__device_stub__Z9firstCubeP4CubeP3RayP8TrianglePiS5_P4CubeP3RayP8TrianglePiS5_
	.globl	_Z9firstCubeP4CubeP3RayP8TrianglePiS5_
	.type	_Z9firstCubeP4CubeP3RayP8TrianglePiS5_, @function
_Z9firstCubeP4CubeP3RayP8TrianglePiS5_:
.LFB3966:
	.cfi_startproc
	endbr64
	jmp	_Z52__device_stub__Z9firstCubeP4CubeP3RayP8TrianglePiS5_P4CubeP3RayP8TrianglePiS5_
	.cfi_endproc
.LFE3966:
	.size	_Z9firstCubeP4CubeP3RayP8TrianglePiS5_, .-_Z9firstCubeP4CubeP3RayP8TrianglePiS5_
	.section	.rodata.str1.1
.LC25:
	.string	"_Z9firstCubeP4CubeP3RayP8TrianglePiS5_"
.LC26:
	.string	"_Z9appendALLP4CubePiS1_PbP8Triangle"
.LC27:
	.string	"_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube"
.LC28:
	.string	"_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube"
.LC29:
	.string	"_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_"
.LC30:
	.string	"_Z15appendTrianglesP4CubePiS1_S1_S1_Pb"
.LC31:
	.string	"_Z10findUniqueP4CubePiS1_PbS1_S1_"
.LC32:
	.string	"_Z9calcAllocP4CubePiS1_S1_S1_"
.LC33:
	.string	"_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3968:
	.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	.LC25(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z9firstCubeP4CubeP3RayP8TrianglePiS5_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC26(%rip), %rdx
	movq	%rbx, %rdi
	leaq	_Z9appendALLP4CubePiS1_PbP8Triangle(%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
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC27(%rip), %rdx
	movq	%rbx, %rdi
	leaq	_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube(%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
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC28(%rip), %rdx
	movq	%rbx, %rdi
	leaq	_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube(%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
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC29(%rip), %rdx
	movq	%rbx, %rdi
	leaq	_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_(%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
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC30(%rip), %rdx
	movq	%rbx, %rdi
	leaq	_Z15appendTrianglesP4CubePiS1_S1_S1_Pb(%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
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC31(%rip), %rdx
	movq	%rbx, %rdi
	leaq	_Z10findUniqueP4CubePiS1_PbS1_S1_(%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
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC32(%rip), %rdx
	movq	%rbx, %rdi
	leaq	_Z9calcAllocP4CubePiS1_S1_S1_(%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
	leaq	.LC33(%rip), %rdx
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3968:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text.startup
	.type	_GLOBAL__sub_I_rays, @function
_GLOBAL__sub_I_rays:
.LFB4588:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	movl	%eax, 100+boundingBox(%rip)
	movl	%eax, 112+boundingBox(%rip)
	ret
	.cfi_endproc
.LFE4588:
	.size	_GLOBAL__sub_I_rays, .-_GLOBAL__sub_I_rays
	.section	.init_array
	.align 8
	.quad	_GLOBAL__sub_I_rays
	.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	numTriangles
	.bss
	.align 4
	.type	numTriangles, @object
	.size	numTriangles, 4
numTriangles:
	.zero	4
	.globl	triangles
	.align 8
	.type	triangles, @object
	.size	triangles, 8
triangles:
	.zero	8
	.globl	isInPlane
	.align 8
	.type	isInPlane, @object
	.size	isInPlane, 8
isInPlane:
	.zero	8
	.globl	isInside
	.align 8
	.type	isInside, @object
	.size	isInside, 8
isInside:
	.zero	8
	.globl	boundingBox
	.align 32
	.type	boundingBox, @object
	.size	boundingBox, 120
boundingBox:
	.zero	120
	.globl	numRays
	.align 4
	.type	numRays, @object
	.size	numRays, 4
numRays:
	.zero	4
	.globl	rays
	.align 8
	.type	rays, @object
	.size	rays, 8
rays:
	.zero	8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1071644672
	.align 8
.LC6:
	.long	-350469331
	.long	1059731170
	.align 8
.LC7:
	.long	0
	.long	1072693248
	.align 8
.LC9:
	.long	-640172613
	.long	-1109689121
	.align 8
.LC10:
	.long	-640172613
	.long	1037794527
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC11:
	.long	0
	.long	-2147483648
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC13:
	.long	0
	.long	1082081280
	.align 8
.LC19:
	.long	0
	.long	1093567616
	.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 <algorithm>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hip/hip_runtime.h"
// #include "ray_tracing_GPU.h"

#define X 0
#define Y 1
#define Z 2

#define MY_CUDA_CHECK(call) {                                    \
    hipError_t err = call;                                                    \
    if( hipSuccess != err) {                                                \
        fprintf(stderr, "Cuda error in file '%s' in line %i : %s.\n",        \
                __FILE__, __LINE__, hipGetErrorString( err) );              \
        exit(EXIT_FAILURE);                                                  \
    } }

 #define MY_CHECK_ERROR(errorMessage) {                                    \
    hipError_t err = hipGetLastError();                                    \
    if( hipSuccess != err) {                                                \
        fprintf(stderr, "Cuda error: %s in file '%s' in line %i : %s.\n",    \
                errorMessage, __FILE__, __LINE__, hipGetErrorString( err) );\
        exit(EXIT_FAILURE);                                                  \
    }                                                                        \
    }


#define CPROD(dest,v1,v2) \
dest[0]=v1[1]*v2[2]-v1[2]*v2[1]; \
dest[1]=v1[2]*v2[0]-v1[0]*v2[2]; \
dest[2]=v1[0]*v2[1]-v1[1]*v2[0]; 
    
    

    
    
#define DPROD(v1,v2) (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2])

// #define DPROD1(v1,v2) \
// return (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2]);

    
    
#define SUB(dest,v1,v2) \
    dest[0]=v1[0]-v2[0]; \
    dest[1]=v1[1]-v2[1]; \
    dest[2]=v1[2]-v2[2]; 
    
    
    
#define FINDMINMAX(x0,x1,x2,min,max) \
min = max = x0;   \
if(x1<min) min=x1;\
if(x1>max) max=x1;\
if(x2<min) min=x2;\
if(x2>max) max=x2;
    
    /******** X_AXIS test *********/
#define AXISTEST_X01(a, b, fa, fb)			   \
p0 = a*v0[Y] - b*v0[Z];			       	   \
p2 = a*v2[Y] - b*v2[Z];			       	   \
if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z];   \
if(min>rad || max<-rad) return 0;
    
    
#define AXISTEST_X2(a, b, fa, fb)			   \
p0 = a*v0[Y] - b*v0[Z];			           \
p1 = a*v1[Y] - b*v1[Z];			       	   \
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z];   \
if(min>rad || max<-rad) return 0;
    
    
/*********** Y_AXIS test ************/
#define AXISTEST_Y02(a, b, fa, fb)			   \
p0 = -a*v0[X] + b*v0[Z];		      	   \
p2 = -a*v2[X] + b*v2[Z];	       	       	   \
if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z];   \
if(min>rad || max<-rad) return 0;
    
    
#define AXISTEST_Y1(a, b, fa, fb)			   \
p0 = -a*v0[X] + b*v0[Z];		      	   \
p1 = -a*v1[X] + b*v1[Z];	     	       	   \
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z];   \
if(min>rad || max<-rad) return 0;
    
    
/***************** Z_AXIS test ************************/
    
    
#define AXISTEST_Z12(a, b, fa, fb)			   \
p1 = a*v1[X] - b*v1[Y];			           \
p2 = a*v2[X] - b*v2[Y];			       	   \
if(p2<p1) {min=p2; max=p1;} else {min=p1; max=p2;} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y];   \
if(min>rad || max<-rad) return 0;
    
    
    
#define AXISTEST_Z0(a, b, fa, fb)			   \
p0 = a*v0[X] - b*v0[Y];				   \
p1 = a*v1[X] - b*v1[Y];			           \
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y];   \
if(min>rad || max<-rad) return 0;
    
__device__ __host__ struct Point3D {
    double x;
    double y;
    double z;
};

__device__ __host__ struct Triangle {
    double v0[3];
    double v1[3];
    double v2[3];
};

__device__ __host__ struct Index
{
    int size;
    int count;
    int *ptr;

    __device__ __host__ Index()  
    { 
        ptr = (int *)malloc(sizeof(int) *100);
        size = 100;
        count = 0; 
    }

    __device__ __host__ void Insert(int value){
        if(count == size){
            // printf("Enters %p",ptr); 
            int *newptr = (int *)malloc(sizeof(int)*(size + 1));
            for (int index = 0; index<size; index++){
                newptr[index] = ptr[index];
            }
           // delete [] ptr;
            free(ptr);
            ptr = newptr;
            size+=1;
        }
        ptr[count] = value;
        count+=1;
    } 

};

__device__ __host__ struct Cube { 

    double xmin, xmax;
    double ymin, ymax;
    double zmin, zmax;
    double boxhalfsize[3];
    double center[3];
    int reference;
    int counter=0;
    int *triangleIndexes;
    // int triangleIndexes[12];
    int index =0;

};

__device__ __host__ struct Ray {
    //Rreze
    double orig[3];
    double dir[3];
    int intersectedCubes[4]={-1};
    int index;
    int intersects=0;
};
    
    

using namespace std;

/******************Declaring global variables ***************/
Ray *rays;
int numRays;
Cube boundingBox;
bool *isInside;
bool *isInPlane;
Triangle *triangles;
int numTriangles;

/****************** Declaring functions*********************/
__device__ __host__ double dot_product(double *v1, double *v2);
void  GETCENTER(Cube cube, double *center);
void GETHALFSIZE(Cube cube, double *boxhalfsize);
double into_double(char *str);
void getTriangles(Triangle *triangles);
void generateRandoms(double *direction, double *origin); 
void getRays(Ray *rays);
int getNumberOfCubes(Point3D lower, Point3D upper, double delta);
void createGrid3D(Cube *cubes, Point3D lower, Point3D upper, double delta, Index &frontGrid);
__device__ __host__  bool rayTriangleIntersect(Ray ray, Triangle tri);
__device__ __host__ int planeBoxOverlap(double *normal, double *vert, double *maxbox);
__device__ __host__ int triBoxOverlap(double *boxcenter, double *boxhalfsize, Triangle triverts);
__host__ __device__ double TriArea(double *P1, double *P2, double *P3);
__device__ __host__ bool IsInPlaneTest(Ray ray, Triangle tri, double epsilon);
__device__ __host__ bool  PointIsInSurface(Ray ray, Triangle tri, double epsilon);
__device__ __host__ int rayBoxIntersection_yaxis(double *rayorigin, Cube cube);
__global__ void TriangleCount_GPU(Triangle *triangles, Cube *cubes, int *numCubes, int *numTriangles, bool *CubeTriMapp);
__global__ void calcAlloc(Cube *cubes, int *frontGrid, int *cubesPerBlock, int *indexes, int *counter);
__global__ void calcAlloc(Cube *cubes, int *frontGrid, int *cubesPerBlock, int *indexes, int *counter);
__global__ void findUnique(Cube *cubes, int *end, int *cubesPerBlock, bool *CubeTriMapp, int *numTriangles, int *numCubes);
__global__ void appendTriangles(Cube *cubes, int *indexes, int *frontGrid, int *numTriangles, int *numCubes, bool *CubeTriMapp );
__global__ void getIntersectedCubes_GPU( Ray *rays, Cube *cubes, int *numrays, int *indexes,  Cube *boundingBox, int *frontGrid);
void IsInPlane(Ray *rays, Triangle *tri, bool *isInside, int nr_rays, int nr_triangles, double epsilon);
__global__ void IsInPlaneGPU(Ray *rays, Triangle *tri, bool *isInside, int *n_r, int *n_tr, Cube *cubes);
__global__  void ray_tracingGPU(Ray *ray, Triangle *tri, bool *results, int *n_r, int *n_tr, Cube *cubes);
extern "C" void SetRays(float *xyz_flat, int nr_rays);
extern "C" void SetTriangles(double *tri_coordinates, int nr_triangles);
extern "C" void  SetBoundingBox(double *x, double *y, double *z);
extern "C" bool *RayTracingGPU(int *numRays_, int *numTriangles);


/**************Defining the functions *****************/
__device__ __host__ double dot_product(double *v1, double *v2){

    double dot_prod=0;
    for (int i = 0; i< 3; i++){
        dot_prod += v1[i]*v2[i];
    }
    return dot_prod;
}


void  GETCENTER(Cube cube, double *center)
{
center[0] = (cube.xmax + cube.xmin)/2;
center[1] = (cube.ymax + cube.ymin)/2;
center[2] = (cube.zmax + cube.zmin)/2;

}


void GETHALFSIZE(Cube cube, double *boxhalfsize)
{
boxhalfsize[0] = (cube.xmax - cube.xmin)/2;
boxhalfsize[1] = (cube.ymax - cube.ymin)/2;
boxhalfsize[2] = (cube.zmax - cube.zmin)/2;

}



double into_double(char *str){
    char *ptr;
    double value;
    value = strtod(str, &ptr);
    return value;
}


void getTriangles(Triangle *triangles){

    char * line = NULL;
    size_t len = 0;
    ssize_t read;
    FILE *fp = fopen("/home/diko/MOBIUS/MOEBIUS/BACKEND/SCRIPTS/TEMP/triangles.txt","r");
    if(fp == NULL){
        perror(" unable to open file ");
        exit(1);
    }

    int index = 0;
    int nr_vec =0;
    
    while ((read = getline(&line, &len, fp)) != -1) {
        int j =0;
        char* token = strtok(line," ");
        while(token != NULL){
            token = strtok(NULL," ");
            if(nr_vec == 0){
                if(token != NULL){
                double token_ = into_double(token);
                    double r = 0;

                    if(token_ < 0){
                        token_ = token_ - r;
                    }
                    else token_ = token_ +r;
                triangles[index].v0[j] = token_;
               
                j = j+1;
                }
            }
            else if(nr_vec == 1){
                if(token != NULL){
                double token_ = into_double(token);
                    double r = 0;

                    if(token_ < 0){
                        token_ = token_ - r;
                    }
                    else token_ = token_ +r;
                triangles[index].v1[j] = token_;
               
                j = j+1;
                }
            }
            else{
                if(token != NULL){
                double token_ = into_double(token);
                    double r = 0;
                    if(token_ < 0){
                        token_ = token_ - r;
                    }
                    else token_ = token_ +r;
                triangles[index].v2[j] = token_;
                j = j+1;
                }
            }

        }
        if(nr_vec == 2){
            index+=1;
            nr_vec=0;
        }
        else nr_vec+=1;
        }
   

    fclose(fp);
    if (line)
        free(line);
}


 void generateRandoms(double *direction, double *origin) 
{ 
    
	direction[0] = 0.0002;
	direction[1] = 1.0;
	direction[2] = 0.0002;

} 

 void getRays(Ray *rays){
    char * line = NULL;
    size_t len = 0;
    ssize_t read;
    FILE *fp = fopen("/home/diko/MOBIUS/MOEBIUS/BACKEND/SCRIPTS/TEMP/points.txt","r");
    if(fp == NULL){
        perror(" unable to open file ");
        exit(1);
    }
    int index = 0;
    while ((read = getline(&line, &len, fp)) != -1) {
        int j =0;
        char* token = strtok(line," ");            
        
        while(token != NULL && j < 3){
            rays[index].orig[j] =into_double(token);
            //printf("\n token %d %d is : %.5lf",index,j,rays[index].orig[j]);
            token = strtok(NULL," ");
            j = j+1;
        }
        generateRandoms(rays[index].dir, rays[index].orig);
        index+=1;
    }    
    fclose(fp);
    if (line)
        free(line);
    
}


int getNumberOfCubes(Point3D lower, Point3D upper, double delta){


    int xn = ceil((upper.x - lower.x)/delta);
    int yn = ceil((upper.y - lower.y)/delta);
    int zn = ceil((upper.z - lower.z)/delta);

    int num_BB = xn * yn * zn;

    return num_BB;
}


void createGrid3D(Cube *cubes, Point3D lower, Point3D upper, double delta, Index &frontGrid){

    /***********************************************
    Input: Empty allocated memory for cubes, lower point and upper point
    Outpu: It is a void function, will modify the array of cubes
    ***********************************************/
    // double Y_MAX = upper.y;

    const int xn = ceil((upper.x - lower.x)/delta);
    const int yn = ceil((upper.y - lower.y)/delta);
    const int zn = ceil((upper.z - lower.z)/delta);


    double x = 0;
    double y = 0;
    double z = 0;
    int block = 0;
    int index = 0;
    for(int i = 0; i<xn; i++){
        x = lower.x;
        x = x+delta*i;

        for(int j = 0; j<zn; j++){
            z = lower.z;
            z = z+delta*j;

            for(int k =0; k<yn; k++){
                y = lower.y;
                y = y + delta*k;

                cubes[index].xmax = x+delta;
                cubes[index].ymax = y+delta;
                cubes[index].zmax = z+delta;
                cubes[index].xmin = x;
                cubes[index].ymin = y;
                cubes[index].zmin = z;

                GETCENTER(cubes[index], cubes[index].center);
                GETHALFSIZE(cubes[index], cubes[index].boxhalfsize);

                if(k== yn-1) 
                {
                    frontGrid.Insert(index);
                }
                cubes[index].reference = (block+1)*yn -1;
                index +=1;
                
                
            }
            block+=1;
    
        }
    }

}



__device__ __host__  bool rayTriangleIntersect(Ray ray, Triangle tri){
   
    double ZERO = 0.0;
    double ONE = 1.0;

    const double epsilon = 1.e-10;
    double edge1[3] ={}; double edge2[3] ={} ; double pvec[3]={};double tvec[3] = {}; double qvec[3] = {};
    
    //Calculate edges
    SUB(edge1,tri.v1, tri.v0); 
    SUB(edge2,tri.v2, tri.v0);
    CPROD(pvec,ray.dir, edge2); 
    
    
    //Calculate the determinant 
    double det = dot_product(edge1, pvec); 
    
    if( det>-epsilon && det < epsilon) return false; //It is parallel with the triangle

    //Calculate the inverse determinant
    double invDet = ONE / det; // f
    //calculate the 'u' of baycentric 
    SUB(tvec,ray.orig, tri.v0); //s
    double prod = dot_product(tvec, pvec); // s dot prod h
    double u = prod *  invDet; //f * s dot prod h

    //Check if u is inside the allowed bounds
    if(u < ZERO || u > ONE) return false;

    //calculate the 'v' of baycentric coordinates and check if it is inside the desired interval to continue 
    CPROD(qvec,tvec, edge1);
    double prod1 = dot_product(ray.dir, qvec);
    double v = prod1 * invDet;

    if(v < ZERO || u + v > ONE ) return false;

    double t_prod = dot_product(edge2, qvec); 
    double t =t_prod * invDet;

    return (t>epsilon);

}



__device__ __host__ int planeBoxOverlap(double *normal, double *vert, double *maxbox)	
{

    int q;
    double vmin[3],vmax[3],v;
    for(q=X;q<=Z;q++)
    {
        v=vert[q];
        
        int isBigger = (int) (normal[q]>0.0f);
        
        vmin[q]=isBigger*(-maxbox[q] - v) + !isBigger*(maxbox[q] - v);	
        vmax[q]= isBigger*(maxbox[q] - v) + !isBigger *(-maxbox[q] - v) ;	
       
    }

    return !(DPROD(normal,vmin)>0.0f) * (DPROD(normal,vmax)>=0.0f);

}


__device__ __host__ int triBoxOverlap(double *boxcenter, double *boxhalfsize, Triangle triverts)
{

double v0[3]={0};
double v1[3]={0};
double v2[3]={0};

double min=1000000,max=-10000000,p0=0,p1=0,p2=0,rad=0,fex=0,fey=0,fez=0;	

double normal[3]={0};
double e0[3]={0};
double e1[3]={0};
double e2[3]={0};

SUB(v0,triverts.v0,boxcenter);
SUB(v1,triverts.v1,boxcenter);
SUB(v2,triverts.v2,boxcenter);

SUB(e0,v1,v0);     
SUB(e1,v2,v1);      
SUB(e2,v0,v2);     

CPROD(normal,e0,e1);
return planeBoxOverlap(normal, v0, boxhalfsize);

}

__host__ __device__ double TriArea(double *P1, double *P2, double *P3)
{
    double P1P2[3];
    double P1P3[3];
    double CP[3];

    SUB(P1P2, P2, P1);
    SUB(P1P3, P3, P1);
    CPROD(CP,P1P2, P1P3)

    double triArea = sqrt(CP[0]*CP[0] + CP[1]*CP[1] +CP[2]*CP[2])/2;
    return triArea;

}

__device__ __host__ bool IsInPlaneTest(Ray ray, Triangle tri, double epsilon)
{
    //Find the plane equation starting with coordinates a, b, c and then distance d

    double a1, b1, c1;
    double a2, b2, c2;
    double a, b, c; //rate of normal vector of the plane
    double d; //distance

    a1 = tri.v1[0] -tri.v0[0];
    b1 = tri.v1[1] -tri.v0[1];
    c1 = tri.v1[2] -tri.v0[2];

    a2 = tri.v2[0] -tri.v0[0];
    b2 = tri.v2[1] -tri.v0[1];
    c2 = tri.v2[2] -tri.v0[2];

    a = b1 * c2 - b2 * c1;
    b = a2 * c1 - a1 * c2;
    c = a1 * b2 - b1 * a2; 

    d = (- a * tri.v0[0] - b * tri.v0[1] - c * tri.v0[2]);

    //Check if point is in plane
    return (a*ray.orig[0]+b*ray.orig[1]+c*ray.orig[2]+d<=0+epsilon && a*ray.orig[0]+b*ray.orig[1]+c*ray.orig[2]+d>=0-epsilon );
    // return (a*ray.orig[0]+b*ray.orig[1]+c*ray.orig[2]+d==0 );

}

__device__ __host__ bool  PointIsInSurface(Ray ray, Triangle tri, double epsilon)
{
    // const double epsilon = 1.e-7;
    double tri0, tri1, tri2, tri3;
    tri0 = TriArea(tri.v0, tri.v1, tri.v2);
    tri1 = TriArea(ray.orig, tri.v0, tri.v1);
    tri2 = TriArea(ray.orig, tri.v0, tri.v2);
    tri3 = TriArea(ray.orig, tri.v1, tri.v2);

    double sum = tri1 + tri2 +tri3;
    double res = sqrt(sum)/sqrt(tri0)-1;
    return(res <= epsilon && res >= -epsilon);
    // return sum == tri0;
  

}


__device__ __host__ int rayBoxIntersection_yaxis(double *rayorigin, Cube cube)
{

    // const double epsilon = 1.e-5;
    double xmin = cube.xmin;
    double xmax = cube.xmax;
    double zmin = cube.zmin;
    double zmax = cube.zmax;
    double ymax = cube.ymax;
    double ymin = cube.ymin;
    return !(rayorigin[0]<xmin || rayorigin[0] >xmax || rayorigin[2]<zmin || rayorigin[2]>zmax || rayorigin[1]>ymax);
    // return !(rayorigin[0]<xmin || rayorigin[0] >xmax || rayorigin[2]<zmin || rayorigin[2]>zmax || rayorigin[1]>ymax || rayorigin[1]<ymin);

    // return !(rayorigin[0]<xmin-epsilon || rayorigin[0] >xmax+epsilon || rayorigin[2]<zmin-epsilon || rayorigin[2]>zmax+epsilon);

}



__global__ void TriangleCount_GPU(Triangle *triangles, Cube *cubes, int *numCubes, int *numTriangles, bool *CubeTriMapp)
    {
        int idx = threadIdx.x + blockIdx.x*blockDim.x;
        const unsigned int num_threads = gridDim.x * blockDim.x;

        for (int i=idx; i<(*numCubes)*(*numTriangles) ; i+=num_threads)
        {               
            int triIndex = (int)i/(*numCubes);
            int cubeIndex = i%(*numCubes);
            int intersects = (int) (triBoxOverlap(cubes[cubeIndex].center, cubes[cubeIndex].boxhalfsize, triangles[triIndex])==1);
            CubeTriMapp[i]=(intersects>0);
            atomicAdd(&cubes[cubeIndex].counter, intersects);
        }

    }


__global__ void calcAlloc(Cube *cubes, int *frontGrid, int *cubesPerBlock, int *indexes, int *counter)
{
    int idx = threadIdx.x + blockIdx.x*blockDim.x;
    const unsigned int num_threads = gridDim.x * blockDim.x;
    for(int i=idx; i<*frontGrid; i+=num_threads)
    {
        int end = indexes[i];
        int start = end - (*cubesPerBlock-1);

        for(int j=start; j<end; j++)
        {
            cubes[end].counter+=cubes[j].counter;
        }


    }
    
}

__global__ void findUnique(Cube *cubes, int *end, int *cubesPerBlock, bool *CubeTriMapp, int *numTriangles, int *numCubes)
{
    int idx = threadIdx.x + blockIdx.x*blockDim.x;
    const unsigned int num_threads = gridDim.x * blockDim.x;
    int start = *end -(*cubesPerBlock-1);
    
    for(int triIndex=idx; triIndex<*numTriangles; triIndex+=num_threads)
    {
        for(int cubeIndex=start; cubeIndex<*end; cubeIndex++)
        {
            CubeTriMapp[triIndex*(*numCubes)+(*end)]|=CubeTriMapp[triIndex*(*numCubes)+cubeIndex];
        }
        atomicAdd(&cubes[*end].index,(int)(CubeTriMapp[triIndex*(*numCubes)+(*end)]==true));
    }

}



__global__ void appendTriangles(Cube *cubes, int *indexes, int *frontGrid, int *numTriangles, int *numCubes, bool *CubeTriMapp )
    {
        int idx = threadIdx.x + blockIdx.x*blockDim.x;
        const unsigned int num_threads = gridDim.x * blockDim.x;

        for(int i=idx; i<*frontGrid; i+=num_threads)
        {
            int cubeIndex=indexes[i];
            // int counter = 0;
            cubes[cubeIndex].index=0;
            for(int triIndex=0; triIndex<*numTriangles; triIndex+=1)
            {   

                int index = triIndex*(*numCubes) + cubeIndex;
                cubes[cubeIndex].triangleIndexes[cubes[cubeIndex].index] = triIndex;
                cubes[cubeIndex].index+=1*(int)(CubeTriMapp[index]==true);
                
            }
        }

        
    }


__global__ void getIntersectedCubes_GPU( Ray *rays, Cube *cubes, int *numrays, int *indexes,  Cube *boundingBox, int *frontGrid)
    {   
        int idx = threadIdx.x + blockIdx.x * blockDim.x;
        const unsigned int num_threads = gridDim.x*blockDim.x;


        for(int index = idx; index<*numrays; index+=num_threads)
        {
            rays[index].index = 0;            
            for(int frontGridIndex=0; frontGridIndex<*frontGrid; frontGridIndex++)
            {
                    int intersects = (int)rayBoxIntersection_yaxis(rays[index].orig, cubes[indexes[frontGridIndex]]);
                    rays[index].intersectedCubes[rays[index].index] = indexes[frontGridIndex];
                    rays[index].index+=1*intersects;
            }


 
        }

    }



    
 __global__  void ray_tracingGPU(Ray *ray, Triangle *tri, bool *results, int *n_r, int *n_tr, Cube *cubes){

        int idx = threadIdx.x + blockIdx.x * blockDim.x;
        const unsigned int num_threads = gridDim.x*blockDim.x;
        
        for(int rayIndex = idx; rayIndex <*n_r; rayIndex+=num_threads)
        {       
            int count = 0;
            if(ray[rayIndex].index > 0)
            {
                for (int j = 0; j<cubes[ray[rayIndex].intersectedCubes[0]].index; j=j+1){
                        count += (int)rayTriangleIntersect(ray[rayIndex],tri[cubes[ray[rayIndex].intersectedCubes[0]].triangleIndexes[j]]);
                }
 
                results[rayIndex] = (count % 2 !=0);       
               
            }
        
    }

    }

    __global__ void IsInPlaneGPU(Ray *rays, Triangle *tri, bool *isInside, int *n_r, int *n_tr, Cube *cubes)
    {
        int idx = threadIdx.x + blockIdx.x * blockDim.x;
        const unsigned int num_threads = gridDim.x*blockDim.x;
        const double epsilon = 1.e-10;
        for(int rayIndex=idx; rayIndex<*n_r; rayIndex+=num_threads)
        {
            if(rays[rayIndex].index > 0)
            {
                int counter = 0;
                    for(int j=0; j<cubes[rays[rayIndex].intersectedCubes[0]].index;)
                    {
    
                            counter+=(int)(PointIsInSurface(rays[rayIndex], tri[cubes[rays[rayIndex].intersectedCubes[0]].triangleIndexes[j]], epsilon)==true);
                            j+=1+counter*cubes[rays[rayIndex].intersectedCubes[0]].index;
    
                    }
                    isInside[rayIndex]=(counter>0);
            }
        }
    }
    
    

__global__ void appendALL(Cube *cubes,int *numCubes,int *numTriangles, bool *CubeTriMapp, Triangle *triangles)
    {
        int idx = threadIdx.x + blockIdx.x*blockDim.x;
        const unsigned int num_threads = gridDim.x * blockDim.x;
    
        for(int cubeIndex=idx; cubeIndex<*numCubes; cubeIndex+=num_threads)
        {
            // cubes[cubeIndex].index = 0;
            for(int triIndex=0; triIndex<*numTriangles; triIndex+=1)
            {   
                int index = triIndex*(*numCubes) + cubeIndex;
                // if(cubeIndex == 0) printf("Index: %d", index);
                cubes[cubeIndex].triangleIndexes[cubes[cubeIndex].index] = triIndex;
                int intersects = CubeTriMapp[index];
                cubes[cubeIndex].index+=1*intersects;
                // atomicAdd(&cubes[cubeIndex].index, intersects);
                
            }
        }
        
    }
    
    
__global__ void firstCube(Cube *cubes, Ray *rays, Triangle *triangles,int *numRays, int *numCubes)
    {
        int idx = threadIdx.x + blockIdx.x*blockDim.x;
        const unsigned int num_threads = gridDim.x * blockDim.x;
        for(int rayIndex=idx; rayIndex<*numRays; rayIndex+=num_threads)
        {
            rays[rayIndex].index=0;
    
            for(int cubeIndex=0; cubeIndex<*numCubes;)
            {
                if(rayBoxIntersection_yaxis(rays[rayIndex].orig, cubes[cubeIndex]))
                {
                    rays[rayIndex].intersectedCubes[rays[rayIndex].index] = cubeIndex;
                    rays[rayIndex].index +=1;
                    cubeIndex+=*numCubes;
                }
                cubeIndex+=1;
            }
            // printf("RayIndex: %d \n",rays[rayIndex].index);
        }  
    }
    


/************************ END of GPU FUNCTIONS ************************************/


extern "C" void SetRays(float *xyz_flat, int nr_rays)
    {
        numRays = nr_rays;
        rays = (Ray *)malloc(sizeof(Ray)*numRays);

        for(int i=0; i<nr_rays; i+=1)
        {
            rays[i].orig[0] = xyz_flat[0+i*3];
            rays[i].orig[1] = xyz_flat[1+i*3];
            rays[i].orig[2] = xyz_flat[2+i*3];
            generateRandoms(rays[i].dir, rays[i].orig);
           
        }
    }

    

extern "C" void SetTriangles(double *tri_coordinates, int nr_triangles)
    {
        numTriangles = nr_triangles;
        triangles = (Triangle *)malloc(sizeof(Triangle)*nr_triangles);

        for(int i=0; i<nr_triangles; i+=1)
        {
            // int tri_index = int(i/9);
            triangles[i].v0[0] = tri_coordinates[i*9];
            triangles[i].v0[1] = tri_coordinates[i*9+1];
            triangles[i].v0[2] = tri_coordinates[i*9+2];
            triangles[i].v1[0] = tri_coordinates[i*9+3];
            triangles[i].v1[1] = tri_coordinates[i*9+4];
            triangles[i].v1[2] = tri_coordinates[i*9+5];
            triangles[i].v2[0] = tri_coordinates[i*9+6];
            triangles[i].v2[1] = tri_coordinates[i*9+7];
            triangles[i].v2[2] = tri_coordinates[i*9+8];

        }
    }

// extern "C" void printTriangles()
void printTriangles()
{
    for(int i=0; i<numTriangles; i++)
    {
        printf("Triangle:%d %lf %lf %lf \n",i, triangles[i].v0[0],triangles[i].v0[1],triangles[i].v0[2]);
        printf("Triangle:%d %lf %lf %lf \n",i, triangles[i].v1[0],triangles[i].v1[1],triangles[i].v1[2]);
        printf("Triangle:%d %lf %lf %lf \n",i, triangles[i].v2[0],triangles[i].v2[1],triangles[i].v2[2]);

    }
}



extern "C" void  SetBoundingBox(double *x, double *y, double *z)
// extern "C" void  SetBoundingBox(int *mesh_bounds)
{
    boundingBox.xmin = x[0];
    boundingBox.xmax = x[1];
    boundingBox.ymin = y[0];
    boundingBox.ymax = y[1];
    boundingBox.zmin = z[0];
    boundingBox.zmax = z[1];
    // printf("XMIN: %lf  XMAX: %lf",boundingBox.xmin,boundingBox.xmax);
    // printf("yMIN: %lf  yMAX: %lf",boundingBox.ymin,boundingBox.ymax);
    // printf("zMIN: %lf  zMAX: %lf",boundingBox.zmin,boundingBox.zmax);


}


/*************** CPU VERSION OF IS IN SURFACE *****************/


void TriangleCount(Triangle *triangles, Cube *cubes, int numCubes, int numTriangles, bool *CubeTriMapp)
    {
        for(int i=0; i<numCubes; i++)
        {
            cubes[i].counter=0;
            for(int j=0; j<numTriangles; j++)
            {
                int index = j*numCubes + i;
                int intersects = triBoxOverlap(cubes[i].center, cubes[i].boxhalfsize, triangles[j]);
                CubeTriMapp[index] =(intersects>0);
                cubes[i].counter+=intersects;
                
            }
        }

    }


 void appendALL_CPU(Cube *cubes,int numCubes,int numTriangles, bool *CubeTriMapp, Triangle *triangles)
    {
        for(int cubeIndex=0; cubeIndex<numCubes; cubeIndex+=1)
        {
            cubes[cubeIndex].index = 0;
            for(int triIndex=0; triIndex<numTriangles; triIndex+=1)
            {   
                int index = triIndex*numCubes + cubeIndex;
                cubes[cubeIndex].triangleIndexes[cubes[cubeIndex].index] = triIndex;
                int intersects = CubeTriMapp[index];
                cubes[cubeIndex].index+=1*intersects;
                
            }
        }
        
    }


void firstCube_CPU(Cube *cubes, Ray *rays, Triangle *triangles,int numRays, int numCubes)
    {

        for(int rayIndex=0; rayIndex<numRays; rayIndex+=1)
        {
            rays[rayIndex].index=0;
    
            for(int cubeIndex=0; cubeIndex<numCubes;)
            {
                if(rayBoxIntersection_yaxis(rays[rayIndex].orig, cubes[cubeIndex]))
                {
                    rays[rayIndex].intersectedCubes[rays[rayIndex].index] = cubeIndex;
                    rays[rayIndex].index +=1;
                    cubeIndex+=numCubes;
                }
                cubeIndex+=1;
            }
        }  
    }


void IsInPlane(Ray *rays, Triangle *tri, bool *isInside, int nr_rays,  Cube *cubes)
{

    const double epsilon = 1.e-10;
    for(int rayIndex=0; rayIndex<nr_rays; rayIndex+=1)
    {
        if(rays[rayIndex].index > 0)
        {
            int counter = 0;
            for(int j=0; j<cubes[rays[rayIndex].intersectedCubes[0]].index;)
            {   
                counter+=(int)(PointIsInSurface(rays[rayIndex], tri[cubes[rays[rayIndex].intersectedCubes[0]].triangleIndexes[j]], epsilon)==true);
                j+=1+counter*cubes[rays[rayIndex].intersectedCubes[0]].index;
    
            }
            isInside[rayIndex]=(counter>0);
        }
    }

}

void findUnique_CPU(Cube *cubes, int end, int cubesPerBlock, bool *CubeTriMapp, int numTriangles, int numCubes)
{
    int start = end -(cubesPerBlock-1);   
    for(int triIndex=0; triIndex<numTriangles; triIndex+=1)
    {
        for(int cubeIndex=start; cubeIndex<end; cubeIndex++)
        {
            CubeTriMapp[triIndex*(numCubes)+(end)]|=CubeTriMapp[triIndex*(numCubes)+cubeIndex];
        }
        cubes[end].index+=(int)CubeTriMapp[triIndex*(numCubes)+(end)];
    }

}

void appendTriangles_CPU(Cube *cubes, int *indexes, int frontGrid, int numTriangles, int numCubes, bool *CubeTriMapp )
    {
        for(int i=0; i<frontGrid; i+=1)
        {
            int cubeIndex=indexes[i];
            cubes[cubeIndex].index=0;
            for(int triIndex=0; triIndex<numTriangles; triIndex+=1)
            {   

                int index = triIndex*numCubes + cubeIndex;
                cubes[cubeIndex].triangleIndexes[cubes[cubeIndex].index] = triIndex;
                cubes[cubeIndex].index+=1*(int)CubeTriMapp[index];
                
            }
        }

        
    }
// void IsInPlane(Ray *rays, Triangle *tri, bool *isInside, int nr_rays, int nr_triangles, double epsilon)
// {
//     for(int rayIndex=0; rayIndex<nr_rays; rayIndex+=1)
//     {
//         if(rays[rayIndex].index > 0)
//         {
//             int counter = 0;
//             for(int j=0; j<nr_triangles; j=j+1)
//             {

//                     counter+=(PointIsInSurface(rays[rayIndex], tri[j], epsilon)==true);
//                     // counter+=(IsInPlaneTest(rays[rayIndex], tri[j], epsilon)==true);

//                     // counter+=(SameSide(rays[rayIndex], tri[j])==true);


//             }
//             isInside[rayIndex]=(counter>0);
//         }
//     }

// }

void getIntersectedCubes(Ray *rays, Cube *cubes, int numrays, int *indexes,  Cube boundingBox, int frontGrid)
    {   
        for(int index = 0; index<numrays; index+=1)
        {
            rays[index].index = 0;            
            for(int frontGridIndex=0; frontGridIndex<frontGrid; frontGridIndex++)
            {
                    int intersects = (int)rayBoxIntersection_yaxis(rays[index].orig, cubes[indexes[frontGridIndex]]);
                    rays[index].intersectedCubes[rays[index].index] = indexes[frontGridIndex];
                    rays[index].index+=1*intersects;
            }


 
        }

    }

void ray_tracing(Ray *ray, Triangle *tri, bool *results, int n_r, int n_tr, Cube *cubes)
{
        for(int rayIndex = 0; rayIndex <n_r; rayIndex+=1)
        {       
            int count = 0;
            if(ray[rayIndex].index > 0)
            {
                for (int j = 0; j<cubes[ray[rayIndex].intersectedCubes[0]].index; j=j+1)
                {
                        count += (int)rayTriangleIntersect(ray[rayIndex],tri[cubes[ray[rayIndex].intersectedCubes[0]].triangleIndexes[j]]);
                }
 
                results[rayIndex] = (count % 2 !=0);       
               
            }
        
    }

    }
/*************** END OF CPU VERSION OF IS IN SURFACE *****************/


// extern "C" void RayTracingGPU(int *numRays, int *numTriangles, bool *isInside, bool *isInPlane){
extern "C" bool *RayTracingGPU(int *numRays_, int *numTriangles){



    // bool GPU = true;
    bool GPU = false;
    int nr_rays = *numRays_;
    int nr_triangles = *numTriangles;

    Point3D upper = {boundingBox.xmax, boundingBox.ymax, boundingBox.zmax};
    Point3D lower = {boundingBox.xmin, boundingBox.ymin, boundingBox.zmin};

    double delta = ((upper.x-lower.x) * (upper.z-lower.z)) / 500;
    delta = sqrt(delta);

    //number of cubes per each block
    int cubesPerBlock = ceil((upper.y - lower.y)/delta);
    int num = getNumberOfCubes(lower, upper,delta);

    Cube *cubes_d;
    if (GPU)
        hipMallocManaged((void**)&cubes_d, sizeof(Cube)*num);
    else
        cubes_d = (Cube *)malloc(sizeof(Cube)*num);

    Index frontGrid;
    // createGrid3D(cubes, lower, upper, delta,frontGrid);
    createGrid3D(cubes_d, lower, upper, delta,frontGrid);

    bool *CubeTriMapp = (bool *)malloc(sizeof(bool)*nr_triangles*num);

    int frontGridSize = frontGrid.count;
    int *indexes = new int[frontGrid.count];

    //Copy indexes in array
    for(int i = 0; i<frontGrid.count; i++)
    {
        indexes[i] = frontGrid.ptr[i];
    }

    printf("Num cubes: %d \n",num);
    printf("Num Triangles: %d \n",nr_triangles);
    printf("Num Rays: %d \n",nr_rays);

    const double epsilon = 1.e-15 * (boundingBox.xmax - boundingBox.xmin);
  
    /******************* Device memory allocation ********************/
    Triangle *tri_d;
    MY_CUDA_CHECK(hipMalloc((void**)&tri_d, sizeof(Triangle)*nr_triangles));
    MY_CUDA_CHECK(hipMemcpy(tri_d, triangles,sizeof(Triangle)*nr_triangles,hipMemcpyHostToDevice));

    Ray *ray_d;
    MY_CUDA_CHECK(hipMalloc((void**)&ray_d, sizeof(Ray)*nr_rays));
    MY_CUDA_CHECK(hipMemcpy(ray_d, rays, sizeof(Ray)*nr_rays, hipMemcpyHostToDevice));

    bool *CubeTriMapp_d;
    MY_CUDA_CHECK(hipMalloc((void**)&CubeTriMapp_d, sizeof(bool)*num*nr_triangles));
    MY_CUDA_CHECK(hipMemcpy(CubeTriMapp_d, CubeTriMapp,sizeof(bool)*num*nr_triangles , hipMemcpyHostToDevice));

    int *cubesPerBlock_d;
    MY_CUDA_CHECK(hipMalloc((void**)&cubesPerBlock_d, sizeof(int)));
    MY_CUDA_CHECK(hipMemcpy(cubesPerBlock_d, &cubesPerBlock, sizeof(int),hipMemcpyHostToDevice));

    int *frontGridSize_d;
    MY_CUDA_CHECK(hipMalloc((void**)&frontGridSize_d, sizeof(int)));
    MY_CUDA_CHECK(hipMemcpy(frontGridSize_d, &frontGridSize, sizeof(int),hipMemcpyHostToDevice));

    int *indexes_d;
    MY_CUDA_CHECK(hipMalloc((void**)&indexes_d, sizeof(int)*frontGridSize));
    MY_CUDA_CHECK(hipMemcpy(indexes_d, indexes, sizeof(int)*frontGridSize,hipMemcpyHostToDevice));

    int *numRays_d;
    MY_CUDA_CHECK(hipMalloc((void**)&numRays_d, sizeof(int)));
    MY_CUDA_CHECK(hipMemcpy(numRays_d, &nr_rays, sizeof(int),hipMemcpyHostToDevice));

    int *nr_triangles_d;
    MY_CUDA_CHECK(hipMalloc((void**)&nr_triangles_d, sizeof(int)));
    MY_CUDA_CHECK(hipMemcpy(nr_triangles_d, &nr_triangles, sizeof(int),hipMemcpyHostToDevice));

    int *num_cubes_d;
    MY_CUDA_CHECK(hipMalloc((void**)&num_cubes_d, sizeof(int)));
    MY_CUDA_CHECK(hipMemcpy(num_cubes_d, &num, sizeof(int),hipMemcpyHostToDevice));

    Cube *cube3d_d;
    MY_CUDA_CHECK(hipMalloc((void**)&cube3d_d, sizeof(Cube)));
    MY_CUDA_CHECK(hipMemcpy(cube3d_d, &boundingBox, sizeof(Cube),hipMemcpyHostToDevice));

    int *pointsInside;
    MY_CUDA_CHECK(hipMalloc((void**)&pointsInside, sizeof(int)));

    int *countTri;
    MY_CUDA_CHECK(hipMalloc((void**)&countTri, sizeof(int)));

    bool *results;
    MY_CUDA_CHECK(hipMalloc((void**)&results, sizeof(bool)*nr_rays*2));

    bool *isInside_d;
    MY_CUDA_CHECK(hipMalloc((void**)&isInside_d, sizeof(bool)*nr_rays));

    int *triCubMapp_d;
    MY_CUDA_CHECK(hipMalloc((void**)&triCubMapp_d, sizeof(int)*num));

    /**************** End of device memory allocation *****************/ 

    isInside = (bool *)malloc(2*nr_rays*sizeof(bool));
    isInPlane = (bool *)malloc(nr_rays*sizeof(bool));

    
    /**************** Begining of computations *****************/ 
    

    if(GPU){

        clock_t begin = clock();

        TriangleCount_GPU<<<256,512>>>(tri_d, cubes_d, num_cubes_d, nr_triangles_d, CubeTriMapp_d); //Count number of triangles per cube
        hipDeviceSynchronize();

        for(int i=0; i<num; i++)
        {
            MY_CUDA_CHECK(hipMallocManaged((void**)&cubes_d[i].triangleIndexes, sizeof(int)*cubes_d[i].counter+1));

        }

        appendALL<<<256,256>>>(cubes_d, num_cubes_d, nr_triangles_d, CubeTriMapp_d,tri_d);
        hipDeviceSynchronize();


        firstCube<<<256,256>>>(cubes_d, ray_d, tri_d, numRays_d, num_cubes_d);
        hipDeviceSynchronize();
        // exit(0);


        IsInPlaneGPU<<<256,256>>>(ray_d, tri_d, results, numRays_d, nr_triangles_d, cubes_d);    //Find surface points
        hipDeviceSynchronize(); 

        hipStream_t streams_u[frontGridSize]; //using cuda streams to parallelise kernel execution
        for(int i=0;i<frontGridSize; i++)
        {
            hipStreamCreate(&streams_u[i]);
            int reference = indexes[i];
            int *cubeIndex;
            MY_CUDA_CHECK(hipMalloc((void**)&cubeIndex, sizeof(int)));
            MY_CUDA_CHECK(hipMemcpy(cubeIndex, &reference, sizeof(int),hipMemcpyHostToDevice));

            findUnique<<<8,256,0,streams_u[i]>>>(cubes_d,cubeIndex,cubesPerBlock_d, CubeTriMapp_d, nr_triangles_d, num_cubes_d);//find unique triangles per cube

        }
        hipDeviceSynchronize();

        for(int i=0;i<frontGridSize; i++)
        {
            hipStreamDestroy(streams_u[i]); //Cuda streams must be destroyed at the end of execution
        }


        for(int i=0; i<frontGridSize; i++)
        {
            MY_CUDA_CHECK(hipMalloc((void**)&cubes_d[indexes[i]].triangleIndexes, sizeof(int)*cubes_d[indexes[i]].index));
        }
        
        int numThreads = (frontGridSize + 32 - (frontGridSize%32))/2;
        appendTriangles<<<2,196>>>(cubes_d,indexes_d, frontGridSize_d,nr_triangles_d, num_cubes_d, CubeTriMapp_d); //append triangles to cubes
        hipDeviceSynchronize();
    
        getIntersectedCubes_GPU<<<32,256>>>(ray_d, cubes_d, numRays_d , indexes_d, cube3d_d, frontGridSize_d); //ray cube intersection 
        hipDeviceSynchronize();
        
        ray_tracingGPU<<<256,256>>>(ray_d, tri_d, isInside_d, numRays_d, nr_triangles_d, cubes_d);    // ray tracing - ray triangle intersection Moller algorithm
        hipDeviceSynchronize();   



        clock_t end = clock();
        double time_spent = (double)(end-begin)/ CLOCKS_PER_SEC;

        MY_CUDA_CHECK(hipMemcpy(isInside, results, sizeof(bool)*nr_rays,hipMemcpyDeviceToHost));
        MY_CUDA_CHECK(hipMemcpy(isInPlane, isInside_d, sizeof(bool)*nr_rays,hipMemcpyDeviceToHost));

        // printf("\n time spent: %.10f\n",time_spent);
    }

    else{

        clock_t begin1 = clock();
        
        TriangleCount(triangles, cubes_d, num, nr_triangles, CubeTriMapp);

        for(int i=0; i<num; i++)
        {
            cubes_d[i].triangleIndexes = (int *)malloc(sizeof(int)*cubes_d[i].counter+1);
        }

        appendALL_CPU(cubes_d,num, nr_triangles, CubeTriMapp, triangles);   
        firstCube_CPU(cubes_d, rays, triangles, nr_rays, num);

        clock_t end1 = clock();
        double time_spent1 = (double)(end1-begin1)/ CLOCKS_PER_SEC;
        printf(" \n time spent for preprocessing: %.10f\n",time_spent1);

        clock_t begin2 = clock();
        IsInPlane(rays, triangles, isInside, nr_rays,  cubes_d);

        clock_t end2 = clock();
        double time_spent2 = (double)(end2-begin2)/ CLOCKS_PER_SEC;
        printf("time spent for Is In plane: %.10f\n",time_spent2);

        for(int i=0;i<frontGridSize; i++)
        {
            int reference = indexes[i];
            findUnique_CPU(cubes_d, reference, cubesPerBlock, CubeTriMapp, nr_triangles, num);
        }

        for(int i=0; i<frontGridSize; i++)
        {
            cubes_d[indexes[i]].triangleIndexes =(int *)malloc(sizeof(int)*cubes_d[indexes[i]].index);
        }

        clock_t begin3 = clock();

        appendTriangles_CPU(cubes_d, indexes, frontGridSize, nr_triangles, num, CubeTriMapp);
        getIntersectedCubes(rays, cubes_d, nr_rays, indexes,  boundingBox, frontGridSize);
        clock_t end3 = clock();
        double time_spent3 = (double)(end3-begin3)/ CLOCKS_PER_SEC;
        printf("time spent for pre-raytracing: %.10f\n",time_spent3);

        clock_t begin4 = clock();

        ray_tracing(rays, triangles, isInPlane, nr_rays, nr_triangles, cubes_d);

        clock_t end4 = clock();
        double time_spent4 = (double)(end4-begin4)/ CLOCKS_PER_SEC;
        printf("time spent for raytracing: %.10f\n",time_spent4);

    }

    /**************** End of Computations*****************/ 


    for(int i=0; i<nr_rays;i++){
        isInside[i+nr_rays]= isInPlane[i]; //Copying the results to one unique array of size 2 x number of rays
    }

    for(int i=0; i<nr_rays;i++){
        if (isInside[i]==true) isInside[nr_rays+i]= false; //Removing redundance
    }
    // int counter=0;

    // for(int i=0; i<nr_rays;i++){
    //     if (isInside[i]==true) counter+=1;
    // }
    // printf("Counter C: %d \n",counter);

//    FILE *fptr;

//    // use appropriate location if you are using MacOS or Linux
//    if (GPU)
//    fptr = fopen("/home/diko/Desktop/programGPU.txt","w");

//    else
//    fptr = fopen("/home/diko/Desktop/programCPU.txt","w");

//    if(fptr == NULL)
//    {
//       printf("Error!");   
//       exit(1);             
//    }

//    for(int i=0; i<nr_rays; i++){

//     if (isInside[i]==true) fprintf(fptr,"%d\n",i);
//    }
//    fclose(fptr);

//    printf("Ray: %lf %lf %lf",rays[20182].orig[0],rays[20182].orig[1],rays[20182].orig[2]);

    
    free(rays);
    free(triangles);
    free(isInPlane);
    hipFree(ray_d);
    hipFree(tri_d);
    hipFree(results);
    hipFree(pointsInside);
    hipFree(cube3d_d);
    hipFree(cubes_d);
    hipFree(cubesPerBlock_d);
    hipFree(indexes_d);
    hipFree(frontGridSize_d);
    hipFree(numRays_d);
    hipFree(triCubMapp_d);
    hipFree(isInside_d);

    return isInside;

}

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

                                        # End of file scope inline assembly
	.globl	_Z11dot_productPdS_             # -- Begin function _Z11dot_productPdS_
	.type	_Z11dot_productPdS_,@function
_Z11dot_productPdS_:                    # @_Z11dot_productPdS_
	.cfi_startproc
# %bb.0:
	xorpd	%xmm0, %xmm0
	xorl	%eax, %eax
.LBB0_1:                                # =>This Inner Loop Header: Depth=1
	movsd	(%rdi,%rax,8), %xmm1            # xmm1 = mem[0],zero
	mulsd	(%rsi,%rax,8), %xmm1
	addsd	%xmm1, %xmm0
	incq	%rax
	cmpq	$3, %rax
	jne	.LBB0_1
# %bb.2:
	retq
.Lfunc_end0:
	.size	_Z11dot_productPdS_, .Lfunc_end0-_Z11dot_productPdS_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z9GETCENTER4CubePd
.LCPI1_0:
	.quad	0x3fe0000000000000              # double 0.5
	.text
	.globl	_Z9GETCENTER4CubePd
	.type	_Z9GETCENTER4CubePd,@function
_Z9GETCENTER4CubePd:                    # @_Z9GETCENTER4CubePd
	.cfi_startproc
# %bb.0:
	movsd	16(%rsp), %xmm0                 # xmm0 = mem[0],zero
	addsd	8(%rsp), %xmm0
	movsd	.LCPI1_0(%rip), %xmm1           # xmm1 = mem[0],zero
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, (%rdi)
	movsd	32(%rsp), %xmm0                 # xmm0 = mem[0],zero
	addsd	24(%rsp), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, 8(%rdi)
	movsd	48(%rsp), %xmm0                 # xmm0 = mem[0],zero
	addsd	40(%rsp), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, 16(%rdi)
	retq
.Lfunc_end1:
	.size	_Z9GETCENTER4CubePd, .Lfunc_end1-_Z9GETCENTER4CubePd
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z11GETHALFSIZE4CubePd
.LCPI2_0:
	.quad	0x3fe0000000000000              # double 0.5
	.text
	.globl	_Z11GETHALFSIZE4CubePd
	.type	_Z11GETHALFSIZE4CubePd,@function
_Z11GETHALFSIZE4CubePd:                 # @_Z11GETHALFSIZE4CubePd
	.cfi_startproc
# %bb.0:
	movsd	16(%rsp), %xmm0                 # xmm0 = mem[0],zero
	subsd	8(%rsp), %xmm0
	movsd	.LCPI2_0(%rip), %xmm1           # xmm1 = mem[0],zero
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, (%rdi)
	movsd	32(%rsp), %xmm0                 # xmm0 = mem[0],zero
	subsd	24(%rsp), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, 8(%rdi)
	movsd	48(%rsp), %xmm0                 # xmm0 = mem[0],zero
	subsd	40(%rsp), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, 16(%rdi)
	retq
.Lfunc_end2:
	.size	_Z11GETHALFSIZE4CubePd, .Lfunc_end2-_Z11GETHALFSIZE4CubePd
	.cfi_endproc
                                        # -- End function
	.globl	_Z11into_doublePc               # -- Begin function _Z11into_doublePc
	.type	_Z11into_doublePc,@function
_Z11into_doublePc:                      # @_Z11into_doublePc
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rsp, %rsi
	callq	strtod
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z11into_doublePc, .Lfunc_end3-_Z11into_doublePc
	.cfi_endproc
                                        # -- End function
	.globl	_Z12getTrianglesP8Triangle      # -- Begin function _Z12getTrianglesP8Triangle
	.type	_Z12getTrianglesP8Triangle,@function
_Z12getTrianglesP8Triangle:             # @_Z12getTrianglesP8Triangle
	.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	%rdi, %rbx
	xorl	%eax, %eax
	movq	%rax, (%rsp)
	movq	%rax, 8(%rsp)
	movl	$.L.str, %edi
	movl	$.L.str.1, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB4_18
# %bb.1:                                # %.preheader
	movq	%rax, %r14
	movq	%rsp, %rdi
	leaq	8(%rsp), %rsi
	movq	%rax, %rdx
	callq	getline
	cmpq	$-1, %rax
	je	.LBB4_15
# %bb.2:                                # %.lr.ph72.preheader
	leaq	16(%rsp), %r13
	xorl	%ebp, %ebp
	xorl	%r15d, %r15d
.LBB4_3:                                # %.lr.ph72
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_5 Depth 2
	movq	(%rsp), %rdi
	movl	$.L.str.3, %esi
	callq	strtok
	testq	%rax, %rax
	je	.LBB4_14
# %bb.4:                                # %.lr.ph
                                        #   in Loop: Header=BB4_3 Depth=1
	movl	%ebp, %eax
	leaq	(%rax,%rax,8), %rax
	leaq	(%rbx,%rax,8), %r12
.LBB4_5:                                #   Parent Loop BB4_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$.L.str.3, %esi
	xorl	%edi, %edi
	callq	strtok
	cmpl	$1, %r15d
	je	.LBB4_9
# %bb.6:                                #   in Loop: Header=BB4_5 Depth=2
	testl	%r15d, %r15d
	jne	.LBB4_11
# %bb.7:                                #   in Loop: Header=BB4_5 Depth=2
	testq	%rax, %rax
	je	.LBB4_14
# %bb.8:                                #   in Loop: Header=BB4_5 Depth=2
	movq	%rax, %rdi
	movq	%r13, %rsi
	callq	strtod
	movapd	%xmm0, %xmm1
	xorpd	%xmm3, %xmm3
	addsd	%xmm3, %xmm1
	movapd	%xmm0, %xmm2
	cmpltsd	%xmm3, %xmm2
	andpd	%xmm2, %xmm0
	andnpd	%xmm1, %xmm2
	orpd	%xmm0, %xmm2
	movlpd	%xmm2, (%r12)
	jmp	.LBB4_13
.LBB4_9:                                #   in Loop: Header=BB4_5 Depth=2
	testq	%rax, %rax
	je	.LBB4_14
# %bb.10:                               #   in Loop: Header=BB4_5 Depth=2
	movq	%rax, %rdi
	movq	%r13, %rsi
	callq	strtod
	movapd	%xmm0, %xmm1
	xorpd	%xmm3, %xmm3
	addsd	%xmm3, %xmm1
	movapd	%xmm0, %xmm2
	cmpltsd	%xmm3, %xmm2
	andpd	%xmm2, %xmm0
	andnpd	%xmm1, %xmm2
	orpd	%xmm0, %xmm2
	movlpd	%xmm2, 24(%r12)
	jmp	.LBB4_13
.LBB4_11:                               #   in Loop: Header=BB4_5 Depth=2
	testq	%rax, %rax
	je	.LBB4_14
# %bb.12:                               #   in Loop: Header=BB4_5 Depth=2
	movq	%rax, %rdi
	movq	%r13, %rsi
	callq	strtod
	movapd	%xmm0, %xmm1
	xorpd	%xmm3, %xmm3
	addsd	%xmm3, %xmm1
	movapd	%xmm0, %xmm2
	cmpltsd	%xmm3, %xmm2
	andpd	%xmm2, %xmm0
	andnpd	%xmm1, %xmm2
	orpd	%xmm0, %xmm2
	movlpd	%xmm2, 48(%r12)
.LBB4_13:                               #   in Loop: Header=BB4_5 Depth=2
	addq	$8, %r12
	jmp	.LBB4_5
.LBB4_14:                               # %._crit_edge
                                        #   in Loop: Header=BB4_3 Depth=1
	leal	1(%r15), %r12d
	xorl	%eax, %eax
	cmpl	$2, %r15d
	sete	%al
	movl	$0, %ecx
	cmovel	%ecx, %r12d
	addl	%eax, %ebp
	movq	%rsp, %rdi
	leaq	8(%rsp), %rsi
	movq	%r14, %rdx
	callq	getline
	movl	%r12d, %r15d
	cmpq	$-1, %rax
	jne	.LBB4_3
.LBB4_15:                               # %._crit_edge73
	movq	%r14, %rdi
	callq	fclose
	movq	(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB4_17
# %bb.16:
	callq	free
.LBB4_17:
	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
.LBB4_18:
	.cfi_def_cfa_offset 80
	movl	$.L.str.2, %edi
	callq	perror
	movl	$1, %edi
	callq	exit
.Lfunc_end4:
	.size	_Z12getTrianglesP8Triangle, .Lfunc_end4-_Z12getTrianglesP8Triangle
	.cfi_endproc
                                        # -- End function
	.globl	_Z15generateRandomsPdS_         # -- Begin function _Z15generateRandomsPdS_
	.type	_Z15generateRandomsPdS_,@function
_Z15generateRandomsPdS_:                # @_Z15generateRandomsPdS_
	.cfi_startproc
# %bb.0:
	movabsq	$4551510721646314285, %rax      # imm = 0x3F2A36E2EB1C432D
	movq	%rax, (%rdi)
	movabsq	$4607182418800017408, %rcx      # imm = 0x3FF0000000000000
	movq	%rcx, 8(%rdi)
	movq	%rax, 16(%rdi)
	retq
.Lfunc_end5:
	.size	_Z15generateRandomsPdS_, .Lfunc_end5-_Z15generateRandomsPdS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z7getRaysP3Ray                 # -- Begin function _Z7getRaysP3Ray
	.type	_Z7getRaysP3Ray,@function
_Z7getRaysP3Ray:                        # @_Z7getRaysP3Ray
	.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	%rdi, %r12
	xorl	%eax, %eax
	movq	%rax, (%rsp)
	movq	%rax, 8(%rsp)
	movl	$.L.str.4, %edi
	movl	$.L.str.1, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB6_11
# %bb.1:                                # %.preheader
	movq	%rax, %r15
	movq	%rsp, %rdi
	leaq	8(%rsp), %rsi
	movq	%rax, %rdx
	callq	getline
	cmpq	$-1, %rax
	je	.LBB6_8
# %bb.2:                                # %.lr.ph23.preheader
	xorl	%ebp, %ebp
	leaq	16(%rsp), %r13
	movq	%r12, %rbx
.LBB6_3:                                # %.lr.ph23
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_5 Depth 2
	movq	(%rsp), %rdi
	movl	$.L.str.3, %esi
	callq	strtok
	testq	%rax, %rax
	je	.LBB6_7
# %bb.4:                                # %.lr.ph
                                        #   in Loop: Header=BB6_3 Depth=1
	xorl	%r14d, %r14d
.LBB6_5:                                #   Parent Loop BB6_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	%rax, %rdi
	movq	%r13, %rsi
	callq	strtod
	movsd	%xmm0, (%rbx,%r14,8)
	movl	$.L.str.3, %esi
	xorl	%edi, %edi
	callq	strtok
	testq	%rax, %rax
	je	.LBB6_7
# %bb.6:                                #   in Loop: Header=BB6_5 Depth=2
	leaq	1(%r14), %rcx
	cmpq	$2, %r14
	movq	%rcx, %r14
	jb	.LBB6_5
.LBB6_7:                                # %._crit_edge
                                        #   in Loop: Header=BB6_3 Depth=1
	leaq	(,%rbp,8), %rax
	addq	%rbp, %rax
	movabsq	$4551510721646314285, %rcx      # imm = 0x3F2A36E2EB1C432D
	movq	%rcx, 24(%r12,%rax,8)
	movabsq	$4607182418800017408, %rdx      # imm = 0x3FF0000000000000
	movq	%rdx, 32(%r12,%rax,8)
	movq	%rcx, 40(%r12,%rax,8)
	incq	%rbp
	movq	%rsp, %rdi
	leaq	8(%rsp), %rsi
	movq	%r15, %rdx
	callq	getline
	addq	$72, %rbx
	cmpq	$-1, %rax
	jne	.LBB6_3
.LBB6_8:                                # %._crit_edge24
	movq	%r15, %rdi
	callq	fclose
	movq	(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB6_10
# %bb.9:
	callq	free
.LBB6_10:
	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
.LBB6_11:
	.cfi_def_cfa_offset 80
	movl	$.L.str.2, %edi
	callq	perror
	movl	$1, %edi
	callq	exit
.Lfunc_end6:
	.size	_Z7getRaysP3Ray, .Lfunc_end6-_Z7getRaysP3Ray
	.cfi_endproc
                                        # -- End function
	.globl	_Z16getNumberOfCubes7Point3DS_d # -- Begin function _Z16getNumberOfCubes7Point3DS_d
	.type	_Z16getNumberOfCubes7Point3DS_d,@function
_Z16getNumberOfCubes7Point3DS_d:        # @_Z16getNumberOfCubes7Point3DS_d
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -24
	.cfi_offset %rbp, -16
	movapd	%xmm0, %xmm1
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movsd	72(%rsp), %xmm0                 # xmm0 = mem[0],zero
	movsd	80(%rsp), %xmm2                 # xmm2 = mem[0],zero
	movsd	%xmm2, 16(%rsp)                 # 8-byte Spill
	subsd	48(%rsp), %xmm0
	divsd	%xmm1, %xmm0
	callq	ceil@PLT
	cvttsd2si	%xmm0, %ebx
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	subsd	56(%rsp), %xmm0
	divsd	8(%rsp), %xmm0                  # 8-byte Folded Reload
	callq	ceil@PLT
	cvttsd2si	%xmm0, %ebp
	imull	%ebx, %ebp
	movsd	88(%rsp), %xmm0                 # xmm0 = mem[0],zero
	subsd	64(%rsp), %xmm0
	divsd	8(%rsp), %xmm0                  # 8-byte Folded Reload
	callq	ceil@PLT
	cvttsd2si	%xmm0, %eax
	imull	%ebp, %eax
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end7:
	.size	_Z16getNumberOfCubes7Point3DS_d, .Lfunc_end7-_Z16getNumberOfCubes7Point3DS_d
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z12createGrid3DP4Cube7Point3DS1_dR5Index
.LCPI8_0:
	.quad	0x3fe0000000000000              # double 0.5
.LCPI8_1:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z12createGrid3DP4Cube7Point3DS1_dR5Index
	.type	_Z12createGrid3DP4Cube7Point3DS1_dR5Index,@function
_Z12createGrid3DP4Cube7Point3DS1_dR5Index: # @_Z12createGrid3DP4Cube7Point3DS1_dR5Index
	.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	$152, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	movapd	%xmm0, %xmm2
	movsd	%xmm0, 16(%rsp)                 # 8-byte Spill
	movq	%rdi, 48(%rsp)                  # 8-byte Spill
	movsd	208(%rsp), %xmm1                # xmm1 = mem[0],zero
	movsd	216(%rsp), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 56(%rsp)                 # 8-byte Spill
	movsd	232(%rsp), %xmm0                # xmm0 = mem[0],zero
	movsd	240(%rsp), %xmm3                # xmm3 = mem[0],zero
	movsd	%xmm3, (%rsp)                   # 8-byte Spill
	movsd	%xmm1, 64(%rsp)                 # 8-byte Spill
	subsd	%xmm1, %xmm0
	divsd	%xmm2, %xmm0
	callq	ceil@PLT
	cvttsd2si	%xmm0, %ebp
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	subsd	56(%rsp), %xmm0                 # 8-byte Folded Reload
	divsd	16(%rsp), %xmm0                 # 8-byte Folded Reload
	callq	ceil@PLT
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	movsd	248(%rsp), %xmm0                # xmm0 = mem[0],zero
	movsd	224(%rsp), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 72(%rsp)                 # 8-byte Spill
	subsd	%xmm1, %xmm0
	divsd	16(%rsp), %xmm0                 # 8-byte Folded Reload
	callq	ceil@PLT
	movsd	16(%rsp), %xmm3                 # 8-byte Reload
                                        # xmm3 = mem[0],zero
	movl	%ebp, 32(%rsp)                  # 4-byte Spill
	testl	%ebp, %ebp
	jle	.LBB8_8
# %bb.1:                                # %.lr.ph98
	cvttsd2si	(%rsp), %r13d           # 8-byte Folded Reload
	cvttsd2si	%xmm0, %eax
	movl	%eax, 12(%rsp)                  # 4-byte Spill
	addq	$96, 48(%rsp)                   # 8-byte Folded Spill
	xorl	%eax, %eax
	xorpd	%xmm0, %xmm0
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	movsd	.LCPI8_0(%rip), %xmm4           # xmm4 = mem[0],zero
	movsd	.LCPI8_1(%rip), %xmm5           # xmm5 = mem[0],zero
	xorl	%ebp, %ebp
	xorl	%r15d, %r15d
	movl	%r13d, 40(%rsp)                 # 4-byte Spill
.LBB8_2:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB8_4 Depth 2
                                        #       Child Loop BB8_10 Depth 3
	movl	%eax, 36(%rsp)                  # 4-byte Spill
	cmpl	$0, 12(%rsp)                    # 4-byte Folded Reload
	jle	.LBB8_7
# %bb.3:                                # %.lr.ph90
                                        #   in Loop: Header=BB8_2 Depth=1
	movsd	24(%rsp), %xmm6                 # 8-byte Reload
                                        # xmm6 = mem[0],zero
	mulsd	%xmm3, %xmm6
	addsd	64(%rsp), %xmm6                 # 8-byte Folded Reload
	movapd	%xmm6, %xmm7
	addsd	%xmm3, %xmm7
	movapd	%xmm6, %xmm8
	addsd	%xmm7, %xmm8
	mulsd	%xmm4, %xmm8
	movapd	%xmm7, %xmm9
	subsd	%xmm6, %xmm9
	mulsd	%xmm4, %xmm9
	xorl	%r14d, %r14d
	xorpd	%xmm0, %xmm0
	movsd	%xmm6, 112(%rsp)                # 8-byte Spill
	movsd	%xmm7, 104(%rsp)                # 8-byte Spill
	movsd	%xmm8, 96(%rsp)                 # 8-byte Spill
	movsd	%xmm9, 88(%rsp)                 # 8-byte Spill
.LBB8_4:                                #   Parent Loop BB8_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB8_10 Depth 3
	testl	%r13d, %r13d
	jle	.LBB8_5
# %bb.9:                                # %.lr.ph
                                        #   in Loop: Header=BB8_4 Depth=2
	movsd	%xmm0, 80(%rsp)                 # 8-byte Spill
	movapd	%xmm0, %xmm10
	mulsd	%xmm3, %xmm10
	addsd	72(%rsp), %xmm10                # 8-byte Folded Reload
	movapd	%xmm10, %xmm11
	addsd	%xmm3, %xmm11
	incl	%r15d
	movl	%r15d, 44(%rsp)                 # 4-byte Spill
	imull	%r13d, %r15d
	decl	%r15d
	movslq	%ebp, %rax
	movapd	%xmm10, %xmm12
	addsd	%xmm11, %xmm12
	mulsd	%xmm4, %xmm12
	movapd	%xmm11, %xmm13
	subsd	%xmm10, %xmm13
	mulsd	%xmm4, %xmm13
	imulq	$120, %rax, %r12
	addq	48(%rsp), %r12                  # 8-byte Folded Reload
	xorpd	%xmm14, %xmm14
	movsd	%xmm10, 144(%rsp)               # 8-byte Spill
	movsd	%xmm11, 136(%rsp)               # 8-byte Spill
	movsd	%xmm12, 128(%rsp)               # 8-byte Spill
	movsd	%xmm13, 120(%rsp)               # 8-byte Spill
.LBB8_10:                               #   Parent Loop BB8_2 Depth=1
                                        #     Parent Loop BB8_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movapd	%xmm14, %xmm0
	mulsd	%xmm3, %xmm0
	addsd	56(%rsp), %xmm0                 # 8-byte Folded Reload
	movsd	%xmm7, -88(%r12)
	movapd	%xmm0, %xmm1
	addsd	%xmm3, %xmm1
	movsd	%xmm1, -72(%r12)
	movsd	%xmm11, -56(%r12)
	movsd	%xmm6, -96(%r12)
	movsd	%xmm0, -80(%r12)
	movsd	%xmm10, -64(%r12)
	movsd	%xmm8, -24(%r12)
	movapd	%xmm0, %xmm2
	addsd	%xmm1, %xmm2
	mulsd	%xmm4, %xmm2
	movsd	%xmm2, -16(%r12)
	movsd	%xmm12, -8(%r12)
	movsd	%xmm9, -48(%r12)
	subsd	%xmm0, %xmm1
	mulsd	%xmm4, %xmm1
	movsd	%xmm1, -40(%r12)
	movsd	%xmm13, -32(%r12)
	cmpl	$1, %r13d
	jne	.LBB8_12
# %bb.11:                               #   in Loop: Header=BB8_10 Depth=3
	movq	%rbx, %rdi
	movl	%ebp, %esi
	movsd	%xmm14, (%rsp)                  # 8-byte Spill
	callq	_ZN5Index6InsertEi
	movsd	(%rsp), %xmm14                  # 8-byte Reload
                                        # xmm14 = mem[0],zero
	movsd	120(%rsp), %xmm13               # 8-byte Reload
                                        # xmm13 = mem[0],zero
	movsd	128(%rsp), %xmm12               # 8-byte Reload
                                        # xmm12 = mem[0],zero
	movsd	136(%rsp), %xmm11               # 8-byte Reload
                                        # xmm11 = mem[0],zero
	movsd	144(%rsp), %xmm10               # 8-byte Reload
                                        # xmm10 = mem[0],zero
	movsd	88(%rsp), %xmm9                 # 8-byte Reload
                                        # xmm9 = mem[0],zero
	movsd	96(%rsp), %xmm8                 # 8-byte Reload
                                        # xmm8 = mem[0],zero
	movsd	104(%rsp), %xmm7                # 8-byte Reload
                                        # xmm7 = mem[0],zero
	movsd	112(%rsp), %xmm6                # 8-byte Reload
                                        # xmm6 = mem[0],zero
	movsd	.LCPI8_1(%rip), %xmm5           # xmm5 = mem[0],zero
	movsd	.LCPI8_0(%rip), %xmm4           # xmm4 = mem[0],zero
	movsd	16(%rsp), %xmm3                 # 8-byte Reload
                                        # xmm3 = mem[0],zero
.LBB8_12:                               #   in Loop: Header=BB8_10 Depth=3
	movl	%r15d, (%r12)
	addsd	%xmm5, %xmm14
	addq	$120, %r12
	incl	%ebp
	decl	%r13d
	jne	.LBB8_10
# %bb.13:                               #   in Loop: Header=BB8_4 Depth=2
	movl	40(%rsp), %r13d                 # 4-byte Reload
	movl	44(%rsp), %r15d                 # 4-byte Reload
	movsd	80(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	jmp	.LBB8_6
.LBB8_5:                                # %.._crit_edge_crit_edge
                                        #   in Loop: Header=BB8_4 Depth=2
	incl	%r15d
.LBB8_6:                                # %._crit_edge
                                        #   in Loop: Header=BB8_4 Depth=2
	addsd	%xmm5, %xmm0
	incl	%r14d
	cmpl	12(%rsp), %r14d                 # 4-byte Folded Reload
	jne	.LBB8_4
.LBB8_7:                                # %._crit_edge91
                                        #   in Loop: Header=BB8_2 Depth=1
	movsd	24(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	addsd	%xmm5, %xmm0
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	movl	36(%rsp), %eax                  # 4-byte Reload
	incl	%eax
	cmpl	32(%rsp), %eax                  # 4-byte Folded Reload
	jne	.LBB8_2
.LBB8_8:                                # %._crit_edge99
	addq	$152, %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_end8:
	.size	_Z12createGrid3DP4Cube7Point3DS1_dR5Index, .Lfunc_end8-_Z12createGrid3DP4Cube7Point3DS1_dR5Index
	.cfi_endproc
                                        # -- End function
	.section	.text._ZN5Index6InsertEi,"axG",@progbits,_ZN5Index6InsertEi,comdat
	.weak	_ZN5Index6InsertEi              # -- Begin function _ZN5Index6InsertEi
	.p2align	1, 0x90
	.type	_ZN5Index6InsertEi,@function
_ZN5Index6InsertEi:                     # @_ZN5Index6InsertEi
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebp
	movq	%rdi, %rbx
	movl	4(%rdi), %r15d
	cmpl	(%rdi), %r15d
	jne	.LBB9_1
# %bb.2:
	movslq	%r15d, %rax
	leaq	4(,%rax,4), %rdi
	callq	malloc
	movq	%rax, %r14
	movq	8(%rbx), %rdi
	testl	%r15d, %r15d
	jle	.LBB9_5
# %bb.3:                                # %.lr.ph
	xorl	%eax, %eax
.LBB9_4:                                # =>This Inner Loop Header: Depth=1
	movl	(%rdi,%rax,4), %ecx
	movl	%ecx, (%r14,%rax,4)
	incq	%rax
	cmpq	%rax, %r15
	jne	.LBB9_4
.LBB9_5:                                # %._crit_edge
	callq	free
	movq	%r14, 8(%rbx)
	incl	(%rbx)
	movl	4(%rbx), %r15d
	jmp	.LBB9_6
.LBB9_1:                                # %._crit_edge10
	movq	8(%rbx), %r14
.LBB9_6:
	movslq	%r15d, %rax
	movl	%ebp, (%r14,%rax,4)
	incl	4(%rbx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end9:
	.size	_ZN5Index6InsertEi, .Lfunc_end9-_ZN5Index6InsertEi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z20rayTriangleIntersect3Ray8Triangle
.LCPI10_0:
	.quad	0xbddb7cdfd9d7bdbb              # double -1.0E-10
.LCPI10_1:
	.quad	0x3ddb7cdfd9d7bdbb              # double 1.0E-10
.LCPI10_2:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z20rayTriangleIntersect3Ray8Triangle
	.type	_Z20rayTriangleIntersect3Ray8Triangle,@function
_Z20rayTriangleIntersect3Ray8Triangle:  # @_Z20rayTriangleIntersect3Ray8Triangle
	.cfi_startproc
# %bb.0:
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	32(%rsp), %rcx
	movsd	128(%rsp), %xmm0                # xmm0 = mem[0],zero
	movsd	104(%rsp), %xmm4                # xmm4 = mem[0],zero
	movsd	112(%rsp), %xmm3                # xmm3 = mem[0],zero
	subsd	%xmm4, %xmm0
	movsd	%xmm0, (%rsp)
	movsd	136(%rsp), %xmm1                # xmm1 = mem[0],zero
	subsd	%xmm3, %xmm1
	movsd	%xmm1, 8(%rsp)
	movsd	144(%rsp), %xmm2                # xmm2 = mem[0],zero
	movsd	120(%rsp), %xmm5                # xmm5 = mem[0],zero
	subsd	%xmm5, %xmm2
	movsd	%xmm2, 16(%rsp)
	movsd	152(%rsp), %xmm6                # xmm6 = mem[0],zero
	subsd	%xmm4, %xmm6
	movsd	%xmm6, -32(%rsp)
	movsd	160(%rsp), %xmm7                # xmm7 = mem[0],zero
	subsd	%xmm3, %xmm7
	movsd	%xmm7, -24(%rsp)
	movsd	168(%rsp), %xmm8                # xmm8 = mem[0],zero
	subsd	%xmm5, %xmm8
	movsd	%xmm8, -16(%rsp)
	movsd	32(%rcx), %xmm9                 # xmm9 = mem[0],zero
	movsd	40(%rcx), %xmm10                # xmm10 = mem[0],zero
	movapd	%xmm8, %xmm11
	mulsd	%xmm9, %xmm11
	movapd	%xmm7, %xmm12
	mulsd	%xmm10, %xmm12
	subsd	%xmm12, %xmm11
	movsd	%xmm11, -96(%rsp)
	mulsd	%xmm6, %xmm10
	movsd	24(%rcx), %xmm11                # xmm11 = mem[0],zero
	mulsd	%xmm11, %xmm8
	subsd	%xmm8, %xmm10
	movsd	%xmm10, -88(%rsp)
	mulsd	%xmm11, %xmm7
	mulsd	%xmm9, %xmm6
	subsd	%xmm6, %xmm7
	movsd	%xmm7, -80(%rsp)
	xorpd	%xmm7, %xmm7
	xorl	%eax, %eax
.LBB10_1:                               # =>This Inner Loop Header: Depth=1
	movsd	(%rsp,%rax,8), %xmm6            # xmm6 = mem[0],zero
	mulsd	-96(%rsp,%rax,8), %xmm6
	addsd	%xmm6, %xmm7
	incq	%rax
	cmpq	$3, %rax
	jne	.LBB10_1
# %bb.2:                                # %_Z11dot_productPdS_.exit
	ucomisd	.LCPI10_0(%rip), %xmm7
	jbe	.LBB10_5
# %bb.3:                                # %_Z11dot_productPdS_.exit
	movsd	.LCPI10_1(%rip), %xmm6          # xmm6 = mem[0],zero
	ucomisd	%xmm7, %xmm6
	jbe	.LBB10_5
# %bb.4:
	xorl	%eax, %eax
.LBB10_16:
                                        # kill: def $al killed $al killed $eax
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	retq
.LBB10_5:
	.cfi_def_cfa_offset 32
	movsd	(%rcx), %xmm6                   # xmm6 = mem[0],zero
	subsd	%xmm4, %xmm6
	movsd	%xmm6, -64(%rsp)
	movsd	8(%rcx), %xmm8                  # xmm8 = mem[0],zero
	subsd	%xmm3, %xmm8
	movsd	%xmm8, -56(%rsp)
	movsd	16(%rcx), %xmm9                 # xmm9 = mem[0],zero
	subsd	%xmm5, %xmm9
	movsd	%xmm9, -48(%rsp)
	xorpd	%xmm4, %xmm4
	xorl	%eax, %eax
.LBB10_6:                               # =>This Inner Loop Header: Depth=1
	movsd	-64(%rsp,%rax,8), %xmm3         # xmm3 = mem[0],zero
	mulsd	-96(%rsp,%rax,8), %xmm3
	addsd	%xmm3, %xmm4
	incq	%rax
	cmpq	$3, %rax
	jne	.LBB10_6
# %bb.7:                                # %_Z11dot_productPdS_.exit31
	movsd	.LCPI10_2(%rip), %xmm3          # xmm3 = mem[0],zero
	divsd	%xmm7, %xmm3
	mulsd	%xmm3, %xmm4
	xorl	%eax, %eax
	xorpd	%xmm5, %xmm5
	ucomisd	%xmm4, %xmm5
	ja	.LBB10_16
# %bb.8:                                # %_Z11dot_productPdS_.exit31
	ucomisd	.LCPI10_2(%rip), %xmm4
	ja	.LBB10_16
# %bb.9:
	movapd	%xmm2, %xmm5
	mulsd	%xmm8, %xmm5
	movapd	%xmm1, %xmm7
	mulsd	%xmm9, %xmm7
	subsd	%xmm7, %xmm5
	movsd	%xmm5, -128(%rsp)
	mulsd	%xmm0, %xmm9
	mulsd	%xmm6, %xmm2
	subsd	%xmm2, %xmm9
	movsd	%xmm9, -120(%rsp)
	mulsd	%xmm6, %xmm1
	mulsd	%xmm8, %xmm0
	subsd	%xmm0, %xmm1
	movsd	%xmm1, -112(%rsp)
	xorpd	%xmm0, %xmm0
	xorl	%eax, %eax
.LBB10_10:                              # =>This Inner Loop Header: Depth=1
	movsd	24(%rcx,%rax,8), %xmm1          # xmm1 = mem[0],zero
	mulsd	-128(%rsp,%rax,8), %xmm1
	addsd	%xmm1, %xmm0
	incq	%rax
	cmpq	$3, %rax
	jne	.LBB10_10
# %bb.11:                               # %_Z11dot_productPdS_.exit36
	mulsd	%xmm3, %xmm0
	xorl	%eax, %eax
	xorpd	%xmm1, %xmm1
	ucomisd	%xmm0, %xmm1
	ja	.LBB10_16
# %bb.12:                               # %_Z11dot_productPdS_.exit36
	addsd	%xmm0, %xmm4
	ucomisd	.LCPI10_2(%rip), %xmm4
	ja	.LBB10_16
# %bb.13:                               # %.preheader.preheader
	xorpd	%xmm0, %xmm0
	xorl	%eax, %eax
.LBB10_14:                              # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	movsd	-32(%rsp,%rax,8), %xmm1         # xmm1 = mem[0],zero
	mulsd	-128(%rsp,%rax,8), %xmm1
	addsd	%xmm1, %xmm0
	incq	%rax
	cmpq	$3, %rax
	jne	.LBB10_14
# %bb.15:                               # %_Z11dot_productPdS_.exit41
	mulsd	%xmm0, %xmm3
	ucomisd	.LCPI10_1(%rip), %xmm3
	seta	%al
	jmp	.LBB10_16
.Lfunc_end10:
	.size	_Z20rayTriangleIntersect3Ray8Triangle, .Lfunc_end10-_Z20rayTriangleIntersect3Ray8Triangle
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z15planeBoxOverlapPdS_S_
.LCPI11_0:
	.quad	0x3ff0000000000000              # double 1
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI11_1:
	.quad	0x8000000000000000              # double -0
	.quad	0x8000000000000000              # double -0
	.text
	.globl	_Z15planeBoxOverlapPdS_S_
	.type	_Z15planeBoxOverlapPdS_S_,@function
_Z15planeBoxOverlapPdS_S_:              # @_Z15planeBoxOverlapPdS_S_
	.cfi_startproc
# %bb.0:
	xorl	%eax, %eax
	movsd	.LCPI11_0(%rip), %xmm0          # xmm0 = mem[0],zero
	movapd	.LCPI11_1(%rip), %xmm1          # xmm1 = [-0.0E+0,-0.0E+0]
.LBB11_1:                               # =>This Inner Loop Header: Depth=1
	movsd	(%rsi,%rax,8), %xmm2            # xmm2 = mem[0],zero
	movsd	(%rdi,%rax,8), %xmm3            # xmm3 = mem[0],zero
	xorpd	%xmm4, %xmm4
	cmpltsd	%xmm3, %xmm4
	andpd	%xmm0, %xmm4
	movsd	(%rdx,%rax,8), %xmm5            # xmm5 = mem[0],zero
	movapd	%xmm5, %xmm6
	xorpd	%xmm1, %xmm6
	subsd	%xmm2, %xmm6
	xorpd	%xmm7, %xmm7
	cmpnltsd	%xmm3, %xmm7
	andpd	%xmm0, %xmm7
	subsd	%xmm2, %xmm5
	movapd	%xmm5, %xmm2
	mulsd	%xmm7, %xmm2
	mulsd	%xmm6, %xmm7
	mulsd	%xmm4, %xmm6
	addsd	%xmm6, %xmm2
	movsd	%xmm2, -24(%rsp,%rax,8)
	mulsd	%xmm4, %xmm5
	addsd	%xmm5, %xmm7
	movsd	%xmm7, -56(%rsp,%rax,8)
	incq	%rax
	cmpq	$3, %rax
	jne	.LBB11_1
# %bb.2:
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	8(%rdi), %xmm1                  # xmm1 = mem[0],zero
	movsd	-24(%rsp), %xmm2                # xmm2 = mem[0],zero
	mulsd	%xmm0, %xmm2
	movsd	-16(%rsp), %xmm3                # xmm3 = mem[0],zero
	mulsd	%xmm1, %xmm3
	addsd	%xmm2, %xmm3
	movsd	16(%rdi), %xmm2                 # xmm2 = mem[0],zero
	movsd	-8(%rsp), %xmm4                 # xmm4 = mem[0],zero
	mulsd	%xmm2, %xmm4
	addsd	%xmm3, %xmm4
	mulsd	-56(%rsp), %xmm0
	mulsd	-48(%rsp), %xmm1
	addsd	%xmm0, %xmm1
	mulsd	-40(%rsp), %xmm2
	addsd	%xmm1, %xmm2
	xorpd	%xmm0, %xmm0
	xorpd	%xmm1, %xmm1
	cmplepd	%xmm2, %xmm1
	cmpnltpd	%xmm4, %xmm0
	andpd	%xmm1, %xmm0
	movd	%xmm0, %eax
	andl	$1, %eax
	retq
.Lfunc_end11:
	.size	_Z15planeBoxOverlapPdS_S_, .Lfunc_end11-_Z15planeBoxOverlapPdS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z13triBoxOverlapPdS_8Triangle  # -- Begin function _Z13triBoxOverlapPdS_8Triangle
	.type	_Z13triBoxOverlapPdS_8Triangle,@function
_Z13triBoxOverlapPdS_8Triangle:         # @_Z13triBoxOverlapPdS_8Triangle
	.cfi_startproc
# %bb.0:
	subq	$56, %rsp
	.cfi_def_cfa_offset 64
	movq	%rsi, %rdx
	movsd	(%rdi), %xmm4                   # xmm4 = mem[0],zero
	movsd	64(%rsp), %xmm6                 # xmm6 = mem[0],zero
	movsd	72(%rsp), %xmm2                 # xmm2 = mem[0],zero
	subsd	%xmm4, %xmm6
	leaq	32(%rsp), %rsi
	movsd	%xmm6, (%rsi)
	movsd	8(%rdi), %xmm8                  # xmm8 = mem[0],zero
	subsd	%xmm8, %xmm2
	movsd	%xmm2, 8(%rsi)
	movsd	80(%rsp), %xmm7                 # xmm7 = mem[0],zero
	movsd	16(%rdi), %xmm9                 # xmm9 = mem[0],zero
	subsd	%xmm9, %xmm7
	movsd	%xmm7, 16(%rsi)
	movsd	88(%rsp), %xmm1                 # xmm1 = mem[0],zero
	subsd	%xmm4, %xmm1
	movsd	96(%rsp), %xmm0                 # xmm0 = mem[0],zero
	subsd	%xmm8, %xmm0
	movsd	104(%rsp), %xmm5                # xmm5 = mem[0],zero
	subsd	%xmm9, %xmm5
	movsd	112(%rsp), %xmm3                # xmm3 = mem[0],zero
	subsd	%xmm4, %xmm3
	movsd	120(%rsp), %xmm4                # xmm4 = mem[0],zero
	subsd	%xmm8, %xmm4
	movsd	128(%rsp), %xmm8                # xmm8 = mem[0],zero
	subsd	%xmm9, %xmm8
	subsd	%xmm1, %xmm3
	subsd	%xmm6, %xmm1
	subsd	%xmm0, %xmm4
	subsd	%xmm2, %xmm0
	subsd	%xmm5, %xmm8
	subsd	%xmm7, %xmm5
	movapd	%xmm0, %xmm2
	mulsd	%xmm8, %xmm2
	movapd	%xmm5, %xmm6
	mulsd	%xmm4, %xmm6
	subsd	%xmm6, %xmm2
	movq	%rsp, %rdi
	movsd	%xmm2, (%rdi)
	mulsd	%xmm3, %xmm5
	mulsd	%xmm1, %xmm8
	subsd	%xmm8, %xmm5
	movsd	%xmm5, 8(%rdi)
	mulsd	%xmm1, %xmm4
	mulsd	%xmm3, %xmm0
	subsd	%xmm0, %xmm4
	movsd	%xmm4, 16(%rdi)
	callq	_Z15planeBoxOverlapPdS_S_
	addq	$56, %rsp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end12:
	.size	_Z13triBoxOverlapPdS_8Triangle, .Lfunc_end12-_Z13triBoxOverlapPdS_8Triangle
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z7TriAreaPdS_S_
.LCPI13_0:
	.quad	0x3fe0000000000000              # double 0.5
	.text
	.globl	_Z7TriAreaPdS_S_
	.type	_Z7TriAreaPdS_S_,@function
_Z7TriAreaPdS_S_:                       # @_Z7TriAreaPdS_S_
	.cfi_startproc
# %bb.0:
	movsd	(%rsi), %xmm1                   # xmm1 = mem[0],zero
	movsd	8(%rsi), %xmm3                  # xmm3 = mem[0],zero
	movsd	(%rdi), %xmm5                   # xmm5 = mem[0],zero
	movsd	8(%rdi), %xmm6                  # xmm6 = mem[0],zero
	subsd	%xmm5, %xmm1
	subsd	%xmm6, %xmm3
	movsd	16(%rsi), %xmm0                 # xmm0 = mem[0],zero
	movsd	16(%rdi), %xmm7                 # xmm7 = mem[0],zero
	subsd	%xmm7, %xmm0
	movsd	(%rdx), %xmm4                   # xmm4 = mem[0],zero
	movsd	8(%rdx), %xmm2                  # xmm2 = mem[0],zero
	subsd	%xmm5, %xmm4
	subsd	%xmm6, %xmm2
	movsd	16(%rdx), %xmm5                 # xmm5 = mem[0],zero
	subsd	%xmm7, %xmm5
	movapd	%xmm0, %xmm6
	mulsd	%xmm4, %xmm0
	mulsd	%xmm3, %xmm4
	mulsd	%xmm5, %xmm3
	mulsd	%xmm2, %xmm6
	subsd	%xmm6, %xmm3
	mulsd	%xmm1, %xmm5
	subsd	%xmm5, %xmm0
	mulsd	%xmm1, %xmm2
	subsd	%xmm4, %xmm2
	mulsd	%xmm3, %xmm3
	mulsd	%xmm0, %xmm0
	addsd	%xmm3, %xmm0
	mulsd	%xmm2, %xmm2
	addsd	%xmm0, %xmm2
	xorps	%xmm0, %xmm0
	sqrtsd	%xmm2, %xmm0
	mulsd	.LCPI13_0(%rip), %xmm0
	retq
.Lfunc_end13:
	.size	_Z7TriAreaPdS_S_, .Lfunc_end13-_Z7TriAreaPdS_S_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z13IsInPlaneTest3Ray8Triangled
.LCPI14_0:
	.quad	0x8000000000000000              # double -0
	.quad	0x8000000000000000              # double -0
	.text
	.globl	_Z13IsInPlaneTest3Ray8Triangled
	.type	_Z13IsInPlaneTest3Ray8Triangled,@function
_Z13IsInPlaneTest3Ray8Triangled:        # @_Z13IsInPlaneTest3Ray8Triangled
	.cfi_startproc
# %bb.0:
	movsd	104(%rsp), %xmm6                # xmm6 = mem[0],zero
	movsd	80(%rsp), %xmm5                 # xmm5 = mem[0],zero
	movsd	88(%rsp), %xmm4                 # xmm4 = mem[0],zero
	subsd	%xmm5, %xmm6
	movsd	112(%rsp), %xmm8                # xmm8 = mem[0],zero
	subsd	%xmm4, %xmm8
	movsd	120(%rsp), %xmm2                # xmm2 = mem[0],zero
	movsd	96(%rsp), %xmm3                 # xmm3 = mem[0],zero
	subsd	%xmm3, %xmm2
	movsd	128(%rsp), %xmm7                # xmm7 = mem[0],zero
	subsd	%xmm5, %xmm7
	movsd	136(%rsp), %xmm1                # xmm1 = mem[0],zero
	subsd	%xmm4, %xmm1
	movsd	144(%rsp), %xmm9                # xmm9 = mem[0],zero
	subsd	%xmm3, %xmm9
	movapd	%xmm2, %xmm10
	mulsd	%xmm7, %xmm2
	mulsd	%xmm8, %xmm7
	mulsd	%xmm9, %xmm8
	mulsd	%xmm1, %xmm10
	subsd	%xmm10, %xmm8
	mulsd	%xmm6, %xmm9
	subsd	%xmm9, %xmm2
	mulsd	%xmm6, %xmm1
	subsd	%xmm7, %xmm1
	movapd	.LCPI14_0(%rip), %xmm6          # xmm6 = [-0.0E+0,-0.0E+0]
	xorpd	%xmm8, %xmm6
	mulsd	%xmm5, %xmm6
	mulsd	%xmm2, %xmm4
	subsd	%xmm4, %xmm6
	mulsd	%xmm1, %xmm3
	mulsd	8(%rsp), %xmm8
	mulsd	16(%rsp), %xmm2
	subsd	%xmm3, %xmm6
	addsd	%xmm8, %xmm2
	mulsd	24(%rsp), %xmm1
	addsd	%xmm2, %xmm1
	addsd	%xmm6, %xmm1
	xorpd	%xmm2, %xmm2
	movapd	%xmm0, %xmm3
	addsd	%xmm2, %xmm3
	subsd	%xmm0, %xmm2
	cmplepd	%xmm1, %xmm2
	cmplepd	%xmm3, %xmm1
	andpd	%xmm2, %xmm1
	movd	%xmm1, %eax
	andb	$1, %al
                                        # kill: def $al killed $al killed $eax
	retq
.Lfunc_end14:
	.size	_Z13IsInPlaneTest3Ray8Triangled, .Lfunc_end14-_Z13IsInPlaneTest3Ray8Triangled
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z16PointIsInSurface3Ray8Triangled
.LCPI15_0:
	.quad	0xbff0000000000000              # double -1
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI15_1:
	.quad	0x8000000000000000              # double -0
	.quad	0x8000000000000000              # double -0
	.text
	.globl	_Z16PointIsInSurface3Ray8Triangled
	.type	_Z16PointIsInSurface3Ray8Triangled,@function
_Z16PointIsInSurface3Ray8Triangled:     # @_Z16PointIsInSurface3Ray8Triangled
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movapd	%xmm0, 32(%rsp)                 # 16-byte Spill
	leaq	192(%rsp), %rbx
	leaq	216(%rsp), %r14
	leaq	168(%rsp), %r15
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	callq	_Z7TriAreaPdS_S_
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	leaq	96(%rsp), %r12
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%rbx, %rdx
	callq	_Z7TriAreaPdS_S_
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_Z7TriAreaPdS_S_
	movsd	%xmm0, 16(%rsp)                 # 8-byte Spill
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	callq	_Z7TriAreaPdS_S_
	movsd	16(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	addsd	24(%rsp), %xmm1                 # 8-byte Folded Reload
	addsd	%xmm0, %xmm1
	movapd	%xmm1, %xmm0
	xorpd	%xmm1, %xmm1
	ucomisd	%xmm1, %xmm0
	jb	.LBB15_2
# %bb.1:
	sqrtsd	%xmm0, %xmm2
	jmp	.LBB15_3
.LBB15_2:                               # %call.sqrt
	callq	sqrt
	xorpd	%xmm1, %xmm1
	movapd	%xmm0, %xmm2
.LBB15_3:                               # %.split
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	ucomisd	%xmm1, %xmm0
	jb	.LBB15_5
# %bb.4:
	sqrtsd	%xmm0, %xmm0
	jmp	.LBB15_6
.LBB15_5:                               # %call.sqrt9
	movapd	%xmm2, (%rsp)                   # 16-byte Spill
	callq	sqrt
	movapd	(%rsp), %xmm2                   # 16-byte Reload
.LBB15_6:                               # %.split.split
	divsd	%xmm0, %xmm2
	addsd	.LCPI15_0(%rip), %xmm2
	movapd	.LCPI15_1(%rip), %xmm0          # xmm0 = [-0.0E+0,-0.0E+0]
	movapd	32(%rsp), %xmm1                 # 16-byte Reload
	xorpd	%xmm1, %xmm0
	cmplepd	%xmm2, %xmm0
	cmplepd	%xmm1, %xmm2
	andpd	%xmm0, %xmm2
	movd	%xmm2, %eax
	andb	$1, %al
                                        # kill: def $al killed $al killed $eax
	addq	$56, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end15:
	.size	_Z16PointIsInSurface3Ray8Triangled, .Lfunc_end15-_Z16PointIsInSurface3Ray8Triangled
	.cfi_endproc
                                        # -- End function
	.globl	_Z24rayBoxIntersection_yaxisPd4Cube # -- Begin function _Z24rayBoxIntersection_yaxisPd4Cube
	.type	_Z24rayBoxIntersection_yaxisPd4Cube,@function
_Z24rayBoxIntersection_yaxisPd4Cube:    # @_Z24rayBoxIntersection_yaxisPd4Cube
	.cfi_startproc
# %bb.0:
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	8(%rsp), %xmm1                  # xmm1 = mem[0],zero
	xorl	%eax, %eax
	ucomisd	%xmm0, %xmm1
	ja	.LBB16_5
# %bb.1:
	ucomisd	16(%rsp), %xmm0
	ja	.LBB16_5
# %bb.2:
	leaq	8(%rsp), %rcx
	movsd	32(%rcx), %xmm1                 # xmm1 = mem[0],zero
	movsd	16(%rdi), %xmm0                 # xmm0 = mem[0],zero
	ucomisd	%xmm0, %xmm1
	ja	.LBB16_5
# %bb.3:
	ucomisd	40(%rcx), %xmm0
	ja	.LBB16_5
# %bb.4:
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	xorl	%eax, %eax
	ucomisd	32(%rsp), %xmm0
	setbe	%al
.LBB16_5:
	retq
.Lfunc_end16:
	.size	_Z24rayBoxIntersection_yaxisPd4Cube, .Lfunc_end16-_Z24rayBoxIntersection_yaxisPd4Cube
	.cfi_endproc
                                        # -- End function
	.globl	_Z32__device_stub__TriangleCount_GPUP8TriangleP4CubePiS3_Pb # -- Begin function _Z32__device_stub__TriangleCount_GPUP8TriangleP4CubePiS3_Pb
	.type	_Z32__device_stub__TriangleCount_GPUP8TriangleP4CubePiS3_Pb,@function
_Z32__device_stub__TriangleCount_GPUP8TriangleP4CubePiS3_Pb: # @_Z32__device_stub__TriangleCount_GPUP8TriangleP4CubePiS3_Pb
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end17:
	.size	_Z32__device_stub__TriangleCount_GPUP8TriangleP4CubePiS3_Pb, .Lfunc_end17-_Z32__device_stub__TriangleCount_GPUP8TriangleP4CubePiS3_Pb
	.cfi_endproc
                                        # -- End function
	.globl	_Z24__device_stub__calcAllocP4CubePiS1_S1_S1_ # -- Begin function _Z24__device_stub__calcAllocP4CubePiS1_S1_S1_
	.type	_Z24__device_stub__calcAllocP4CubePiS1_S1_S1_,@function
_Z24__device_stub__calcAllocP4CubePiS1_S1_S1_: # @_Z24__device_stub__calcAllocP4CubePiS1_S1_S1_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z9calcAllocP4CubePiS1_S1_S1_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end18:
	.size	_Z24__device_stub__calcAllocP4CubePiS1_S1_S1_, .Lfunc_end18-_Z24__device_stub__calcAllocP4CubePiS1_S1_S1_
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__findUniqueP4CubePiS1_PbS1_S1_ # -- Begin function _Z25__device_stub__findUniqueP4CubePiS1_PbS1_S1_
	.type	_Z25__device_stub__findUniqueP4CubePiS1_PbS1_S1_,@function
_Z25__device_stub__findUniqueP4CubePiS1_PbS1_S1_: # @_Z25__device_stub__findUniqueP4CubePiS1_PbS1_S1_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	16(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z10findUniqueP4CubePiS1_PbS1_S1_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end19:
	.size	_Z25__device_stub__findUniqueP4CubePiS1_PbS1_S1_, .Lfunc_end19-_Z25__device_stub__findUniqueP4CubePiS1_PbS1_S1_
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__appendTrianglesP4CubePiS1_S1_S1_Pb # -- Begin function _Z30__device_stub__appendTrianglesP4CubePiS1_S1_S1_Pb
	.type	_Z30__device_stub__appendTrianglesP4CubePiS1_S1_S1_Pb,@function
_Z30__device_stub__appendTrianglesP4CubePiS1_S1_S1_Pb: # @_Z30__device_stub__appendTrianglesP4CubePiS1_S1_S1_Pb
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	16(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z15appendTrianglesP4CubePiS1_S1_S1_Pb, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end20:
	.size	_Z30__device_stub__appendTrianglesP4CubePiS1_S1_S1_Pb, .Lfunc_end20-_Z30__device_stub__appendTrianglesP4CubePiS1_S1_S1_Pb
	.cfi_endproc
                                        # -- End function
	.globl	_Z38__device_stub__getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_ # -- Begin function _Z38__device_stub__getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
	.type	_Z38__device_stub__getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_,@function
_Z38__device_stub__getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_: # @_Z38__device_stub__getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	16(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end21:
	.size	_Z38__device_stub__getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_, .Lfunc_end21-_Z38__device_stub__getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
	.cfi_endproc
                                        # -- End function
	.globl	_Z29__device_stub__ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube # -- Begin function _Z29__device_stub__ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
	.type	_Z29__device_stub__ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube,@function
_Z29__device_stub__ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube: # @_Z29__device_stub__ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	16(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end22:
	.size	_Z29__device_stub__ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube, .Lfunc_end22-_Z29__device_stub__ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
	.cfi_endproc
                                        # -- End function
	.globl	_Z27__device_stub__IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube # -- Begin function _Z27__device_stub__IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
	.type	_Z27__device_stub__IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube,@function
_Z27__device_stub__IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube: # @_Z27__device_stub__IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	16(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end23:
	.size	_Z27__device_stub__IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube, .Lfunc_end23-_Z27__device_stub__IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
	.cfi_endproc
                                        # -- End function
	.globl	_Z24__device_stub__appendALLP4CubePiS1_PbP8Triangle # -- Begin function _Z24__device_stub__appendALLP4CubePiS1_PbP8Triangle
	.type	_Z24__device_stub__appendALLP4CubePiS1_PbP8Triangle,@function
_Z24__device_stub__appendALLP4CubePiS1_PbP8Triangle: # @_Z24__device_stub__appendALLP4CubePiS1_PbP8Triangle
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z9appendALLP4CubePiS1_PbP8Triangle, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end24:
	.size	_Z24__device_stub__appendALLP4CubePiS1_PbP8Triangle, .Lfunc_end24-_Z24__device_stub__appendALLP4CubePiS1_PbP8Triangle
	.cfi_endproc
                                        # -- End function
	.globl	_Z24__device_stub__firstCubeP4CubeP3RayP8TrianglePiS5_ # -- Begin function _Z24__device_stub__firstCubeP4CubeP3RayP8TrianglePiS5_
	.type	_Z24__device_stub__firstCubeP4CubeP3RayP8TrianglePiS5_,@function
_Z24__device_stub__firstCubeP4CubeP3RayP8TrianglePiS5_: # @_Z24__device_stub__firstCubeP4CubeP3RayP8TrianglePiS5_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z9firstCubeP4CubeP3RayP8TrianglePiS5_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end25:
	.size	_Z24__device_stub__firstCubeP4CubeP3RayP8TrianglePiS5_, .Lfunc_end25-_Z24__device_stub__firstCubeP4CubeP3RayP8TrianglePiS5_
	.cfi_endproc
                                        # -- End function
	.globl	SetRays                         # -- Begin function SetRays
	.type	SetRays,@function
SetRays:                                # @SetRays
	.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
	movl	%esi, numRays(%rip)
	movslq	%esi, %r14
	leaq	(,%r14,8), %rax
	leaq	(%rax,%rax,8), %rdi
	callq	malloc
	movq	%rax, rays(%rip)
	testl	%r14d, %r14d
	jle	.LBB26_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebp, %ecx
	addq	$8, %rbx
	shlq	$3, %rcx
	leaq	(%rcx,%rcx,8), %rcx
	xorl	%edx, %edx
	movabsq	$4551510721646314285, %rsi      # imm = 0x3F2A36E2EB1C432D
	movabsq	$4607182418800017408, %rdi      # imm = 0x3FF0000000000000
.LBB26_2:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	-8(%rbx), %xmm0
	movsd	%xmm0, (%rax,%rdx)
	xorps	%xmm0, %xmm0
	cvtss2sd	-4(%rbx), %xmm0
	movsd	%xmm0, 8(%rax,%rdx)
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx), %xmm0
	movsd	%xmm0, 16(%rax,%rdx)
	movq	%rsi, 24(%rax,%rdx)
	movq	%rdi, 32(%rax,%rdx)
	movq	%rsi, 40(%rax,%rdx)
	addq	$12, %rbx
	addq	$72, %rdx
	cmpq	%rdx, %rcx
	jne	.LBB26_2
.LBB26_3:                               # %._crit_edge
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end26:
	.size	SetRays, .Lfunc_end26-SetRays
	.cfi_endproc
                                        # -- End function
	.globl	SetTriangles                    # -- Begin function SetTriangles
	.type	SetTriangles,@function
SetTriangles:                           # @SetTriangles
	.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
	movl	%esi, numTriangles(%rip)
	movslq	%esi, %r14
	leaq	(,%r14,8), %rax
	leaq	(%rax,%rax,8), %rdi
	callq	malloc
	movq	%rax, triangles(%rip)
	testl	%r14d, %r14d
	jle	.LBB27_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebp, %ecx
	shlq	$3, %rcx
	leaq	(%rcx,%rcx,8), %rcx
	xorl	%edx, %edx
.LBB27_2:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%rbx,%rdx), %xmm0              # xmm0 = mem[0],zero
	movsd	%xmm0, (%rax,%rdx)
	movsd	8(%rbx,%rdx), %xmm0             # xmm0 = mem[0],zero
	movsd	%xmm0, 8(%rax,%rdx)
	movsd	16(%rbx,%rdx), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, 16(%rax,%rdx)
	movsd	24(%rbx,%rdx), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, 24(%rax,%rdx)
	movsd	32(%rbx,%rdx), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, 32(%rax,%rdx)
	movsd	40(%rbx,%rdx), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, 40(%rax,%rdx)
	movsd	48(%rbx,%rdx), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, 48(%rax,%rdx)
	movsd	56(%rbx,%rdx), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, 56(%rax,%rdx)
	movsd	64(%rbx,%rdx), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, 64(%rax,%rdx)
	addq	$72, %rdx
	cmpq	%rdx, %rcx
	jne	.LBB27_2
.LBB27_3:                               # %._crit_edge
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end27:
	.size	SetTriangles, .Lfunc_end27-SetTriangles
	.cfi_endproc
                                        # -- End function
	.globl	_Z14printTrianglesv             # -- Begin function _Z14printTrianglesv
	.type	_Z14printTrianglesv,@function
_Z14printTrianglesv:                    # @_Z14printTrianglesv
	.cfi_startproc
# %bb.0:
	cmpl	$0, numTriangles(%rip)
	jle	.LBB28_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	xorl	%r14d, %r14d
	xorl	%ebx, %ebx
.LBB28_2:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	triangles(%rip), %rax
	movsd	(%rax,%r14), %xmm0              # xmm0 = mem[0],zero
	movsd	8(%rax,%r14), %xmm1             # xmm1 = mem[0],zero
	movsd	16(%rax,%r14), %xmm2            # xmm2 = mem[0],zero
	movl	$.L.str.5, %edi
	movl	%ebx, %esi
	movb	$3, %al
	callq	printf
	movq	triangles(%rip), %rax
	movsd	24(%rax,%r14), %xmm0            # xmm0 = mem[0],zero
	movsd	32(%rax,%r14), %xmm1            # xmm1 = mem[0],zero
	movsd	40(%rax,%r14), %xmm2            # xmm2 = mem[0],zero
	movl	$.L.str.5, %edi
	movl	%ebx, %esi
	movb	$3, %al
	callq	printf
	movq	triangles(%rip), %rax
	movsd	48(%rax,%r14), %xmm0            # xmm0 = mem[0],zero
	movsd	56(%rax,%r14), %xmm1            # xmm1 = mem[0],zero
	movsd	64(%rax,%r14), %xmm2            # xmm2 = mem[0],zero
	movl	$.L.str.5, %edi
	movl	%ebx, %esi
	movb	$3, %al
	callq	printf
	incq	%rbx
	movslq	numTriangles(%rip), %rax
	addq	$72, %r14
	cmpq	%rax, %rbx
	jl	.LBB28_2
# %bb.3:
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
.LBB28_4:                               # %._crit_edge
	retq
.Lfunc_end28:
	.size	_Z14printTrianglesv, .Lfunc_end28-_Z14printTrianglesv
	.cfi_endproc
                                        # -- End function
	.globl	SetBoundingBox                  # -- Begin function SetBoundingBox
	.type	SetBoundingBox,@function
SetBoundingBox:                         # @SetBoundingBox
	.cfi_startproc
# %bb.0:
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, boundingBox(%rip)
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, boundingBox+8(%rip)
	movsd	(%rsi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, boundingBox+16(%rip)
	movsd	8(%rsi), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, boundingBox+24(%rip)
	movsd	(%rdx), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, boundingBox+32(%rip)
	movsd	8(%rdx), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, boundingBox+40(%rip)
	retq
.Lfunc_end29:
	.size	SetBoundingBox, .Lfunc_end29-SetBoundingBox
	.cfi_endproc
                                        # -- End function
	.globl	_Z13TriangleCountP8TriangleP4CubeiiPb # -- Begin function _Z13TriangleCountP8TriangleP4CubeiiPb
	.type	_Z13TriangleCountP8TriangleP4CubeiiPb,@function
_Z13TriangleCountP8TriangleP4CubeiiPb:  # @_Z13TriangleCountP8TriangleP4CubeiiPb
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r8, 88(%rsp)                   # 8-byte Spill
	movl	%ecx, 76(%rsp)                  # 4-byte Spill
	movq	%rsi, 80(%rsp)                  # 8-byte Spill
	movq	%rdi, 104(%rsp)                 # 8-byte Spill
	testl	%edx, %edx
	jle	.LBB30_6
# %bb.1:                                # %.lr.ph27
	movl	%edx, %r12d
	movl	76(%rsp), %eax                  # 4-byte Reload
	movq	%rax, 96(%rsp)                  # 8-byte Spill
	xorl	%eax, %eax
.LBB30_2:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB30_4 Depth 2
	movq	%rax, 112(%rsp)                 # 8-byte Spill
	imulq	$120, %rax, %rax
	movq	80(%rsp), %rcx                  # 8-byte Reload
	movl	$0, 100(%rcx,%rax)
	cmpl	$0, 76(%rsp)                    # 4-byte Folded Reload
	jle	.LBB30_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB30_2 Depth=1
	movq	80(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax), %rsi
	addq	$100, %rsi
	movq	%rsi, 128(%rsp)                 # 8-byte Spill
	leaq	(%rcx,%rax), %rsi
	addq	$72, %rsi
	movq	%rsi, 120(%rsp)                 # 8-byte Spill
	leaq	(%rcx,%rax), %r13
	addq	$48, %r13
	xorl	%r14d, %r14d
	movq	96(%rsp), %rbp                  # 8-byte Reload
	movq	104(%rsp), %r15                 # 8-byte Reload
	movq	88(%rsp), %rbx                  # 8-byte Reload
.LBB30_4:                               #   Parent Loop BB30_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$9, %ecx
	movq	%rsp, %rdi
	movq	%r15, %rsi
	rep;movsq (%rsi), %es:(%rdi)
	movq	120(%rsp), %rdi                 # 8-byte Reload
	movq	%r13, %rsi
	callq	_Z13triBoxOverlapPdS_8Triangle
	movb	%al, (%rbx)
	addl	%eax, %r14d
	movq	128(%rsp), %rax                 # 8-byte Reload
	movl	%r14d, (%rax)
	addq	%r12, %rbx
	addq	$72, %r15
	decq	%rbp
	jne	.LBB30_4
.LBB30_5:                               # %._crit_edge
                                        #   in Loop: Header=BB30_2 Depth=1
	movq	112(%rsp), %rax                 # 8-byte Reload
	incq	%rax
	incq	88(%rsp)                        # 8-byte Folded Spill
	cmpq	%r12, %rax
	jne	.LBB30_2
.LBB30_6:                               # %._crit_edge28
	addq	$136, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end30:
	.size	_Z13TriangleCountP8TriangleP4CubeiiPb, .Lfunc_end30-_Z13TriangleCountP8TriangleP4CubeiiPb
	.cfi_endproc
                                        # -- End function
	.globl	_Z13appendALL_CPUP4CubeiiPbP8Triangle # -- Begin function _Z13appendALL_CPUP4CubeiiPbP8Triangle
	.type	_Z13appendALL_CPUP4CubeiiPbP8Triangle,@function
_Z13appendALL_CPUP4CubeiiPbP8Triangle:  # @_Z13appendALL_CPUP4CubeiiPbP8Triangle
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB31_7
# %bb.1:                                # %.lr.ph25
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movl	%esi, %eax
	movl	%edx, %esi
	xorl	%r8d, %r8d
.LBB31_2:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB31_4 Depth 2
	imulq	$120, %r8, %r9
	movl	$0, 112(%rdi,%r9)
	testl	%edx, %edx
	jle	.LBB31_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB31_2 Depth=1
	addq	%rdi, %r9
	addq	$112, %r9
	movq	-8(%r9), %r10
	xorl	%ebx, %ebx
	movq	%rcx, %r11
	xorl	%r14d, %r14d
.LBB31_4:                               #   Parent Loop BB31_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movslq	%ebx, %rbx
	movl	%r14d, (%r10,%rbx,4)
	movzbl	(%r11), %ebx
	addl	(%r9), %ebx
	movl	%ebx, (%r9)
	incq	%r14
	addq	%rax, %r11
	cmpq	%r14, %rsi
	jne	.LBB31_4
.LBB31_5:                               # %._crit_edge
                                        #   in Loop: Header=BB31_2 Depth=1
	incq	%r8
	incq	%rcx
	cmpq	%rax, %r8
	jne	.LBB31_2
# %bb.6:
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
.LBB31_7:                               # %._crit_edge26
	retq
.Lfunc_end31:
	.size	_Z13appendALL_CPUP4CubeiiPbP8Triangle, .Lfunc_end31-_Z13appendALL_CPUP4CubeiiPbP8Triangle
	.cfi_endproc
                                        # -- End function
	.globl	_Z13firstCube_CPUP4CubeP3RayP8Triangleii # -- Begin function _Z13firstCube_CPUP4CubeP3RayP8Triangleii
	.type	_Z13firstCube_CPUP4CubeP3RayP8Triangleii,@function
_Z13firstCube_CPUP4CubeP3RayP8Triangleii: # @_Z13firstCube_CPUP4CubeP3RayP8Triangleii
	.cfi_startproc
# %bb.0:
	testl	%ecx, %ecx
	jle	.LBB32_13
# %bb.1:                                # %.lr.ph27
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	%ecx, %eax
	xorl	%ecx, %ecx
.LBB32_2:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB32_4 Depth 2
	leaq	(%rcx,%rcx,8), %rdx
	movl	$0, 64(%rsi,%rdx,8)
	testl	%r8d, %r8d
	jle	.LBB32_11
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB32_2 Depth=1
	leaq	(%rsi,%rdx,8), %rdx
	addq	$64, %rdx
	movsd	-64(%rdx), %xmm0                # xmm0 = mem[0],zero
	xorl	%r9d, %r9d
	xorl	%r10d, %r10d
.LBB32_4:                               #   Parent Loop BB32_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movslq	%r10d, %r11
	imulq	$120, %r11, %r11
	movsd	(%rdi,%r11), %xmm1              # xmm1 = mem[0],zero
	ucomisd	%xmm0, %xmm1
	ja	.LBB32_10
# %bb.5:                                #   in Loop: Header=BB32_4 Depth=2
	ucomisd	8(%rdi,%r11), %xmm0
	ja	.LBB32_10
# %bb.6:                                #   in Loop: Header=BB32_4 Depth=2
	leaq	(%rdi,%r11), %rbx
	movsd	32(%rbx), %xmm2                 # xmm2 = mem[0],zero
	movsd	-48(%rdx), %xmm1                # xmm1 = mem[0],zero
	ucomisd	%xmm1, %xmm2
	ja	.LBB32_10
# %bb.7:                                #   in Loop: Header=BB32_4 Depth=2
	ucomisd	40(%rbx), %xmm1
	ja	.LBB32_10
# %bb.8:                                # %_Z24rayBoxIntersection_yaxisPd4Cube.exit
                                        #   in Loop: Header=BB32_4 Depth=2
	movsd	-56(%rdx), %xmm1                # xmm1 = mem[0],zero
	ucomisd	24(%rdi,%r11), %xmm1
	ja	.LBB32_10
# %bb.9:                                #   in Loop: Header=BB32_4 Depth=2
	movslq	%r9d, %r9
	movl	%r10d, -16(%rdx,%r9,4)
	movl	(%rdx), %r9d
	incl	%r9d
	movl	%r9d, (%rdx)
	addl	%r8d, %r10d
.LBB32_10:                              # %_Z24rayBoxIntersection_yaxisPd4Cube.exit.thread
                                        #   in Loop: Header=BB32_4 Depth=2
	incl	%r10d
	cmpl	%r8d, %r10d
	jl	.LBB32_4
.LBB32_11:                              # %._crit_edge
                                        #   in Loop: Header=BB32_2 Depth=1
	incq	%rcx
	cmpq	%rax, %rcx
	jne	.LBB32_2
# %bb.12:
	popq	%rbx
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
.LBB32_13:                              # %._crit_edge28
	retq
.Lfunc_end32:
	.size	_Z13firstCube_CPUP4CubeP3RayP8Triangleii, .Lfunc_end32-_Z13firstCube_CPUP4CubeP3RayP8Triangleii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z9IsInPlaneP3RayP8TrianglePbiP4Cube
.LCPI33_0:
	.quad	0x3fe0000000000000              # double 0.5
.LCPI33_1:
	.quad	0xbff0000000000000              # double -1
.LCPI33_2:
	.quad	0xbddb7cdfd9d7bdbb              # double -1.0E-10
.LCPI33_3:
	.quad	0x3ddb7cdfd9d7bdbb              # double 1.0E-10
	.text
	.globl	_Z9IsInPlaneP3RayP8TrianglePbiP4Cube
	.type	_Z9IsInPlaneP3RayP8TrianglePbiP4Cube,@function
_Z9IsInPlaneP3RayP8TrianglePbiP4Cube:   # @_Z9IsInPlaneP3RayP8TrianglePbiP4Cube
	.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
	movq	%rdx, 24(%rsp)                  # 8-byte Spill
	testl	%ecx, %ecx
	jle	.LBB33_7
# %bb.1:                                # %.lr.ph68.preheader
	movq	%r8, %rbx
	movq	%rsi, %r15
	movl	%ecx, %eax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	xorl	%ebp, %ebp
	movsd	.LCPI33_0(%rip), %xmm13         # xmm13 = mem[0],zero
	xorpd	%xmm14, %xmm14
	movq	%rdi, 16(%rsp)                  # 8-byte Spill
.LBB33_2:                               # %.lr.ph68
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB33_9 Depth 2
	leaq	(,%rbp,8), %rcx
	addq	%rbp, %rcx
	cmpl	$0, 64(%rdi,%rcx,8)
	jle	.LBB33_6
# %bb.3:                                # %.preheader
                                        #   in Loop: Header=BB33_2 Depth=1
	movslq	48(%rdi,%rcx,8), %rax
	imulq	$120, %rax, %rdx
	cmpl	$0, 112(%rbx,%rdx)
	jle	.LBB33_4
# %bb.8:                                # %.lr.ph
                                        #   in Loop: Header=BB33_2 Depth=1
	leaq	(%rdi,%rcx,8), %r13
	xorl	%r12d, %r12d
	xorl	%r14d, %r14d
.LBB33_9:                               #   Parent Loop BB33_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%r13), %xmm5                   # xmm5 = mem[0],zero
	movsd	8(%r13), %xmm9                  # xmm9 = mem[0],zero
	movsd	16(%r13), %xmm7                 # xmm7 = mem[0],zero
	imulq	$120, %rax, %rax
	movq	104(%rbx,%rax), %rax
	movslq	%r12d, %rcx
	movslq	(%rax,%rcx,4), %rax
	leaq	(%rax,%rax,8), %rax
	movsd	(%r15,%rax,8), %xmm3            # xmm3 = mem[0],zero
	movsd	8(%r15,%rax,8), %xmm6           # xmm6 = mem[0],zero
	movsd	16(%r15,%rax,8), %xmm4          # xmm4 = mem[0],zero
	movsd	24(%r15,%rax,8), %xmm10         # xmm10 = mem[0],zero
	movsd	32(%r15,%rax,8), %xmm1          # xmm1 = mem[0],zero
	movsd	40(%r15,%rax,8), %xmm15         # xmm15 = mem[0],zero
	movsd	%xmm3, 72(%rsp)                 # 8-byte Spill
	subsd	%xmm5, %xmm3
	movsd	%xmm6, 80(%rsp)                 # 8-byte Spill
	subsd	%xmm9, %xmm6
	movsd	%xmm4, 88(%rsp)                 # 8-byte Spill
	subsd	%xmm7, %xmm4
	movsd	%xmm1, (%rsp)                   # 8-byte Spill
	subsd	%xmm9, %xmm1
	movapd	%xmm15, %xmm0
	subsd	%xmm7, %xmm0
	movapd	%xmm6, %xmm8
	mulsd	%xmm0, %xmm8
	movapd	%xmm4, %xmm2
	mulsd	%xmm1, %xmm2
	subsd	%xmm2, %xmm8
	movsd	%xmm10, 96(%rsp)                # 8-byte Spill
	movapd	%xmm10, %xmm2
	subsd	%xmm5, %xmm2
	movapd	%xmm4, %xmm11
	mulsd	%xmm2, %xmm11
	movapd	%xmm3, %xmm10
	mulsd	%xmm0, %xmm10
	subsd	%xmm10, %xmm11
	movapd	%xmm3, %xmm10
	mulsd	%xmm1, %xmm10
	movapd	%xmm6, %xmm12
	mulsd	%xmm2, %xmm12
	subsd	%xmm12, %xmm10
	mulsd	%xmm8, %xmm8
	mulsd	%xmm11, %xmm11
	addsd	%xmm8, %xmm11
	mulsd	%xmm10, %xmm10
	addsd	%xmm11, %xmm10
	movsd	48(%r15,%rax,8), %xmm8          # xmm8 = mem[0],zero
	movsd	%xmm8, 64(%rsp)                 # 8-byte Spill
	subsd	%xmm5, %xmm8
	movsd	56(%r15,%rax,8), %xmm12         # xmm12 = mem[0],zero
	movapd	%xmm12, %xmm5
	subsd	%xmm9, %xmm5
	movsd	64(%r15,%rax,8), %xmm9          # xmm9 = mem[0],zero
	movsd	%xmm9, 56(%rsp)                 # 8-byte Spill
	subsd	%xmm7, %xmm9
	movapd	%xmm6, %xmm7
	mulsd	%xmm9, %xmm7
	movapd	%xmm4, %xmm11
	mulsd	%xmm5, %xmm11
	subsd	%xmm11, %xmm7
	mulsd	%xmm8, %xmm4
	movapd	%xmm3, %xmm11
	mulsd	%xmm9, %xmm11
	subsd	%xmm11, %xmm4
	mulsd	%xmm5, %xmm3
	mulsd	%xmm8, %xmm6
	subsd	%xmm6, %xmm3
	mulsd	%xmm7, %xmm7
	mulsd	%xmm4, %xmm4
	addsd	%xmm7, %xmm4
	mulsd	%xmm3, %xmm3
	addsd	%xmm4, %xmm3
	xorps	%xmm4, %xmm4
	sqrtsd	%xmm10, %xmm4
	mulsd	%xmm13, %xmm4
	sqrtsd	%xmm3, %xmm3
	mulsd	%xmm13, %xmm3
	addsd	%xmm4, %xmm3
	movapd	%xmm0, %xmm4
	mulsd	%xmm8, %xmm0
	mulsd	%xmm1, %xmm8
	mulsd	%xmm9, %xmm1
	mulsd	%xmm5, %xmm4
	subsd	%xmm4, %xmm1
	mulsd	%xmm2, %xmm9
	subsd	%xmm9, %xmm0
	mulsd	%xmm2, %xmm5
	subsd	%xmm8, %xmm5
	mulsd	%xmm1, %xmm1
	mulsd	%xmm0, %xmm0
	addsd	%xmm1, %xmm0
	mulsd	%xmm5, %xmm5
	addsd	%xmm0, %xmm5
	xorps	%xmm0, %xmm0
	sqrtsd	%xmm5, %xmm0
	mulsd	%xmm13, %xmm0
	addsd	%xmm3, %xmm0
	ucomisd	%xmm14, %xmm0
	jb	.LBB33_11
# %bb.10:                               #   in Loop: Header=BB33_9 Depth=2
	xorps	%xmm6, %xmm6
	sqrtsd	%xmm0, %xmm6
	jmp	.LBB33_12
.LBB33_11:                              # %call.sqrt
                                        #   in Loop: Header=BB33_9 Depth=2
	movsd	%xmm15, 48(%rsp)                # 8-byte Spill
	movsd	%xmm12, 40(%rsp)                # 8-byte Spill
	callq	sqrt
	movsd	40(%rsp), %xmm12                # 8-byte Reload
                                        # xmm12 = mem[0],zero
	movsd	48(%rsp), %xmm15                # 8-byte Reload
                                        # xmm15 = mem[0],zero
	xorpd	%xmm14, %xmm14
	movsd	.LCPI33_0(%rip), %xmm13         # xmm13 = mem[0],zero
	movapd	%xmm0, %xmm6
.LBB33_12:                              # %.split
                                        #   in Loop: Header=BB33_9 Depth=2
	movsd	96(%rsp), %xmm3                 # 8-byte Reload
                                        # xmm3 = mem[0],zero
	movsd	72(%rsp), %xmm4                 # 8-byte Reload
                                        # xmm4 = mem[0],zero
	subsd	%xmm4, %xmm3
	movsd	(%rsp), %xmm2                   # 8-byte Reload
                                        # xmm2 = mem[0],zero
	movsd	80(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	subsd	%xmm1, %xmm2
	movsd	88(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	subsd	%xmm0, %xmm15
	movsd	64(%rsp), %xmm5                 # 8-byte Reload
                                        # xmm5 = mem[0],zero
	subsd	%xmm4, %xmm5
	subsd	%xmm1, %xmm12
	movsd	56(%rsp), %xmm4                 # 8-byte Reload
                                        # xmm4 = mem[0],zero
	subsd	%xmm0, %xmm4
	movapd	%xmm2, %xmm0
	mulsd	%xmm4, %xmm0
	movapd	%xmm15, %xmm1
	mulsd	%xmm12, %xmm1
	subsd	%xmm1, %xmm0
	mulsd	%xmm5, %xmm15
	mulsd	%xmm3, %xmm4
	subsd	%xmm4, %xmm15
	mulsd	%xmm3, %xmm12
	mulsd	%xmm2, %xmm5
	subsd	%xmm5, %xmm12
	mulsd	%xmm0, %xmm0
	mulsd	%xmm15, %xmm15
	addsd	%xmm0, %xmm15
	mulsd	%xmm12, %xmm12
	addsd	%xmm15, %xmm12
	xorps	%xmm0, %xmm0
	sqrtsd	%xmm12, %xmm0
	mulsd	%xmm13, %xmm0
	ucomisd	%xmm14, %xmm0
	jb	.LBB33_14
# %bb.13:                               #   in Loop: Header=BB33_9 Depth=2
	sqrtsd	%xmm0, %xmm0
	jmp	.LBB33_15
.LBB33_14:                              # %call.sqrt71
                                        #   in Loop: Header=BB33_9 Depth=2
	movapd	%xmm6, (%rsp)                   # 16-byte Spill
	callq	sqrt
	movapd	(%rsp), %xmm6                   # 16-byte Reload
	xorpd	%xmm14, %xmm14
	movsd	.LCPI33_0(%rip), %xmm13         # xmm13 = mem[0],zero
.LBB33_15:                              # %.split.split
                                        #   in Loop: Header=BB33_9 Depth=2
	divsd	%xmm0, %xmm6
	addsd	.LCPI33_1(%rip), %xmm6
	movsd	.LCPI33_2(%rip), %xmm0          # xmm0 = mem[0],zero
	cmplepd	%xmm6, %xmm0
	movsd	.LCPI33_3(%rip), %xmm1          # xmm1 = mem[0],zero
	cmplepd	%xmm1, %xmm6
	andpd	%xmm0, %xmm6
	movd	%xmm6, %eax
	subl	%eax, %r14d
	movslq	48(%r13), %rax
	imulq	$120, %rax, %rcx
	movl	112(%rbx,%rcx), %ecx
	movl	%r14d, %edx
	imull	%ecx, %edx
	addl	%edx, %r12d
	incl	%r12d
	cmpl	%ecx, %r12d
	jl	.LBB33_9
	jmp	.LBB33_5
.LBB33_4:                               #   in Loop: Header=BB33_2 Depth=1
	xorl	%r14d, %r14d
.LBB33_5:                               # %._crit_edge
                                        #   in Loop: Header=BB33_2 Depth=1
	testl	%r14d, %r14d
	movq	24(%rsp), %rax                  # 8-byte Reload
	setne	(%rax,%rbp)
	movq	16(%rsp), %rdi                  # 8-byte Reload
.LBB33_6:                               #   in Loop: Header=BB33_2 Depth=1
	incq	%rbp
	cmpq	32(%rsp), %rbp                  # 8-byte Folded Reload
	jne	.LBB33_2
.LBB33_7:                               # %._crit_edge69
	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_end33:
	.size	_Z9IsInPlaneP3RayP8TrianglePbiP4Cube, .Lfunc_end33-_Z9IsInPlaneP3RayP8TrianglePbiP4Cube
	.cfi_endproc
                                        # -- End function
	.globl	_Z14findUnique_CPUP4CubeiiPbii  # -- Begin function _Z14findUnique_CPUP4CubeiiPbii
	.type	_Z14findUnique_CPUP4CubeiiPbii,@function
_Z14findUnique_CPUP4CubeiiPbii:         # @_Z14findUnique_CPUP4CubeiiPbii
	.cfi_startproc
# %bb.0:
                                        # kill: def $edx killed $edx def $rdx
	testl	%r8d, %r8d
	jle	.LBB34_7
# %bb.1:                                # %.preheader.lr.ph
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movslq	%esi, %rax
	subl	%edx, %esi
	incl	%esi
	imulq	$120, %rax, %r10
	addq	%r10, %rdi
	addq	$112, %rdi
	movl	(%rdi), %r10d
	movslq	%esi, %r11
	movslq	%r9d, %r9
	movl	%r8d, %r8d
	addq	%rcx, %r11
	decl	%edx
	xorl	%ebx, %ebx
.LBB34_2:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB34_4 Depth 2
	movq	%rbx, %r14
	imulq	%r9, %r14
	addq	%rax, %r14
	cmpl	%eax, %esi
	jge	.LBB34_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB34_2 Depth=1
	movb	(%rcx,%r14), %bpl
	xorl	%r15d, %r15d
.LBB34_4:                               #   Parent Loop BB34_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	orb	(%r11,%r15), %bpl
	movb	%bpl, (%rcx,%r14)
	incq	%r15
	cmpl	%r15d, %edx
	jne	.LBB34_4
.LBB34_5:                               # %._crit_edge
                                        #   in Loop: Header=BB34_2 Depth=1
	movzbl	(%rcx,%r14), %ebp
	addl	%ebp, %r10d
	incq	%rbx
	addq	%r9, %r11
	cmpq	%r8, %rbx
	jne	.LBB34_2
# %bb.6:                                # %._crit_edge27
	movl	%r10d, (%rdi)
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
.LBB34_7:
	retq
.Lfunc_end34:
	.size	_Z14findUnique_CPUP4CubeiiPbii, .Lfunc_end34-_Z14findUnique_CPUP4CubeiiPbii
	.cfi_endproc
                                        # -- End function
	.globl	_Z19appendTriangles_CPUP4CubePiiiiPb # -- Begin function _Z19appendTriangles_CPUP4CubePiiiiPb
	.type	_Z19appendTriangles_CPUP4CubePiiiiPb,@function
_Z19appendTriangles_CPUP4CubePiiiiPb:   # @_Z19appendTriangles_CPUP4CubePiiiiPb
	.cfi_startproc
# %bb.0:
	testl	%edx, %edx
	jle	.LBB35_7
# %bb.1:                                # %.lr.ph25
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movslq	%r8d, %rax
	movl	%edx, %edx
	movl	%ecx, %r8d
	xorl	%r10d, %r10d
.LBB35_2:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB35_4 Depth 2
	movslq	(%rsi,%r10,4), %r11
	imulq	$120, %r11, %rbx
	movl	$0, 112(%rdi,%rbx)
	testl	%ecx, %ecx
	jle	.LBB35_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB35_2 Depth=1
	addq	%rdi, %rbx
	addq	$112, %rbx
	movq	-8(%rbx), %r14
	addq	%r9, %r11
	xorl	%r15d, %r15d
	xorl	%r12d, %r12d
.LBB35_4:                               #   Parent Loop BB35_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movslq	%r15d, %r15
	movl	%r12d, (%r14,%r15,4)
	movzbl	(%r11), %r15d
	addl	(%rbx), %r15d
	movl	%r15d, (%rbx)
	incq	%r12
	addq	%rax, %r11
	cmpq	%r12, %r8
	jne	.LBB35_4
.LBB35_5:                               # %._crit_edge
                                        #   in Loop: Header=BB35_2 Depth=1
	incq	%r10
	cmpq	%rdx, %r10
	jne	.LBB35_2
# %bb.6:
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r14
	.cfi_restore %r15
.LBB35_7:                               # %._crit_edge26
	retq
.Lfunc_end35:
	.size	_Z19appendTriangles_CPUP4CubePiiiiPb, .Lfunc_end35-_Z19appendTriangles_CPUP4CubePiiiiPb
	.cfi_endproc
                                        # -- End function
	.globl	_Z19getIntersectedCubesP3RayP4CubeiPiS1_i # -- Begin function _Z19getIntersectedCubesP3RayP4CubeiPiS1_i
	.type	_Z19getIntersectedCubesP3RayP4CubeiPiS1_i,@function
_Z19getIntersectedCubesP3RayP4CubeiPiS1_i: # @_Z19getIntersectedCubesP3RayP4CubeiPiS1_i
	.cfi_startproc
# %bb.0:
	testl	%edx, %edx
	jle	.LBB36_12
# %bb.1:                                # %.lr.ph26
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %eax
	movl	%r8d, %edx
	xorl	%r9d, %r9d
.LBB36_2:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB36_4 Depth 2
	leaq	(%r9,%r9,8), %r10
	movl	$0, 64(%rdi,%r10,8)
	testl	%r8d, %r8d
	jle	.LBB36_10
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB36_2 Depth=1
	leaq	(%rdi,%r10,8), %r10
	addq	$64, %r10
	movsd	-64(%r10), %xmm0                # xmm0 = mem[0],zero
	xorl	%ebx, %ebx
	xorl	%r11d, %r11d
.LBB36_4:                               #   Parent Loop BB36_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movslq	(%rcx,%r11,4), %r14
	imulq	$120, %r14, %r15
	movsd	(%rsi,%r15), %xmm1              # xmm1 = mem[0],zero
	ucomisd	%xmm0, %xmm1
	movl	$0, %ebp
	ja	.LBB36_9
# %bb.5:                                #   in Loop: Header=BB36_4 Depth=2
	ucomisd	8(%rsi,%r15), %xmm0
	ja	.LBB36_9
# %bb.6:                                #   in Loop: Header=BB36_4 Depth=2
	leaq	(%rsi,%r15), %r12
	movsd	32(%r12), %xmm2                 # xmm2 = mem[0],zero
	movsd	-48(%r10), %xmm1                # xmm1 = mem[0],zero
	ucomisd	%xmm1, %xmm2
	ja	.LBB36_9
# %bb.7:                                #   in Loop: Header=BB36_4 Depth=2
	ucomisd	40(%r12), %xmm1
	ja	.LBB36_9
# %bb.8:                                #   in Loop: Header=BB36_4 Depth=2
	movsd	-56(%r10), %xmm1                # xmm1 = mem[0],zero
	xorl	%ebp, %ebp
	ucomisd	24(%rsi,%r15), %xmm1
	setbe	%bpl
.LBB36_9:                               # %_Z24rayBoxIntersection_yaxisPd4Cube.exit
                                        #   in Loop: Header=BB36_4 Depth=2
	movslq	%ebx, %rbx
	movl	%r14d, -16(%r10,%rbx,4)
	addl	(%r10), %ebp
	movl	%ebp, (%r10)
	incq	%r11
	movl	%ebp, %ebx
	cmpq	%r11, %rdx
	jne	.LBB36_4
.LBB36_10:                              # %._crit_edge
                                        #   in Loop: Header=BB36_2 Depth=1
	incq	%r9
	cmpq	%rax, %r9
	jne	.LBB36_2
# %bb.11:
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
.LBB36_12:                              # %._crit_edge27
	retq
.Lfunc_end36:
	.size	_Z19getIntersectedCubesP3RayP4CubeiPiS1_i, .Lfunc_end36-_Z19getIntersectedCubesP3RayP4CubeiPiS1_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z11ray_tracingP3RayP8TrianglePbiiP4Cube # -- Begin function _Z11ray_tracingP3RayP8TrianglePbiiP4Cube
	.type	_Z11ray_tracingP3RayP8TrianglePbiiP4Cube,@function
_Z11ray_tracingP3RayP8TrianglePbiiP4Cube: # @_Z11ray_tracingP3RayP8TrianglePbiiP4Cube
	.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	$184, %rsp
	.cfi_def_cfa_offset 240
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, 160(%rsp)                 # 8-byte Spill
	testl	%ecx, %ecx
	jle	.LBB37_7
# %bb.1:                                # %.lr.ph26.preheader
	movq	%rsi, %r15
	movl	%ecx, %eax
	movq	%rax, 168(%rsp)                 # 8-byte Spill
	xorl	%ecx, %ecx
	movq	%r9, 152(%rsp)                  # 8-byte Spill
	movq	%rdi, 144(%rsp)                 # 8-byte Spill
.LBB37_2:                               # %.lr.ph26
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB37_9 Depth 2
	leaq	(%rcx,%rcx,8), %rax
	cmpl	$0, 64(%rdi,%rax,8)
	jle	.LBB37_6
# %bb.3:                                # %.preheader
                                        #   in Loop: Header=BB37_2 Depth=1
	movq	%rcx, 176(%rsp)                 # 8-byte Spill
	movslq	48(%rdi,%rax,8), %rcx
	imulq	$120, %rcx, %rcx
	movl	112(%r9,%rcx), %ebx
	testl	%ebx, %ebx
	jle	.LBB37_4
# %bb.8:                                # %.lr.ph
                                        #   in Loop: Header=BB37_2 Depth=1
	leaq	(%rdi,%rax,8), %r13
	movq	104(%r9,%rcx), %r12
	xorl	%r14d, %r14d
	xorl	%ebp, %ebp
.LBB37_9:                               #   Parent Loop BB37_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movslq	(%r12,%r14,4), %rax
	leaq	(%rax,%rax,8), %rax
	leaq	(%r15,%rax,8), %rax
	movl	$9, %ecx
	movq	%rsp, %rdi
	movq	%r13, %rsi
	rep;movsq (%rsi), %es:(%rdi)
	leaq	72(%rsp), %rdi
	movl	$9, %ecx
	movq	%rax, %rsi
	rep;movsq (%rsi), %es:(%rdi)
	callq	_Z20rayTriangleIntersect3Ray8Triangle
	addb	%al, %bpl
	incq	%r14
	cmpq	%r14, %rbx
	jne	.LBB37_9
	jmp	.LBB37_5
.LBB37_4:                               #   in Loop: Header=BB37_2 Depth=1
	xorl	%ebp, %ebp
.LBB37_5:                               # %._crit_edge
                                        #   in Loop: Header=BB37_2 Depth=1
	andb	$1, %bpl
	movq	160(%rsp), %rax                 # 8-byte Reload
	movq	176(%rsp), %rcx                 # 8-byte Reload
	movb	%bpl, (%rax,%rcx)
	movq	152(%rsp), %r9                  # 8-byte Reload
	movq	144(%rsp), %rdi                 # 8-byte Reload
.LBB37_6:                               #   in Loop: Header=BB37_2 Depth=1
	incq	%rcx
	cmpq	168(%rsp), %rcx                 # 8-byte Folded Reload
	jne	.LBB37_2
.LBB37_7:                               # %._crit_edge27
	addq	$184, %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_end37:
	.size	_Z11ray_tracingP3RayP8TrianglePbiiP4Cube, .Lfunc_end37-_Z11ray_tracingP3RayP8TrianglePbiiP4Cube
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function RayTracingGPU
.LCPI38_0:
	.quad	0x407f400000000000              # double 500
.LCPI38_1:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	RayTracingGPU
	.type	RayTracingGPU,@function
RayTracingGPU:                          # @RayTracingGPU
	.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	$408, %rsp                      # imm = 0x198
	.cfi_def_cfa_offset 464
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	(%rdi), %eax
	movl	%eax, 128(%rsp)
	movslq	(%rsi), %r14
	movl	%r14d, 132(%rsp)
	movsd	boundingBox+8(%rip), %xmm0      # xmm0 = mem[0],zero
	movsd	boundingBox+24(%rip), %xmm2     # xmm2 = mem[0],zero
	movsd	boundingBox+40(%rip), %xmm1     # xmm1 = mem[0],zero
	movsd	boundingBox(%rip), %xmm3        # xmm3 = mem[0],zero
	movsd	boundingBox+32(%rip), %xmm4     # xmm4 = mem[0],zero
	movsd	%xmm0, 176(%rsp)                # 8-byte Spill
	movsd	%xmm3, 264(%rsp)                # 8-byte Spill
	subsd	%xmm3, %xmm0
	movsd	%xmm1, 272(%rsp)                # 8-byte Spill
	movsd	%xmm4, 256(%rsp)                # 8-byte Spill
	subsd	%xmm4, %xmm1
	movsd	%xmm0, 240(%rsp)                # 8-byte Spill
	movsd	%xmm1, 248(%rsp)                # 8-byte Spill
	mulsd	%xmm1, %xmm0
	divsd	.LCPI38_0(%rip), %xmm0
	movsd	boundingBox+16(%rip), %xmm3     # xmm3 = mem[0],zero
	xorpd	%xmm1, %xmm1
	ucomisd	%xmm1, %xmm0
	movsd	%xmm2, 168(%rsp)                # 8-byte Spill
	movsd	%xmm3, 144(%rsp)                # 8-byte Spill
	jb	.LBB38_2
# %bb.1:
	xorps	%xmm1, %xmm1
	sqrtsd	%xmm0, %xmm1
	jmp	.LBB38_3
.LBB38_2:                               # %call.sqrt
	callq	sqrt
	movsd	144(%rsp), %xmm3                # 8-byte Reload
                                        # xmm3 = mem[0],zero
	movsd	168(%rsp), %xmm2                # 8-byte Reload
                                        # xmm2 = mem[0],zero
	movapd	%xmm0, %xmm1
.LBB38_3:                               # %.split
	movsd	%xmm1, 152(%rsp)                # 8-byte Spill
	movapd	%xmm2, %xmm0
	subsd	%xmm3, %xmm0
	divsd	%xmm1, %xmm0
	callq	ceil@PLT
	cvttsd2si	%xmm0, %ebx
	movl	%ebx, 164(%rsp)
	movsd	240(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	152(%rsp), %xmm0                # 8-byte Folded Reload
	callq	ceil@PLT
	cvttsd2si	%xmm0, %ebp
	movsd	248(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	152(%rsp), %xmm0                # 8-byte Folded Reload
	callq	ceil@PLT
	cvttsd2si	%xmm0, %eax
	imull	%ebx, %ebp
	imull	%eax, %ebp
	movl	%ebp, 136(%rsp)
	movslq	%ebp, %r15
	imulq	$120, %r15, %rdi
	callq	malloc
	movq	%rax, %rbx
	movl	$400, %edi                      # imm = 0x190
	callq	malloc
	leaq	392(%rsp), %r12
	movq	%rax, 8(%r12)
	movq	$100, (%r12)
	movsd	264(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	%xmm0, 360(%rsp)
	movsd	144(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	%xmm0, 368(%rsp)
	movsd	256(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	%xmm0, 376(%rsp)
	movsd	176(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	%xmm0, 336(%rsp)
	movsd	168(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	%xmm0, 344(%rsp)
	movsd	272(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	%xmm0, 352(%rsp)
	movq	352(%rsp), %rax
	movq	%rax, 40(%rsp)
	movups	336(%rsp), %xmm0
	movups	%xmm0, 24(%rsp)
	movq	376(%rsp), %rax
	movq	%rax, 16(%rsp)
	movups	360(%rsp), %xmm0
	movups	%xmm0, (%rsp)
	movq	%rbx, %rdi
	movsd	152(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movq	%r12, %rsi
	callq	_Z12createGrid3DP4Cube7Point3DS1_dR5Index
	imulq	%r15, %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, %r13
	movslq	4(%r12), %r14
	leaq	(,%r14,4), %rax
	testq	%r14, %r14
	movl	%r14d, 140(%rsp)
	movq	$-1, %rdi
	cmovnsq	%rax, %rdi
	callq	_Znam
	movq	%rax, %r15
	testq	%r14, %r14
	jle	.LBB38_6
# %bb.4:                                # %.lr.ph
	movl	%r14d, %eax
	movq	400(%rsp), %rcx
	xorl	%edx, %edx
.LBB38_5:                               # =>This Inner Loop Header: Depth=1
	movl	(%rcx,%rdx,4), %esi
	movl	%esi, (%r15,%rdx,4)
	incq	%rdx
	cmpq	%rdx, %rax
	jne	.LBB38_5
.LBB38_6:                               # %._crit_edge
	movl	$.L.str.6, %edi
	movl	%ebp, %esi
	xorl	%eax, %eax
	callq	printf
	movl	132(%rsp), %esi
	movl	$.L.str.7, %edi
	xorl	%eax, %eax
	callq	printf
	movl	128(%rsp), %esi
	movl	$.L.str.8, %edi
	xorl	%eax, %eax
	callq	printf
	movslq	132(%rsp), %rax
	shlq	$3, %rax
	leaq	(%rax,%rax,8), %rsi
	leaq	232(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_7
# %bb.9:
	movq	232(%rsp), %rdi
	movq	triangles(%rip), %rsi
	movslq	132(%rsp), %rax
	shlq	$3, %rax
	leaq	(%rax,%rax,8), %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB38_10
# %bb.11:
	movslq	128(%rsp), %rax
	shlq	$3, %rax
	leaq	(%rax,%rax,8), %rsi
	leaq	224(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_12
# %bb.13:
	movq	224(%rsp), %rdi
	movq	rays(%rip), %rsi
	movslq	128(%rsp), %rax
	shlq	$3, %rax
	leaq	(%rax,%rax,8), %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB38_14
# %bb.15:
	movslq	136(%rsp), %rax
	movslq	132(%rsp), %rsi
	imulq	%rax, %rsi
	leaq	328(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_16
# %bb.17:
	movq	328(%rsp), %rdi
	movslq	136(%rsp), %rax
	movslq	132(%rsp), %rdx
	imulq	%rax, %rdx
	movq	%r13, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB38_18
# %bb.19:
	leaq	216(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_20
# %bb.21:
	movq	216(%rsp), %rdi
	leaq	164(%rsp), %rsi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB38_22
# %bb.23:
	leaq	208(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_24
# %bb.25:
	movq	208(%rsp), %rdi
	leaq	140(%rsp), %rsi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB38_26
# %bb.27:
	movslq	140(%rsp), %rsi
	shlq	$2, %rsi
	leaq	200(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_28
# %bb.29:
	movq	200(%rsp), %rdi
	movslq	140(%rsp), %rdx
	shlq	$2, %rdx
	movq	%r15, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB38_30
# %bb.31:
	leaq	192(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_32
# %bb.33:
	movq	192(%rsp), %rdi
	leaq	128(%rsp), %rsi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB38_34
# %bb.35:
	leaq	320(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_36
# %bb.37:
	movq	320(%rsp), %rdi
	leaq	132(%rsp), %rsi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB38_38
# %bb.39:
	leaq	312(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_40
# %bb.41:
	movq	312(%rsp), %rdi
	leaq	136(%rsp), %rsi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB38_42
# %bb.43:
	leaq	184(%rsp), %rdi
	movl	$120, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_44
# %bb.45:
	movq	184(%rsp), %rdi
	movl	$boundingBox, %esi
	movl	$120, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB38_46
# %bb.47:
	leaq	304(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_48
# %bb.49:
	leaq	384(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_50
# %bb.51:
	movslq	128(%rsp), %rsi
	addq	%rsi, %rsi
	leaq	296(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_52
# %bb.53:
	movslq	128(%rsp), %rsi
	leaq	288(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_54
# %bb.55:
	movq	%r13, 144(%rsp)                 # 8-byte Spill
	movq	%r15, 176(%rsp)                 # 8-byte Spill
	movslq	136(%rsp), %rsi
	shlq	$2, %rsi
	leaq	280(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB38_56
# %bb.57:
	movslq	128(%rsp), %r12
	leaq	(%r12,%r12), %rdi
	callq	malloc
	movq	%rax, isInside(%rip)
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, isInPlane(%rip)
	callq	clock
	movq	%rax, %r12
	movq	triangles(%rip), %rdi
	movl	136(%rsp), %r13d
	movl	132(%rsp), %ebp
	movq	%rbx, %rsi
	movl	%r13d, %edx
	movl	%ebp, %ecx
	movq	144(%rsp), %r8                  # 8-byte Reload
	callq	_Z13TriangleCountP8TriangleP4CubeiiPb
	testl	%r13d, %r13d
	jle	.LBB38_60
# %bb.58:                               # %.lr.ph260.preheader
	imulq	$120, %r13, %r14
	xorl	%r15d, %r15d
.LBB38_59:                              # %.lr.ph260
                                        # =>This Inner Loop Header: Depth=1
	movslq	100(%rbx,%r15), %rax
	leaq	1(,%rax,4), %rdi
	callq	malloc
	movq	%rax, 104(%rbx,%r15)
	addq	$120, %r15
	cmpq	%r15, %r14
	jne	.LBB38_59
.LBB38_60:                              # %._crit_edge261
	movq	%rbx, %rdi
	movl	%r13d, %esi
	movl	%ebp, %edx
	movq	144(%rsp), %rcx                 # 8-byte Reload
	callq	_Z13appendALL_CPUP4CubeiiPbP8Triangle
	movq	rays(%rip), %rsi
	movl	128(%rsp), %ecx
	movl	136(%rsp), %r8d
	movq	%rbx, %rdi
	callq	_Z13firstCube_CPUP4CubeP3RayP8Triangleii
	callq	clock
	subq	%r12, %rax
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI38_1(%rip), %xmm0
	movl	$.L.str.11, %edi
	movb	$1, %al
	callq	printf
	callq	clock
	movq	%rax, %r12
	movq	rays(%rip), %rdi
	movq	triangles(%rip), %rsi
	movq	isInside(%rip), %rdx
	movl	128(%rsp), %ecx
	movq	%rbx, %r8
	callq	_Z9IsInPlaneP3RayP8TrianglePbiP4Cube
	callq	clock
	subq	%r12, %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI38_1(%rip), %xmm0
	movl	$.L.str.12, %edi
	movb	$1, %al
	callq	printf
	movl	140(%rsp), %ebp
	testl	%ebp, %ebp
	movq	176(%rsp), %r13                 # 8-byte Reload
	jle	.LBB38_66
# %bb.61:                               # %.lr.ph264
	movl	164(%rsp), %eax
	movl	%eax, 168(%rsp)                 # 4-byte Spill
	movl	132(%rsp), %r12d
	movq	%rbx, 152(%rsp)                 # 8-byte Spill
	movq	%r13, %rbx
	movl	136(%rsp), %r13d
	xorl	%r14d, %r14d
	movq	144(%rsp), %r15                 # 8-byte Reload
.LBB38_62:                              # =>This Inner Loop Header: Depth=1
	movl	(%rbx,%r14,4), %esi
	movq	152(%rsp), %rdi                 # 8-byte Reload
	movl	168(%rsp), %edx                 # 4-byte Reload
	movq	%r15, %rcx
	movl	%r12d, %r8d
	movl	%r13d, %r9d
	callq	_Z14findUnique_CPUP4CubeiiPbii
	incq	%r14
	cmpq	%r14, %rbp
	jne	.LBB38_62
# %bb.63:                               # %.preheader255
	testl	%ebp, %ebp
	movq	%rbx, %r13
	movq	152(%rsp), %rbx                 # 8-byte Reload
	jle	.LBB38_66
# %bb.64:                               # %.lr.ph266.preheader
	xorl	%r12d, %r12d
.LBB38_65:                              # %.lr.ph266
                                        # =>This Inner Loop Header: Depth=1
	movslq	(%r13,%r12,4), %rax
	imulq	$120, %rax, %r14
	movslq	112(%rbx,%r14), %rdi
	shlq	$2, %rdi
	callq	malloc
	movq	%rax, 104(%rbx,%r14)
	incq	%r12
	cmpq	%r12, %rbp
	jne	.LBB38_65
.LBB38_66:                              # %._crit_edge267
	callq	clock
	movq	%rax, %r12
	movl	140(%rsp), %edx
	movl	132(%rsp), %ecx
	movl	136(%rsp), %r8d
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movq	144(%rsp), %r9                  # 8-byte Reload
	callq	_Z19appendTriangles_CPUP4CubePiiiiPb
	movq	rays(%rip), %rax
	movl	128(%rsp), %edx
	movl	140(%rsp), %r8d
	movl	$15, %ecx
	movl	$boundingBox, %esi
	movq	%rsp, %rdi
	rep;movsq (%rsi), %es:(%rdi)
	movq	%rax, %rdi
	movq	%rbx, %rsi
	movq	%r13, %rcx
	callq	_Z19getIntersectedCubesP3RayP4CubeiPiS1_i
	callq	clock
	subq	%r12, %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	movsd	.LCPI38_1(%rip), %xmm1          # xmm1 = mem[0],zero
	divsd	%xmm1, %xmm0
	movl	$.L.str.13, %edi
	movb	$1, %al
	callq	printf
	callq	clock
	movq	%rax, %r14
	movq	rays(%rip), %rdi
	movq	triangles(%rip), %rsi
	movq	isInPlane(%rip), %rdx
	movl	128(%rsp), %ecx
	movq	%rbx, %r9
	callq	_Z11ray_tracingP3RayP8TrianglePbiiP4Cube
	callq	clock
	subq	%r14, %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI38_1(%rip), %xmm0
	movl	$.L.str.14, %edi
	movb	$1, %al
	callq	printf
	movl	128(%rsp), %eax
	testl	%eax, %eax
	jle	.LBB38_74
# %bb.67:                               # %.lr.ph270
	movq	isInPlane(%rip), %rcx
	movq	isInside(%rip), %rdx
	addq	%rax, %rdx
	xorl	%esi, %esi
.LBB38_68:                              # =>This Inner Loop Header: Depth=1
	movb	(%rcx,%rsi), %dil
	movb	%dil, (%rdx,%rsi)
	incq	%rsi
	cmpq	%rsi, %rax
	jne	.LBB38_68
# %bb.69:                               # %.preheader
	testl	%eax, %eax
	jle	.LBB38_74
# %bb.70:                               # %.lr.ph273
	movq	isInside(%rip), %rcx
	leaq	(%rcx,%rax), %rdx
	xorl	%esi, %esi
.LBB38_71:                              # =>This Inner Loop Header: Depth=1
	cmpb	$0, (%rcx,%rsi)
	je	.LBB38_73
# %bb.72:                               #   in Loop: Header=BB38_71 Depth=1
	movb	$0, (%rdx,%rsi)
.LBB38_73:                              #   in Loop: Header=BB38_71 Depth=1
	incq	%rsi
	cmpq	%rsi, %rax
	jne	.LBB38_71
.LBB38_74:                              # %._crit_edge274
	movq	rays(%rip), %rdi
	callq	free
	movq	triangles(%rip), %rdi
	callq	free
	movq	isInPlane(%rip), %rdi
	callq	free
	movq	224(%rsp), %rdi
	callq	hipFree
	movq	232(%rsp), %rdi
	callq	hipFree
	movq	296(%rsp), %rdi
	callq	hipFree
	movq	304(%rsp), %rdi
	callq	hipFree
	movq	184(%rsp), %rdi
	callq	hipFree
	movq	%rbx, %rdi
	callq	hipFree
	movq	216(%rsp), %rdi
	callq	hipFree
	movq	200(%rsp), %rdi
	callq	hipFree
	movq	208(%rsp), %rdi
	callq	hipFree
	movq	192(%rsp), %rdi
	callq	hipFree
	movq	280(%rsp), %rdi
	callq	hipFree
	movq	288(%rsp), %rdi
	callq	hipFree
	movq	isInside(%rip), %rax
	addq	$408, %rsp                      # imm = 0x198
	.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
.LBB38_7:
	.cfi_def_cfa_offset 464
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1120, %ecx                     # imm = 0x460
	jmp	.LBB38_8
.LBB38_10:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1121, %ecx                     # imm = 0x461
	jmp	.LBB38_8
.LBB38_12:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1124, %ecx                     # imm = 0x464
	jmp	.LBB38_8
.LBB38_14:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1125, %ecx                     # imm = 0x465
	jmp	.LBB38_8
.LBB38_16:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1128, %ecx                     # imm = 0x468
	jmp	.LBB38_8
.LBB38_18:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1129, %ecx                     # imm = 0x469
	jmp	.LBB38_8
.LBB38_20:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1132, %ecx                     # imm = 0x46C
	jmp	.LBB38_8
.LBB38_22:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1133, %ecx                     # imm = 0x46D
	jmp	.LBB38_8
.LBB38_24:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1136, %ecx                     # imm = 0x470
	jmp	.LBB38_8
.LBB38_26:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1137, %ecx                     # imm = 0x471
	jmp	.LBB38_8
.LBB38_28:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1140, %ecx                     # imm = 0x474
	jmp	.LBB38_8
.LBB38_30:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1141, %ecx                     # imm = 0x475
	jmp	.LBB38_8
.LBB38_32:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1144, %ecx                     # imm = 0x478
	jmp	.LBB38_8
.LBB38_34:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1145, %ecx                     # imm = 0x479
	jmp	.LBB38_8
.LBB38_36:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1148, %ecx                     # imm = 0x47C
	jmp	.LBB38_8
.LBB38_38:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1149, %ecx                     # imm = 0x47D
	jmp	.LBB38_8
.LBB38_40:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1152, %ecx                     # imm = 0x480
	jmp	.LBB38_8
.LBB38_42:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1153, %ecx                     # imm = 0x481
	jmp	.LBB38_8
.LBB38_44:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1156, %ecx                     # imm = 0x484
	jmp	.LBB38_8
.LBB38_46:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1157, %ecx                     # imm = 0x485
	jmp	.LBB38_8
.LBB38_48:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1160, %ecx                     # imm = 0x488
	jmp	.LBB38_8
.LBB38_50:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1163, %ecx                     # imm = 0x48B
	jmp	.LBB38_8
.LBB38_52:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1166, %ecx                     # imm = 0x48E
	jmp	.LBB38_8
.LBB38_54:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1169, %ecx                     # imm = 0x491
	jmp	.LBB38_8
.LBB38_56:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	movq	%rbx, %rdi
	movl	$1172, %ecx                     # imm = 0x494
.LBB38_8:
	movq	%rax, %r8
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.Lfunc_end38:
	.size	RayTracingGPU, .Lfunc_end38-RayTracingGPU
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB39_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB39_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb, %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	$_Z9calcAllocP4CubePiS1_S1_S1_, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10findUniqueP4CubePiS1_PbS1_S1_, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z15appendTrianglesP4CubePiS1_S1_S1_Pb, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube, %esi
	movl	$.L__unnamed_6, %edx
	movl	$.L__unnamed_6, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube, %esi
	movl	$.L__unnamed_7, %edx
	movl	$.L__unnamed_7, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9appendALLP4CubePiS1_PbP8Triangle, %esi
	movl	$.L__unnamed_8, %edx
	movl	$.L__unnamed_8, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9firstCubeP4CubeP3RayP8TrianglePiS5_, %esi
	movl	$.L__unnamed_9, %edx
	movl	$.L__unnamed_9, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end39:
	.size	__hip_module_ctor, .Lfunc_end39-__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	.LBB40_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
.LBB40_2:
	retq
.Lfunc_end40:
	.size	__hip_module_dtor, .Lfunc_end40-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	rays,@object                    # @rays
	.bss
	.globl	rays
	.p2align	3, 0x0
rays:
	.quad	0
	.size	rays, 8

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

	.type	boundingBox,@object             # @boundingBox
	.globl	boundingBox
	.p2align	3, 0x0
boundingBox:
	.zero	120
	.size	boundingBox, 120

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

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

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

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"/home/diko/MOBIUS/MOEBIUS/BACKEND/SCRIPTS/TEMP/triangles.txt"
	.size	.L.str, 61

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	" unable to open file "
	.size	.L.str.2, 22

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

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"/home/diko/MOBIUS/MOEBIUS/BACKEND/SCRIPTS/TEMP/points.txt"
	.size	.L.str.4, 58

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

	.type	_Z9calcAllocP4CubePiS1_S1_S1_,@object # @_Z9calcAllocP4CubePiS1_S1_S1_
	.globl	_Z9calcAllocP4CubePiS1_S1_S1_
	.p2align	3, 0x0
_Z9calcAllocP4CubePiS1_S1_S1_:
	.quad	_Z24__device_stub__calcAllocP4CubePiS1_S1_S1_
	.size	_Z9calcAllocP4CubePiS1_S1_S1_, 8

	.type	_Z10findUniqueP4CubePiS1_PbS1_S1_,@object # @_Z10findUniqueP4CubePiS1_PbS1_S1_
	.globl	_Z10findUniqueP4CubePiS1_PbS1_S1_
	.p2align	3, 0x0
_Z10findUniqueP4CubePiS1_PbS1_S1_:
	.quad	_Z25__device_stub__findUniqueP4CubePiS1_PbS1_S1_
	.size	_Z10findUniqueP4CubePiS1_PbS1_S1_, 8

	.type	_Z15appendTrianglesP4CubePiS1_S1_S1_Pb,@object # @_Z15appendTrianglesP4CubePiS1_S1_S1_Pb
	.globl	_Z15appendTrianglesP4CubePiS1_S1_S1_Pb
	.p2align	3, 0x0
_Z15appendTrianglesP4CubePiS1_S1_S1_Pb:
	.quad	_Z30__device_stub__appendTrianglesP4CubePiS1_S1_S1_Pb
	.size	_Z15appendTrianglesP4CubePiS1_S1_S1_Pb, 8

	.type	_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_,@object # @_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
	.globl	_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
	.p2align	3, 0x0
_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_:
	.quad	_Z38__device_stub__getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
	.size	_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_, 8

	.type	_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube,@object # @_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
	.globl	_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
	.p2align	3, 0x0
_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube:
	.quad	_Z29__device_stub__ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
	.size	_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube, 8

	.type	_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube,@object # @_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
	.globl	_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
	.p2align	3, 0x0
_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube:
	.quad	_Z27__device_stub__IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
	.size	_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube, 8

	.type	_Z9appendALLP4CubePiS1_PbP8Triangle,@object # @_Z9appendALLP4CubePiS1_PbP8Triangle
	.globl	_Z9appendALLP4CubePiS1_PbP8Triangle
	.p2align	3, 0x0
_Z9appendALLP4CubePiS1_PbP8Triangle:
	.quad	_Z24__device_stub__appendALLP4CubePiS1_PbP8Triangle
	.size	_Z9appendALLP4CubePiS1_PbP8Triangle, 8

	.type	_Z9firstCubeP4CubeP3RayP8TrianglePiS5_,@object # @_Z9firstCubeP4CubeP3RayP8TrianglePiS5_
	.globl	_Z9firstCubeP4CubeP3RayP8TrianglePiS5_
	.p2align	3, 0x0
_Z9firstCubeP4CubeP3RayP8TrianglePiS5_:
	.quad	_Z24__device_stub__firstCubeP4CubeP3RayP8TrianglePiS5_
	.size	_Z9firstCubeP4CubeP3RayP8TrianglePiS5_, 8

	.type	.L.str.5,@object                # @.str.5
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.5:
	.asciz	"Triangle:%d %lf %lf %lf \n"
	.size	.L.str.5, 26

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Num cubes: %d \n"
	.size	.L.str.6, 16

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Num Triangles: %d \n"
	.size	.L.str.7, 20

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Num Rays: %d \n"
	.size	.L.str.8, 15

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Cuda error in file '%s' in line %i : %s.\n"
	.size	.L.str.9, 42

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/ADiko1997/CUDA-optimized-ray-tracing/main/ray_tracingGPU.hip"
	.size	.L.str.10, 123

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	" \n time spent for preprocessing: %.10f\n"
	.size	.L.str.11, 40

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"time spent for Is In plane: %.10f\n"
	.size	.L.str.12, 35

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"time spent for pre-raytracing: %.10f\n"
	.size	.L.str.13, 38

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"time spent for raytracing: %.10f\n"
	.size	.L.str.14, 34

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb"
	.size	.L__unnamed_1, 45

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z9calcAllocP4CubePiS1_S1_S1_"
	.size	.L__unnamed_2, 30

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

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z15appendTrianglesP4CubePiS1_S1_S1_Pb"
	.size	.L__unnamed_4, 39

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_"
	.size	.L__unnamed_5, 50

	.type	.L__unnamed_6,@object           # @5
.L__unnamed_6:
	.asciz	"_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube"
	.size	.L__unnamed_6, 47

	.type	.L__unnamed_7,@object           # @6
.L__unnamed_7:
	.asciz	"_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube"
	.size	.L__unnamed_7, 45

	.type	.L__unnamed_8,@object           # @7
.L__unnamed_8:
	.asciz	"_Z9appendALLP4CubePiS1_PbP8Triangle"
	.size	.L__unnamed_8, 36

	.type	.L__unnamed_9,@object           # @8
.L__unnamed_9:
	.asciz	"_Z9firstCubeP4CubeP3RayP8TrianglePiS5_"
	.size	.L__unnamed_9, 39

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z32__device_stub__TriangleCount_GPUP8TriangleP4CubePiS3_Pb
	.addrsig_sym _Z24__device_stub__calcAllocP4CubePiS1_S1_S1_
	.addrsig_sym _Z25__device_stub__findUniqueP4CubePiS1_PbS1_S1_
	.addrsig_sym _Z30__device_stub__appendTrianglesP4CubePiS1_S1_S1_Pb
	.addrsig_sym _Z38__device_stub__getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
	.addrsig_sym _Z29__device_stub__ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
	.addrsig_sym _Z27__device_stub__IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
	.addrsig_sym _Z24__device_stub__appendALLP4CubePiS1_PbP8Triangle
	.addrsig_sym _Z24__device_stub__firstCubeP4CubeP3RayP8TrianglePiS5_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym boundingBox
	.addrsig_sym _Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb
	.addrsig_sym _Z9calcAllocP4CubePiS1_S1_S1_
	.addrsig_sym _Z10findUniqueP4CubePiS1_PbS1_S1_
	.addrsig_sym _Z15appendTrianglesP4CubePiS1_S1_S1_Pb
	.addrsig_sym _Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
	.addrsig_sym _Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
	.addrsig_sym _Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
	.addrsig_sym _Z9appendALLP4CubePiS1_PbP8Triangle
	.addrsig_sym _Z9firstCubeP4CubeP3RayP8TrianglePiS5_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb ; -- Begin function _Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb
	.globl	_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb
	.p2align	8
	.type	_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb,@function
_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb: ; @_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb
; %bb.0:
	s_clause 0x1
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b32 s13, s[0:1], 0x34
	s_add_u32 s2, s0, 40
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_load_b32 s12, s[8:9], 0x0
	s_load_b32 s14, s[10:11], 0x0
	s_and_b32 s13, s13, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1)
	v_mad_u64_u32 v[1:2], null, s15, s13, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s14, s14, s12
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_cmp_gt_i32_e32 vcc_lo, s14, v1
	s_and_saveexec_b32 s14, vcc_lo
	s_cbranch_execz .LBB0_5
; %bb.1:                                ; %.lr.ph.preheader
	s_load_b32 s14, s[2:3], 0x0
	s_load_b64 s[2:3], s[0:1], 0x20
	v_mov_b32_e32 v2, 0
	s_mov_b32 s15, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s14, s14, s13
.LBB0_2:                                ; %.lr.ph
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
	s_ashr_i32 s0, s12, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s1, s12, s0
	s_xor_b32 s1, s1, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_u32_e32 v0, s1
	s_sub_i32 s13, 0, s1
	v_rcp_iflag_f32_e32 v0, v0
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v0, 0x4f7ffffe, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cvt_u32_f32_e32 v3, v0
	v_ashrrev_i32_e32 v0, 31, v1
	v_mul_lo_u32 v4, s13, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v5, v1, v0
	v_xor_b32_e32 v5, v5, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v4, v3, v4
	v_add_nc_u32_e32 v3, v3, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v3, v5, v3
	v_mul_lo_u32 v4, v3, s1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v4, v5, v4
	v_add_nc_u32_e32 v5, 1, v3
	v_subrev_nc_u32_e32 v6, s1, v4
	v_cmp_le_u32_e32 vcc_lo, s1, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_dual_cndmask_b32 v4, v4, v6 :: v_dual_cndmask_b32 v3, v3, v5
	v_xor_b32_e32 v6, s0, v0
	v_cmp_le_u32_e32 vcc_lo, s1, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v5, 1, v3
	v_cndmask_b32_e32 v3, v3, v5, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v3, v3, v6
	v_sub_nc_u32_e32 v3, v3, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v4, v3, s12
	v_mad_i64_i32 v[8:9], null, 0x48, v3, s[4:5]
	s_mov_b64 s[12:13], 0
	v_sub_nc_u32_e32 v30, v1, v4
	s_delay_alu instid0(VALU_DEP_1)
	v_mad_i64_i32 v[26:27], null, 0x78, v30, s[6:7]
	global_load_b128 v[4:7], v[8:9], off
	global_load_b128 v[10:13], v[26:27], off offset:72
	global_load_b128 v[14:17], v[8:9], off offset:16
	global_load_b64 v[28:29], v[26:27], off offset:88
	s_clause 0x2
	global_load_b128 v[18:21], v[8:9], off offset:32
	global_load_b128 v[22:25], v[8:9], off offset:48
	global_load_b64 v[31:32], v[8:9], off offset:64
	s_waitcnt vmcnt(5)
	v_add_f64 v[4:5], v[4:5], -v[10:11]
	v_add_f64 v[6:7], v[6:7], -v[12:13]
	s_waitcnt vmcnt(3)
	v_add_f64 v[8:9], v[14:15], -v[28:29]
	v_add_f64 v[14:15], v[16:17], -v[10:11]
	s_waitcnt vmcnt(2)
	v_add_f64 v[16:17], v[18:19], -v[12:13]
	v_add_f64 v[18:19], v[20:21], -v[28:29]
	s_waitcnt vmcnt(1)
	v_add_f64 v[12:13], v[24:25], -v[12:13]
	s_waitcnt vmcnt(0)
	v_add_f64 v[20:21], v[31:32], -v[28:29]
	v_add_f64 v[10:11], v[22:23], -v[10:11]
	v_add_f64 v[22:23], v[14:15], -v[4:5]
	v_add_f64 v[24:25], v[16:17], -v[6:7]
	v_add_f64 v[28:29], v[18:19], -v[8:9]
	v_add_f64 v[12:13], v[12:13], -v[16:17]
	v_add_f64 v[16:17], v[20:21], -v[18:19]
	v_add_f64 v[14:15], v[10:11], -v[14:15]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_f64 v[10:11], v[12:13], v[28:29]
	v_mul_f64 v[18:19], v[22:23], v[16:17]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_f64 v[20:21], v[14:15], v[24:25]
	v_fma_f64 v[10:11], v[24:25], v[16:17], -v[10:11]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f64 v[14:15], v[14:15], v[28:29], -v[18:19]
	v_fma_f64 v[12:13], v[22:23], v[12:13], -v[20:21]
	v_add_co_u32 v16, vcc_lo, v26, 48
	v_add_co_ci_u32_e32 v17, vcc_lo, 0, v27, vcc_lo
                                        ; implicit-def: $vgpr18_vgpr19
                                        ; implicit-def: $vgpr28_vgpr29
                                        ; implicit-def: $vgpr20_vgpr21
                                        ; implicit-def: $vgpr22_vgpr23
                                        ; implicit-def: $vgpr26_vgpr27
                                        ; implicit-def: $vgpr24_vgpr25
.LBB0_3:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	global_load_b64 v[31:32], v[16:17], off
	s_cmp_eq_u32 s12, 1
	s_cselect_b32 vcc_lo, -1, 0
	s_cmp_eq_u32 s12, 2
	v_cndmask_b32_e32 v3, v5, v7, vcc_lo
	v_cndmask_b32_e32 v33, v4, v6, vcc_lo
	s_cselect_b32 s0, -1, 0
	s_cmp_eq_u32 s12, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v34, v3, v9, s0
	v_cndmask_b32_e64 v33, v33, v8, s0
	v_cndmask_b32_e32 v3, v11, v15, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v38, v3, v13, s0
	s_waitcnt vmcnt(0)
	v_add_f64 v[35:36], v[31:32], -v[33:34]
	v_add_f64 v[31:32], -v[31:32], -v[33:34]
	v_cndmask_b32_e32 v34, v10, v14, vcc_lo
	v_mov_b32_e32 v33, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v37, v34, v12, s0
	v_cmp_nlt_f64_e64 s1, 0, v[37:38]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v34, 0, 0x3ff00000, s1
	v_cmp_lt_f64_e64 s1, 0, v[37:38]
	v_mul_f64 v[39:40], v[35:36], v[33:34]
	v_mul_f64 v[33:34], v[31:32], v[33:34]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v3, 0, 0x3ff00000, s1
	v_add_co_u32 v16, s1, v16, 8
	v_add_co_ci_u32_e64 v17, s1, 0, v17, s1
	s_delay_alu instid0(VALU_DEP_3)
	v_fma_f64 v[31:32], v[31:32], v[2:3], v[39:40]
	v_fma_f64 v[33:34], v[35:36], v[2:3], v[33:34]
	s_cselect_b32 s1, -1, 0
	s_add_u32 s12, s12, 1
	s_addc_u32 s13, s13, 0
	s_cmp_lg_u32 s12, 3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v28, v28, v31, vcc_lo
	v_cndmask_b32_e64 v19, v19, v32, s1
	v_cndmask_b32_e64 v18, v18, v31, s1
	v_cndmask_b32_e32 v29, v29, v32, vcc_lo
	v_cndmask_b32_e64 v21, v21, v32, s0
	v_cndmask_b32_e64 v20, v20, v31, s0
	v_cndmask_b32_e64 v23, v23, v34, s1
	v_cndmask_b32_e64 v22, v22, v33, s1
	v_dual_cndmask_b32 v27, v27, v34 :: v_dual_cndmask_b32 v26, v26, v33
	v_cndmask_b32_e64 v25, v25, v34, s0
	v_cndmask_b32_e64 v24, v24, v33, s0
	s_cbranch_scc1 .LBB0_3
; %bb.4:                                ; %_Z13triBoxOverlapPdS_8Triangle.exit
                                        ;   in Loop: Header=BB0_2 Depth=1
	v_mul_f64 v[3:4], v[14:15], v[28:29]
	v_mul_f64 v[5:6], v[14:15], v[26:27]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[3:4], v[10:11], v[18:19], v[3:4]
	v_fma_f64 v[5:6], v[10:11], v[22:23], v[5:6]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[3:4], v[12:13], v[20:21], v[3:4]
	v_fma_f64 v[5:6], v[12:13], v[24:25], v[5:6]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_nlt_f64_e32 vcc_lo, 0, v[3:4]
	v_cmp_le_f64_e64 s0, 0, v[5:6]
	v_add_co_u32 v3, s1, s2, v1
	v_mad_i64_i32 v[5:6], null, 0x78, v30, s[6:7]
	v_add_co_ci_u32_e64 v4, s1, s3, v0, s1
	v_add_nc_u32_e32 v1, s14, v1
	s_and_b32 s0, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	v_cndmask_b32_e64 v0, 0, 1, s0
	global_store_b8 v[3:4], v0, off
	global_atomic_add_u32 v[5:6], v0, off offset:100
	s_clause 0x1
	global_load_b32 v0, v2, s[8:9]
	global_load_b32 v3, v2, s[10:11]
	s_waitcnt vmcnt(1)
	v_readfirstlane_b32 s12, v0
	s_waitcnt vmcnt(0)
	v_mul_lo_u32 v3, v3, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_ge_i32_e32 vcc_lo, v1, v3
	s_or_b32 s15, vcc_lo, s15
	s_and_not1_b32 exec_lo, exec_lo, s15
	s_cbranch_execnz .LBB0_2
.LBB0_5:                                ; %Flow65
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 41
		.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	_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb, .Lfunc_end0-_Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1144
; NumSgprs: 18
; NumVgprs: 41
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 5
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 41
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z9calcAllocP4CubePiS1_S1_S1_ ; -- Begin function _Z9calcAllocP4CubePiS1_S1_S1_
	.globl	_Z9calcAllocP4CubePiS1_S1_S1_
	.p2align	8
	.type	_Z9calcAllocP4CubePiS1_S1_S1_,@function
_Z9calcAllocP4CubePiS1_S1_S1_:          ; @_Z9calcAllocP4CubePiS1_S1_S1_
; %bb.0:
	s_clause 0x1
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b32 s2, s[0:1], 0x34
	s_add_u32 s0, s0, 40
	s_addc_u32 s1, s1, 0
	s_mov_b32 s12, exec_lo
	s_waitcnt lgkmcnt(0)
	s_load_b32 s3, s[6:7], 0x0
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB1_7
; %bb.1:                                ; %.lr.ph27.preheader
	s_load_b32 s12, s[0:1], 0x0
	v_dual_mov_b32 v3, s3 :: v_dual_mov_b32 v0, 0
	s_add_u32 s0, s4, 0x64
	s_addc_u32 s1, s5, 0
	s_mov_b32 s3, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s2, s12, s2
.LBB1_2:                                ; %.lr.ph27
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB1_4 Depth 2
	v_ashrrev_i32_e32 v2, 31, v1
	s_mov_b32 s12, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	v_add_co_u32 v4, vcc_lo, s10, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s11, v5, vcc_lo
	global_load_b32 v2, v[4:5], off
	global_load_b32 v5, v0, s[8:9]
	s_waitcnt vmcnt(0)
	v_sub_nc_u32_e32 v4, v2, v5
	v_readfirstlane_b32 s13, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v4, 1, v4
	v_cmpx_lt_i32_e64 v4, v2
	s_cbranch_execz .LBB1_6
; %bb.3:                                ; %.lr.ph
                                        ;   in Loop: Header=BB1_2 Depth=1
	v_mad_i64_i32 v[7:8], null, 0x78, v2, s[4:5]
	v_mad_i64_i32 v[2:3], null, 0x78, v4, s[0:1]
	s_add_i32 s13, s13, -1
	global_load_b32 v6, v[7:8], off offset:100
	v_add_co_u32 v4, vcc_lo, 0x64, v7
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v8, vcc_lo
.LBB1_4:                                ;   Parent Loop BB1_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	global_load_b32 v7, v[2:3], off
	v_add_co_u32 v2, vcc_lo, 0x78, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
	s_add_i32 s13, s13, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s13, 0
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v6, v6, v7
	global_store_b32 v[4:5], v6, off
	s_cbranch_scc0 .LBB1_4
; %bb.5:                                ; %._crit_edge.loopexit
                                        ;   in Loop: Header=BB1_2 Depth=1
	global_load_b32 v3, v0, s[6:7]
.LBB1_6:                                ; %Flow
                                        ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s12
	v_add_nc_u32_e32 v1, s2, v1
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_ge_i32_e32 vcc_lo, v1, v3
	s_or_b32 s3, vcc_lo, s3
	s_and_not1_b32 exec_lo, exec_lo, s3
	s_cbranch_execnz .LBB1_2
.LBB1_7:                                ; %Flow44
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9calcAllocP4CubePiS1_S1_S1_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 9
		.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	_Z9calcAllocP4CubePiS1_S1_S1_, .Lfunc_end1-_Z9calcAllocP4CubePiS1_S1_S1_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 364
; NumSgprs: 18
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 9
; 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	_Z10findUniqueP4CubePiS1_PbS1_S1_ ; -- Begin function _Z10findUniqueP4CubePiS1_PbS1_S1_
	.globl	_Z10findUniqueP4CubePiS1_PbS1_S1_
	.p2align	8
	.type	_Z10findUniqueP4CubePiS1_PbS1_S1_,@function
_Z10findUniqueP4CubePiS1_PbS1_S1_:      ; @_Z10findUniqueP4CubePiS1_PbS1_S1_
; %bb.0:
	s_clause 0x1
	s_load_b128 s[8:11], s[0:1], 0x20
	s_load_b32 s2, s[0:1], 0x3c
	s_add_u32 s12, s0, 48
	s_addc_u32 s13, s1, 0
	s_waitcnt lgkmcnt(0)
	s_load_b32 s3, s[8:9], 0x0
	s_and_b32 s14, s2, 0xffff
	s_mov_b32 s2, exec_lo
	v_mad_u64_u32 v[1:2], null, s15, s14, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB2_10
; %bb.1:                                ; %.preheader.preheader
	s_load_b256 s[0:7], s[0:1], 0x0
	v_mov_b32_e32 v0, 0
	s_waitcnt lgkmcnt(0)
	s_load_b32 s15, s[2:3], 0x0
	s_load_b32 s4, s[4:5], 0x0
	s_load_b32 s5, s[12:13], 0x0
	s_waitcnt lgkmcnt(0)
	s_sub_i32 s12, s15, s4
	s_mul_i32 s4, s5, s14
	s_add_i32 s5, s12, 1
	s_mov_b32 s12, 0
.LBB2_2:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB2_4 Depth 2
                                        ;     Child Loop BB2_6 Depth 2
	s_clause 0x1
	global_load_b32 v2, v0, s[10:11]
	global_load_b32 v3, v0, s[2:3]
	s_waitcnt vmcnt(1)
	v_mul_lo_u32 v4, v2, v1
	s_waitcnt vmcnt(0)
	v_cmp_ge_i32_e32 vcc_lo, s5, v3
	v_readfirstlane_b32 s13, v3
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v6, v4, v3
	v_ashrrev_i32_e32 v7, 31, v6
	s_cbranch_vccnz .LBB2_5
; %bb.3:                                ; %.lr.ph
                                        ;   in Loop: Header=BB2_2 Depth=1
	v_add_co_u32 v2, vcc_lo, s6, v6
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s7, v7, vcc_lo
	v_add_nc_u32_e32 v4, s5, v4
	s_mov_b32 s14, s5
	global_load_u8 v8, v[2:3], off
	v_ashrrev_i32_e32 v5, 31, v4
	v_add_co_u32 v4, vcc_lo, s6, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v5, vcc_lo
.LBB2_4:                                ;   Parent Loop BB2_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	global_load_u8 v9, v[4:5], off
	v_add_co_u32 v4, vcc_lo, v4, 1
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v5, vcc_lo
	s_add_i32 s14, s14, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_ge_i32 s14, s13
	s_waitcnt vmcnt(0)
	v_or_b32_e32 v8, v8, v9
	global_store_b8 v[2:3], v8, off
	s_cbranch_scc0 .LBB2_4
.LBB2_5:                                ; %._crit_edge
                                        ;   in Loop: Header=BB2_2 Depth=1
	v_add_co_u32 v2, vcc_lo, s6, v6
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s7, v7, vcc_lo
	s_mov_b32 s15, exec_lo
	s_mov_b32 s14, 0
	global_load_u8 v2, v[2:3], off
.LBB2_6:                                ; %ComputeLoop
                                        ;   Parent Loop BB2_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_ctz_i32_b32 s16, s15
	s_waitcnt vmcnt(0)
	v_readlane_b32 s17, v2, s16
	s_lshl_b32 s16, 1, s16
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_and_not1_b32 s15, s15, s16
	s_add_i32 s14, s14, s17
	s_cmp_lg_u32 s15, 0
	s_cbranch_scc1 .LBB2_6
; %bb.7:                                ; %ComputeEnd
                                        ;   in Loop: Header=BB2_2 Depth=1
	v_mbcnt_lo_u32_b32 v2, exec_lo, 0
	s_mov_b32 s15, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v2
	s_xor_b32 s15, exec_lo, s15
	s_cbranch_execz .LBB2_9
; %bb.8:                                ;   in Loop: Header=BB2_2 Depth=1
	s_mul_i32 s16, s13, 0x78
	v_mov_b32_e32 v2, s14
	s_mul_hi_i32 s13, s13, 0x78
	s_add_u32 s16, s0, s16
	s_addc_u32 s17, s1, s13
	global_atomic_add_u32 v0, v2, s[16:17] offset:112
.LBB2_9:                                ;   in Loop: Header=BB2_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s15
	global_load_b32 v2, v0, s[8:9]
	v_add_nc_u32_e32 v1, s4, v1
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_ge_i32_e32 vcc_lo, v1, v2
	s_or_b32 s12, vcc_lo, s12
	s_and_not1_b32 exec_lo, exec_lo, s12
	s_cbranch_execnz .LBB2_2
.LBB2_10:                               ; %._crit_edge35
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10findUniqueP4CubePiS1_PbS1_S1_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 304
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 10
		.amdhsa_next_free_sgpr 18
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z10findUniqueP4CubePiS1_PbS1_S1_, .Lfunc_end2-_Z10findUniqueP4CubePiS1_PbS1_S1_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 492
; NumSgprs: 20
; NumVgprs: 10
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 20
; NumVGPRsForWavesPerEU: 10
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z15appendTrianglesP4CubePiS1_S1_S1_Pb ; -- Begin function _Z15appendTrianglesP4CubePiS1_S1_S1_Pb
	.globl	_Z15appendTrianglesP4CubePiS1_S1_S1_Pb
	.p2align	8
	.type	_Z15appendTrianglesP4CubePiS1_S1_S1_Pb,@function
_Z15appendTrianglesP4CubePiS1_S1_S1_Pb: ; @_Z15appendTrianglesP4CubePiS1_S1_S1_Pb
; %bb.0:
	s_clause 0x1
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b32 s12, s[0:1], 0x3c
	s_add_u32 s2, s0, 48
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_load_b32 s13, s[8:9], 0x0
	s_and_b32 s12, s12, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s12, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, s13, v1
	s_and_saveexec_b32 s13, vcc_lo
	s_cbranch_execz .LBB3_6
; %bb.1:                                ; %.lr.ph33.preheader
	s_load_b32 s13, s[2:3], 0x0
	s_load_b128 s[0:3], s[0:1], 0x20
	v_mov_b32_e32 v8, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s12, s13, s12
	s_mov_b32 s13, 0
.LBB3_2:                                ; %.lr.ph33
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB3_4 Depth 2
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[1:2]
	v_add_co_u32 v2, vcc_lo, s6, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s7, v3, vcc_lo
	global_load_b32 v0, v[2:3], off
	s_waitcnt vmcnt(0)
	v_mad_i64_i32 v[4:5], null, 0x78, v0, s[4:5]
	global_store_b32 v[4:5], v8, off offset:112
	global_load_b32 v2, v8, s[10:11]
	s_waitcnt vmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, 1, v2
	s_cbranch_vccnz .LBB3_5
; %bb.3:                                ; %.lr.ph
                                        ;   in Loop: Header=BB3_2 Depth=1
	global_load_b64 v[2:3], v[4:5], off offset:104
	v_add_co_u32 v4, vcc_lo, 0x70, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v5, vcc_lo
	v_mov_b32_e32 v6, 0
	s_mov_b32 s14, 0
.LBB3_4:                                ;   Parent Loop BB3_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	global_load_b32 v11, v8, s[0:1]
	v_ashrrev_i32_e32 v7, 31, v6
	v_mov_b32_e32 v12, s14
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[6:7], 2, v[6:7]
	s_waitcnt vmcnt(1)
	v_add_co_u32 v6, vcc_lo, v2, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v7, vcc_lo, v3, v7, vcc_lo
	global_store_b32 v[6:7], v12, off
	s_waitcnt vmcnt(0)
	v_mad_u64_u32 v[9:10], null, v11, s14, v[0:1]
	s_add_i32 s14, s14, 1
	v_ashrrev_i32_e32 v10, 31, v9
	v_add_co_u32 v9, vcc_lo, s2, v9
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v10, vcc_lo, s3, v10, vcc_lo
	global_load_b32 v6, v[4:5], off
	global_load_u8 v7, v[9:10], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v6, v6, v7
	global_store_b32 v[4:5], v6, off
	global_load_b32 v7, v8, s[10:11]
	s_waitcnt vmcnt(0)
	v_cmp_ge_i32_e32 vcc_lo, s14, v7
	s_cbranch_vccz .LBB3_4
.LBB3_5:                                ; %._crit_edge
                                        ;   in Loop: Header=BB3_2 Depth=1
	global_load_b32 v0, v8, s[8:9]
	v_add_nc_u32_e32 v1, s12, v1
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_ge_i32_e32 vcc_lo, v1, v0
	s_or_b32 s13, vcc_lo, s13
	s_and_not1_b32 exec_lo, exec_lo, s13
	s_cbranch_execnz .LBB3_2
.LBB3_6:                                ; %Flow66
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15appendTrianglesP4CubePiS1_S1_S1_Pb
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 304
		.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 13
		.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_end3:
	.size	_Z15appendTrianglesP4CubePiS1_S1_S1_Pb, .Lfunc_end3-_Z15appendTrianglesP4CubePiS1_S1_S1_Pb
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 416
; NumSgprs: 18
; NumVgprs: 13
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 13
; 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	_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_ ; -- Begin function _Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
	.globl	_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
	.p2align	8
	.type	_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_,@function
_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_: ; @_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
; %bb.0:
	s_clause 0x1
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b32 s12, s[0:1], 0x3c
	s_add_u32 s2, s0, 48
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_load_b32 s13, s[8:9], 0x0
	s_and_b32 s12, s12, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s12, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, s13, v1
	s_and_saveexec_b32 s13, vcc_lo
	s_cbranch_execz .LBB4_10
; %bb.1:                                ; %.lr.ph34.preheader
	s_load_b32 s13, s[2:3], 0x0
	s_load_b64 s[2:3], s[0:1], 0x28
	v_mov_b32_e32 v0, 0
	s_mov_b32 s14, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s1, s13, s12
.LBB4_2:                                ; %.lr.ph34
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB4_4 Depth 2
	v_mad_i64_i32 v[2:3], null, 0x48, v1, s[4:5]
	global_store_b32 v[2:3], v0, off offset:64
	global_load_b32 v4, v0, s[2:3]
	s_waitcnt vmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, 1, v4
	s_cbranch_vccnz .LBB4_9
; %bb.3:                                ; %.lr.ph
                                        ;   in Loop: Header=BB4_2 Depth=1
	global_load_b64 v[4:5], v[2:3], off
	v_add_co_u32 v6, vcc_lo, v2, 64
	v_add_co_ci_u32_e32 v7, vcc_lo, 0, v3, vcc_lo
	v_mov_b32_e32 v8, 0
	s_mov_b32 s15, 0
	s_mov_b64 s[12:13], s[10:11]
.LBB4_4:                                ;   Parent Loop BB4_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	global_load_b32 v11, v0, s[12:13]
	s_waitcnt vmcnt(0)
	v_mul_lo_u32 v9, 0x78, v11
	v_mul_hi_i32 v10, 0x78, v11
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v9, vcc_lo, s6, v9
	v_add_co_ci_u32_e32 v10, vcc_lo, s7, v10, vcc_lo
	global_load_b128 v[12:15], v[9:10], off
	s_waitcnt vmcnt(0)
	v_cmp_nlt_f64_e32 vcc_lo, v[4:5], v[12:13]
	v_cmp_ngt_f64_e64 s0, v[4:5], v[14:15]
	v_mov_b32_e32 v12, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s0, vcc_lo, s0
	s_and_saveexec_b32 s16, s0
	s_cbranch_execz .LBB4_8
; %bb.5:                                ;   in Loop: Header=BB4_4 Depth=2
	global_load_b128 v[12:15], v[9:10], off offset:32
	global_load_b64 v[16:17], v[2:3], off offset:16
	s_waitcnt vmcnt(0)
	v_cmp_nlt_f64_e32 vcc_lo, v[16:17], v[12:13]
	v_cmp_ngt_f64_e64 s0, v[16:17], v[14:15]
	v_mov_b32_e32 v12, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s17, vcc_lo, s0
	s_and_saveexec_b32 s0, s17
	s_cbranch_execz .LBB4_7
; %bb.6:                                ;   in Loop: Header=BB4_4 Depth=2
	global_load_b64 v[9:10], v[9:10], off offset:24
	global_load_b64 v[12:13], v[2:3], off offset:8
	s_waitcnt vmcnt(0)
	v_cmp_ngt_f64_e32 vcc_lo, v[12:13], v[9:10]
	v_cndmask_b32_e64 v12, 0, 1, vcc_lo
.LBB4_7:                                ; %Flow
                                        ;   in Loop: Header=BB4_4 Depth=2
	s_or_b32 exec_lo, exec_lo, s0
.LBB4_8:                                ; %_Z24rayBoxIntersection_yaxisPd4Cube.exit
                                        ;   in Loop: Header=BB4_4 Depth=2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	s_or_b32 exec_lo, exec_lo, s16
	v_ashrrev_i32_e32 v9, 31, v8
	s_add_i32 s15, s15, 1
	s_add_u32 s12, s12, 4
	s_addc_u32 s13, s13, 0
	v_lshlrev_b64 v[8:9], 2, v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v8, vcc_lo, v2, v8
	v_add_co_ci_u32_e32 v9, vcc_lo, v3, v9, vcc_lo
	global_store_b32 v[8:9], v11, off offset:48
	global_load_b32 v8, v[6:7], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v8, v8, v12
	global_store_b32 v[6:7], v8, off
	global_load_b32 v9, v0, s[2:3]
	s_waitcnt vmcnt(0)
	v_cmp_ge_i32_e32 vcc_lo, s15, v9
	s_cbranch_vccz .LBB4_4
.LBB4_9:                                ; %._crit_edge
                                        ;   in Loop: Header=BB4_2 Depth=1
	global_load_b32 v2, v0, s[8:9]
	v_add_nc_u32_e32 v1, s1, v1
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_ge_i32_e32 vcc_lo, v1, v2
	s_or_b32 s14, vcc_lo, s14
	s_and_not1_b32 exec_lo, exec_lo, s14
	s_cbranch_execnz .LBB4_2
.LBB4_10:                               ; %Flow57
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 304
		.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 18
		.amdhsa_next_free_sgpr 18
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end4:
	.size	_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_, .Lfunc_end4-_Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 512
; NumSgprs: 20
; NumVgprs: 18
; ScratchSize: 0
; MemoryBound: 1
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 20
; NumVGPRsForWavesPerEU: 18
; 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	_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube ; -- Begin function _Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
	.globl	_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
	.p2align	8
	.type	_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube,@function
_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube: ; @_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
; %bb.0:
	s_clause 0x1
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b32 s12, s[0:1], 0x3c
	s_add_u32 s2, s0, 48
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_load_b32 s16, s[10:11], 0x0
	s_and_b32 s12, s12, 0xffff
	s_mov_b32 s10, exec_lo
	v_mad_u64_u32 v[8:9], null, s15, s12, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s16, v8
	s_cbranch_execz .LBB5_23
; %bb.1:                                ; %.lr.ph37
	s_load_b32 s17, s[2:3], 0x0
	s_load_b64 s[2:3], s[0:1], 0x28
	v_add_nc_u32_e64 v35, 8, 24
	s_mov_b32 s10, 0xd9d7bdbb
	s_mov_b32 s11, 0xbddb7cdf
	s_mov_b32 s13, 0
	s_mov_b32 s1, 0x3ddb7cdf
	s_mov_b32 s18, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s17, s17, s12
.LBB5_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB5_5 Depth 2
                                        ;       Child Loop BB5_6 Depth 3
                                        ;       Child Loop BB5_9 Depth 3
                                        ;       Child Loop BB5_12 Depth 3
                                        ;       Child Loop BB5_15 Depth 3
	v_mad_i64_i32 v[9:10], null, 0x48, v8, s[4:5]
	v_ashrrev_i32_e32 v36, 31, v8
	s_mov_b32 s19, exec_lo
	global_load_b32 v0, v[9:10], off offset:64
	s_waitcnt vmcnt(0)
	v_cmpx_lt_i32_e32 0, v0
	s_cbranch_execz .LBB5_22
; %bb.3:                                ; %.preheader
                                        ;   in Loop: Header=BB5_2 Depth=1
	global_load_b32 v2, v[9:10], off offset:48
	v_mov_b32_e32 v37, 0
	s_mov_b32 s21, 0
	s_mov_b32 s20, exec_lo
	s_waitcnt vmcnt(0)
	v_mad_i64_i32 v[0:1], null, 0x78, v2, s[2:3]
	global_load_b32 v38, v[0:1], off offset:112
	s_waitcnt vmcnt(0)
	v_cmpx_lt_i32_e32 0, v38
	s_cbranch_execz .LBB5_21
; %bb.4:                                ; %.lr.ph
                                        ;   in Loop: Header=BB5_2 Depth=1
	global_load_b64 v[11:12], v[0:1], off offset:104
	v_mov_b32_e32 v37, 0
	s_mov_b32 s12, s21
.LBB5_5:                                ;   Parent Loop BB5_2 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB5_6 Depth 3
                                        ;       Child Loop BB5_9 Depth 3
                                        ;       Child Loop BB5_12 Depth 3
                                        ;       Child Loop BB5_15 Depth 3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_lshl_b64 s[14:15], s[12:13], 2
	s_waitcnt vmcnt(0)
	v_add_co_u32 v0, vcc_lo, v11, s14
	v_add_co_ci_u32_e32 v1, vcc_lo, s15, v12, vcc_lo
	s_mov_b64 s[14:15], 0
	global_load_b32 v0, v[0:1], off
	s_clause 0x1
	global_load_b128 v[13:16], v[9:10], off offset:32
	global_load_b128 v[17:20], v[9:10], off offset:16
	s_waitcnt vmcnt(2)
	v_mad_i64_i32 v[25:26], null, 0x48, v0, s[6:7]
	s_clause 0x3
	global_load_b128 v[21:24], v[25:26], off offset:48
	global_load_b128 v[0:3], v[25:26], off offset:16
	global_load_b128 v[4:7], v[25:26], off
	global_load_b64 v[29:30], v[25:26], off offset:64
	s_clause 0x1
	global_load_b128 v[31:34], v[9:10], off offset:48
	global_load_b128 v[39:42], v[9:10], off
	s_waitcnt vmcnt(7)
	scratch_store_b128 off, v[13:16], off offset:40
	s_waitcnt vmcnt(6)
	scratch_store_b128 off, v[17:20], off offset:24
	s_clause 0x1
	scratch_load_b64 v[47:48], off, off offset:48
	scratch_load_b128 v[43:46], off, off offset:32
	global_load_b128 v[25:28], v[25:26], off offset:32
	global_load_b64 v[49:50], v[9:10], off offset:64
	s_waitcnt vmcnt(0)
	s_clause 0x1
	scratch_store_b64 off, v[49:50], off offset:72
	scratch_store_b128 off, v[31:34], off offset:56
	v_add_f64 v[13:14], v[23:24], -v[6:7]
	v_add_f64 v[15:16], v[29:30], -v[0:1]
	v_add_f64 v[17:18], v[21:22], -v[4:5]
	v_add_f64 v[2:3], v[2:3], -v[4:5]
	v_add_f64 v[19:20], v[25:26], -v[6:7]
	v_add_f64 v[21:22], v[27:28], -v[0:1]
	scratch_store_b128 off, v[39:42], off offset:8
	v_mul_f64 v[23:24], v[13:14], v[47:48]
	v_mul_f64 v[29:30], v[15:16], v[43:44]
	v_mul_f64 v[51:52], v[17:18], v[45:46]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f64 v[25:26], v[15:16], v[45:46], -v[23:24]
	v_fma_f64 v[27:28], v[17:18], v[47:48], -v[29:30]
	s_delay_alu instid0(VALU_DEP_3)
	v_fma_f64 v[29:30], v[13:14], v[43:44], -v[51:52]
	v_mov_b32_e32 v23, 0
	v_mov_b32_e32 v24, 0
.LBB5_6:                                ;   Parent Loop BB5_2 Depth=1
                                        ;     Parent Loop BB5_5 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	s_cmp_eq_u32 s14, 1
	s_cselect_b32 vcc_lo, -1, 0
	s_cmp_eq_u32 s14, 2
	s_delay_alu instid0(VALU_DEP_4)
	v_dual_cndmask_b32 v34, v26, v28 :: v_dual_cndmask_b32 v39, v25, v27
	v_cndmask_b32_e32 v31, v3, v20, vcc_lo
	v_cndmask_b32_e32 v33, v2, v19, vcc_lo
	s_cselect_b32 vcc_lo, -1, 0
	s_add_u32 s14, s14, 1
	v_cndmask_b32_e32 v34, v34, v30, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_dual_cndmask_b32 v32, v31, v22 :: v_dual_cndmask_b32 v31, v33, v21
	v_cndmask_b32_e32 v33, v39, v29, vcc_lo
	s_addc_u32 s15, s15, 0
	s_cmp_lg_u32 s14, 3
	v_fma_f64 v[23:24], v[31:32], v[33:34], v[23:24]
	s_cbranch_scc1 .LBB5_6
; %bb.7:                                ; %_Z11dot_productPdS_.exit.i
                                        ;   in Loop: Header=BB5_5 Depth=2
	s_mov_b32 s0, s10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_nlt_f64_e32 vcc_lo, s[10:11], v[23:24]
	v_cmp_ngt_f64_e64 s0, s[0:1], v[23:24]
	s_or_b32 s14, vcc_lo, s0
	s_mov_b32 s0, 0
	s_and_saveexec_b32 s22, s14
	s_cbranch_execz .LBB5_19
; %bb.8:                                ;   in Loop: Header=BB5_5 Depth=2
	s_clause 0x1
	scratch_load_b128 v[31:34], off, off offset:8
	scratch_load_b64 v[39:40], off, off offset:24
	s_mov_b64 s[14:15], 0
	s_waitcnt vmcnt(1)
	v_add_f64 v[31:32], v[31:32], -v[4:5]
	v_add_f64 v[4:5], v[33:34], -v[6:7]
	s_waitcnt vmcnt(0)
	v_add_f64 v[6:7], v[39:40], -v[0:1]
	v_mov_b32_e32 v33, 0
	v_mov_b32_e32 v34, 0
.LBB5_9:                                ;   Parent Loop BB5_2 Depth=1
                                        ;     Parent Loop BB5_5 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	s_cmp_eq_u32 s14, 1
	s_cselect_b32 vcc_lo, -1, 0
	s_cmp_eq_u32 s14, 2
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_dual_cndmask_b32 v0, v32, v5 :: v_dual_cndmask_b32 v39, v31, v4
	v_dual_cndmask_b32 v40, v26, v28 :: v_dual_cndmask_b32 v41, v25, v27
	s_cselect_b32 vcc_lo, -1, 0
	s_add_u32 s14, s14, 1
	v_dual_cndmask_b32 v1, v0, v7 :: v_dual_cndmask_b32 v0, v39, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_dual_cndmask_b32 v40, v40, v30 :: v_dual_cndmask_b32 v39, v41, v29
	s_addc_u32 s15, s15, 0
	s_cmp_lg_u32 s14, 3
	v_fma_f64 v[33:34], v[0:1], v[39:40], v[33:34]
	s_cbranch_scc1 .LBB5_9
; %bb.10:                               ; %_Z11dot_productPdS_.exit36.i
                                        ;   in Loop: Header=BB5_5 Depth=2
	v_div_scale_f64 v[0:1], null, v[23:24], v[23:24], 1.0
	v_div_scale_f64 v[29:30], vcc_lo, 1.0, v[23:24], 1.0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[25:26], v[0:1]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[27:28], -v[0:1], v[25:26], 1.0
	v_fma_f64 v[25:26], v[25:26], v[27:28], v[25:26]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[27:28], -v[0:1], v[25:26], 1.0
	v_fma_f64 v[25:26], v[25:26], v[27:28], v[25:26]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[27:28], v[29:30], v[25:26]
	v_fma_f64 v[0:1], -v[0:1], v[27:28], v[29:30]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[0:1], v[0:1], v[25:26], v[27:28]
	v_div_fixup_f64 v[0:1], v[0:1], v[23:24], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[23:24], v[0:1], v[33:34]
	v_cmp_ngt_f64_e32 vcc_lo, 0, v[23:24]
	v_cmp_nlt_f64_e64 s0, 1.0, v[23:24]
	s_delay_alu instid0(VALU_DEP_1)
	s_and_b32 s14, vcc_lo, s0
	s_mov_b32 s0, 0
	s_and_saveexec_b32 s23, s14
	s_cbranch_execz .LBB5_18
; %bb.11:                               ;   in Loop: Header=BB5_5 Depth=2
	v_mul_f64 v[25:26], v[19:20], v[6:7]
	v_mul_f64 v[27:28], v[21:22], v[31:32]
	v_mul_f64 v[29:30], v[2:3], v[4:5]
	s_mov_b64 s[14:15], 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f64 v[4:5], v[21:22], v[4:5], -v[25:26]
	v_fma_f64 v[2:3], v[2:3], v[6:7], -v[27:28]
	s_delay_alu instid0(VALU_DEP_3)
	v_fma_f64 v[6:7], v[19:20], v[31:32], -v[29:30]
	v_mov_b32_e32 v19, 0
	v_dual_mov_b32 v20, 0 :: v_dual_mov_b32 v21, v35
.LBB5_12:                               ;   Parent Loop BB5_2 Depth=1
                                        ;     Parent Loop BB5_5 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	scratch_load_b64 v[25:26], v21, off
	s_cmp_eq_u32 s14, 1
	v_add_nc_u32_e32 v21, 8, v21
	s_cselect_b32 vcc_lo, -1, 0
	s_cmp_eq_u32 s14, 2
	v_dual_cndmask_b32 v22, v5, v3 :: v_dual_cndmask_b32 v27, v4, v2
	s_cselect_b32 vcc_lo, -1, 0
	s_add_u32 s14, s14, 1
	s_addc_u32 s15, s15, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_dual_cndmask_b32 v28, v22, v7 :: v_dual_cndmask_b32 v27, v27, v6
	s_cmp_lg_u32 s14, 3
	s_waitcnt vmcnt(0)
	v_fma_f64 v[19:20], v[25:26], v[27:28], v[19:20]
	s_cbranch_scc1 .LBB5_12
; %bb.13:                               ; %_Z11dot_productPdS_.exit40.i
                                        ;   in Loop: Header=BB5_5 Depth=2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_f64 v[21:22], v[0:1], v[19:20]
	v_fma_f64 v[19:20], v[0:1], v[19:20], v[23:24]
	v_cmp_ngt_f64_e32 vcc_lo, 0, v[21:22]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_nlt_f64_e64 s0, 1.0, v[19:20]
	s_and_b32 s14, vcc_lo, s0
	s_mov_b32 s0, 0
	s_and_saveexec_b32 s24, s14
	s_cbranch_execz .LBB5_17
; %bb.14:                               ; %.preheader.i.preheader
                                        ;   in Loop: Header=BB5_5 Depth=2
	v_mov_b32_e32 v19, 0
	v_mov_b32_e32 v20, 0
	s_mov_b64 s[14:15], 0
.LBB5_15:                               ; %.preheader.i
                                        ;   Parent Loop BB5_2 Depth=1
                                        ;     Parent Loop BB5_5 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s14, 1
	s_cselect_b32 vcc_lo, -1, 0
	s_cmp_eq_u32 s14, 2
	v_dual_cndmask_b32 v21, v18, v14 :: v_dual_cndmask_b32 v24, v5, v3
	v_cndmask_b32_e32 v23, v17, v13, vcc_lo
	v_cndmask_b32_e32 v25, v4, v2, vcc_lo
	s_cselect_b32 vcc_lo, -1, 0
	s_add_u32 s14, s14, 1
	v_cndmask_b32_e32 v22, v21, v16, vcc_lo
	v_cndmask_b32_e32 v24, v24, v7, vcc_lo
	v_cndmask_b32_e32 v21, v23, v15, vcc_lo
	v_cndmask_b32_e32 v23, v25, v6, vcc_lo
	s_addc_u32 s15, s15, 0
	s_cmp_lg_u32 s14, 3
	s_delay_alu instid0(VALU_DEP_1)
	v_fma_f64 v[19:20], v[21:22], v[23:24], v[19:20]
	s_cbranch_scc1 .LBB5_15
; %bb.16:                               ; %_Z11dot_productPdS_.exit44.i
                                        ;   in Loop: Header=BB5_5 Depth=2
	s_delay_alu instid0(VALU_DEP_1)
	v_mul_f64 v[0:1], v[0:1], v[19:20]
	s_mov_b32 s0, s10
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_cmp_lt_f64_e32 vcc_lo, s[0:1], v[0:1]
	s_and_b32 s0, vcc_lo, exec_lo
.LBB5_17:                               ; %Flow
                                        ;   in Loop: Header=BB5_5 Depth=2
	s_or_b32 exec_lo, exec_lo, s24
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 s0, s0, exec_lo
.LBB5_18:                               ; %Flow98
                                        ;   in Loop: Header=BB5_5 Depth=2
	s_or_b32 exec_lo, exec_lo, s23
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 s0, s0, exec_lo
.LBB5_19:                               ; %Flow99
                                        ;   in Loop: Header=BB5_5 Depth=2
	s_or_b32 exec_lo, exec_lo, s22
	v_cndmask_b32_e64 v0, 0, 1, s0
	s_add_i32 s12, s12, 1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_eq_u32_e32 vcc_lo, s12, v38
	v_add_nc_u32_e32 v37, v37, v0
	s_or_b32 s21, vcc_lo, s21
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s21
	s_cbranch_execnz .LBB5_5
; %bb.20:                               ; %Flow100
                                        ;   in Loop: Header=BB5_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s21
.LBB5_21:                               ; %Flow101
                                        ;   in Loop: Header=BB5_2 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s20
	v_add_co_u32 v0, vcc_lo, s8, v8
	v_add_co_ci_u32_e32 v1, vcc_lo, s9, v36, vcc_lo
	v_and_b32_e32 v2, 1, v37
	global_store_b8 v[0:1], v2, off
.LBB5_22:                               ; %Flow102
                                        ;   in Loop: Header=BB5_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s19
	v_add_nc_u32_e32 v8, s17, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_le_i32_e32 vcc_lo, s16, v8
	s_or_b32 s18, vcc_lo, s18
	s_and_not1_b32 exec_lo, exec_lo, s18
	s_cbranch_execnz .LBB5_2
.LBB5_23:                               ; %Flow104
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 80
		.amdhsa_kernarg_size 304
		.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 1
		.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 53
		.amdhsa_next_free_sgpr 25
		.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_end5:
	.size	_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube, .Lfunc_end5-_Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1452
; NumSgprs: 27
; NumVgprs: 53
; ScratchSize: 80
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 6
; NumSGPRsForWavesPerEU: 27
; NumVGPRsForWavesPerEU: 53
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 1
; 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	_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube ; -- Begin function _Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
	.globl	_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
	.p2align	8
	.type	_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube,@function
_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube: ; @_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
; %bb.0:
	s_clause 0x1
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b32 s12, s[0:1], 0x3c
	s_add_u32 s2, s0, 48
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_load_b32 s14, s[10:11], 0x0
	s_and_b32 s16, s12, 0xffff
	s_mov_b32 s10, exec_lo
	v_mad_u64_u32 v[4:5], null, s15, s16, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s14, v4
	s_cbranch_execz .LBB6_9
; %bb.1:                                ; %.lr.ph42.preheader
	s_load_b32 s2, s[2:3], 0x0
	s_load_b64 s[10:11], s[0:1], 0x28
	s_mov_b32 s12, 0xd9d7bdbb
	s_mov_b32 s13, 0x3ddb7cdf
	s_mov_b32 s15, 0
	s_mov_b32 s3, 0xbddb7cdf
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s16, s2, s16
.LBB6_2:                                ; %.lr.ph42
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB6_5 Depth 2
	v_mad_i64_i32 v[0:1], null, 0x48, v4, s[4:5]
	v_ashrrev_i32_e32 v11, 31, v4
	s_mov_b32 s17, exec_lo
	global_load_b32 v2, v[0:1], off offset:64
	s_waitcnt vmcnt(0)
	v_cmpx_lt_i32_e32 0, v2
	s_cbranch_execz .LBB6_8
; %bb.3:                                ; %.preheader
                                        ;   in Loop: Header=BB6_2 Depth=1
	global_load_b32 v2, v[0:1], off offset:48
	v_mov_b32_e32 v13, 0
	s_mov_b32 s19, 0
	s_mov_b32 s18, exec_lo
	s_waitcnt vmcnt(0)
	v_mad_i64_i32 v[7:8], null, 0x78, v2, s[10:11]
	global_load_b32 v12, v[7:8], off offset:112
	s_waitcnt vmcnt(0)
	v_cmpx_lt_i32_e32 0, v12
	s_cbranch_execz .LBB6_7
; %bb.4:                                ; %.lr.ph
                                        ;   in Loop: Header=BB6_2 Depth=1
	s_clause 0x1
	global_load_b64 v[5:6], v[0:1], off offset:16
	global_load_b128 v[0:3], v[0:1], off
	global_load_b64 v[7:8], v[7:8], off offset:104
	v_mov_b32_e32 v9, 0
	v_mov_b32_e32 v13, 0
.LBB6_5:                                ;   Parent Loop BB6_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v10, 31, v9
	v_lshlrev_b64 v[14:15], 2, v[9:10]
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v14, vcc_lo, v7, v14
	v_add_co_ci_u32_e32 v15, vcc_lo, v8, v15, vcc_lo
	global_load_b32 v10, v[14:15], off
	s_waitcnt vmcnt(0)
	v_mad_i64_i32 v[26:27], null, 0x48, v10, s[6:7]
	s_clause 0x4
	global_load_b128 v[14:17], v[26:27], off
	global_load_b64 v[30:31], v[26:27], off offset:64
	global_load_b128 v[18:21], v[26:27], off offset:16
	global_load_b128 v[22:25], v[26:27], off offset:32
	global_load_b128 v[26:29], v[26:27], off offset:48
	s_waitcnt vmcnt(4)
	v_add_f64 v[32:33], v[14:15], -v[0:1]
	s_waitcnt vmcnt(3)
	v_add_f64 v[34:35], v[30:31], -v[5:6]
	s_waitcnt vmcnt(2)
	v_add_f64 v[36:37], v[18:19], -v[5:6]
	s_waitcnt vmcnt(1)
	v_add_f64 v[38:39], v[24:25], -v[5:6]
	s_waitcnt vmcnt(0)
	v_add_f64 v[40:41], v[26:27], -v[0:1]
	v_add_f64 v[42:43], v[28:29], -v[2:3]
	v_add_f64 v[46:47], v[20:21], -v[14:15]
	v_add_f64 v[30:31], v[30:31], -v[18:19]
	v_add_f64 v[48:49], v[22:23], -v[2:3]
	v_add_f64 v[50:51], v[16:17], -v[2:3]
	v_add_f64 v[20:21], v[20:21], -v[0:1]
	v_add_f64 v[18:19], v[24:25], -v[18:19]
	v_add_f64 v[24:25], v[28:29], -v[16:17]
	v_add_f64 v[14:15], v[26:27], -v[14:15]
	v_add_f64 v[16:17], v[22:23], -v[16:17]
	v_mul_f64 v[44:45], v[32:33], v[34:35]
	v_mul_f64 v[52:53], v[32:33], v[38:39]
	v_mul_f64 v[54:55], v[36:37], v[42:43]
	v_mul_f64 v[60:61], v[38:39], v[42:43]
	v_mul_f64 v[26:27], v[46:47], v[30:31]
	v_mul_f64 v[28:29], v[36:37], v[48:49]
	v_mul_f64 v[56:57], v[50:51], v[40:41]
	v_mul_f64 v[58:59], v[20:21], v[34:35]
	v_mul_f64 v[22:23], v[18:19], v[24:25]
	v_fma_f64 v[44:45], v[36:37], v[40:41], -v[44:45]
	v_fma_f64 v[36:37], v[36:37], v[20:21], -v[52:53]
	v_fma_f64 v[52:53], v[50:51], v[34:35], -v[54:55]
	v_mul_f64 v[54:55], v[50:51], v[20:21]
	v_fma_f64 v[18:19], v[18:19], v[14:15], -v[26:27]
	v_fma_f64 v[26:27], v[50:51], v[38:39], -v[28:29]
	v_mul_f64 v[14:15], v[16:17], v[14:15]
	v_fma_f64 v[28:29], v[38:39], v[40:41], -v[58:59]
	v_fma_f64 v[38:39], v[32:33], v[42:43], -v[56:57]
	v_mul_f64 v[40:41], v[48:49], v[40:41]
	v_fma_f64 v[16:17], v[16:17], v[30:31], -v[22:23]
	v_fma_f64 v[30:31], v[48:49], v[34:35], -v[60:61]
	v_mul_f64 v[44:45], v[44:45], v[44:45]
	v_mul_f64 v[36:37], v[36:37], v[36:37]
	v_fma_f64 v[22:23], v[32:33], v[48:49], -v[54:55]
	v_mul_f64 v[18:19], v[18:19], v[18:19]
	v_fma_f64 v[14:15], v[46:47], v[24:25], -v[14:15]
	v_mul_f64 v[28:29], v[28:29], v[28:29]
	v_fma_f64 v[44:45], v[52:53], v[52:53], v[44:45]
	v_fma_f64 v[26:27], v[26:27], v[26:27], v[36:37]
	v_fma_f64 v[16:17], v[16:17], v[16:17], v[18:19]
	v_fma_f64 v[18:19], v[20:21], v[42:43], -v[40:41]
	v_fma_f64 v[20:21], v[30:31], v[30:31], v[28:29]
	v_fma_f64 v[32:33], v[38:39], v[38:39], v[44:45]
	v_fma_f64 v[22:23], v[22:23], v[22:23], v[26:27]
	v_fma_f64 v[14:15], v[14:15], v[14:15], v[16:17]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_fma_f64 v[16:17], v[18:19], v[18:19], v[20:21]
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[32:33]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_cmp_gt_f64_e64 s0, 0x10000000, v[22:23]
	v_cmp_gt_f64_e64 s1, 0x10000000, v[14:15]
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_gt_f64_e64 s2, 0x10000000, v[16:17]
	v_cndmask_b32_e64 v10, 0, 1, vcc_lo
	v_lshlrev_b32_e32 v10, 8, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_ldexp_f64 v[24:25], v[32:33], v10
	v_cndmask_b32_e64 v10, 0, 1, s0
	v_lshlrev_b32_e32 v10, 8, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_ldexp_f64 v[18:19], v[22:23], v10
	v_cndmask_b32_e64 v10, 0, 1, s1
	v_cndmask_b32_e64 v22, 0, 1, s2
	v_lshlrev_b32_e32 v10, 8, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b32_e32 v22, 8, v22
	v_ldexp_f64 v[14:15], v[14:15], v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(VALU_DEP_4)
	v_ldexp_f64 v[16:17], v[16:17], v22
	v_cndmask_b32_e64 v10, 0, 0xffffff80, vcc_lo
	v_rsq_f64_e32 v[20:21], v[24:25]
	v_cmp_class_f64_e64 vcc_lo, v[24:25], 0x260
	v_rsq_f64_e32 v[22:23], v[18:19]
	v_rsq_f64_e32 v[28:29], v[14:15]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(TRANS32_DEP_3)
	v_rsq_f64_e32 v[30:31], v[16:17]
	v_mul_f64 v[26:27], v[24:25], v[20:21]
	v_mul_f64 v[20:21], v[20:21], 0.5
	v_mul_f64 v[32:33], v[18:19], v[22:23]
	v_mul_f64 v[22:23], v[22:23], 0.5
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[36:37], v[14:15], v[28:29]
	v_mul_f64 v[28:29], v[28:29], 0.5
	v_mul_f64 v[38:39], v[16:17], v[30:31]
	v_mul_f64 v[30:31], v[30:31], 0.5
	v_fma_f64 v[34:35], -v[20:21], v[26:27], 0.5
	v_fma_f64 v[40:41], -v[22:23], v[32:33], 0.5
	v_fma_f64 v[42:43], -v[28:29], v[36:37], 0.5
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_fma_f64 v[44:45], -v[30:31], v[38:39], 0.5
	v_fma_f64 v[26:27], v[26:27], v[34:35], v[26:27]
	v_fma_f64 v[20:21], v[20:21], v[34:35], v[20:21]
	v_fma_f64 v[32:33], v[32:33], v[40:41], v[32:33]
	v_fma_f64 v[22:23], v[22:23], v[40:41], v[22:23]
	v_fma_f64 v[36:37], v[36:37], v[42:43], v[36:37]
	v_fma_f64 v[28:29], v[28:29], v[42:43], v[28:29]
	v_fma_f64 v[38:39], v[38:39], v[44:45], v[38:39]
	v_fma_f64 v[30:31], v[30:31], v[44:45], v[30:31]
	v_fma_f64 v[34:35], -v[26:27], v[26:27], v[24:25]
	v_fma_f64 v[40:41], -v[32:33], v[32:33], v[18:19]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f64 v[42:43], -v[38:39], v[38:39], v[16:17]
	v_fma_f64 v[26:27], v[34:35], v[20:21], v[26:27]
	v_fma_f64 v[34:35], -v[36:37], v[36:37], v[14:15]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f64 v[32:33], v[40:41], v[22:23], v[32:33]
	v_fma_f64 v[40:41], -v[26:27], v[26:27], v[24:25]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_fma_f64 v[34:35], v[34:35], v[28:29], v[36:37]
	v_fma_f64 v[36:37], v[42:43], v[30:31], v[38:39]
	v_fma_f64 v[38:39], -v[32:33], v[32:33], v[18:19]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_fma_f64 v[20:21], v[40:41], v[20:21], v[26:27]
	v_fma_f64 v[26:27], -v[34:35], v[34:35], v[14:15]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_fma_f64 v[40:41], -v[36:37], v[36:37], v[16:17]
	v_fma_f64 v[22:23], v[38:39], v[22:23], v[32:33]
	s_delay_alu instid0(VALU_DEP_4)
	v_ldexp_f64 v[20:21], v[20:21], v10
	v_cndmask_b32_e64 v10, 0, 0xffffff80, s0
	v_fma_f64 v[26:27], v[26:27], v[28:29], v[34:35]
	v_fma_f64 v[28:29], v[40:41], v[30:31], v[36:37]
	v_cndmask_b32_e64 v30, 0, 0xffffff80, s2
	v_cmp_class_f64_e64 s0, v[14:15], 0x260
	s_mov_b32 s2, s12
	v_ldexp_f64 v[22:23], v[22:23], v10
	v_cndmask_b32_e64 v10, 0, 0xffffff80, s1
	v_cmp_class_f64_e64 s1, v[16:17], 0x260
	v_dual_cndmask_b32 v21, v21, v25 :: v_dual_cndmask_b32 v20, v20, v24
	v_cmp_class_f64_e64 vcc_lo, v[18:19], 0x260
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_ldexp_f64 v[24:25], v[26:27], v10
	v_ldexp_f64 v[26:27], v[28:29], v30
	v_mul_f64 v[20:21], v[20:21], 0.5
	v_dual_cndmask_b32 v19, v23, v19 :: v_dual_cndmask_b32 v18, v22, v18
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_4) | instid1(VALU_DEP_4)
	v_cndmask_b32_e64 v15, v25, v15, s0
	v_cndmask_b32_e64 v14, v24, v14, s0
	v_cndmask_b32_e64 v17, v27, v17, s1
	v_cndmask_b32_e64 v16, v26, v16, s1
	v_fma_f64 v[18:19], v[18:19], 0.5, v[20:21]
	v_mul_f64 v[14:15], v[14:15], 0.5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[16:17], v[16:17], 0.5, v[18:19]
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_gt_f64_e64 s0, 0x10000000, v[16:17]
	v_cndmask_b32_e64 v10, 0, 1, vcc_lo
	v_lshlrev_b32_e32 v10, 8, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_ldexp_f64 v[14:15], v[14:15], v10
	v_cndmask_b32_e64 v10, 0, 0xffffff80, vcc_lo
	v_cndmask_b32_e64 v18, 0, 1, s0
	v_lshlrev_b32_e32 v18, 8, v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_ldexp_f64 v[16:17], v[16:17], v18
	v_rsq_f64_e32 v[18:19], v[14:15]
	v_cmp_class_f64_e64 vcc_lo, v[14:15], 0x260
	v_rsq_f64_e32 v[20:21], v[16:17]
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[22:23], v[14:15], v[18:19]
	v_mul_f64 v[18:19], v[18:19], 0.5
	v_mul_f64 v[24:25], v[16:17], v[20:21]
	v_mul_f64 v[20:21], v[20:21], 0.5
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[26:27], -v[18:19], v[22:23], 0.5
	v_fma_f64 v[28:29], -v[20:21], v[24:25], 0.5
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_fma_f64 v[22:23], v[22:23], v[26:27], v[22:23]
	v_fma_f64 v[18:19], v[18:19], v[26:27], v[18:19]
	v_fma_f64 v[24:25], v[24:25], v[28:29], v[24:25]
	v_fma_f64 v[20:21], v[20:21], v[28:29], v[20:21]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f64 v[26:27], -v[22:23], v[22:23], v[14:15]
	v_fma_f64 v[28:29], -v[24:25], v[24:25], v[16:17]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[22:23], v[26:27], v[18:19], v[22:23]
	v_fma_f64 v[24:25], v[28:29], v[20:21], v[24:25]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[26:27], -v[22:23], v[22:23], v[14:15]
	v_fma_f64 v[28:29], -v[24:25], v[24:25], v[16:17]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_fma_f64 v[18:19], v[26:27], v[18:19], v[22:23]
	v_cndmask_b32_e64 v22, 0, 0xffffff80, s0
	v_cmp_class_f64_e64 s0, v[16:17], 0x260
	v_fma_f64 v[20:21], v[28:29], v[20:21], v[24:25]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ldexp_f64 v[18:19], v[18:19], v10
	v_ldexp_f64 v[20:21], v[20:21], v22
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_dual_cndmask_b32 v15, v19, v15 :: v_dual_cndmask_b32 v14, v18, v14
	v_cndmask_b32_e64 v17, v21, v17, s0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v16, v20, v16, s0
	v_div_scale_f64 v[18:19], null, v[14:15], v[14:15], v[16:17]
	v_div_scale_f64 v[24:25], vcc_lo, v[16:17], v[14:15], v[16:17]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[20:21], v[18:19]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[22:23], -v[18:19], v[20:21], 1.0
	v_fma_f64 v[20:21], v[20:21], v[22:23], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], -v[18:19], v[20:21], 1.0
	v_fma_f64 v[20:21], v[20:21], v[22:23], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[22:23], v[24:25], v[20:21]
	v_fma_f64 v[18:19], -v[18:19], v[22:23], v[24:25]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[18:19], v[18:19], v[20:21], v[22:23]
	v_div_fixup_f64 v[14:15], v[18:19], v[14:15], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[14:15], -1.0
	v_cmp_ge_f64_e32 vcc_lo, s[12:13], v[14:15]
	v_cmp_le_f64_e64 s0, s[2:3], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	s_and_b32 vcc_lo, vcc_lo, s0
	v_add_co_ci_u32_e32 v13, vcc_lo, 0, v13, vcc_lo
	v_mul_lo_u32 v10, v13, v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add3_u32 v9, v9, v10, 1
	v_cmp_ge_i32_e32 vcc_lo, v9, v12
	s_or_b32 s19, vcc_lo, s19
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s19
	s_cbranch_execnz .LBB6_5
; %bb.6:                                ; %Flow
                                        ;   in Loop: Header=BB6_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s19
.LBB6_7:                                ; %Flow68
                                        ;   in Loop: Header=BB6_2 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s18
	v_add_co_u32 v0, vcc_lo, s8, v4
	v_add_co_ci_u32_e32 v1, vcc_lo, s9, v11, vcc_lo
	v_cmp_ne_u32_e32 vcc_lo, 0, v13
	v_cndmask_b32_e64 v2, 0, 1, vcc_lo
	global_store_b8 v[0:1], v2, off
.LBB6_8:                                ; %Flow69
                                        ;   in Loop: Header=BB6_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s17
	v_add_nc_u32_e32 v4, s16, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_le_i32_e32 vcc_lo, s14, v4
	s_or_b32 s15, vcc_lo, s15
	s_and_not1_b32 exec_lo, exec_lo, s15
	s_cbranch_execnz .LBB6_2
.LBB6_9:                                ; %Flow71
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 304
		.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 62
		.amdhsa_next_free_sgpr 20
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end6:
	.size	_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube, .Lfunc_end6-_Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 2128
; NumSgprs: 22
; NumVgprs: 62
; ScratchSize: 0
; MemoryBound: 1
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 7
; NumSGPRsForWavesPerEU: 22
; NumVGPRsForWavesPerEU: 62
; 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	_Z9appendALLP4CubePiS1_PbP8Triangle ; -- Begin function _Z9appendALLP4CubePiS1_PbP8Triangle
	.globl	_Z9appendALLP4CubePiS1_PbP8Triangle
	.p2align	8
	.type	_Z9appendALLP4CubePiS1_PbP8Triangle,@function
_Z9appendALLP4CubePiS1_PbP8Triangle:    ; @_Z9appendALLP4CubePiS1_PbP8Triangle
; %bb.0:
	s_clause 0x1
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b32 s2, s[0:1], 0x34
	s_add_u32 s0, s0, 40
	s_addc_u32 s1, s1, 0
	s_mov_b32 s12, exec_lo
	s_waitcnt lgkmcnt(0)
	s_load_b32 s3, s[6:7], 0x0
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[3:4], null, s15, s2, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_i32_e64 s3, v3
	s_cbranch_execz .LBB7_7
; %bb.1:                                ; %.preheader.preheader
	s_load_b32 s12, s[8:9], 0x0
	s_load_b32 s0, s[0:1], 0x0
	v_mov_b32_e32 v0, s3
	v_mov_b32_e32 v8, 0
	s_mov_b32 s1, 0
	s_waitcnt lgkmcnt(0)
	v_mov_b32_e32 v2, s12
	s_mul_i32 s0, s0, s2
.LBB7_2:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB7_4 Depth 2
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, 1, v2
	s_cbranch_vccnz .LBB7_6
; %bb.3:                                ; %.lr.ph
                                        ;   in Loop: Header=BB7_2 Depth=1
	v_mad_i64_i32 v[4:5], null, 0x78, v3, s[4:5]
	s_mov_b32 s2, 0
	global_load_b96 v[0:2], v[4:5], off offset:104
	v_add_co_u32 v4, vcc_lo, 0x70, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v5, vcc_lo
	s_waitcnt vmcnt(0)
	v_mov_b32_e32 v6, v2
.LBB7_4:                                ;   Parent Loop BB7_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	global_load_b32 v2, v8, s[6:7]
	v_ashrrev_i32_e32 v7, 31, v6
	v_mov_b32_e32 v11, s2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[6:7], 2, v[6:7]
	v_add_co_u32 v6, vcc_lo, v0, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v7, vcc_lo, v1, v7, vcc_lo
	global_store_b32 v[6:7], v11, off
	s_waitcnt vmcnt(0)
	v_mad_u64_u32 v[9:10], null, v2, s2, v[3:4]
	s_add_i32 s2, s2, 1
	v_ashrrev_i32_e32 v2, 31, v9
	v_add_co_u32 v9, vcc_lo, s10, v9
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v10, vcc_lo, s11, v2, vcc_lo
	global_load_b32 v2, v[4:5], off
	global_load_u8 v6, v[9:10], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v6, v2, v6
	global_store_b32 v[4:5], v6, off
	global_load_b32 v2, v8, s[8:9]
	s_waitcnt vmcnt(0)
	v_cmp_ge_i32_e32 vcc_lo, s2, v2
	s_cbranch_vccz .LBB7_4
; %bb.5:                                ; %._crit_edge.loopexit
                                        ;   in Loop: Header=BB7_2 Depth=1
	global_load_b32 v0, v8, s[6:7]
.LBB7_6:                                ; %._crit_edge
                                        ;   in Loop: Header=BB7_2 Depth=1
	v_add_nc_u32_e32 v3, s0, v3
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_ge_i32_e32 vcc_lo, v3, v0
	s_or_b32 s1, vcc_lo, s1
	s_and_not1_b32 exec_lo, exec_lo, s1
	s_cbranch_execnz .LBB7_2
.LBB7_7:                                ; %._crit_edge28
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9appendALLP4CubePiS1_PbP8Triangle
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 12
		.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_end7:
	.size	_Z9appendALLP4CubePiS1_PbP8Triangle, .Lfunc_end7-_Z9appendALLP4CubePiS1_PbP8Triangle
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 368
; NumSgprs: 18
; NumVgprs: 12
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 12
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z9firstCubeP4CubeP3RayP8TrianglePiS5_ ; -- Begin function _Z9firstCubeP4CubeP3RayP8TrianglePiS5_
	.globl	_Z9firstCubeP4CubeP3RayP8TrianglePiS5_
	.p2align	8
	.type	_Z9firstCubeP4CubeP3RayP8TrianglePiS5_,@function
_Z9firstCubeP4CubeP3RayP8TrianglePiS5_: ; @_Z9firstCubeP4CubeP3RayP8TrianglePiS5_
; %bb.0:
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x18
	s_load_b32 s8, s[0:1], 0x34
	s_add_u32 s2, s0, 40
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_load_b32 s9, s[4:5], 0x0
	s_and_b32 s12, s8, 0xffff
	s_mov_b32 s8, exec_lo
	v_mad_u64_u32 v[1:2], null, s15, s12, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s9, v1
	s_cbranch_execz .LBB8_13
; %bb.1:                                ; %.lr.ph32.preheader
	s_load_b32 s2, s[2:3], 0x0
	s_load_b128 s[8:11], s[0:1], 0x0
	v_mov_b32_e32 v0, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s1, s2, s12
	s_mov_b32 s2, 0
.LBB8_2:                                ; %.lr.ph32
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB8_4 Depth 2
	v_mad_i64_i32 v[2:3], null, 0x48, v1, s[10:11]
	global_store_b32 v[2:3], v0, off offset:64
	global_load_b32 v11, v0, s[6:7]
	s_waitcnt vmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, 1, v11
	s_cbranch_vccnz .LBB8_12
; %bb.3:                                ; %.lr.ph
                                        ;   in Loop: Header=BB8_2 Depth=1
	global_load_b64 v[4:5], v[2:3], off
	v_add_co_u32 v6, vcc_lo, v2, 64
	v_add_co_ci_u32_e32 v7, vcc_lo, 0, v3, vcc_lo
	v_mov_b32_e32 v8, 0
	v_mov_b32_e32 v12, 0
	s_mov_b32 s3, 0
.LBB8_4:                                ;   Parent Loop BB8_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_1)
	v_mad_i64_i32 v[9:10], null, 0x78, v12, s[8:9]
	global_load_b128 v[13:16], v[9:10], off
	s_waitcnt vmcnt(0)
	v_cmp_nlt_f64_e32 vcc_lo, v[4:5], v[13:14]
	v_cmp_ngt_f64_e64 s0, v[4:5], v[15:16]
	v_mov_b32_e32 v13, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s0, vcc_lo, s0
	s_and_saveexec_b32 s12, s0
	s_cbranch_execz .LBB8_8
; %bb.5:                                ;   in Loop: Header=BB8_4 Depth=2
	global_load_b128 v[13:16], v[9:10], off offset:32
	global_load_b64 v[17:18], v[2:3], off offset:16
	s_waitcnt vmcnt(0)
	v_cmp_nlt_f64_e32 vcc_lo, v[17:18], v[13:14]
	v_cmp_ngt_f64_e64 s0, v[17:18], v[15:16]
	v_mov_b32_e32 v13, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s13, vcc_lo, s0
	s_and_saveexec_b32 s0, s13
	s_cbranch_execz .LBB8_7
; %bb.6:                                ;   in Loop: Header=BB8_4 Depth=2
	global_load_b64 v[9:10], v[9:10], off offset:24
	global_load_b64 v[13:14], v[2:3], off offset:8
	s_waitcnt vmcnt(0)
	v_cmp_ngt_f64_e32 vcc_lo, v[13:14], v[9:10]
	v_cndmask_b32_e64 v13, 0, 1, vcc_lo
.LBB8_7:                                ; %Flow
                                        ;   in Loop: Header=BB8_4 Depth=2
	s_or_b32 exec_lo, exec_lo, s0
.LBB8_8:                                ; %_Z24rayBoxIntersection_yaxisPd4Cube.exit
                                        ;   in Loop: Header=BB8_4 Depth=2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s12
	s_mov_b32 s0, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_ne_u32_e32 0, v13
	s_cbranch_execz .LBB8_10
; %bb.9:                                ;   in Loop: Header=BB8_4 Depth=2
	v_ashrrev_i32_e32 v9, 31, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[8:9], 2, v[8:9]
	v_add_co_u32 v8, vcc_lo, v2, v8
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v9, vcc_lo, v3, v9, vcc_lo
	global_store_b32 v[8:9], v12, off offset:48
	global_load_b32 v8, v[6:7], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v8, 1, v8
	global_store_b32 v[6:7], v8, off
	global_load_b32 v11, v0, s[6:7]
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v12, v11, v12
.LBB8_10:                               ;   in Loop: Header=BB8_4 Depth=2
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v12, 1, v12
	v_cmp_ge_i32_e32 vcc_lo, v12, v11
	s_or_b32 s3, vcc_lo, s3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s3
	s_cbranch_execnz .LBB8_4
; %bb.11:                               ; %Flow50
                                        ;   in Loop: Header=BB8_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s3
.LBB8_12:                               ; %._crit_edge
                                        ;   in Loop: Header=BB8_2 Depth=1
	global_load_b32 v2, v0, s[4:5]
	v_add_nc_u32_e32 v1, s1, v1
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_ge_i32_e32 vcc_lo, v1, v2
	s_or_b32 s2, vcc_lo, s2
	s_and_not1_b32 exec_lo, exec_lo, s2
	s_cbranch_execnz .LBB8_2
.LBB8_13:                               ; %Flow53
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9firstCubeP4CubeP3RayP8TrianglePiS5_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 19
		.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_end8:
	.size	_Z9firstCubeP4CubeP3RayP8TrianglePiS5_, .Lfunc_end8-_Z9firstCubeP4CubeP3RayP8TrianglePiS5_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 520
; NumSgprs: 18
; NumVgprs: 19
; ScratchSize: 0
; MemoryBound: 1
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 19
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z17TriangleCount_GPUP8TriangleP4CubePiS3_Pb.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     41
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9calcAllocP4CubePiS1_S1_S1_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z9calcAllocP4CubePiS1_S1_S1_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         52
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         60
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         62
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         64
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         66
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         68
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         70
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         112
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 304
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10findUniqueP4CubePiS1_PbS1_S1_
    .private_segment_fixed_size: 0
    .sgpr_count:     20
    .sgpr_spill_count: 0
    .symbol:         _Z10findUniqueP4CubePiS1_PbS1_S1_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     10
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         52
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         60
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         62
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         64
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         66
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         68
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         70
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         112
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 304
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15appendTrianglesP4CubePiS1_S1_S1_Pb
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z15appendTrianglesP4CubePiS1_S1_S1_Pb.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     13
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         52
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         60
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         62
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         64
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         66
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         68
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         70
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         112
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 304
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_
    .private_segment_fixed_size: 0
    .sgpr_count:     20
    .sgpr_spill_count: 0
    .symbol:         _Z23getIntersectedCubes_GPUP3RayP4CubePiS3_S2_S3_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     18
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         52
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         60
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         62
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         64
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         66
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         68
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         70
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         112
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 304
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube
    .private_segment_fixed_size: 80
    .sgpr_count:     27
    .sgpr_spill_count: 0
    .symbol:         _Z14ray_tracingGPUP3RayP8TrianglePbPiS4_P4Cube.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     53
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         52
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         60
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         62
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         64
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         66
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         68
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         70
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         112
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 304
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube
    .private_segment_fixed_size: 0
    .sgpr_count:     22
    .sgpr_spill_count: 0
    .symbol:         _Z12IsInPlaneGPUP3RayP8TrianglePbPiS4_P4Cube.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     62
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9appendALLP4CubePiS1_PbP8Triangle
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z9appendALLP4CubePiS1_PbP8Triangle.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     12
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9firstCubeP4CubeP3RayP8TrianglePiS5_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z9firstCubeP4CubeP3RayP8TrianglePiS5_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     19
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
