
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>


// Number of threads
#define BLOCK_SIZE 16
#define GRID_SIZE 256


#define CUDA_CALL(x) {if((x) != cudaSuccess){ \
  printf("CUDA error at %s:%d\n",__FILE__,__LINE__); \
  printf("  %s\n", cudaGetErrorString(cudaGetLastError())); \
  exit(EXIT_FAILURE);}}

// nCentroids and size on device
__constant__ int dev_nCentroids;
__constant__ int dev_size;

// global variables
int CLUSTER_BYTES = 0; // nCentroids * sizeof(int)
int IMAGE_BYTES = 0;  // width * height * sizeof(int)

//R,G,B Centroid's triple on device
__constant__ int dev_RedCentroid[20];
__constant__ int dev_GreenCentroid[20];
__constant__ int dev_BlueCentroid[20];

void initialise_centroids(int nCentroids, int* redCentroid, int* greenCentroid, int*  blueCentroid, int r[], int g[], int b[], int size) {

	int i;

	for(i=0;i<nCentroids;++i)
	{
		int index = rand()%size;
		redCentroid[i] = r[index];
		blueCentroid[i] = b[index];
		greenCentroid[i] = g[index];
		
	
	}
}


bool loadRawImage(char* filename, int* r, int* g, int* b, int size) {
	FILE *imageFile;
	imageFile = fopen(filename, "r");

	if (imageFile == NULL) {
		return false;
	} else {
		for (int i = 0; i < size; i++) {

			r[i] = fgetc(imageFile);
			g[i] = fgetc(imageFile);
			b[i] = fgetc(imageFile);
		}
		fclose(imageFile);

		/*for(int j = 0; j < h * w; j++) {
			printf("%d, %d, %d ", r[j], g[j], b[j]);
		}*/
		return true;
	}
}



bool writeRawImage(char* filename, int* labelArray, int* redCentroid, int* greenCentroid, int* blueCentroid, int size){
	FILE *imageFile;
	imageFile = fopen(filename, "wb");

	if(imageFile == NULL) {
		return false;
	} else {
		for (int i = 0; i < size; i++) {
			fputc((char) redCentroid[labelArray[i]], imageFile);
			fputc((char) greenCentroid[labelArray[i]], imageFile);
			fputc((char) blueCentroid[labelArray[i]], imageFile);
		}
		fclose(imageFile);
		return true;
	}
}



//Clears arrays before each kernel getClusterLabel iteration
 
__global__ void clearArrays(int *dev_sumRed,int *dev_sumGreen,int *dev_sumBlue, int* dev_pixelClusterCounter, int* dev_tempRedCentroid, int* dev_tempGreenCentroid, int* dev_tempBlueCentroid ) {

	// 1 block, 16x16 threads
	int threadID = threadIdx.x + threadIdx.y * blockDim.x;

	if(threadID < dev_nCentroids) { 


		// nCentroids long
		dev_sumRed[threadID] = 0;
		dev_sumGreen[threadID] = 0;
		dev_sumBlue[threadID] = 0;
		dev_pixelClusterCounter[threadID] = 0;
		dev_tempRedCentroid[threadID] = 0;
		dev_tempGreenCentroid[threadID] = 0;
		dev_tempBlueCentroid[threadID] = 0;
	}
}// end clearArrays

/*
 *  Clear label array before each kernel getClusterLabel iteration
 */
__global__ void clearLabelArray(int *dev_labelArray){

	// Global thread index
	int threadID = (threadIdx.x + blockIdx.x * blockDim.x) + (threadIdx.y + blockIdx.y * blockDim.y) * blockDim.x * gridDim.x;
	//int threadID = (blockIdx.y*gridDim.x + blockIdx.x)*(blockDim.x*blockDim.y) + threadIdx.y*blockDim.x + threadIdx.x;
	// labelArray is "size" long
	if(threadID < dev_size) {
		dev_labelArray[threadID] = 0;
	}
}// end clearLabelArray



__global__ void getClusterLabel(int *dev_Red,int *dev_Green,int *dev_Blue,int *dev_labelArray) {


	// Global thread index
	int threadID = (threadIdx.x + blockIdx.x * blockDim.x) + (threadIdx.y + blockIdx.y * blockDim.y) * blockDim.x * gridDim.x;
	//int threadID = (blockIdx.y*gridDim.x + blockIdx.x)*(blockDim.x*blockDim.y) + threadIdx.y*blockDim.x + threadIdx.x;
	//default min value of distance
	float min = 500.0, value;
	//will be label
	int index = 0;


	if(threadID < dev_size) {
		// Finding the nearest centroid to current triple identified by threadID thread
		for(int i = 0; i < dev_nCentroids; i++) {
			// Performing Euclidean distance, Saving current value
			value = sqrtf(powf((dev_Red[threadID]-dev_RedCentroid[i]),2.0) + powf((dev_Green[threadID]-dev_GreenCentroid[i]),2.0) + powf((dev_Blue[threadID]-dev_BlueCentroid[i]),2.0));

			if(value < min){
				// saving new nearest centroid
				min = value;
				// Updating his index
				index = i;
			}
		}// end for
		// Writing to global memory the index of the nearest centroid
		// for dev_Red[threadID], dev_Green[threadID], dev_Blue[threadID] pixel triple
		dev_labelArray[threadID] = index;

	}// end if
}// end getClusterLabel





/*
 *  Summing Red, Green, Blue values per cluster
 *  Counting how many pixels there are in each cluster
 *
 */

__global__ void sumCluster(int *dev_Red,int *dev_Green,int *dev_Blue,int *dev_sumRed,int *dev_sumGreen,int *dev_sumBlue,int *dev_labelArray,int *dev_pixelClusterCounter) {

	// Global thread index
	int threadID = (threadIdx.x + blockIdx.x * blockDim.x) + (threadIdx.y + blockIdx.y * blockDim.y) * blockDim.x * gridDim.x;
	//int threadID = (blockIdx.y*gridDim.x + blockIdx.x)*(blockDim.x*blockDim.y) + threadIdx.y*blockDim.x + threadIdx.x;

	if(threadID < dev_size) {
		int currentLabelArray = dev_labelArray[threadID];
		int currentRed = dev_Red[threadID];
		int currentGreen = dev_Green[threadID];
		int currentBlue = dev_Blue[threadID];
		// Writing to global memory needs a serialization. Many threads are writing into the same few locations
		atomicAdd(&dev_sumRed[currentLabelArray], currentRed);
		atomicAdd(&dev_sumGreen[currentLabelArray], currentGreen);
		atomicAdd(&dev_sumBlue[currentLabelArray], currentBlue);
		atomicAdd(&dev_pixelClusterCounter[currentLabelArray], 1);
	}
}// end sumCluster


/*
 *  Calculates the new R,G,B values of the centroids dividing the sum of color (for each channel) by the number of pixels in that cluster
 *	New values are stored in global memory since the current R,G,B values of the centroids are in read-only constant memory.
 */
__global__ void updateCentroids(int *dev_tempRedCentroid, int *dev_tempGreenCentroid, int *dev_tempBlueCentroid,int* dev_sumRed, int *dev_sumGreen,int *dev_sumBlue, int* dev_pixelClusterCounter,int *dev_flag) {

	// 1 block , 16*16 threads
	int threadID = threadIdx.x + threadIdx.y * blockDim.x;

	if(threadID < dev_nCentroids) {
		int currentPixelCounter = dev_pixelClusterCounter[threadID];
		int sumRed = dev_sumRed[threadID];
		int sumGreen = dev_sumGreen[threadID];
		int sumBlue = dev_sumBlue[threadID];
		
		//new RGB Centroids' values written in global memory
		dev_tempRedCentroid[threadID] = (int)(sumRed/currentPixelCounter);
		
		dev_tempGreenCentroid[threadID] = (int)(sumGreen/currentPixelCounter);
		dev_tempBlueCentroid[threadID] = (int)(sumBlue/currentPixelCounter);
		
		if(dev_tempGreenCentroid[threadID]!=dev_GreenCentroid[threadID] || dev_tempRedCentroid[threadID]!=dev_RedCentroid[threadID] || dev_tempBlueCentroid[threadID]!=dev_BlueCentroid[threadID])
		*dev_flag=1;
	}

}// end updateCentroids

/*******************************************************************/

int main(int argc, char *argv[]) {

		cudaSetDevice(0);
		cudaDeviceSynchronize();
		cudaThreadSynchronize();

		
		char *inputFile, *outputFile;
		int *r, *g, *b, *redCentroid, *greenCentroid, *blueCentroid;
		int *dev_Red, *dev_Green, *dev_Blue, *dev_tempRedCentroid, *dev_tempGreenCentroid, *dev_tempBlueCentroid;
		int *labelArray, *dev_labelArray;

		
		int width, height, nCentroids, nIterations,size;
		//int IMAGE_BYTES, CLUSTER_BYTES;
		int *pixelClusterCounter, *dev_pixelClusterCounter;
		int *sumRed, *sumGreen, *sumBlue;
		int flag = 0;
		int *dev_sumRed, *dev_sumGreen, *dev_sumBlue;
		int *dev_flag;

		inputFile = argv[1];
		outputFile = argv[2];
		width = atoi(argv[3]);
		
		height = atoi(argv[4]);
		nCentroids = atoi(argv[5]);  
		nIterations = atoi(argv[6]);
		

		// Setting image size in bytes
		IMAGE_BYTES = width * height * sizeof(int);
		CLUSTER_BYTES = nCentroids * sizeof(int);
		size = width * height;


		printf("Image: %s\n",inputFile);
		printf("Width: %d, Height: %d\n", width, height);
		printf("#Clusters: %d, #Iterations: %d\n", nCentroids, nIterations);


		
		r = (int*)(malloc(IMAGE_BYTES));
		g = (int*)(malloc(IMAGE_BYTES));
		b = (int*)(malloc(IMAGE_BYTES));
		redCentroid = (int*)(malloc(CLUSTER_BYTES));
		greenCentroid = (int*)(malloc(CLUSTER_BYTES));
		blueCentroid = (int*)(malloc(CLUSTER_BYTES));
		labelArray = (int*)(malloc(IMAGE_BYTES)); //stores the cluster number for each pixel
		sumRed = (int*)(malloc(CLUSTER_BYTES));
		sumGreen = (int*)(malloc(CLUSTER_BYTES));
		sumBlue = (int*)(malloc(CLUSTER_BYTES));
		pixelClusterCounter = (int*)(malloc(CLUSTER_BYTES));

		// Loading image in r, g, b arrays
		printf("Image loading...\n");
		if (loadRawImage(inputFile, r, g, b, size)) {
			printf("Image loaded!\n");
		} else {
			printf("NOT loaded!\n");
			return -1;
		}
		cudaEvent_t start;
  		cudaEvent_t stop;
		cudaEventCreate(&start);
    		cudaEventCreate(&stop);


		// Setting initial centroids
		printf("Initial Centroids: \n");
		
		initialise_centroids(nCentroids, redCentroid, greenCentroid, blueCentroid,r,g,b,size);

		printf("\n");	


		if(IMAGE_BYTES == 0 || CLUSTER_BYTES == 0) {
			return -1;
		}

		// allocate memory on GPU
		CUDA_CALL(cudaMalloc((void**) &dev_Red, IMAGE_BYTES));
		CUDA_CALL(cudaMalloc((void**) &dev_Green, IMAGE_BYTES));
		CUDA_CALL(cudaMalloc((void**) &dev_Blue, IMAGE_BYTES));
		CUDA_CALL(cudaMalloc((void**) &dev_tempRedCentroid, CLUSTER_BYTES));
		CUDA_CALL(cudaMalloc((void**) &dev_tempGreenCentroid, CLUSTER_BYTES));
		CUDA_CALL(cudaMalloc((void**) &dev_tempBlueCentroid, CLUSTER_BYTES));
		CUDA_CALL(cudaMalloc((void**) &dev_labelArray, IMAGE_BYTES));
		CUDA_CALL(cudaMalloc((void**) &dev_sumRed, CLUSTER_BYTES));
		CUDA_CALL(cudaMalloc((void**) &dev_sumGreen, CLUSTER_BYTES));
		CUDA_CALL(cudaMalloc((void**) &dev_sumBlue, CLUSTER_BYTES));
		CUDA_CALL(cudaMalloc((void**) &dev_pixelClusterCounter, CLUSTER_BYTES));
		CUDA_CALL(cudaMalloc((void**) &dev_flag, sizeof(int)));

		// copy host CPU memory to GPU
		CUDA_CALL(cudaMemcpy(dev_Red, r, IMAGE_BYTES, cudaMemcpyHostToDevice));
		CUDA_CALL(cudaMemcpy(dev_Green, g, IMAGE_BYTES, cudaMemcpyHostToDevice));
		CUDA_CALL(cudaMemcpy(dev_Blue, b, IMAGE_BYTES, cudaMemcpyHostToDevice));
		CUDA_CALL(cudaMemcpy(dev_tempRedCentroid, redCentroid,CLUSTER_BYTES,cudaMemcpyHostToDevice ));
		CUDA_CALL(cudaMemcpy(dev_tempGreenCentroid, greenCentroid,CLUSTER_BYTES,cudaMemcpyHostToDevice ));
		CUDA_CALL(cudaMemcpy(dev_tempBlueCentroid, blueCentroid,CLUSTER_BYTES,cudaMemcpyHostToDevice ));
		CUDA_CALL(cudaMemcpy(dev_labelArray, labelArray, IMAGE_BYTES, cudaMemcpyHostToDevice));
		CUDA_CALL(cudaMemcpy(dev_flag,&flag,sizeof(int),cudaMemcpyHostToDevice));
        //CUDA_CALL(cudaMemcpy(dev_sumRed, sumRed, CLUSTER_BYTES, cudaMemcpyHostToDevice));
		//CUDA_CALL(cudaMemcpy(dev_sumGreen, sumGreen, CLUSTER_BYTES, cudaMemcpyHostToDevice));
		//CUDA_CALL(cudaMemcpy(dev_sumBlue, sumBlue, CLUSTER_BYTES, cudaMemcpyHostToDevice));
		CUDA_CALL(cudaMemcpy(dev_pixelClusterCounter, pixelClusterCounter, CLUSTER_BYTES, cudaMemcpyHostToDevice));
		CUDA_CALL(cudaMemcpyToSymbol(dev_RedCentroid, redCentroid, CLUSTER_BYTES));
		CUDA_CALL(cudaMemcpyToSymbol(dev_GreenCentroid, greenCentroid, CLUSTER_BYTES));
		CUDA_CALL(cudaMemcpyToSymbol(dev_BlueCentroid, blueCentroid, CLUSTER_BYTES));
		CUDA_CALL(cudaMemcpyToSymbol(dev_nCentroids,&nCentroids, sizeof(int)));
		CUDA_CALL(cudaMemcpyToSymbol(dev_size, &size, sizeof(int)));


		// Clearing centroids on host
		for(int i = 0; i < nCentroids; i++) {
			redCentroid[i] = 0;
			greenCentroid[i] = 0;
			blueCentroid[i] = 0;
		}

		// Defining grid size

		int BLOCK_X, BLOCK_Y;
		BLOCK_X = ceil(width/BLOCK_SIZE);
		BLOCK_Y = ceil(height/BLOCK_SIZE);
		if(BLOCK_X > GRID_SIZE)
			BLOCK_X = GRID_SIZE;
		if(BLOCK_Y > GRID_SIZE)
			BLOCK_Y = GRID_SIZE;

	 	dim3 dimGRID(BLOCK_X,BLOCK_Y);
		dim3 dimBLOCK(BLOCK_SIZE,BLOCK_SIZE);

		//Starting timer
		cudaEventRecord(start, 0);
		printf("Launching K-Means Kernels..	\n");
		//Iteration of kmeans algorithm
		int num_iterations;
		for(int i = 0; i < nIterations; i++) {

			num_iterations = i;
			flag=0;
			CUDA_CALL(cudaMemcpy(dev_flag,&flag,sizeof(int),cudaMemcpyHostToDevice));
			
			
			clearArrays<<<1, dimBLOCK>>>(dev_sumRed, dev_sumGreen, dev_sumBlue, dev_pixelClusterCounter, dev_tempRedCentroid, dev_tempGreenCentroid, dev_tempBlueCentroid);

			
			clearLabelArray<<<dimGRID, dimBLOCK>>>(dev_labelArray);

	
			getClusterLabel<<< dimGRID, dimBLOCK >>> (dev_Red, dev_Green, dev_Blue,dev_labelArray);

			
			sumCluster<<<dimGRID, dimBLOCK>>> (dev_Red, dev_Green, dev_Blue, dev_sumRed, dev_sumGreen, dev_sumBlue, dev_labelArray,dev_pixelClusterCounter);

			
			updateCentroids<<<1,dimBLOCK >>>(dev_tempRedCentroid, dev_tempGreenCentroid, dev_tempBlueCentroid, dev_sumRed, dev_sumGreen, dev_sumBlue, dev_pixelClusterCounter,dev_flag);

		
			CUDA_CALL(cudaMemcpy(redCentroid, dev_tempRedCentroid, CLUSTER_BYTES,cudaMemcpyDeviceToHost));
			CUDA_CALL(cudaMemcpy(greenCentroid, dev_tempGreenCentroid, CLUSTER_BYTES,cudaMemcpyDeviceToHost));
			CUDA_CALL(cudaMemcpy(blueCentroid, dev_tempBlueCentroid, CLUSTER_BYTES,cudaMemcpyDeviceToHost));
			CUDA_CALL(cudaMemcpy(&flag, dev_flag,sizeof(int),cudaMemcpyDeviceToHost));
			

			CUDA_CALL(cudaMemcpyToSymbol(dev_RedCentroid, redCentroid, CLUSTER_BYTES));
			CUDA_CALL(cudaMemcpyToSymbol(dev_GreenCentroid, greenCentroid, CLUSTER_BYTES));
			CUDA_CALL(cudaMemcpyToSymbol(dev_BlueCentroid, blueCentroid, CLUSTER_BYTES));

			if(flag==0)
				break;
			

		}
		cudaEventRecord(stop, 0);
		float elapsed;
		cudaEventSynchronize(stop);
   		cudaEventElapsedTime(&elapsed, start, stop);
		
		CUDA_CALL(cudaMemcpy(labelArray, dev_labelArray, IMAGE_BYTES, cudaMemcpyDeviceToHost));
		CUDA_CALL(cudaMemcpy(sumRed, dev_sumRed, CLUSTER_BYTES, cudaMemcpyDeviceToHost));
		CUDA_CALL(cudaMemcpy(sumGreen, dev_sumGreen, CLUSTER_BYTES, cudaMemcpyDeviceToHost));
		CUDA_CALL(cudaMemcpy(sumBlue, dev_sumBlue, CLUSTER_BYTES, cudaMemcpyDeviceToHost));
		CUDA_CALL(cudaMemcpy(pixelClusterCounter, dev_pixelClusterCounter, CLUSTER_BYTES, cudaMemcpyDeviceToHost));

		
		printf("Kmeans code ran in: %f secs.\n", elapsed/1000.0);
		printf("Converged in %d iterations.\n",num_iterations);
		printf("\n");

	

		// labelArray DEBUG
		  int counter = 0;

		printf("Label Array:\n");
		for(int i = 0; i < (size); i++) {
			//printf("%d\n", labelArray[i]);
			counter++;
		}
		printf("printing counter %d\n", counter);
		counter = 0;

		printf("Sum Arrays:\n");
		for(int j = 0; j < nCentroids; j++) {
			printf("r: %u g: %u b: %u \n", sumRed[j], sumGreen[j], sumBlue[j]);
			counter++;
		}

		printf("\n");

		printf("Pixels per centroids:\n");
		for(int k = 0; k < nCentroids; k++){
			printf("%d centroid: %d pixels\n", k, pixelClusterCounter[k]);
		}

		printf("\n");



		printf("New centroids:\n");
		for(int i = 0; i < nCentroids; i++) {

			printf("%d, %d, %d \n", redCentroid[i], greenCentroid[i], blueCentroid[i]);
		}


		// writing...
		printf("Image writing...\n");

		if (writeRawImage(outputFile,labelArray, redCentroid, greenCentroid,  blueCentroid,  size)) {
			printf("Image written!\n");
		} else {
			printf("NOT written!\n");
			return -1;
		}

		free(r);
		free(g);
		free(b);
		free(redCentroid);
		free(greenCentroid);
		free(blueCentroid);
		free(labelArray);
		free(sumRed);
		free(sumGreen);
		free(sumBlue);
		free(pixelClusterCounter);

		CUDA_CALL(cudaFree(dev_Red));
		CUDA_CALL(cudaFree(dev_Green));
		CUDA_CALL(cudaFree(dev_Blue));
		CUDA_CALL(cudaFree(dev_tempRedCentroid));
		CUDA_CALL(cudaFree(dev_tempGreenCentroid));
		CUDA_CALL(cudaFree(dev_tempBlueCentroid));
		CUDA_CALL(cudaFree(dev_labelArray));
		CUDA_CALL(cudaFree(dev_sumRed));
		CUDA_CALL(cudaFree(dev_sumGreen));
		CUDA_CALL(cudaFree(dev_sumBlue));
		CUDA_CALL(cudaFree(dev_pixelClusterCounter));

		printf("That's the end.\n");
		return 0;
}

	.file	"tmpxft_00321fb2_00000000-6_kmeans.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
	.globl	_Z20initialise_centroidsiPiS_S_S_S_S_i
	.type	_Z20initialise_centroidsiPiS_S_S_S_S_i, @function
_Z20initialise_centroidsiPiS_S_S_S_S_i:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rcx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	80(%rsp), %r13
.L3:
	cmpl	%ebx, %ebp
	jle	.L7
	movq	%r9, 8(%rsp)
	movq	%r8, (%rsp)
	call	rand@PLT
	movq	(%rsp), %r8
	movq	8(%rsp), %r9
	cltd
	idivl	88(%rsp)
	movslq	%edx, %rdx
	movl	(%r8,%rdx,4), %eax
	movl	%eax, (%r12,%rbx,4)
	movl	0(%r13,%rdx,4), %eax
	movl	%eax, (%r15,%rbx,4)
	movl	(%r9,%rdx,4), %eax
	movl	%eax, (%r14,%rbx,4)
	incq	%rbx
	jmp	.L3
.L7:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z20initialise_centroidsiPiS_S_S_S_S_i, .-_Z20initialise_centroidsiPiS_S_S_S_S_i
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"r"
	.text
	.globl	_Z12loadRawImagePcPiS0_S0_i
	.type	_Z12loadRawImagePcPiS0_S0_i, @function
_Z12loadRawImagePcPiS0_S0_i:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rcx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	leaq	.LC0(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%r8d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	pushq	%r9
	.cfi_def_cfa_offset 64
	call	fopen@PLT
	movq	%rax, %rbx
	testq	%rax, %rax
	je	.L15
.L10:
	movq	%rbx, %rdi
	cmpl	%ebp, %r12d
	jle	.L16
	call	fgetc@PLT
	movq	%rbx, %rdi
	movl	%eax, 0(%r13,%rbp,4)
	call	fgetc@PLT
	movq	%rbx, %rdi
	movl	%eax, (%r14,%rbp,4)
	call	fgetc@PLT
	movl	%eax, (%r15,%rbp,4)
	incq	%rbp
	jmp	.L10
.L16:
	call	fclose@PLT
	movb	$1, %al
	jmp	.L8
.L15:
	xorl	%eax, %eax
.L8:
	popq	%rdx
	.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
.LFE2028:
	.size	_Z12loadRawImagePcPiS0_S0_i, .-_Z12loadRawImagePcPiS0_S0_i
	.section	.rodata.str1.1
.LC1:
	.string	"wb"
	.text
	.globl	_Z13writeRawImagePcPiS0_S0_S0_i
	.type	_Z13writeRawImagePcPiS0_S0_S0_i, @function
_Z13writeRawImagePcPiS0_S0_S0_i:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%r8, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rcx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	leaq	.LC1(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%r9d, 12(%rsp)
	call	fopen@PLT
	movq	%rax, %rbx
	testq	%rax, %rax
	je	.L24
.L19:
	cmpl	%r12d, 12(%rsp)
	jle	.L25
	movslq	0(%rbp,%r12,4), %rax
	movq	%rbx, %rsi
	movsbl	0(%r13,%rax,4), %edi
	call	fputc@PLT
	movslq	0(%rbp,%r12,4), %rax
	movq	%rbx, %rsi
	movsbl	(%r14,%rax,4), %edi
	call	fputc@PLT
	movslq	0(%rbp,%r12,4), %rax
	movq	%rbx, %rsi
	incq	%r12
	movsbl	(%r15,%rax,4), %edi
	call	fputc@PLT
	jmp	.L19
.L25:
	movq	%rbx, %rdi
	call	fclose@PLT
	movb	$1, %al
	jmp	.L17
.L24:
	xorl	%eax, %eax
.L17:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z13writeRawImagePcPiS0_S0_S0_i, .-_Z13writeRawImagePcPiS0_S0_S0_i
	.globl	_Z43__device_stub__Z11clearArraysPiS_S_S_S_S_S_PiS_S_S_S_S_S_
	.type	_Z43__device_stub__Z11clearArraysPiS_S_S_S_S_S_PiS_S_S_S_S_S_, @function
_Z43__device_stub__Z11clearArraysPiS_S_S_S_S_S_PiS_S_S_S_S_S_:
.LFB2055:
	.cfi_startproc
	endbr64
	subq	$200, %rsp
	.cfi_def_cfa_offset 208
	movq	208(%rsp), %rax
	movq	%rdi, 56(%rsp)
	leaq	80(%rsp), %rdi
	movq	%rsi, 48(%rsp)
	leaq	92(%rsp), %rsi
	movq	%rdx, 40(%rsp)
	leaq	64(%rsp), %rdx
	movq	%rcx, 32(%rsp)
	leaq	72(%rsp), %rcx
	movq	%r8, 24(%rsp)
	movq	%r9, 16(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rax
	movl	$1, 88(%rsp)
	movq	%rax, 128(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 176(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 80(%rsp)
	movq	%rax, 92(%rsp)
	movl	$1, 100(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L26
	pushq	72(%rsp)
	.cfi_def_cfa_offset 216
	leaq	_Z11clearArraysPiS_S_S_S_S_S_(%rip), %rdi
	pushq	72(%rsp)
	.cfi_def_cfa_offset 224
	movq	108(%rsp), %rcx
	movl	116(%rsp), %r8d
	movq	96(%rsp), %rsi
	movl	104(%rsp), %edx
	leaq	144(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 216
	popq	%rdx
	.cfi_def_cfa_offset 208
.L26:
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	addq	$200, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2055:
	.size	_Z43__device_stub__Z11clearArraysPiS_S_S_S_S_S_PiS_S_S_S_S_S_, .-_Z43__device_stub__Z11clearArraysPiS_S_S_S_S_S_PiS_S_S_S_S_S_
	.globl	_Z11clearArraysPiS_S_S_S_S_S_
	.type	_Z11clearArraysPiS_S_S_S_S_S_, @function
_Z11clearArraysPiS_S_S_S_S_S_:
.LFB2056:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z11clearArraysPiS_S_S_S_S_S_PiS_S_S_S_S_S_
	.cfi_endproc
.LFE2056:
	.size	_Z11clearArraysPiS_S_S_S_S_S_, .-_Z11clearArraysPiS_S_S_S_S_S_
	.globl	_Z35__device_stub__Z15clearLabelArrayPiPi
	.type	_Z35__device_stub__Z15clearLabelArrayPiPi, @function
_Z35__device_stub__Z15clearLabelArrayPiPi:
.LFB2057:
	.cfi_startproc
	endbr64
	subq	$104, %rsp
	.cfi_def_cfa_offset 112
	movq	%rdi, 8(%rsp)
	leaq	24(%rsp), %rcx
	leaq	16(%rsp), %rdx
	leaq	44(%rsp), %rsi
	leaq	32(%rsp), %rdi
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 40(%rsp)
	movq	%rax, 80(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L31
	pushq	24(%rsp)
	.cfi_def_cfa_offset 120
	leaq	_Z15clearLabelArrayPi(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 128
	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 120
	popq	%rdx
	.cfi_def_cfa_offset 112
.L31:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	addq	$104, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2057:
	.size	_Z35__device_stub__Z15clearLabelArrayPiPi, .-_Z35__device_stub__Z15clearLabelArrayPiPi
	.globl	_Z15clearLabelArrayPi
	.type	_Z15clearLabelArrayPi, @function
_Z15clearLabelArrayPi:
.LFB2058:
	.cfi_startproc
	endbr64
	jmp	_Z35__device_stub__Z15clearLabelArrayPiPi
	.cfi_endproc
.LFE2058:
	.size	_Z15clearLabelArrayPi, .-_Z15clearLabelArrayPi
	.globl	_Z41__device_stub__Z15getClusterLabelPiS_S_S_PiS_S_S_
	.type	_Z41__device_stub__Z15getClusterLabelPiS_S_S_PiS_S_S_, @function
_Z41__device_stub__Z15getClusterLabelPiS_S_S_PiS_S_S_:
.LFB2059:
	.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
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L36
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z15getClusterLabelPiS_S_S_(%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
.L36:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L38
	call	__stack_chk_fail@PLT
.L38:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2059:
	.size	_Z41__device_stub__Z15getClusterLabelPiS_S_S_PiS_S_S_, .-_Z41__device_stub__Z15getClusterLabelPiS_S_S_PiS_S_S_
	.globl	_Z15getClusterLabelPiS_S_S_
	.type	_Z15getClusterLabelPiS_S_S_, @function
_Z15getClusterLabelPiS_S_S_:
.LFB2060:
	.cfi_startproc
	endbr64
	jmp	_Z41__device_stub__Z15getClusterLabelPiS_S_S_PiS_S_S_
	.cfi_endproc
.LFE2060:
	.size	_Z15getClusterLabelPiS_S_S_, .-_Z15getClusterLabelPiS_S_S_
	.globl	_Z44__device_stub__Z10sumClusterPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_
	.type	_Z44__device_stub__Z10sumClusterPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_, @function
_Z44__device_stub__Z10sumClusterPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_:
.LFB2061:
	.cfi_startproc
	endbr64
	subq	$216, %rsp
	.cfi_def_cfa_offset 224
	movq	224(%rsp), %rax
	movq	%rdi, 56(%rsp)
	leaq	88(%rsp), %rdi
	movq	%rsi, 48(%rsp)
	leaq	100(%rsp), %rsi
	movq	%rax, 8(%rsp)
	movq	232(%rsp), %rax
	movq	%rdx, 40(%rsp)
	leaq	72(%rsp), %rdx
	movq	%rcx, 32(%rsp)
	leaq	80(%rsp), %rcx
	movq	%r8, 24(%rsp)
	movq	%r9, 16(%rsp)
	movq	%rax, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 200(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rax
	movl	$1, 96(%rsp)
	movq	%rax, 136(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 184(%rsp)
	movq	%rsp, %rax
	movq	%rax, 192(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 88(%rsp)
	movq	%rax, 100(%rsp)
	movl	$1, 108(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L41
	pushq	80(%rsp)
	.cfi_def_cfa_offset 232
	leaq	_Z10sumClusterPiS_S_S_S_S_S_S_(%rip), %rdi
	pushq	80(%rsp)
	.cfi_def_cfa_offset 240
	movq	116(%rsp), %rcx
	movl	124(%rsp), %r8d
	movq	104(%rsp), %rsi
	movl	112(%rsp), %edx
	leaq	152(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 232
	popq	%rdx
	.cfi_def_cfa_offset 224
.L41:
	movq	200(%rsp), %rax
	subq	%fs:40, %rax
	je	.L43
	call	__stack_chk_fail@PLT
.L43:
	addq	$216, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2061:
	.size	_Z44__device_stub__Z10sumClusterPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_, .-_Z44__device_stub__Z10sumClusterPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_
	.globl	_Z10sumClusterPiS_S_S_S_S_S_S_
	.type	_Z10sumClusterPiS_S_S_S_S_S_S_, @function
_Z10sumClusterPiS_S_S_S_S_S_S_:
.LFB2062:
	.cfi_startproc
	endbr64
	jmp	_Z44__device_stub__Z10sumClusterPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_
	.cfi_endproc
.LFE2062:
	.size	_Z10sumClusterPiS_S_S_S_S_S_S_, .-_Z10sumClusterPiS_S_S_S_S_S_S_
	.globl	_Z49__device_stub__Z15updateCentroidsPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_
	.type	_Z49__device_stub__Z15updateCentroidsPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_, @function
_Z49__device_stub__Z15updateCentroidsPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_:
.LFB2063:
	.cfi_startproc
	endbr64
	subq	$216, %rsp
	.cfi_def_cfa_offset 224
	movq	224(%rsp), %rax
	movq	%rdi, 56(%rsp)
	leaq	88(%rsp), %rdi
	movq	%rsi, 48(%rsp)
	leaq	100(%rsp), %rsi
	movq	%rax, 8(%rsp)
	movq	232(%rsp), %rax
	movq	%rdx, 40(%rsp)
	leaq	72(%rsp), %rdx
	movq	%rcx, 32(%rsp)
	leaq	80(%rsp), %rcx
	movq	%r8, 24(%rsp)
	movq	%r9, 16(%rsp)
	movq	%rax, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 200(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rax
	movl	$1, 96(%rsp)
	movq	%rax, 136(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 184(%rsp)
	movq	%rsp, %rax
	movq	%rax, 192(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 88(%rsp)
	movq	%rax, 100(%rsp)
	movl	$1, 108(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L46
	pushq	80(%rsp)
	.cfi_def_cfa_offset 232
	leaq	_Z15updateCentroidsPiS_S_S_S_S_S_S_(%rip), %rdi
	pushq	80(%rsp)
	.cfi_def_cfa_offset 240
	movq	116(%rsp), %rcx
	movl	124(%rsp), %r8d
	movq	104(%rsp), %rsi
	movl	112(%rsp), %edx
	leaq	152(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 232
	popq	%rdx
	.cfi_def_cfa_offset 224
.L46:
	movq	200(%rsp), %rax
	subq	%fs:40, %rax
	je	.L48
	call	__stack_chk_fail@PLT
.L48:
	addq	$216, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2063:
	.size	_Z49__device_stub__Z15updateCentroidsPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_, .-_Z49__device_stub__Z15updateCentroidsPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_
	.globl	_Z15updateCentroidsPiS_S_S_S_S_S_S_
	.type	_Z15updateCentroidsPiS_S_S_S_S_S_S_, @function
_Z15updateCentroidsPiS_S_S_S_S_S_S_:
.LFB2064:
	.cfi_startproc
	endbr64
	jmp	_Z49__device_stub__Z15updateCentroidsPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_
	.cfi_endproc
.LFE2064:
	.size	_Z15updateCentroidsPiS_S_S_S_S_S_S_, .-_Z15updateCentroidsPiS_S_S_S_S_S_S_
	.section	.rodata.str1.1
.LC2:
	.string	"Image: %s\n"
.LC3:
	.string	"Width: %d, Height: %d\n"
.LC4:
	.string	"#Clusters: %d, #Iterations: %d\n"
.LC5:
	.string	"Image loading...\n"
.LC6:
	.string	"Image loaded!\n"
.LC7:
	.string	"Initial Centroids: \n"
.LC8:
	.string	"\n"
.LC9:
	.string	"NOT loaded!\n"
.LC10:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/grakshith/Parallel-K-means/master/Cuda/kmeans.cu"
.LC11:
	.string	"CUDA error at %s:%d\n"
.LC12:
	.string	"  %s\n"
.LC13:
	.string	"Launching K-Means Kernels..\t\n"
.LC15:
	.string	"Kmeans code ran in: %f secs.\n"
.LC16:
	.string	"Converged in %d iterations.\n"
.LC17:
	.string	"Label Array:\n"
.LC18:
	.string	"printing counter %d\n"
.LC19:
	.string	"Sum Arrays:\n"
.LC20:
	.string	"r: %u g: %u b: %u \n"
.LC21:
	.string	"Pixels per centroids:\n"
.LC22:
	.string	"%d centroid: %d pixels\n"
.LC23:
	.string	"New centroids:\n"
.LC24:
	.string	"%d, %d, %d \n"
.LC25:
	.string	"Image writing...\n"
.LC26:
	.string	"Image written!\n"
.LC27:
	.string	"NOT written!\n"
.LC28:
	.string	"That's the end.\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%edi, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$264, %rsp
	.cfi_def_cfa_offset 320
	movq	%fs:40, %rax
	movq	%rax, 248(%rsp)
	xorl	%eax, %eax
	call	cudaSetDevice@PLT
	call	cudaDeviceSynchronize@PLT
	call	cudaThreadSynchronize@PLT
	movq	8(%rbx), %rax
	movq	24(%rbx), %rdi
	xorl	%r9d, %r9d
	movl	%r9d, 92(%rsp)
	movq	%rax, 56(%rsp)
	movq	16(%rbx), %rax
	movq	%rax, 72(%rsp)
	call	atoi@PLT
	movq	32(%rbx), %rdi
	movl	%eax, %r12d
	call	atoi@PLT
	movq	40(%rbx), %rdi
	movl	%eax, %r14d
	call	atoi@PLT
	movq	48(%rbx), %rdi
	movl	%eax, %ebp
	movl	%eax, 84(%rsp)
	call	atoi@PLT
	sall	$2, %ebp
	movl	$2, %edi
	leaq	.LC2(%rip), %rsi
	movl	%eax, 68(%rsp)
	movl	%r12d, %eax
	imull	%r14d, %eax
	movl	%ebp, CLUSTER_BYTES(%rip)
	leal	0(,%rax,4), %edx
	movl	%eax, 88(%rsp)
	xorl	%eax, %eax
	movl	%edx, IMAGE_BYTES(%rip)
	movq	56(%rsp), %rdx
	call	__printf_chk@PLT
	movl	%r14d, %ecx
	movl	%r12d, %edx
	movl	$2, %edi
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	68(%rsp), %ecx
	movl	84(%rsp), %edx
	xorl	%eax, %eax
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movslq	IMAGE_BYTES(%rip), %r15
	movq	%r15, %rdi
	call	malloc@PLT
	movq	%r15, %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	movq	%r15, %rdi
	movq	%rax, 16(%rsp)
	call	malloc@PLT
	movslq	CLUSTER_BYTES(%rip), %r13
	movq	%rax, 24(%rsp)
	movq	%r13, %rdi
	call	malloc@PLT
	movq	%r13, %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	movq	%r13, %rdi
	movq	%rax, %rbx
	call	malloc@PLT
	movq	%r15, %rdi
	movq	%rax, (%rsp)
	call	malloc@PLT
	movq	%r13, %rdi
	movq	%rax, 32(%rsp)
	call	malloc@PLT
	movq	%r13, %rdi
	movq	%rax, 40(%rsp)
	call	malloc@PLT
	movq	%r13, %rdi
	movq	%rax, %r15
	call	malloc@PLT
	movq	%r13, %rdi
	movq	%rax, 48(%rsp)
	call	malloc@PLT
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	movq	%rax, %r13
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	88(%rsp), %r8d
	movq	24(%rsp), %rcx
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	movq	56(%rsp), %rdi
	call	_Z12loadRawImagePcPiS0_S0_i
	testb	%al, %al
	je	.L52
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	192(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	200(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	88(%rsp), %eax
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	pushq	%rax
	.cfi_def_cfa_offset 328
	pushq	32(%rsp)
	.cfi_def_cfa_offset 336
	movq	32(%rsp), %r9
	movq	16(%rsp), %rcx
	movq	24(%rsp), %r8
	movl	100(%rsp), %edi
	call	_Z20initialise_centroidsiPiS_S_S_S_S_i
	popq	%rdi
	.cfi_def_cfa_offset 328
	leaq	.LC8(%rip), %rsi
	popq	%r8
	.cfi_def_cfa_offset 320
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movslq	IMAGE_BYTES(%rip), %rsi
	testl	%esi, %esi
	jne	.L133
	jmp	.L53
.L52:
	leaq	.LC9(%rip), %rsi
	jmp	.L136
.L133:
	cmpl	$0, CLUSTER_BYTES(%rip)
	je	.L53
	leaq	96(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$299, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	IMAGE_BYTES(%rip), %rsi
	leaq	104(%rsp), %rdi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L56
	movl	$300, %ecx
.L137:
	leaq	.LC10(%rip), %rdx
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$2, %edi
	leaq	.LC12(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L56:
	movslq	IMAGE_BYTES(%rip), %rsi
	leaq	112(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$301, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	120(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$302, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	128(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$303, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	136(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$304, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	IMAGE_BYTES(%rip), %rsi
	leaq	144(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$305, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	160(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$306, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	168(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$307, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	176(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$308, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	152(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$309, %ecx
	testl	%eax, %eax
	jne	.L137
	leaq	184(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	$310, %ecx
	testl	%eax, %eax
	jne	.L137
	movq	8(%rsp), %rsi
	movq	96(%rsp), %rdi
	movl	$1, %ecx
	movslq	IMAGE_BYTES(%rip), %rdx
	call	cudaMemcpy@PLT
	movl	$313, %ecx
	testl	%eax, %eax
	jne	.L137
	movq	16(%rsp), %rsi
	movq	104(%rsp), %rdi
	movl	$1, %ecx
	movslq	IMAGE_BYTES(%rip), %rdx
	call	cudaMemcpy@PLT
	movl	$314, %ecx
	testl	%eax, %eax
	jne	.L137
	movq	24(%rsp), %rsi
	movq	112(%rsp), %rdi
	movl	$1, %ecx
	movslq	IMAGE_BYTES(%rip), %rdx
	call	cudaMemcpy@PLT
	movl	$315, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	120(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	call	cudaMemcpy@PLT
	movl	$316, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	128(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	call	cudaMemcpy@PLT
	movl	$317, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	(%rsp), %rsi
	movl	$1, %ecx
	movq	136(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	$318, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	IMAGE_BYTES(%rip), %rdx
	movq	32(%rsp), %rsi
	movl	$1, %ecx
	movq	144(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	$319, %ecx
	testl	%eax, %eax
	jne	.L137
	movl	$1, %ecx
	leaq	92(%rsp), %rsi
	movl	$4, %edx
	movq	184(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	$320, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	152(%rsp), %rdi
	movl	$1, %ecx
	movq	%r13, %rsi
	call	cudaMemcpy@PLT
	movl	$324, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rdx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	movq	%rbp, %rsi
	leaq	_ZL15dev_RedCentroid(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$325, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rdx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	movq	%rbx, %rsi
	leaq	_ZL17dev_GreenCentroid(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$326, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	(%rsp), %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	leaq	_ZL16dev_BlueCentroid(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$327, %ecx
	testl	%eax, %eax
	jne	.L137
	xorl	%ecx, %ecx
	leaq	84(%rsp), %rsi
	movl	$1, %r8d
	movl	$4, %edx
	leaq	_ZL14dev_nCentroids(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$328, %ecx
	testl	%eax, %eax
	jne	.L137
	xorl	%ecx, %ecx
	leaq	88(%rsp), %rsi
	movl	$1, %r8d
	movl	$4, %edx
	leaq	_ZL8dev_size(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	testl	%eax, %eax
	jne	.L80
	movl	84(%rsp), %edx
	xorl	%eax, %eax
	jmp	.L81
.L80:
	movl	$329, %ecx
	jmp	.L137
.L81:
	cmpl	%eax, %edx
	jle	.L138
	movq	(%rsp), %rcx
	xorl	%r11d, %r11d
	xorl	%esi, %esi
	movl	%r11d, 0(%rbp,%rax,4)
	movl	%r11d, (%rbx,%rax,4)
	movl	%esi, (%rcx,%rax,4)
	incq	%rax
	jmp	.L81
.L138:
	movl	$256, %ecx
	cmpl	$4111, %r12d
	jg	.L83
	movl	%r12d, %eax
	movl	$16, %ecx
	cltd
	idivl	%ecx
	movl	%eax, %ecx
.L83:
	movl	$256, %eax
	cmpl	$4111, %r14d
	jg	.L84
	movl	%r14d, %eax
	movl	$16, %esi
	cltd
	idivl	%esi
.L84:
	movq	192(%rsp), %rdi
	movl	%eax, 216(%rsp)
	movl	%ecx, 212(%rsp)
	movl	$1, 220(%rsp)
	movl	$1, 232(%rsp)
	movabsq	$68719476752, %rax
	xorl	%esi, %esi
	xorl	%r12d, %r12d
	movabsq	$4294967297, %r14
	movq	%rax, 224(%rsp)
	call	cudaEventRecord@PLT
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L85:
	movl	68(%rsp), %eax
	cmpl	%eax, %r12d
	jge	.L99
	movq	184(%rsp), %rdi
	xorl	%r10d, %r10d
	leaq	92(%rsp), %rsi
	movl	$1, %ecx
	movl	$4, %edx
	movl	%r10d, 92(%rsp)
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	je	.L86
	movl	$361, %ecx
	jmp	.L137
.L86:
	movl	232(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r14, %rdi
	movq	224(%rsp), %rdx
	movl	$1, %esi
	movq	%r14, 236(%rsp)
	movl	$1, 244(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L87
	pushq	%rdi
	.cfi_def_cfa_offset 328
	pushq	144(%rsp)
	.cfi_def_cfa_offset 336
	movq	144(%rsp), %r9
	movq	136(%rsp), %r8
	movq	168(%rsp), %rcx
	movq	192(%rsp), %rdx
	movq	184(%rsp), %rsi
	movq	176(%rsp), %rdi
	call	_Z43__device_stub__Z11clearArraysPiS_S_S_S_S_S_PiS_S_S_S_S_S_
	popq	%r8
	.cfi_def_cfa_offset 328
	popq	%r9
	.cfi_def_cfa_offset 320
.L87:
	movl	232(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	224(%rsp), %rdx
	movq	212(%rsp), %rdi
	movl	220(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L88
	movq	144(%rsp), %rdi
	call	_Z35__device_stub__Z15clearLabelArrayPiPi
.L88:
	movl	232(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	224(%rsp), %rdx
	movq	212(%rsp), %rdi
	movl	220(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L89
	movq	144(%rsp), %rcx
	movq	112(%rsp), %rdx
	movq	104(%rsp), %rsi
	movq	96(%rsp), %rdi
	call	_Z41__device_stub__Z15getClusterLabelPiS_S_S_PiS_S_S_
.L89:
	movl	232(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	224(%rsp), %rdx
	movq	212(%rsp), %rdi
	movl	220(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L90
	pushq	152(%rsp)
	.cfi_def_cfa_offset 328
	pushq	152(%rsp)
	.cfi_def_cfa_offset 336
	movq	192(%rsp), %r9
	movq	184(%rsp), %r8
	movq	176(%rsp), %rcx
	movq	128(%rsp), %rdx
	movq	120(%rsp), %rsi
	movq	112(%rsp), %rdi
	call	_Z44__device_stub__Z10sumClusterPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_
	popq	%rcx
	.cfi_def_cfa_offset 328
	popq	%rsi
	.cfi_def_cfa_offset 320
.L90:
	movl	232(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r14, %rdi
	movq	224(%rsp), %rdx
	movl	$1, %esi
	movq	%r14, 236(%rsp)
	movl	$1, 244(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L91
	pushq	184(%rsp)
	.cfi_def_cfa_offset 328
	pushq	160(%rsp)
	.cfi_def_cfa_offset 336
	movq	192(%rsp), %r9
	movq	184(%rsp), %r8
	movq	176(%rsp), %rcx
	movq	152(%rsp), %rdx
	movq	144(%rsp), %rsi
	movq	136(%rsp), %rdi
	call	_Z49__device_stub__Z15updateCentroidsPiS_S_S_S_S_S_S_PiS_S_S_S_S_S_S_
	popq	%rax
	.cfi_def_cfa_offset 328
	popq	%rdx
	.cfi_def_cfa_offset 320
.L91:
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	120(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbp, %rdi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	je	.L92
	movl	$379, %ecx
	jmp	.L137
.L92:
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	128(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	je	.L93
	movl	$380, %ecx
	jmp	.L137
.L93:
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	(%rsp), %rdi
	movl	$2, %ecx
	movq	136(%rsp), %rsi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	je	.L94
	movl	$381, %ecx
	jmp	.L137
.L94:
	leaq	92(%rsp), %rdi
	movl	$2, %ecx
	movl	$4, %edx
	movq	184(%rsp), %rsi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	je	.L95
	movl	$382, %ecx
	jmp	.L137
.L95:
	movslq	CLUSTER_BYTES(%rip), %rdx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	movq	%rbp, %rsi
	leaq	_ZL15dev_RedCentroid(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	testl	%eax, %eax
	je	.L96
	movl	$385, %ecx
	jmp	.L137
.L96:
	movslq	CLUSTER_BYTES(%rip), %rdx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	movq	%rbx, %rsi
	leaq	_ZL17dev_GreenCentroid(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	testl	%eax, %eax
	je	.L97
	movl	$386, %ecx
	jmp	.L137
.L97:
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	(%rsp), %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	leaq	_ZL16dev_BlueCentroid(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	testl	%eax, %eax
	je	.L98
	movl	$387, %ecx
	jmp	.L137
.L98:
	cmpl	$0, 92(%rsp)
	movl	%r12d, 64(%rsp)
	je	.L99
	incl	%r12d
	jmp	.L85
.L99:
	movq	200(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	200(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	200(%rsp), %rdx
	movq	192(%rsp), %rsi
	leaq	236(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	32(%rsp), %rdi
	movl	$2, %ecx
	movslq	IMAGE_BYTES(%rip), %rdx
	movq	144(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	$399, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	40(%rsp), %rdi
	movl	$2, %ecx
	movq	160(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	$400, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	168(%rsp), %rsi
	movl	$2, %ecx
	movq	%r15, %rdi
	call	cudaMemcpy@PLT
	movl	$401, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	48(%rsp), %rdi
	movl	$2, %ecx
	movq	176(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	$402, %ecx
	testl	%eax, %eax
	jne	.L137
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	152(%rsp), %rsi
	movl	$2, %ecx
	movq	%r13, %rdi
	call	cudaMemcpy@PLT
	movl	$403, %ecx
	testl	%eax, %eax
	jne	.L137
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	236(%rsp), %xmm0
	divsd	.LC14(%rip), %xmm0
	call	__printf_chk@PLT
	movl	64(%rsp), %edx
	leaq	.LC16(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC20(%rip), %r12
	call	__printf_chk@PLT
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC17(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	88(%rsp), %edx
	xorl	%eax, %eax
	movl	$2, %edi
	leaq	.LC18(%rip), %rsi
	testl	%edx, %edx
	cmovs	%eax, %edx
	xorl	%r14d, %r14d
	call	__printf_chk@PLT
	leaq	.LC19(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L106:
	cmpl	%r14d, 84(%rsp)
	jle	.L139
	movq	40(%rsp), %rax
	movl	(%r15,%r14,4), %ecx
	movq	%r12, %rsi
	movl	$2, %edi
	movl	(%rax,%r14,4), %edx
	movq	48(%rsp), %rax
	movl	(%rax,%r14,4), %r8d
	xorl	%eax, %eax
	incq	%r14
	call	__printf_chk@PLT
	jmp	.L106
.L139:
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	call	__printf_chk@PLT
	leaq	.LC21(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC22(%rip), %r12
.L108:
	movl	%r14d, %edx
	cmpl	%r14d, 84(%rsp)
	jle	.L140
	movl	0(%r13,%r14,4), %ecx
	movq	%r12, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r14
	call	__printf_chk@PLT
	jmp	.L108
.L140:
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	call	__printf_chk@PLT
	leaq	.LC23(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC24(%rip), %r12
.L110:
	cmpl	%r14d, 84(%rsp)
	jle	.L141
	movq	(%rsp), %rax
	movl	(%rbx,%r14,4), %ecx
	movq	%r12, %rsi
	movl	$2, %edi
	movl	0(%rbp,%r14,4), %edx
	movl	(%rax,%r14,4), %r8d
	xorl	%eax, %eax
	incq	%r14
	call	__printf_chk@PLT
	jmp	.L110
.L141:
	leaq	.LC25(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	88(%rsp), %r9d
	movq	%rbx, %rcx
	movq	%rbp, %rdx
	movq	(%rsp), %r8
	movq	32(%rsp), %rsi
	movq	72(%rsp), %rdi
	call	_Z13writeRawImagePcPiS0_S0_S0_i
	testb	%al, %al
	je	.L112
	leaq	.LC26(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	(%rsp), %rdi
	call	free@PLT
	movq	32(%rsp), %rdi
	call	free@PLT
	movq	40(%rsp), %rdi
	call	free@PLT
	movq	%r15, %rdi
	call	free@PLT
	movq	48(%rsp), %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	96(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	je	.L134
	movl	$469, %ecx
	jmp	.L137
.L112:
	leaq	.LC27(%rip), %rsi
.L136:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L53:
	orl	$-1, %eax
	jmp	.L51
.L134:
	movq	104(%rsp), %rdi
	call	cudaFree@PLT
	movl	$470, %ecx
	testl	%eax, %eax
	jne	.L137
	movq	112(%rsp), %rdi
	call	cudaFree@PLT
	movl	$471, %ecx
	testl	%eax, %eax
	jne	.L137
	movq	120(%rsp), %rdi
	call	cudaFree@PLT
	movl	$472, %ecx
	testl	%eax, %eax
	jne	.L137
	movq	128(%rsp), %rdi
	call	cudaFree@PLT
	movl	$473, %ecx
	testl	%eax, %eax
	jne	.L137
	movq	136(%rsp), %rdi
	call	cudaFree@PLT
	movl	$474, %ecx
	testl	%eax, %eax
	jne	.L137
	movq	144(%rsp), %rdi
	call	cudaFree@PLT
	movl	$475, %ecx
	testl	%eax, %eax
	jne	.L137
	movq	160(%rsp), %rdi
	call	cudaFree@PLT
	movl	$476, %ecx
	testl	%eax, %eax
	jne	.L137
	movq	168(%rsp), %rdi
	call	cudaFree@PLT
	movl	$477, %ecx
	testl	%eax, %eax
	jne	.L137
	movq	176(%rsp), %rdi
	call	cudaFree@PLT
	movl	$478, %ecx
	testl	%eax, %eax
	jne	.L137
	movq	152(%rsp), %rdi
	call	cudaFree@PLT
	movl	$479, %ecx
	testl	%eax, %eax
	jne	.L137
	leaq	.LC28(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
.L51:
	movq	248(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L126
	call	__stack_chk_fail@PLT
.L126:
	addq	$264, %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
.LFE2030:
	.size	main, .-main
	.section	.rodata.str1.1
.LC29:
	.string	"_Z15updateCentroidsPiS_S_S_S_S_S_S_"
.LC30:
	.string	"_Z10sumClusterPiS_S_S_S_S_S_S_"
.LC31:
	.string	"_Z15getClusterLabelPiS_S_S_"
.LC32:
	.string	"_Z15clearLabelArrayPi"
.LC33:
	.string	"_Z11clearArraysPiS_S_S_S_S_S_"
.LC34:
	.string	"dev_nCentroids"
.LC35:
	.string	"dev_size"
.LC36:
	.string	"dev_RedCentroid"
.LC37:
	.string	"dev_GreenCentroid"
.LC38:
	.string	"dev_BlueCentroid"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2066:
	.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	.LC29(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z15updateCentroidsPiS_S_S_S_S_S_S_(%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	.LC30(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z10sumClusterPiS_S_S_S_S_S_S_(%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	.LC31(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z15getClusterLabelPiS_S_S_(%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	.LC32(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z15clearLabelArrayPi(%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	.LC33(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z11clearArraysPiS_S_S_S_S_S_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC34(%rip), %rdx
	movl	$4, %r9d
	leaq	_ZL14dev_nCentroids(%rip), %rsi
	pushq	$1
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC35(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL8dev_size(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC36(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$80, %r9d
	leaq	_ZL15dev_RedCentroid(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rdi
	.cfi_def_cfa_offset 24
	popq	%r8
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC37(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$80, %r9d
	leaq	_ZL17dev_GreenCentroid(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%r9
	.cfi_def_cfa_offset 24
	popq	%r10
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC38(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movl	$80, %r9d
	movq	%rdx, %rcx
	leaq	_ZL16dev_BlueCentroid(%rip), %rsi
	call	__cudaRegisterVar@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%r11
	.cfi_def_cfa_offset 24
	popq	%rbx
	.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
.LFE2066:
	.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
	.local	_ZL16dev_BlueCentroid
	.comm	_ZL16dev_BlueCentroid,80,32
	.local	_ZL17dev_GreenCentroid
	.comm	_ZL17dev_GreenCentroid,80,32
	.local	_ZL15dev_RedCentroid
	.comm	_ZL15dev_RedCentroid,80,32
	.globl	IMAGE_BYTES
	.bss
	.align 4
	.type	IMAGE_BYTES, @object
	.size	IMAGE_BYTES, 4
IMAGE_BYTES:
	.zero	4
	.globl	CLUSTER_BYTES
	.align 4
	.type	CLUSTER_BYTES, @object
	.size	CLUSTER_BYTES, 4
CLUSTER_BYTES:
	.zero	4
	.local	_ZL8dev_size
	.comm	_ZL8dev_size,4,4
	.local	_ZL14dev_nCentroids
	.comm	_ZL14dev_nCentroids,4,4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC14:
	.long	0
	.long	1083129856
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:



#include <hip/hip_runtime.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>


// Number of threads
#define BLOCK_SIZE 16
#define GRID_SIZE 256


#define CUDA_CALL(x) {if((x) != hipSuccess){ \
  printf("CUDA error at %s:%d\n",__FILE__,__LINE__); \
  printf("  %s\n", hipGetErrorString(hipGetLastError())); \
  exit(EXIT_FAILURE);}}

// nCentroids and size on device
__constant__ int dev_nCentroids;
__constant__ int dev_size;

// global variables
int CLUSTER_BYTES = 0; // nCentroids * sizeof(int)
int IMAGE_BYTES = 0;  // width * height * sizeof(int)

//R,G,B Centroid's triple on device
__constant__ int dev_RedCentroid[20];
__constant__ int dev_GreenCentroid[20];
__constant__ int dev_BlueCentroid[20];

void initialise_centroids(int nCentroids, int* redCentroid, int* greenCentroid, int*  blueCentroid, int r[], int g[], int b[], int size) {

	int i;

	for(i=0;i<nCentroids;++i)
	{
		int index = rand()%size;
		redCentroid[i] = r[index];
		blueCentroid[i] = b[index];
		greenCentroid[i] = g[index];
		
	
	}
}


bool loadRawImage(char* filename, int* r, int* g, int* b, int size) {
	FILE *imageFile;
	imageFile = fopen(filename, "r");

	if (imageFile == NULL) {
		return false;
	} else {
		for (int i = 0; i < size; i++) {

			r[i] = fgetc(imageFile);
			g[i] = fgetc(imageFile);
			b[i] = fgetc(imageFile);
		}
		fclose(imageFile);

		/*for(int j = 0; j < h * w; j++) {
			printf("%d, %d, %d ", r[j], g[j], b[j]);
		}*/
		return true;
	}
}



bool writeRawImage(char* filename, int* labelArray, int* redCentroid, int* greenCentroid, int* blueCentroid, int size){
	FILE *imageFile;
	imageFile = fopen(filename, "wb");

	if(imageFile == NULL) {
		return false;
	} else {
		for (int i = 0; i < size; i++) {
			fputc((char) redCentroid[labelArray[i]], imageFile);
			fputc((char) greenCentroid[labelArray[i]], imageFile);
			fputc((char) blueCentroid[labelArray[i]], imageFile);
		}
		fclose(imageFile);
		return true;
	}
}



//Clears arrays before each kernel getClusterLabel iteration
 
__global__ void clearArrays(int *dev_sumRed,int *dev_sumGreen,int *dev_sumBlue, int* dev_pixelClusterCounter, int* dev_tempRedCentroid, int* dev_tempGreenCentroid, int* dev_tempBlueCentroid ) {

	// 1 block, 16x16 threads
	int threadID = threadIdx.x + threadIdx.y * blockDim.x;

	if(threadID < dev_nCentroids) { 


		// nCentroids long
		dev_sumRed[threadID] = 0;
		dev_sumGreen[threadID] = 0;
		dev_sumBlue[threadID] = 0;
		dev_pixelClusterCounter[threadID] = 0;
		dev_tempRedCentroid[threadID] = 0;
		dev_tempGreenCentroid[threadID] = 0;
		dev_tempBlueCentroid[threadID] = 0;
	}
}// end clearArrays

/*
 *  Clear label array before each kernel getClusterLabel iteration
 */
__global__ void clearLabelArray(int *dev_labelArray){

	// Global thread index
	int threadID = (threadIdx.x + blockIdx.x * blockDim.x) + (threadIdx.y + blockIdx.y * blockDim.y) * blockDim.x * gridDim.x;
	//int threadID = (blockIdx.y*gridDim.x + blockIdx.x)*(blockDim.x*blockDim.y) + threadIdx.y*blockDim.x + threadIdx.x;
	// labelArray is "size" long
	if(threadID < dev_size) {
		dev_labelArray[threadID] = 0;
	}
}// end clearLabelArray



__global__ void getClusterLabel(int *dev_Red,int *dev_Green,int *dev_Blue,int *dev_labelArray) {


	// Global thread index
	int threadID = (threadIdx.x + blockIdx.x * blockDim.x) + (threadIdx.y + blockIdx.y * blockDim.y) * blockDim.x * gridDim.x;
	//int threadID = (blockIdx.y*gridDim.x + blockIdx.x)*(blockDim.x*blockDim.y) + threadIdx.y*blockDim.x + threadIdx.x;
	//default min value of distance
	float min = 500.0, value;
	//will be label
	int index = 0;


	if(threadID < dev_size) {
		// Finding the nearest centroid to current triple identified by threadID thread
		for(int i = 0; i < dev_nCentroids; i++) {
			// Performing Euclidean distance, Saving current value
			value = sqrtf(powf((dev_Red[threadID]-dev_RedCentroid[i]),2.0) + powf((dev_Green[threadID]-dev_GreenCentroid[i]),2.0) + powf((dev_Blue[threadID]-dev_BlueCentroid[i]),2.0));

			if(value < min){
				// saving new nearest centroid
				min = value;
				// Updating his index
				index = i;
			}
		}// end for
		// Writing to global memory the index of the nearest centroid
		// for dev_Red[threadID], dev_Green[threadID], dev_Blue[threadID] pixel triple
		dev_labelArray[threadID] = index;

	}// end if
}// end getClusterLabel





/*
 *  Summing Red, Green, Blue values per cluster
 *  Counting how many pixels there are in each cluster
 *
 */

__global__ void sumCluster(int *dev_Red,int *dev_Green,int *dev_Blue,int *dev_sumRed,int *dev_sumGreen,int *dev_sumBlue,int *dev_labelArray,int *dev_pixelClusterCounter) {

	// Global thread index
	int threadID = (threadIdx.x + blockIdx.x * blockDim.x) + (threadIdx.y + blockIdx.y * blockDim.y) * blockDim.x * gridDim.x;
	//int threadID = (blockIdx.y*gridDim.x + blockIdx.x)*(blockDim.x*blockDim.y) + threadIdx.y*blockDim.x + threadIdx.x;

	if(threadID < dev_size) {
		int currentLabelArray = dev_labelArray[threadID];
		int currentRed = dev_Red[threadID];
		int currentGreen = dev_Green[threadID];
		int currentBlue = dev_Blue[threadID];
		// Writing to global memory needs a serialization. Many threads are writing into the same few locations
		atomicAdd(&dev_sumRed[currentLabelArray], currentRed);
		atomicAdd(&dev_sumGreen[currentLabelArray], currentGreen);
		atomicAdd(&dev_sumBlue[currentLabelArray], currentBlue);
		atomicAdd(&dev_pixelClusterCounter[currentLabelArray], 1);
	}
}// end sumCluster


/*
 *  Calculates the new R,G,B values of the centroids dividing the sum of color (for each channel) by the number of pixels in that cluster
 *	New values are stored in global memory since the current R,G,B values of the centroids are in read-only constant memory.
 */
__global__ void updateCentroids(int *dev_tempRedCentroid, int *dev_tempGreenCentroid, int *dev_tempBlueCentroid,int* dev_sumRed, int *dev_sumGreen,int *dev_sumBlue, int* dev_pixelClusterCounter,int *dev_flag) {

	// 1 block , 16*16 threads
	int threadID = threadIdx.x + threadIdx.y * blockDim.x;

	if(threadID < dev_nCentroids) {
		int currentPixelCounter = dev_pixelClusterCounter[threadID];
		int sumRed = dev_sumRed[threadID];
		int sumGreen = dev_sumGreen[threadID];
		int sumBlue = dev_sumBlue[threadID];
		
		//new RGB Centroids' values written in global memory
		dev_tempRedCentroid[threadID] = (int)(sumRed/currentPixelCounter);
		
		dev_tempGreenCentroid[threadID] = (int)(sumGreen/currentPixelCounter);
		dev_tempBlueCentroid[threadID] = (int)(sumBlue/currentPixelCounter);
		
		if(dev_tempGreenCentroid[threadID]!=dev_GreenCentroid[threadID] || dev_tempRedCentroid[threadID]!=dev_RedCentroid[threadID] || dev_tempBlueCentroid[threadID]!=dev_BlueCentroid[threadID])
		*dev_flag=1;
	}

}// end updateCentroids

/*******************************************************************/

int main(int argc, char *argv[]) {

		hipSetDevice(0);
		hipDeviceSynchronize();
		hipDeviceSynchronize();

		
		char *inputFile, *outputFile;
		int *r, *g, *b, *redCentroid, *greenCentroid, *blueCentroid;
		int *dev_Red, *dev_Green, *dev_Blue, *dev_tempRedCentroid, *dev_tempGreenCentroid, *dev_tempBlueCentroid;
		int *labelArray, *dev_labelArray;

		
		int width, height, nCentroids, nIterations,size;
		//int IMAGE_BYTES, CLUSTER_BYTES;
		int *pixelClusterCounter, *dev_pixelClusterCounter;
		int *sumRed, *sumGreen, *sumBlue;
		int flag = 0;
		int *dev_sumRed, *dev_sumGreen, *dev_sumBlue;
		int *dev_flag;

		inputFile = argv[1];
		outputFile = argv[2];
		width = atoi(argv[3]);
		
		height = atoi(argv[4]);
		nCentroids = atoi(argv[5]);  
		nIterations = atoi(argv[6]);
		

		// Setting image size in bytes
		IMAGE_BYTES = width * height * sizeof(int);
		CLUSTER_BYTES = nCentroids * sizeof(int);
		size = width * height;


		printf("Image: %s\n",inputFile);
		printf("Width: %d, Height: %d\n", width, height);
		printf("#Clusters: %d, #Iterations: %d\n", nCentroids, nIterations);


		
		r = (int*)(malloc(IMAGE_BYTES));
		g = (int*)(malloc(IMAGE_BYTES));
		b = (int*)(malloc(IMAGE_BYTES));
		redCentroid = (int*)(malloc(CLUSTER_BYTES));
		greenCentroid = (int*)(malloc(CLUSTER_BYTES));
		blueCentroid = (int*)(malloc(CLUSTER_BYTES));
		labelArray = (int*)(malloc(IMAGE_BYTES)); //stores the cluster number for each pixel
		sumRed = (int*)(malloc(CLUSTER_BYTES));
		sumGreen = (int*)(malloc(CLUSTER_BYTES));
		sumBlue = (int*)(malloc(CLUSTER_BYTES));
		pixelClusterCounter = (int*)(malloc(CLUSTER_BYTES));

		// Loading image in r, g, b arrays
		printf("Image loading...\n");
		if (loadRawImage(inputFile, r, g, b, size)) {
			printf("Image loaded!\n");
		} else {
			printf("NOT loaded!\n");
			return -1;
		}
		hipEvent_t start;
  		hipEvent_t stop;
		hipEventCreate(&start);
    		hipEventCreate(&stop);


		// Setting initial centroids
		printf("Initial Centroids: \n");
		
		initialise_centroids(nCentroids, redCentroid, greenCentroid, blueCentroid,r,g,b,size);

		printf("\n");	


		if(IMAGE_BYTES == 0 || CLUSTER_BYTES == 0) {
			return -1;
		}

		// allocate memory on GPU
		CUDA_CALL(hipMalloc((void**) &dev_Red, IMAGE_BYTES));
		CUDA_CALL(hipMalloc((void**) &dev_Green, IMAGE_BYTES));
		CUDA_CALL(hipMalloc((void**) &dev_Blue, IMAGE_BYTES));
		CUDA_CALL(hipMalloc((void**) &dev_tempRedCentroid, CLUSTER_BYTES));
		CUDA_CALL(hipMalloc((void**) &dev_tempGreenCentroid, CLUSTER_BYTES));
		CUDA_CALL(hipMalloc((void**) &dev_tempBlueCentroid, CLUSTER_BYTES));
		CUDA_CALL(hipMalloc((void**) &dev_labelArray, IMAGE_BYTES));
		CUDA_CALL(hipMalloc((void**) &dev_sumRed, CLUSTER_BYTES));
		CUDA_CALL(hipMalloc((void**) &dev_sumGreen, CLUSTER_BYTES));
		CUDA_CALL(hipMalloc((void**) &dev_sumBlue, CLUSTER_BYTES));
		CUDA_CALL(hipMalloc((void**) &dev_pixelClusterCounter, CLUSTER_BYTES));
		CUDA_CALL(hipMalloc((void**) &dev_flag, sizeof(int)));

		// copy host CPU memory to GPU
		CUDA_CALL(hipMemcpy(dev_Red, r, IMAGE_BYTES, hipMemcpyHostToDevice));
		CUDA_CALL(hipMemcpy(dev_Green, g, IMAGE_BYTES, hipMemcpyHostToDevice));
		CUDA_CALL(hipMemcpy(dev_Blue, b, IMAGE_BYTES, hipMemcpyHostToDevice));
		CUDA_CALL(hipMemcpy(dev_tempRedCentroid, redCentroid,CLUSTER_BYTES,hipMemcpyHostToDevice ));
		CUDA_CALL(hipMemcpy(dev_tempGreenCentroid, greenCentroid,CLUSTER_BYTES,hipMemcpyHostToDevice ));
		CUDA_CALL(hipMemcpy(dev_tempBlueCentroid, blueCentroid,CLUSTER_BYTES,hipMemcpyHostToDevice ));
		CUDA_CALL(hipMemcpy(dev_labelArray, labelArray, IMAGE_BYTES, hipMemcpyHostToDevice));
		CUDA_CALL(hipMemcpy(dev_flag,&flag,sizeof(int),hipMemcpyHostToDevice));
        //CUDA_CALL(cudaMemcpy(dev_sumRed, sumRed, CLUSTER_BYTES, cudaMemcpyHostToDevice));
		//CUDA_CALL(cudaMemcpy(dev_sumGreen, sumGreen, CLUSTER_BYTES, cudaMemcpyHostToDevice));
		//CUDA_CALL(cudaMemcpy(dev_sumBlue, sumBlue, CLUSTER_BYTES, cudaMemcpyHostToDevice));
		CUDA_CALL(hipMemcpy(dev_pixelClusterCounter, pixelClusterCounter, CLUSTER_BYTES, hipMemcpyHostToDevice));
		CUDA_CALL(hipMemcpyToSymbol(HIP_SYMBOL(dev_RedCentroid), redCentroid, CLUSTER_BYTES));
		CUDA_CALL(hipMemcpyToSymbol(HIP_SYMBOL(dev_GreenCentroid), greenCentroid, CLUSTER_BYTES));
		CUDA_CALL(hipMemcpyToSymbol(HIP_SYMBOL(dev_BlueCentroid), blueCentroid, CLUSTER_BYTES));
		CUDA_CALL(hipMemcpyToSymbol(HIP_SYMBOL(dev_nCentroids),&nCentroids, sizeof(int)));
		CUDA_CALL(hipMemcpyToSymbol(HIP_SYMBOL(dev_size), &size, sizeof(int)));


		// Clearing centroids on host
		for(int i = 0; i < nCentroids; i++) {
			redCentroid[i] = 0;
			greenCentroid[i] = 0;
			blueCentroid[i] = 0;
		}

		// Defining grid size

		int BLOCK_X, BLOCK_Y;
		BLOCK_X = ceil(width/BLOCK_SIZE);
		BLOCK_Y = ceil(height/BLOCK_SIZE);
		if(BLOCK_X > GRID_SIZE)
			BLOCK_X = GRID_SIZE;
		if(BLOCK_Y > GRID_SIZE)
			BLOCK_Y = GRID_SIZE;

	 	dim3 dimGRID(BLOCK_X,BLOCK_Y);
		dim3 dimBLOCK(BLOCK_SIZE,BLOCK_SIZE);

		//Starting timer
		hipEventRecord(start, 0);
		printf("Launching K-Means Kernels..	\n");
		//Iteration of kmeans algorithm
		int num_iterations;
		for(int i = 0; i < nIterations; i++) {

			num_iterations = i;
			flag=0;
			CUDA_CALL(hipMemcpy(dev_flag,&flag,sizeof(int),hipMemcpyHostToDevice));
			
			
			clearArrays<<<1, dimBLOCK>>>(dev_sumRed, dev_sumGreen, dev_sumBlue, dev_pixelClusterCounter, dev_tempRedCentroid, dev_tempGreenCentroid, dev_tempBlueCentroid);

			
			clearLabelArray<<<dimGRID, dimBLOCK>>>(dev_labelArray);

	
			getClusterLabel<<< dimGRID, dimBLOCK >>> (dev_Red, dev_Green, dev_Blue,dev_labelArray);

			
			sumCluster<<<dimGRID, dimBLOCK>>> (dev_Red, dev_Green, dev_Blue, dev_sumRed, dev_sumGreen, dev_sumBlue, dev_labelArray,dev_pixelClusterCounter);

			
			updateCentroids<<<1,dimBLOCK >>>(dev_tempRedCentroid, dev_tempGreenCentroid, dev_tempBlueCentroid, dev_sumRed, dev_sumGreen, dev_sumBlue, dev_pixelClusterCounter,dev_flag);

		
			CUDA_CALL(hipMemcpy(redCentroid, dev_tempRedCentroid, CLUSTER_BYTES,hipMemcpyDeviceToHost));
			CUDA_CALL(hipMemcpy(greenCentroid, dev_tempGreenCentroid, CLUSTER_BYTES,hipMemcpyDeviceToHost));
			CUDA_CALL(hipMemcpy(blueCentroid, dev_tempBlueCentroid, CLUSTER_BYTES,hipMemcpyDeviceToHost));
			CUDA_CALL(hipMemcpy(&flag, dev_flag,sizeof(int),hipMemcpyDeviceToHost));
			

			CUDA_CALL(hipMemcpyToSymbol(HIP_SYMBOL(dev_RedCentroid), redCentroid, CLUSTER_BYTES));
			CUDA_CALL(hipMemcpyToSymbol(HIP_SYMBOL(dev_GreenCentroid), greenCentroid, CLUSTER_BYTES));
			CUDA_CALL(hipMemcpyToSymbol(HIP_SYMBOL(dev_BlueCentroid), blueCentroid, CLUSTER_BYTES));

			if(flag==0)
				break;
			

		}
		hipEventRecord(stop, 0);
		float elapsed;
		hipEventSynchronize(stop);
   		hipEventElapsedTime(&elapsed, start, stop);
		
		CUDA_CALL(hipMemcpy(labelArray, dev_labelArray, IMAGE_BYTES, hipMemcpyDeviceToHost));
		CUDA_CALL(hipMemcpy(sumRed, dev_sumRed, CLUSTER_BYTES, hipMemcpyDeviceToHost));
		CUDA_CALL(hipMemcpy(sumGreen, dev_sumGreen, CLUSTER_BYTES, hipMemcpyDeviceToHost));
		CUDA_CALL(hipMemcpy(sumBlue, dev_sumBlue, CLUSTER_BYTES, hipMemcpyDeviceToHost));
		CUDA_CALL(hipMemcpy(pixelClusterCounter, dev_pixelClusterCounter, CLUSTER_BYTES, hipMemcpyDeviceToHost));

		
		printf("Kmeans code ran in: %f secs.\n", elapsed/1000.0);
		printf("Converged in %d iterations.\n",num_iterations);
		printf("\n");

	

		// labelArray DEBUG
		  int counter = 0;

		printf("Label Array:\n");
		for(int i = 0; i < (size); i++) {
			//printf("%d\n", labelArray[i]);
			counter++;
		}
		printf("printing counter %d\n", counter);
		counter = 0;

		printf("Sum Arrays:\n");
		for(int j = 0; j < nCentroids; j++) {
			printf("r: %u g: %u b: %u \n", sumRed[j], sumGreen[j], sumBlue[j]);
			counter++;
		}

		printf("\n");

		printf("Pixels per centroids:\n");
		for(int k = 0; k < nCentroids; k++){
			printf("%d centroid: %d pixels\n", k, pixelClusterCounter[k]);
		}

		printf("\n");



		printf("New centroids:\n");
		for(int i = 0; i < nCentroids; i++) {

			printf("%d, %d, %d \n", redCentroid[i], greenCentroid[i], blueCentroid[i]);
		}


		// writing...
		printf("Image writing...\n");

		if (writeRawImage(outputFile,labelArray, redCentroid, greenCentroid,  blueCentroid,  size)) {
			printf("Image written!\n");
		} else {
			printf("NOT written!\n");
			return -1;
		}

		free(r);
		free(g);
		free(b);
		free(redCentroid);
		free(greenCentroid);
		free(blueCentroid);
		free(labelArray);
		free(sumRed);
		free(sumGreen);
		free(sumBlue);
		free(pixelClusterCounter);

		CUDA_CALL(hipFree(dev_Red));
		CUDA_CALL(hipFree(dev_Green));
		CUDA_CALL(hipFree(dev_Blue));
		CUDA_CALL(hipFree(dev_tempRedCentroid));
		CUDA_CALL(hipFree(dev_tempGreenCentroid));
		CUDA_CALL(hipFree(dev_tempBlueCentroid));
		CUDA_CALL(hipFree(dev_labelArray));
		CUDA_CALL(hipFree(dev_sumRed));
		CUDA_CALL(hipFree(dev_sumGreen));
		CUDA_CALL(hipFree(dev_sumBlue));
		CUDA_CALL(hipFree(dev_pixelClusterCounter));

		printf("That's the end.\n");
		return 0;
}

	.text
	.file	"kmeans.hip"
	.globl	_Z20initialise_centroidsiPiS_S_S_S_S_i # -- Begin function _Z20initialise_centroidsiPiS_S_S_S_S_i
	.type	_Z20initialise_centroidsiPiS_S_S_S_S_i,@function
_Z20initialise_centroidsiPiS_S_S_S_S_i: # @_Z20initialise_centroidsiPiS_S_S_S_S_i
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jle	.LBB0_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, %r14
	movq	%r8, %r15
	movq	%rcx, %r12
	movq	%rdx, %r13
	movq	%rsi, %rbp
	movl	%edi, %eax
	movq	%rax, (%rsp)                    # 8-byte Spill
	xorl	%ebx, %ebx
.LBB0_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltd
	idivl	72(%rsp)
	movslq	%edx, %rax
	movl	(%r15,%rax,4), %ecx
	movl	%ecx, (%rbp,%rbx,4)
	movq	64(%rsp), %rcx
	movl	(%rcx,%rax,4), %ecx
	movl	%ecx, (%r12,%rbx,4)
	movl	(%r14,%rax,4), %eax
	movl	%eax, (%r13,%rbx,4)
	incq	%rbx
	cmpq	%rbx, (%rsp)                    # 8-byte Folded Reload
	jne	.LBB0_2
# %bb.3:
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
.LBB0_4:                                # %._crit_edge
	retq
.Lfunc_end0:
	.size	_Z20initialise_centroidsiPiS_S_S_S_S_i, .Lfunc_end0-_Z20initialise_centroidsiPiS_S_S_S_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z12loadRawImagePcPiS0_S0_i     # -- Begin function _Z12loadRawImagePcPiS0_S0_i
	.type	_Z12loadRawImagePcPiS0_S0_i,@function
_Z12loadRawImagePcPiS0_S0_i:            # @_Z12loadRawImagePcPiS0_S0_i
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%r8d, %ebp
	movq	%rcx, %rbx
	movq	%rdx, %r14
	movq	%rsi, %r15
	movl	$.L.str, %esi
	callq	fopen
	movq	%rax, %r12
	testq	%rax, %rax
	je	.LBB1_5
# %bb.1:                                # %.preheader
	testl	%ebp, %ebp
	jle	.LBB1_4
# %bb.2:                                # %.lr.ph.preheader
	movl	%ebp, %r13d
	xorl	%ebp, %ebp
.LBB1_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	callq	fgetc
	movl	%eax, (%r15,%rbp,4)
	movq	%r12, %rdi
	callq	fgetc
	movl	%eax, (%r14,%rbp,4)
	movq	%r12, %rdi
	callq	fgetc
	movl	%eax, (%rbx,%rbp,4)
	incq	%rbp
	cmpq	%rbp, %r13
	jne	.LBB1_3
.LBB1_4:                                # %._crit_edge
	movq	%r12, %rdi
	callq	fclose
.LBB1_5:
	testq	%r12, %r12
	setne	%al
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z12loadRawImagePcPiS0_S0_i, .Lfunc_end1-_Z12loadRawImagePcPiS0_S0_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z13writeRawImagePcPiS0_S0_S0_i # -- Begin function _Z13writeRawImagePcPiS0_S0_S0_i
	.type	_Z13writeRawImagePcPiS0_S0_S0_i,@function
_Z13writeRawImagePcPiS0_S0_S0_i:        # @_Z13writeRawImagePcPiS0_S0_S0_i
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%r9d, %ebp
	movq	%r8, %rbx
	movq	%rcx, %r14
	movq	%rdx, %r15
	movq	%rsi, %r12
	movl	$.L.str.1, %esi
	callq	fopen
	movq	%rax, %r13
	testq	%rax, %rax
	je	.LBB2_5
# %bb.1:                                # %.preheader
	testl	%ebp, %ebp
	movq	%r14, (%rsp)                    # 8-byte Spill
	jle	.LBB2_4
# %bb.2:                                # %.lr.ph.preheader
	movq	%rbx, %r14
	movl	%ebp, %ebp
	xorl	%ebx, %ebx
.LBB2_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movslq	(%r12,%rbx,4), %rax
	movsbl	(%r15,%rax,4), %edi
	movq	%r13, %rsi
	callq	fputc
	movslq	(%r12,%rbx,4), %rax
	movq	(%rsp), %rcx                    # 8-byte Reload
	movsbl	(%rcx,%rax,4), %edi
	movq	%r13, %rsi
	callq	fputc
	movslq	(%r12,%rbx,4), %rax
	movsbl	(%r14,%rax,4), %edi
	movq	%r13, %rsi
	callq	fputc
	incq	%rbx
	cmpq	%rbx, %rbp
	jne	.LBB2_3
.LBB2_4:                                # %._crit_edge
	movq	%r13, %rdi
	callq	fclose
.LBB2_5:
	testq	%r13, %r13
	setne	%al
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z13writeRawImagePcPiS0_S0_S0_i, .Lfunc_end2-_Z13writeRawImagePcPiS0_S0_S0_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z26__device_stub__clearArraysPiS_S_S_S_S_S_ # -- Begin function _Z26__device_stub__clearArraysPiS_S_S_S_S_S_
	.type	_Z26__device_stub__clearArraysPiS_S_S_S_S_S_,@function
_Z26__device_stub__clearArraysPiS_S_S_S_S_S_: # @_Z26__device_stub__clearArraysPiS_S_S_S_S_S_
	.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	$160, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	16(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	208(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z11clearArraysPiS_S_S_S_S_S_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	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	_Z26__device_stub__clearArraysPiS_S_S_S_S_S_, .Lfunc_end3-_Z26__device_stub__clearArraysPiS_S_S_S_S_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__clearLabelArrayPi # -- Begin function _Z30__device_stub__clearLabelArrayPi
	.type	_Z30__device_stub__clearLabelArrayPi,@function
_Z30__device_stub__clearLabelArrayPi:   # @_Z30__device_stub__clearLabelArrayPi
	.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	$64, %rsp
	.cfi_def_cfa_offset 112
	.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)
	movq	%rsp, %rbx
	movq	%rax, (%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	$_Z15clearLabelArrayPi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$80, %rsp
	.cfi_adjust_cfa_offset -80
	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_end4:
	.size	_Z30__device_stub__clearLabelArrayPi, .Lfunc_end4-_Z30__device_stub__clearLabelArrayPi
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__getClusterLabelPiS_S_S_ # -- Begin function _Z30__device_stub__getClusterLabelPiS_S_S_
	.type	_Z30__device_stub__getClusterLabelPiS_S_S_,@function
_Z30__device_stub__getClusterLabelPiS_S_S_: # @_Z30__device_stub__getClusterLabelPiS_S_S_
	.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), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	16(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	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	$_Z15getClusterLabelPiS_S_S_, %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_end5:
	.size	_Z30__device_stub__getClusterLabelPiS_S_S_, .Lfunc_end5-_Z30__device_stub__getClusterLabelPiS_S_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__sumClusterPiS_S_S_S_S_S_S_ # -- Begin function _Z25__device_stub__sumClusterPiS_S_S_S_S_S_S_
	.type	_Z25__device_stub__sumClusterPiS_S_S_S_S_S_S_,@function
_Z25__device_stub__sumClusterPiS_S_S_S_S_S_S_: # @_Z25__device_stub__sumClusterPiS_S_S_S_S_S_S_
	.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	$160, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	16(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	208(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	216(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z10sumClusterPiS_S_S_S_S_S_S_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	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_end6:
	.size	_Z25__device_stub__sumClusterPiS_S_S_S_S_S_S_, .Lfunc_end6-_Z25__device_stub__sumClusterPiS_S_S_S_S_S_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__updateCentroidsPiS_S_S_S_S_S_S_ # -- Begin function _Z30__device_stub__updateCentroidsPiS_S_S_S_S_S_S_
	.type	_Z30__device_stub__updateCentroidsPiS_S_S_S_S_S_S_,@function
_Z30__device_stub__updateCentroidsPiS_S_S_S_S_S_S_: # @_Z30__device_stub__updateCentroidsPiS_S_S_S_S_S_S_
	.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	$160, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	16(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	208(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	216(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z15updateCentroidsPiS_S_S_S_S_S_S_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	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_end7:
	.size	_Z30__device_stub__updateCentroidsPiS_S_S_S_S_S_S_, .Lfunc_end7-_Z30__device_stub__updateCentroidsPiS_S_S_S_S_S_S_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI8_0:
	.quad	0x408f400000000000              # double 1000
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$264, %rsp                      # imm = 0x108
	.cfi_def_cfa_offset 320
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r15
	xorl	%edi, %edi
	callq	hipSetDevice
	callq	hipDeviceSynchronize
	callq	hipDeviceSynchronize
	movl	$0, 8(%rsp)
	movq	8(%r15), %r13
	movq	%r13, 176(%rsp)                 # 8-byte Spill
	movq	16(%r15), %rax
	movq	%rax, 232(%rsp)                 # 8-byte Spill
	movq	24(%r15), %rdi
	callq	atoi
	movl	%eax, %r12d
	movq	32(%r15), %rdi
	callq	atoi
	movl	%eax, %r14d
	movq	40(%r15), %rdi
	callq	atoi
	movl	%eax, %ebx
	movl	%eax, 4(%rsp)
	movq	48(%r15), %rdi
	callq	atoi
	movl	%eax, %ebp
	movl	%r14d, %r15d
	imull	%r12d, %r15d
	leal	(,%r15,4), %eax
	movl	%eax, IMAGE_BYTES(%rip)
	leal	(,%rbx,4), %eax
	movl	%eax, CLUSTER_BYTES(%rip)
	movl	%r15d, 12(%rsp)
	movl	$.L.str.2, %edi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.3, %edi
	movq	%r12, 248(%rsp)                 # 8-byte Spill
	movl	%r12d, %esi
	movq	%r14, 256(%rsp)                 # 8-byte Spill
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.4, %edi
	movl	%ebx, %esi
	movl	%ebp, 84(%rsp)                  # 4-byte Spill
	movl	%ebp, %edx
	xorl	%eax, %eax
	callq	printf
	movslq	IMAGE_BYTES(%rip), %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, %r13
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, %rbp
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, %rbx
	movslq	CLUSTER_BYTES(%rip), %r12
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 216(%rsp)                 # 8-byte Spill
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 208(%rsp)                 # 8-byte Spill
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, %r14
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 240(%rsp)                 # 8-byte Spill
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 136(%rsp)                 # 8-byte Spill
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 144(%rsp)                 # 8-byte Spill
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 152(%rsp)                 # 8-byte Spill
	movl	$.Lstr, %edi
	callq	puts@PLT
	movq	176(%rsp), %rdi                 # 8-byte Reload
	movq	%r13, 168(%rsp)                 # 8-byte Spill
	movq	%r13, %rsi
	movq	%rbp, 184(%rsp)                 # 8-byte Spill
	movq	%rbp, %rdx
	movq	%rbx, 160(%rsp)                 # 8-byte Spill
	movq	%rbx, %rcx
	movl	%r15d, %r8d
	callq	_Z12loadRawImagePcPiS0_S0_i
	testb	%al, %al
	je	.LBB8_136
# %bb.1:
	movq	%r14, 128(%rsp)                 # 8-byte Spill
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	leaq	224(%rsp), %rdi
	callq	hipEventCreate
	leaq	192(%rsp), %rdi
	callq	hipEventCreate
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	movq	168(%rsp), %r14                 # 8-byte Reload
	movq	160(%rsp), %rbp                 # 8-byte Reload
	movq	216(%rsp), %r15                 # 8-byte Reload
	movq	208(%rsp), %rbx                 # 8-byte Reload
	movq	88(%rsp), %r13                  # 8-byte Reload
	jle	.LBB8_4
# %bb.2:                                # %.lr.ph.preheader.i
	movl	12(%rsp), %r10d
	movl	%r10d, 200(%rsp)                # 4-byte Spill
	xorl	%r12d, %r12d
	movq	%rax, 176(%rsp)                 # 8-byte Spill
.LBB8_3:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltd
	idivl	200(%rsp)                       # 4-byte Folded Reload
	movslq	%edx, %rax
	movl	(%r14,%rax,4), %ecx
	movl	%ecx, (%r15,%r12,4)
	movl	(%rbp,%rax,4), %ecx
	movl	%ecx, (%r13,%r12,4)
	movq	184(%rsp), %rcx                 # 8-byte Reload
	movl	(%rcx,%rax,4), %eax
	movl	%eax, (%rbx,%r12,4)
	movq	176(%rsp), %rax                 # 8-byte Reload
	incq	%r12
	cmpq	%r12, %rax
	jne	.LBB8_3
.LBB8_4:                                # %_Z20initialise_centroidsiPiS_S_S_S_S_i.exit
	movl	$10, %edi
	callq	putchar@PLT
	movslq	IMAGE_BYTES(%rip), %rsi
	movl	$-1, %r14d
	testq	%rsi, %rsi
	je	.LBB8_135
# %bb.5:                                # %_Z20initialise_centroidsiPiS_S_S_S_S_i.exit
	cmpl	$0, CLUSTER_BYTES(%rip)
	je	.LBB8_135
# %bb.6:
	leaq	120(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB8_7
# %bb.9:
	movslq	IMAGE_BYTES(%rip), %rsi
	leaq	112(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	movq	168(%rsp), %r14                 # 8-byte Reload
	movq	184(%rsp), %r15                 # 8-byte Reload
	movq	216(%rsp), %rbx                 # 8-byte Reload
	movq	208(%rsp), %rbp                 # 8-byte Reload
	movq	88(%rsp), %r12                  # 8-byte Reload
	jne	.LBB8_10
# %bb.11:
	movslq	IMAGE_BYTES(%rip), %rsi
	leaq	104(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB8_12
# %bb.13:
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	72(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB8_14
# %bb.15:
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	64(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB8_16
# %bb.17:
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	56(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB8_18
# %bb.19:
	movslq	IMAGE_BYTES(%rip), %rsi
	leaq	24(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB8_20
# %bb.21:
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	48(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB8_22
# %bb.23:
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	40(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB8_24
# %bb.25:
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	32(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB8_26
# %bb.27:
	movslq	CLUSTER_BYTES(%rip), %rsi
	leaq	16(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB8_28
# %bb.29:
	leaq	96(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB8_30
# %bb.31:
	movq	120(%rsp), %rdi
	movslq	IMAGE_BYTES(%rip), %rdx
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_32
# %bb.33:
	movq	112(%rsp), %rdi
	movslq	IMAGE_BYTES(%rip), %rdx
	movq	%r15, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	movq	128(%rsp), %r14                 # 8-byte Reload
	jne	.LBB8_34
# %bb.35:
	movq	104(%rsp), %rdi
	movslq	IMAGE_BYTES(%rip), %rdx
	movq	160(%rsp), %rsi                 # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	movq	152(%rsp), %r15                 # 8-byte Reload
	jne	.LBB8_36
# %bb.37:
	movq	72(%rsp), %rdi
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_38
# %bb.39:
	movq	64(%rsp), %rdi
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	%rbp, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_40
# %bb.41:
	movq	56(%rsp), %rdi
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	%r12, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_42
# %bb.43:
	movq	24(%rsp), %rdi
	movslq	IMAGE_BYTES(%rip), %rdx
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_44
# %bb.45:
	movq	96(%rsp), %rdi
	leaq	8(%rsp), %rsi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_46
# %bb.47:
	movq	16(%rsp), %rdi
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	%r15, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_48
# %bb.49:
	movslq	CLUSTER_BYTES(%rip), %rdx
	movl	$dev_RedCentroid, %edi
	movq	%rbx, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	testl	%eax, %eax
	jne	.LBB8_50
# %bb.51:
	movslq	CLUSTER_BYTES(%rip), %rdx
	movl	$dev_GreenCentroid, %edi
	movq	%rbp, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	testl	%eax, %eax
	jne	.LBB8_52
# %bb.53:
	movslq	CLUSTER_BYTES(%rip), %rdx
	movl	$dev_BlueCentroid, %edi
	movq	%r12, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	testl	%eax, %eax
	jne	.LBB8_54
# %bb.55:
	leaq	4(%rsp), %rsi
	movl	$dev_nCentroids, %edi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	testl	%eax, %eax
	jne	.LBB8_56
# %bb.57:
	leaq	12(%rsp), %rsi
	movl	$dev_size, %edi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	testl	%eax, %eax
	jne	.LBB8_137
# %bb.58:                               # %.preheader
	movl	4(%rsp), %r14d
	testl	%r14d, %r14d
	jle	.LBB8_60
# %bb.59:                               # %.lr.ph.preheader
	shlq	$2, %r14
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	movq	%rbp, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	movq	%r12, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
.LBB8_60:                               # %._crit_edge
	movq	248(%rsp), %rax                 # 8-byte Reload
	leal	15(%rax), %r15d
	testl	%eax, %eax
	cmovnsl	%eax, %r15d
	sarl	$4, %r15d
	movq	256(%rsp), %rax                 # 8-byte Reload
	leal	15(%rax), %r14d
	testl	%eax, %eax
	cmovnsl	%eax, %r14d
	sarl	$4, %r14d
	movl	$256, %eax                      # imm = 0x100
	cmpl	%eax, %r15d
	cmovgel	%eax, %r15d
	cmpl	%eax, %r14d
	cmovgel	%eax, %r14d
	movq	224(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	$.Lstr.4, %edi
	callq	puts@PLT
	cmpl	$0, 84(%rsp)                    # 4-byte Folded Reload
	jle	.LBB8_61
# %bb.62:                               # %.lr.ph243.preheader
	shlq	$32, %r14
	orq	%r15, %r14
	movabsq	$68719476752, %r15              # imm = 0x1000000010
	movl	$-1, %r13d
.LBB8_63:                               # %.lr.ph243
                                        # =>This Inner Loop Header: Depth=1
	movl	$0, 8(%rsp)
	movq	96(%rsp), %rdi
	movl	$4, %edx
	leaq	8(%rsp), %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_64
# %bb.65:                               #   in Loop: Header=BB8_63 Depth=1
	movabsq	$4294967297, %rdi               # imm = 0x100000001
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	movq	88(%rsp), %r12                  # 8-byte Reload
	jne	.LBB8_67
# %bb.66:                               #   in Loop: Header=BB8_63 Depth=1
	movq	48(%rsp), %rdi
	movq	40(%rsp), %rsi
	movq	32(%rsp), %rdx
	movq	16(%rsp), %rcx
	movq	72(%rsp), %r8
	movq	64(%rsp), %r9
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	pushq	64(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	_Z26__device_stub__clearArraysPiS_S_S_S_S_S_
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB8_67:                               #   in Loop: Header=BB8_63 Depth=1
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB8_69
# %bb.68:                               #   in Loop: Header=BB8_63 Depth=1
	movq	24(%rsp), %rdi
	callq	_Z30__device_stub__clearLabelArrayPi
.LBB8_69:                               #   in Loop: Header=BB8_63 Depth=1
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB8_71
# %bb.70:                               #   in Loop: Header=BB8_63 Depth=1
	movq	120(%rsp), %rdi
	movq	112(%rsp), %rsi
	movq	104(%rsp), %rdx
	movq	24(%rsp), %rcx
	callq	_Z30__device_stub__getClusterLabelPiS_S_S_
.LBB8_71:                               #   in Loop: Header=BB8_63 Depth=1
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB8_73
# %bb.72:                               #   in Loop: Header=BB8_63 Depth=1
	movq	120(%rsp), %rdi
	movq	112(%rsp), %rsi
	movq	104(%rsp), %rdx
	movq	48(%rsp), %rcx
	movq	40(%rsp), %r8
	movq	32(%rsp), %r9
	pushq	16(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	32(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	_Z25__device_stub__sumClusterPiS_S_S_S_S_S_S_
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB8_73:                               #   in Loop: Header=BB8_63 Depth=1
	movabsq	$4294967297, %rdi               # imm = 0x100000001
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB8_75
# %bb.74:                               #   in Loop: Header=BB8_63 Depth=1
	movq	72(%rsp), %rdi
	movq	64(%rsp), %rsi
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rcx
	movq	40(%rsp), %r8
	movq	32(%rsp), %r9
	pushq	96(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	24(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	_Z30__device_stub__updateCentroidsPiS_S_S_S_S_S_S_
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB8_75:                               #   in Loop: Header=BB8_63 Depth=1
	movq	72(%rsp), %rsi
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_76
# %bb.77:                               #   in Loop: Header=BB8_63 Depth=1
	movq	64(%rsp), %rsi
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	%rbp, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_78
# %bb.79:                               #   in Loop: Header=BB8_63 Depth=1
	movq	56(%rsp), %rsi
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_80
# %bb.81:                               #   in Loop: Header=BB8_63 Depth=1
	movq	96(%rsp), %rsi
	movl	$4, %edx
	leaq	8(%rsp), %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_82
# %bb.83:                               #   in Loop: Header=BB8_63 Depth=1
	movslq	CLUSTER_BYTES(%rip), %rdx
	movl	$dev_RedCentroid, %edi
	movq	%rbx, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	testl	%eax, %eax
	jne	.LBB8_84
# %bb.85:                               #   in Loop: Header=BB8_63 Depth=1
	movslq	CLUSTER_BYTES(%rip), %rdx
	movl	$dev_GreenCentroid, %edi
	movq	%rbp, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	testl	%eax, %eax
	jne	.LBB8_86
# %bb.87:                               #   in Loop: Header=BB8_63 Depth=1
	movslq	CLUSTER_BYTES(%rip), %rdx
	movl	$dev_BlueCentroid, %edi
	movq	%r12, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	testl	%eax, %eax
	jne	.LBB8_88
# %bb.89:                               #   in Loop: Header=BB8_63 Depth=1
	leal	1(%r13), %r12d
	cmpl	$0, 8(%rsp)
	je	.LBB8_91
# %bb.90:                               #   in Loop: Header=BB8_63 Depth=1
	addl	$2, %r13d
	cmpl	84(%rsp), %r13d                 # 4-byte Folded Reload
	movl	%r12d, %r13d
	jl	.LBB8_63
	jmp	.LBB8_91
.LBB8_136:
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	$-1, %r14d
	jmp	.LBB8_135
.LBB8_61:
                                        # implicit-def: $r12d
.LBB8_91:                               # %._crit_edge244
	movq	192(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	192(%rsp), %rdi
	callq	hipEventSynchronize
	movq	224(%rsp), %rsi
	movq	192(%rsp), %rdx
	leaq	204(%rsp), %rdi
	callq	hipEventElapsedTime
	movq	24(%rsp), %rsi
	movslq	IMAGE_BYTES(%rip), %rdx
	movq	128(%rsp), %rdi                 # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_92
# %bb.93:
	movq	48(%rsp), %rsi
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	240(%rsp), %r13                 # 8-byte Reload
	movq	%r13, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	movq	144(%rsp), %r14                 # 8-byte Reload
	movq	152(%rsp), %r15                 # 8-byte Reload
	jne	.LBB8_94
# %bb.95:
	movq	40(%rsp), %rsi
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	136(%rsp), %rdi                 # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_96
# %bb.97:
	movq	32(%rsp), %rsi
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	%r14, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_98
# %bb.99:
	movq	16(%rsp), %rsi
	movslq	CLUSTER_BYTES(%rip), %rdx
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_100
# %bb.101:                              # %._crit_edge251
	cvtss2sd	204(%rsp), %xmm0
	divsd	.LCPI8_0(%rip), %xmm0
	movl	$.L.str.14, %edi
	movb	$1, %al
	callq	printf
	movl	$.L.str.15, %edi
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$10, %edi
	callq	putchar@PLT
	movl	$.Lstr.5, %edi
	callq	puts@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	movl	$0, %esi
	cmovgl	%eax, %esi
	movl	$.L.str.17, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.6, %edi
	callq	puts@PLT
	cmpl	$0, 4(%rsp)
	movq	136(%rsp), %r12                 # 8-byte Reload
	movq	144(%rsp), %r15                 # 8-byte Reload
	jle	.LBB8_104
# %bb.102:                              # %.lr.ph255.preheader
	xorl	%r14d, %r14d
.LBB8_103:                              # %.lr.ph255
                                        # =>This Inner Loop Header: Depth=1
	movl	(%r13,%r14,4), %esi
	movl	(%r12,%r14,4), %edx
	movl	(%r15,%r14,4), %ecx
	movl	$.L.str.19, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r14
	movslq	4(%rsp), %rax
	cmpq	%rax, %r14
	jl	.LBB8_103
.LBB8_104:                              # %._crit_edge256
	movl	$10, %edi
	callq	putchar@PLT
	movl	$.Lstr.7, %edi
	callq	puts@PLT
	cmpl	$0, 4(%rsp)
	movq	88(%rsp), %r12                  # 8-byte Reload
	movq	152(%rsp), %r15                 # 8-byte Reload
	jle	.LBB8_107
# %bb.105:                              # %.lr.ph259.preheader
	xorl	%r14d, %r14d
.LBB8_106:                              # %.lr.ph259
                                        # =>This Inner Loop Header: Depth=1
	movl	(%r15,%r14,4), %edx
	movl	$.L.str.21, %edi
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	printf
	incq	%r14
	movslq	4(%rsp), %rax
	cmpq	%rax, %r14
	jl	.LBB8_106
.LBB8_107:                              # %._crit_edge260
	movl	$10, %edi
	callq	putchar@PLT
	movl	$.Lstr.8, %edi
	callq	puts@PLT
	cmpl	$0, 4(%rsp)
	jle	.LBB8_110
# %bb.108:                              # %.lr.ph263.preheader
	xorl	%r14d, %r14d
.LBB8_109:                              # %.lr.ph263
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rbx,%r14,4), %esi
	movl	(%rbp,%r14,4), %edx
	movl	(%r12,%r14,4), %ecx
	movl	$.L.str.23, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r14
	movslq	4(%rsp), %rax
	cmpq	%rax, %r14
	jl	.LBB8_109
.LBB8_110:                              # %._crit_edge264
	movl	$.Lstr.9, %edi
	callq	puts@PLT
	movl	12(%rsp), %r9d
	movq	232(%rsp), %rdi                 # 8-byte Reload
	movq	128(%rsp), %r14                 # 8-byte Reload
	movq	%r14, %rsi
	movq	%rbx, %rdx
	movq	%rbp, %rcx
	movq	%r12, %r8
	callq	_Z13writeRawImagePcPiS0_S0_S0_i
	testb	%al, %al
	je	.LBB8_111
# %bb.112:
	movl	$.Lstr.11, %edi
	callq	puts@PLT
	movq	168(%rsp), %rdi                 # 8-byte Reload
	callq	free
	movq	184(%rsp), %rdi                 # 8-byte Reload
	callq	free
	movq	160(%rsp), %rdi                 # 8-byte Reload
	callq	free
	movq	%rbx, %rdi
	callq	free
	movq	%rbp, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%r13, %rdi
	callq	free
	movq	136(%rsp), %rdi                 # 8-byte Reload
	callq	free
	movq	144(%rsp), %rdi                 # 8-byte Reload
	callq	free
	movq	%r15, %rdi
	callq	free
	movq	120(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB8_113
# %bb.114:
	movq	112(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB8_115
# %bb.116:
	movq	104(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB8_117
# %bb.118:
	movq	72(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB8_119
# %bb.120:
	movq	64(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB8_121
# %bb.122:
	movq	56(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB8_123
# %bb.124:
	movq	24(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB8_125
# %bb.126:
	movq	48(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB8_127
# %bb.128:
	movq	40(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB8_129
# %bb.130:
	movq	32(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB8_131
# %bb.132:
	movq	16(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB8_138
# %bb.133:
	xorl	%r14d, %r14d
	movl	$.Lstr.12, %edi
	jmp	.LBB8_134
.LBB8_111:
	movl	$-1, %r14d
	movl	$.Lstr.10, %edi
.LBB8_134:
	callq	puts@PLT
.LBB8_135:
	movl	%r14d, %eax
	addq	$264, %rsp                      # imm = 0x108
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB8_88:
	.cfi_def_cfa_offset 320
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$389, %edx                      # imm = 0x185
	jmp	.LBB8_8
.LBB8_86:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$388, %edx                      # imm = 0x184
	jmp	.LBB8_8
.LBB8_84:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$387, %edx                      # imm = 0x183
	jmp	.LBB8_8
.LBB8_82:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$384, %edx                      # imm = 0x180
	jmp	.LBB8_8
.LBB8_80:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$383, %edx                      # imm = 0x17F
	jmp	.LBB8_8
.LBB8_78:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$382, %edx                      # imm = 0x17E
	jmp	.LBB8_8
.LBB8_76:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$381, %edx                      # imm = 0x17D
	jmp	.LBB8_8
.LBB8_64:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$363, %edx                      # imm = 0x16B
.LBB8_8:
	xorl	%eax, %eax
	callq	printf
	callq	hipGetLastError
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.LBB8_7:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$301, %edx                      # imm = 0x12D
	jmp	.LBB8_8
.LBB8_10:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$302, %edx                      # imm = 0x12E
	jmp	.LBB8_8
.LBB8_12:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$303, %edx                      # imm = 0x12F
	jmp	.LBB8_8
.LBB8_14:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$304, %edx                      # imm = 0x130
	jmp	.LBB8_8
.LBB8_16:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$305, %edx                      # imm = 0x131
	jmp	.LBB8_8
.LBB8_18:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$306, %edx                      # imm = 0x132
	jmp	.LBB8_8
.LBB8_20:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$307, %edx                      # imm = 0x133
	jmp	.LBB8_8
.LBB8_22:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$308, %edx                      # imm = 0x134
	jmp	.LBB8_8
.LBB8_24:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$309, %edx                      # imm = 0x135
	jmp	.LBB8_8
.LBB8_26:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$310, %edx                      # imm = 0x136
	jmp	.LBB8_8
.LBB8_28:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$311, %edx                      # imm = 0x137
	jmp	.LBB8_8
.LBB8_30:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$312, %edx                      # imm = 0x138
	jmp	.LBB8_8
.LBB8_32:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$315, %edx                      # imm = 0x13B
	jmp	.LBB8_8
.LBB8_34:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$316, %edx                      # imm = 0x13C
	jmp	.LBB8_8
.LBB8_36:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$317, %edx                      # imm = 0x13D
	jmp	.LBB8_8
.LBB8_38:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$318, %edx                      # imm = 0x13E
	jmp	.LBB8_8
.LBB8_40:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$319, %edx                      # imm = 0x13F
	jmp	.LBB8_8
.LBB8_42:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$320, %edx                      # imm = 0x140
	jmp	.LBB8_8
.LBB8_44:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$321, %edx                      # imm = 0x141
	jmp	.LBB8_8
.LBB8_46:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$322, %edx                      # imm = 0x142
	jmp	.LBB8_8
.LBB8_48:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$326, %edx                      # imm = 0x146
	jmp	.LBB8_8
.LBB8_50:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$327, %edx                      # imm = 0x147
	jmp	.LBB8_8
.LBB8_52:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$328, %edx                      # imm = 0x148
	jmp	.LBB8_8
.LBB8_54:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$329, %edx                      # imm = 0x149
	jmp	.LBB8_8
.LBB8_56:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$330, %edx                      # imm = 0x14A
	jmp	.LBB8_8
.LBB8_137:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$331, %edx                      # imm = 0x14B
	jmp	.LBB8_8
.LBB8_92:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$401, %edx                      # imm = 0x191
	jmp	.LBB8_8
.LBB8_94:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$402, %edx                      # imm = 0x192
	jmp	.LBB8_8
.LBB8_96:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$403, %edx                      # imm = 0x193
	jmp	.LBB8_8
.LBB8_98:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$404, %edx                      # imm = 0x194
	jmp	.LBB8_8
.LBB8_100:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$405, %edx                      # imm = 0x195
	jmp	.LBB8_8
.LBB8_113:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$471, %edx                      # imm = 0x1D7
	jmp	.LBB8_8
.LBB8_115:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$472, %edx                      # imm = 0x1D8
	jmp	.LBB8_8
.LBB8_117:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$473, %edx                      # imm = 0x1D9
	jmp	.LBB8_8
.LBB8_119:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$474, %edx                      # imm = 0x1DA
	jmp	.LBB8_8
.LBB8_121:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$475, %edx                      # imm = 0x1DB
	jmp	.LBB8_8
.LBB8_123:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$476, %edx                      # imm = 0x1DC
	jmp	.LBB8_8
.LBB8_125:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$477, %edx                      # imm = 0x1DD
	jmp	.LBB8_8
.LBB8_127:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$478, %edx                      # imm = 0x1DE
	jmp	.LBB8_8
.LBB8_129:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$479, %edx                      # imm = 0x1DF
	jmp	.LBB8_8
.LBB8_131:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$480, %edx                      # imm = 0x1E0
	jmp	.LBB8_8
.LBB8_138:
	movl	$.L.str.10, %edi
	movl	$.L.str.11, %esi
	movl	$481, %edx                      # imm = 0x1E1
	jmp	.LBB8_8
.Lfunc_end8:
	.size	main, .Lfunc_end8-main
	.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	.LBB9_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB9_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z11clearArraysPiS_S_S_S_S_S_, %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	$_Z15clearLabelArrayPi, %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	$_Z15getClusterLabelPiS_S_S_, %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	$_Z10sumClusterPiS_S_S_S_S_S_S_, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z15updateCentroidsPiS_S_S_S_S_S_S_, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$0, 8(%rsp)
	movl	$1, (%rsp)
	movl	$dev_nCentroids, %esi
	movl	$.L__unnamed_6, %edx
	movl	$.L__unnamed_6, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$0, 8(%rsp)
	movl	$1, (%rsp)
	movl	$dev_size, %esi
	movl	$.L__unnamed_7, %edx
	movl	$.L__unnamed_7, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$0, 8(%rsp)
	movl	$1, (%rsp)
	movl	$dev_RedCentroid, %esi
	movl	$.L__unnamed_8, %edx
	movl	$.L__unnamed_8, %ecx
	movl	$80, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$0, 8(%rsp)
	movl	$1, (%rsp)
	movl	$dev_GreenCentroid, %esi
	movl	$.L__unnamed_9, %edx
	movl	$.L__unnamed_9, %ecx
	movl	$80, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$0, 8(%rsp)
	movl	$1, (%rsp)
	movl	$dev_BlueCentroid, %esi
	movl	$.L__unnamed_10, %edx
	movl	$.L__unnamed_10, %ecx
	movl	$80, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end9:
	.size	__hip_module_ctor, .Lfunc_end9-__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	.LBB10_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
.LBB10_2:
	retq
.Lfunc_end10:
	.size	__hip_module_dtor, .Lfunc_end10-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	dev_nCentroids,@object          # @dev_nCentroids
	.local	dev_nCentroids
	.comm	dev_nCentroids,4,4
	.type	dev_size,@object                # @dev_size
	.local	dev_size
	.comm	dev_size,4,4
	.type	CLUSTER_BYTES,@object           # @CLUSTER_BYTES
	.bss
	.globl	CLUSTER_BYTES
	.p2align	2, 0x0
CLUSTER_BYTES:
	.long	0                               # 0x0
	.size	CLUSTER_BYTES, 4

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

	.type	dev_RedCentroid,@object         # @dev_RedCentroid
	.local	dev_RedCentroid
	.comm	dev_RedCentroid,80,16
	.type	dev_GreenCentroid,@object       # @dev_GreenCentroid
	.local	dev_GreenCentroid
	.comm	dev_GreenCentroid,80,16
	.type	dev_BlueCentroid,@object        # @dev_BlueCentroid
	.local	dev_BlueCentroid
	.comm	dev_BlueCentroid,80,16
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"r"
	.size	.L.str, 2

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

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

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

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

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

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

	.type	.L.str.2,@object                # @.str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.2:
	.asciz	"Image: %s\n"
	.size	.L.str.2, 11

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Width: %d, Height: %d\n"
	.size	.L.str.3, 23

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"#Clusters: %d, #Iterations: %d\n"
	.size	.L.str.4, 32

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"CUDA error at %s:%d\n"
	.size	.L.str.10, 21

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/grakshith/Parallel-K-means/master/Cuda/kmeans.hip"
	.size	.L.str.11, 112

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"  %s\n"
	.size	.L.str.12, 6

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Kmeans code ran in: %f secs.\n"
	.size	.L.str.14, 30

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"Converged in %d iterations.\n"
	.size	.L.str.15, 29

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"printing counter %d\n"
	.size	.L.str.17, 21

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"r: %u g: %u b: %u \n"
	.size	.L.str.19, 20

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	"%d centroid: %d pixels\n"
	.size	.L.str.21, 24

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"%d, %d, %d \n"
	.size	.L.str.23, 13

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z11clearArraysPiS_S_S_S_S_S_"
	.size	.L__unnamed_1, 30

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z15clearLabelArrayPi"
	.size	.L__unnamed_2, 22

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

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z10sumClusterPiS_S_S_S_S_S_S_"
	.size	.L__unnamed_4, 31

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"_Z15updateCentroidsPiS_S_S_S_S_S_S_"
	.size	.L__unnamed_5, 36

	.type	.L__unnamed_6,@object           # @5
.L__unnamed_6:
	.asciz	"dev_nCentroids"
	.size	.L__unnamed_6, 15

	.type	.L__unnamed_7,@object           # @6
.L__unnamed_7:
	.asciz	"dev_size"
	.size	.L__unnamed_7, 9

	.type	.L__unnamed_8,@object           # @7
.L__unnamed_8:
	.asciz	"dev_RedCentroid"
	.size	.L__unnamed_8, 16

	.type	.L__unnamed_9,@object           # @8
.L__unnamed_9:
	.asciz	"dev_GreenCentroid"
	.size	.L__unnamed_9, 18

	.type	.L__unnamed_10,@object          # @9
.L__unnamed_10:
	.asciz	"dev_BlueCentroid"
	.size	.L__unnamed_10, 17

	.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	"Image loading..."
	.size	.Lstr, 17

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"NOT loaded!"
	.size	.Lstr.1, 12

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"Image loaded!"
	.size	.Lstr.2, 14

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"Initial Centroids: "
	.size	.Lstr.3, 20

	.type	.Lstr.4,@object                 # @str.4
.Lstr.4:
	.asciz	"Launching K-Means Kernels..\t"
	.size	.Lstr.4, 29

	.type	.Lstr.5,@object                 # @str.5
.Lstr.5:
	.asciz	"Label Array:"
	.size	.Lstr.5, 13

	.type	.Lstr.6,@object                 # @str.6
.Lstr.6:
	.asciz	"Sum Arrays:"
	.size	.Lstr.6, 12

	.type	.Lstr.7,@object                 # @str.7
.Lstr.7:
	.asciz	"Pixels per centroids:"
	.size	.Lstr.7, 22

	.type	.Lstr.8,@object                 # @str.8
.Lstr.8:
	.asciz	"New centroids:"
	.size	.Lstr.8, 15

	.type	.Lstr.9,@object                 # @str.9
.Lstr.9:
	.asciz	"Image writing..."
	.size	.Lstr.9, 17

	.type	.Lstr.10,@object                # @str.10
.Lstr.10:
	.asciz	"NOT written!"
	.size	.Lstr.10, 13

	.type	.Lstr.11,@object                # @str.11
.Lstr.11:
	.asciz	"Image written!"
	.size	.Lstr.11, 15

	.type	.Lstr.12,@object                # @str.12
.Lstr.12:
	.asciz	"That's the end."
	.size	.Lstr.12, 16

	.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 _Z26__device_stub__clearArraysPiS_S_S_S_S_S_
	.addrsig_sym _Z30__device_stub__clearLabelArrayPi
	.addrsig_sym _Z30__device_stub__getClusterLabelPiS_S_S_
	.addrsig_sym _Z25__device_stub__sumClusterPiS_S_S_S_S_S_S_
	.addrsig_sym _Z30__device_stub__updateCentroidsPiS_S_S_S_S_S_S_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym dev_nCentroids
	.addrsig_sym dev_size
	.addrsig_sym dev_RedCentroid
	.addrsig_sym dev_GreenCentroid
	.addrsig_sym dev_BlueCentroid
	.addrsig_sym _Z11clearArraysPiS_S_S_S_S_S_
	.addrsig_sym _Z15clearLabelArrayPi
	.addrsig_sym _Z15getClusterLabelPiS_S_S_
	.addrsig_sym _Z10sumClusterPiS_S_S_S_S_S_S_
	.addrsig_sym _Z15updateCentroidsPiS_S_S_S_S_S_S_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z11clearArraysPiS_S_S_S_S_S_ ; -- Begin function _Z11clearArraysPiS_S_S_S_S_S_
	.globl	_Z11clearArraysPiS_S_S_S_S_S_
	.p2align	8
	.type	_Z11clearArraysPiS_S_S_S_S_S_,@function
_Z11clearArraysPiS_S_S_S_S_S_:          ; @_Z11clearArraysPiS_S_S_S_S_S_
; %bb.0:
	s_load_b32 s4, s[0:1], 0x44
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, dev_nCentroids@rel32@lo+4
	s_addc_u32 s3, s3, dev_nCentroids@rel32@hi+12
	v_and_b32_e32 v1, 0x3ff, v0
	s_load_b32 s2, s[2:3], 0x0
	v_bfe_u32 v0, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s3, s4, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u32_u24 v0, v0, s3, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s2, v0
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_clause 0x1
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b256 s[12:19], s[0:1], 0x20
	v_dual_mov_b32 v1, 0 :: v_dual_lshlrev_b32 v0, 2, v0
	s_waitcnt lgkmcnt(0)
	s_clause 0x6
	global_store_b32 v0, v1, s[4:5]
	global_store_b32 v0, v1, s[6:7]
	global_store_b32 v0, v1, s[8:9]
	global_store_b32 v0, v1, s[10:11]
	global_store_b32 v0, v1, s[12:13]
	global_store_b32 v0, v1, s[14:15]
	global_store_b32 v0, v1, s[16:17]
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11clearArraysPiS_S_S_S_S_S_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 312
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 2
		.amdhsa_next_free_sgpr 20
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z11clearArraysPiS_S_S_S_S_S_, .Lfunc_end0-_Z11clearArraysPiS_S_S_S_S_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 196
; NumSgprs: 22
; NumVgprs: 2
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 22
; NumVGPRsForWavesPerEU: 2
; 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: 1
	.text
	.protected	_Z15clearLabelArrayPi   ; -- Begin function _Z15clearLabelArrayPi
	.globl	_Z15clearLabelArrayPi
	.p2align	8
	.type	_Z15clearLabelArrayPi,@function
_Z15clearLabelArrayPi:                  ; @_Z15clearLabelArrayPi
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x14
	s_load_b32 s5, s[0:1], 0x8
	v_bfe_u32 v1, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s6, s4, 16
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, dev_size@rel32@lo+4
	s_addc_u32 s3, s3, dev_size@rel32@hi+12
	v_mad_u64_u32 v[2:3], null, s15, s6, v[1:2]
	s_load_b32 s2, s[2:3], 0x0
	s_and_b32 s3, s4, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[3:4], null, v2, s5, s[14:15]
	v_and_b32_e32 v2, 0x3ff, v0
	v_mad_u64_u32 v[0:1], null, v3, s3, v[2:3]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s2, v0
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_ashrrev_i32_e32 v1, 31, v0
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
.LBB1_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15clearLabelArrayPi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 264
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 5
		.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	_Z15clearLabelArrayPi, .Lfunc_end1-_Z15clearLabelArrayPi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 196
; NumSgprs: 18
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 5
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z15getClusterLabelPiS_S_S_ ; -- Begin function _Z15getClusterLabelPiS_S_S_
	.globl	_Z15getClusterLabelPiS_S_S_
	.p2align	8
	.type	_Z15getClusterLabelPiS_S_S_,@function
_Z15getClusterLabelPiS_S_S_:            ; @_Z15getClusterLabelPiS_S_S_
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x2c
	s_load_b32 s5, s[0:1], 0x20
	v_bfe_u32 v1, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s6, s4, 16
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, dev_size@rel32@lo+4
	s_addc_u32 s3, s3, dev_size@rel32@hi+12
	v_mad_u64_u32 v[2:3], null, s15, s6, v[1:2]
	s_load_b32 s2, s[2:3], 0x0
	s_and_b32 s3, s4, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[3:4], null, v2, s5, s[14:15]
	v_and_b32_e32 v2, 0x3ff, v0
	v_mad_u64_u32 v[0:1], null, v3, s3, v[2:3]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s2, v0
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB2_6
; %bb.1:                                ; %.preheader
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, dev_nCentroids@rel32@lo+4
	s_addc_u32 s3, s3, dev_nCentroids@rel32@hi+12
	v_ashrrev_i32_e32 v1, 31, v0
	s_load_b32 s16, s[2:3], 0x0
	s_load_b256 s[4:11], s[0:1], 0x0
	s_delay_alu instid0(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s16, 1
	s_cbranch_scc1 .LBB2_4
; %bb.2:                                ; %.lr.ph
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s4, v0
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
	v_add_co_u32 v4, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
	v_add_co_u32 v6, vcc_lo, s8, v0
	v_add_co_ci_u32_e32 v7, vcc_lo, s9, v1, vcc_lo
	global_load_b32 v3, v[2:3], off
	global_load_b32 v4, v[4:5], off
	global_load_b32 v5, v[6:7], off
	v_mov_b32_e32 v2, 0
	v_mov_b32_e32 v6, 0x43fa0000
	s_getpc_b64 s[8:9]
	s_add_u32 s8, s8, dev_RedCentroid@rel32@lo+4
	s_addc_u32 s9, s9, dev_RedCentroid@rel32@hi+12
	s_mov_b32 s17, 0
	s_mov_b32 s18, 0x3e76c4e1
	s_getpc_b64 s[12:13]
	s_add_u32 s12, s12, dev_GreenCentroid@rel32@lo+4
	s_addc_u32 s13, s13, dev_GreenCentroid@rel32@hi+12
	s_getpc_b64 s[14:15]
	s_add_u32 s14, s14, dev_BlueCentroid@rel32@lo+4
	s_addc_u32 s15, s15, dev_BlueCentroid@rel32@hi+12
.LBB2_3:                                ; =>This Inner Loop Header: Depth=1
	s_load_b32 s0, s[8:9], 0x0
	s_load_b32 s1, s[12:13], 0x0
	s_load_b32 s2, s[14:15], 0x0
	s_waitcnt vmcnt(2) lgkmcnt(0)
	v_subrev_nc_u32_e32 v7, s0, v3
	s_waitcnt vmcnt(1)
	v_subrev_nc_u32_e32 v8, s1, v4
	s_waitcnt vmcnt(0)
	v_subrev_nc_u32_e32 v9, s2, v5
	v_cmp_eq_u32_e32 vcc_lo, s0, v3
	v_cmp_eq_u32_e64 s0, s1, v4
	v_cvt_f32_i32_e32 v13, v7
	v_cmp_eq_u32_e64 s1, s2, v5
	v_cmp_eq_u32_e64 s2, 1, v7
	v_cvt_f32_i32_e32 v15, v8
	v_cvt_f32_i32_e32 v17, v9
	v_frexp_mant_f32_e64 v19, |v13|
	v_frexp_exp_i32_f32_e32 v20, v13
	v_cndmask_b32_e64 v14, 2.0, 1.0, s2
	v_cmp_eq_u32_e64 s2, 1, v8
	v_frexp_mant_f32_e64 v23, |v15|
	v_cmp_gt_f32_e64 s5, 0x3f2aaaab, v19
	v_frexp_mant_f32_e64 v27, |v17|
	v_trunc_f32_e32 v21, v14
	v_cndmask_b32_e64 v16, 2.0, 1.0, s2
	v_cmp_eq_u32_e64 s2, 1, v9
	v_cndmask_b32_e64 v31, 0, 1, s5
	v_cmp_gt_f32_e64 s6, 0x3f2aaaab, v23
	v_cmp_gt_f32_e64 s7, 0x3f2aaaab, v27
	v_subrev_co_ci_u32_e64 v20, s5, 0, v20, s5
	s_delay_alu instid0(VALU_DEP_4)
	v_ldexp_f32 v19, v19, v31
	v_mul_f32_e32 v22, 0.5, v14
	v_cndmask_b32_e64 v18, 2.0, 1.0, s2
	v_cmp_eq_f32_e64 s2, v21, v14
	v_cndmask_b32_e64 v32, 0, 1, s6
	v_cndmask_b32_e64 v33, 0, 1, s7
	v_trunc_f32_e32 v21, v22
	v_trunc_f32_e32 v29, v18
	v_frexp_exp_i32_f32_e32 v24, v15
	v_frexp_exp_i32_f32_e32 v28, v17
	v_trunc_f32_e32 v25, v16
	v_cmp_neq_f32_e64 s5, v21, v22
	v_ldexp_f32 v21, v23, v32
	v_ldexp_f32 v23, v27, v33
	v_mul_f32_e32 v30, 0.5, v18
	v_mul_f32_e32 v26, 0.5, v16
	v_cmp_eq_f32_e64 s4, v29, v18
	v_subrev_co_ci_u32_e64 v22, s6, 0, v24, s6
	v_add_f32_e32 v31, -1.0, v23
	v_trunc_f32_e32 v29, v30
	v_subrev_co_ci_u32_e64 v24, s7, 0, v28, s7
	v_cmp_eq_f32_e64 s3, v25, v16
	v_cvt_f32_i32_e32 v22, v22
	s_delay_alu instid0(VALU_DEP_4)
	v_cmp_neq_f32_e64 s7, v29, v30
	v_add_f32_e32 v29, 1.0, v21
	v_trunc_f32_e32 v25, v26
	s_and_b32 s5, s2, s5
	v_cndmask_b32_e64 v10, 0x7f800000, 0, vcc_lo
	s_and_b32 s7, s4, s7
	v_cndmask_b32_e64 v12, 0x7f800000, 0, s1
	v_cmp_neq_f32_e64 s6, v25, v26
	v_dual_add_f32 v26, 1.0, v19 :: v_dual_add_f32 v37, -1.0, v29
	v_cndmask_b32_e64 v27, 1.0, v13, s5
	v_dual_add_f32 v28, -1.0, v21 :: v_dual_mul_f32 v39, 0x3f317218, v22
	v_cndmask_b32_e64 v33, 1.0, v17, s7
	v_cndmask_b32_e64 v13, 0, v13, s5
	v_cndmask_b32_e64 v17, 0, v17, s7
	v_dual_add_f32 v34, -1.0, v26 :: v_dual_add_f32 v25, -1.0, v19
	v_cvt_f32_i32_e32 v20, v20
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_bfi_b32 v10, 0x7fffffff, v10, v13
	v_bfi_b32 v12, 0x7fffffff, v12, v17
	v_dual_sub_f32 v17, v21, v37 :: v_dual_add_f32 v32, 1.0, v23
	v_sub_f32_e32 v13, v19, v34
	v_fma_f32 v19, 0x3f317218, v22, -v39
	s_and_b32 s6, s3, s6
	v_cndmask_b32_e64 v11, 0x7f800000, 0, s0
	v_cndmask_b32_e64 v30, 1.0, v15, s6
	v_cndmask_b32_e64 v15, 0, v15, s6
	v_rcp_f32_e32 v38, v29
	v_dual_add_f32 v40, -1.0, v32 :: v_dual_fmac_f32 v19, 0xb102e308, v22
	v_mul_f32_e32 v36, 0x3f317218, v20
	v_cvt_f32_i32_e32 v24, v24
	v_bfi_b32 v11, 0x7fffffff, v11, v15
	v_rcp_f32_e32 v35, v26
	v_add_f32_e32 v43, v39, v19
	v_fma_f32 v15, 0x3f317218, v20, -v36
	v_rcp_f32_e32 v41, v32
	v_sub_f32_e32 v21, v23, v40
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_f32_e32 v39, v43, v39
	v_dual_fmac_f32 v15, 0xb102e308, v20 :: v_dual_mul_f32 v20, v28, v38
	v_mul_f32_e32 v42, 0x3f317218, v24
	s_delay_alu instid0(TRANS32_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_f32_e32 v34, v25, v35
	v_add_f32_e32 v37, v36, v15
	s_delay_alu instid0(VALU_DEP_3)
	v_fma_f32 v23, 0x3f317218, v24, -v42
	s_delay_alu instid0(TRANS32_DEP_1) | instid1(VALU_DEP_1)
	v_dual_mul_f32 v22, v31, v41 :: v_dual_fmac_f32 v23, 0xb102e308, v24
	v_mul_f32_e32 v40, v29, v20
	v_mul_f32_e32 v24, v26, v34
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f32_e32 v45, v42, v23
	v_fma_f32 v29, v20, v29, -v40
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_fma_f32 v26, v34, v26, -v24
	v_sub_f32_e32 v36, v37, v36
	v_dual_sub_f32 v42, v45, v42 :: v_dual_fmac_f32 v29, v20, v17
	v_mul_f32_e32 v44, v32, v22
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_dual_fmac_f32 v26, v34, v13 :: v_dual_sub_f32 v13, v15, v36
	v_sub_f32_e32 v15, v19, v39
	v_sub_f32_e32 v17, v23, v42
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v32, v22, v32, -v44
	v_dual_add_f32 v19, v24, v26 :: v_dual_fmac_f32 v32, v22, v21
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_dual_sub_f32 v36, v25, v19 :: v_dual_add_f32 v21, v40, v29
	v_sub_f32_e32 v24, v19, v24
	v_add_f32_e32 v23, v44, v32
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_sub_f32_e32 v25, v25, v36
	v_dual_sub_f32 v39, v21, v40 :: v_dual_sub_f32 v40, v28, v21
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_f32_e32 v24, v24, v26
	v_dual_sub_f32 v42, v23, v44 :: v_dual_sub_f32 v19, v25, v19
	v_sub_f32_e32 v44, v31, v23
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_f32_e32 v26, v28, v40
	v_dual_sub_f32 v28, v39, v29 :: v_dual_add_f32 v19, v24, v19
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v19, v36, v19
	v_mul_f32_e32 v19, v35, v19
	v_sub_f32_e32 v29, v31, v44
	v_sub_f32_e32 v31, v42, v32
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f32_e32 v24, v34, v19
	v_sub_f32_e32 v23, v29, v23
	v_sub_f32_e32 v21, v26, v21
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_f32_e32 v23, v31, v23
	v_ldexp_f32 v31, v24, 1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v23, v44, v23
	v_mul_f32_e32 v23, v41, v23
	v_add_f32_e32 v21, v28, v21
	v_sub_f32_e32 v28, v24, v34
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_add_f32 v26, v22, v23 :: v_dual_add_f32 v21, v40, v21
	v_sub_f32_e32 v22, v26, v22
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_mul_f32_e32 v21, v38, v21
	v_mul_f32_e32 v35, v26, v26
	v_ldexp_f32 v36, v26, 1
	v_dual_sub_f32 v22, v23, v22 :: v_dual_add_f32 v25, v20, v21
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v23, v26, v26, -v35
	v_add_f32_e32 v42, v22, v22
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_f32_e32 v20, v25, v20
	v_ldexp_f32 v44, v22, 1
	v_sub_f32_e32 v20, v21, v20
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_add_f32_e32 v40, v20, v20
	v_sub_f32_e32 v19, v19, v28
	v_ldexp_f32 v41, v20, 1
	v_add_f32_e32 v38, v19, v19
	v_dual_mul_f32 v32, v25, v25 :: v_dual_fmac_f32 v23, v26, v42
	v_mul_f32_e32 v29, v24, v24
	v_ldexp_f32 v34, v25, 1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_fma_f32 v21, v25, v25, -v32
	v_add_f32_e32 v42, v35, v23
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v28, v24, v24, -v29
	v_fmaak_f32 v50, s18, v42, 0x3e91f4c4
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v28, v24, v38
	v_ldexp_f32 v39, v19, 1
	v_add_f32_e32 v38, v29, v28
	v_fmac_f32_e32 v21, v25, v40
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_dual_sub_f32 v35, v42, v35 :: v_dual_fmaak_f32 v46, s18, v38, 0x3e91f4c4
	v_add_f32_e32 v40, v32, v21
	v_sub_f32_e32 v29, v38, v29
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_dual_sub_f32 v23, v23, v35 :: v_dual_fmaak_f32 v48, s18, v40, 0x3e91f4c4
	v_sub_f32_e32 v32, v40, v32
	v_mul_f32_e32 v49, v25, v40
	v_dual_mul_f32 v51, v26, v42 :: v_dual_sub_f32 v28, v28, v29
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_dual_fmaak_f32 v46, v38, v46, 0x3ecccdef :: v_dual_sub_f32 v21, v21, v32
	v_fmaak_f32 v48, v40, v48, 0x3ecccdef
	v_fma_f32 v32, v40, v25, -v49
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v35, v42, v26, -v51
	v_dual_fmac_f32 v32, v40, v20 :: v_dual_fmac_f32 v35, v42, v22
	v_mul_f32_e32 v47, v24, v38
	v_mul_f32_e32 v20, v40, v48
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_dual_fmac_f32 v32, v21, v25 :: v_dual_fmac_f32 v35, v23, v26
	v_fma_f32 v29, v38, v24, -v47
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v25, v40, v48, -v20
	v_fmac_f32_e32 v29, v38, v19
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_dual_fmaak_f32 v50, v42, v50, 0x3ecccdef :: v_dual_fmac_f32 v25, v21, v48
	v_fmac_f32_e32 v29, v28, v24
	v_mul_f32_e32 v19, v38, v46
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f32_e32 v22, v42, v50
	v_fma_f32 v24, v38, v46, -v19
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_fma_f32 v26, v42, v50, -v22
	v_add_f32_e32 v38, v47, v29
	v_fmac_f32_e32 v24, v28, v46
	v_dual_add_f32 v28, v49, v32 :: v_dual_add_f32 v21, v51, v35
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_dual_fmac_f32 v26, v23, v50 :: v_dual_sub_f32 v23, v38, v47
	v_add_f32_e32 v40, v19, v24
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_dual_sub_f32 v42, v28, v49 :: v_dual_sub_f32 v47, v21, v51
	v_add_f32_e32 v46, v20, v25
	v_dual_add_f32 v48, v22, v26 :: v_dual_sub_f32 v19, v40, v19
	v_sub_f32_e32 v23, v29, v23
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_dual_add_f32 v29, 0x3f2aaaaa, v40 :: v_dual_sub_f32 v32, v32, v42
	v_dual_sub_f32 v35, v35, v47 :: v_dual_add_f32 v42, 0x3f2aaaaa, v46
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_add_f32_e32 v47, 0x3f2aaaaa, v48
	v_dual_sub_f32 v20, v46, v20 :: v_dual_sub_f32 v19, v24, v19
	v_add_f32_e32 v24, 0xbf2aaaaa, v29
	v_sub_f32_e32 v22, v48, v22
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_dual_sub_f32 v20, v25, v20 :: v_dual_add_f32 v25, 0xbf2aaaaa, v42
	v_dual_add_f32 v19, 0x31739010, v19 :: v_dual_sub_f32 v24, v40, v24
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_f32_e32 v22, v26, v22
	v_sub_f32_e32 v25, v46, v25
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v19, v19, v24
	v_add_f32_e32 v24, v29, v19
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_dual_add_f32 v22, 0x31739010, v22 :: v_dual_sub_f32 v29, v29, v24
	v_add_f32_e32 v20, 0x31739010, v20
	v_dual_mul_f32 v40, v38, v24 :: v_dual_add_f32 v19, v19, v29
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f32_e32 v20, v20, v25
	v_add_f32_e32 v26, 0xbf2aaaaa, v47
	v_fma_f32 v29, v38, v24, -v40
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_add_f32 v25, v42, v20 :: v_dual_sub_f32 v26, v48, v26
	v_dual_fmac_f32 v29, v38, v19 :: v_dual_mul_f32 v46, v28, v25
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_add_f32 v22, v22, v26 :: v_dual_fmac_f32 v29, v23, v24
	v_dual_add_f32 v26, v47, v22 :: v_dual_add_f32 v19, v40, v29
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_dual_sub_f32 v42, v42, v25 :: v_dual_sub_f32 v47, v47, v26
	v_dual_add_f32 v23, v31, v19 :: v_dual_mul_f32 v48, v21, v26
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f32_e32 v22, v22, v47
	v_fma_f32 v47, v21, v26, -v48
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v47, v21, v22
	v_fmac_f32_e32 v47, v35, v26
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_add_f32 v21, v48, v47 :: v_dual_sub_f32 v22, v19, v40
	v_dual_sub_f32 v22, v29, v22 :: v_dual_sub_f32 v29, v23, v31
	v_add_f32_e32 v20, v20, v42
	v_fma_f32 v42, v28, v25, -v46
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f32_e32 v22, v39, v22
	v_dual_sub_f32 v19, v19, v29 :: v_dual_fmac_f32 v42, v28, v20
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_dual_add_f32 v19, v22, v19 :: v_dual_sub_f32 v26, v21, v48
	v_fmac_f32_e32 v42, v32, v25
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v22, v23, v19
	v_dual_add_f32 v28, v36, v21 :: v_dual_add_f32 v29, v37, v22
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_sub_f32 v32, v28, v36 :: v_dual_sub_f32 v23, v22, v23
	v_dual_sub_f32 v21, v21, v32 :: v_dual_add_f32 v20, v46, v42
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_sub_f32_e32 v19, v19, v23
	v_dual_sub_f32 v23, v29, v37 :: v_dual_sub_f32 v26, v47, v26
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_add_f32 v25, v34, v20 :: v_dual_sub_f32 v24, v20, v46
	v_dual_sub_f32 v22, v22, v23 :: v_dual_sub_f32 v31, v25, v34
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_sub_f32_e32 v24, v42, v24
	v_sub_f32_e32 v34, v29, v23
	v_add_f32_e32 v23, v13, v19
	v_sub_f32_e32 v20, v20, v31
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f32_e32 v24, v41, v24
	v_dual_sub_f32 v34, v37, v34 :: v_dual_sub_f32 v37, v23, v13
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f32_e32 v20, v24, v20
	v_add_f32_e32 v22, v22, v34
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_f32_e32 v34, v23, v37
	v_dual_sub_f32 v19, v19, v37 :: v_dual_add_f32 v24, v25, v20
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f32_e32 v22, v23, v22
	v_sub_f32_e32 v13, v13, v34
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_sub_f32_e32 v25, v24, v25
	v_add_f32_e32 v31, v43, v24
	v_add_f32_e32 v13, v19, v13
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_dual_add_f32 v19, v29, v22 :: v_dual_sub_f32 v20, v20, v25
	v_dual_add_f32 v26, v44, v26 :: v_dual_sub_f32 v25, v31, v43
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_f32_e32 v35, v31, v25
	v_dual_sub_f32 v24, v24, v25 :: v_dual_add_f32 v25, v15, v20
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f32_e32 v21, v26, v21
	v_sub_f32_e32 v35, v43, v35
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_f32_e32 v38, v25, v15
	v_add_f32_e32 v26, v28, v21
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_dual_add_f32 v24, v24, v35 :: v_dual_sub_f32 v35, v25, v38
	v_sub_f32_e32 v28, v26, v28
	v_add_f32_e32 v32, v45, v26
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_add_f32_e32 v23, v25, v24
	v_sub_f32_e32 v25, v19, v29
	v_sub_f32_e32 v15, v15, v35
	v_dual_sub_f32 v21, v21, v28 :: v_dual_sub_f32 v28, v32, v45
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_f32_e32 v22, v22, v25
	v_dual_sub_f32 v36, v32, v28 :: v_dual_add_f32 v13, v13, v22
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v22, v19, v13
	v_dual_sub_f32 v20, v20, v38 :: v_dual_sub_f32 v19, v22, v19
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_dual_sub_f32 v26, v26, v28 :: v_dual_add_f32 v15, v20, v15
	v_sub_f32_e32 v36, v45, v36
	v_add_f32_e32 v28, v17, v21
	v_dual_add_f32 v20, v31, v23 :: v_dual_mul_f32 v25, v14, v22
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_dual_sub_f32 v13, v13, v19 :: v_dual_add_f32 v26, v26, v36
	v_sub_f32_e32 v39, v28, v17
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_fma_f32 v19, v14, v22, -v25
	v_cmp_class_f32_e64 s7, v25, 0x204
	v_add_f32_e32 v24, v28, v26
	v_sub_f32_e32 v26, v20, v31
	v_sub_f32_e32 v21, v21, v39
	v_fmac_f32_e32 v19, v14, v13
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_f32_e32 v23, v23, v26
	v_add_f32_e32 v13, v25, v19
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v15, v15, v23
	v_add_f32_e32 v23, v20, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_f32_e32 v20, v23, v20
	v_sub_f32_e32 v36, v28, v39
	v_dual_mul_f32 v26, v16, v23 :: v_dual_sub_f32 v15, v15, v20
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_f32_e32 v17, v17, v36
	v_fma_f32 v20, v16, v23, -v26
	v_cmp_class_f32_e64 s5, v26, 0x204
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_add_f32_e32 v17, v21, v17
	v_add_f32_e32 v21, v32, v24
	v_fmac_f32_e32 v20, v16, v15
	v_sub_f32_e32 v16, v13, v25
	v_cndmask_b32_e64 v13, v13, v25, s7
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_sub_f32_e32 v28, v21, v32
	v_add_f32_e32 v14, v26, v20
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_f32_e32 v16, v19, v16
	v_sub_f32_e32 v24, v24, v28
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v17, v17, v24
	v_add_f32_e32 v24, v21, v17
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_sub_f32 v21, v24, v21 :: v_dual_mul_f32 v28, v18, v24
	v_sub_f32_e32 v17, v17, v21
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v21, v18, v24, -v28
	v_fmac_f32_e32 v21, v18, v17
	v_sub_f32_e32 v17, v14, v26
	v_cndmask_b32_e64 v14, v14, v26, s5
	v_cmp_eq_f32_e64 s5, 0x42b17218, v13
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_sub_f32_e32 v17, v20, v17
	v_add_f32_e32 v15, v28, v21
	v_cmp_class_f32_e64 s6, v28, 0x204
	v_cndmask_b32_e64 v19, 0, 0x37000000, s5
	v_cmp_neq_f32_e64 s5, 0x7f800000, |v14|
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_sub_f32_e32 v18, v15, v28
	v_cndmask_b32_e64 v15, v15, v28, s6
	v_cmp_eq_f32_e64 s6, 0x42b17218, v14
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_cndmask_b32_e64 v17, 0, v17, s5
	v_sub_f32_e32 v18, v21, v18
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_cmp_eq_f32_e64 s7, 0x42b17218, v15
	v_cndmask_b32_e64 v20, 0, 0x37000000, s6
	v_cmp_neq_f32_e64 s6, 0x7f800000, |v15|
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_cndmask_b32_e64 v21, 0, 0x37000000, s7
	v_cmp_neq_f32_e64 s7, 0x7f800000, |v13|
	v_sub_f32_e32 v13, v13, v19
	v_cndmask_b32_e64 v18, 0, v18, s6
	v_add_f32_e32 v17, v20, v17
	v_sub_f32_e32 v15, v15, v21
	v_cndmask_b32_e64 v16, 0, v16, s7
	v_cmp_ngt_f32_e64 s7, 0xc2ce8ed0, v13
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_dual_add_f32 v18, v21, v18 :: v_dual_mul_f32 v21, 0x3fb8aa3b, v15
	v_dual_add_f32 v16, v19, v16 :: v_dual_mul_f32 v19, 0x3fb8aa3b, v13
	v_cmp_ngt_f32_e64 s6, 0xc2ce8ed0, v15
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_rndne_f32_e32 v28, v21
	v_fma_f32 v26, 0x3fb8aa3b, v15, -v21
	v_fma_f32 v22, 0x3fb8aa3b, v13, -v19
	v_rndne_f32_e32 v23, v19
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_dual_sub_f32 v21, v21, v28 :: v_dual_fmac_f32 v26, 0x32a5705f, v15
	v_dual_fmac_f32 v22, 0x32a5705f, v13 :: v_dual_sub_f32 v19, v19, v23
	v_sub_f32_e32 v14, v14, v20
	v_cvt_i32_f32_e32 v23, v23
	s_delay_alu instid0(VALU_DEP_4)
	v_add_f32_e32 v21, v21, v26
	v_cvt_i32_f32_e32 v28, v28
	v_add_f32_e32 v19, v19, v22
	v_mul_f32_e32 v20, 0x3fb8aa3b, v14
	v_cmp_ngt_f32_e64 s5, 0xc2ce8ed0, v14
	v_exp_f32_e32 v21, v21
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_exp_f32_e32 v19, v19
	v_fma_f32 v24, 0x3fb8aa3b, v14, -v20
	v_rndne_f32_e32 v25, v20
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v24, 0x32a5705f, v14
	v_sub_f32_e32 v20, v20, v25
	v_cvt_i32_f32_e32 v25, v25
	s_delay_alu instid0(TRANS32_DEP_2) | instskip(NEXT) | instid1(TRANS32_DEP_1)
	v_ldexp_f32 v21, v21, v28
	v_ldexp_f32 v19, v19, v23
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f32_e32 v20, v20, v24
	v_cndmask_b32_e64 v19, 0, v19, s7
	v_cmp_nlt_f32_e64 s7, 0x42b17218, v13
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_exp_f32_e32 v20, v20
	v_cndmask_b32_e64 v13, 0x7f800000, v19, s7
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_fma_f32 v16, v13, v16, v13
	s_waitcnt_depctr 0xfff
	v_ldexp_f32 v20, v20, v25
	v_cmp_eq_f32_e64 s7, 0x7f800000, v13
	v_cndmask_b32_e64 v20, 0, v20, s5
	v_cmp_nlt_f32_e64 s5, 0x42b17218, v14
	v_cndmask_b32_e64 v14, 0, v21, s6
	v_cmp_nlt_f32_e64 s6, 0x42b17218, v15
	v_cndmask_b32_e64 v13, v16, v13, s7
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v15, 0x7f800000, v20, s5
	v_cndmask_b32_e64 v14, 0x7f800000, v14, s6
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_bfi_b32 v13, 0x7fffffff, v13, v27
	v_fma_f32 v17, v15, v17, v15
	v_cmp_eq_f32_e64 s5, 0x7f800000, v15
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_4) | instid1(VALU_DEP_4)
	v_fma_f32 v18, v14, v18, v14
	v_cmp_eq_f32_e64 s6, 0x7f800000, v14
	v_cndmask_b32_e64 v16, 0x7fc00000, v13, s2
	v_cmp_gt_i32_e64 s2, 0, v8
	v_cndmask_b32_e64 v15, v17, v15, s5
	v_cndmask_b32_e64 v14, v18, v14, s6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_bfi_b32 v15, 0x7fffffff, v15, v30
	v_bfi_b32 v14, 0x7fffffff, v14, v33
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v17, 0x7fc00000, v15, s3
	v_cmp_gt_i32_e64 s3, 0, v9
	v_cndmask_b32_e64 v8, 0x7fc00000, v14, s4
	v_cmp_gt_i32_e64 s4, 0, v7
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v9, v15, v17, s2
	v_cndmask_b32_e64 v8, v14, v8, s3
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v7, v13, v16, s4
	v_cndmask_b32_e64 v9, v9, v11, s0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v8, v8, v12, s1
	v_cndmask_b32_e32 v7, v7, v10, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v7, v7, v9
	v_add_f32_e32 v7, v7, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_f32_e32 v8, 0x4f800000, v7
	v_cmp_gt_f32_e32 vcc_lo, 0xf800000, v7
	v_cndmask_b32_e32 v7, v7, v8, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_sqrt_f32_e32 v8, v7
	s_waitcnt_depctr 0xfff
	v_add_nc_u32_e32 v9, -1, v8
	v_add_nc_u32_e32 v10, 1, v8
	v_fma_f32 v11, -v9, v8, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v12, -v10, v8, v7
	v_cmp_ge_f32_e64 s0, 0, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v8, v8, v9, s0
	v_cmp_lt_f32_e64 s0, 0, v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v8, v8, v10, s0
	v_mul_f32_e32 v9, 0x37800000, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v8, v8, v9, vcc_lo
	v_cmp_class_f32_e64 vcc_lo, v7, 0x260
	v_cndmask_b32_e32 v7, v8, v7, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_cmp_lt_f32_e32 vcc_lo, v7, v6
	v_cndmask_b32_e32 v6, v6, v7, vcc_lo
	v_cndmask_b32_e64 v2, v2, s17, vcc_lo
	s_add_i32 s17, s17, 1
	s_add_u32 s8, s8, 4
	s_addc_u32 s9, s9, 0
	s_add_u32 s12, s12, 4
	s_addc_u32 s13, s13, 0
	s_add_u32 s14, s14, 4
	s_addc_u32 s15, s15, 0
	s_cmp_eq_u32 s16, s17
	s_cbranch_scc0 .LBB2_3
	s_branch .LBB2_5
.LBB2_4:
	v_mov_b32_e32 v2, 0
.LBB2_5:                                ; %Flow49
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s10, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s11, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
.LBB2_6:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15getClusterLabelPiS_S_S_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 52
		.amdhsa_next_free_sgpr 19
		.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	_Z15getClusterLabelPiS_S_S_, .Lfunc_end2-_Z15getClusterLabelPiS_S_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 3664
; NumSgprs: 21
; NumVgprs: 52
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 6
; NumSGPRsForWavesPerEU: 21
; NumVGPRsForWavesPerEU: 52
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z10sumClusterPiS_S_S_S_S_S_S_ ; -- Begin function _Z10sumClusterPiS_S_S_S_S_S_S_
	.globl	_Z10sumClusterPiS_S_S_S_S_S_S_
	.p2align	8
	.type	_Z10sumClusterPiS_S_S_S_S_S_S_,@function
_Z10sumClusterPiS_S_S_S_S_S_S_:         ; @_Z10sumClusterPiS_S_S_S_S_S_S_
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x4c
	s_load_b32 s5, s[0:1], 0x40
	v_bfe_u32 v1, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s6, s4, 16
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, dev_size@rel32@lo+4
	s_addc_u32 s3, s3, dev_size@rel32@hi+12
	v_mad_u64_u32 v[2:3], null, s15, s6, v[1:2]
	s_load_b32 s2, s[2:3], 0x0
	s_and_b32 s3, s4, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[3:4], null, v2, s5, s[14:15]
	v_and_b32_e32 v2, 0x3ff, v0
	v_mad_u64_u32 v[0:1], null, v3, s3, v[2:3]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s2, v0
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB3_2
; %bb.1:
	s_load_b512 s[0:15], s[0:1], 0x0
	v_ashrrev_i32_e32 v1, 31, v0
	v_mov_b32_e32 v11, 1
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s12, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s13, v1, vcc_lo
	global_load_b32 v2, v[2:3], off
	v_add_co_u32 v3, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v1, vcc_lo
	v_add_co_u32 v5, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v6, vcc_lo, s3, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s4, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	global_load_b32 v8, v[3:4], off
	global_load_b32 v9, v[5:6], off
	global_load_b32 v10, v[0:1], off
	s_waitcnt vmcnt(3)
	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 v2, vcc_lo, s6, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s7, v1, vcc_lo
	v_add_co_u32 v4, vcc_lo, s8, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, s9, v1, vcc_lo
	v_add_co_u32 v6, vcc_lo, s10, v0
	v_add_co_ci_u32_e32 v7, vcc_lo, s11, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s14, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s15, v1, vcc_lo
	s_waitcnt vmcnt(2)
	global_atomic_add_u32 v[2:3], v8, off
	s_waitcnt vmcnt(1)
	global_atomic_add_u32 v[4:5], v9, off
	s_waitcnt vmcnt(0)
	global_atomic_add_u32 v[6:7], v10, off
	global_atomic_add_u32 v[0:1], v11, off
.LBB3_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10sumClusterPiS_S_S_S_S_S_S_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 320
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 12
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end3:
	.size	_Z10sumClusterPiS_S_S_S_S_S_S_, .Lfunc_end3-_Z10sumClusterPiS_S_S_S_S_S_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 372
; NumSgprs: 18
; NumVgprs: 12
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 12
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z15updateCentroidsPiS_S_S_S_S_S_S_ ; -- Begin function _Z15updateCentroidsPiS_S_S_S_S_S_S_
	.globl	_Z15updateCentroidsPiS_S_S_S_S_S_S_
	.p2align	8
	.type	_Z15updateCentroidsPiS_S_S_S_S_S_S_,@function
_Z15updateCentroidsPiS_S_S_S_S_S_S_:    ; @_Z15updateCentroidsPiS_S_S_S_S_S_S_
; %bb.0:
	s_load_b32 s4, s[0:1], 0x4c
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, dev_nCentroids@rel32@lo+4
	s_addc_u32 s3, s3, dev_nCentroids@rel32@hi+12
	v_and_b32_e32 v1, 0x3ff, v0
	s_load_b32 s2, s[2:3], 0x0
	v_bfe_u32 v0, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s3, s4, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u32_u24 v0, v0, s3, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s2, v0
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB4_7
; %bb.1:
	s_load_b512 s[4:19], s[0:1], 0x0
	v_lshlrev_b32_e32 v0, 2, v0
	s_waitcnt lgkmcnt(0)
	s_clause 0x3
	global_load_b32 v1, v0, s[16:17]
	global_load_b32 v2, v0, s[10:11]
	global_load_b32 v3, v0, s[12:13]
	global_load_b32 v4, v0, s[14:15]
	s_waitcnt vmcnt(3)
	v_ashrrev_i32_e32 v5, 31, v1
	s_waitcnt vmcnt(2)
	v_ashrrev_i32_e32 v8, 31, v2
	s_waitcnt vmcnt(1)
	v_ashrrev_i32_e32 v9, 31, v3
	s_waitcnt vmcnt(0)
	v_ashrrev_i32_e32 v10, 31, v4
	v_add_nc_u32_e32 v1, v1, v5
	v_add_nc_u32_e32 v2, v2, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v1, v1, v5
	v_xor_b32_e32 v2, v2, v8
	v_xor_b32_e32 v8, v8, v5
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cvt_f32_u32_e32 v6, v1
	v_sub_nc_u32_e32 v7, 0, v1
	v_rcp_iflag_f32_e32 v6, v6
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v6, 0x4f7ffffe, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_u32_f32_e32 v6, v6
	v_mul_lo_u32 v7, v7, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v7, v6, v7
	v_add_nc_u32_e32 v6, v6, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v7, v2, v6
	v_mul_lo_u32 v12, v7, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v2, v2, v12
	v_cmp_ge_u32_e32 vcc_lo, v2, v1
	v_add_nc_u32_e32 v3, v3, v9
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_xor_b32_e32 v3, v3, v9
	v_xor_b32_e32 v9, v9, v5
	v_xor_b32_e32 v5, v10, v5
	v_mul_hi_u32 v11, v3, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v13, v11, v1
	v_add_nc_u32_e32 v12, 1, v11
	v_sub_nc_u32_e32 v3, v3, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_ge_u32_e64 s0, v3, v1
	v_cndmask_b32_e64 v11, v11, v12, s0
	v_sub_nc_u32_e32 v12, v3, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v3, v3, v12, s0
	v_add_nc_u32_e32 v12, 1, v11
	v_add_nc_u32_e32 v4, v4, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v4, v4, v10
	v_mul_hi_u32 v6, v4, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v14, v6, v1
	v_add_nc_u32_e32 v15, 1, v6
	v_sub_nc_u32_e32 v4, v4, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cmp_ge_u32_e64 s1, v4, v1
	v_sub_nc_u32_e32 v13, v4, v1
	v_cndmask_b32_e64 v6, v6, v15, s1
	s_delay_alu instid0(VALU_DEP_2)
	v_cndmask_b32_e64 v4, v4, v13, s1
	s_getpc_b64 s[0:1]
	s_add_u32 s0, s0, dev_GreenCentroid@rel32@lo+4
	s_addc_u32 s1, s1, dev_GreenCentroid@rel32@hi+12
	v_add_nc_u32_e32 v13, 1, v6
	v_add_nc_u32_e32 v10, 1, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v7, v7, v10, vcc_lo
	v_sub_nc_u32_e32 v10, v2, v1
	v_cndmask_b32_e32 v2, v2, v10, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v10, 1, v7
	v_cmp_ge_u32_e32 vcc_lo, v2, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v2, v7, v10, vcc_lo
	v_cmp_ge_u32_e32 vcc_lo, v3, v1
	v_xor_b32_e32 v2, v2, v8
	v_cndmask_b32_e32 v3, v11, v12, vcc_lo
	v_cmp_ge_u32_e32 vcc_lo, v4, v1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_nc_u32_e32 v2, v2, v8
	v_xor_b32_e32 v3, v3, v9
	v_cndmask_b32_e32 v1, v6, v13, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v3, v3, v9
	v_xor_b32_e32 v1, v1, v5
	s_delay_alu instid0(VALU_DEP_1)
	v_sub_nc_u32_e32 v1, v1, v5
	s_clause 0x2
	global_store_b32 v0, v2, s[4:5]
	global_store_b32 v0, v3, s[6:7]
	global_store_b32 v0, v1, s[8:9]
	s_clause 0x1
	global_load_b32 v2, v0, s[6:7]
	global_load_b32 v3, v0, s[0:1]
	s_mov_b32 s1, exec_lo
	s_waitcnt vmcnt(0)
	v_cmp_ne_u32_e64 s0, v2, v3
	v_cmpx_eq_u32_e64 v2, v3
	s_cbranch_execz .LBB4_5
; %bb.2:
	v_add_co_u32 v2, s2, s4, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v3, null, s5, 0, s2
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, dev_RedCentroid@rel32@lo+4
	s_addc_u32 s3, s3, dev_RedCentroid@rel32@hi+12
	global_load_b32 v2, v[2:3], off
	global_load_b32 v3, v0, s[2:3]
	s_mov_b32 s3, exec_lo
	s_waitcnt vmcnt(0)
	v_cmp_ne_u32_e64 s2, v2, v3
	v_cmpx_eq_u32_e64 v2, v3
	s_cbranch_execz .LBB4_4
; %bb.3:
	s_getpc_b64 s[4:5]
	s_add_u32 s4, s4, dev_BlueCentroid@rel32@lo+4
	s_addc_u32 s5, s5, dev_BlueCentroid@rel32@hi+12
	s_and_not1_b32 s2, s2, exec_lo
	global_load_b32 v0, v0, s[4:5]
	s_waitcnt vmcnt(0)
	v_cmp_ne_u32_e32 vcc_lo, v1, v0
	s_and_b32 s4, vcc_lo, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s2, s2, s4
.LBB4_4:                                ; %Flow63
	s_or_b32 exec_lo, exec_lo, s3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_and_not1_b32 s0, s0, exec_lo
	s_and_b32 s2, s2, exec_lo
	s_or_b32 s0, s0, s2
.LBB4_5:                                ; %Flow
	s_or_b32 exec_lo, exec_lo, s1
	s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1)
	s_and_b32 exec_lo, exec_lo, s0
	s_cbranch_execz .LBB4_7
; %bb.6:
	v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, 1
	global_store_b32 v0, v1, s[18:19]
.LBB4_7:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15updateCentroidsPiS_S_S_S_S_S_S_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 320
		.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 1
		.amdhsa_next_free_vgpr 16
		.amdhsa_next_free_sgpr 20
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end4:
	.size	_Z15updateCentroidsPiS_S_S_S_S_S_S_, .Lfunc_end4-_Z15updateCentroidsPiS_S_S_S_S_S_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 848
; NumSgprs: 22
; NumVgprs: 16
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 22
; NumVGPRsForWavesPerEU: 16
; 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: 1
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.protected	dev_nCentroids          ; @dev_nCentroids
	.type	dev_nCentroids,@object
	.section	.bss,"aw",@nobits
	.globl	dev_nCentroids
	.p2align	2, 0x0
dev_nCentroids:
	.long	0                               ; 0x0
	.size	dev_nCentroids, 4

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

	.protected	dev_RedCentroid         ; @dev_RedCentroid
	.type	dev_RedCentroid,@object
	.globl	dev_RedCentroid
	.p2align	4, 0x0
dev_RedCentroid:
	.zero	80
	.size	dev_RedCentroid, 80

	.protected	dev_GreenCentroid       ; @dev_GreenCentroid
	.type	dev_GreenCentroid,@object
	.globl	dev_GreenCentroid
	.p2align	4, 0x0
dev_GreenCentroid:
	.zero	80
	.size	dev_GreenCentroid, 80

	.protected	dev_BlueCentroid        ; @dev_BlueCentroid
	.type	dev_BlueCentroid,@object
	.globl	dev_BlueCentroid
	.p2align	4, 0x0
dev_BlueCentroid:
	.zero	80
	.size	dev_BlueCentroid, 80

	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

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

	.end_amdgpu_metadata
