/*
 * Author: Tejeswini
 * Purpose: 2D convolution of image on CPU and GPU
 */

#include <iostream>
#include <stdio.h>
#include "cuda.h"
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#define _USE_MATH_DEFINES
#include <math.h>
#include <time.h>
#include <string>
#include <cstring>

#define _CRT_SECURE_NO_DEPRECATE

using namespace std;

#define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ ))

#define RGB_COMPONENT_COLOR 255
static int width= 0;
static int height = 0;

/*------------------------------------------------- PPMPixel -----------------
         | Structure- to store image data
         *-------------------------------------------------------------------*/
typedef struct {
     unsigned char red,green,blue;
} PPMPixel;

/*------------------------------------------------- PPMImage -----------------
         | Structure- to store image dimension and data
         *-------------------------------------------------------------------*/

typedef struct {
     int x, y;
     PPMPixel *data;
} PPMImage;

 /*------------------------------------------------- HandleError -----
         |  Function HandleError
         |
         |  Purpose:  This functions checks the status of CUDA APIs 
         |
         |  Parameters:
         |      cudaError_t	 Error Status
		 |		const char *file A file pointer,
		 |		int line where the errror occured
		 |
         |  Returns:	Void
         *-------------------------------------------------------------------*/

static void HandleError( cudaError_t err,
                         const char *file,
                         int line ) {
    if (err != cudaSuccess) {
        printf( "%s in %s at line %d\n", cudaGetErrorString( err ), file, line );
        exit( EXIT_FAILURE );
    }
}


/*------------------------------------------------- gpuConvolution_x -----
         |  gpuConvolution_x
         |
         |  Purpose:  This function is called by CPU and executed on GPU 
		 |			  This function is to compute the Convolution of image pixels along x axis on GPU
         |
         |  Parameters:
         |      float *kernel Gausian kernel used to blur the image
		 |		int *kernelSizeX Gausian kernel size
		 |		int *width image width
		 |		int *height image hight
		 |		unsigned char* redPixels pointerto buffer storing redPixels
		 |		unsigned char* greenPixels pointer to buffer storing green pixels
		 |		unsigned char* bluePixelOp  pointer to buffer storing convoluted bluepixels
		 |		unsigned char* greenPixelOp pointer to buffer storing convoluted green pixels
		 |		unsigned char* bluePixelOp  pointer to buffer storing  convoluted bluepixels
		 |
		 |
         |  Returns:	Void
         *-------------------------------------------------------------------*/


__global__ void gpuConvolution_x(float *kernel, int *kernelSizeX,  int *width, int *height, unsigned char* redPixels, unsigned char* greenPixels, unsigned char* bluePixels, unsigned char* redPixelsOp, unsigned char* greenPixelsOp, unsigned char* bluePixelsOp) {
	int i = blockIdx.x * blockDim.x + threadIdx.x;
	int j = blockIdx.y * blockDim.y + threadIdx.y;

	if(i > (*width) || j > (*height)) return; 

//	for(int j = 0; j < (*height); j++)
//	{
//	for(int i = 0; i < (*width); i++)
//	{
		
				if(i == 0 || i == 1 || i == 0 || i == 1)
				{
				}
				else {
				/*convolute red, green and blue pixels seperately with gausian kernel along x direction*/
				for(int r = 0; r < 5; r++)
				{
					redPixelsOp[(j*(*width)) + i] += (unsigned char)redPixels[((*width)*j)+(i+r-1)]*kernel[r];
					greenPixelsOp[(j*(*width)) + i] += (unsigned char)greenPixels[((*width)*j)+(i+r-1)]*kernel[r];
					bluePixelsOp[(j*(*width))+i] += (unsigned char)bluePixels[((*width)*j)+(i+r-1)]*kernel[r];
				}

		}
	
	/*wait for all threads to complete*/
	__syncthreads();
//	}
//	}

}


/*------------------------------------------------- gpuConvolution_y -----
         |  gpuConvolution_y
         |
         |  Purpose:  This function is called by CPU and executed on GPU 
		 |			  This function is to compute the Convolution of image pixels along y axis on GPU
         |
         |  Parameters:
         |      float *kernel Gausian kernel used to blur the image
		 |		int *kernelSizeX Gausian kernel size
		 |		int *width image width
		 |		int *height image hight
		 |		unsigned char* redPixelsOp pointerto buffer storing redPixels along x axis
		 |		unsigned char* greenPixelsOp pointer to buffer storing green pixels along x axis
		 |		unsigned char* bluePixelOpy  pointer to buffer storing convoluted bluepixels along y axis
		 |		unsigned char* greenPixelOpy pointer to buffer storing convoluted green pixels along y axis
		 |		unsigned char* bluePixelOpy  pointer to buffer storing  convoluted bluepixels along y axis
		 |
		 |
         |  Returns:	Void
         *-------------------------------------------------------------------*/

__global__ void gpuConvolution_y(float *kernel, int *kernelSizeX,  int *width, int *height, unsigned char *redPixelsOp, unsigned char *greenPixelsOp, unsigned char *bluePixelsOp, unsigned char *redPixelsOpy, unsigned char *greenPixelsOpy, unsigned char *bluePixelsOpy, unsigned char *out) {
	int i = blockIdx.x * blockDim.x + threadIdx.x;
	int j = blockIdx.y * blockDim.y + threadIdx.y;

	if(i > (*width) || j > (*height)) return; 

//	for(int j = 0; j < (*height); j++)
//	{
//	for(int i = 0; i < (*width); i++)
//	{
		
				if(i == 0 || i == 1 || i == 0 || i == 1)
				{
				}
				else {
					/*convolute red, green and blue pixels seperately with gausian kernel along Y direction*/
					for(int r = 0; r < 5; r++)
						{
							redPixelsOpy[(j*(*width)) + i] += (unsigned char)redPixelsOp[i+(j+r-1)*(*width)]*kernel[r];
							greenPixelsOpy[(j*(*width)) + i] += (unsigned char)greenPixelsOp[i+(j+r-1)*(*width)]*kernel[r];
							bluePixelsOpy[(j*(*width))+i] += (unsigned char)bluePixelsOp[i+(j+r-1)*(*width)]*kernel[r];
						}

			}

		/*wait for all threads to complete*/
		__syncthreads();	


		//}
	//}

}

/*------------------------------------------------- gpuFunction -----
         |  gpuFunction
         |
         |  Purpose:  This function is called by CPU and executed on CPU 
		 |			  This function allocates memory on GPU device and launches GPU kernels
         |
         |  Parameters:
         |      unsigned char *data input image data
		 |		int width width of image file
		 |		int height hight of image file
		 |		float *kernel  Gusian kernel used to blur image on GPU
		 |		int kernelSize Size of Gausian kernel
		 |		unsigned char* out buffer to store convoluted image data
		 |
         |  Returns:	unsigned char* returns pointer to convoluted image
         *-------------------------------------------------------------------*/

unsigned char* gpuFunction(unsigned char *data, int width, int height, float *kernel, int kernelSize, unsigned char* out){

					/*gausian kernel*/
					float *d_kernelForGpu;

					/*pointers to store image data before convolution*/
					unsigned char *d_redpixel;
					unsigned char *d_greenpixel;
					unsigned char *d_bluepixel;
					
					/*pointers to store image data after x convolution*/
					unsigned char *d_redpixelOp;
					unsigned char *d_greenpixelOp;
					unsigned char *d_bluepixelOp;

					/*pointers to store image data after y convolution*/
					unsigned char *d_redpixelOpy;
					unsigned char *d_greenpixelOpy;
					unsigned char *d_bluepixelOpy;

					/*pointer to input image data*/
					unsigned char *d_data;

					/*pointer to convoluted image*/
					unsigned char *d_out;
					
					/*gausian filter size*/
					int *d_kernelSizeX;

					/*image width and hight*/
					int *d_width;
					int *d_height;



		    		dim3 blocks( ((width / 32)+1), ( (height/32)+1));
					dim3 threads(32, 32); 

					HANDLE_ERROR(cudaMalloc((void**)&d_kernelForGpu, kernelSize*sizeof(float)));
					HANDLE_ERROR(cudaMemcpy(d_kernelForGpu, kernel, kernelSize*sizeof(float), cudaMemcpyHostToDevice));

					HANDLE_ERROR(cudaMalloc(&d_data, width*height*3*sizeof(unsigned char)));
					HANDLE_ERROR(cudaMemcpy(d_data, data, 3*width*height*sizeof(unsigned char), cudaMemcpyHostToDevice));

					HANDLE_ERROR(cudaMalloc(&d_out, width*height*3*sizeof(unsigned char)));

					
					HANDLE_ERROR(cudaMalloc((void**)&d_kernelSizeX, sizeof(int)));
					HANDLE_ERROR(cudaMemcpy(d_kernelSizeX, &kernelSize, sizeof(int), cudaMemcpyHostToDevice));

					HANDLE_ERROR(cudaMalloc((void**)&d_width, sizeof(int)));
					HANDLE_ERROR(cudaMemcpy(d_width, &width, sizeof(int), cudaMemcpyHostToDevice));

					HANDLE_ERROR(cudaMalloc((void**)&d_height, sizeof(int)));
					HANDLE_ERROR(cudaMemcpy(d_height, &height, sizeof(int), cudaMemcpyHostToDevice));


					
	
					unsigned char *redPixels = (unsigned char*)malloc((width*height*sizeof(unsigned char)));
					unsigned char *greenPixels = (unsigned char*)malloc((width*height*sizeof(unsigned char)));
					unsigned char *bluePixels = (unsigned char*)malloc((width*height*sizeof(unsigned char)));

					for(int i = 0; i < (width*height);i++ ){
						redPixels[i] = data[i*3+0];
						greenPixels[i] = data[i*3+1];
						bluePixels[i] = data[i*3+2];
					}					
					
					unsigned char *redPixelOp = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
					unsigned char *greenPixelOp = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
					unsigned char *bluePixelOp = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));

					for(int i = 0; i < (width*height); i++){
					redPixels[i] = data[i*3+0];
					greenPixels[i] = data[i*3+1];
					bluePixels[i] = data[i*3+2];
					}

					HANDLE_ERROR(cudaMalloc(&d_redpixel, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(cudaMalloc(&d_redpixelOp, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(cudaMalloc(&d_redpixelOpy, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(cudaMemcpy(d_redpixel, &redPixels, sizeof(int), cudaMemcpyHostToDevice));

					HANDLE_ERROR(cudaMalloc(&d_greenpixel, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(cudaMalloc(&d_greenpixelOp, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(cudaMalloc(&d_greenpixelOpy, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(cudaMemcpy(d_greenpixel, &greenPixels, sizeof(int), cudaMemcpyHostToDevice));

					HANDLE_ERROR(cudaMalloc(&d_bluepixel, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(cudaMalloc(&d_bluepixelOp, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(cudaMalloc(&d_bluepixelOpy, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(cudaMemcpy(d_bluepixel, &bluePixels, sizeof(int), cudaMemcpyHostToDevice));

	
					unsigned char *redPixelOpy = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
					unsigned char *greenPixelOpy = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
					unsigned char *bluePixelOpy = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));

					clock_t start = clock();
					
					/*Launch GPU kernels here*/
					gpuConvolution_x<<<blocks, threads>>>(d_kernelForGpu, d_kernelSizeX, d_width, d_height, d_redpixel, d_greenpixel, d_bluepixel, d_redpixelOp, d_greenpixelOp, d_bluepixelOp);

					gpuConvolution_y<<<blocks, threads>>>(d_kernelForGpu, d_kernelSizeX, d_width, d_height, d_redpixelOp, d_greenpixelOp, d_bluepixelOp, d_redpixelOpy, d_greenpixelOpy, d_bluepixelOpy, d_out);

					clock_t end = clock();

					/*profile convolution time here*/
					double elapsed_time = (end - start)/(double)CLOCKS_PER_SEC;
					printf("Convolution time on GPU is %lf fractional seconds\n", elapsed_time);
						

					HANDLE_ERROR(cudaMemcpy(redPixels, d_redpixelOp, width*height*sizeof(unsigned char), cudaMemcpyDeviceToHost));
					 HANDLE_ERROR(cudaMemcpy(greenPixels, d_greenpixelOp, width*height*sizeof(unsigned char), cudaMemcpyDeviceToHost));
					 HANDLE_ERROR(cudaMemcpy(bluePixels, d_bluepixelOp, width*height*sizeof(unsigned char), cudaMemcpyDeviceToHost));

					for(int k = 0; k < (width*height); k++) {
				                out[k*3+0]= redPixelOpy[k];
				                out[k*3+1]= greenPixelOpy[k];
				                out[k*3+2]= bluePixelOpy[k];
        				}

					/*File to store GPU convoluted image*/
					FILE *fp;
					fp = fopen("gpu_out.ppm", "wb");
					if(!fp) {
						exit(1);
					}
					fprintf(fp, "P6\n");
					fprintf(fp, "%d %d\n", width, height);
					fprintf(fp, "%d\n", RGB_COMPONENT_COLOR);
					fwrite(out, 3*width, height, fp);
					fclose(fp);
					
					cudaFree(kernel);
					cudaFree(d_kernelSizeX);
					cudaFree(d_data);
					cudaFree(d_out);
					cudaFree(d_redpixelOpy);
					cudaFree(d_greenpixelOpy);
					cudaFree(d_bluepixelOpy);
					cudaFree(d_redpixelOp);
					cudaFree(d_greenpixelOp);
					cudaFree(d_bluepixelOp);
					cudaFree(d_redpixel);
					cudaFree(d_greenpixel);
					cudaFree(d_bluepixel);
					return out;
}

/*------------------------------------------------- readPPM -----
         |  readPPM
         |
         |  Purpose:  This function is called by CPU and executed on CPU 
		 |			  This function reads the input image passed through 
		 |			  command line argument and stores the data in a buffer
         |
         |  Parameters: constant char* input image file passed through command line argument
         |      
         |  Returns:	unsigned char* returns pointer to input image
         *-------------------------------------------------------------------*/


static unsigned char *readPPM(const char *filename)
{
		 char buff[16];
         PPMImage *img;
         FILE *fp;
		 unsigned char *data;
		 int c, rgb_comp_color;
         

		 fp = fopen(filename, "rb");
        
		 if (!fp) {
              fprintf(stderr, "Unable to open file '%s'\n", filename);
              exit(1);
         }

		 if (!fgets(buff, sizeof(buff), fp)) {
              perror(filename);
              exit(1);
         }

		 if (buff[0] != 'P' || buff[1] != '6') {
			fprintf(stderr, "Invalid image format (must be 'P6')\n");
			exit(1);
		}

	    img = (PPMImage *)malloc(sizeof(PPMImage));
		if (!img) {
         fprintf(stderr, "Unable to allocate memory\n");
         exit(1);
		}

	    c = getc(fp);
		while (c == '#') {
			while (getc(fp) != '\n') ;
				c = getc(fp);
			}

		ungetc(c, fp);
			
		if (fscanf(fp, "%d %d", &img->x, &img->y) != 2) {
			 fprintf(stderr, "Invalid image size (error loading '%s')\n", filename);
			 exit(1);
		 }

		width = img->x;
		height = img->y;

    
		if (fscanf(fp, "%d", &rgb_comp_color) != 1) {
			 fprintf(stderr, "Invalid rgb component (error loading '%s')\n", filename);
			 exit(1);
		}

		if (rgb_comp_color!= RGB_COMPONENT_COLOR) {
			 fprintf(stderr, "'%s' does not have 8-bits components\n", filename);
			 exit(1);
		}

		while (fgetc(fp) != '\n') ;
    
		data = (unsigned char*)malloc(img->x * img->y * 3*sizeof(unsigned char));
		if (!data) {
			 fprintf(stderr, "Unable to allocate memory\n");
			 exit(1);
		}

		if (fread(data, 3 * img->x, img->y, fp));
		fclose(fp);
	
		
		return data;
	
}


/*------------------------------------------------- convolvePPM -----
         |  readPPM
         |
         |  Purpose:  This function is called by CPU and executed on CPU 
		 |			  This function does the convolution of input image 
		 |			  command line argument and stores the data in a buffer
         |
         |  Parameters: unsigned char *img: input image data
		 |				unsigned char *out: convoluted image data 
		 |				float kernel[]: gausian kernel for convolution
		 |				int kernelSizeX: size of gausian kernel
		 |				int kernelSizeY: size of gausian kernel
         |      
         |  Returns:	unsigned char* returns pointer to convoluted image
         *-------------------------------------------------------------------*/



unsigned char *convolvePPM(unsigned char *img, unsigned char *out, float kernel[], int kernelSizeX, int kernelSizeY)
{
		FILE *fp;
		
	
	unsigned char *redPixels = (unsigned char*)malloc((width*height*sizeof(unsigned char)));
	unsigned char *greenPixels = (unsigned char*)malloc((width*height*sizeof(unsigned char)));
	unsigned char *bluePixels = (unsigned char*)malloc((width*height*sizeof(unsigned char)));

	unsigned char *redPixelOp = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
	unsigned char *greenPixelOp = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
	unsigned char *bluePixelOp = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));

	
	unsigned char *redPixelOpy = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
	unsigned char *greenPixelOpy = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
	unsigned char *bluePixelOpy = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
	
	for(int i = 0; i < (width*height);i++ ){

		redPixels[i] = img[i*3+0];
		greenPixels[i] = img[i*3+1];
		bluePixels[i] = img[i*3+2];
	}

	
    fp = fopen("CPU_out.ppm", "wb");
    if (!fp) {
         
         exit(1);
    }

    fprintf(fp, "P6\n");
    fprintf(fp, "%d %d\n",width, height);

    fprintf(fp, "%d\n",RGB_COMPONENT_COLOR);

	out[0]=0;

	clock_t start = clock();
	
	for(int q = 0; q < height; q++)
	{
	for(int p = 0; p < width; p++)
	{
		
				if(p == 0 || p == 1 || q == 0 || q == 1)
				{
				}
				else {
				for(int r = 0; r < 5; r++)
				{
					redPixelOp[(q*width) + p] += (unsigned char)redPixels[(width*q)+(p+r-1)]*kernel[r];
					greenPixelOp[(q*width) + p] += (unsigned char)greenPixels[(width*q)+(p+r-1)]*kernel[r];
					bluePixelOp[(q*width)+p] += (unsigned char)bluePixels[(width*q)+(p+r-1)]*kernel[r];
				}

				for(int r = 0; r < 5; r++)
				{
					redPixelOpy[(q*width) + p] += (unsigned char)redPixelOp[p+(q+r-1)*width]*kernel[r];
					greenPixelOpy[(q*width) + p] += (unsigned char)greenPixelOp[p+(q+r-1)*width]*kernel[r];
					bluePixelOpy[(q*width)+p] += (unsigned char)bluePixelOp[p+(q+r-1)*width]*kernel[r];
				}
				}
	}
	}

	clock_t end = clock();
	double elapsed_time = (end - start)/(double)CLOCKS_PER_SEC;

	printf("Convolution time for CPU is %lf fractional seconds\n", elapsed_time);

	for(int k = 0; k < (width*height); k++) {
		out[k*3+0]= redPixelOpy[k];
		out[k*3+1]= greenPixelOpy[k];
		out[k*3+2]= bluePixelOpy[k];
	}

	 fwrite(out, 3 * width, height, fp);

    fclose(fp);

	return out;
}

/*------------------------------------------------- main -----
         |  main
         |
         |  Purpose:  This function is called by CPU and executed on CPU 
		 |			  This function erceives command line arguments, image file 
		 |			  name and the standard deviation
		 |			  Prepares gausian kernel and calls the convolution functions on CPU and GPU
         |
         |  Parameters: int argc: number of commandline arguments
		 |				argv[] : image file name and standard deviation
         |  Returns:	int 0 on success
         *-------------------------------------------------------------------*/

int main(int argc, char* argv[]) {	
	string filename = argv[1];
	unsigned char *image;
	unsigned char *outimageongpu;
	int sigma = atoi(argv[2]);	
	image = readPPM(filename.c_str());
	unsigned char *out = (unsigned char*)malloc(width * height * 3 * sizeof(unsigned char));
	float *gKernel = (float*)malloc(5 * sizeof(float));

	double s = 2.0 * sigma * sigma;
	double sum = 0.0;

	int p = 0;
	for(int x = -2; x <=2; x++)
   {
			gKernel[p] = (exp(-(x*x)/s))/(sqrt(M_PI * s));
			sum += gKernel[p];
			p++;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    }

	
    for(int i = 0; i < 5; i++) {
            gKernel[i] /= sum;
	
	}

	unsigned char *outimage = convolvePPM(image, out, gKernel, 5, 5);
	outimageongpu = (unsigned char*)malloc(width*height*3*sizeof(unsigned char));
	unsigned char *gpu_outimage = gpuFunction(image, width, height, gKernel, 5, outimageongpu);
}



	.file	"tmpxft_00265cc0_00000000-6_kernel.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3642:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3642:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/tejeswinijayaramareddy/2D-Convolution--CUDA/master/kernel.cu"
.LC1:
	.string	"%s in %s at line %d\n"
	.text
	.type	_ZL11HandleError9cudaErrorPKci.constprop.0, @function
_ZL11HandleError9cudaErrorPKci.constprop.0:
.LFB4294:
	.cfi_startproc
	testl	%edi, %edi
	je	.L2
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	%esi, 12(%rsp)
	call	cudaGetErrorString@PLT
	movl	12(%rsp), %r8d
	movl	$2, %edi
	leaq	.LC0(%rip), %rcx
	movq	%rax, %rdx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4294:
	.size	_ZL11HandleError9cudaErrorPKci.constprop.0, .-_ZL11HandleError9cudaErrorPKci.constprop.0
	.section	.rodata.str1.1
.LC2:
	.string	"wb"
.LC3:
	.string	"CPU_out.ppm"
.LC4:
	.string	"P6\n"
.LC5:
	.string	"%d %d\n"
.LC6:
	.string	"%d\n"
.LC8:
	.string	"Convolution time for CPU is %lf fractional seconds\n"
	.text
	.globl	_Z11convolvePPMPhS_Pfii
	.type	_Z11convolvePPMPhS_Pfii, @function
_Z11convolvePPMPhS_Pfii:
.LFB3638:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$168, %rsp
	.cfi_def_cfa_offset 224
	movl	_ZL5width(%rip), %ebp
	imull	_ZL6height(%rip), %ebp
	movq	%rsi, 16(%rsp)
	movslq	%ebp, %r12
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, 40(%rsp)
	call	malloc@PLT
	movq	%r12, %rdi
	leal	0(%rbp,%rbp,2), %r12d
	movslq	%r12d, %r12
	movq	%rax, 48(%rsp)
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, 56(%rsp)
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, 64(%rsp)
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, 72(%rsp)
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, 80(%rsp)
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, 88(%rsp)
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, 96(%rsp)
	call	malloc@PLT
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
.L9:
	cmpl	%eax, %ebp
	jle	.L24
	movb	(%rbx), %dl
	movq	40(%rsp), %rcx
	addq	$3, %rbx
	movb	%dl, (%rcx,%rax)
	movb	-2(%rbx), %dl
	movq	48(%rsp), %rcx
	movb	%dl, (%rcx,%rax)
	movb	-1(%rbx), %dl
	movq	56(%rsp), %rcx
	movb	%dl, (%rcx,%rax)
	incq	%rax
	jmp	.L9
.L24:
	leaq	.LC2(%rip), %rsi
	leaq	.LC3(%rip), %rdi
	call	fopen@PLT
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	jne	.L11
	movl	$1, %edi
	call	exit@PLT
.L11:
	movq	8(%rsp), %rdi
	leaq	.LC4(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	_ZL6height(%rip), %r8d
	xorl	%eax, %eax
	movl	_ZL5width(%rip), %ecx
	movq	8(%rsp), %rdi
	leaq	.LC5(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	8(%rsp), %rdi
	movl	$255, %ecx
	xorl	%eax, %eax
	leaq	.LC6(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	16(%rsp), %rax
	movb	$0, (%rax)
	call	clock@PLT
	movl	_ZL5width(%rip), %r14d
	movq	%rax, 120(%rsp)
	movl	_ZL6height(%rip), %eax
	movl	%eax, 116(%rsp)
	movl	%r14d, %eax
	negl	%eax
	movl	%eax, 112(%rsp)
	xorl	%eax, %eax
	movl	%eax, 28(%rsp)
	movl	%eax, 24(%rsp)
	movslq	%r14d, %rax
	movq	%rax, 152(%rsp)
.L12:
	movl	24(%rsp), %ecx
	cmpl	%ecx, 116(%rsp)
	jle	.L17
	movslq	112(%rsp), %rax
	movslq	28(%rsp), %rcx
	xorl	%r13d, %r13d
	movq	%rax, 144(%rsp)
.L18:
	movl	%r13d, %eax
	cmpl	%r13d, %r14d
	jle	.L25
	cmpl	$1, %r13d
	jbe	.L13
	cmpl	$1, 24(%rsp)
	jbe	.L13
	movl	28(%rsp), %ebx
	xorl	%edx, %edx
	addl	%ebx, %eax
	movq	64(%rsp), %rbx
	cltq
	leaq	(%rbx,%rax), %rbp
	movq	72(%rsp), %rbx
	movzbl	0(%rbp), %r8d
	leaq	(%rbx,%rax), %r11
	movq	80(%rsp), %rbx
	movzbl	(%r11), %edi
	leaq	(%rbx,%rax), %r9
	movq	40(%rsp), %rbx
	movzbl	(%r9), %esi
	addq	%rcx, %rbx
	movq	%rbx, 32(%rsp)
	movq	48(%rsp), %rbx
	addq	%rcx, %rbx
	movq	%rbx, 128(%rsp)
	movq	56(%rsp), %rbx
	addq	%rcx, %rbx
	movq	%rbx, 136(%rsp)
.L14:
	movq	32(%rsp), %rbx
	movss	(%r15,%rdx,4), %xmm1
	cvtsi2ssl	%r8d, %xmm2
	movzbl	-1(%rbx,%rdx), %r10d
	movq	128(%rsp), %rbx
	cvtsi2ssl	%r10d, %xmm0
	movzbl	-1(%rbx,%rdx), %r10d
	mulss	%xmm1, %xmm0
	addss	%xmm2, %xmm0
	cvtsi2ssl	%edi, %xmm2
	cvttss2sil	%xmm0, %r12d
	cvtsi2ssl	%r10d, %xmm0
	movq	136(%rsp), %r10
	movzbl	-1(%r10,%rdx), %r10d
	incq	%rdx
	movzbl	%r12b, %r8d
	mulss	%xmm1, %xmm0
	addss	%xmm2, %xmm0
	cvttss2sil	%xmm0, %ebx
	cvtsi2ssl	%r10d, %xmm0
	movzbl	%bl, %edi
	mulss	%xmm1, %xmm0
	cvtsi2ssl	%esi, %xmm1
	addss	%xmm1, %xmm0
	cvttss2sil	%xmm0, %r10d
	movzbl	%r10b, %esi
	cmpq	$5, %rdx
	jne	.L14
	movq	88(%rsp), %rsi
	movb	%r12b, 0(%rbp)
	movb	%bl, (%r11)
	leaq	(%rsi,%rax), %rbp
	movq	96(%rsp), %rsi
	movb	%r10b, (%r9)
	movzbl	0(%rbp), %r9d
	leaq	(%rsi,%rax), %r11
	movq	104(%rsp), %rsi
	movzbl	(%r11), %r8d
	addq	%rsi, %rax
	movq	144(%rsp), %rsi
	movq	%rax, 32(%rsp)
	movzbl	(%rax), %edi
	leaq	(%rsi,%r13), %rdx
	xorl	%esi, %esi
.L15:
	movq	64(%rsp), %rbx
	movss	(%r15,%rsi,4), %xmm1
	cvtsi2ssl	%r9d, %xmm2
	incq	%rsi
	movq	152(%rsp), %rax
	movzbl	(%rbx,%rdx), %r10d
	movq	72(%rsp), %rbx
	cvtsi2ssl	%r10d, %xmm0
	movzbl	(%rbx,%rdx), %r10d
	mulss	%xmm1, %xmm0
	addss	%xmm2, %xmm0
	cvtsi2ssl	%r8d, %xmm2
	cvttss2sil	%xmm0, %r12d
	cvtsi2ssl	%r10d, %xmm0
	movq	80(%rsp), %r10
	movzbl	(%r10,%rdx), %r10d
	addq	%rax, %rdx
	movzbl	%r12b, %r9d
	mulss	%xmm1, %xmm0
	addss	%xmm2, %xmm0
	cvttss2sil	%xmm0, %ebx
	cvtsi2ssl	%r10d, %xmm0
	movzbl	%bl, %r8d
	mulss	%xmm1, %xmm0
	cvtsi2ssl	%edi, %xmm1
	addss	%xmm1, %xmm0
	cvttss2sil	%xmm0, %r10d
	movzbl	%r10b, %edi
	cmpq	$5, %rsi
	jne	.L15
	movq	32(%rsp), %rax
	movb	%r12b, 0(%rbp)
	movb	%bl, (%r11)
	movb	%r10b, (%rax)
.L13:
	incq	%r13
	incq	%rcx
	jmp	.L18
.L25:
	incl	24(%rsp)
	addl	%r14d, 28(%rsp)
	addl	%r14d, 112(%rsp)
	jmp	.L12
.L17:
	call	clock@PLT
	movq	120(%rsp), %rcx
	movl	$2, %edi
	leaq	.LC8(%rip), %rsi
	subq	%rcx, %rax
	cvtsi2sdq	%rax, %xmm0
	movb	$1, %al
	divsd	.LC7(%rip), %xmm0
	call	__printf_chk@PLT
	movl	_ZL5width(%rip), %esi
	movslq	_ZL6height(%rip), %rdx
	xorl	%eax, %eax
	movq	16(%rsp), %rcx
	movl	%esi, %edi
	imull	%edx, %edi
.L19:
	cmpl	%eax, %edi
	jle	.L26
	movq	88(%rsp), %rbx
	addq	$3, %rcx
	movb	(%rbx,%rax), %r8b
	movq	96(%rsp), %rbx
	movb	%r8b, -3(%rcx)
	movb	(%rbx,%rax), %r8b
	movq	104(%rsp), %rbx
	movb	%r8b, -2(%rcx)
	movb	(%rbx,%rax), %r8b
	incq	%rax
	movb	%r8b, -1(%rcx)
	jmp	.L19
.L26:
	movq	8(%rsp), %rcx
	movq	16(%rsp), %rdi
	leal	(%rsi,%rsi,2), %esi
	movslq	%esi, %rsi
	call	fwrite@PLT
	movq	8(%rsp), %rdi
	call	fclose@PLT
	movq	16(%rsp), %rax
	addq	$168, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3638:
	.size	_Z11convolvePPMPhS_Pfii, .-_Z11convolvePPMPhS_Pfii
	.globl	_Z61__device_stub__Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_
	.type	_Z61__device_stub__Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_, @function
_Z61__device_stub__Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_:
.LFB3664:
	.cfi_startproc
	endbr64
	subq	$248, %rsp
	.cfi_def_cfa_offset 256
	movq	256(%rsp), %rax
	movq	%rdi, 72(%rsp)
	leaq	104(%rsp), %rdi
	movq	%rsi, 64(%rsp)
	leaq	116(%rsp), %rsi
	movq	%rax, 24(%rsp)
	movq	264(%rsp), %rax
	movq	%rdx, 56(%rsp)
	leaq	88(%rsp), %rdx
	movq	%rax, 16(%rsp)
	movq	272(%rsp), %rax
	movq	%rcx, 48(%rsp)
	leaq	96(%rsp), %rcx
	movq	%rax, 8(%rsp)
	movq	280(%rsp), %rax
	movq	%r8, 40(%rsp)
	movq	%r9, 32(%rsp)
	movq	%rax, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 232(%rsp)
	xorl	%eax, %eax
	leaq	72(%rsp), %rax
	movl	$1, 112(%rsp)
	movq	%rax, 152(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 192(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 200(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 208(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 216(%rsp)
	movq	%rsp, %rax
	movq	%rax, 224(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 104(%rsp)
	movq	%rax, 116(%rsp)
	movl	$1, 124(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L27
	pushq	96(%rsp)
	.cfi_def_cfa_offset 264
	leaq	_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_(%rip), %rdi
	pushq	96(%rsp)
	.cfi_def_cfa_offset 272
	movq	132(%rsp), %rcx
	movl	140(%rsp), %r8d
	movq	120(%rsp), %rsi
	movl	128(%rsp), %edx
	leaq	168(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 264
	popq	%rdx
	.cfi_def_cfa_offset 256
.L27:
	movq	232(%rsp), %rax
	subq	%fs:40, %rax
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	addq	$248, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3664:
	.size	_Z61__device_stub__Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_, .-_Z61__device_stub__Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_
	.globl	_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	.type	_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_, @function
_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_:
.LFB3665:
	.cfi_startproc
	endbr64
	jmp	_Z61__device_stub__Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_
	.cfi_endproc
.LFE3665:
	.size	_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_, .-_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	.globl	_Z64__device_stub__Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	.type	_Z64__device_stub__Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_S1_, @function
_Z64__device_stub__Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_S1_:
.LFB3666:
	.cfi_startproc
	endbr64
	subq	$264, %rsp
	.cfi_def_cfa_offset 272
	movq	272(%rsp), %rax
	movq	%rdi, 88(%rsp)
	leaq	112(%rsp), %rdi
	movq	%rsi, 80(%rsp)
	leaq	124(%rsp), %rsi
	movq	%rax, 40(%rsp)
	movq	280(%rsp), %rax
	movq	%rdx, 72(%rsp)
	leaq	96(%rsp), %rdx
	movq	%rax, 32(%rsp)
	movq	288(%rsp), %rax
	movq	%rcx, 64(%rsp)
	leaq	104(%rsp), %rcx
	movq	%rax, 24(%rsp)
	movq	296(%rsp), %rax
	movq	%r8, 56(%rsp)
	movq	%rax, 16(%rsp)
	movq	304(%rsp), %rax
	movq	%r9, 48(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 248(%rsp)
	xorl	%eax, %eax
	leaq	88(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	80(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	72(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 192(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 200(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 208(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 216(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 224(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 232(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 240(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 112(%rsp)
	movl	$1, 120(%rsp)
	movq	%rax, 124(%rsp)
	movl	$1, 132(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L32
	pushq	104(%rsp)
	.cfi_def_cfa_offset 280
	leaq	_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_(%rip), %rdi
	pushq	104(%rsp)
	.cfi_def_cfa_offset 288
	movq	140(%rsp), %rcx
	movl	148(%rsp), %r8d
	movq	128(%rsp), %rsi
	movl	136(%rsp), %edx
	leaq	176(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 280
	popq	%rdx
	.cfi_def_cfa_offset 272
.L32:
	movq	248(%rsp), %rax
	subq	%fs:40, %rax
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	addq	$264, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3666:
	.size	_Z64__device_stub__Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_S1_, .-_Z64__device_stub__Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	.globl	_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	.type	_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_, @function
_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_:
.LFB3667:
	.cfi_startproc
	endbr64
	jmp	_Z64__device_stub__Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	.cfi_endproc
.LFE3667:
	.size	_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_, .-_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	.section	.rodata.str1.1
.LC9:
	.string	"Convolution time on GPU is %lf fractional seconds\n"
.LC10:
	.string	"gpu_out.ppm"
	.text
	.globl	_Z11gpuFunctionPhiiPfiS_
	.type	_Z11gpuFunctionPhiiPfiS_, @function
_Z11gpuFunctionPhiiPfiS_:
.LFB3636:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edx, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rcx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r9, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	movl	%esi, %edi
	subq	$200, %rsp
	.cfi_def_cfa_offset 256
	movl	%r8d, 4(%rsp)
	movl	%esi, 12(%rsp)
	movl	$32, %esi
	movl	%edx, 8(%rsp)
	movq	%fs:40, %rdx
	movq	%rdx, 184(%rsp)
	xorl	%edx, %edx
	cltd
	movl	$1, 168(%rsp)
	idivl	%esi
	movl	$1, 180(%rsp)
	leal	1(%rax), %ecx
	movl	%edi, %eax
	leaq	16(%rsp), %rdi
	cltd
	movl	%ecx, 164(%rsp)
	idivl	%esi
	movslq	%r8d, %rsi
	salq	$2, %rsi
	incl	%eax
	movl	%eax, 160(%rsp)
	movabsq	$137438953504, %rax
	movq	%rax, 172(%rsp)
	call	cudaMalloc@PLT
	movl	$231, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movslq	4(%rsp), %rdx
	movq	16(%rsp), %rdi
	movq	%r13, %rsi
	movl	$1, %ecx
	salq	$2, %rdx
	call	cudaMemcpy@PLT
	movl	$232, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %esi
	imull	8(%rsp), %esi
	leaq	96(%rsp), %rdi
	leal	(%rsi,%rsi,2), %esi
	movslq	%esi, %rsi
	call	cudaMalloc@PLT
	movl	$234, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %edx
	imull	8(%rsp), %edx
	movq	%rbx, %rsi
	movq	96(%rsp), %rdi
	movl	$1, %ecx
	leal	(%rdx,%rdx,2), %edx
	movslq	%edx, %rdx
	call	cudaMemcpy@PLT
	movl	$235, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %esi
	imull	8(%rsp), %esi
	leaq	104(%rsp), %rdi
	leal	(%rsi,%rsi,2), %esi
	movslq	%esi, %rsi
	call	cudaMalloc@PLT
	movl	$237, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	leaq	112(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	$240, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movq	112(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	leaq	4(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	$241, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	leaq	120(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	$243, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movq	120(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	leaq	12(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	$244, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	leaq	128(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	$246, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	$4, %edx
	movl	$1, %ecx
	movq	128(%rsp), %rdi
	leaq	8(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	$247, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %ebp
	imull	8(%rsp), %ebp
	movslq	%ebp, %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, 136(%rsp)
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, 144(%rsp)
	call	malloc@PLT
	movq	%rbx, %rdx
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
.L38:
	movl	12(%rsp), %ecx
	imull	8(%rsp), %ecx
	cmpl	%eax, %ecx
	jle	.L49
	movb	(%rdx), %sil
	movq	136(%rsp), %rcx
	addq	$3, %rdx
	movb	%sil, (%rcx,%rax)
	movb	-2(%rdx), %sil
	movq	144(%rsp), %rcx
	movb	%sil, (%rcx,%rax)
	movb	-1(%rdx), %sil
	movq	152(%rsp), %rcx
	movb	%sil, (%rcx,%rax)
	incq	%rax
	jmp	.L38
.L49:
	xorl	%eax, %eax
.L40:
	movl	12(%rsp), %esi
	imull	8(%rsp), %esi
	cmpl	%eax, %esi
	jle	.L50
	movb	(%rbx), %cl
	movq	136(%rsp), %rdx
	addq	$3, %rbx
	movb	%cl, (%rdx,%rax)
	movb	-2(%rbx), %cl
	movq	144(%rsp), %rdx
	movb	%cl, (%rdx,%rax)
	movb	-1(%rbx), %cl
	movq	152(%rsp), %rdx
	movb	%cl, (%rdx,%rax)
	incq	%rax
	jmp	.L40
.L50:
	movslq	%esi, %rsi
	leaq	24(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$272, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %esi
	imull	8(%rsp), %esi
	leaq	48(%rsp), %rdi
	movslq	%esi, %rsi
	call	cudaMalloc@PLT
	movl	$273, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %esi
	imull	8(%rsp), %esi
	leaq	72(%rsp), %rdi
	movslq	%esi, %rsi
	call	cudaMalloc@PLT
	movl	$274, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	leaq	136(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	$275, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %esi
	imull	8(%rsp), %esi
	leaq	32(%rsp), %rdi
	movslq	%esi, %rsi
	call	cudaMalloc@PLT
	movl	$277, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %esi
	imull	8(%rsp), %esi
	leaq	56(%rsp), %rdi
	movslq	%esi, %rsi
	call	cudaMalloc@PLT
	movl	$278, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %esi
	imull	8(%rsp), %esi
	leaq	80(%rsp), %rdi
	movslq	%esi, %rsi
	call	cudaMalloc@PLT
	movl	$279, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movq	32(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	leaq	144(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	$280, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %esi
	imull	8(%rsp), %esi
	leaq	40(%rsp), %rdi
	movslq	%esi, %rsi
	call	cudaMalloc@PLT
	movl	$282, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %esi
	imull	8(%rsp), %esi
	leaq	64(%rsp), %rdi
	movslq	%esi, %rsi
	call	cudaMalloc@PLT
	movl	$283, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %esi
	imull	8(%rsp), %esi
	leaq	88(%rsp), %rdi
	movslq	%esi, %rsi
	call	cudaMalloc@PLT
	movl	$284, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movq	40(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	leaq	152(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	$285, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %ebx
	imull	8(%rsp), %ebx
	leal	(%rbx,%rbx,2), %ebx
	movslq	%ebx, %rbx
	movq	%rbx, %rdi
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, %r14
	call	malloc@PLT
	movq	%rax, %rbx
	call	clock@PLT
	movl	180(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	172(%rsp), %rdx
	movq	160(%rsp), %rdi
	movl	168(%rsp), %esi
	xorl	%r8d, %r8d
	movq	%rax, %r15
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L42
	pushq	64(%rsp)
	.cfi_def_cfa_offset 264
	pushq	64(%rsp)
	.cfi_def_cfa_offset 272
	pushq	64(%rsp)
	.cfi_def_cfa_offset 280
	pushq	64(%rsp)
	.cfi_def_cfa_offset 288
	movq	64(%rsp), %r9
	movq	56(%rsp), %r8
	movq	160(%rsp), %rcx
	movq	152(%rsp), %rdx
	movq	144(%rsp), %rsi
	movq	48(%rsp), %rdi
	call	_Z61__device_stub__Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_
	addq	$32, %rsp
	.cfi_def_cfa_offset 256
.L42:
	movl	180(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	172(%rsp), %rdx
	movq	160(%rsp), %rdi
	movl	168(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L43
	pushq	%rax
	.cfi_def_cfa_offset 264
	pushq	112(%rsp)
	.cfi_def_cfa_offset 272
	pushq	104(%rsp)
	.cfi_def_cfa_offset 280
	pushq	104(%rsp)
	.cfi_def_cfa_offset 288
	pushq	104(%rsp)
	.cfi_def_cfa_offset 296
	pushq	104(%rsp)
	.cfi_def_cfa_offset 304
	movq	104(%rsp), %r9
	movq	96(%rsp), %r8
	movq	176(%rsp), %rcx
	movq	168(%rsp), %rdx
	movq	160(%rsp), %rsi
	movq	64(%rsp), %rdi
	call	_Z64__device_stub__Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_PfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	addq	$48, %rsp
	.cfi_def_cfa_offset 256
.L43:
	call	clock@PLT
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	subq	%r15, %rax
	cvtsi2sdq	%rax, %xmm0
	movb	$1, %al
	divsd	.LC7(%rip), %xmm0
	call	__printf_chk@PLT
	movl	12(%rsp), %edx
	imull	8(%rsp), %edx
	movl	$2, %ecx
	movq	48(%rsp), %rsi
	movq	136(%rsp), %rdi
	movslq	%edx, %rdx
	call	cudaMemcpy@PLT
	movl	$306, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %edx
	imull	8(%rsp), %edx
	movl	$2, %ecx
	movq	56(%rsp), %rsi
	movq	144(%rsp), %rdi
	movslq	%edx, %rdx
	call	cudaMemcpy@PLT
	movl	$307, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %edx
	imull	8(%rsp), %edx
	movl	$2, %ecx
	movq	64(%rsp), %rsi
	movq	152(%rsp), %rdi
	movslq	%edx, %rdx
	call	cudaMemcpy@PLT
	movl	$308, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movl	12(%rsp), %ecx
	imull	8(%rsp), %ecx
	xorl	%eax, %eax
	movq	%r12, %rdx
.L44:
	cmpl	%eax, %ecx
	jle	.L51
	movb	0(%rbp,%rax), %sil
	addq	$3, %rdx
	movb	%sil, -3(%rdx)
	movb	(%r14,%rax), %sil
	movb	%sil, -2(%rdx)
	movb	(%rbx,%rax), %sil
	incq	%rax
	movb	%sil, -1(%rdx)
	jmp	.L44
.L51:
	leaq	.LC2(%rip), %rsi
	leaq	.LC10(%rip), %rdi
	call	fopen@PLT
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	.L46
	movl	$1, %edi
	call	exit@PLT
.L46:
	movq	%rax, %rdi
	leaq	.LC4(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	8(%rsp), %r8d
	movl	12(%rsp), %ecx
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rdx
	movl	$2, %esi
	movq	%rbx, %rdi
	call	__fprintf_chk@PLT
	movl	$255, %ecx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	leaq	.LC6(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	imull	$3, 12(%rsp), %esi
	movq	%rbx, %rcx
	movq	%r12, %rdi
	movslq	8(%rsp), %rdx
	movslq	%esi, %rsi
	call	fwrite@PLT
	movq	%rbx, %rdi
	call	fclose@PLT
	movq	%r13, %rdi
	call	cudaFree@PLT
	movq	112(%rsp), %rdi
	call	cudaFree@PLT
	movq	96(%rsp), %rdi
	call	cudaFree@PLT
	movq	104(%rsp), %rdi
	call	cudaFree@PLT
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L47
	call	__stack_chk_fail@PLT
.L47:
	addq	$200, %rsp
	.cfi_def_cfa_offset 56
	movq	%r12, %rax
	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
.LFE3636:
	.size	_Z11gpuFunctionPhiiPfiS_, .-_Z11gpuFunctionPhiiPfiS_
	.section	.rodata.str1.1
.LC12:
	.string	"basic_string: construction from null is not valid"
.LC13:
	.string	"rb"
.LC14:
	.string	"Unable to open file '%s'\n"
.LC15:
	.string	"Invalid image format (must be 'P6')\n"
.LC16:
	.string	"Unable to allocate memory\n"
.LC17:
	.string	"%d %d"
.LC18:
	.string	"Invalid image size (error loading '%s')\n"
.LC19:
	.string	"%d"
.LC20:
	.string	"Invalid rgb component (error loading '%s')\n"
.LC21:
	.string	"'%s' does not have 8-bits components\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3639:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3639
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	8(%rsi), %rbp
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 40(%rsp)
	testq	%rbp, %rbp
	jne	.L53
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L81
	leaq	.LC12(%rip), %rdi
.LEHB0:
	call	_ZSt19__throw_logic_errorPKc@PLT
.L53:
	movq	%rbp, %rdi
	movq	%rsi, %rbx
	call	strlen@PLT
	movq	%rax, 32(%rsp)
	leaq	0(%rbp,%rax), %r12
	cmpq	$15, %rax
	jbe	.L55
	movq	8(%rsp), %rdi
	leaq	32(%rsp), %rsi
	xorl	%edx, %edx
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
.LEHE0:
	movq	%rax, 40(%rsp)
	movq	32(%rsp), %rax
	movq	%rax, 56(%rsp)
.L55:
	movq	40(%rsp), %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	32(%rsp), %rax
	movq	40(%rsp), %rdx
	movq	%rax, 48(%rsp)
	movb	$0, (%rdx,%rax)
	movq	16(%rbx), %rdi
	call	atoi@PLT
	movq	40(%rsp), %r12
	leaq	.LC13(%rip), %rsi
	movl	%eax, %r15d
	movq	%r12, %rdi
.LEHB1:
	call	fopen@PLT
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	.L56
	movq	%r12, %rcx
	leaq	.LC14(%rip), %rdx
.L84:
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L58:
	movl	$1, %edi
	call	exit@PLT
.L56:
	leaq	72(%rsp), %rdi
	movq	%rax, %rcx
	movl	$16, %edx
	movl	$16, %esi
	call	__fgets_chk@PLT
	testq	%rax, %rax
	jne	.L57
	movq	%r12, %rdi
	call	perror@PLT
	jmp	.L58
.L57:
	cmpb	$80, 72(%rsp)
	jne	.L59
	cmpb	$54, 73(%rsp)
	je	.L60
.L59:
	leaq	.LC15(%rip), %rdx
	jmp	.L86
.L60:
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, %rbp
	testq	%rax, %rax
	jne	.L92
.L88:
	leaq	.LC16(%rip), %rdx
.L86:
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	jmp	.L58
.L95:
	cmpl	$35, %eax
	jne	.L94
.L63:
	movq	%rbx, %rdi
	call	getc@PLT
	cmpl	$10, %eax
	jne	.L63
.L92:
	movq	%rbx, %rdi
	call	getc@PLT
	jmp	.L95
.L94:
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	ungetc@PLT
	leaq	4(%rbp), %rcx
	movq	%rbp, %rdx
	leaq	.LC17(%rip), %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	__isoc23_fscanf@PLT
	movq	%r12, %rcx
	leaq	.LC18(%rip), %rdx
	cmpl	$2, %eax
	jne	.L84
	movl	0(%rbp), %eax
	leaq	32(%rsp), %rdx
	leaq	.LC19(%rip), %rsi
	movq	%rbx, %rdi
	movl	%eax, _ZL5width(%rip)
	movl	4(%rbp), %eax
	movl	%eax, _ZL6height(%rip)
	xorl	%eax, %eax
	call	__isoc23_fscanf@PLT
	decl	%eax
	movq	%r12, %rcx
	leaq	.LC20(%rip), %rdx
	jne	.L84
	cmpl	$255, 32(%rsp)
	leaq	.LC21(%rip), %rdx
	jne	.L84
.L66:
	movq	%rbx, %rdi
	call	fgetc@PLT
	cmpl	$10, %eax
	jne	.L66
	movl	0(%rbp), %r14d
	movl	4(%rbp), %r13d
	movl	%r14d, %ebp
	imull	%r13d, %ebp
	leal	0(%rbp,%rbp,2), %ebp
	movslq	%ebp, %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rax, %r12
	testq	%rax, %rax
	je	.L88
	leal	(%r14,%r14,2), %edx
	movslq	%r13d, %rcx
	movq	%rbx, %r8
	movq	%rbp, %rsi
	movslq	%edx, %rdx
	movq	%rax, %rdi
	call	__fread_chk@PLT
	movq	%rbx, %rdi
	call	fclose@PLT
	movl	_ZL5width(%rip), %edi
	imull	_ZL6height(%rip), %edi
	leal	(%rdi,%rdi,2), %edi
	movslq	%edi, %rdi
	call	malloc@PLT
	movl	$20, %edi
	movq	%rax, %r14
	call	malloc@PLT
	cvtsi2sdl	%r15d, %xmm0
	xorl	%r15d, %r15d
	movq	%rax, %rbp
	movaps	%xmm0, %xmm1
	addsd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	movsd	%xmm1, 16(%rsp)
	xorps	%xmm1, %xmm1
.L68:
	leal	-2(%r15), %eax
	movsd	%xmm1, 24(%rsp)
	imull	%eax, %eax
	negl	%eax
	cvtsi2sdl	%eax, %xmm0
	divsd	16(%rsp), %xmm0
	call	exp@PLT
	movq	%xmm0, %rbx
	movsd	.LC22(%rip), %xmm0
	mulsd	16(%rsp), %xmm0
	call	sqrt@PLT
	movsd	24(%rsp), %xmm1
	movaps	%xmm0, %xmm2
	movq	%rbx, %xmm0
	divsd	%xmm2, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, 0(%rbp,%r15,4)
	incq	%r15
	cvtss2sd	%xmm0, %xmm0
	addsd	%xmm0, %xmm1
	cmpq	$5, %r15
	jne	.L68
	xorl	%eax, %eax
.L69:
	cvtss2sd	0(%rbp,%rax,4), %xmm0
	divsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, 0(%rbp,%rax,4)
	incq	%rax
	cmpq	$5, %rax
	jne	.L69
	movl	$5, %r8d
	movq	%rbp, %rdx
	movq	%r14, %rsi
	movq	%r12, %rdi
	movl	$5, %ecx
	call	_Z11convolvePPMPhS_Pfii
	movl	_ZL5width(%rip), %ebx
	movl	_ZL6height(%rip), %r14d
	movl	%ebx, %edi
	imull	%r14d, %edi
	leal	(%rdi,%rdi,2), %edi
	movslq	%edi, %rdi
	call	malloc@PLT
	movl	$5, %r8d
	movq	%rbp, %rcx
	movl	%ebx, %esi
	movq	%rax, %r9
	movl	%r14d, %edx
	movq	%r12, %rdi
	call	_Z11gpuFunctionPhiiPfiS_
.LEHE1:
	movq	8(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L72
	jmp	.L81
.L73:
	endbr64
	movq	%rax, %rbx
.L70:
	movq	8(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L81
	movq	%rbx, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L81:
	call	__stack_chk_fail@PLT
.L72:
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3639:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3639:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3639-.LLSDACSB3639
.LLSDACSB3639:
	.uleb128 .LEHB0-.LFB3639
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3639
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L73-.LFB3639
	.uleb128 0
	.uleb128 .LEHB2-.LFB3639
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE3639:
	.section	.text.startup
	.size	main, .-main
	.section	.rodata.str1.1
.LC23:
	.string	"_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_"
.LC24:
	.string	"_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3669:
	.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	.LC23(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_(%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	.LC24(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3669:
	.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	_ZL6height
	.comm	_ZL6height,4,4
	.local	_ZL5width
	.comm	_ZL5width,4,4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC7:
	.long	0
	.long	1093567616
	.align 8
.LC22:
	.long	1413754136
	.long	1074340347
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.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:

/*
 * Author: Tejeswini
 * Purpose: 2D convolution of image on CPU and GPU
 */

#include <iostream>
#include <stdio.h>
#include "hip/hip_runtime.h"


#define _USE_MATH_DEFINES
#include <math.h>
#include <time.h>
#include <string>
#include <cstring>

#define _CRT_SECURE_NO_DEPRECATE

using namespace std;

#define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ ))

#define RGB_COMPONENT_COLOR 255
static int width= 0;
static int height = 0;

/*------------------------------------------------- PPMPixel -----------------
         | Structure- to store image data
         *-------------------------------------------------------------------*/
typedef struct {
     unsigned char red,green,blue;
} PPMPixel;

/*------------------------------------------------- PPMImage -----------------
         | Structure- to store image dimension and data
         *-------------------------------------------------------------------*/

typedef struct {
     int x, y;
     PPMPixel *data;
} PPMImage;

 /*------------------------------------------------- HandleError -----
         |  Function HandleError
         |
         |  Purpose:  This functions checks the status of CUDA APIs 
         |
         |  Parameters:
         |      cudaError_t	 Error Status
		 |		const char *file A file pointer,
		 |		int line where the errror occured
		 |
         |  Returns:	Void
         *-------------------------------------------------------------------*/

static void HandleError( hipError_t err,
                         const char *file,
                         int line ) {
    if (err != hipSuccess) {
        printf( "%s in %s at line %d\n", hipGetErrorString( err ), file, line );
        exit( EXIT_FAILURE );
    }
}


/*------------------------------------------------- gpuConvolution_x -----
         |  gpuConvolution_x
         |
         |  Purpose:  This function is called by CPU and executed on GPU 
		 |			  This function is to compute the Convolution of image pixels along x axis on GPU
         |
         |  Parameters:
         |      float *kernel Gausian kernel used to blur the image
		 |		int *kernelSizeX Gausian kernel size
		 |		int *width image width
		 |		int *height image hight
		 |		unsigned char* redPixels pointerto buffer storing redPixels
		 |		unsigned char* greenPixels pointer to buffer storing green pixels
		 |		unsigned char* bluePixelOp  pointer to buffer storing convoluted bluepixels
		 |		unsigned char* greenPixelOp pointer to buffer storing convoluted green pixels
		 |		unsigned char* bluePixelOp  pointer to buffer storing  convoluted bluepixels
		 |
		 |
         |  Returns:	Void
         *-------------------------------------------------------------------*/


__global__ void gpuConvolution_x(float *kernel, int *kernelSizeX,  int *width, int *height, unsigned char* redPixels, unsigned char* greenPixels, unsigned char* bluePixels, unsigned char* redPixelsOp, unsigned char* greenPixelsOp, unsigned char* bluePixelsOp) {
	int i = blockIdx.x * blockDim.x + threadIdx.x;
	int j = blockIdx.y * blockDim.y + threadIdx.y;

	if(i > (*width) || j > (*height)) return; 

//	for(int j = 0; j < (*height); j++)
//	{
//	for(int i = 0; i < (*width); i++)
//	{
		
				if(i == 0 || i == 1 || i == 0 || i == 1)
				{
				}
				else {
				/*convolute red, green and blue pixels seperately with gausian kernel along x direction*/
				for(int r = 0; r < 5; r++)
				{
					redPixelsOp[(j*(*width)) + i] += (unsigned char)redPixels[((*width)*j)+(i+r-1)]*kernel[r];
					greenPixelsOp[(j*(*width)) + i] += (unsigned char)greenPixels[((*width)*j)+(i+r-1)]*kernel[r];
					bluePixelsOp[(j*(*width))+i] += (unsigned char)bluePixels[((*width)*j)+(i+r-1)]*kernel[r];
				}

		}
	
	/*wait for all threads to complete*/
	__syncthreads();
//	}
//	}

}


/*------------------------------------------------- gpuConvolution_y -----
         |  gpuConvolution_y
         |
         |  Purpose:  This function is called by CPU and executed on GPU 
		 |			  This function is to compute the Convolution of image pixels along y axis on GPU
         |
         |  Parameters:
         |      float *kernel Gausian kernel used to blur the image
		 |		int *kernelSizeX Gausian kernel size
		 |		int *width image width
		 |		int *height image hight
		 |		unsigned char* redPixelsOp pointerto buffer storing redPixels along x axis
		 |		unsigned char* greenPixelsOp pointer to buffer storing green pixels along x axis
		 |		unsigned char* bluePixelOpy  pointer to buffer storing convoluted bluepixels along y axis
		 |		unsigned char* greenPixelOpy pointer to buffer storing convoluted green pixels along y axis
		 |		unsigned char* bluePixelOpy  pointer to buffer storing  convoluted bluepixels along y axis
		 |
		 |
         |  Returns:	Void
         *-------------------------------------------------------------------*/

__global__ void gpuConvolution_y(float *kernel, int *kernelSizeX,  int *width, int *height, unsigned char *redPixelsOp, unsigned char *greenPixelsOp, unsigned char *bluePixelsOp, unsigned char *redPixelsOpy, unsigned char *greenPixelsOpy, unsigned char *bluePixelsOpy, unsigned char *out) {
	int i = blockIdx.x * blockDim.x + threadIdx.x;
	int j = blockIdx.y * blockDim.y + threadIdx.y;

	if(i > (*width) || j > (*height)) return; 

//	for(int j = 0; j < (*height); j++)
//	{
//	for(int i = 0; i < (*width); i++)
//	{
		
				if(i == 0 || i == 1 || i == 0 || i == 1)
				{
				}
				else {
					/*convolute red, green and blue pixels seperately with gausian kernel along Y direction*/
					for(int r = 0; r < 5; r++)
						{
							redPixelsOpy[(j*(*width)) + i] += (unsigned char)redPixelsOp[i+(j+r-1)*(*width)]*kernel[r];
							greenPixelsOpy[(j*(*width)) + i] += (unsigned char)greenPixelsOp[i+(j+r-1)*(*width)]*kernel[r];
							bluePixelsOpy[(j*(*width))+i] += (unsigned char)bluePixelsOp[i+(j+r-1)*(*width)]*kernel[r];
						}

			}

		/*wait for all threads to complete*/
		__syncthreads();	


		//}
	//}

}

/*------------------------------------------------- gpuFunction -----
         |  gpuFunction
         |
         |  Purpose:  This function is called by CPU and executed on CPU 
		 |			  This function allocates memory on GPU device and launches GPU kernels
         |
         |  Parameters:
         |      unsigned char *data input image data
		 |		int width width of image file
		 |		int height hight of image file
		 |		float *kernel  Gusian kernel used to blur image on GPU
		 |		int kernelSize Size of Gausian kernel
		 |		unsigned char* out buffer to store convoluted image data
		 |
         |  Returns:	unsigned char* returns pointer to convoluted image
         *-------------------------------------------------------------------*/

unsigned char* gpuFunction(unsigned char *data, int width, int height, float *kernel, int kernelSize, unsigned char* out){

					/*gausian kernel*/
					float *d_kernelForGpu;

					/*pointers to store image data before convolution*/
					unsigned char *d_redpixel;
					unsigned char *d_greenpixel;
					unsigned char *d_bluepixel;
					
					/*pointers to store image data after x convolution*/
					unsigned char *d_redpixelOp;
					unsigned char *d_greenpixelOp;
					unsigned char *d_bluepixelOp;

					/*pointers to store image data after y convolution*/
					unsigned char *d_redpixelOpy;
					unsigned char *d_greenpixelOpy;
					unsigned char *d_bluepixelOpy;

					/*pointer to input image data*/
					unsigned char *d_data;

					/*pointer to convoluted image*/
					unsigned char *d_out;
					
					/*gausian filter size*/
					int *d_kernelSizeX;

					/*image width and hight*/
					int *d_width;
					int *d_height;



		    		dim3 blocks( ((width / 32)+1), ( (height/32)+1));
					dim3 threads(32, 32); 

					HANDLE_ERROR(hipMalloc((void**)&d_kernelForGpu, kernelSize*sizeof(float)));
					HANDLE_ERROR(hipMemcpy(d_kernelForGpu, kernel, kernelSize*sizeof(float), hipMemcpyHostToDevice));

					HANDLE_ERROR(hipMalloc(&d_data, width*height*3*sizeof(unsigned char)));
					HANDLE_ERROR(hipMemcpy(d_data, data, 3*width*height*sizeof(unsigned char), hipMemcpyHostToDevice));

					HANDLE_ERROR(hipMalloc(&d_out, width*height*3*sizeof(unsigned char)));

					
					HANDLE_ERROR(hipMalloc((void**)&d_kernelSizeX, sizeof(int)));
					HANDLE_ERROR(hipMemcpy(d_kernelSizeX, &kernelSize, sizeof(int), hipMemcpyHostToDevice));

					HANDLE_ERROR(hipMalloc((void**)&d_width, sizeof(int)));
					HANDLE_ERROR(hipMemcpy(d_width, &width, sizeof(int), hipMemcpyHostToDevice));

					HANDLE_ERROR(hipMalloc((void**)&d_height, sizeof(int)));
					HANDLE_ERROR(hipMemcpy(d_height, &height, sizeof(int), hipMemcpyHostToDevice));


					
	
					unsigned char *redPixels = (unsigned char*)malloc((width*height*sizeof(unsigned char)));
					unsigned char *greenPixels = (unsigned char*)malloc((width*height*sizeof(unsigned char)));
					unsigned char *bluePixels = (unsigned char*)malloc((width*height*sizeof(unsigned char)));

					for(int i = 0; i < (width*height);i++ ){
						redPixels[i] = data[i*3+0];
						greenPixels[i] = data[i*3+1];
						bluePixels[i] = data[i*3+2];
					}					
					
					unsigned char *redPixelOp = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
					unsigned char *greenPixelOp = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
					unsigned char *bluePixelOp = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));

					for(int i = 0; i < (width*height); i++){
					redPixels[i] = data[i*3+0];
					greenPixels[i] = data[i*3+1];
					bluePixels[i] = data[i*3+2];
					}

					HANDLE_ERROR(hipMalloc(&d_redpixel, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(hipMalloc(&d_redpixelOp, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(hipMalloc(&d_redpixelOpy, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(hipMemcpy(d_redpixel, &redPixels, sizeof(int), hipMemcpyHostToDevice));

					HANDLE_ERROR(hipMalloc(&d_greenpixel, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(hipMalloc(&d_greenpixelOp, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(hipMalloc(&d_greenpixelOpy, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(hipMemcpy(d_greenpixel, &greenPixels, sizeof(int), hipMemcpyHostToDevice));

					HANDLE_ERROR(hipMalloc(&d_bluepixel, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(hipMalloc(&d_bluepixelOp, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(hipMalloc(&d_bluepixelOpy, width*height*sizeof(unsigned char)));
					HANDLE_ERROR(hipMemcpy(d_bluepixel, &bluePixels, sizeof(int), hipMemcpyHostToDevice));

	
					unsigned char *redPixelOpy = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
					unsigned char *greenPixelOpy = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
					unsigned char *bluePixelOpy = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));

					clock_t start = clock();
					
					/*Launch GPU kernels here*/
					gpuConvolution_x<<<blocks, threads>>>(d_kernelForGpu, d_kernelSizeX, d_width, d_height, d_redpixel, d_greenpixel, d_bluepixel, d_redpixelOp, d_greenpixelOp, d_bluepixelOp);

					gpuConvolution_y<<<blocks, threads>>>(d_kernelForGpu, d_kernelSizeX, d_width, d_height, d_redpixelOp, d_greenpixelOp, d_bluepixelOp, d_redpixelOpy, d_greenpixelOpy, d_bluepixelOpy, d_out);

					clock_t end = clock();

					/*profile convolution time here*/
					double elapsed_time = (end - start)/(double)CLOCKS_PER_SEC;
					printf("Convolution time on GPU is %lf fractional seconds\n", elapsed_time);
						

					HANDLE_ERROR(hipMemcpy(redPixels, d_redpixelOp, width*height*sizeof(unsigned char), hipMemcpyDeviceToHost));
					 HANDLE_ERROR(hipMemcpy(greenPixels, d_greenpixelOp, width*height*sizeof(unsigned char), hipMemcpyDeviceToHost));
					 HANDLE_ERROR(hipMemcpy(bluePixels, d_bluepixelOp, width*height*sizeof(unsigned char), hipMemcpyDeviceToHost));

					for(int k = 0; k < (width*height); k++) {
				                out[k*3+0]= redPixelOpy[k];
				                out[k*3+1]= greenPixelOpy[k];
				                out[k*3+2]= bluePixelOpy[k];
        				}

					/*File to store GPU convoluted image*/
					FILE *fp;
					fp = fopen("gpu_out.ppm", "wb");
					if(!fp) {
						exit(1);
					}
					fprintf(fp, "P6\n");
					fprintf(fp, "%d %d\n", width, height);
					fprintf(fp, "%d\n", RGB_COMPONENT_COLOR);
					fwrite(out, 3*width, height, fp);
					fclose(fp);
					
					hipFree(kernel);
					hipFree(d_kernelSizeX);
					hipFree(d_data);
					hipFree(d_out);
					hipFree(d_redpixelOpy);
					hipFree(d_greenpixelOpy);
					hipFree(d_bluepixelOpy);
					hipFree(d_redpixelOp);
					hipFree(d_greenpixelOp);
					hipFree(d_bluepixelOp);
					hipFree(d_redpixel);
					hipFree(d_greenpixel);
					hipFree(d_bluepixel);
					return out;
}

/*------------------------------------------------- readPPM -----
         |  readPPM
         |
         |  Purpose:  This function is called by CPU and executed on CPU 
		 |			  This function reads the input image passed through 
		 |			  command line argument and stores the data in a buffer
         |
         |  Parameters: constant char* input image file passed through command line argument
         |      
         |  Returns:	unsigned char* returns pointer to input image
         *-------------------------------------------------------------------*/


static unsigned char *readPPM(const char *filename)
{
		 char buff[16];
         PPMImage *img;
         FILE *fp;
		 unsigned char *data;
		 int c, rgb_comp_color;
         

		 fp = fopen(filename, "rb");
        
		 if (!fp) {
              fprintf(stderr, "Unable to open file '%s'\n", filename);
              exit(1);
         }

		 if (!fgets(buff, sizeof(buff), fp)) {
              perror(filename);
              exit(1);
         }

		 if (buff[0] != 'P' || buff[1] != '6') {
			fprintf(stderr, "Invalid image format (must be 'P6')\n");
			exit(1);
		}

	    img = (PPMImage *)malloc(sizeof(PPMImage));
		if (!img) {
         fprintf(stderr, "Unable to allocate memory\n");
         exit(1);
		}

	    c = getc(fp);
		while (c == '#') {
			while (getc(fp) != '\n') ;
				c = getc(fp);
			}

		ungetc(c, fp);
			
		if (fscanf(fp, "%d %d", &img->x, &img->y) != 2) {
			 fprintf(stderr, "Invalid image size (error loading '%s')\n", filename);
			 exit(1);
		 }

		width = img->x;
		height = img->y;

    
		if (fscanf(fp, "%d", &rgb_comp_color) != 1) {
			 fprintf(stderr, "Invalid rgb component (error loading '%s')\n", filename);
			 exit(1);
		}

		if (rgb_comp_color!= RGB_COMPONENT_COLOR) {
			 fprintf(stderr, "'%s' does not have 8-bits components\n", filename);
			 exit(1);
		}

		while (fgetc(fp) != '\n') ;
    
		data = (unsigned char*)malloc(img->x * img->y * 3*sizeof(unsigned char));
		if (!data) {
			 fprintf(stderr, "Unable to allocate memory\n");
			 exit(1);
		}

		if (fread(data, 3 * img->x, img->y, fp));
		fclose(fp);
	
		
		return data;
	
}


/*------------------------------------------------- convolvePPM -----
         |  readPPM
         |
         |  Purpose:  This function is called by CPU and executed on CPU 
		 |			  This function does the convolution of input image 
		 |			  command line argument and stores the data in a buffer
         |
         |  Parameters: unsigned char *img: input image data
		 |				unsigned char *out: convoluted image data 
		 |				float kernel[]: gausian kernel for convolution
		 |				int kernelSizeX: size of gausian kernel
		 |				int kernelSizeY: size of gausian kernel
         |      
         |  Returns:	unsigned char* returns pointer to convoluted image
         *-------------------------------------------------------------------*/



unsigned char *convolvePPM(unsigned char *img, unsigned char *out, float kernel[], int kernelSizeX, int kernelSizeY)
{
		FILE *fp;
		
	
	unsigned char *redPixels = (unsigned char*)malloc((width*height*sizeof(unsigned char)));
	unsigned char *greenPixels = (unsigned char*)malloc((width*height*sizeof(unsigned char)));
	unsigned char *bluePixels = (unsigned char*)malloc((width*height*sizeof(unsigned char)));

	unsigned char *redPixelOp = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
	unsigned char *greenPixelOp = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
	unsigned char *bluePixelOp = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));

	
	unsigned char *redPixelOpy = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
	unsigned char *greenPixelOpy = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
	unsigned char *bluePixelOpy = (unsigned char*)malloc((width*height*3*sizeof(unsigned char)));
	
	for(int i = 0; i < (width*height);i++ ){

		redPixels[i] = img[i*3+0];
		greenPixels[i] = img[i*3+1];
		bluePixels[i] = img[i*3+2];
	}

	
    fp = fopen("CPU_out.ppm", "wb");
    if (!fp) {
         
         exit(1);
    }

    fprintf(fp, "P6\n");
    fprintf(fp, "%d %d\n",width, height);

    fprintf(fp, "%d\n",RGB_COMPONENT_COLOR);

	out[0]=0;

	clock_t start = clock();
	
	for(int q = 0; q < height; q++)
	{
	for(int p = 0; p < width; p++)
	{
		
				if(p == 0 || p == 1 || q == 0 || q == 1)
				{
				}
				else {
				for(int r = 0; r < 5; r++)
				{
					redPixelOp[(q*width) + p] += (unsigned char)redPixels[(width*q)+(p+r-1)]*kernel[r];
					greenPixelOp[(q*width) + p] += (unsigned char)greenPixels[(width*q)+(p+r-1)]*kernel[r];
					bluePixelOp[(q*width)+p] += (unsigned char)bluePixels[(width*q)+(p+r-1)]*kernel[r];
				}

				for(int r = 0; r < 5; r++)
				{
					redPixelOpy[(q*width) + p] += (unsigned char)redPixelOp[p+(q+r-1)*width]*kernel[r];
					greenPixelOpy[(q*width) + p] += (unsigned char)greenPixelOp[p+(q+r-1)*width]*kernel[r];
					bluePixelOpy[(q*width)+p] += (unsigned char)bluePixelOp[p+(q+r-1)*width]*kernel[r];
				}
				}
	}
	}

	clock_t end = clock();
	double elapsed_time = (end - start)/(double)CLOCKS_PER_SEC;

	printf("Convolution time for CPU is %lf fractional seconds\n", elapsed_time);

	for(int k = 0; k < (width*height); k++) {
		out[k*3+0]= redPixelOpy[k];
		out[k*3+1]= greenPixelOpy[k];
		out[k*3+2]= bluePixelOpy[k];
	}

	 fwrite(out, 3 * width, height, fp);

    fclose(fp);

	return out;
}

/*------------------------------------------------- main -----
         |  main
         |
         |  Purpose:  This function is called by CPU and executed on CPU 
		 |			  This function erceives command line arguments, image file 
		 |			  name and the standard deviation
		 |			  Prepares gausian kernel and calls the convolution functions on CPU and GPU
         |
         |  Parameters: int argc: number of commandline arguments
		 |				argv[] : image file name and standard deviation
         |  Returns:	int 0 on success
         *-------------------------------------------------------------------*/

int main(int argc, char* argv[]) {	
	string filename = argv[1];
	unsigned char *image;
	unsigned char *outimageongpu;
	int sigma = atoi(argv[2]);	
	image = readPPM(filename.c_str());
	unsigned char *out = (unsigned char*)malloc(width * height * 3 * sizeof(unsigned char));
	float *gKernel = (float*)malloc(5 * sizeof(float));

	double s = 2.0 * sigma * sigma;
	double sum = 0.0;

	int p = 0;
	for(int x = -2; x <=2; x++)
   {
			gKernel[p] = (exp(-(x*x)/s))/(sqrt(M_PI * s));
			sum += gKernel[p];
			p++;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    }

	
    for(int i = 0; i < 5; i++) {
            gKernel[i] /= sum;
	
	}

	unsigned char *outimage = convolvePPM(image, out, gKernel, 5, 5);
	outimageongpu = (unsigned char*)malloc(width*height*3*sizeof(unsigned char));
	unsigned char *gpu_outimage = gpuFunction(image, width, height, gKernel, 5, outimageongpu);
}



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

                                        # End of file scope inline assembly
	.globl	_Z31__device_stub__gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_ # -- Begin function _Z31__device_stub__gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	.type	_Z31__device_stub__gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_,@function
_Z31__device_stub__gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_: # @_Z31__device_stub__gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$176, %rsp
	.cfi_def_cfa_offset 224
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	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	224(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	232(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	240(%rsp), %rax
	movq	%rax, 64(%rbx)
	leaq	248(%rsp), %rax
	movq	%rax, 72(%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	$_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$192, %rsp
	.cfi_adjust_cfa_offset -192
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z31__device_stub__gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_, .Lfunc_end0-_Z31__device_stub__gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	.cfi_endproc
                                        # -- End function
	.globl	_Z31__device_stub__gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_ # -- Begin function _Z31__device_stub__gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	.type	_Z31__device_stub__gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_,@function
_Z31__device_stub__gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_: # @_Z31__device_stub__gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$192, %rsp
	.cfi_def_cfa_offset 240
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	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	240(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	248(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	256(%rsp), %rax
	movq	%rax, 64(%rbx)
	leaq	264(%rsp), %rax
	movq	%rax, 72(%rbx)
	leaq	272(%rsp), %rax
	movq	%rax, 80(%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	$_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$208, %rsp
	.cfi_adjust_cfa_offset -208
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z31__device_stub__gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_, .Lfunc_end1-_Z31__device_stub__gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z11gpuFunctionPhiiPfiS_
.LCPI2_0:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	_Z11gpuFunctionPhiiPfiS_
	.type	_Z11gpuFunctionPhiiPfiS_,@function
_Z11gpuFunctionPhiiPfiS_:               # @_Z11gpuFunctionPhiiPfiS_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, 168(%rsp)                  # 8-byte Spill
	movq	%rcx, %r15
	movl	%edx, %r14d
	movl	%esi, %ebx
	movq	%rdi, %r12
	leaq	4(%rsp), %rax
	movl	%esi, (%rax)
	movq	%rsp, %rax
	movl	%edx, (%rax)
	leaq	44(%rsp), %rax
	movl	%r8d, (%rax)
	leal	31(%rbx), %eax
	testl	%esi, %esi
	cmovnsl	%esi, %eax
	sarl	$5, %eax
	incl	%eax
	leal	31(%r14), %ecx
	testl	%edx, %edx
	cmovnsl	%edx, %ecx
	sarl	$5, %ecx
	incl	%ecx
	shlq	$32, %rcx
	orq	%rax, %rcx
	movq	%rcx, 160(%rsp)                 # 8-byte Spill
	movslq	%r8d, %r13
	shlq	$2, %r13
	leaq	144(%rsp), %rbp
	movq	%rbp, %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$231, %esi
	callq	_ZL11HandleError10hipError_tPKci
	movq	(%rbp), %rdi
	movq	%r15, 152(%rsp)                 # 8-byte Spill
	movq	%r15, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$232, %esi
	callq	_ZL11HandleError10hipError_tPKci
	imull	%r14d, %ebx
	leal	(%rbx,%rbx,2), %eax
	movslq	%eax, %rbx
	leaq	176(%rsp), %r14
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$234, %esi
	callq	_ZL11HandleError10hipError_tPKci
	movq	(%r14), %rdi
	movq	%r12, %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$235, %esi
	callq	_ZL11HandleError10hipError_tPKci
	leaq	88(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$237, %esi
	callq	_ZL11HandleError10hipError_tPKci
	leaq	32(%rsp), %rbx
	movl	$4, %esi
	movq	%rbx, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$240, %esi
	callq	_ZL11HandleError10hipError_tPKci
	movq	(%rbx), %rdi
	movl	$4, %edx
	leaq	44(%rsp), %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$241, %esi
	callq	_ZL11HandleError10hipError_tPKci
	leaq	80(%rsp), %rbx
	movl	$4, %esi
	movq	%rbx, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$243, %esi
	callq	_ZL11HandleError10hipError_tPKci
	movq	(%rbx), %rdi
	movl	$4, %edx
	leaq	4(%rsp), %r14
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$244, %esi
	callq	_ZL11HandleError10hipError_tPKci
	leaq	72(%rsp), %rbx
	movl	$4, %esi
	movq	%rbx, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$246, %esi
	callq	_ZL11HandleError10hipError_tPKci
	movq	(%rbx), %rdi
	movl	$4, %edx
	movq	%rsp, %rbx
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$247, %esi
	callq	_ZL11HandleError10hipError_tPKci
	movslq	(%r14), %rax
	movslq	(%rbx), %rbx
	imulq	%rax, %rbx
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, %r14
	movq	%rax, 64(%rsp)
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, %r13
	movq	%rax, 56(%rsp)
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, 48(%rsp)
	testl	%ebx, %ebx
	jle	.LBB2_6
# %bb.1:                                # %.lr.ph.preheader
	leaq	2(%r12), %rcx
	xorl	%edx, %edx
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movb	-2(%rcx), %sil
	movb	%sil, (%r14,%rdx)
	movb	-1(%rcx), %sil
	movb	%sil, (%r13,%rdx)
	movb	(%rcx), %sil
	movb	%sil, (%rax,%rdx)
	incq	%rdx
	addq	$3, %rcx
	cmpq	%rbx, %rdx
	jl	.LBB2_2
# %bb.3:                                # %.preheader
	testl	%ebx, %ebx
	jle	.LBB2_6
# %bb.4:                                # %.lr.ph78.preheader
	addq	$2, %r12
	xorl	%ecx, %ecx
.LBB2_5:                                # %.lr.ph78
                                        # =>This Inner Loop Header: Depth=1
	movb	-2(%r12), %dl
	movb	%dl, (%r14,%rcx)
	movb	-1(%r12), %dl
	movb	%dl, (%r13,%rcx)
	movb	(%r12), %dl
	movb	%dl, (%rax,%rcx)
	incq	%rcx
	addq	$3, %r12
	cmpq	%rbx, %rcx
	jl	.LBB2_5
.LBB2_6:                                # %._crit_edge
	movabsq	$137438953504, %r12             # imm = 0x2000000020
	leaq	136(%rsp), %r14
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$272, %esi                      # imm = 0x110
	callq	_ZL11HandleError10hipError_tPKci
	movslq	4(%rsp), %rax
	movslq	(%rsp), %rsi
	imulq	%rax, %rsi
	leaq	24(%rsp), %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$273, %esi                      # imm = 0x111
	callq	_ZL11HandleError10hipError_tPKci
	movslq	4(%rsp), %rax
	movslq	(%rsp), %rsi
	imulq	%rax, %rsi
	leaq	112(%rsp), %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$274, %esi                      # imm = 0x112
	callq	_ZL11HandleError10hipError_tPKci
	movq	(%r14), %rdi
	leaq	64(%rsp), %rsi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$275, %esi                      # imm = 0x113
	callq	_ZL11HandleError10hipError_tPKci
	movslq	4(%rsp), %rax
	movslq	(%rsp), %rsi
	imulq	%rax, %rsi
	leaq	128(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$277, %esi                      # imm = 0x115
	callq	_ZL11HandleError10hipError_tPKci
	movslq	4(%rsp), %rax
	movslq	(%rsp), %rsi
	imulq	%rax, %rsi
	leaq	16(%rsp), %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$278, %esi                      # imm = 0x116
	callq	_ZL11HandleError10hipError_tPKci
	movslq	4(%rsp), %rax
	movslq	(%rsp), %rsi
	imulq	%rax, %rsi
	leaq	104(%rsp), %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$279, %esi                      # imm = 0x117
	callq	_ZL11HandleError10hipError_tPKci
	movq	(%rbx), %rdi
	leaq	56(%rsp), %rsi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$280, %esi                      # imm = 0x118
	callq	_ZL11HandleError10hipError_tPKci
	movslq	4(%rsp), %rax
	movslq	(%rsp), %rsi
	imulq	%rax, %rsi
	leaq	120(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$282, %esi                      # imm = 0x11A
	callq	_ZL11HandleError10hipError_tPKci
	movslq	4(%rsp), %rax
	movslq	(%rsp), %rsi
	imulq	%rax, %rsi
	leaq	8(%rsp), %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$283, %esi                      # imm = 0x11B
	callq	_ZL11HandleError10hipError_tPKci
	movslq	4(%rsp), %rax
	movslq	(%rsp), %rsi
	imulq	%rax, %rsi
	leaq	96(%rsp), %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$284, %esi                      # imm = 0x11C
	callq	_ZL11HandleError10hipError_tPKci
	movq	(%rbx), %rdi
	leaq	48(%rsp), %rsi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$285, %esi                      # imm = 0x11D
	callq	_ZL11HandleError10hipError_tPKci
	movl	4(%rsp), %eax
	imull	(%rsp), %eax
	leal	(%rax,%rax,2), %eax
	movslq	%eax, %rbx
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, %r13
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, %rbp
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, %r14
	callq	clock
	movq	%rax, %rbx
	movq	160(%rsp), %r15                 # 8-byte Reload
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_8
# %bb.7:
	movq	144(%rsp), %rdi
	movq	32(%rsp), %rsi
	movq	80(%rsp), %rdx
	movq	72(%rsp), %rcx
	movq	136(%rsp), %r8
	movq	128(%rsp), %r9
	pushq	8(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	24(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	40(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	144(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	_Z31__device_stub__gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	addq	$32, %rsp
	.cfi_adjust_cfa_offset -32
.LBB2_8:
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_10
# %bb.9:
	movq	144(%rsp), %rdi
	movq	32(%rsp), %rsi
	movq	80(%rsp), %rdx
	movq	72(%rsp), %rcx
	movq	24(%rsp), %r8
	movq	16(%rsp), %r9
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	pushq	96(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	112(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	128(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	144(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	48(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	_Z31__device_stub__gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	addq	$48, %rsp
	.cfi_adjust_cfa_offset -48
.LBB2_10:
	callq	clock
	subq	%rbx, %rax
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI2_0(%rip), %xmm0
	movl	$.L.str.1, %edi
	movb	$1, %al
	callq	printf
	movq	64(%rsp), %rdi
	movq	24(%rsp), %rsi
	movslq	4(%rsp), %rax
	movslq	(%rsp), %rdx
	imulq	%rax, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$306, %esi                      # imm = 0x132
	callq	_ZL11HandleError10hipError_tPKci
	movq	56(%rsp), %rdi
	movq	16(%rsp), %rsi
	movslq	4(%rsp), %rax
	movslq	(%rsp), %rdx
	imulq	%rax, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$307, %esi                      # imm = 0x133
	callq	_ZL11HandleError10hipError_tPKci
	movq	48(%rsp), %rdi
	movq	8(%rsp), %rsi
	movslq	4(%rsp), %rax
	movslq	(%rsp), %rdx
	imulq	%rax, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$308, %esi                      # imm = 0x134
	callq	_ZL11HandleError10hipError_tPKci
	movl	(%rsp), %eax
	imull	4(%rsp), %eax
	testl	%eax, %eax
	movq	168(%rsp), %r15                 # 8-byte Reload
	jle	.LBB2_13
# %bb.11:                               # %.lr.ph81.preheader
	movl	%eax, %eax
	leaq	2(%r15), %rcx
	xorl	%edx, %edx
.LBB2_12:                               # %.lr.ph81
                                        # =>This Inner Loop Header: Depth=1
	movb	(%r13,%rdx), %sil
	movb	%sil, -2(%rcx)
	movb	(%rbp,%rdx), %sil
	movb	%sil, -1(%rcx)
	movb	(%r14,%rdx), %sil
	movb	%sil, (%rcx)
	incq	%rdx
	addq	$3, %rcx
	cmpq	%rdx, %rax
	jne	.LBB2_12
.LBB2_13:                               # %._crit_edge82
	movl	$.L.str.2, %edi
	movl	$.L.str.3, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB2_15
# %bb.14:
	movq	%rax, %rbx
	movl	$.L.str.4, %edi
	movl	$3, %esi
	movl	$1, %edx
	movq	%rax, %rcx
	callq	fwrite
	movl	4(%rsp), %edx
	movl	(%rsp), %ecx
	movl	$.L.str.5, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	fprintf
	movl	$.L.str.6, %esi
	movq	%rbx, %rdi
	movl	$255, %edx
	xorl	%eax, %eax
	callq	fprintf
	movslq	4(%rsp), %rax
	leaq	(%rax,%rax,2), %rsi
	movslq	(%rsp), %rdx
	movq	%r15, %rdi
	movq	%rbx, %rcx
	callq	fwrite
	movq	%rbx, %rdi
	callq	fclose
	movq	152(%rsp), %rdi                 # 8-byte Reload
	callq	hipFree
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	176(%rsp), %rdi
	callq	hipFree
	movq	88(%rsp), %rdi
	callq	hipFree
	movq	112(%rsp), %rdi
	callq	hipFree
	movq	104(%rsp), %rdi
	callq	hipFree
	movq	96(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	136(%rsp), %rdi
	callq	hipFree
	movq	128(%rsp), %rdi
	callq	hipFree
	movq	120(%rsp), %rdi
	callq	hipFree
	movq	%r15, %rax
	addq	$184, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB2_15:
	.cfi_def_cfa_offset 240
	movl	$1, %edi
	callq	exit
.Lfunc_end2:
	.size	_Z11gpuFunctionPhiiPfiS_, .Lfunc_end2-_Z11gpuFunctionPhiiPfiS_
	.cfi_endproc
                                        # -- End function
	.type	_ZL11HandleError10hipError_tPKci,@function # -- Begin function _ZL11HandleError10hipError_tPKci
_ZL11HandleError10hipError_tPKci:       # @_ZL11HandleError10hipError_tPKci
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jne	.LBB3_2
# %bb.1:
	retq
.LBB3_2:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	%esi, %ebx
	callq	hipGetErrorString
	movl	$.L.str.9, %edi
	movl	$.L.str, %edx
	movq	%rax, %rsi
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end3:
	.size	_ZL11HandleError10hipError_tPKci, .Lfunc_end3-_ZL11HandleError10hipError_tPKci
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z11convolvePPMPhS_Pfii
.LCPI4_0:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	_Z11convolvePPMPhS_Pfii
	.type	_Z11convolvePPMPhS_Pfii,@function
_Z11convolvePPMPhS_Pfii:                # @_Z11convolvePPMPhS_Pfii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, %r12
	movq	%rsi, 16(%rsp)                  # 8-byte Spill
	movq	%rdi, 40(%rsp)                  # 8-byte Spill
	movslq	_ZL5width(%rip), %rax
	movslq	_ZL6height(%rip), %r15
	imulq	%rax, %r15
	movq	%r15, 32(%rsp)                  # 8-byte Spill
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, 80(%rsp)                  # 8-byte Spill
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, %rbx
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, %r14
	leal	(%r15,%r15,2), %eax
	movslq	%eax, %rbp
	movq	%rbp, (%rsp)                    # 8-byte Spill
	movq	%rbp, %rdi
	callq	malloc
	movq	%rax, %r15
	movq	%rbp, %rdi
	callq	malloc
	movq	%rax, %r13
	movq	%rbp, %rdi
	callq	malloc
	movq	%rax, %rbp
	movq	(%rsp), %rdi                    # 8-byte Reload
	callq	malloc
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	movq	(%rsp), %rdi                    # 8-byte Reload
	callq	malloc
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	movq	(%rsp), %rdi                    # 8-byte Reload
	callq	malloc
	movq	40(%rsp), %rdi                  # 8-byte Reload
	movq	80(%rsp), %rsi                  # 8-byte Reload
	movq	%rax, 48(%rsp)                  # 8-byte Spill
	movq	32(%rsp), %rax                  # 8-byte Reload
	testl	%eax, %eax
	jle	.LBB4_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%eax, %eax
	addq	$2, %rdi
	xorl	%ecx, %ecx
.LBB4_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movb	-2(%rdi), %dl
	movb	%dl, (%rsi,%rcx)
	movb	-1(%rdi), %dl
	movb	%dl, (%rbx,%rcx)
	movb	(%rdi), %dl
	movb	%dl, (%r14,%rcx)
	incq	%rcx
	addq	$3, %rdi
	cmpq	%rcx, %rax
	jne	.LBB4_2
.LBB4_3:                                # %._crit_edge
	movl	$.L.str.7, %edi
	movl	$.L.str.3, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB4_21
# %bb.4:
	movl	$.L.str.4, %edi
	movl	$3, %esi
	movl	$1, %edx
	movq	%rax, %rcx
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	callq	fwrite
	movl	_ZL5width(%rip), %edx
	movl	_ZL6height(%rip), %ecx
	movl	$.L.str.5, %esi
	movq	24(%rsp), %rdi                  # 8-byte Reload
	xorl	%eax, %eax
	callq	fprintf
	movl	$.L.str.6, %esi
	movq	24(%rsp), %rdi                  # 8-byte Reload
	movl	$255, %edx
	xorl	%eax, %eax
	callq	fprintf
	movq	16(%rsp), %rax                  # 8-byte Reload
	movb	$0, (%rax)
	callq	clock
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	movl	_ZL6height(%rip), %eax
	movq	%rax, 96(%rsp)                  # 8-byte Spill
	testl	%eax, %eax
	jle	.LBB4_17
# %bb.5:                                # %.preheader117.lr.ph
	movl	_ZL5width(%rip), %ecx
	movl	%ecx, %eax
	negl	%eax
	movl	%eax, 12(%rsp)                  # 4-byte Spill
	movq	$-1, 72(%rsp)                   # 8-byte Folded Spill
	xorl	%eax, %eax
.LBB4_6:                                # %.preheader117
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_8 Depth 2
                                        #       Child Loop BB4_11 Depth 3
                                        #       Child Loop BB4_13 Depth 3
	testl	%ecx, %ecx
	jle	.LBB4_16
# %bb.7:                                # %.lr.ph134
                                        #   in Loop: Header=BB4_6 Depth=1
	movl	%ecx, %edx
	imull	%eax, %edx
	movq	%rdx, 104(%rsp)                 # 8-byte Spill
	movl	12(%rsp), %r11d                 # 4-byte Reload
	movq	72(%rsp), %r10                  # 8-byte Reload
	xorl	%edx, %edx
	movq	%rax, 112(%rsp)                 # 8-byte Spill
.LBB4_8:                                #   Parent Loop BB4_6 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB4_11 Depth 3
                                        #       Child Loop BB4_13 Depth 3
	cmpq	$2, %rax
	jb	.LBB4_15
# %bb.9:                                #   in Loop: Header=BB4_8 Depth=2
	cmpq	$2, %rdx
	jb	.LBB4_15
# %bb.10:                               # %.preheader116
                                        #   in Loop: Header=BB4_8 Depth=2
	movl	%r11d, 40(%rsp)                 # 4-byte Spill
	movq	104(%rsp), %rax                 # 8-byte Reload
	movq	%rdx, 32(%rsp)                  # 8-byte Spill
	addq	%rdx, %rax
	movb	(%r15,%rax), %dil
	movb	(%r13,%rax), %r8b
	movq	%rax, (%rsp)                    # 8-byte Spill
	movb	(%rbp,%rax), %dl
	xorl	%esi, %esi
	movq	80(%rsp), %r11                  # 8-byte Reload
.LBB4_11:                               #   Parent Loop BB4_6 Depth=1
                                        #     Parent Loop BB4_8 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	leal	(%r10,%rsi), %r9d
	movslq	%r9d, %r9
	movzbl	(%r11,%r9), %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	(%r12,%rsi,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm1, %xmm0
	movzbl	%dil, %eax
	xorps	%xmm2, %xmm2
	cvtsi2ss	%eax, %xmm2
	addss	%xmm0, %xmm2
	movzbl	(%rbx,%r9), %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	cvttss2si	%xmm2, %edi
	mulss	%xmm1, %xmm0
	movzbl	%r8b, %eax
	xorps	%xmm2, %xmm2
	cvtsi2ss	%eax, %xmm2
	addss	%xmm0, %xmm2
	movzbl	(%r14,%r9), %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	cvttss2si	%xmm2, %r8d
	mulss	%xmm1, %xmm0
	movzbl	%dl, %eax
	xorps	%xmm1, %xmm1
	cvtsi2ss	%eax, %xmm1
	addss	%xmm0, %xmm1
	cvttss2si	%xmm1, %edx
	incq	%rsi
	cmpq	$5, %rsi
	jne	.LBB4_11
# %bb.12:                               # %.preheader
                                        #   in Loop: Header=BB4_8 Depth=2
	movq	(%rsp), %r9                     # 8-byte Reload
	movb	%dil, (%r15,%r9)
	movb	%r8b, (%r13,%r9)
	movb	%dl, (%rbp,%r9)
	movq	64(%rsp), %rax                  # 8-byte Reload
	movb	(%rax,%r9), %sil
	movq	56(%rsp), %rax                  # 8-byte Reload
	movb	(%rax,%r9), %dl
	movq	48(%rsp), %rax                  # 8-byte Reload
	movb	(%rax,%r9), %r8b
	movl	40(%rsp), %r11d                 # 4-byte Reload
	movl	%r11d, %edi
	xorl	%r9d, %r9d
.LBB4_13:                               #   Parent Loop BB4_6 Depth=1
                                        #     Parent Loop BB4_8 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movslq	%edi, %rdi
	movzbl	(%r15,%rdi), %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	(%r12,%r9,4), %xmm1             # xmm1 = mem[0],zero,zero,zero
	movzbl	%sil, %eax
	xorps	%xmm2, %xmm2
	cvtsi2ss	%eax, %xmm2
	mulss	%xmm1, %xmm0
	addss	%xmm0, %xmm2
	cvttss2si	%xmm2, %esi
	movzbl	(%r13,%rdi), %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movzbl	%dl, %eax
	xorps	%xmm2, %xmm2
	cvtsi2ss	%eax, %xmm2
	mulss	%xmm1, %xmm0
	addss	%xmm0, %xmm2
	cvttss2si	%xmm2, %edx
	movzbl	(%rbp,%rdi), %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movzbl	%r8b, %eax
	xorps	%xmm2, %xmm2
	cvtsi2ss	%eax, %xmm2
	mulss	%xmm1, %xmm0
	addss	%xmm0, %xmm2
	cvttss2si	%xmm2, %r8d
	incq	%r9
	addl	%ecx, %edi
	cmpq	$5, %r9
	jne	.LBB4_13
# %bb.14:                               # %.loopexit
                                        #   in Loop: Header=BB4_8 Depth=2
	movq	64(%rsp), %rax                  # 8-byte Reload
	movq	(%rsp), %rdi                    # 8-byte Reload
	movb	%sil, (%rax,%rdi)
	movq	56(%rsp), %rax                  # 8-byte Reload
	movb	%dl, (%rax,%rdi)
	movq	48(%rsp), %rax                  # 8-byte Reload
	movb	%r8b, (%rax,%rdi)
	movq	112(%rsp), %rax                 # 8-byte Reload
	movq	32(%rsp), %rdx                  # 8-byte Reload
.LBB4_15:                               #   in Loop: Header=BB4_8 Depth=2
	incq	%rdx
	incq	%r10
	incl	%r11d
	cmpq	%rcx, %rdx
	jne	.LBB4_8
.LBB4_16:                               # %._crit_edge135
                                        #   in Loop: Header=BB4_6 Depth=1
	incq	%rax
	addq	%rcx, 72(%rsp)                  # 8-byte Folded Spill
	addl	%ecx, 12(%rsp)                  # 4-byte Folded Spill
	cmpq	96(%rsp), %rax                  # 8-byte Folded Reload
	jne	.LBB4_6
.LBB4_17:                               # %._crit_edge137
	callq	clock
	subq	88(%rsp), %rax                  # 8-byte Folded Reload
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI4_0(%rip), %xmm0
	movl	$.L.str.8, %edi
	movb	$1, %al
	callq	printf
	movslq	_ZL5width(%rip), %rax
	movslq	_ZL6height(%rip), %rdx
	movl	%edx, %ecx
	imull	%eax, %ecx
	testl	%ecx, %ecx
	movq	64(%rsp), %r9                   # 8-byte Reload
	movq	56(%rsp), %r10                  # 8-byte Reload
	movq	48(%rsp), %r11                  # 8-byte Reload
	jle	.LBB4_20
# %bb.18:                               # %.lr.ph140.preheader
	movl	%ecx, %ecx
	movq	16(%rsp), %rsi                  # 8-byte Reload
	addq	$2, %rsi
	xorl	%edi, %edi
.LBB4_19:                               # %.lr.ph140
                                        # =>This Inner Loop Header: Depth=1
	movb	(%r9,%rdi), %r8b
	movb	%r8b, -2(%rsi)
	movb	(%r10,%rdi), %r8b
	movb	%r8b, -1(%rsi)
	movb	(%r11,%rdi), %r8b
	movb	%r8b, (%rsi)
	incq	%rdi
	addq	$3, %rsi
	cmpq	%rdi, %rcx
	jne	.LBB4_19
.LBB4_20:                               # %._crit_edge141
	leaq	(%rax,%rax,2), %rsi
	movq	16(%rsp), %rbx                  # 8-byte Reload
	movq	%rbx, %rdi
	movq	24(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rcx
	callq	fwrite
	movq	%r14, %rdi
	callq	fclose
	movq	%rbx, %rax
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB4_21:
	.cfi_def_cfa_offset 176
	movl	$1, %edi
	callq	exit
.Lfunc_end4:
	.size	_Z11convolvePPMPhS_Pfii, .Lfunc_end4-_Z11convolvePPMPhS_Pfii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI5_0:
	.quad	0x400921fb54442d18              # double 3.1415926535897931
.LCPI5_1:
	.quad	0x0000000000000000              # double 0
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$96, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	movq	8(%rsi), %rsi
	leaq	64(%rsp), %r14
	leaq	16(%rsp), %rdx
	movq	%r14, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	movq	16(%rbx), %rdi
	callq	atoi
	movl	%eax, %ebx
	movq	(%r14), %r14
	movl	$.L.str.10, %esi
	movq	%r14, %rdi
	callq	fopen
	testq	%rax, %rax
	je	.LBB5_26
# %bb.1:
	movq	%rax, %r15
	leaq	16(%rsp), %rdi
	movl	$16, %esi
	movq	%rax, %rdx
	callq	fgets
	testq	%rax, %rax
	je	.LBB5_27
# %bb.2:
	cmpb	$80, 16(%rsp)
	jne	.LBB5_28
# %bb.3:
	cmpb	$54, 17(%rsp)
	jne	.LBB5_28
# %bb.4:
	movl	$16, %edi
	callq	malloc
	testq	%rax, %rax
	je	.LBB5_25
# %bb.5:
	movq	%rax, %r12
.LBB5_6:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_7 Depth 2
	movq	%r15, %rdi
	callq	getc
	cmpl	$35, %eax
	jne	.LBB5_8
.LBB5_7:                                # %.preheader44.i
                                        #   Parent Loop BB5_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	%r15, %rdi
	callq	getc
	cmpl	$10, %eax
	jne	.LBB5_7
	jmp	.LBB5_6
.LBB5_8:                                # %._crit_edge.i
	movl	%eax, %edi
	movq	%r15, %rsi
	callq	ungetc
	movq	%r12, %rcx
	addq	$4, %rcx
.Ltmp0:
	movl	$.L.str.14, %esi
	movq	%r15, %rdi
	movq	%r12, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
.Ltmp1:
# %bb.9:                                # %.noexc
	cmpl	$2, %eax
	jne	.LBB5_31
# %bb.10:
	movl	(%r12), %eax
	movl	%eax, _ZL5width(%rip)
	movl	4(%r12), %eax
	movl	%eax, _ZL6height(%rip)
.Ltmp2:
	leaq	4(%rsp), %rdx
	movl	$.L.str.16, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
.Ltmp3:
# %bb.11:                               # %.noexc39
	cmpl	$1, %eax
	jne	.LBB5_32
# %bb.12:
	cmpl	$255, 4(%rsp)
	jne	.LBB5_33
.LBB5_13:                               # %.preheader.i
                                        # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	fgetc
	cmpl	$10, %eax
	jne	.LBB5_13
# %bb.14:
	movl	(%r12), %eax
	movslq	4(%r12), %r12
	leal	(%rax,%rax,2), %ebp
	movl	%ebp, %eax
	imull	%r12d, %eax
	movslq	%eax, %rdi
	callq	malloc
	testq	%rax, %rax
	je	.LBB5_25
# %bb.15:
	movq	%rax, %r14
	movslq	%ebp, %rsi
	movq	%rax, %rdi
	movq	%r12, %rdx
	movq	%r15, %rcx
	callq	fread
	movq	%r15, %rdi
	callq	fclose
	movl	_ZL5width(%rip), %eax
	imull	_ZL6height(%rip), %eax
	leal	(%rax,%rax,2), %eax
	movslq	%eax, %rdi
	callq	malloc
	movq	%rax, %r12
	movl	$20, %edi
	callq	malloc
	movq	%rax, %r15
	cvtsi2sd	%ebx, %xmm0
	movapd	%xmm0, %xmm1
	addsd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	movsd	.LCPI5_0(%rip), %xmm0           # xmm0 = mem[0],zero
	movsd	%xmm1, 48(%rsp)                 # 8-byte Spill
	mulsd	%xmm1, %xmm0
	xorl	%ebx, %ebx
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	sqrtsd	%xmm0, %xmm0
	movsd	%xmm0, 40(%rsp)                 # 8-byte Spill
	xorpd	%xmm1, %xmm1
.LBB5_16:                               # =>This Inner Loop Header: Depth=1
	movsd	%xmm1, 56(%rsp)                 # 8-byte Spill
	leal	-2(%rbx), %eax
	imull	%eax, %eax
	negl	%eax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	48(%rsp), %xmm0                 # 8-byte Folded Reload
	callq	exp
	movapd	%xmm0, %xmm1
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	ucomisd	.LCPI5_1(%rip), %xmm0
	movsd	40(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	jae	.LBB5_18
# %bb.17:                               # %call.sqrt
                                        #   in Loop: Header=BB5_16 Depth=1
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	%xmm1, 32(%rsp)                 # 8-byte Spill
	callq	sqrt
	movsd	32(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
.LBB5_18:                               # %.split
                                        #   in Loop: Header=BB5_16 Depth=1
	divsd	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtsd2ss	%xmm1, %xmm0
	movss	%xmm0, (%r15,%rbx,4)
	cvtss2sd	%xmm0, %xmm0
	movsd	56(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	addsd	%xmm0, %xmm1
	incq	%rbx
	cmpq	$5, %rbx
	jne	.LBB5_16
# %bb.19:                               # %.preheader.preheader
	xorl	%eax, %eax
.LBB5_20:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r15,%rax,4), %xmm0
	divsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%r15,%rax,4)
	incq	%rax
	cmpq	$5, %rax
	jne	.LBB5_20
# %bb.21:
	movq	%r14, %rdi
	movq	%r12, %rsi
	movq	%r15, %rdx
	callq	_Z11convolvePPMPhS_Pfii
	movl	_ZL5width(%rip), %ebx
	movl	_ZL6height(%rip), %ebp
	movl	%ebx, %eax
	imull	%ebp, %eax
	leal	(%rax,%rax,2), %eax
	movslq	%eax, %rdi
	callq	malloc
.Ltmp5:
	movq	%r14, %rdi
	movl	%ebx, %esi
	movl	%ebp, %edx
	movq	%r15, %rcx
	movl	$5, %r8d
	movq	%rax, %r9
	callq	_Z11gpuFunctionPhiiPfiS_
.Ltmp6:
# %bb.22:
	leaq	80(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB5_24
# %bb.23:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB5_24:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	xorl	%eax, %eax
	addq	$96, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB5_25:
	.cfi_def_cfa_offset 144
	movq	stderr(%rip), %rcx
	movl	$.L.str.13, %edi
	movl	$26, %esi
	jmp	.LBB5_29
.LBB5_26:
	movq	stderr(%rip), %rdi
	movl	$.L.str.11, %esi
	jmp	.LBB5_34
.LBB5_27:
	movq	%r14, %rdi
	callq	perror
	jmp	.LBB5_30
.LBB5_28:
	movq	stderr(%rip), %rcx
	movl	$.L.str.12, %edi
	movl	$36, %esi
.LBB5_29:
	movl	$1, %edx
	callq	fwrite
	jmp	.LBB5_30
.LBB5_31:
	movq	stderr(%rip), %rdi
	movl	$.L.str.15, %esi
	jmp	.LBB5_34
.LBB5_32:
	movq	stderr(%rip), %rdi
	movl	$.L.str.17, %esi
	jmp	.LBB5_34
.LBB5_33:
	movq	stderr(%rip), %rdi
	movl	$.L.str.18, %esi
.LBB5_34:
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	fprintf
.LBB5_30:
	movl	$1, %edi
	callq	exit
.LBB5_35:
.Ltmp7:
	jmp	.LBB5_37
.LBB5_36:
.Ltmp4:
.LBB5_37:
	movq	%rax, %rbx
	leaq	80(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB5_39
# %bb.38:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i40
	callq	_ZdlPv
.LBB5_39:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit42
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end5:
	.size	main, .Lfunc_end5-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table5:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp3-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp3
	.uleb128 .Ltmp4-.Lfunc_begin0           #     jumps to .Ltmp4
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp5-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp6-.Ltmp5                  #   Call between .Ltmp5 and .Ltmp6
	.uleb128 .Ltmp7-.Lfunc_begin0           #     jumps to .Ltmp7
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Lfunc_end5-.Ltmp6             #   Call between .Ltmp6 and .Lfunc_end5
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_ # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	je	.LBB6_1
# %bb.2:
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	strlen
	leaq	(%rax,%rbx), %rdx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # TAILCALL
.LBB6_1:
	.cfi_def_cfa_offset 32
	movl	$.L.str.19, %edi
	callq	_ZSt19__throw_logic_errorPKc
.Lfunc_end6:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .Lfunc_end6-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB7_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB7_3
.LBB7_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB7_3:
	testq	%r14, %r14
	je	.LBB7_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB7_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB7_7
.LBB7_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB7_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end7:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end7-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_endproc
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB8_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB8_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_, %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	$_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end8:
	.size	__hip_module_ctor, .Lfunc_end8-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB9_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB9_2:
	retq
.Lfunc_end9:
	.size	__hip_module_dtor, .Lfunc_end9-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_,@object # @_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	.section	.rodata,"a",@progbits
	.globl	_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	.p2align	3, 0x0
_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_:
	.quad	_Z31__device_stub__gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	.size	_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_, 8

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/tejeswinijayaramareddy/2D-Convolution--CUDA/master/kernel.hip"
	.size	.L.str, 124

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Convolution time on GPU is %lf fractional seconds\n"
	.size	.L.str.1, 51

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"gpu_out.ppm"
	.size	.L.str.2, 12

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

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"P6\n"
	.size	.L.str.4, 4

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

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

	.type	_ZL5width,@object               # @_ZL5width
	.local	_ZL5width
	.comm	_ZL5width,4,4
	.type	_ZL6height,@object              # @_ZL6height
	.local	_ZL6height
	.comm	_ZL6height,4,4
	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"CPU_out.ppm"
	.size	.L.str.7, 12

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Convolution time for CPU is %lf fractional seconds\n"
	.size	.L.str.8, 52

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"%s in %s at line %d\n"
	.size	.L.str.9, 21

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

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Unable to open file '%s'\n"
	.size	.L.str.11, 26

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Invalid image format (must be 'P6')\n"
	.size	.L.str.12, 37

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Unable to allocate memory\n"
	.size	.L.str.13, 27

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"%d %d"
	.size	.L.str.14, 6

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"Invalid image size (error loading '%s')\n"
	.size	.L.str.15, 41

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

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"Invalid rgb component (error loading '%s')\n"
	.size	.L.str.17, 44

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"'%s' does not have 8-bits components\n"
	.size	.L.str.18, 38

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"basic_string: construction from null is not valid"
	.size	.L.str.19, 50

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_"
	.size	.L__unnamed_1, 48

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_"
	.size	.L__unnamed_2, 51

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

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

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z31__device_stub__gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	.addrsig_sym _Z31__device_stub__gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	.addrsig_sym _Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_ ; -- Begin function _Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	.globl	_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
	.p2align	8
	.type	_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_,@function
_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_: ; @_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
; %bb.0:
	s_clause 0x1
	s_load_b512 s[16:31], s[0:1], 0x10
	s_load_b32 s2, s[0:1], 0x5c
	v_and_b32_e32 v3, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_load_b32 s3, s[16:17], 0x0
	s_and_b32 s4, s2, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[1:2], null, s14, s4, v[3:4]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_ge_i32_e32 vcc_lo, s3, v1
	s_and_saveexec_b32 s3, vcc_lo
	s_cbranch_execz .LBB0_6
; %bb.1:
	s_load_b32 s3, s[18:19], 0x0
	v_bfe_u32 v0, v0, 10, 10
	s_lshr_b32 s2, s2, 16
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[2:3], null, s15, s2, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_ge_i32_e32 vcc_lo, s3, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_6
; %bb.2:
	v_cmp_lt_u32_e32 vcc_lo, 1, v1
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_5
; %bb.3:                                ; %.preheader
	s_load_b64 s[2:3], s[0:1], 0x0
	v_dual_mov_b32 v3, 0 :: v_dual_add_nc_u32 v0, -1, v1
	s_mov_b64 s[4:5], 0
.LBB0_4:                                ; =>This Inner Loop Header: Depth=1
	global_load_b32 v4, v3, s[16:17]
	s_waitcnt lgkmcnt(0)
	s_add_u32 s6, s2, s4
	s_addc_u32 s7, s3, s5
	s_add_u32 s4, s4, 4
	global_load_b32 v8, v3, s[6:7]
	s_addc_u32 s5, s5, 0
	s_cmp_lg_u32 s4, 20
	s_waitcnt vmcnt(1)
	v_mul_lo_u32 v4, v4, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v5, v0, v4
	v_add_nc_u32_e32 v4, v4, v1
	v_ashrrev_i32_e32 v7, 31, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_ashrrev_i32_e32 v9, 31, v4
	v_add_co_u32 v6, s0, s20, v5
	v_add_co_u32 v4, vcc_lo, s26, v4
	v_add_co_ci_u32_e64 v7, s0, s21, v7, s0
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_ci_u32_e32 v5, vcc_lo, s27, v9, vcc_lo
	global_load_u8 v6, v[6:7], off
	global_load_u8 v7, v[4:5], off
	s_waitcnt vmcnt(1)
	v_cvt_f32_ubyte0_e32 v6, v6
	s_waitcnt vmcnt(0)
	v_cvt_f32_ubyte0_e32 v7, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v7, v8, v6
	v_cvt_i32_f32_e32 v6, v7
	global_store_b8 v[4:5], v6, off
	s_clause 0x1
	global_load_b32 v4, v3, s[16:17]
	global_load_b32 v8, v3, s[6:7]
	s_waitcnt vmcnt(1)
	v_mul_lo_u32 v4, v4, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v5, v0, v4
	v_add_nc_u32_e32 v4, v4, v1
	v_ashrrev_i32_e32 v7, 31, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_ashrrev_i32_e32 v9, 31, v4
	v_add_co_u32 v6, s0, s22, v5
	v_add_co_u32 v4, vcc_lo, s28, v4
	v_add_co_ci_u32_e64 v7, s0, s23, v7, s0
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_ci_u32_e32 v5, vcc_lo, s29, v9, vcc_lo
	global_load_u8 v6, v[6:7], off
	global_load_u8 v7, v[4:5], off
	s_waitcnt vmcnt(1)
	v_cvt_f32_ubyte0_e32 v6, v6
	s_waitcnt vmcnt(0)
	v_cvt_f32_ubyte0_e32 v7, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v7, v8, v6
	v_cvt_i32_f32_e32 v6, v7
	global_store_b8 v[4:5], v6, off
	s_clause 0x1
	global_load_b32 v4, v3, s[16:17]
	global_load_b32 v8, v3, s[6:7]
	s_waitcnt vmcnt(1)
	v_mul_lo_u32 v4, v4, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v5, v0, v4
	v_add_nc_u32_e32 v0, 1, v0
	v_add_nc_u32_e32 v4, v4, v1
	v_ashrrev_i32_e32 v7, 31, v5
	v_add_co_u32 v6, s0, s24, v5
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_ashrrev_i32_e32 v9, 31, v4
	v_add_co_u32 v4, vcc_lo, s30, v4
	v_add_co_ci_u32_e64 v7, s0, s25, v7, s0
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v5, vcc_lo, s31, v9, vcc_lo
	global_load_u8 v6, v[6:7], off
	global_load_u8 v7, v[4:5], off
	s_waitcnt vmcnt(1)
	v_cvt_f32_ubyte0_e32 v6, v6
	s_waitcnt vmcnt(0)
	v_cvt_f32_ubyte0_e32 v7, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v7, v8, v6
	v_cvt_i32_f32_e32 v6, v7
	global_store_b8 v[4:5], v6, off
	s_cbranch_scc1 .LBB0_4
.LBB0_5:                                ; %.loopexit
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
.LBB0_6:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 336
		.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 10
		.amdhsa_next_free_sgpr 32
		.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	_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_, .Lfunc_end0-_Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 632
; NumSgprs: 34
; NumVgprs: 10
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 4
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 34
; NumVGPRsForWavesPerEU: 10
; 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	_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_ ; -- Begin function _Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	.globl	_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
	.p2align	8
	.type	_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_,@function
_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_: ; @_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
; %bb.0:
	s_clause 0x1
	s_load_b512 s[16:31], s[0:1], 0x10
	s_load_b32 s2, s[0:1], 0x64
	v_and_b32_e32 v3, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_load_b32 s3, s[16:17], 0x0
	s_and_b32 s4, s2, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[1:2], null, s14, s4, v[3:4]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_ge_i32_e32 vcc_lo, s3, v1
	s_and_saveexec_b32 s3, vcc_lo
	s_cbranch_execz .LBB1_6
; %bb.1:
	s_load_b32 s3, s[18:19], 0x0
	v_bfe_u32 v0, v0, 10, 10
	s_lshr_b32 s2, s2, 16
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[2:3], null, s15, s2, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_ge_i32_e32 vcc_lo, s3, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB1_6
; %bb.2:
	v_cmp_lt_u32_e32 vcc_lo, 1, v1
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB1_5
; %bb.3:                                ; %.preheader
	s_load_b64 s[2:3], s[0:1], 0x0
	v_mov_b32_e32 v0, 0
	s_mov_b32 s1, -1
.LBB1_4:                                ; =>This Inner Loop Header: Depth=1
	global_load_b32 v6, v0, s[16:17]
	s_waitcnt lgkmcnt(0)
	global_load_b32 v9, v0, s[2:3]
	v_add_nc_u32_e32 v8, s1, v2
	s_add_i32 s1, s1, 1
	s_waitcnt vmcnt(1)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[3:4], null, v6, v8, v[1:2]
	v_mad_u64_u32 v[4:5], null, v6, v2, v[1:2]
	v_ashrrev_i32_e32 v5, 31, v3
	v_add_co_u32 v6, s0, s20, v3
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_ashrrev_i32_e32 v10, 31, v4
	v_add_co_u32 v4, vcc_lo, s26, v4
	v_add_co_ci_u32_e64 v7, s0, s21, v5, s0
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v5, vcc_lo, s27, v10, vcc_lo
	global_load_u8 v3, v[6:7], off
	global_load_u8 v6, v[4:5], off
	s_waitcnt vmcnt(1)
	v_cvt_f32_ubyte0_e32 v3, v3
	s_waitcnt vmcnt(0)
	v_cvt_f32_ubyte0_e32 v6, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v9, v3
	v_cvt_i32_f32_e32 v3, v6
	global_store_b8 v[4:5], v3, off
	s_clause 0x1
	global_load_b32 v6, v0, s[16:17]
	global_load_b32 v9, v0, s[2:3]
	s_waitcnt vmcnt(1)
	v_mad_u64_u32 v[3:4], null, v6, v8, v[1:2]
	v_mad_u64_u32 v[4:5], null, v6, v2, v[1:2]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_ashrrev_i32_e32 v5, 31, v3
	v_add_co_u32 v6, s0, s22, v3
	v_ashrrev_i32_e32 v10, 31, v4
	v_add_co_u32 v4, vcc_lo, s28, v4
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e64 v7, s0, s23, v5, s0
	v_add_co_ci_u32_e32 v5, vcc_lo, s29, v10, vcc_lo
	global_load_u8 v3, v[6:7], off
	global_load_u8 v6, v[4:5], off
	s_waitcnt vmcnt(1)
	v_cvt_f32_ubyte0_e32 v3, v3
	s_waitcnt vmcnt(0)
	v_cvt_f32_ubyte0_e32 v6, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v9, v3
	v_cvt_i32_f32_e32 v3, v6
	global_store_b8 v[4:5], v3, off
	s_clause 0x1
	global_load_b32 v6, v0, s[16:17]
	global_load_b32 v9, v0, s[2:3]
	s_add_u32 s2, s2, 4
	s_addc_u32 s3, s3, 0
	s_cmp_lg_u32 s1, 4
	s_waitcnt vmcnt(1)
	v_mad_u64_u32 v[3:4], null, v6, v8, v[1:2]
	v_mad_u64_u32 v[4:5], null, v6, v2, v[1:2]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_ashrrev_i32_e32 v5, 31, v3
	v_add_co_u32 v6, s0, s24, v3
	v_ashrrev_i32_e32 v8, 31, v4
	v_add_co_u32 v4, vcc_lo, s30, v4
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e64 v7, s0, s25, v5, s0
	v_add_co_ci_u32_e32 v5, vcc_lo, s31, v8, vcc_lo
	global_load_u8 v3, v[6:7], off
	global_load_u8 v6, v[4:5], off
	s_waitcnt vmcnt(1)
	v_cvt_f32_ubyte0_e32 v3, v3
	s_waitcnt vmcnt(0)
	v_cvt_f32_ubyte0_e32 v6, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v9, v3
	v_cvt_i32_f32_e32 v3, v6
	global_store_b8 v[4:5], v3, off
	s_cbranch_scc1 .LBB1_4
.LBB1_5:                                ; %.loopexit
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
.LBB1_6:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 344
		.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 11
		.amdhsa_next_free_sgpr 32
		.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	_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_, .Lfunc_end1-_Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 616
; NumSgprs: 34
; NumVgprs: 11
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 4
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 34
; NumVGPRsForWavesPerEU: 11
; 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
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .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
      - .address_space:  global
        .offset:         64
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         72
        .size:           8
        .value_kind:     global_buffer
      - .offset:         80
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         84
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         88
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         92
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         94
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         96
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         98
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         100
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         102
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         120
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         128
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         136
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         144
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 336
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_
    .private_segment_fixed_size: 0
    .sgpr_count:     34
    .sgpr_spill_count: 0
    .symbol:         _Z16gpuConvolution_xPfPiS0_S0_PhS1_S1_S1_S1_S1_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     10
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         48
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         56
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         64
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         72
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         80
        .size:           8
        .value_kind:     global_buffer
      - .offset:         88
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         92
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         96
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         100
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         102
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         104
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         106
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         108
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         110
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         128
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         136
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         144
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         152
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 344
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_
    .private_segment_fixed_size: 0
    .sgpr_count:     34
    .sgpr_spill_count: 0
    .symbol:         _Z16gpuConvolution_yPfPiS0_S0_PhS1_S1_S1_S1_S1_S1_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     11
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
