#include <iostream>
#include <fstream>
#include <sstream>
#include <stdlib.h>

#include <cuda_runtime.h>

 
 __global__ void
convolution(const float *A, const float *B, float *C, int a_rows, int a_cols, int b_rows, int b_cols, int c_rows, int c_cols)
{
    int m = blockDim.y * blockIdx.y + threadIdx.y;
	int n = blockDim.x * blockIdx.x + threadIdx.x;

	if(m < c_rows && n < c_cols)
	{
		C[m*(c_cols) + n] = 0;
		for(int i=0;i < b_rows;i++)
		{
			for(int j=0; j < b_cols;j++)
			{
				if(((m-i) < a_rows && (m-i) >= 0) && ((n-j) < a_cols && (n-j) >= 0))
				{
					C[m*(c_cols) + n] = B[i*(b_cols) + j] * A[(m-i)*a_cols + (n-j)] + C[m*(c_cols) + n];
				}
			}
		}
	}
	
}

/**
 * Host main routine
 */
int main(int argc, char *argv[])
{
	// Error code to check return values for CUDA calls
    cudaError_t err = cudaSuccess;
	
	bool first = true;
	float number;
	std::ifstream input(argv[1]);
	int a_rows = 0;
	int a_cols = 0;
	int b_rows = 0;
	int b_cols = 0;
	std::string line;
	
	while(std::getline(input, line))
	{
    if(line.empty())
        first = false;
    std::istringstream element (line);
    if(first == true)
    {
        a_cols = 0;
        while(element >> number)
        {
            a_cols++;
        }
        a_rows++;
    }

    else
    {
        if(!line.empty())
        {
            b_cols = 0;
             while(element >> number)
             {
                 b_cols++;
             }
        b_rows++;
        }
		}
	}
	
	int c_rows = a_rows+b_rows - 1;
	int c_cols = a_cols+b_cols - 1;
	
	size_t size1 = a_rows * a_cols * sizeof(float);
	size_t size2 = b_rows * b_cols * sizeof(float);
	size_t size3 = ((a_rows+b_rows-1)*(a_cols*b_cols-1)) * sizeof(float);
	
	float *h_A = (float *)malloc(size1);
	float *h_B = (float *)malloc(size2);
	float *h_C = (float *)malloc(size3);
	//int numElements = (a_rows+b_rows-1) * (a_cols+b_cols-1);
	
	std::ifstream input1(argv[1]);
	a_rows=a_cols=b_rows=b_cols=0;
	first = true;
	int i=0;
	int j=0;
	
	while(std::getline(input1, line))
	{
    std::istringstream element (line);
    if(line.empty())
        first = false;

    if(first == true)
    {
        a_cols=0;
        while(element >> number)
        {
            h_A[i] = number;
			i++;
            a_cols++;
        }
        a_rows++;
    }

    else
    {
        b_cols = 0;
        if(!line.empty())
        {
            while(element >> number)
            {
                h_B[j] = number;
				j++;
                b_cols++;
            }
            b_rows++;
        }

    }

	}
	
	for(int i = 0; i<a_rows;i++)
	{
		for(int j=0;j<a_cols;j++)
		{
			printf("%.3f ", h_A[i*a_cols+j]);
		}
		printf("\n");
	}
	printf("\n");
	
	for(int i = 0; i<b_rows;i++)
	{
		for(int j=0;j<b_cols;j++)
		{
			printf("%.3f ", h_B[i*b_cols+j]);
		}
		printf("\n");
	}
	
	
	
	
	
	
	printf("%d, %d\n", a_rows, a_cols);
	printf("%d, %d\n", b_rows, b_cols);
	printf("%d, %d\n", c_rows, c_cols);
	
	// Verify that allocations succeeded
    if (h_A == NULL || h_B == NULL || h_C == NULL)
    {
        fprintf(stderr, "Failed to allocate host vectors!\n");
        exit(EXIT_FAILURE);
    }
	
	
	float *d_A = NULL;
    err = cudaMalloc((void **)&d_A, size1);

    if (err != cudaSuccess)
    {
        fprintf(stderr, "Failed to allocate device vector A (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    // Allocate the device input vector B
    float *d_B = NULL;
    err = cudaMalloc((void **)&d_B, size2);

    if (err != cudaSuccess)
    {
        fprintf(stderr, "Failed to allocate device vector B (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    // Allocate the device output vector C
    float *d_C = NULL;
    err = cudaMalloc((void **)&d_C, size3);

    if (err != cudaSuccess)
    {
        fprintf(stderr, "Failed to allocate device vector C (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	// Copy the host input vectors A and B in host memory to the device input vectors in
    // device memory
    printf("Copy input data from the host memory to the CUDA device\n");
    err = cudaMemcpy(d_A, h_A, size1, cudaMemcpyHostToDevice);

    if (err != cudaSuccess)
    {
        fprintf(stderr, "Failed to copy vector A from host to device (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    err = cudaMemcpy(d_B, h_B, size2, cudaMemcpyHostToDevice);

    if (err != cudaSuccess)
    {
        fprintf(stderr, "Failed to copy vector B from host to device (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	// Launch the Vector Add CUDA Kernel
	dim3 dimGrid(((c_rows-1)/2)+1, ((c_cols-1)/2)+1, 1);
	dim3 dimBlock(16, 16, 1);
    //int threadsPerBlock = 256;
    //int blocksPerGrid =(numElements + threadsPerBlock - 1) / threadsPerBlock;
   // printf("CUDA kernel launch with %d blocks of %d threads\n", blocksPerGrid, threadsPerBlock);
    convolution<<<dimGrid, dimBlock>>>(d_A, d_B, d_C, a_rows, a_cols, b_rows, b_cols, c_rows, c_cols);
    err = cudaGetLastError();

    if (err != cudaSuccess)
    {
        fprintf(stderr, "Failed to launch vectorAdd kernel (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	
	// Copy the device result vector in device memory to the host result vector
    // in host memory.
    printf("Copy output data from the CUDA device to the host memory\n");
    err = cudaMemcpy(h_C, d_C, size3, cudaMemcpyDeviceToHost);

    if (err != cudaSuccess)
    {
        fprintf(stderr, "Failed to copy vector C from device to host (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	for(int i = 0; i<c_rows; i++)
	{
		for(int j = 0; j < c_cols; j++)
		{
			printf("%.3f ", h_C[i*(c_cols)+j]);
		}
		printf("\n");
	}
	
	
	// Free device global memory
    err = cudaFree(d_A);

    if (err != cudaSuccess)
    {
        fprintf(stderr, "Failed to free device vector A (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    err = cudaFree(d_B);

    if (err != cudaSuccess)
    {
        fprintf(stderr, "Failed to free device vector B (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    err = cudaFree(d_C);

    if (err != cudaSuccess)
    {
        fprintf(stderr, "Failed to free device vector C (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    // Free host memory
    free(h_A);
    free(h_B);
    free(h_C);

    // Reset the device and exit
    // cudaDeviceReset causes the driver to clean up all state. While
    // not mandatory in normal operation, it is good practice.  It is also
    // needed to ensure correct operation when the application is being
    // profiled. Calling cudaDeviceReset causes all profile data to be
    // flushed before the application exits
    err = cudaDeviceReset();

    if (err != cudaSuccess)
    {
        fprintf(stderr, "Failed to deinitialize the device! error=%s\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    return 0;
}

	.file	"tmpxft_0036121a_00000000-6_2dconvol.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3827:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3827:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z43__device_stub__Z11convolutionPKfS0_PfiiiiiiPKfS0_Pfiiiiii
	.type	_Z43__device_stub__Z11convolutionPKfS0_PfiiiiiiPKfS0_Pfiiiiii, @function
_Z43__device_stub__Z11convolutionPKfS0_PfiiiiiiPKfS0_Pfiiiiii:
.LFB3849:
	.cfi_startproc
	endbr64
	subq	$200, %rsp
	.cfi_def_cfa_offset 208
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	48(%rsp), %rdx
	movl	%ecx, 20(%rsp)
	leaq	56(%rsp), %rcx
	movl	%r8d, 16(%rsp)
	movl	%r9d, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	208(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	216(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	224(%rsp), %rax
	movq	%rax, 176(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	56(%rsp)
	.cfi_def_cfa_offset 216
	leaq	_Z11convolutionPKfS0_Pfiiiiii(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 224
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 216
	popq	%rdx
	.cfi_def_cfa_offset 208
.L2:
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$200, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3849:
	.size	_Z43__device_stub__Z11convolutionPKfS0_PfiiiiiiPKfS0_Pfiiiiii, .-_Z43__device_stub__Z11convolutionPKfS0_PfiiiiiiPKfS0_Pfiiiiii
	.globl	_Z11convolutionPKfS0_Pfiiiiii
	.type	_Z11convolutionPKfS0_Pfiiiiii, @function
_Z11convolutionPKfS0_Pfiiiiii:
.LFB3850:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z11convolutionPKfS0_PfiiiiiiPKfS0_Pfiiiiii
	.cfi_endproc
.LFE3850:
	.size	_Z11convolutionPKfS0_Pfiiiiii, .-_Z11convolutionPKfS0_Pfiiiiii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z11convolutionPKfS0_Pfiiiiii"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3852:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 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	.LC0(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z11convolutionPKfS0_Pfiiiiii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	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	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3852:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC1:
	.string	"%.3f "
.LC2:
	.string	"\n"
.LC3:
	.string	"%d, %d\n"
.LC4:
	.string	"Failed to allocate host vectors!\n"
.LC5:
	.string	"Failed to allocate device vector A (error code %s)!\n"
.LC6:
	.string	"Failed to allocate device vector B (error code %s)!\n"
.LC7:
	.string	"Failed to allocate device vector C (error code %s)!\n"
.LC8:
	.string	"Copy input data from the host memory to the CUDA device\n"
.LC9:
	.string	"Failed to copy vector A from host to device (error code %s)!\n"
.LC10:
	.string	"Failed to copy vector B from host to device (error code %s)!\n"
.LC11:
	.string	"Failed to launch vectorAdd kernel (error code %s)!\n"
.LC12:
	.string	"Copy output data from the CUDA device to the host memory\n"
.LC13:
	.string	"Failed to copy vector C from device to host (error code %s)!\n"
.LC14:
	.string	"Failed to free device vector A (error code %s)!\n"
.LC15:
	.string	"Failed to free device vector B (error code %s)!\n"
.LC16:
	.string	"Failed to free device vector C (error code %s)!\n"
.LC17:
	.string	"Failed to deinitialize the device! error=%s\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3823:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3823
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$8, %edx
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	.cfi_offset 15, -24
	movb	$1, %r15b
	pushq	%r14
	.cfi_offset 14, -32
	xorl	%r14d, %r14d
	pushq	%r13
	.cfi_offset 13, -40
	movq	%rsi, %r13
	pushq	%r12
	.cfi_offset 12, -48
	xorl	%r12d, %r12d
	pushq	%rbx
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$1624, %rsp
	movq	8(%rsi), %rsi
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-1096(%rbp), %rax
	movq	%rax, %rdi
	movq	%rax, -1600(%rbp)
.LEHB0:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE0:
	leaq	-1496(%rbp), %rax
	xorl	%r11d, %r11d
	movb	$0, -1496(%rbp)
	movq	%rax, -1512(%rbp)
	leaq	-1512(%rbp), %rax
	movq	%r11, -1504(%rbp)
	movq	%rax, -1608(%rbp)
	movl	%ebx, -1588(%rbp)
	xorl	%ebx, %ebx
.L11:
	movq	-1608(%rbp), %rsi
	movq	-1600(%rbp), %rdi
.LEHB1:
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	movl	32(%rax,%rdx), %eax
	andl	$5, %eax
	movl	%eax, -1584(%rbp)
	leaq	-576(%rbp), %rax
	movq	%rax, -1576(%rbp)
	jne	.L97
	movq	-1608(%rbp), %rsi
	movq	-1576(%rbp), %rdi
	xorl	%eax, %eax
	movl	$8, %edx
	cmpq	$0, -1504(%rbp)
	cmove	%eax, %r15d
	call	_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode@PLT
.LEHE1:
	testb	%r15b, %r15b
	je	.L73
	leaq	-1564(%rbp), %rbx
.L13:
	movq	-1576(%rbp), %rdi
	movq	%rbx, %rsi
.LEHB2:
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L98
	incl	-1584(%rbp)
	jmp	.L13
.L98:
	movl	-1584(%rbp), %ebx
	incl	%r12d
	jmp	.L16
.L73:
	cmpq	$0, -1504(%rbp)
	je	.L16
	leaq	-1564(%rbp), %r14
.L17:
	movq	-1576(%rbp), %rdi
	movq	%r14, %rsi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
.LEHE2:
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L99
	incl	-1584(%rbp)
	jmp	.L17
.L99:
	incl	-1588(%rbp)
	movl	-1584(%rbp), %r14d
.L16:
	movq	-1576(%rbp), %rdi
	call	_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	jmp	.L11
.L97:
	movl	-1588(%rbp), %eax
	addl	%r12d, %eax
	imull	%ebx, %r12d
	movl	%eax, -1652(%rbp)
	decl	%eax
	movl	%eax, -1608(%rbp)
	leal	(%rbx,%r14), %eax
	movl	%eax, -1656(%rbp)
	movslq	%r12d, %r12
	imull	%r14d, %ebx
	decl	%eax
	movl	%eax, -1592(%rbp)
	leaq	0(,%r12,4), %rax
	movq	%rax, -1632(%rbp)
	movl	-1588(%rbp), %eax
	decl	%ebx
	movq	-1632(%rbp), %rdi
	imull	%r14d, %eax
	cltq
	salq	$2, %rax
	movq	%rax, -1640(%rbp)
	movl	-1608(%rbp), %eax
	imull	%eax, %ebx
	movslq	%ebx, %rbx
	leaq	0(,%rbx,4), %rax
	movq	%rax, -1648(%rbp)
	call	malloc@PLT
	movq	-1640(%rbp), %rdi
	movq	%rax, -1584(%rbp)
	call	malloc@PLT
	movq	-1648(%rbp), %rdi
	movq	%rax, %r15
	call	malloc@PLT
	movq	8(%r13), %rsi
	movl	$8, %edx
	movq	-1576(%rbp), %rdi
	movq	%rax, -1616(%rbp)
.LEHB3:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE3:
	xorl	%r10d, %r10d
	leaq	-1512(%rbp), %rax
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	movl	%r10d, -1600(%rbp)
	xorl	%ebx, %ebx
	movb	$1, %r14b
	movl	%r10d, -1576(%rbp)
	movl	%r10d, -1588(%rbp)
	movq	%rax, -1664(%rbp)
.L20:
	movq	-1664(%rbp), %rsi
	leaq	-576(%rbp), %rdi
.LEHB4:
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	movl	32(%rax,%rdx), %eax
	andl	$5, %eax
	movl	%eax, -1624(%rbp)
	jne	.L100
	movq	-1664(%rbp), %rsi
	leaq	-1480(%rbp), %rdi
	movl	$8, %edx
	call	_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode@PLT
.LEHE4:
	cmpq	$0, -1504(%rbp)
	je	.L65
	testb	%r14b, %r14b
	jne	.L22
	leaq	-1564(%rbp), %rax
	movslq	%r13d, %rbx
	movq	%rax, -1624(%rbp)
	jmp	.L23
.L22:
	movslq	%r12d, %rax
	movq	%rax, -1624(%rbp)
	leaq	-1564(%rbp), %rax
	movq	%rax, -1576(%rbp)
.L24:
	movq	-1576(%rbp), %rsi
	leaq	-1480(%rbp), %rdi
.LEHB5:
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L101
	movq	-1624(%rbp), %rcx
	movss	-1564(%rbp), %xmm0
	movq	-1584(%rbp), %rax
	incq	-1624(%rbp)
	movss	%xmm0, (%rax,%rcx,4)
	jmp	.L24
.L101:
	movl	-1624(%rbp), %eax
	incl	-1588(%rbp)
	subl	%r12d, %eax
	movl	-1624(%rbp), %r12d
	movl	%ebx, -1624(%rbp)
	movl	%eax, -1576(%rbp)
	jmp	.L21
.L103:
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L102
	movss	-1564(%rbp), %xmm0
	movss	%xmm0, (%r15,%rbx,4)
	incq	%rbx
.L23:
	movq	-1624(%rbp), %rsi
	leaq	-1480(%rbp), %rdi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
.LEHE5:
	jmp	.L103
.L102:
	movl	%ebx, %eax
	incl	-1600(%rbp)
	subl	%r13d, %eax
	movl	%ebx, %r13d
	movl	%eax, -1624(%rbp)
	jmp	.L21
.L65:
	xorl	%r14d, %r14d
.L21:
	leaq	-1480(%rbp), %rdi
	call	_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	movl	-1624(%rbp), %ebx
	jmp	.L20
.L100:
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
.L28:
	cmpl	%r13d, -1588(%rbp)
	jle	.L30
	xorl	%r9d, %r9d
	movq	-1584(%rbp), %rcx
	movslq	%r12d, %rax
	movq	%r9, -1624(%rbp)
	leaq	(%rcx,%rax,4), %r14
.L31:
	movl	-1624(%rbp), %ecx
	cmpl	%ecx, -1576(%rbp)
	jle	.L104
	movq	-1624(%rbp), %rax
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	cvtss2sd	(%r14,%rax,4), %xmm0
	movb	$1, %al
.LEHB6:
	call	__printf_chk@PLT
	incq	-1624(%rbp)
	jmp	.L31
.L104:
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	-1576(%rbp), %eax
	incl	%r13d
	addl	%eax, %r12d
	jmp	.L28
.L30:
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
.L32:
	cmpl	%r13d, -1600(%rbp)
	jle	.L34
	xorl	%r8d, %r8d
	movslq	%r12d, %rax
	movq	%r8, -1624(%rbp)
	leaq	(%r15,%rax,4), %r14
.L35:
	movl	-1624(%rbp), %eax
	cmpl	%eax, %ebx
	jle	.L105
	movq	-1624(%rbp), %rax
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	cvtss2sd	(%r14,%rax,4), %xmm0
	movb	$1, %al
	call	__printf_chk@PLT
	incq	-1624(%rbp)
	jmp	.L35
.L105:
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	incl	%r13d
	addl	%ebx, %r12d
	jmp	.L32
.L34:
	movl	-1576(%rbp), %ecx
	movl	-1588(%rbp), %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	-1600(%rbp), %edx
	movl	%ebx, %ecx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	movl	-1592(%rbp), %ecx
	movl	-1608(%rbp), %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	cmpq	$0, -1584(%rbp)
	sete	%al
	testq	%r15, %r15
	sete	%dl
	orb	%dl, %al
	jne	.L70
	cmpq	$0, -1616(%rbp)
	jne	.L36
.L70:
	movq	stderr(%rip), %rdi
	leaq	.LC4(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L39:
	movl	$1, %edi
	call	exit@PLT
.L36:
	xorl	%edi, %edi
	movq	-1632(%rbp), %rsi
	movq	%rdi, -1560(%rbp)
	leaq	-1560(%rbp), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L38
	call	cudaGetErrorString@PLT
	movq	%rax, %rcx
	leaq	.LC5(%rip), %rdx
	jmp	.L79
.L38:
	xorl	%esi, %esi
	leaq	-1552(%rbp), %rdi
	movq	%rsi, -1552(%rbp)
	movq	-1640(%rbp), %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L40
	call	cudaGetErrorString@PLT
	movq	%rax, %rcx
	leaq	.LC6(%rip), %rdx
	jmp	.L79
.L40:
	movq	-1648(%rbp), %rsi
	xorl	%ecx, %ecx
	leaq	-1544(%rbp), %rdi
	movq	%rcx, -1544(%rbp)
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L41
	call	cudaGetErrorString@PLT
	movq	%rax, %rcx
	leaq	.LC7(%rip), %rdx
	jmp	.L79
.L41:
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-1632(%rbp), %rdx
	movq	-1584(%rbp), %rsi
	movl	$1, %ecx
	movq	-1560(%rbp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L42
	call	cudaGetErrorString@PLT
	movq	%rax, %rcx
	leaq	.LC9(%rip), %rdx
	jmp	.L79
.L42:
	movq	-1640(%rbp), %rdx
	movq	-1552(%rbp), %rdi
	movl	$1, %ecx
	movq	%r15, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L43
	call	cudaGetErrorString@PLT
	movq	%rax, %rcx
	leaq	.LC10(%rip), %rdx
	jmp	.L79
.L43:
	movl	$2, %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %esi
	movl	-1652(%rbp), %eax
	subl	$2, %eax
	cltd
	idivl	%ecx
	incl	%eax
	movl	%eax, -1536(%rbp)
	movl	-1656(%rbp), %eax
	subl	$2, %eax
	cltd
	idivl	%ecx
	movabsq	$68719476752, %rdx
	movl	$1, %ecx
	incl	%eax
	movl	%eax, -1532(%rbp)
	movq	-1536(%rbp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L44
.L46:
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L47
	jmp	.L106
.L44:
	pushq	%rdx
	movl	-1592(%rbp), %eax
	movl	-1600(%rbp), %r9d
	movl	-1576(%rbp), %r8d
	movl	-1588(%rbp), %ecx
	movq	-1544(%rbp), %rdx
	pushq	%rax
	movl	-1608(%rbp), %eax
	movq	-1552(%rbp), %rsi
	movq	-1560(%rbp), %rdi
	pushq	%rax
	pushq	%rbx
	.cfi_escape 0x2e,0x20
	call	_Z43__device_stub__Z11convolutionPKfS0_PfiiiiiiPKfS0_Pfiiiiii
	addq	$32, %rsp
	jmp	.L46
.L106:
	.cfi_escape 0x2e,0
	call	cudaGetErrorString@PLT
	movq	%rax, %rcx
	leaq	.LC11(%rip), %rdx
	jmp	.L79
.L47:
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-1648(%rbp), %rdx
	movq	-1544(%rbp), %rsi
	movl	$2, %ecx
	movq	-1616(%rbp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %r14
	testl	%eax, %eax
	je	.L49
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movq	%rax, %rcx
	leaq	.LC13(%rip), %rdx
	jmp	.L79
.L50:
	movq	-1576(%rbp), %rax
	movq	%r14, %rsi
	movl	$2, %edi
	cvtss2sd	0(%r13,%rax,4), %xmm0
	movb	$1, %al
	call	__printf_chk@PLT
	incq	-1576(%rbp)
.L52:
	movl	-1576(%rbp), %ecx
	cmpl	%ecx, -1592(%rbp)
	jg	.L50
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	-1592(%rbp), %eax
	incl	%r12d
	addl	%eax, %ebx
.L49:
	movl	-1608(%rbp), %eax
	cmpl	%eax, %r12d
	jge	.L51
	movq	-1616(%rbp), %rcx
	movslq	%ebx, %rax
	leaq	(%rcx,%rax,4), %r13
	xorl	%eax, %eax
	movq	%rax, -1576(%rbp)
	jmp	.L52
.L51:
	movq	-1560(%rbp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L53
	call	cudaGetErrorString@PLT
	movq	%rax, %rcx
	leaq	.LC14(%rip), %rdx
	jmp	.L79
.L53:
	movq	-1552(%rbp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L54
	call	cudaGetErrorString@PLT
	movq	%rax, %rcx
	leaq	.LC15(%rip), %rdx
	jmp	.L79
.L54:
	movq	-1544(%rbp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L55
	call	cudaGetErrorString@PLT
	movq	%rax, %rcx
	leaq	.LC16(%rip), %rdx
	jmp	.L79
.L55:
	movq	-1584(%rbp), %rdi
	call	free@PLT
	movq	%r15, %rdi
	call	free@PLT
	movq	-1616(%rbp), %rdi
	call	free@PLT
	call	cudaDeviceReset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L56
	call	cudaGetErrorString@PLT
	movq	%rax, %rcx
	leaq	.LC17(%rip), %rdx
.L79:
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.LEHE6:
	jmp	.L39
.L56:
	leaq	-576(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	-1512(%rbp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	-1096(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L62
	jmp	.L76
.L66:
	endbr64
	movq	%rax, %rbx
.L57:
	movq	-1576(%rbp), %rdi
	call	_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	jmp	.L58
.L68:
	endbr64
	movq	%rax, %rbx
.L59:
	leaq	-1480(%rbp), %rdi
	call	_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	jmp	.L60
.L69:
	endbr64
	movq	%rax, %rbx
.L60:
	leaq	-576(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L58
.L67:
	endbr64
	movq	%rax, %rbx
.L58:
	leaq	-1512(%rbp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	-1096(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L76
	movq	%rbx, %rdi
.LEHB7:
	call	_Unwind_Resume@PLT
.LEHE7:
.L76:
	call	__stack_chk_fail@PLT
.L62:
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3823:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3823:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3823-.LLSDACSB3823
.LLSDACSB3823:
	.uleb128 .LEHB0-.LFB3823
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3823
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L67-.LFB3823
	.uleb128 0
	.uleb128 .LEHB2-.LFB3823
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L66-.LFB3823
	.uleb128 0
	.uleb128 .LEHB3-.LFB3823
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L67-.LFB3823
	.uleb128 0
	.uleb128 .LEHB4-.LFB3823
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L69-.LFB3823
	.uleb128 0
	.uleb128 .LEHB5-.LFB3823
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L68-.LFB3823
	.uleb128 0
	.uleb128 .LEHB6-.LFB3823
	.uleb128 .LEHE6-.LEHB6
	.uleb128 .L69-.LFB3823
	.uleb128 0
	.uleb128 .LEHB7-.LFB3823
	.uleb128 .LEHE7-.LEHB7
	.uleb128 0
	.uleb128 0
.LLSDACSE3823:
	.section	.text.startup
	.size	main, .-main
	.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
	.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:

#include <iostream>
#include <fstream>
#include <sstream>
#include <stdlib.h>

#include <hip/hip_runtime.h>

 
 __global__ void
convolution(const float *A, const float *B, float *C, int a_rows, int a_cols, int b_rows, int b_cols, int c_rows, int c_cols)
{
    int m = blockDim.y * blockIdx.y + threadIdx.y;
	int n = blockDim.x * blockIdx.x + threadIdx.x;

	if(m < c_rows && n < c_cols)
	{
		C[m*(c_cols) + n] = 0;
		for(int i=0;i < b_rows;i++)
		{
			for(int j=0; j < b_cols;j++)
			{
				if(((m-i) < a_rows && (m-i) >= 0) && ((n-j) < a_cols && (n-j) >= 0))
				{
					C[m*(c_cols) + n] = B[i*(b_cols) + j] * A[(m-i)*a_cols + (n-j)] + C[m*(c_cols) + n];
				}
			}
		}
	}
	
}

/**
 * Host main routine
 */
int main(int argc, char *argv[])
{
	// Error code to check return values for CUDA calls
    hipError_t err = hipSuccess;
	
	bool first = true;
	float number;
	std::ifstream input(argv[1]);
	int a_rows = 0;
	int a_cols = 0;
	int b_rows = 0;
	int b_cols = 0;
	std::string line;
	
	while(std::getline(input, line))
	{
    if(line.empty())
        first = false;
    std::istringstream element (line);
    if(first == true)
    {
        a_cols = 0;
        while(element >> number)
        {
            a_cols++;
        }
        a_rows++;
    }

    else
    {
        if(!line.empty())
        {
            b_cols = 0;
             while(element >> number)
             {
                 b_cols++;
             }
        b_rows++;
        }
		}
	}
	
	int c_rows = a_rows+b_rows - 1;
	int c_cols = a_cols+b_cols - 1;
	
	size_t size1 = a_rows * a_cols * sizeof(float);
	size_t size2 = b_rows * b_cols * sizeof(float);
	size_t size3 = ((a_rows+b_rows-1)*(a_cols*b_cols-1)) * sizeof(float);
	
	float *h_A = (float *)malloc(size1);
	float *h_B = (float *)malloc(size2);
	float *h_C = (float *)malloc(size3);
	//int numElements = (a_rows+b_rows-1) * (a_cols+b_cols-1);
	
	std::ifstream input1(argv[1]);
	a_rows=a_cols=b_rows=b_cols=0;
	first = true;
	int i=0;
	int j=0;
	
	while(std::getline(input1, line))
	{
    std::istringstream element (line);
    if(line.empty())
        first = false;

    if(first == true)
    {
        a_cols=0;
        while(element >> number)
        {
            h_A[i] = number;
			i++;
            a_cols++;
        }
        a_rows++;
    }

    else
    {
        b_cols = 0;
        if(!line.empty())
        {
            while(element >> number)
            {
                h_B[j] = number;
				j++;
                b_cols++;
            }
            b_rows++;
        }

    }

	}
	
	for(int i = 0; i<a_rows;i++)
	{
		for(int j=0;j<a_cols;j++)
		{
			printf("%.3f ", h_A[i*a_cols+j]);
		}
		printf("\n");
	}
	printf("\n");
	
	for(int i = 0; i<b_rows;i++)
	{
		for(int j=0;j<b_cols;j++)
		{
			printf("%.3f ", h_B[i*b_cols+j]);
		}
		printf("\n");
	}
	
	
	
	
	
	
	printf("%d, %d\n", a_rows, a_cols);
	printf("%d, %d\n", b_rows, b_cols);
	printf("%d, %d\n", c_rows, c_cols);
	
	// Verify that allocations succeeded
    if (h_A == NULL || h_B == NULL || h_C == NULL)
    {
        fprintf(stderr, "Failed to allocate host vectors!\n");
        exit(EXIT_FAILURE);
    }
	
	
	float *d_A = NULL;
    err = hipMalloc((void **)&d_A, size1);

    if (err != hipSuccess)
    {
        fprintf(stderr, "Failed to allocate device vector A (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    // Allocate the device input vector B
    float *d_B = NULL;
    err = hipMalloc((void **)&d_B, size2);

    if (err != hipSuccess)
    {
        fprintf(stderr, "Failed to allocate device vector B (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    // Allocate the device output vector C
    float *d_C = NULL;
    err = hipMalloc((void **)&d_C, size3);

    if (err != hipSuccess)
    {
        fprintf(stderr, "Failed to allocate device vector C (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	// Copy the host input vectors A and B in host memory to the device input vectors in
    // device memory
    printf("Copy input data from the host memory to the CUDA device\n");
    err = hipMemcpy(d_A, h_A, size1, hipMemcpyHostToDevice);

    if (err != hipSuccess)
    {
        fprintf(stderr, "Failed to copy vector A from host to device (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    err = hipMemcpy(d_B, h_B, size2, hipMemcpyHostToDevice);

    if (err != hipSuccess)
    {
        fprintf(stderr, "Failed to copy vector B from host to device (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	// Launch the Vector Add CUDA Kernel
	dim3 dimGrid(((c_rows-1)/2)+1, ((c_cols-1)/2)+1, 1);
	dim3 dimBlock(16, 16, 1);
    //int threadsPerBlock = 256;
    //int blocksPerGrid =(numElements + threadsPerBlock - 1) / threadsPerBlock;
   // printf("CUDA kernel launch with %d blocks of %d threads\n", blocksPerGrid, threadsPerBlock);
    convolution<<<dimGrid, dimBlock>>>(d_A, d_B, d_C, a_rows, a_cols, b_rows, b_cols, c_rows, c_cols);
    err = hipGetLastError();

    if (err != hipSuccess)
    {
        fprintf(stderr, "Failed to launch vectorAdd kernel (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	
	// Copy the device result vector in device memory to the host result vector
    // in host memory.
    printf("Copy output data from the CUDA device to the host memory\n");
    err = hipMemcpy(h_C, d_C, size3, hipMemcpyDeviceToHost);

    if (err != hipSuccess)
    {
        fprintf(stderr, "Failed to copy vector C from device to host (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	for(int i = 0; i<c_rows; i++)
	{
		for(int j = 0; j < c_cols; j++)
		{
			printf("%.3f ", h_C[i*(c_cols)+j]);
		}
		printf("\n");
	}
	
	
	// Free device global memory
    err = hipFree(d_A);

    if (err != hipSuccess)
    {
        fprintf(stderr, "Failed to free device vector A (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    err = hipFree(d_B);

    if (err != hipSuccess)
    {
        fprintf(stderr, "Failed to free device vector B (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    err = hipFree(d_C);

    if (err != hipSuccess)
    {
        fprintf(stderr, "Failed to free device vector C (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    // Free host memory
    free(h_A);
    free(h_B);
    free(h_C);

    // Reset the device and exit
    // cudaDeviceReset causes the driver to clean up all state. While
    // not mandatory in normal operation, it is good practice.  It is also
    // needed to ensure correct operation when the application is being
    // profiled. Calling cudaDeviceReset causes all profile data to be
    // flushed before the application exits
    err = hipDeviceReset();

    if (err != hipSuccess)
    {
        fprintf(stderr, "Failed to deinitialize the device! error=%s\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z26__device_stub__convolutionPKfS0_Pfiiiiii # -- Begin function _Z26__device_stub__convolutionPKfS0_Pfiiiiii
	.type	_Z26__device_stub__convolutionPKfS0_Pfiiiiii,@function
_Z26__device_stub__convolutionPKfS0_Pfiiiiii: # @_Z26__device_stub__convolutionPKfS0_Pfiiiiii
	.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	20(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	16(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	12(%rsp), %r8
	movl	%r9d, (%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	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%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	$_Z11convolutionPKfS0_Pfiiiiii, %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	_Z26__device_stub__convolutionPKfS0_Pfiiiiii, .Lfunc_end0-_Z26__device_stub__convolutionPKfS0_Pfiiiiii
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function 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	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$1592, %rsp                     # imm = 0x638
	.cfi_def_cfa_offset 1648
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, 24(%rsp)                  # 8-byte Spill
	movq	8(%rsi), %rsi
	.cfi_escape 0x2e, 0x00
	leaq	1072(%rsp), %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
	leaq	104(%rsp), %rax
	movq	%rax, -16(%rax)
	movq	$0, -8(%rax)
	movb	$0, (%rax)
	movb	$1, %r15b
	leaq	552(%rsp), %r13
	leaq	36(%rsp), %rbp
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	movq	%rax, 56(%rsp)                  # 8-byte Spill
.LBB1_1:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_12 Depth 2
                                        #     Child Loop BB1_8 Depth 2
	movq	1072(%rsp), %rax
	movq	-24(%rax), %rdi
	leaq	1072(%rsp), %r12
	addq	%r12, %rdi
.Ltmp0:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp1:
# %bb.2:                                # %.noexc
                                        #   in Loop: Header=BB1_1 Depth=1
.Ltmp2:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %edx
	movq	%r12, %rdi
	leaq	88(%rsp), %rsi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp3:
# %bb.3:                                #   in Loop: Header=BB1_1 Depth=1
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB1_18
# %bb.4:                                #   in Loop: Header=BB1_1 Depth=1
	cmpq	$0, 96(%rsp)
	movzbl	%r15b, %r15d
	movl	$0, %eax
	cmovel	%eax, %r15d
.Ltmp74:
	.cfi_escape 0x2e, 0x00
	movq	%r13, %rdi
	leaq	88(%rsp), %rsi
	movl	$8, %edx
	callq	_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode
.Ltmp75:
# %bb.5:                                #   in Loop: Header=BB1_1 Depth=1
	testb	$1, %r15b
	jne	.LBB1_11
# %bb.6:                                #   in Loop: Header=BB1_1 Depth=1
	cmpq	$0, 96(%rsp)
	je	.LBB1_17
# %bb.7:                                # %.preheader242.preheader
                                        #   in Loop: Header=BB1_1 Depth=1
	xorl	%r14d, %r14d
.LBB1_8:                                # %.preheader242
                                        #   Parent Loop BB1_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp80:
	.cfi_escape 0x2e, 0x00
	movq	%r13, %rdi
	movq	%rbp, %rsi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp81:
# %bb.9:                                #   in Loop: Header=BB1_8 Depth=2
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB1_16
# %bb.10:                               #   in Loop: Header=BB1_8 Depth=2
	incl	%r14d
	jmp	.LBB1_8
.LBB1_11:                               # %.preheader248.preheader
                                        #   in Loop: Header=BB1_1 Depth=1
	xorl	%ebx, %ebx
.LBB1_12:                               # %.preheader248
                                        #   Parent Loop BB1_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp77:
	.cfi_escape 0x2e, 0x00
	movq	%r13, %rdi
	movq	%rbp, %rsi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp78:
# %bb.13:                               #   in Loop: Header=BB1_12 Depth=2
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB1_15
# %bb.14:                               #   in Loop: Header=BB1_12 Depth=2
	incl	%ebx
	jmp	.LBB1_12
.LBB1_15:                               #   in Loop: Header=BB1_1 Depth=1
	movq	56(%rsp), %rax                  # 8-byte Reload
	incl	%eax
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	jmp	.LBB1_17
.LBB1_16:                               #   in Loop: Header=BB1_1 Depth=1
	movq	8(%rsp), %rax                   # 8-byte Reload
	incl	%eax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
.LBB1_17:                               #   in Loop: Header=BB1_1 Depth=1
	.cfi_escape 0x2e, 0x00
	movl	$_ZTTNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEE, %esi
	movq	%r13, %rdi
	callq	_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEED2Ev
	.cfi_escape 0x2e, 0x00
	leaq	672(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	jmp	.LBB1_1
.LBB1_18:
	movq	56(%rsp), %r12                  # 8-byte Reload
	movq	8(%rsp), %rbp                   # 8-byte Reload
	leal	(%r12,%rbp), %ecx
	decl	%ecx
	movl	%r12d, %eax
	imull	%ebx, %eax
	movslq	%eax, %rdi
	shlq	$2, %rdi
	movl	%ebp, %eax
	imull	%r14d, %eax
	movslq	%eax, %r13
	shlq	$2, %r13
	movl	%ebx, %eax
	imull	%r14d, %eax
	decl	%eax
	movq	%rcx, 160(%rsp)                 # 8-byte Spill
	imull	%ecx, %eax
	movslq	%eax, %r15
	shlq	$2, %r15
	.cfi_escape 0x2e, 0x00
	movq	%rdi, 128(%rsp)                 # 8-byte Spill
	callq	malloc
	movq	%rax, 48(%rsp)                  # 8-byte Spill
	.cfi_escape 0x2e, 0x00
	movq	%r13, 120(%rsp)                 # 8-byte Spill
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	.cfi_escape 0x2e, 0x00
	movq	%r15, 152(%rsp)                 # 8-byte Spill
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	movq	24(%rsp), %rax                  # 8-byte Reload
	movq	8(%rax), %rsi
.Ltmp5:
	.cfi_escape 0x2e, 0x00
	leaq	552(%rsp), %r15
	movq	%r15, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
.Ltmp6:
# %bb.19:                               # %.preheader241
	addl	%ebp, %r12d
	movq	%r12, 56(%rsp)                  # 8-byte Spill
	leal	(%rbx,%r14), %eax
	movq	%rax, 136(%rsp)                 # 8-byte Spill
	leal	(%rbx,%r14), %eax
	decl	%eax
	movq	%rax, 144(%rsp)                 # 8-byte Spill
	movb	$1, %bl
	leaq	168(%rsp), %r14
	leaq	36(%rsp), %rbp
	movl	$0, 8(%rsp)                     # 4-byte Folded Spill
	movl	$0, 24(%rsp)                    # 4-byte Folded Spill
	xorl	%r12d, %r12d
	movl	$0, 16(%rsp)                    # 4-byte Folded Spill
	xorl	%r13d, %r13d
	movl	$0, 20(%rsp)                    # 4-byte Folded Spill
.LBB1_20:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_31 Depth 2
                                        #     Child Loop BB1_27 Depth 2
	movq	552(%rsp), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
.Ltmp8:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp9:
# %bb.21:                               # %.noexc220
                                        #   in Loop: Header=BB1_20 Depth=1
.Ltmp10:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %edx
	movq	%r15, %rdi
	leaq	88(%rsp), %rsi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp11:
# %bb.22:                               #   in Loop: Header=BB1_20 Depth=1
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB1_39
# %bb.23:                               #   in Loop: Header=BB1_20 Depth=1
.Ltmp65:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	leaq	88(%rsp), %rsi
	movl	$8, %edx
	callq	_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode
.Ltmp66:
# %bb.24:                               #   in Loop: Header=BB1_20 Depth=1
	movq	96(%rsp), %rax
	testq	%rax, %rax
	movzbl	%bl, %ebx
	movl	$0, %ecx
	cmovel	%ecx, %ebx
	testb	$1, %bl
	jne	.LBB1_30
# %bb.25:                               #   in Loop: Header=BB1_20 Depth=1
	testq	%rax, %rax
	je	.LBB1_38
# %bb.26:                               # %.preheader239.preheader
                                        #   in Loop: Header=BB1_20 Depth=1
	movslq	24(%rsp), %rax                  # 4-byte Folded Reload
	movq	40(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %r15
	xorl	%r12d, %r12d
.LBB1_27:                               # %.preheader239
                                        #   Parent Loop BB1_20 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp71:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	movq	%rbp, %rsi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp72:
# %bb.28:                               #   in Loop: Header=BB1_27 Depth=2
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB1_35
# %bb.29:                               #   in Loop: Header=BB1_27 Depth=2
	movss	36(%rsp), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%r15,%r12,4)
	incq	%r12
	jmp	.LBB1_27
.LBB1_30:                               # %.preheader240.preheader
                                        #   in Loop: Header=BB1_20 Depth=1
	movslq	8(%rsp), %rax                   # 4-byte Folded Reload
	movq	48(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %r15
	xorl	%r13d, %r13d
.LBB1_31:                               # %.preheader240
                                        #   Parent Loop BB1_20 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp68:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	movq	%rbp, %rsi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp69:
# %bb.32:                               #   in Loop: Header=BB1_31 Depth=2
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB1_34
# %bb.33:                               #   in Loop: Header=BB1_31 Depth=2
	movss	36(%rsp), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%r15,%r13,4)
	incq	%r13
	jmp	.LBB1_31
.LBB1_34:                               #   in Loop: Header=BB1_20 Depth=1
	addl	%r13d, 8(%rsp)                  # 4-byte Folded Spill
	incl	20(%rsp)                        # 4-byte Folded Spill
	jmp	.LBB1_36
.LBB1_35:                               #   in Loop: Header=BB1_20 Depth=1
	addl	%r12d, 24(%rsp)                 # 4-byte Folded Spill
	incl	16(%rsp)                        # 4-byte Folded Spill
.LBB1_36:                               #   in Loop: Header=BB1_20 Depth=1
	leaq	552(%rsp), %r15
.LBB1_37:                               #   in Loop: Header=BB1_20 Depth=1
	.cfi_escape 0x2e, 0x00
	movl	$_ZTTNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEE, %esi
	movq	%r14, %rdi
	callq	_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEED2Ev
	.cfi_escape 0x2e, 0x00
	leaq	288(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	jmp	.LBB1_20
.LBB1_38:                               #   in Loop: Header=BB1_20 Depth=1
	xorl	%r12d, %r12d
	jmp	.LBB1_37
.LBB1_39:                               # %.preheader238
	cmpl	$0, 20(%rsp)                    # 4-byte Folded Reload
	jle	.LBB1_45
# %bb.40:                               # %.preheader237.lr.ph
	movl	20(%rsp), %eax                  # 4-byte Reload
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	movl	%r13d, %r14d
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	xorl	%ebp, %ebp
.LBB1_41:                               # %.preheader237
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_43 Depth 2
	testl	%r13d, %r13d
	jle	.LBB1_44
# %bb.42:                               # %.lr.ph
                                        #   in Loop: Header=BB1_41 Depth=1
	movl	8(%rsp), %eax                   # 4-byte Reload
	movq	48(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %rbx
	xorl	%r15d, %r15d
.LBB1_43:                               #   Parent Loop BB1_41 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx,%r15,4), %xmm0
	.cfi_escape 0x2e, 0x00
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB1_43
.LBB1_44:                               # %._crit_edge
                                        #   in Loop: Header=BB1_41 Depth=1
	.cfi_escape 0x2e, 0x00
	movl	$10, %edi
	callq	putchar@PLT
	incq	%rbp
	movq	8(%rsp), %rax                   # 8-byte Reload
	addl	%r13d, %eax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	cmpq	24(%rsp), %rbp                  # 8-byte Folded Reload
	jne	.LBB1_41
.LBB1_45:                               # %._crit_edge289
	.cfi_escape 0x2e, 0x00
	movl	$10, %edi
	callq	putchar@PLT
	cmpl	$0, 16(%rsp)                    # 4-byte Folded Reload
	jle	.LBB1_51
# %bb.46:                               # %.preheader236.lr.ph
	movl	16(%rsp), %eax                  # 4-byte Reload
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	movl	%r12d, %r14d
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	xorl	%ebp, %ebp
.LBB1_47:                               # %.preheader236
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_49 Depth 2
	testl	%r12d, %r12d
	jle	.LBB1_50
# %bb.48:                               # %.lr.ph291
                                        #   in Loop: Header=BB1_47 Depth=1
	movl	8(%rsp), %eax                   # 4-byte Reload
	movq	40(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %rbx
	xorl	%r15d, %r15d
.LBB1_49:                               #   Parent Loop BB1_47 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx,%r15,4), %xmm0
	.cfi_escape 0x2e, 0x00
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB1_49
.LBB1_50:                               # %._crit_edge292
                                        #   in Loop: Header=BB1_47 Depth=1
	.cfi_escape 0x2e, 0x00
	movl	$10, %edi
	callq	putchar@PLT
	incq	%rbp
	movq	8(%rsp), %rax                   # 8-byte Reload
	addl	%r12d, %eax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	cmpq	24(%rsp), %rbp                  # 8-byte Folded Reload
	jne	.LBB1_47
.LBB1_51:                               # %._crit_edge294
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.2, %edi
	movl	20(%rsp), %esi                  # 4-byte Reload
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	printf
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.2, %edi
	movl	16(%rsp), %esi                  # 4-byte Reload
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	printf
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.2, %edi
	movq	160(%rsp), %r15                 # 8-byte Reload
	movl	%r15d, %esi
	movq	144(%rsp), %rbp                 # 8-byte Reload
	movl	%ebp, %edx
	xorl	%eax, %eax
	callq	printf
	cmpq	$0, 48(%rsp)                    # 8-byte Folded Reload
	je	.LBB1_88
# %bb.52:                               # %._crit_edge294
	cmpq	$0, 40(%rsp)                    # 8-byte Folded Reload
	je	.LBB1_88
# %bb.53:                               # %._crit_edge294
	cmpq	$0, 64(%rsp)                    # 8-byte Folded Reload
	je	.LBB1_88
# %bb.54:
	leaq	168(%rsp), %rdi
	movq	$0, (%rdi)
.Ltmp13:
	.cfi_escape 0x2e, 0x00
	movq	128(%rsp), %rsi                 # 8-byte Reload
	callq	hipMalloc
.Ltmp14:
	movq	56(%rsp), %rbx                  # 8-byte Reload
	movq	152(%rsp), %r14                 # 8-byte Reload
# %bb.55:
	testl	%eax, %eax
	jne	.LBB1_89
# %bb.56:
	leaq	80(%rsp), %rdi
	movq	$0, (%rdi)
.Ltmp18:
	.cfi_escape 0x2e, 0x00
	movq	120(%rsp), %rsi                 # 8-byte Reload
	callq	hipMalloc
.Ltmp19:
# %bb.57:
	testl	%eax, %eax
	jne	.LBB1_91
# %bb.58:
	leaq	72(%rsp), %rdi
	movq	$0, (%rdi)
.Ltmp23:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rsi
	callq	hipMalloc
.Ltmp24:
# %bb.59:
	testl	%eax, %eax
	jne	.LBB1_93
# %bb.60:
	.cfi_escape 0x2e, 0x00
	movl	$.Lstr, %edi
	callq	puts@PLT
	movq	168(%rsp), %rdi
.Ltmp27:
	.cfi_escape 0x2e, 0x00
	movq	48(%rsp), %rsi                  # 8-byte Reload
	movq	128(%rsp), %rdx                 # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp28:
# %bb.61:
	testl	%eax, %eax
	jne	.LBB1_95
# %bb.62:
	movq	80(%rsp), %rdi
.Ltmp31:
	.cfi_escape 0x2e, 0x00
	movq	40(%rsp), %rsi                  # 8-byte Reload
	movq	120(%rsp), %rdx                 # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp32:
# %bb.63:
	testl	%eax, %eax
	jne	.LBB1_97
# %bb.64:
	leal	-2(%rbx), %eax
	shrl	$31, %eax
	addl	%ebx, %eax
	addl	$-2, %eax
	sarl	%eax
	incl	%eax
	movq	136(%rsp), %rdx                 # 8-byte Reload
	leal	-2(%rdx), %ecx
	shrl	$31, %ecx
	leal	(%rdx,%rcx), %edi
	addl	$-2, %edi
	sarl	%edi
	incl	%edi
	shlq	$32, %rdi
	orq	%rax, %rdi
.Ltmp36:
	.cfi_escape 0x2e, 0x00
	movabsq	$68719476752, %rdx              # imm = 0x1000000010
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp37:
# %bb.65:
	testl	%eax, %eax
	jne	.LBB1_67
# %bb.66:
	movq	168(%rsp), %rdi
	movq	80(%rsp), %rsi
	movq	72(%rsp), %rdx
.Ltmp38:
	.cfi_escape 0x2e, 0x20
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	movl	28(%rsp), %ecx                  # 4-byte Reload
	movl	%r13d, %r8d
	movl	24(%rsp), %r9d                  # 4-byte Reload
	pushq	%rbp
	.cfi_adjust_cfa_offset 8
	pushq	%r15
	.cfi_adjust_cfa_offset 8
	pushq	%r12
	.cfi_adjust_cfa_offset 8
	callq	_Z26__device_stub__convolutionPKfS0_Pfiiiiii
	addq	$32, %rsp
	.cfi_adjust_cfa_offset -32
.Ltmp39:
.LBB1_67:
.Ltmp40:
	.cfi_escape 0x2e, 0x00
	callq	hipGetLastError
.Ltmp41:
# %bb.68:
	testl	%eax, %eax
	jne	.LBB1_99
# %bb.69:
	.cfi_escape 0x2e, 0x00
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movq	72(%rsp), %rsi
.Ltmp44:
	.cfi_escape 0x2e, 0x00
	movq	64(%rsp), %rdi                  # 8-byte Reload
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp45:
# %bb.70:
	testl	%eax, %eax
	jne	.LBB1_101
# %bb.71:                               # %.preheader235
	cmpl	$2, %ebx
	jl	.LBB1_77
# %bb.72:                               # %.preheader.lr.ph
	cmpl	$2, %ebp
	movl	$1, %ebx
	cmovgel	%ebp, %ebx
	movslq	%ebp, %r14
	movl	%r15d, %r15d
	shlq	$2, %r14
	xorl	%r12d, %r12d
	movq	64(%rsp), %r13                  # 8-byte Reload
.LBB1_73:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_75 Depth 2
	cmpl	$2, 136(%rsp)                   # 4-byte Folded Reload
	jl	.LBB1_76
# %bb.74:                               # %.lr.ph296
                                        #   in Loop: Header=BB1_73 Depth=1
	xorl	%ebp, %ebp
.LBB1_75:                               #   Parent Loop BB1_73 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r13,%rbp,4), %xmm0
	.cfi_escape 0x2e, 0x00
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%rbp
	cmpq	%rbp, %rbx
	jne	.LBB1_75
.LBB1_76:                               # %._crit_edge297
                                        #   in Loop: Header=BB1_73 Depth=1
	.cfi_escape 0x2e, 0x00
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r12
	addq	%r14, %r13
	cmpq	%r15, %r12
	jne	.LBB1_73
.LBB1_77:                               # %._crit_edge299
	movq	168(%rsp), %rdi
.Ltmp48:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp49:
# %bb.78:
	testl	%eax, %eax
	jne	.LBB1_103
# %bb.79:
	movq	80(%rsp), %rdi
.Ltmp52:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp53:
# %bb.80:
	testl	%eax, %eax
	jne	.LBB1_105
# %bb.81:
	movq	72(%rsp), %rdi
.Ltmp56:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp57:
# %bb.82:
	testl	%eax, %eax
	jne	.LBB1_107
# %bb.83:
	.cfi_escape 0x2e, 0x00
	movq	48(%rsp), %rdi                  # 8-byte Reload
	callq	free
	.cfi_escape 0x2e, 0x00
	movq	40(%rsp), %rdi                  # 8-byte Reload
	callq	free
	.cfi_escape 0x2e, 0x00
	movq	64(%rsp), %rdi                  # 8-byte Reload
	callq	free
.Ltmp60:
	.cfi_escape 0x2e, 0x00
	callq	hipDeviceReset
.Ltmp61:
# %bb.84:
	testl	%eax, %eax
	jne	.LBB1_109
# %bb.85:
	.cfi_escape 0x2e, 0x00
	leaq	552(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	88(%rsp), %rdi
	leaq	104(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB1_87
# %bb.86:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB1_87:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	.cfi_escape 0x2e, 0x00
	leaq	1072(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	xorl	%eax, %eax
	addq	$1592, %rsp                     # imm = 0x638
	.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
.LBB1_88:
	.cfi_def_cfa_offset 1648
	movq	stderr(%rip), %rcx
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.3, %edi
	movl	$33, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	.cfi_escape 0x2e, 0x00
	jmp	.LBB1_112
.LBB1_89:
	movq	stderr(%rip), %rbx
.Ltmp15:
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp16:
# %bb.90:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.4, %esi
	jmp	.LBB1_111
.LBB1_91:
	movq	stderr(%rip), %rbx
.Ltmp20:
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp21:
# %bb.92:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.5, %esi
	jmp	.LBB1_111
.LBB1_93:
	movq	stderr(%rip), %rbx
.Ltmp25:
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp26:
# %bb.94:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.6, %esi
	jmp	.LBB1_111
.LBB1_95:
	movq	stderr(%rip), %rbx
.Ltmp29:
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp30:
# %bb.96:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.8, %esi
	jmp	.LBB1_111
.LBB1_97:
	movq	stderr(%rip), %rbx
.Ltmp33:
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp34:
# %bb.98:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.9, %esi
	jmp	.LBB1_111
.LBB1_99:
	movq	stderr(%rip), %rbx
.Ltmp42:
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp43:
# %bb.100:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.10, %esi
	jmp	.LBB1_111
.LBB1_101:
	movq	stderr(%rip), %rbx
.Ltmp46:
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp47:
# %bb.102:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.12, %esi
	jmp	.LBB1_111
.LBB1_103:
	movq	stderr(%rip), %rbx
.Ltmp50:
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp51:
# %bb.104:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.13, %esi
	jmp	.LBB1_111
.LBB1_105:
	movq	stderr(%rip), %rbx
.Ltmp54:
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp55:
# %bb.106:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.14, %esi
	jmp	.LBB1_111
.LBB1_107:
	movq	stderr(%rip), %rbx
.Ltmp58:
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp59:
# %bb.108:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.15, %esi
	jmp	.LBB1_111
.LBB1_109:
	movq	stderr(%rip), %rbx
.Ltmp62:
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp63:
# %bb.110:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.16, %esi
.LBB1_111:
	movq	%rbx, %rdi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	fprintf
	.cfi_escape 0x2e, 0x00
.LBB1_112:
	movl	$1, %edi
	callq	exit
.LBB1_113:
.Ltmp7:
	jmp	.LBB1_123
.LBB1_114:
.Ltmp22:
	jmp	.LBB1_121
.LBB1_115:
.Ltmp17:
	jmp	.LBB1_121
.LBB1_116:
.Ltmp35:
	jmp	.LBB1_121
.LBB1_117:
.Ltmp64:
	jmp	.LBB1_121
.LBB1_118:
.Ltmp67:
	jmp	.LBB1_121
.LBB1_119:
.Ltmp76:
	jmp	.LBB1_123
.LBB1_120:
.Ltmp12:
.LBB1_121:
	movq	%rax, %r14
	jmp	.LBB1_128
.LBB1_122:
.Ltmp4:
.LBB1_123:
	movq	%rax, %r14
	jmp	.LBB1_131
.LBB1_124:                              # %.loopexit
.Ltmp73:
	jmp	.LBB1_127
.LBB1_125:                              # %.loopexit243
.Ltmp82:
	jmp	.LBB1_130
.LBB1_126:                              # %.loopexit.split-lp
.Ltmp70:
.LBB1_127:
	movq	%rax, %r14
	.cfi_escape 0x2e, 0x00
	leaq	168(%rsp), %rdi
	movl	$_ZTTNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEE, %esi
	callq	_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEED2Ev
	.cfi_escape 0x2e, 0x00
	leaq	288(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
.LBB1_128:
	.cfi_escape 0x2e, 0x00
	leaq	552(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	jmp	.LBB1_131
.LBB1_129:                              # %.loopexit.split-lp244
.Ltmp79:
.LBB1_130:
	movq	%rax, %r14
	.cfi_escape 0x2e, 0x00
	leaq	552(%rsp), %rdi
	movl	$_ZTTNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEE, %esi
	callq	_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEED2Ev
	.cfi_escape 0x2e, 0x00
	leaq	672(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
.LBB1_131:
	leaq	104(%rsp), %rax
	movq	88(%rsp), %rdi
	cmpq	%rax, %rdi
	je	.LBB1_133
# %bb.132:                              # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i230
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB1_133:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit232
	.cfi_escape 0x2e, 0x00
	leaq	1072(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table1:
.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 .Ltmp74-.Lfunc_begin0          # >> Call Site 3 <<
	.uleb128 .Ltmp75-.Ltmp74                #   Call between .Ltmp74 and .Ltmp75
	.uleb128 .Ltmp76-.Lfunc_begin0          #     jumps to .Ltmp76
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp80-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp81-.Ltmp80                #   Call between .Ltmp80 and .Ltmp81
	.uleb128 .Ltmp82-.Lfunc_begin0          #     jumps to .Ltmp82
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp77-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp78-.Ltmp77                #   Call between .Ltmp77 and .Ltmp78
	.uleb128 .Ltmp79-.Lfunc_begin0          #     jumps to .Ltmp79
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp5-.Lfunc_begin0           # >> Call Site 6 <<
	.uleb128 .Ltmp6-.Ltmp5                  #   Call between .Ltmp5 and .Ltmp6
	.uleb128 .Ltmp7-.Lfunc_begin0           #     jumps to .Ltmp7
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp8-.Lfunc_begin0           # >> Call Site 7 <<
	.uleb128 .Ltmp11-.Ltmp8                 #   Call between .Ltmp8 and .Ltmp11
	.uleb128 .Ltmp12-.Lfunc_begin0          #     jumps to .Ltmp12
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp65-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp66-.Ltmp65                #   Call between .Ltmp65 and .Ltmp66
	.uleb128 .Ltmp67-.Lfunc_begin0          #     jumps to .Ltmp67
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp71-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp72-.Ltmp71                #   Call between .Ltmp71 and .Ltmp72
	.uleb128 .Ltmp73-.Lfunc_begin0          #     jumps to .Ltmp73
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp68-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp69-.Ltmp68                #   Call between .Ltmp68 and .Ltmp69
	.uleb128 .Ltmp70-.Lfunc_begin0          #     jumps to .Ltmp70
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp13-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp14-.Ltmp13                #   Call between .Ltmp13 and .Ltmp14
	.uleb128 .Ltmp17-.Lfunc_begin0          #     jumps to .Ltmp17
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp18-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp19-.Ltmp18                #   Call between .Ltmp18 and .Ltmp19
	.uleb128 .Ltmp22-.Lfunc_begin0          #     jumps to .Ltmp22
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp23-.Lfunc_begin0          # >> Call Site 13 <<
	.uleb128 .Ltmp32-.Ltmp23                #   Call between .Ltmp23 and .Ltmp32
	.uleb128 .Ltmp35-.Lfunc_begin0          #     jumps to .Ltmp35
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp36-.Lfunc_begin0          # >> Call Site 14 <<
	.uleb128 .Ltmp61-.Ltmp36                #   Call between .Ltmp36 and .Ltmp61
	.uleb128 .Ltmp64-.Lfunc_begin0          #     jumps to .Ltmp64
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp15-.Lfunc_begin0          # >> Call Site 15 <<
	.uleb128 .Ltmp16-.Ltmp15                #   Call between .Ltmp15 and .Ltmp16
	.uleb128 .Ltmp17-.Lfunc_begin0          #     jumps to .Ltmp17
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp20-.Lfunc_begin0          # >> Call Site 16 <<
	.uleb128 .Ltmp21-.Ltmp20                #   Call between .Ltmp20 and .Ltmp21
	.uleb128 .Ltmp22-.Lfunc_begin0          #     jumps to .Ltmp22
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp25-.Lfunc_begin0          # >> Call Site 17 <<
	.uleb128 .Ltmp34-.Ltmp25                #   Call between .Ltmp25 and .Ltmp34
	.uleb128 .Ltmp35-.Lfunc_begin0          #     jumps to .Ltmp35
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp42-.Lfunc_begin0          # >> Call Site 18 <<
	.uleb128 .Ltmp63-.Ltmp42                #   Call between .Ltmp42 and .Ltmp63
	.uleb128 .Ltmp64-.Lfunc_begin0          #     jumps to .Ltmp64
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp63-.Lfunc_begin0          # >> Call Site 19 <<
	.uleb128 .Lfunc_end1-.Ltmp63            #   Call between .Ltmp63 and .Lfunc_end1
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- 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:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB2_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB2_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z11convolutionPKfS0_Pfiiiiii, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end2:
	.size	__hip_module_ctor, .Lfunc_end2-__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	.LBB3_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
.LBB3_2:
	retq
.Lfunc_end3:
	.size	__hip_module_dtor, .Lfunc_end3-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z11convolutionPKfS0_Pfiiiiii,@object # @_Z11convolutionPKfS0_Pfiiiiii
	.section	.rodata,"a",@progbits
	.globl	_Z11convolutionPKfS0_Pfiiiiii
	.p2align	3, 0x0
_Z11convolutionPKfS0_Pfiiiiii:
	.quad	_Z26__device_stub__convolutionPKfS0_Pfiiiiii
	.size	_Z11convolutionPKfS0_Pfiiiiii, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%.3f "
	.size	.L.str, 6

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Failed to allocate host vectors!\n"
	.size	.L.str.3, 34

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Failed to allocate device vector A (error code %s)!\n"
	.size	.L.str.4, 53

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Failed to allocate device vector B (error code %s)!\n"
	.size	.L.str.5, 53

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Failed to allocate device vector C (error code %s)!\n"
	.size	.L.str.6, 53

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Failed to copy vector A from host to device (error code %s)!\n"
	.size	.L.str.8, 62

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Failed to copy vector B from host to device (error code %s)!\n"
	.size	.L.str.9, 62

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Failed to launch vectorAdd kernel (error code %s)!\n"
	.size	.L.str.10, 52

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Failed to copy vector C from device to host (error code %s)!\n"
	.size	.L.str.12, 62

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Failed to free device vector A (error code %s)!\n"
	.size	.L.str.13, 49

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Failed to free device vector B (error code %s)!\n"
	.size	.L.str.14, 49

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"Failed to free device vector C (error code %s)!\n"
	.size	.L.str.15, 49

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"Failed to deinitialize the device! error=%s\n"
	.size	.L.str.16, 45

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

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

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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"Copy input data from the host memory to the CUDA device"
	.size	.Lstr, 56

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Copy output data from the CUDA device to the host memory"
	.size	.Lstr.1, 57

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z11convolutionPKfS0_Pfiiiiii ; -- Begin function _Z11convolutionPKfS0_Pfiiiiii
	.globl	_Z11convolutionPKfS0_Pfiiiiii
	.p2align	8
	.type	_Z11convolutionPKfS0_Pfiiiiii,@function
_Z11convolutionPKfS0_Pfiiiiii:          ; @_Z11convolutionPKfS0_Pfiiiiii
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x3c
	s_load_b64 s[2:3], s[0:1], 0x28
	v_bfe_u32 v2, v0, 10, 10
	v_and_b32_e32 v3, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s5, s4, 16
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[0:1], null, s15, s5, v[2:3]
	v_mad_u64_u32 v[1:2], null, s14, s4, v[3:4]
	v_cmp_gt_i32_e32 vcc_lo, s2, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_gt_i32_e64 s2, s3, v1
	s_and_b32 s2, vcc_lo, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s4, s2
	s_cbranch_execz .LBB0_11
; %bb.1:
	s_clause 0x1
	s_load_b64 s[8:9], s[0:1], 0x10
	s_load_b128 s[4:7], s[0:1], 0x18
	v_mad_u64_u32 v[2:3], null, v0, s3, v[1:2]
	v_mov_b32_e32 v4, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s8, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s9, v3, vcc_lo
	s_cmp_lt_i32 s6, 1
	global_store_b32 v[2:3], v4, off
	s_cbranch_scc1 .LBB0_11
; %bb.2:                                ; %.preheader.lr.ph
	s_load_b128 s[8:11], s[0:1], 0x0
	v_mul_lo_u32 v5, s5, v0
	v_mov_b32_e32 v6, 0
	s_cmp_gt_i32 s7, 0
	s_mov_b32 s3, 0
	s_cselect_b32 s1, -1, 0
	s_mov_b32 s12, 0
	s_mov_b32 s13, 0
.LBB0_3:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	s_and_not1_b32 vcc_lo, exec_lo, s1
	s_cbranch_vccnz .LBB0_10
; %bb.4:                                ; %.lr.ph
                                        ;   in Loop: Header=BB0_3 Depth=1
	v_subrev_nc_u32_e32 v7, s13, v0
	s_mov_b32 s2, s12
	s_mov_b32 s15, s7
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e32 vcc_lo, s4, v7
	v_cmp_lt_i32_e64 s0, -1, v7
	v_mov_b32_e32 v7, v1
	s_and_b32 s14, vcc_lo, s0
.LBB0_5:                                ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s16, s14
	s_cbranch_execz .LBB0_9
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s5, v7
	v_cmp_lt_i32_e64 s0, -1, v7
	s_and_b32 s17, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s0, s17
	s_cbranch_execz .LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=2
	v_add_nc_u32_e32 v8, v5, v7
	s_lshl_b64 s[18:19], s[2:3], 2
	s_waitcnt lgkmcnt(0)
	s_add_u32 s18, s10, s18
	s_addc_u32 s19, s11, s19
	v_ashrrev_i32_e32 v9, 31, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[8:9], 2, v[8:9]
	v_add_co_u32 v8, vcc_lo, s8, v8
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v9, vcc_lo, s9, v9, vcc_lo
	global_load_b32 v10, v4, s[18:19]
	global_load_b32 v8, v[8:9], off
	s_waitcnt vmcnt(0)
	v_fmac_f32_e32 v6, v10, v8
	global_store_b32 v[2:3], v6, off
.LBB0_8:                                ; %Flow
                                        ;   in Loop: Header=BB0_5 Depth=2
	s_or_b32 exec_lo, exec_lo, s0
.LBB0_9:                                ;   in Loop: Header=BB0_5 Depth=2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s16
	v_add_nc_u32_e32 v7, -1, v7
	s_add_i32 s15, s15, -1
	s_add_i32 s2, s2, 1
	s_cmp_eq_u32 s15, 0
	s_cbranch_scc0 .LBB0_5
.LBB0_10:                               ; %Flow95
                                        ;   in Loop: Header=BB0_3 Depth=1
	v_subrev_nc_u32_e32 v5, s5, v5
	s_add_i32 s13, s13, 1
	s_add_i32 s12, s12, s7
	s_cmp_eq_u32 s13, s6
	s_cbranch_scc0 .LBB0_3
.LBB0_11:                               ; %.loopexit
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11convolutionPKfS0_Pfiiiiii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 304
		.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 20
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z11convolutionPKfS0_Pfiiiiii, .Lfunc_end0-_Z11convolutionPKfS0_Pfiiiiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 464
; NumSgprs: 22
; NumVgprs: 11
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 22
; NumVGPRsForWavesPerEU: 11
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         36
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     by_value
      - .offset:         44
        .size:           4
        .value_kind:     by_value
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         52
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         60
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         62
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         64
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         66
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         68
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         70
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         112
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 304
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z11convolutionPKfS0_Pfiiiiii
    .private_segment_fixed_size: 0
    .sgpr_count:     22
    .sgpr_spill_count: 0
    .symbol:         _Z11convolutionPKfS0_Pfiiiiii.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
