// System includes
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>

// CUDA runtime
#include <cuda.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>

//#include <thrust/host_vector.h>
//#include <thrust/device_vector.h>
//#include <thrust/copy.h>
//#include <thrust/fill.h>
//#include <thrust/sequence.h>
//https://github.com/thrust/thrust/blob/master/examples/bounding_box.cu

extern "C"
cudaError_t discretizePoints(const float4 *dev_points, float4 *dev_discPoints, int4 * dev_pointIdx, const int nPoints, const float3 mapRes, const float3 gridMin, const float3 gridMax, const cudaExtent gridDims);

extern "C"
cudaError_t addObsToVolume(const int4 * dev_pointIdx, int * dev_volume, const int nPoints, const cudaExtent gridDims);

extern "C"
cudaError_t interpolateVolume(int * dev_volume, const cudaExtent gridDims);

extern "C"
cudaError_t checkNegOnes(int * dev_volume, const cudaExtent gridDims, int *flag);

/**
* Discretizes a given set of points.
* points: Given points. .x .y .z are the coordinates, .w holds the data (0-255).
* discPoints: Discretized points. .x .y .z are the coordinates, .w holds the data.
* pointIdx: Holds the indices for each each point in the 3D grid
* nPoints: Number of given data points.
* mapRes: Resolution of the discretization grid in x,y,z (1 unit in data corresponds to 1/mapRes units in the Voronoi diagram)
* gridMin: Minimum point coords
* gridMax: Maximum point coords // probably not needed
*/
__global__ void discretizePoints_kernel(const float4 *points, float4 *discPoints, int4 * pointIdx, const int nPoints, const float3 mapRes, const float3 gridMin, const float3 gridMax, const cudaExtent gridDims)
{
	int idx = blockIdx.x*blockDim.x + threadIdx.x; //thread index

	if (idx > nPoints) { return; } // thread index greater than number of points in the points vector
	 
	float4 point = points[idx]; // get the point at location idx
	float4 newLoc; // discretized location
	int4 newIdx; // index in the volume
		
	//newIdx.x = (int)roundf((point.x - gridMin.x) / mapRes.x); // account for offset, if there is any
	//newIdx.y = (int)roundf((point.y - gridMin.y) / mapRes.y);
	//newIdx.z = (int)roundf((point.z - gridMin.z) / mapRes.z);
	//newIdx.w = (int)roundf(point.w);

	newIdx.x = (int)roundf((point.x - gridMin.x) / (gridMax.x - gridMin.x) * gridDims.width); // account for offset, if there is any
	newIdx.y = (int)roundf((point.y - gridMin.y) / (gridMax.y - gridMin.y) * gridDims.height);
	newIdx.z = (int)roundf((point.z - gridMin.z) / (gridMax.z - gridMin.z) * gridDims.depth);
	newIdx.w = (int)roundf(point.w);

	newLoc.x = newIdx.x * mapRes.x + gridMin.x; // scale by map resolution and round to nearest integer
	newLoc.y = newIdx.y * mapRes.y + gridMin.y;
	newLoc.z = newIdx.z * mapRes.z + gridMin.z;
	newLoc.w = roundf(point.w); // data value rounded to nearest integer

	pointIdx[idx] = newIdx; // add grid indices to pointIdx vector
	discPoints[idx] = newLoc; // add descretized point to discrete points vector

	__syncthreads(); // we could call cudaDeviceSynchronize instead
}

/**
* Assigns discretized points to their indices. Resolves multiple writes using max.
* pointIdx: Holds the indices for each each point in the 3D grid, and the color (.w)
* volume: Output volume
* nPoints: Number of given data points.
* gridDims: Height x Width x Depth of the map.
*/
__global__ void addObsToVolume_kernel(const int4 * pointIdx, int * volume, const int nPoints, const cudaExtent gridDims)
{
	int idx = blockIdx.x*blockDim.x + threadIdx.x; //thread index

	if (idx >= nPoints) // thread index greater than number of points in the pointIdx vector
	{
		return;
	}

	int4 point = pointIdx[idx];

	int linearIdx = gridDims.width*gridDims.height*point.z + gridDims.width*point.y + point.x;
	//int linearIdx = gridDims.width*gridDims.height*point.z + gridDims.height*point.x + point.y;

//	int nVoxels = gridDims.width*gridDims.height*gridDims.depth;
//	if (linearIdx >= nVoxels)
//		printf("--- Error in addObsToVolume_kernel: linearIdx >= nVoxels\n\n");

	atomicMax(&volume[linearIdx], point.w);

	__syncthreads();
}

/**
* Interpolate.
* volume: Output volume
* gridDims: Width x Height x  Depth of the map.
*/
__global__ void interpolate_kernel(int * dev_volume, const cudaExtent gridDims)
{
    int idx = blockIdx.x*blockDim.x + threadIdx.x; //thread index

    int nPoints = gridDims.width*gridDims.height*gridDims.depth;

    if (idx > nPoints) { return; } // thread index greater than number of points in the volume

    int pixVal = dev_volume[idx]; // get the point at location idx

    if( pixVal != -1 )
        return; // point is outside the interpolation boundary or already has a value

    // compute 3D idx
    int x,y,z, wh;
    wh = gridDims.width*gridDims.height;
    z = idx / wh;
    y = (idx - z*wh) / gridDims.width;
    x = (idx - z*wh - y*gridDims.width);

    // take a look at neighbors to see if there are any values to be used
    int right, left, up, down, front, back, rightLin, leftLin, upLin, downLin, frontLin, backLin;
    right = x+1        ; rightLin =     z*wh +    y*gridDims.width + right;
    left  = x-1        ; leftLin  =     z*wh +    y*gridDims.width +  left;
    up    =     y+1    ; upLin    =     z*wh +   up*gridDims.width +     x;
    down  =     y-1    ; downLin  =     z*wh + down*gridDims.width +     x;
    front =         z+1; frontLin = front*wh +    y*gridDims.width +     x;
    back  =         z-1; backLin  =  back*wh +    y*gridDims.width +     x;

    int rPix = -3, lPix = -3, uPix = -3, dPix = -3, fPix = -3, bPix = -3;
    if( (right < gridDims.width ) && (rightLin < nPoints)) { rPix = dev_volume[rightLin]; }
    if( ( left > -1)                                     ) { lPix = dev_volume[ leftLin]; }
    if( (   up < gridDims.height) && (   upLin < nPoints)) { uPix = dev_volume[   upLin]; }
    if( ( down > -1)                                     ) { dPix = dev_volume[ downLin]; }
    if( (front < gridDims.depth ) && (frontLin < nPoints)) { fPix = dev_volume[frontLin]; }
    if( ( back > -1)                                     ) { bPix = dev_volume[ backLin]; }

    int sum = rPix + lPix + uPix + dPix + fPix + bPix;

    if(sum == -18) // all out of bounds - should not happen unless volume is size 1x1x1
    { dev_volume[idx] = 0; return; }

    if( (rPix == -1) && (lPix == -1) && (uPix == -1) && (dPix == -1) && (fPix == -1) && (bPix == -1) )
    { return; } // do not change -1, we'll come back to it

    if( (rPix == -2) && (lPix == -2) && (uPix == -2) && (dPix == -2) && (fPix == -2) && (bPix == -2) )
    { dev_volume[idx] = 0; return; } // all outside conv hull - should not happen unless we have a single point

    // handle partial cases
    int div = 0;
    if( rPix < 0) { rPix = 0; } else { div++; }
    if( lPix < 0) { lPix = 0; } else { div++; }
    if( uPix < 0) { uPix = 0; } else { div++; }
    if( dPix < 0) { dPix = 0; } else { div++; }
    if( fPix < 0) { fPix = 0; } else { div++; }
    if( bPix < 0) { bPix = 0; } else { div++; }

    if(div < 1) { return; } // messed up, this shouldn't happen
    float newPixVal = (rPix + lPix + uPix + dPix + fPix + bPix)/(float)div;

    dev_volume[idx] = (int)newPixVal;

    __syncthreads(); // we could call cudaDeviceSynchronize instead
}

/**
* Interpolate.
* volume: Output volume
* gridDims: Width x Height x Depth of the map.
* flag : size 1 - 0 if no -1 found, >0 if found
*/
__global__ void checkNegOnes_kernel(int * dev_volume, const cudaExtent gridDims, int *flag)
{
    int idx = blockIdx.x*blockDim.x + threadIdx.x; //thread index

    int pixVal = dev_volume[idx];

    if(pixVal == -1)
        atomicAdd(flag, 1);

    __syncthreads();
}

// Helper function for using CUDA to add vectors in parallel.
extern "C"
cudaError_t discretizePoints(const float4 *dev_points, float4 *dev_discPoints, int4 *dev_pointIdx, int nPoints, const float3 mapRes, const float3 gridMin, const float3 gridMax, const cudaExtent gridDims)
{
	cudaError_t cudaStatus;

	// Calculate grid size
	int blockSize;      // The launch configurator returned block size 
	int minGridSize;    // The minimum grid size needed to achieve the maximum occupancy for a full device launch 
	int gridSize;       // The actual grid size needed, based on input size 
	cudaOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, discretizePoints_kernel, 0, nPoints);

	gridSize = (nPoints + blockSize - 1) / blockSize;

	// Launch a kernel on the GPU with one thread for each element.
	printf("Launching discretizePoints_kernel with <%d, %d> grids/blocks.\n", gridSize, blockSize);
	discretizePoints_kernel <<< gridSize, blockSize >>>(dev_points, dev_discPoints, dev_pointIdx, nPoints, mapRes, gridMin, gridMax, gridDims);

	// Check for any errors launching the kernel
	cudaStatus = cudaGetLastError();
	if (cudaStatus != cudaSuccess) {
		fprintf(stderr, "addKernel launch failed: %s\n", cudaGetErrorString(cudaStatus));
	}

	return cudaStatus;
}

extern "C"
cudaError_t addObsToVolume(const int4 * dev_pointIdx, int * dev_volume, const int nPoints, const cudaExtent gridDims)
{
	cudaError_t cudaStatus;

	// Calculate grid size
	int blockSize;      // The launch configurator returned block size 
	int minGridSize;    // The minimum grid size needed to achieve the maximum occupancy for a full device launch 
	int gridSize;       // The actual grid size needed, based on input size 
	cudaOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, addObsToVolume_kernel, 0, nPoints);

	gridSize = (nPoints + blockSize - 1) / blockSize;

	// Launch a kernel on the GPU with one thread for each element.
	printf("Launching addObsToVolume_kernel with <%d, %d> grids/blocks.\n", gridSize, blockSize);
	addObsToVolume_kernel <<< gridSize, blockSize >>>(dev_pointIdx, dev_volume, nPoints, gridDims);

	// Check for any errors launching the kernel
	cudaStatus = cudaGetLastError();
	if (cudaStatus != cudaSuccess) {
		fprintf(stderr, "addKernel launch failed: %s\n", cudaGetErrorString(cudaStatus));
	}

	return cudaStatus;
}

extern "C"
cudaError_t interpolateVolume(int * dev_volume, const cudaExtent gridDims)
{
    cudaError_t cudaStatus;

    int nPoints = gridDims.width*gridDims.height*gridDims.depth;

    // Calculate grid size
    int blockSize;      // The launch configurator returned block size
    int minGridSize;    // The minimum grid size needed to achieve the maximum occupancy for a full device launch
    int gridSize;       // The actual grid size needed, based on input size
    cudaOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, interpolate_kernel, 0, nPoints);

    gridSize = (nPoints + blockSize - 1) / blockSize;

    int h_flag = 1;
    int *dev_flag;
    // Allocate flag
    printf("CUDA malloc dev_flag.\n");
    cudaStatus = cudaMalloc((void**)&dev_flag, sizeof(int));
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "cudaMalloc failed!");
        return cudaStatus;
    }

    int nLoops = 0;
    while( (h_flag > 0) || (nLoops < 1000) )
    {
        // set flag to 0
        printf("CUDA memset dev_flag to 0.\n");
        cudaStatus = cudaMemset(dev_flag, 0, sizeof(int));
        if (cudaStatus != cudaSuccess) {
            fprintf(stderr, "cudaMemset failed!");
            return cudaStatus;
        }

        // Launch a kernel on the GPU with one thread for each element.
        printf("Launching interpolate_kernel with <%d, %d> grids/blocks.\n", gridSize, blockSize);
        interpolate_kernel <<< gridSize, blockSize >>>(dev_volume, gridDims);

        // Check for any errors launching the kernel
        cudaStatus = cudaGetLastError();
        if (cudaStatus != cudaSuccess) {
            fprintf(stderr, "interpolateKernel launch failed: %s\n", cudaGetErrorString(cudaStatus));
            return cudaStatus;
        }

        cudaStatus = checkNegOnes(dev_volume, gridDims, dev_flag);

        printf("CUDA memcpy dev_flag to h_flag.\n");
        cudaStatus = cudaMemcpy(&h_flag, dev_flag, sizeof(int), cudaMemcpyDeviceToHost);
        if (cudaStatus != cudaSuccess) {
            fprintf(stderr, "cudaMemcpy failed!");
            return cudaStatus;
        }
        nLoops++;
    }

    return cudaStatus;
}

extern "C"
cudaError_t checkNegOnes(int * dev_volume, const cudaExtent gridDims, int *flag)
{
    cudaError_t cudaStatus;

    int nPoints = gridDims.width*gridDims.height*gridDims.depth;

    // Calculate grid size
    int blockSize;      // The launch configurator returned block size
    int minGridSize;    // The minimum grid size needed to achieve the maximum occupancy for a full device launch
    int gridSize;       // The actual grid size needed, based on input size
    cudaOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, checkNegOnes_kernel, 0, nPoints);

    gridSize = (nPoints + blockSize - 1) / blockSize;

    // Launch a kernel on the GPU with one thread for each element.
    printf("Launching checkNegOnes_kernel with <%d, %d> grids/blocks.\n", gridSize, blockSize);
    checkNegOnes_kernel <<< gridSize, blockSize >>>(dev_volume, gridDims, flag);

    // Check for any errors launching the kernel
    cudaStatus = cudaGetLastError();
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "checkNegOnesKernel launch failed: %s\n", cudaGetErrorString(cudaStatus));
    }

    return cudaStatus;
}

	.file	"tmpxft_002c8783_00000000-6_RT3DUSkernels.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2033:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2033:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.type	_Z55cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlagsI24__cudaOccupancyB2DHelperPFvPK6float4PS1_P4int4i6float3S7_S7_10cudaExtentEE9cudaErrorPiSC_T0_T_ij.constprop.0.isra.0, @function
_Z55cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlagsI24__cudaOccupancyB2DHelperPFvPK6float4PS1_P4int4i6float3S7_S7_10cudaExtentEE9cudaErrorPiSC_T0_T_ij.constprop.0.isra.0:
.LFB2199:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%r8d, %ebx
	subq	$216, %rsp
	.cfi_def_cfa_offset 272
	movq	%rdx, (%rsp)
	leaq	32(%rsp), %rdi
	movq	%fs:40, %rax
	movq	%rax, 200(%rsp)
	xorl	%eax, %eax
	call	cudaGetDevice@PLT
	testl	%eax, %eax
	jne	.L2
	movl	32(%rsp), %edx
	leaq	36(%rsp), %rdi
	movl	$39, %esi
	call	cudaDeviceGetAttribute@PLT
	testl	%eax, %eax
	jne	.L2
	movl	32(%rsp), %edx
	leaq	40(%rsp), %rdi
	movl	$10, %esi
	call	cudaDeviceGetAttribute@PLT
	testl	%eax, %eax
	jne	.L2
	movl	32(%rsp), %edx
	leaq	44(%rsp), %rdi
	movl	$1, %esi
	call	cudaDeviceGetAttribute@PLT
	testl	%eax, %eax
	jne	.L2
	movl	32(%rsp), %edx
	leaq	48(%rsp), %rdi
	movl	$16, %esi
	call	cudaDeviceGetAttribute@PLT
	testl	%eax, %eax
	jne	.L2
	movq	(%rsp), %rsi
	leaq	56(%rsp), %rdi
	call	cudaFuncGetAttributes@PLT
	testl	%eax, %eax
	jne	.L2
	movl	36(%rsp), %eax
	movl	80(%rsp), %ebp
	testl	%ebx, %ebx
	movl	40(%rsp), %r9d
	movl	%eax, 16(%rsp)
	movl	44(%rsp), %eax
	cmove	%eax, %ebx
	cmpl	%eax, %ebp
	cmovg	%eax, %ebp
	cmpl	%ebx, %ebp
	cmovg	%ebx, %ebp
	xorl	%r10d, %r10d
	xorl	%r12d, %r12d
	xorl	%r15d, %r15d
	leal	-1(%r9,%rbp), %ebx
	movl	%ebx, %eax
	cltd
	idivl	%r9d
	leaq	52(%rsp), %rax
	movq	%rax, 8(%rsp)
	subl	%edx, %ebx
.L7:
	testl	%ebx, %ebx
	jle	.L9
	cmpl	%ebx, %ebp
	movl	%ebx, %edx
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdi
	cmovle	%ebp, %edx
	xorl	%r8d, %r8d
	xorl	%ecx, %ecx
	movl	%r10d, 28(%rsp)
	movl	%r9d, 24(%rsp)
	movl	%edx, 20(%rsp)
	call	cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags@PLT
	testl	%eax, %eax
	jne	.L2
	movl	20(%rsp), %edx
	movl	52(%rsp), %eax
	movl	28(%rsp), %r10d
	movl	24(%rsp), %r9d
	movl	%edx, %ecx
	imull	%eax, %ecx
	cmpl	%r10d, %ecx
	jle	.L8
	movl	%ecx, %r10d
	movl	%eax, %r12d
	movl	%edx, %r15d
.L8:
	cmpl	%r10d, 16(%rsp)
	je	.L9
	subl	%r9d, %ebx
	jmp	.L7
.L9:
	imull	48(%rsp), %r12d
	movl	%r12d, (%r14)
	movl	%r15d, 0(%r13)
.L2:
	movq	200(%rsp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	addq	$216, %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
.LFE2199:
	.size	_Z55cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlagsI24__cudaOccupancyB2DHelperPFvPK6float4PS1_P4int4i6float3S7_S7_10cudaExtentEE9cudaErrorPiSC_T0_T_ij.constprop.0.isra.0, .-_Z55cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlagsI24__cudaOccupancyB2DHelperPFvPK6float4PS1_P4int4i6float3S7_S7_10cudaExtentEE9cudaErrorPiSC_T0_T_ij.constprop.0.isra.0
	.globl	_Z85__device_stub__Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtentPK6float4PS_P4int4iRK6float3S7_S7_RK10cudaExtent
	.type	_Z85__device_stub__Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtentPK6float4PS_P4int4iRK6float3S7_S7_RK10cudaExtent, @function
_Z85__device_stub__Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtentPK6float4PS_P4int4iRK6float3S7_S7_RK10cudaExtent:
.LFB2055:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movq	%r8, 136(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movq	192(%rsp), %rax
	movq	%r9, 144(%rsp)
	movq	%rax, 152(%rsp)
	movq	200(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L16
	pushq	48(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtent(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 208
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L16:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2055:
	.size	_Z85__device_stub__Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtentPK6float4PS_P4int4iRK6float3S7_S7_RK10cudaExtent, .-_Z85__device_stub__Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtentPK6float4PS_P4int4iRK6float3S7_S7_RK10cudaExtent
	.globl	_Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtent
	.type	_Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtent, @function
_Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtent:
.LFB2056:
	.cfi_startproc
	endbr64
	subq	$56, %rsp
	.cfi_def_cfa_offset 64
	leaq	64(%rsp), %rax
	movq	%xmm0, 32(%rsp)
	movss	%xmm1, 40(%rsp)
	movq	%xmm2, 16(%rsp)
	movss	%xmm3, 24(%rsp)
	movq	%xmm4, (%rsp)
	movss	%xmm5, 8(%rsp)
	pushq	%rax
	.cfi_def_cfa_offset 72
	leaq	8(%rsp), %rax
	pushq	%rax
	.cfi_def_cfa_offset 80
	leaq	32(%rsp), %r9
	leaq	48(%rsp), %r8
	call	_Z85__device_stub__Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtentPK6float4PS_P4int4iRK6float3S7_S7_RK10cudaExtent
	addq	$72, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2056:
	.size	_Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtent, .-_Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtent
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Launching discretizePoints_kernel with <%d, %d> grids/blocks.\n"
.LC1:
	.string	"addKernel launch failed: %s\n"
	.text
	.globl	discretizePoints
	.type	discretizePoints, @function
discretizePoints:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%ecx, %r8d
	movq	%rdx, %r15
	leaq	_Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtent(%rip), %rdx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%ecx, %ebx
	xorl	%ecx, %ecx
	subq	$168, %rsp
	.cfi_def_cfa_offset 224
	movss	%xmm1, 40(%rsp)
	leaq	60(%rsp), %rsi
	leaq	64(%rsp), %rdi
	movq	%xmm0, 32(%rsp)
	movq	%xmm2, 16(%rsp)
	movss	%xmm3, 24(%rsp)
	movq	%xmm4, (%rsp)
	movss	%xmm5, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	call	_Z55cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlagsI24__cudaOccupancyB2DHelperPFvPK6float4PS1_P4int4i6float3S7_S7_10cudaExtentEE9cudaErrorPiSC_T0_T_ij.constprop.0.isra.0
	movl	60(%rsp), %r12d
	movl	$2, %edi
	leaq	.LC0(%rip), %rsi
	leal	-1(%r12,%rbx), %eax
	movl	%r12d, %ecx
	cltd
	idivl	%r12d
	movl	%eax, %edx
	movl	%eax, %ebp
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	%r12d, 80(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movabsq	$4294967297, %rax
	movl	%ebp, 68(%rsp)
	movq	%rax, 84(%rsp)
	movl	88(%rsp), %ecx
	movq	%rax, 72(%rsp)
	movq	80(%rsp), %rdx
	movq	68(%rsp), %rdi
	movl	76(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L23
	movq	32(%rsp), %rax
	movq	%r15, %rdx
	movl	%ebx, %ecx
	movq	%r14, %rsi
	movups	224(%rsp), %xmm6
	movq	%r13, %rdi
	movq	%rax, 92(%rsp)
	movl	40(%rsp), %eax
	movups	%xmm6, 128(%rsp)
	movl	%eax, 100(%rsp)
	movq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	movl	24(%rsp), %eax
	movl	%eax, 112(%rsp)
	movq	(%rsp), %rax
	movq	%rax, 116(%rsp)
	movl	8(%rsp), %eax
	movl	%eax, 124(%rsp)
	movq	240(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	128(%rsp), %rax
	pushq	%rax
	.cfi_def_cfa_offset 232
	leaq	124(%rsp), %rax
	pushq	%rax
	.cfi_def_cfa_offset 240
	leaq	120(%rsp), %r9
	leaq	108(%rsp), %r8
	call	_Z85__device_stub__Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtentPK6float4PS_P4int4iRK6float3S7_S7_RK10cudaExtent
	popq	%rax
	.cfi_def_cfa_offset 232
	popq	%rdx
	.cfi_def_cfa_offset 224
.L23:
	call	cudaGetLastError@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L22
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	leaq	.LC1(%rip), %rdx
	movq	%rax, %rcx
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L22:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	addq	$168, %rsp
	.cfi_def_cfa_offset 56
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	discretizePoints, .-discretizePoints
	.globl	_Z61__device_stub__Z21addObsToVolume_kernelPK4int4Pii10cudaExtentPK4int4PiiRK10cudaExtent
	.type	_Z61__device_stub__Z21addObsToVolume_kernelPK4int4Pii10cudaExtentPK4int4PiiRK10cudaExtent, @function
_Z61__device_stub__Z21addObsToVolume_kernelPK4int4Pii10cudaExtentPK4int4PiiRK10cudaExtent:
.LFB2057:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movq	%rcx, 128(%rsp)
	leaq	48(%rsp), %rcx
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movl	$1, 64(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L30
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z21addObsToVolume_kernelPK4int4Pii10cudaExtent(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L30:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2057:
	.size	_Z61__device_stub__Z21addObsToVolume_kernelPK4int4Pii10cudaExtentPK4int4PiiRK10cudaExtent, .-_Z61__device_stub__Z21addObsToVolume_kernelPK4int4Pii10cudaExtentPK4int4PiiRK10cudaExtent
	.globl	_Z21addObsToVolume_kernelPK4int4Pii10cudaExtent
	.type	_Z21addObsToVolume_kernelPK4int4Pii10cudaExtent, @function
_Z21addObsToVolume_kernelPK4int4Pii10cudaExtent:
.LFB2058:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	16(%rsp), %rcx
	call	_Z61__device_stub__Z21addObsToVolume_kernelPK4int4Pii10cudaExtentPK4int4PiiRK10cudaExtent
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z21addObsToVolume_kernelPK4int4Pii10cudaExtent, .-_Z21addObsToVolume_kernelPK4int4Pii10cudaExtent
	.section	.rodata.str1.1
.LC2:
	.string	"Launching addObsToVolume_kernel with <%d, %d> grids/blocks.\n"
	.text
	.globl	addObsToVolume
	.type	addObsToVolume, @function
addObsToVolume:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	%edx, %r8d
	xorl	%ecx, %ecx
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movl	%edx, %ebx
	leaq	_Z21addObsToVolume_kernelPK4int4Pii10cudaExtent(%rip), %rdx
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	4(%rsp), %rdi
	call	_Z55cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlagsI24__cudaOccupancyB2DHelperPFvPK6float4PS1_P4int4i6float3S7_S7_10cudaExtentEE9cudaErrorPiSC_T0_T_ij.constprop.0.isra.0
	movl	(%rsp), %r12d
	movl	$2, %edi
	leaq	.LC2(%rip), %rsi
	leal	-1(%r12,%rbx), %eax
	movl	%r12d, %ecx
	cltd
	idivl	%r12d
	movl	%eax, %edx
	movl	%eax, %ebp
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	%r12d, 20(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movabsq	$4294967297, %rax
	movl	%ebp, 8(%rsp)
	movq	%rax, 24(%rsp)
	movl	28(%rsp), %ecx
	movq	%rax, 12(%rsp)
	movq	20(%rsp), %rdx
	movq	8(%rsp), %rdi
	movl	16(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L37
	movups	112(%rsp), %xmm0
	leaq	32(%rsp), %rcx
	movl	%ebx, %edx
	movq	%r14, %rsi
	movq	128(%rsp), %rax
	movq	%r13, %rdi
	movups	%xmm0, 32(%rsp)
	movq	%rax, 48(%rsp)
	call	_Z61__device_stub__Z21addObsToVolume_kernelPK4int4Pii10cudaExtentPK4int4PiiRK10cudaExtent
.L37:
	call	cudaGetLastError@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L36
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	leaq	.LC1(%rip), %rdx
	movq	%rax, %rcx
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L36:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L39
	call	__stack_chk_fail@PLT
.L39:
	addq	$64, %rsp
	.cfi_def_cfa_offset 48
	movl	%ebx, %eax
	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
.LFE2028:
	.size	addObsToVolume, .-addObsToVolume
	.globl	_Z50__device_stub__Z18interpolate_kernelPi10cudaExtentPiRK10cudaExtent
	.type	_Z50__device_stub__Z18interpolate_kernelPi10cudaExtentPiRK10cudaExtent, @function
_Z50__device_stub__Z18interpolate_kernelPi10cudaExtentPiRK10cudaExtent:
.LFB2059:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	leaq	40(%rsp), %rdi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movq	%rsi, 96(%rsp)
	leaq	52(%rsp), %rsi
	movq	%rax, 88(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movl	$1, 48(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L44
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z18interpolate_kernelPi10cudaExtent(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L44:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L46
	call	__stack_chk_fail@PLT
.L46:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2059:
	.size	_Z50__device_stub__Z18interpolate_kernelPi10cudaExtentPiRK10cudaExtent, .-_Z50__device_stub__Z18interpolate_kernelPi10cudaExtentPiRK10cudaExtent
	.globl	_Z18interpolate_kernelPi10cudaExtent
	.type	_Z18interpolate_kernelPi10cudaExtent, @function
_Z18interpolate_kernelPi10cudaExtent:
.LFB2060:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	16(%rsp), %rsi
	call	_Z50__device_stub__Z18interpolate_kernelPi10cudaExtentPiRK10cudaExtent
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2060:
	.size	_Z18interpolate_kernelPi10cudaExtent, .-_Z18interpolate_kernelPi10cudaExtent
	.globl	_Z53__device_stub__Z19checkNegOnes_kernelPi10cudaExtentS_PiRK10cudaExtentS_
	.type	_Z53__device_stub__Z19checkNegOnes_kernelPi10cudaExtentS_PiRK10cudaExtentS_, @function
_Z53__device_stub__Z19checkNegOnes_kernelPi10cudaExtentS_PiRK10cudaExtentS_:
.LFB2061:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	24(%rsp), %rcx
	leaq	32(%rsp), %rdi
	movq	%rdx, (%rsp)
	leaq	16(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movq	%rsi, 88(%rsp)
	leaq	44(%rsp), %rsi
	movq	%rax, 80(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movl	$1, 40(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L50
	pushq	24(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z19checkNegOnes_kernelPi10cudaExtentS_(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 144
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L50:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L52
	call	__stack_chk_fail@PLT
.L52:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2061:
	.size	_Z53__device_stub__Z19checkNegOnes_kernelPi10cudaExtentS_PiRK10cudaExtentS_, .-_Z53__device_stub__Z19checkNegOnes_kernelPi10cudaExtentS_PiRK10cudaExtentS_
	.globl	_Z19checkNegOnes_kernelPi10cudaExtentS_
	.type	_Z19checkNegOnes_kernelPi10cudaExtentS_, @function
_Z19checkNegOnes_kernelPi10cudaExtentS_:
.LFB2062:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rsi, %rdx
	leaq	16(%rsp), %rsi
	call	_Z53__device_stub__Z19checkNegOnes_kernelPi10cudaExtentS_PiRK10cudaExtentS_
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2062:
	.size	_Z19checkNegOnes_kernelPi10cudaExtentS_, .-_Z19checkNegOnes_kernelPi10cudaExtentS_
	.section	.rodata.str1.1
.LC3:
	.string	"Launching checkNegOnes_kernel with <%d, %d> grids/blocks.\n"
.LC4:
	.string	"checkNegOnesKernel launch failed: %s\n"
	.text
	.globl	checkNegOnes
	.type	checkNegOnes, @function
checkNegOnes:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xorl	%ecx, %ecx
	leaq	_Z19checkNegOnes_kernelPi10cudaExtentS_(%rip), %rdx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$72, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movq	120(%rsp), %rbx
	imull	112(%rsp), %ebx
	movq	%rsp, %rsi
	imull	128(%rsp), %ebx
	leaq	4(%rsp), %rdi
	movl	%ebx, %r8d
	call	_Z55cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlagsI24__cudaOccupancyB2DHelperPFvPK6float4PS1_P4int4i6float3S7_S7_10cudaExtentEE9cudaErrorPiSC_T0_T_ij.constprop.0.isra.0
	movl	(%rsp), %r13d
	movl	$2, %edi
	leaq	.LC3(%rip), %rsi
	leal	-1(%r13,%rbx), %eax
	movl	%r13d, %ecx
	cltd
	idivl	%r13d
	movl	%eax, %edx
	movl	%eax, %ebx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	%r13d, 20(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movabsq	$4294967297, %rax
	movl	%ebx, 8(%rsp)
	movq	%rax, 24(%rsp)
	movl	28(%rsp), %ecx
	movq	%rax, 12(%rsp)
	movq	20(%rsp), %rdx
	movq	8(%rsp), %rdi
	movl	16(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L57
	movups	112(%rsp), %xmm0
	leaq	32(%rsp), %rsi
	movq	%r12, %rdx
	movq	%rbp, %rdi
	movq	128(%rsp), %rax
	movups	%xmm0, 32(%rsp)
	movq	%rax, 48(%rsp)
	call	_Z53__device_stub__Z19checkNegOnes_kernelPi10cudaExtentS_PiRK10cudaExtentS_
.L57:
	call	cudaGetLastError@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L56
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	leaq	.LC4(%rip), %rdx
	movq	%rax, %rcx
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L56:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L59
	call	__stack_chk_fail@PLT
.L59:
	addq	$72, %rsp
	.cfi_def_cfa_offset 40
	movl	%ebx, %eax
	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
.LFE2030:
	.size	checkNegOnes, .-checkNegOnes
	.section	.rodata.str1.1
.LC5:
	.string	"CUDA malloc dev_flag.\n"
.LC6:
	.string	"cudaMalloc failed!"
.LC7:
	.string	"CUDA memset dev_flag to 0.\n"
.LC8:
	.string	"cudaMemset failed!"
.LC9:
	.string	"Launching interpolate_kernel with <%d, %d> grids/blocks.\n"
.LC10:
	.string	"interpolateKernel launch failed: %s\n"
.LC11:
	.string	"CUDA memcpy dev_flag to h_flag.\n"
.LC12:
	.string	"cudaMemcpy failed!"
	.text
	.globl	interpolateVolume
	.type	interpolateVolume, @function
interpolateVolume:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%ecx, %ecx
	leaq	_Z18interpolate_kernelPi10cudaExtent(%rip), %rdx
	leaq	.LC7(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	xorl	%r14d, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	movq	152(%rsp), %rbx
	imull	144(%rsp), %ebx
	leaq	4(%rsp), %rsi
	imull	160(%rsp), %ebx
	leaq	8(%rsp), %rdi
	movl	%ebx, %r8d
	call	_Z55cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlagsI24__cudaOccupancyB2DHelperPFvPK6float4PS1_P4int4i6float3S7_S7_10cudaExtentEE9cudaErrorPiSC_T0_T_ij.constprop.0.isra.0
	movl	4(%rsp), %ebp
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	movl	$1, 12(%rsp)
	leal	-1(%rbp,%rbx), %eax
	cltd
	idivl	%ebp
	movl	%eax, %r13d
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	16(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	leaq	.LC6(%rip), %rdx
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.L76
.L73:
	movq	%r15, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%rsp), %rdi
	movl	$4, %edx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L67
	leaq	.LC8(%rip), %rdx
.L76:
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	jmp	.L64
.L67:
	movl	%ebp, %ecx
	movl	%r13d, %edx
	leaq	.LC9(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	%ebp, 36(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movabsq	$4294967297, %rax
	movl	%r13d, 24(%rsp)
	movq	%rax, 40(%rsp)
	movl	44(%rsp), %ecx
	movq	%rax, 28(%rsp)
	movq	36(%rsp), %rdx
	movq	24(%rsp), %rdi
	movl	32(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L68
	movups	144(%rsp), %xmm0
	movq	160(%rsp), %rax
	leaq	48(%rsp), %rsi
	movq	%r12, %rdi
	movq	%rax, 64(%rsp)
	movups	%xmm0, 48(%rsp)
	call	_Z50__device_stub__Z18interpolate_kernelPi10cudaExtentPiRK10cudaExtent
.L68:
	call	cudaGetLastError@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L69
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	leaq	.LC10(%rip), %rdx
	movq	%rax, %rcx
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	jmp	.L64
.L69:
	subq	$32, %rsp
	.cfi_def_cfa_offset 176
	movq	%r12, %rdi
	movups	176(%rsp), %xmm1
	movq	192(%rsp), %rax
	movq	48(%rsp), %rsi
	movups	%xmm1, (%rsp)
	movq	%rax, 16(%rsp)
	call	checkNegOnes
	addq	$32, %rsp
	.cfi_def_cfa_offset 144
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC11(%rip), %rsi
	call	__printf_chk@PLT
	movq	16(%rsp), %rsi
	leaq	12(%rsp), %rdi
	movl	$2, %ecx
	movl	$4, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L70
	leaq	.LC12(%rip), %rdx
	jmp	.L76
.L70:
	incl	%r14d
	cmpl	$0, 12(%rsp)
	jg	.L73
	cmpl	$999, %r14d
	jle	.L73
.L64:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L71
	call	__stack_chk_fail@PLT
.L71:
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	interpolateVolume, .-interpolateVolume
	.section	.rodata.str1.1
.LC13:
	.string	"_Z19checkNegOnes_kernelPi10cudaExtentS_"
.LC14:
	.string	"_Z18interpolate_kernelPi10cudaExtent"
.LC15:
	.string	"_Z21addObsToVolume_kernelPK4int4Pii10cudaExtent"
.LC16:
	.string	"_Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtent"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2064:
	.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	.LC13(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z19checkNegOnes_kernelPi10cudaExtentS_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC14(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z18interpolate_kernelPi10cudaExtent(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC15(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z21addObsToVolume_kernelPK4int4Pii10cudaExtent(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC16(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z23discretizePoints_kernelPK6float4PS_P4int4i6float3S5_S5_10cudaExtent(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2064:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.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:

// System includes
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>

// CUDA runtime
#include <hip/hip_runtime.h>



//#include <thrust/host_vector.h>
//#include <thrust/device_vector.h>
//#include <thrust/copy.h>
//#include <thrust/fill.h>
//#include <thrust/sequence.h>
//https://github.com/thrust/thrust/blob/master/examples/bounding_box.cu

extern "C"
hipError_t discretizePoints(const float4 *dev_points, float4 *dev_discPoints, int4 * dev_pointIdx, const int nPoints, const float3 mapRes, const float3 gridMin, const float3 gridMax, const hipExtent gridDims);

extern "C"
hipError_t addObsToVolume(const int4 * dev_pointIdx, int * dev_volume, const int nPoints, const hipExtent gridDims);

extern "C"
hipError_t interpolateVolume(int * dev_volume, const hipExtent gridDims);

extern "C"
hipError_t checkNegOnes(int * dev_volume, const hipExtent gridDims, int *flag);

/**
* Discretizes a given set of points.
* points: Given points. .x .y .z are the coordinates, .w holds the data (0-255).
* discPoints: Discretized points. .x .y .z are the coordinates, .w holds the data.
* pointIdx: Holds the indices for each each point in the 3D grid
* nPoints: Number of given data points.
* mapRes: Resolution of the discretization grid in x,y,z (1 unit in data corresponds to 1/mapRes units in the Voronoi diagram)
* gridMin: Minimum point coords
* gridMax: Maximum point coords // probably not needed
*/
__global__ void discretizePoints_kernel(const float4 *points, float4 *discPoints, int4 * pointIdx, const int nPoints, const float3 mapRes, const float3 gridMin, const float3 gridMax, const hipExtent gridDims)
{
	int idx = blockIdx.x*blockDim.x + threadIdx.x; //thread index

	if (idx > nPoints) { return; } // thread index greater than number of points in the points vector
	 
	float4 point = points[idx]; // get the point at location idx
	float4 newLoc; // discretized location
	int4 newIdx; // index in the volume
		
	//newIdx.x = (int)roundf((point.x - gridMin.x) / mapRes.x); // account for offset, if there is any
	//newIdx.y = (int)roundf((point.y - gridMin.y) / mapRes.y);
	//newIdx.z = (int)roundf((point.z - gridMin.z) / mapRes.z);
	//newIdx.w = (int)roundf(point.w);

	newIdx.x = (int)roundf((point.x - gridMin.x) / (gridMax.x - gridMin.x) * gridDims.width); // account for offset, if there is any
	newIdx.y = (int)roundf((point.y - gridMin.y) / (gridMax.y - gridMin.y) * gridDims.height);
	newIdx.z = (int)roundf((point.z - gridMin.z) / (gridMax.z - gridMin.z) * gridDims.depth);
	newIdx.w = (int)roundf(point.w);

	newLoc.x = newIdx.x * mapRes.x + gridMin.x; // scale by map resolution and round to nearest integer
	newLoc.y = newIdx.y * mapRes.y + gridMin.y;
	newLoc.z = newIdx.z * mapRes.z + gridMin.z;
	newLoc.w = roundf(point.w); // data value rounded to nearest integer

	pointIdx[idx] = newIdx; // add grid indices to pointIdx vector
	discPoints[idx] = newLoc; // add descretized point to discrete points vector

	__syncthreads(); // we could call cudaDeviceSynchronize instead
}

/**
* Assigns discretized points to their indices. Resolves multiple writes using max.
* pointIdx: Holds the indices for each each point in the 3D grid, and the color (.w)
* volume: Output volume
* nPoints: Number of given data points.
* gridDims: Height x Width x Depth of the map.
*/
__global__ void addObsToVolume_kernel(const int4 * pointIdx, int * volume, const int nPoints, const hipExtent gridDims)
{
	int idx = blockIdx.x*blockDim.x + threadIdx.x; //thread index

	if (idx >= nPoints) // thread index greater than number of points in the pointIdx vector
	{
		return;
	}

	int4 point = pointIdx[idx];

	int linearIdx = gridDims.width*gridDims.height*point.z + gridDims.width*point.y + point.x;
	//int linearIdx = gridDims.width*gridDims.height*point.z + gridDims.height*point.x + point.y;

//	int nVoxels = gridDims.width*gridDims.height*gridDims.depth;
//	if (linearIdx >= nVoxels)
//		printf("--- Error in addObsToVolume_kernel: linearIdx >= nVoxels\n\n");

	atomicMax(&volume[linearIdx], point.w);

	__syncthreads();
}

/**
* Interpolate.
* volume: Output volume
* gridDims: Width x Height x  Depth of the map.
*/
__global__ void interpolate_kernel(int * dev_volume, const hipExtent gridDims)
{
    int idx = blockIdx.x*blockDim.x + threadIdx.x; //thread index

    int nPoints = gridDims.width*gridDims.height*gridDims.depth;

    if (idx > nPoints) { return; } // thread index greater than number of points in the volume

    int pixVal = dev_volume[idx]; // get the point at location idx

    if( pixVal != -1 )
        return; // point is outside the interpolation boundary or already has a value

    // compute 3D idx
    int x,y,z, wh;
    wh = gridDims.width*gridDims.height;
    z = idx / wh;
    y = (idx - z*wh) / gridDims.width;
    x = (idx - z*wh - y*gridDims.width);

    // take a look at neighbors to see if there are any values to be used
    int right, left, up, down, front, back, rightLin, leftLin, upLin, downLin, frontLin, backLin;
    right = x+1        ; rightLin =     z*wh +    y*gridDims.width + right;
    left  = x-1        ; leftLin  =     z*wh +    y*gridDims.width +  left;
    up    =     y+1    ; upLin    =     z*wh +   up*gridDims.width +     x;
    down  =     y-1    ; downLin  =     z*wh + down*gridDims.width +     x;
    front =         z+1; frontLin = front*wh +    y*gridDims.width +     x;
    back  =         z-1; backLin  =  back*wh +    y*gridDims.width +     x;

    int rPix = -3, lPix = -3, uPix = -3, dPix = -3, fPix = -3, bPix = -3;
    if( (right < gridDims.width ) && (rightLin < nPoints)) { rPix = dev_volume[rightLin]; }
    if( ( left > -1)                                     ) { lPix = dev_volume[ leftLin]; }
    if( (   up < gridDims.height) && (   upLin < nPoints)) { uPix = dev_volume[   upLin]; }
    if( ( down > -1)                                     ) { dPix = dev_volume[ downLin]; }
    if( (front < gridDims.depth ) && (frontLin < nPoints)) { fPix = dev_volume[frontLin]; }
    if( ( back > -1)                                     ) { bPix = dev_volume[ backLin]; }

    int sum = rPix + lPix + uPix + dPix + fPix + bPix;

    if(sum == -18) // all out of bounds - should not happen unless volume is size 1x1x1
    { dev_volume[idx] = 0; return; }

    if( (rPix == -1) && (lPix == -1) && (uPix == -1) && (dPix == -1) && (fPix == -1) && (bPix == -1) )
    { return; } // do not change -1, we'll come back to it

    if( (rPix == -2) && (lPix == -2) && (uPix == -2) && (dPix == -2) && (fPix == -2) && (bPix == -2) )
    { dev_volume[idx] = 0; return; } // all outside conv hull - should not happen unless we have a single point

    // handle partial cases
    int div = 0;
    if( rPix < 0) { rPix = 0; } else { div++; }
    if( lPix < 0) { lPix = 0; } else { div++; }
    if( uPix < 0) { uPix = 0; } else { div++; }
    if( dPix < 0) { dPix = 0; } else { div++; }
    if( fPix < 0) { fPix = 0; } else { div++; }
    if( bPix < 0) { bPix = 0; } else { div++; }

    if(div < 1) { return; } // messed up, this shouldn't happen
    float newPixVal = (rPix + lPix + uPix + dPix + fPix + bPix)/(float)div;

    dev_volume[idx] = (int)newPixVal;

    __syncthreads(); // we could call cudaDeviceSynchronize instead
}

/**
* Interpolate.
* volume: Output volume
* gridDims: Width x Height x Depth of the map.
* flag : size 1 - 0 if no -1 found, >0 if found
*/
__global__ void checkNegOnes_kernel(int * dev_volume, const hipExtent gridDims, int *flag)
{
    int idx = blockIdx.x*blockDim.x + threadIdx.x; //thread index

    int pixVal = dev_volume[idx];

    if(pixVal == -1)
        atomicAdd(flag, 1);

    __syncthreads();
}

// Helper function for using CUDA to add vectors in parallel.
extern "C"
hipError_t discretizePoints(const float4 *dev_points, float4 *dev_discPoints, int4 *dev_pointIdx, int nPoints, const float3 mapRes, const float3 gridMin, const float3 gridMax, const hipExtent gridDims)
{
	hipError_t cudaStatus;

	// Calculate grid size
	int blockSize;      // The launch configurator returned block size 
	int minGridSize;    // The minimum grid size needed to achieve the maximum occupancy for a full device launch 
	int gridSize;       // The actual grid size needed, based on input size 
	hipOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, discretizePoints_kernel, 0, nPoints);

	gridSize = (nPoints + blockSize - 1) / blockSize;

	// Launch a kernel on the GPU with one thread for each element.
	printf("Launching discretizePoints_kernel with <%d, %d> grids/blocks.\n", gridSize, blockSize);
	discretizePoints_kernel <<< gridSize, blockSize >>>(dev_points, dev_discPoints, dev_pointIdx, nPoints, mapRes, gridMin, gridMax, gridDims);

	// Check for any errors launching the kernel
	cudaStatus = hipGetLastError();
	if (cudaStatus != hipSuccess) {
		fprintf(stderr, "addKernel launch failed: %s\n", hipGetErrorString(cudaStatus));
	}

	return cudaStatus;
}

extern "C"
hipError_t addObsToVolume(const int4 * dev_pointIdx, int * dev_volume, const int nPoints, const hipExtent gridDims)
{
	hipError_t cudaStatus;

	// Calculate grid size
	int blockSize;      // The launch configurator returned block size 
	int minGridSize;    // The minimum grid size needed to achieve the maximum occupancy for a full device launch 
	int gridSize;       // The actual grid size needed, based on input size 
	hipOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, addObsToVolume_kernel, 0, nPoints);

	gridSize = (nPoints + blockSize - 1) / blockSize;

	// Launch a kernel on the GPU with one thread for each element.
	printf("Launching addObsToVolume_kernel with <%d, %d> grids/blocks.\n", gridSize, blockSize);
	addObsToVolume_kernel <<< gridSize, blockSize >>>(dev_pointIdx, dev_volume, nPoints, gridDims);

	// Check for any errors launching the kernel
	cudaStatus = hipGetLastError();
	if (cudaStatus != hipSuccess) {
		fprintf(stderr, "addKernel launch failed: %s\n", hipGetErrorString(cudaStatus));
	}

	return cudaStatus;
}

extern "C"
hipError_t interpolateVolume(int * dev_volume, const hipExtent gridDims)
{
    hipError_t cudaStatus;

    int nPoints = gridDims.width*gridDims.height*gridDims.depth;

    // Calculate grid size
    int blockSize;      // The launch configurator returned block size
    int minGridSize;    // The minimum grid size needed to achieve the maximum occupancy for a full device launch
    int gridSize;       // The actual grid size needed, based on input size
    hipOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, interpolate_kernel, 0, nPoints);

    gridSize = (nPoints + blockSize - 1) / blockSize;

    int h_flag = 1;
    int *dev_flag;
    // Allocate flag
    printf("CUDA malloc dev_flag.\n");
    cudaStatus = hipMalloc((void**)&dev_flag, sizeof(int));
    if (cudaStatus != hipSuccess) {
        fprintf(stderr, "hipMalloc failed!");
        return cudaStatus;
    }

    int nLoops = 0;
    while( (h_flag > 0) || (nLoops < 1000) )
    {
        // set flag to 0
        printf("CUDA memset dev_flag to 0.\n");
        cudaStatus = hipMemset(dev_flag, 0, sizeof(int));
        if (cudaStatus != hipSuccess) {
            fprintf(stderr, "hipMemset failed!");
            return cudaStatus;
        }

        // Launch a kernel on the GPU with one thread for each element.
        printf("Launching interpolate_kernel with <%d, %d> grids/blocks.\n", gridSize, blockSize);
        interpolate_kernel <<< gridSize, blockSize >>>(dev_volume, gridDims);

        // Check for any errors launching the kernel
        cudaStatus = hipGetLastError();
        if (cudaStatus != hipSuccess) {
            fprintf(stderr, "interpolateKernel launch failed: %s\n", hipGetErrorString(cudaStatus));
            return cudaStatus;
        }

        cudaStatus = checkNegOnes(dev_volume, gridDims, dev_flag);

        printf("CUDA memcpy dev_flag to h_flag.\n");
        cudaStatus = hipMemcpy(&h_flag, dev_flag, sizeof(int), hipMemcpyDeviceToHost);
        if (cudaStatus != hipSuccess) {
            fprintf(stderr, "hipMemcpy failed!");
            return cudaStatus;
        }
        nLoops++;
    }

    return cudaStatus;
}

extern "C"
hipError_t checkNegOnes(int * dev_volume, const hipExtent gridDims, int *flag)
{
    hipError_t cudaStatus;

    int nPoints = gridDims.width*gridDims.height*gridDims.depth;

    // Calculate grid size
    int blockSize;      // The launch configurator returned block size
    int minGridSize;    // The minimum grid size needed to achieve the maximum occupancy for a full device launch
    int gridSize;       // The actual grid size needed, based on input size
    hipOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, checkNegOnes_kernel, 0, nPoints);

    gridSize = (nPoints + blockSize - 1) / blockSize;

    // Launch a kernel on the GPU with one thread for each element.
    printf("Launching checkNegOnes_kernel with <%d, %d> grids/blocks.\n", gridSize, blockSize);
    checkNegOnes_kernel <<< gridSize, blockSize >>>(dev_volume, gridDims, flag);

    // Check for any errors launching the kernel
    cudaStatus = hipGetLastError();
    if (cudaStatus != hipSuccess) {
        fprintf(stderr, "checkNegOnesKernel launch failed: %s\n", hipGetErrorString(cudaStatus));
    }

    return cudaStatus;
}

	.text
	.file	"RT3DUSkernels.hip"
	.globl	_Z38__device_stub__discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent # -- Begin function _Z38__device_stub__discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
	.type	_Z38__device_stub__discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent,@function
_Z38__device_stub__discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent: # @_Z38__device_stub__discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
	.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	$192, %rsp
	.cfi_def_cfa_offset 240
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	112(%rsp), %rax
	movlps	%xmm0, (%rax)
	movss	%xmm1, 8(%rax)
	leaq	96(%rsp), %r8
	movlps	%xmm2, (%r8)
	movss	%xmm3, 8(%r8)
	leaq	80(%rsp), %r9
	movlps	%xmm4, (%r9)
	movss	%xmm5, 8(%r9)
	leaq	40(%rsp), %r10
	movq	%rdi, (%r10)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	128(%rsp), %rbx
	movq	%r10, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rax, 32(%rbx)
	movq	%r8, 40(%rbx)
	movq	%r9, 48(%rbx)
	leaq	240(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$208, %rsp
	.cfi_adjust_cfa_offset -208
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z38__device_stub__discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent, .Lfunc_end0-_Z38__device_stub__discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
	.cfi_endproc
                                        # -- End function
	.globl	_Z36__device_stub__addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent # -- Begin function _Z36__device_stub__addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent
	.type	_Z36__device_stub__addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent,@function
_Z36__device_stub__addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent: # @_Z36__device_stub__addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	160(%rsp), %rax
	movq	%rax, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z36__device_stub__addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent, .Lfunc_end1-_Z36__device_stub__addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent
	.cfi_endproc
                                        # -- End function
	.globl	_Z33__device_stub__interpolate_kernelPi9hipExtent # -- Begin function _Z33__device_stub__interpolate_kernelPi9hipExtent
	.type	_Z33__device_stub__interpolate_kernelPi9hipExtent,@function
_Z33__device_stub__interpolate_kernelPi9hipExtent: # @_Z33__device_stub__interpolate_kernelPi9hipExtent
	.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	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	leaq	128(%rsp), %rax
	movq	%rax, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z18interpolate_kernelPi9hipExtent, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	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_end2:
	.size	_Z33__device_stub__interpolate_kernelPi9hipExtent, .Lfunc_end2-_Z33__device_stub__interpolate_kernelPi9hipExtent
	.cfi_endproc
                                        # -- End function
	.globl	_Z34__device_stub__checkNegOnes_kernelPi9hipExtentS_ # -- Begin function _Z34__device_stub__checkNegOnes_kernelPi9hipExtentS_
	.type	_Z34__device_stub__checkNegOnes_kernelPi9hipExtentS_,@function
_Z34__device_stub__checkNegOnes_kernelPi9hipExtentS_: # @_Z34__device_stub__checkNegOnes_kernelPi9hipExtentS_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$96, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	16(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	leaq	144(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	%rcx, 16(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%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	$_Z19checkNegOnes_kernelPi9hipExtentS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$112, %rsp
	.cfi_adjust_cfa_offset -112
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z34__device_stub__checkNegOnes_kernelPi9hipExtentS_, .Lfunc_end3-_Z34__device_stub__checkNegOnes_kernelPi9hipExtentS_
	.cfi_endproc
                                        # -- End function
	.globl	discretizePoints                # -- Begin function discretizePoints
	.type	discretizePoints,@function
discretizePoints:                       # @discretizePoints
	.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
	movss	%xmm5, 36(%rsp)                 # 4-byte Spill
	movaps	%xmm4, 80(%rsp)                 # 16-byte Spill
	movss	%xmm3, 32(%rsp)                 # 4-byte Spill
	movaps	%xmm2, 64(%rsp)                 # 16-byte Spill
	movss	%xmm1, 28(%rsp)                 # 4-byte Spill
	movaps	%xmm0, 48(%rsp)                 # 16-byte Spill
	movl	%ecx, %ebx
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r12
	leaq	40(%rsp), %rdi
	leaq	44(%rsp), %r13
	movl	$_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent, %edx
	movq	%r13, %rsi
	xorl	%ecx, %ecx
	movl	%ebx, %r8d
	callq	hipOccupancyMaxPotentialBlockSize
	movl	(%r13), %ecx
	leal	(%rbx,%rcx), %eax
	decl	%eax
	cltd
	idivl	%ecx
	movl	%eax, %ebp
	movl	$.L.str, %edi
	movl	%eax, %esi
	movl	%ecx, %edx
	xorl	%eax, %eax
	callq	printf
	movl	(%r13), %edx
	btsq	$32, %rbp
	btsq	$32, %rdx
	movq	%rbp, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_2
# %bb.1:
	leaq	160(%rsp), %rax
	movq	16(%rax), %rcx
	movq	%rcx, 16(%rsp)
	movups	(%rax), %xmm0
	movups	%xmm0, (%rsp)
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	movl	%ebx, %ecx
	movaps	48(%rsp), %xmm0                 # 16-byte Reload
	movss	28(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	movaps	64(%rsp), %xmm2                 # 16-byte Reload
	movss	32(%rsp), %xmm3                 # 4-byte Reload
                                        # xmm3 = mem[0],zero,zero,zero
	movaps	80(%rsp), %xmm4                 # 16-byte Reload
	movss	36(%rsp), %xmm5                 # 4-byte Reload
                                        # xmm5 = mem[0],zero,zero,zero
	callq	_Z38__device_stub__discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
.LBB4_2:
	callq	hipGetLastError
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB4_3
.LBB4_4:
	movl	%ebx, %eax
	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
.LBB4_3:
	.cfi_def_cfa_offset 160
	movq	stderr(%rip), %r14
	movl	%ebx, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movq	%r14, %rdi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB4_4
.Lfunc_end4:
	.size	discretizePoints, .Lfunc_end4-discretizePoints
	.cfi_endproc
                                        # -- End function
	.globl	addObsToVolume                  # -- Begin function addObsToVolume
	.type	addObsToVolume,@function
addObsToVolume:                         # @addObsToVolume
	.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	$32, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	%edx, %ebx
	movq	%rsi, %r14
	movq	%rdi, %r15
	leaq	24(%rsp), %rdi
	leaq	28(%rsp), %r12
	movl	$_Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent, %edx
	movq	%r12, %rsi
	xorl	%ecx, %ecx
	movl	%ebx, %r8d
	callq	hipOccupancyMaxPotentialBlockSize
	movl	(%r12), %ecx
	leal	(%rbx,%rcx), %eax
	decl	%eax
	cltd
	idivl	%ecx
	movl	%eax, %r13d
	movl	$.L.str.2, %edi
	movl	%eax, %esi
	movl	%ecx, %edx
	xorl	%eax, %eax
	callq	printf
	movl	(%r12), %edx
	btsq	$32, %r13
	btsq	$32, %rdx
	movq	%r13, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_2
# %bb.1:
	leaq	80(%rsp), %rax
	movq	16(%rax), %rcx
	movq	%rcx, 16(%rsp)
	movups	(%rax), %xmm0
	movups	%xmm0, (%rsp)
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	%ebx, %edx
	callq	_Z36__device_stub__addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent
.LBB5_2:
	callq	hipGetLastError
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB5_3
.LBB5_4:
	movl	%ebx, %eax
	addq	$32, %rsp
	.cfi_def_cfa_offset 48
	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
.LBB5_3:
	.cfi_def_cfa_offset 80
	movq	stderr(%rip), %r14
	movl	%ebx, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movq	%r14, %rdi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB5_4
.Lfunc_end5:
	.size	addObsToVolume, .Lfunc_end5-addObsToVolume
	.cfi_endproc
                                        # -- End function
	.globl	interpolateVolume               # -- Begin function interpolateVolume
	.type	interpolateVolume,@function
interpolateVolume:                      # @interpolateVolume
	.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	$56, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdi, %rbx
	movl	120(%rsp), %r14d
	imull	112(%rsp), %r14d
	imull	128(%rsp), %r14d
	leaq	52(%rsp), %rdi
	leaq	36(%rsp), %r15
	movl	$_Z18interpolate_kernelPi9hipExtent, %edx
	movq	%r15, %rsi
	xorl	%ecx, %ecx
	movl	%r14d, %r8d
	callq	hipOccupancyMaxPotentialBlockSize
	movl	(%r15), %ecx
	leal	(%r14,%rcx), %eax
	decl	%eax
	cltd
	idivl	%ecx
	movl	%eax, %ebp
	movl	$1, 32(%rsp)
	movl	$.Lstr, %edi
	callq	puts@PLT
	leaq	40(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB6_4
# %bb.1:                                # %.preheader
	leaq	112(%rsp), %r13
	movl	%ebp, %r14d
	btsq	$32, %r14
	xorl	%eax, %eax
.LBB6_2:                                # =>This Inner Loop Header: Depth=1
	movl	%eax, %r15d
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movq	40(%rsp), %rdi
	movl	$4, %edx
	xorl	%esi, %esi
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB6_3
# %bb.8:                                #   in Loop: Header=BB6_2 Depth=1
	movl	36(%rsp), %edx
	movl	$.L.str.7, %edi
	movl	%ebp, %esi
	xorl	%eax, %eax
	callq	printf
	movl	36(%rsp), %edx
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %rdx
	movq	%r14, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_10
# %bb.9:                                #   in Loop: Header=BB6_2 Depth=1
	movq	16(%r13), %rax
	movq	%rax, 16(%rsp)
	movups	(%r13), %xmm0
	movups	%xmm0, (%rsp)
	movq	%rbx, %rdi
	callq	_Z33__device_stub__interpolate_kernelPi9hipExtent
.LBB6_10:                               #   in Loop: Header=BB6_2 Depth=1
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB6_11
# %bb.12:                               #   in Loop: Header=BB6_2 Depth=1
	movq	40(%rsp), %rsi
	movq	16(%r13), %rax
	movq	%rax, 16(%rsp)
	movups	(%r13), %xmm0
	movups	%xmm0, (%rsp)
	movq	%rbx, %rdi
	callq	checkNegOnes
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movq	40(%rsp), %rsi
	movl	$4, %edx
	leaq	32(%rsp), %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB6_13
# %bb.5:                                #   in Loop: Header=BB6_2 Depth=1
	leal	1(%r15), %eax
	cmpl	$0, 32(%rsp)
	jg	.LBB6_2
# %bb.6:                                #   in Loop: Header=BB6_2 Depth=1
	cmpl	$998, %r15d                     # imm = 0x3E6
	jbe	.LBB6_2
# %bb.7:
	xorl	%r12d, %r12d
.LBB6_15:                               # %.loopexit
	movl	%r12d, %eax
	addq	$56, %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_4:
	.cfi_def_cfa_offset 112
	movl	%eax, %r12d
	movq	stderr(%rip), %rcx
	movl	$.L.str.4, %edi
	jmp	.LBB6_14
.LBB6_3:
	movl	%eax, %r12d
	movq	stderr(%rip), %rcx
	movl	$.L.str.6, %edi
	jmp	.LBB6_14
.LBB6_11:
	movl	%eax, %r12d
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.8, %esi
	movq	%rbx, %rdi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB6_15
.LBB6_13:
	movl	%eax, %r12d
	movq	stderr(%rip), %rcx
	movl	$.L.str.10, %edi
.LBB6_14:                               # %.loopexit
	movl	$17, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	jmp	.LBB6_15
.Lfunc_end6:
	.size	interpolateVolume, .Lfunc_end6-interpolateVolume
	.cfi_endproc
                                        # -- End function
	.globl	checkNegOnes                    # -- Begin function checkNegOnes
	.type	checkNegOnes,@function
checkNegOnes:                           # @checkNegOnes
	.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	$40, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movl	88(%rsp), %r15d
	imull	80(%rsp), %r15d
	imull	96(%rsp), %r15d
	leaq	32(%rsp), %rdi
	leaq	36(%rsp), %r12
	movl	$_Z19checkNegOnes_kernelPi9hipExtentS_, %edx
	movq	%r12, %rsi
	xorl	%ecx, %ecx
	movl	%r15d, %r8d
	callq	hipOccupancyMaxPotentialBlockSize
	movl	(%r12), %ecx
	leal	(%r15,%rcx), %eax
	decl	%eax
	cltd
	idivl	%ecx
	movl	%eax, %r15d
	movl	$.L.str.11, %edi
	movl	%eax, %esi
	movl	%ecx, %edx
	xorl	%eax, %eax
	callq	printf
	movl	(%r12), %edx
	btsq	$32, %r15
	btsq	$32, %rdx
	movq	%r15, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_2
# %bb.1:
	leaq	80(%rsp), %rax
	movq	16(%rax), %rcx
	movq	%rcx, 16(%rsp)
	movups	(%rax), %xmm0
	movups	%xmm0, (%rsp)
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_Z34__device_stub__checkNegOnes_kernelPi9hipExtentS_
.LBB7_2:
	callq	hipGetLastError
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_3
.LBB7_4:
	movl	%ebx, %eax
	addq	$40, %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
.LBB7_3:
	.cfi_def_cfa_offset 80
	movq	stderr(%rip), %r14
	movl	%ebx, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movq	%r14, %rdi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB7_4
.Lfunc_end7:
	.size	checkNegOnes, .Lfunc_end7-checkNegOnes
	.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	.LBB8_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB8_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent, %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	$_Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent, %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	$_Z18interpolate_kernelPi9hipExtent, %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	$_Z19checkNegOnes_kernelPi9hipExtentS_, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %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_end8:
	.size	__hip_module_ctor, .Lfunc_end8-__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	.LBB9_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
.LBB9_2:
	retq
.Lfunc_end9:
	.size	__hip_module_dtor, .Lfunc_end9-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent,@object # @_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
	.section	.rodata,"a",@progbits
	.globl	_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
	.p2align	3, 0x0
_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent:
	.quad	_Z38__device_stub__discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
	.size	_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent, 8

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

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

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Launching discretizePoints_kernel with <%d, %d> grids/blocks.\n"
	.size	.L.str, 63

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"addKernel launch failed: %s\n"
	.size	.L.str.1, 29

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Launching addObsToVolume_kernel with <%d, %d> grids/blocks.\n"
	.size	.L.str.2, 61

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"hipMalloc failed!"
	.size	.L.str.4, 18

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"hipMemset failed!"
	.size	.L.str.6, 18

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Launching interpolate_kernel with <%d, %d> grids/blocks.\n"
	.size	.L.str.7, 58

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"interpolateKernel launch failed: %s\n"
	.size	.L.str.8, 37

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"hipMemcpy failed!"
	.size	.L.str.10, 18

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Launching checkNegOnes_kernel with <%d, %d> grids/blocks.\n"
	.size	.L.str.11, 59

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"checkNegOnesKernel launch failed: %s\n"
	.size	.L.str.12, 38

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent"
	.size	.L__unnamed_1, 94

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent"
	.size	.L__unnamed_2, 65

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

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z19checkNegOnes_kernelPi9hipExtentS_"
	.size	.L__unnamed_4, 38

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

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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"CUDA malloc dev_flag."
	.size	.Lstr, 22

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"CUDA memset dev_flag to 0."
	.size	.Lstr.1, 27

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"CUDA memcpy dev_flag to h_flag."
	.size	.Lstr.2, 32

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z38__device_stub__discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
	.addrsig_sym _Z36__device_stub__addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent
	.addrsig_sym _Z33__device_stub__interpolate_kernelPi9hipExtent
	.addrsig_sym _Z34__device_stub__checkNegOnes_kernelPi9hipExtentS_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
	.addrsig_sym _Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent
	.addrsig_sym _Z18interpolate_kernelPi9hipExtent
	.addrsig_sym _Z19checkNegOnes_kernelPi9hipExtentS_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent ; -- Begin function _Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
	.globl	_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
	.p2align	8
	.type	_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent,@function
_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent: ; @_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x64
	s_load_b32 s3, s[0:1], 0x18
	s_waitcnt lgkmcnt(0)
	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_mov_b32 s2, exec_lo
	v_cmpx_ge_i32_e64 s3, v1
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_clause 0x1
	s_load_b128 s[12:15], s[0:1], 0x0
	s_load_b64 s[2:3], s[0:1], 0x10
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 4, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s12, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s13, v5, vcc_lo
	global_load_b128 v[0:3], v[0:1], off
	s_clause 0x3
	s_load_b256 s[4:11], s[0:1], 0x1c
	s_load_b128 s[16:19], s[0:1], 0x40
	s_load_b32 s12, s[0:1], 0x3c
	s_load_b64 s[0:1], s[0:1], 0x50
	s_waitcnt lgkmcnt(0)
	v_sub_f32_e64 v7, s11, s8
	v_sub_f32_e64 v6, s10, s7
	v_sub_f32_e64 v8, s12, s9
	s_clz_i32_u32 s10, s17
	s_clz_i32_u32 s12, s1
	s_clz_i32_u32 s11, s19
	s_min_u32 s13, s10, 32
	s_min_u32 s21, s12, 32
	s_min_u32 s20, s11, 32
	s_lshl_b64 s[10:11], s[16:17], s13
	s_lshl_b64 s[16:17], s[0:1], s21
	s_min_u32 s10, s10, 1
	s_sub_i32 s22, 32, s13
	s_or_b32 s10, s11, s10
	s_lshl_b64 s[12:13], s[18:19], s20
	v_cvt_f32_u32_e32 v24, s10
	s_min_u32 s12, s12, 1
	s_min_u32 s16, s16, 1
	s_or_b32 s11, s13, s12
	s_sub_i32 s18, 32, s20
	v_cvt_f32_u32_e32 v25, s11
	s_or_b32 s12, s17, s16
	s_sub_i32 s19, 32, s21
	s_waitcnt vmcnt(0)
	v_dual_subrev_f32 v0, s7, v0 :: v_dual_subrev_f32 v1, s8, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_div_scale_f32 v9, null, v6, v6, v0
	v_div_scale_f32 v10, null, v7, v7, v1
	v_div_scale_f32 v15, vcc_lo, v0, v6, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_rcp_f32_e32 v12, v9
	v_rcp_f32_e32 v13, v10
	v_div_scale_f32 v16, s0, v1, v7, v1
	s_waitcnt_depctr 0xfff
	v_fma_f32 v17, -v9, v12, 1.0
	v_fma_f32 v18, -v10, v13, 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_subrev_f32 v2, s9, v2 :: v_dual_fmac_f32 v13, v18, v13
	v_div_scale_f32 v11, null, v8, v8, v2
	v_div_scale_f32 v20, s1, v2, v8, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_f32_e32 v18, v16, v13
	v_rcp_f32_e32 v14, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_fma_f32 v22, -v10, v18, v16
	s_waitcnt_depctr 0xfff
	v_fma_f32 v19, -v11, v14, 1.0
	v_fmac_f32_e32 v14, v19, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_fmac_f32 v12, v17, v12 :: v_dual_mul_f32 v19, v20, v14
	v_mul_f32_e32 v17, v15, v12
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v23, -v11, v19, v20
	v_fma_f32 v21, -v9, v17, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_dual_fmac_f32 v17, v21, v12 :: v_dual_fmac_f32 v18, v22, v13
	v_fmac_f32_e32 v19, v23, v14
	v_ldexp_f32 v22, v24, s22
	v_cvt_f32_u32_e32 v21, s12
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_fma_f32 v9, -v9, v17, v15
	v_fma_f32 v10, -v10, v18, v16
	v_fma_f32 v11, -v11, v19, v20
	v_div_fmas_f32 v9, v9, v12, v17
	s_mov_b32 vcc_lo, s0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_fmas_f32 v10, v10, v13, v18
	s_mov_b32 vcc_lo, s1
	v_div_fixup_f32 v0, v9, v6, v0
	v_div_fmas_f32 v11, v11, v14, v19
	v_ldexp_f32 v6, v25, s18
	v_div_fixup_f32 v1, v10, v7, v1
	v_ldexp_f32 v7, v21, s19
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_div_fixup_f32 v2, v11, v8, v2
	v_trunc_f32_e32 v11, v3
	v_mul_f32_e32 v0, v0, v22
	v_dual_mul_f32 v1, v1, v6 :: v_dual_mul_f32 v2, v2, v7
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_f32_e32 v13, v3, v11
	v_trunc_f32_e32 v6, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_trunc_f32_e32 v7, v1
	v_trunc_f32_e32 v8, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_sub_f32 v9, v0, v6 :: v_dual_sub_f32 v10, v1, v7
	v_cmp_ge_f32_e64 s0, |v9|, 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v9, 0, 1.0, s0
	v_cmp_ge_f32_e64 s0, |v10|, 0.5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_bfi_b32 v0, 0x7fffffff, v9, v0
	v_cndmask_b32_e64 v10, 0, 1.0, s0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_bfi_b32 v1, 0x7fffffff, v10, v1
	v_dual_sub_f32 v12, v2, v8 :: v_dual_add_f32 v1, v7, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_ge_f32_e64 s0, |v12|, 0.5
	v_cvt_i32_f32_e32 v1, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v12, 0, 1.0, s0
	v_cmp_ge_f32_e64 s0, |v13|, 0.5
	v_bfi_b32 v2, 0x7fffffff, v12, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v9, 0, 1.0, s0
	v_cvt_f32_i32_e32 v12, v1
	v_add_f32_e32 v2, v8, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_bfi_b32 v3, 0x7fffffff, v9, v3
	v_add_f32_e32 v0, v6, v0
	v_add_co_u32 v8, vcc_lo, s2, v4
	v_cvt_i32_f32_e32 v2, v2
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_f32_e32 v7, v11, v3
	v_cvt_i32_f32_e32 v0, v0
	v_add_co_ci_u32_e32 v9, vcc_lo, s3, v5, vcc_lo
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_cvt_f32_i32_e32 v13, v2
	v_add_co_u32 v10, vcc_lo, s14, v4
	v_cvt_f32_i32_e32 v6, v0
	v_cvt_i32_f32_e32 v3, v7
	v_add_co_ci_u32_e32 v11, vcc_lo, s15, v5, vcc_lo
	v_fma_f32 v5, s5, v12, s8
	s_delay_alu instid0(VALU_DEP_4)
	v_fma_f32 v4, s4, v6, s7
	v_fma_f32 v6, s6, v13, s9
	global_store_b128 v[8:9], v[0:3], off
	global_store_b128 v[10:11], v[4:7], off
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
.LBB0_2:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 344
		.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 26
		.amdhsa_next_free_sgpr 23
		.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	_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent, .Lfunc_end0-_Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 924
; NumSgprs: 25
; NumVgprs: 26
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 3
; NumSGPRsForWavesPerEU: 25
; NumVGPRsForWavesPerEU: 26
; 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	_Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent ; -- Begin function _Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent
	.globl	_Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent
	.p2align	8
	.type	_Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent,@function
_Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent: ; @_Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x3c
	s_load_b32 s3, s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	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_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_load_b128 s[0:3], s[0:1], 0x18
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 4, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	global_load_b128 v[0:3], v[0:1], off
	s_waitcnt vmcnt(0)
	v_mad_u64_u32 v[4:5], null, s2, v2, v[1:2]
	v_mad_u64_u32 v[1:2], null, v4, s0, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v2, 31, v1
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	global_atomic_max_i32 v[0:1], v3, off
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
.LBB1_2:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent
		.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 6
		.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	_Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent, .Lfunc_end1-_Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 200
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 6
; 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	_Z18interpolate_kernelPi9hipExtent ; -- Begin function _Z18interpolate_kernelPi9hipExtent
	.globl	_Z18interpolate_kernelPi9hipExtent
	.p2align	8
	.type	_Z18interpolate_kernelPi9hipExtent,@function
_Z18interpolate_kernelPi9hipExtent:     ; @_Z18interpolate_kernelPi9hipExtent
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b256 s[4:11], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s0, s2, 0xffff
	s_mul_i32 s1, s8, s6
	v_mad_u64_u32 v[2:3], null, s15, s0, v[0:1]
	s_mul_i32 s2, s1, s10
	s_mov_b32 s0, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_ge_i32_e64 s2, v2
	s_cbranch_execz .LBB2_25
; %bb.1:
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[2:3]
	v_add_co_u32 v0, vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	global_load_b32 v4, v[0:1], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, -1, v4
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB2_25
; %bb.2:
	s_ashr_i32 s3, s1, 31
	v_cvt_f32_u32_e32 v4, s6
	v_cvt_f32_u32_e32 v5, s7
	s_add_i32 s0, s1, s3
	v_add_nc_u32_e32 v8, v2, v3
	s_xor_b32 s12, s0, s3
	s_delay_alu instid0(VALU_DEP_2)
	v_fmamk_f32 v4, v5, 0x4f800000, v4
	v_cvt_f32_u32_e32 v5, s12
	s_sub_i32 s0, 0, s12
	s_sub_u32 s13, 0, s6
	s_subb_u32 s14, 0, s7
	v_rcp_f32_e32 v4, v4
	v_rcp_iflag_f32_e32 v5, v5
	v_xor_b32_e32 v8, v8, v3
	v_xor_b32_e32 v3, s3, v3
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v5, 0x4f7ffffe, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_u32_f32_e32 v5, v5
	v_mul_lo_u32 v7, s0, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v7, v5, v7
	v_dual_mul_f32 v4, 0x5f7ffffc, v4 :: v_dual_add_nc_u32 v5, v5, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f32_e32 v6, 0x2f800000, v4
	v_mul_hi_u32 v5, v8, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_trunc_f32_e32 v6, v6
	v_fmamk_f32 v4, v6, 0xcf800000, v4
	v_cvt_u32_f32_e32 v6, v6
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_add_nc_u32_e32 v15, 1, v5
	v_mul_lo_u32 v14, v5, s12
	v_cvt_u32_f32_e32 v4, v4
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v9, s13, v6
	v_mul_hi_u32 v10, s13, v4
	v_mul_lo_u32 v11, s14, v4
	v_mul_lo_u32 v12, s13, v4
	v_sub_nc_u32_e32 v8, v8, v14
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v7, v10, v9
	v_mul_hi_u32 v9, v4, v12
	v_mul_hi_u32 v10, v6, v12
	v_mul_lo_u32 v12, v6, v12
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v7, v7, v11
	v_mul_lo_u32 v11, v4, v7
	v_mul_hi_u32 v13, v4, v7
	v_mul_hi_u32 v16, v6, v7
	v_mul_lo_u32 v7, v6, v7
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v9, vcc_lo, v9, v11
	v_add_co_ci_u32_e32 v11, vcc_lo, 0, v13, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v9, vcc_lo, v9, v12
	v_add_co_ci_u32_e32 v9, vcc_lo, v11, v10, vcc_lo
	v_add_co_ci_u32_e32 v10, vcc_lo, 0, v16, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s12, v8
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v7, s0, v9, v7
	v_add_co_ci_u32_e64 v9, s0, 0, v10, s0
	v_subrev_nc_u32_e32 v10, s12, v8
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v4, s0, v4, v7
	v_add_co_ci_u32_e64 v7, s0, v6, v9, s0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_dual_cndmask_b32 v5, v5, v15 :: v_dual_cndmask_b32 v6, v8, v10
	v_mul_hi_u32 v8, s13, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_mul_lo_u32 v9, s13, v7
	v_mul_lo_u32 v11, s14, v4
	v_add_nc_u32_e32 v10, 1, v5
	v_cmp_le_u32_e32 vcc_lo, s12, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_dual_cndmask_b32 v5, v5, v10 :: v_dual_add_nc_u32 v6, v8, v9
	v_mul_lo_u32 v8, s13, v4
	v_xor_b32_e32 v5, v5, v3
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v10, v6, v11
	v_sub_nc_u32_e32 v6, v5, v3
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_hi_u32 v3, v4, v8
	v_mul_lo_u32 v5, v4, v10
	v_mul_hi_u32 v11, v4, v10
	v_mul_hi_u32 v12, v7, v8
	v_mul_lo_u32 v8, v7, v8
	v_mul_hi_u32 v13, v7, v10
	v_mul_lo_u32 v10, v7, v10
	v_mul_lo_u32 v9, v6, s1
	v_add_co_u32 v3, vcc_lo, v3, v5
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v11, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, v3, v8
	v_add_co_ci_u32_e32 v3, vcc_lo, v5, v12, vcc_lo
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v13, vcc_lo
	v_sub_nc_u32_e32 v8, v2, v9
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v3, vcc_lo, v3, v10
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v5, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v12, vcc_lo, v4, v3
	v_add_co_ci_u32_e32 v5, vcc_lo, v7, v5, vcc_lo
	v_ashrrev_i32_e32 v7, 31, v8
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_hi_u32 v14, v8, v12
	v_mad_u64_u32 v[3:4], null, v8, v5, 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_mad_u64_u32 v[10:11], null, v7, v12, 0
	v_mad_u64_u32 v[12:13], null, v7, v5, 0
	v_add_co_u32 v3, vcc_lo, v14, v3
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_ci_u32_e32 v4, vcc_lo, 0, v4, vcc_lo
	v_add_co_u32 v3, vcc_lo, v3, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, v4, v11, vcc_lo
	v_add_co_ci_u32_e32 v4, vcc_lo, 0, v13, vcc_lo
	v_add_co_u32 v5, vcc_lo, v3, v12
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_ci_u32_e32 v10, vcc_lo, 0, v4, vcc_lo
	v_mul_lo_u32 v11, s7, v5
	v_mad_u64_u32 v[3:4], null, s6, v5, 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v10, s6, v10
	v_sub_co_u32 v3, vcc_lo, v8, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add3_u32 v4, v4, v10, v11
	v_add_co_u32 v11, null, v5, 2
	v_sub_nc_u32_e32 v10, v7, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_subrev_co_ci_u32_e64 v10, s0, s7, v10, vcc_lo
	v_sub_co_u32 v12, s0, v3, s6
	v_sub_co_ci_u32_e32 v4, vcc_lo, v7, v4, vcc_lo
	v_subrev_co_ci_u32_e64 v10, s0, 0, v10, s0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_cmp_le_u32_e32 vcc_lo, s6, v12
	v_cndmask_b32_e64 v7, 0, -1, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s7, v10
	v_cndmask_b32_e64 v12, 0, -1, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s6, v3
	v_cndmask_b32_e64 v3, 0, -1, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s7, v4
	v_cndmask_b32_e64 v13, 0, -1, vcc_lo
	v_cmp_eq_u32_e32 vcc_lo, s7, v10
	v_add_co_u32 v10, null, v5, 1
	v_cndmask_b32_e32 v7, v12, v7, vcc_lo
	v_cmp_eq_u32_e32 vcc_lo, s7, v4
	v_cndmask_b32_e32 v3, v13, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_cmp_ne_u32_e32 vcc_lo, 0, v7
	v_dual_cndmask_b32 v4, v10, v11 :: v_dual_add_nc_u32 v7, 1, v2
	v_cmp_ne_u32_e32 vcc_lo, 0, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_cmp_gt_i32_e64 s0, s2, v7
	v_mov_b32_e32 v7, -3
	v_cndmask_b32_e32 v11, v5, v4, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v3, v11, s6
	v_sub_nc_u32_e32 v3, v8, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v4, 1, v3
	v_ashrrev_i32_e32 v5, 31, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_cmp_gt_u64_e32 vcc_lo, s[6:7], v[4:5]
	v_mov_b32_e32 v5, -3
	s_and_b32 s3, vcc_lo, s0
	s_and_saveexec_b32 s0, s3
	s_cbranch_execz .LBB2_4
; %bb.3:
	global_load_b32 v5, v[0:1], off offset:4
.LBB2_4:
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_lt_i32_e32 0, v3
	s_cbranch_execz .LBB2_6
; %bb.5:
	v_add_nc_u32_e32 v12, -1, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v13, 31, v12
	v_lshlrev_b64 v[12:13], 2, v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v12, vcc_lo, s4, v12
	v_add_co_ci_u32_e32 v13, vcc_lo, s5, v13, vcc_lo
	global_load_b32 v7, v[12:13], off
.LBB2_6:
	s_or_b32 exec_lo, exec_lo, s0
	v_add_nc_u32_e32 v12, 1, v11
	v_add_nc_u32_e32 v2, v3, v9
	v_mov_b32_e32 v10, -3
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_ashrrev_i32_e32 v13, 31, v12
	v_mad_u64_u32 v[3:4], null, v12, s6, v[2:3]
	v_mov_b32_e32 v4, -3
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cmp_gt_u64_e32 vcc_lo, s[8:9], v[12:13]
	v_cmp_gt_i32_e64 s0, s2, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s3, vcc_lo, s0
	s_and_saveexec_b32 s0, s3
	s_cbranch_execz .LBB2_8
; %bb.7:
	v_ashrrev_i32_e32 v4, 31, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	v_add_co_u32 v3, vcc_lo, s4, v3
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v4, vcc_lo
	global_load_b32 v4, v[3:4], off
.LBB2_8:
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_lt_i32_e32 0, v11
	s_cbranch_execz .LBB2_10
; %bb.9:
	v_add_nc_u32_e32 v3, -1, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[10:11], null, v3, s6, v[2:3]
	v_ashrrev_i32_e32 v11, 31, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[10:11]
	v_add_co_u32 v2, vcc_lo, s4, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v3, vcc_lo
	global_load_b32 v10, v[2:3], off
.LBB2_10:
	s_or_b32 exec_lo, exec_lo, s0
	v_add_nc_u32_e32 v12, 1, v6
	v_add_nc_u32_e32 v11, s1, v9
	v_mov_b32_e32 v9, -3
	v_mov_b32_e32 v3, -3
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_ashrrev_i32_e32 v13, 31, v12
	v_add_nc_u32_e32 v2, v11, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_u64_e32 vcc_lo, s[10:11], v[12:13]
	v_cmp_gt_i32_e64 s0, s2, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s0
	s_and_saveexec_b32 s0, s2
	s_cbranch_execz .LBB2_12
; %bb.11:
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_add_co_u32 v2, vcc_lo, s4, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v3, vcc_lo
	global_load_b32 v3, v[2:3], off
.LBB2_12:
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_lt_i32_e32 0, v6
	s_cbranch_execz .LBB2_14
; %bb.13:
	s_lshl_b32 s1, s1, 1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_subrev_nc_u32_e32 v2, s1, v11
	v_add_nc_u32_e32 v8, v2, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v9, 31, v8
	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, s4, v8
	v_add_co_ci_u32_e32 v9, vcc_lo, s5, v9, vcc_lo
	global_load_b32 v9, v[8:9], off
.LBB2_14:
	s_or_b32 exec_lo, exec_lo, s0
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v2, v7, v5
	s_mov_b32 s0, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add3_u32 v2, v2, v4, v10
	v_add3_u32 v2, v2, v3, v9
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_ne_u32_e32 0xffffffee, v2
	s_xor_b32 s3, exec_lo, s0
	s_cbranch_execz .LBB2_23
; %bb.15:
	v_and_b32_e32 v2, v5, v7
	v_and_b32_e32 v6, v9, v3
	s_mov_b32 s4, exec_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_and_b32_e32 v2, v2, v4
	v_and_b32_e32 v2, v2, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_and_b32_e32 v2, v2, v6
	v_cmpx_ne_u32_e32 -1, v2
	s_cbranch_execz .LBB2_22
; %bb.16:
	v_cmp_ne_u32_e32 vcc_lo, -2, v5
	v_cmp_ne_u32_e64 s0, -2, v7
	v_cmp_ne_u32_e64 s1, -2, v4
	v_cmp_ne_u32_e64 s2, -2, v10
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	s_or_b32 s0, vcc_lo, s0
	v_cmp_ne_u32_e32 vcc_lo, -2, v3
	s_or_b32 s1, s0, s1
	v_cmp_ne_u32_e64 s0, -2, v9
	s_or_b32 s1, s1, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s1, s1, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	s_or_b32 s0, s1, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_saveexec_b32 s1, s0
	s_xor_b32 s0, exec_lo, s1
	s_cbranch_execz .LBB2_20
; %bb.17:
	v_cmp_lt_i32_e32 vcc_lo, -1, v5
	v_not_b32_e32 v2, v4
	v_not_b32_e32 v6, v10
	v_not_b32_e32 v12, v3
	s_mov_b32 s1, exec_lo
	v_cndmask_b32_e64 v8, 0, 1, vcc_lo
	v_cndmask_b32_e64 v11, 1, 2, vcc_lo
	v_cmp_gt_i32_e32 vcc_lo, 0, v7
	v_lshrrev_b32_e32 v2, 31, v2
	v_lshrrev_b32_e32 v6, 31, v6
	v_lshrrev_b32_e32 v12, 31, v12
	v_cndmask_b32_e32 v8, v11, v8, vcc_lo
	v_not_b32_e32 v11, v9
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add3_u32 v2, v8, v2, v6
	v_lshrrev_b32_e32 v6, 31, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add3_u32 v2, v2, v12, v6
	v_cmpx_ne_u32_e32 0, v2
	s_cbranch_execz .LBB2_19
; %bb.18:
	v_max_i32_e32 v6, 0, v7
	v_max_i32_e32 v5, 0, v5
	v_max_i32_e32 v7, 0, v10
	v_max_i32_e32 v4, 0, v4
	v_max_i32_e32 v3, 0, v3
	v_cvt_f32_ubyte0_e32 v2, v2
	v_add_nc_u32_e32 v5, v6, v5
	v_max_i32_e32 v6, 0, v9
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add3_u32 v4, v5, v4, v7
	v_add3_u32 v3, v4, v3, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f32_i32_e32 v3, v3
	v_div_scale_f32 v4, null, v2, v2, v3
	v_div_scale_f32 v7, vcc_lo, v3, v2, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f32_e32 v5, v4
	s_waitcnt_depctr 0xfff
	v_fma_f32 v6, -v4, v5, 1.0
	v_fmac_f32_e32 v5, v6, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v6, v7, v5
	v_fma_f32 v8, -v4, v6, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v8, v5
	v_fma_f32 v4, -v4, v6, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f32 v4, v4, v5, v6
	v_div_fixup_f32 v2, v4, v2, v3
	s_delay_alu instid0(VALU_DEP_1)
	v_cvt_i32_f32_e32 v2, v2
	global_store_b32 v[0:1], v2, off
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
.LBB2_19:                               ; %Flow
	s_or_b32 exec_lo, exec_lo, s1
                                        ; implicit-def: $vgpr0_vgpr1
.LBB2_20:                               ; %Flow172
	s_and_not1_saveexec_b32 s0, s0
	s_cbranch_execz .LBB2_22
; %bb.21:
	v_mov_b32_e32 v2, 0
	global_store_b32 v[0:1], v2, off
.LBB2_22:                               ; %Flow174
	s_or_b32 exec_lo, exec_lo, s4
                                        ; implicit-def: $vgpr0_vgpr1
.LBB2_23:                               ; %Flow175
	s_and_not1_saveexec_b32 s0, s3
	s_cbranch_execz .LBB2_25
; %bb.24:
	v_mov_b32_e32 v2, 0
	global_store_b32 v[0:1], v2, off
.LBB2_25:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z18interpolate_kernelPi9hipExtent
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 17
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z18interpolate_kernelPi9hipExtent, .Lfunc_end2-_Z18interpolate_kernelPi9hipExtent
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 2036
; NumSgprs: 18
; NumVgprs: 17
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 17
; 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	_Z19checkNegOnes_kernelPi9hipExtentS_ ; -- Begin function _Z19checkNegOnes_kernelPi9hipExtentS_
	.globl	_Z19checkNegOnes_kernelPi9hipExtentS_
	.p2align	8
	.type	_Z19checkNegOnes_kernelPi9hipExtentS_,@function
_Z19checkNegOnes_kernelPi9hipExtentS_:  ; @_Z19checkNegOnes_kernelPi9hipExtentS_
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x34
	s_load_b64 s[2:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	v_add_co_u32 v0, vcc_lo, s2, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	s_mov_b32 s2, exec_lo
	global_load_b32 v0, v[0:1], off
	s_waitcnt vmcnt(0)
	v_cmpx_eq_u32_e32 -1, v0
	s_cbranch_execz .LBB3_3
; %bb.1:
	s_mov_b32 s3, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mbcnt_lo_u32_b32 v0, s3, 0
	v_cmp_eq_u32_e32 vcc_lo, 0, v0
	s_and_b32 s4, exec_lo, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 exec_lo, s4
	s_cbranch_execz .LBB3_3
; %bb.2:
	s_load_b64 s[0:1], s[0:1], 0x20
	s_bcnt1_i32_b32 s3, s3
	s_delay_alu instid0(SALU_CYCLE_1)
	v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s3
	s_waitcnt lgkmcnt(0)
	global_atomic_add_u32 v0, v1, s[0:1]
.LBB3_3:
	s_or_b32 exec_lo, exec_lo, s2
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z19checkNegOnes_kernelPi9hipExtentS_
		.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 3
		.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	_Z19checkNegOnes_kernelPi9hipExtentS_, .Lfunc_end3-_Z19checkNegOnes_kernelPi9hipExtentS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 196
; NumSgprs: 18
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 3
; 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
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           12
        .value_kind:     by_value
      - .offset:         40
        .size:           12
        .value_kind:     by_value
      - .offset:         52
        .size:           12
        .value_kind:     by_value
      - .offset:         64
        .size:           24
        .value_kind:     by_value
      - .offset:         88
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         92
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         96
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         100
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         102
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         104
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         106
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         108
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         110
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         128
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         136
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         144
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         152
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 344
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent
    .private_segment_fixed_size: 0
    .sgpr_count:     25
    .sgpr_spill_count: 0
    .symbol:         _Z23discretizePoints_kernelPK15HIP_vector_typeIfLj4EEPS0_PS_IiLj4EEiS_IfLj3EES6_S6_9hipExtent.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     26
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           24
        .value_kind:     by_value
      - .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:           _Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z21addObsToVolume_kernelPK15HIP_vector_typeIiLj4EEPii9hipExtent.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           24
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z18interpolate_kernelPi9hipExtent
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z18interpolate_kernelPi9hipExtent.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     17
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           24
        .value_kind:     by_value
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z19checkNegOnes_kernelPi9hipExtentS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z19checkNegOnes_kernelPi9hipExtentS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     3
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
