/*
Two Dimensional (2D) Image Convolution : A Basic Approch
Image Convolution is a very basic operation in the field of Image Processing. 
It is required in many algorithms in Image Processing. Also it is very compute intensive task as 
it involves operation with pixels.
Its a transformation which involves a Mask and an Image on which that mask will be performing the operation.


General steps of Convolution:
The center point of Mask is first placed on to the Image Pixel.
Each pixel of Mask is multiplied to corresponding pixel of Image.
A complete sum (Cumulative sum) of all multiplications performed between Mask and Image pixels are then 
put in the related Image pixel value as a result of Convolution.
Following is the sample code of Image convolution. The Mask_width, Mask_height are set to 3 as 
its a 3 X 3 2D array with all values set to 1. Also width and height are also set to 3 
as I considered image of size 3 X 3 only for the sake of the example. 
You may change the values as per your need.
*/


#include<stdio.h>
#include<stdlib.h>
#define Mask_width 3
#define Mask_height 3
#define width 3
#define height 3
float convolution_2D_OnHost(float * N,float * M,int i,int j);

int main()
{
 float * input;
 float * Mask;
 float * output;

 input=(float *)malloc(sizeof(float)*width*height);
 Mask=(float *)malloc(sizeof(float)*Mask_width*Mask_height);
 output=(float *)malloc(sizeof(float)*width*height);

 for(int i=0;i<width*height;i++)
 {
  input[i]=1.0;
 }
 for(int i=0;i<Mask_width*Mask_height;i++)
 {
  Mask[i]=1.0;
 }

 printf("\nInput Array:\n");
 for(int i=0;i<width*height;i++)
 {
  if(i>0 && (i%width==0))
  printf("\n");
  printf("%0.2f ",input[i]);

 }printf("\n");

 printf("\nMask:\n");
  for(int i=0;i<Mask_width*Mask_height;i++)
  {
   if(i>0 && (i%Mask_width==0))
   printf("\n");
   printf("%0.2f ",Mask[i]);

  }printf("\n");

  for(int i=0;i<width;i++)
  {
   for(int j=0;j<height;j++)
   {
    output[(i*width)+j]=convolution_2D_OnHost(input,Mask,i,j);
   }
  }

  printf("\nOutput:\n");
  for(int i=0;i<width*height;i++)
    {
    if(i>0 && (i%width==0))
     printf("\n");
    printf("%d = %0.2f \t",i,*(output+i));
    }

free(input);
free(Mask);
free(output);
return 0;
}

float convolution_2D_OnHost(float * N,float * M,int i,int j)
{
 float Pvalue=0.0;
 int N_start_point_i=i-(Mask_width/2);
 int N_start_point_j=j-(Mask_height/2);

 for(int k=0;k<Mask_width;k++)
 {
  for(int l=0;l<Mask_height;l++)
  {
   if(((N_start_point_i+k)>=0) && ((N_start_point_i+k)<width)&&((N_start_point_j+l)>=0)&&((N_start_point_j+l)<height))
   {
   Pvalue+=N[(N_start_point_i+k)*width+(N_start_point_j+l)]*M[(k*Mask_width)+l];
   }
  }
 }
 return(Pvalue);
}
	.file	"tmpxft_002950de_00000000-6_2D_conv_basic.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2031:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2031:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z21convolution_2D_OnHostPfS_ii
	.type	_Z21convolution_2D_OnHostPfS_ii, @function
_Z21convolution_2D_OnHostPfS_ii:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %r9
	movq	%rdi, %r8
	xorl	%esi, %esi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	xorps	%xmm0, %xmm0
	leal	-1(%rcx), %ebx
	addl	$2, %ecx
.L3:
	movl	%ebx, %eax
	movl	%esi, %edi
	leal	-1(%rdx), %r11d
.L5:
	cmpl	$2, %r11d
	ja	.L4
	cmpl	$2, %eax
	ja	.L4
	leal	(%rdx,%rdx,2), %r10d
	leal	-3(%rax,%r10), %ebp
	movslq	%edi, %r10
	movss	(%r8,%rbp,4), %xmm1
	mulss	(%r9,%r10,4), %xmm1
	addss	%xmm1, %xmm0
.L4:
	incl	%eax
	incl	%edi
	cmpl	%ecx, %eax
	jne	.L5
	addl	$3, %esi
	incl	%edx
	cmpl	$9, %esi
	jne	.L3
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z21convolution_2D_OnHostPfS_ii, .-_Z21convolution_2D_OnHostPfS_ii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"\nInput Array:\n"
.LC3:
	.string	"\n"
.LC4:
	.string	"%0.2f "
.LC5:
	.string	"\nMask:\n"
.LC6:
	.string	"\nOutput:\n"
.LC7:
	.string	"%d = %0.2f \t"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$36, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	malloc@PLT
	movl	$36, %edi
	movq	%rax, %rbp
	call	malloc@PLT
	movl	$36, %edi
	movq	%rax, %rbx
	call	malloc@PLT
	movss	.LC1(%rip), %xmm0
	movq	%rax, %r12
	xorl	%eax, %eax
.L11:
	movss	%xmm0, 0(%rbp,%rax,4)
	incq	%rax
	cmpq	$9, %rax
	jne	.L11
	xorl	%eax, %eax
.L12:
	movss	%xmm0, (%rbx,%rax,4)
	incq	%rax
	cmpq	$9, %rax
	jne	.L12
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	call	__printf_chk@PLT
	leaq	.LC3(%rip), %r14
.L14:
	testq	%r13, %r13
	je	.L13
	imull	$-1431655765, %r13d, %eax
	cmpl	$1431655765, %eax
	ja	.L13
	movq	%r14, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L13:
	leaq	.LC4(%rip), %r15
	cvtss2sd	0(%rbp,%r13,4), %xmm0
	movl	$2, %edi
	movb	$1, %al
	movq	%r15, %rsi
	incq	%r13
	call	__printf_chk@PLT
	cmpq	$9, %r13
	jne	.L14
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	call	__printf_chk@PLT
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L16:
	testq	%r14, %r14
	je	.L15
	imull	$-1431655765, %r14d, %eax
	cmpl	$1431655765, %eax
	ja	.L15
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L15:
	cvtss2sd	(%rbx,%r14,4), %xmm0
	movq	%r15, %rsi
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
	incq	%r14
	cmpq	$9, %r14
	jne	.L16
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	call	__printf_chk@PLT
.L17:
	imulq	$12, %r15, %r14
	movl	%r15d, 12(%rsp)
	xorl	%r13d, %r13d
	addq	%r12, %r14
.L18:
	movl	12(%rsp), %edx
	movl	%r13d, %ecx
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	_Z21convolution_2D_OnHostPfS_ii
	movss	%xmm0, (%r14,%r13,4)
	incq	%r13
	cmpq	$3, %r13
	jne	.L18
	incq	%r15
	cmpq	$3, %r15
	jne	.L17
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	call	__printf_chk@PLT
	leaq	.LC7(%rip), %r15
.L21:
	movl	%r13d, %r14d
	testq	%r13, %r13
	je	.L20
	movl	%r13d, %eax
	movl	$3, %esi
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L20
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L20:
	cvtss2sd	(%r12,%r13,4), %xmm0
	movl	%r14d, %edx
	movq	%r15, %rsi
	movb	$1, %al
	movl	$2, %edi
	incq	%r13
	call	__printf_chk@PLT
	cmpq	$9, %r13
	jne	.L21
	movq	%rbp, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	addq	$24, %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
.LFE2027:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2054:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2054:
	.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
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC1:
	.long	1065353216
	.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:

/*
Two Dimensional (2D) Image Convolution : A Basic Approch
Image Convolution is a very basic operation in the field of Image Processing. 
It is required in many algorithms in Image Processing. Also it is very compute intensive task as 
it involves operation with pixels.
Its a transformation which involves a Mask and an Image on which that mask will be performing the operation.


General steps of Convolution:
The center point of Mask is first placed on to the Image Pixel.
Each pixel of Mask is multiplied to corresponding pixel of Image.
A complete sum (Cumulative sum) of all multiplications performed between Mask and Image pixels are then 
put in the related Image pixel value as a result of Convolution.
Following is the sample code of Image convolution. The Mask_width, Mask_height are set to 3 as 
its a 3 X 3 2D array with all values set to 1. Also width and height are also set to 3 
as I considered image of size 3 X 3 only for the sake of the example. 
You may change the values as per your need.
*/



#include <hip/hip_runtime.h>
#include<stdio.h>
#include<stdlib.h>
#define Mask_width 3
#define Mask_height 3
#define width 3
#define height 3
float convolution_2D_OnHost(float * N,float * M,int i,int j);

int main()
{
 float * input;
 float * Mask;
 float * output;

 input=(float *)malloc(sizeof(float)*width*height);
 Mask=(float *)malloc(sizeof(float)*Mask_width*Mask_height);
 output=(float *)malloc(sizeof(float)*width*height);

 for(int i=0;i<width*height;i++)
 {
  input[i]=1.0;
 }
 for(int i=0;i<Mask_width*Mask_height;i++)
 {
  Mask[i]=1.0;
 }

 printf("\nInput Array:\n");
 for(int i=0;i<width*height;i++)
 {
  if(i>0 && (i%width==0))
  printf("\n");
  printf("%0.2f ",input[i]);

 }printf("\n");

 printf("\nMask:\n");
  for(int i=0;i<Mask_width*Mask_height;i++)
  {
   if(i>0 && (i%Mask_width==0))
   printf("\n");
   printf("%0.2f ",Mask[i]);

  }printf("\n");

  for(int i=0;i<width;i++)
  {
   for(int j=0;j<height;j++)
   {
    output[(i*width)+j]=convolution_2D_OnHost(input,Mask,i,j);
   }
  }

  printf("\nOutput:\n");
  for(int i=0;i<width*height;i++)
    {
    if(i>0 && (i%width==0))
     printf("\n");
    printf("%d = %0.2f \t",i,*(output+i));
    }

free(input);
free(Mask);
free(output);
return 0;
}

float convolution_2D_OnHost(float * N,float * M,int i,int j)
{
 float Pvalue=0.0;
 int N_start_point_i=i-(Mask_width/2);
 int N_start_point_j=j-(Mask_height/2);

 for(int k=0;k<Mask_width;k++)
 {
  for(int l=0;l<Mask_height;l++)
  {
   if(((N_start_point_i+k)>=0) && ((N_start_point_i+k)<width)&&((N_start_point_j+l)>=0)&&((N_start_point_j+l)<height))
   {
   Pvalue+=N[(N_start_point_i+k)*width+(N_start_point_j+l)]*M[(k*Mask_width)+l];
   }
  }
 }
 return(Pvalue);
}
	.text
	.file	"2D_conv_basic.hip"
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$36, %edi
	callq	malloc
	movq	%rax, %rbx
	movl	$36, %edi
	callq	malloc
	movq	%rax, %r14
	movl	$36, %edi
	callq	malloc
	movq	%rax, %r15
	xorl	%eax, %eax
.LBB0_1:                                # =>This Inner Loop Header: Depth=1
	movl	$1065353216, (%rbx,%rax,4)      # imm = 0x3F800000
	incq	%rax
	cmpq	$9, %rax
	jne	.LBB0_1
# %bb.2:                                # %.preheader64.preheader
	xorl	%eax, %eax
.LBB0_3:                                # %.preheader64
                                        # =>This Inner Loop Header: Depth=1
	movl	$1065353216, (%r14,%rax,4)      # imm = 0x3F800000
	incq	%rax
	cmpq	$9, %rax
	jne	.LBB0_3
# %bb.4:
	movl	$.Lstr, %edi
	callq	puts@PLT
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
.LBB0_5:                                # =>This Inner Loop Header: Depth=1
	testq	%r13, %r13
	je	.LBB0_8
# %bb.6:                                #   in Loop: Header=BB0_5 Depth=1
	movzbl	%r13b, %eax
	imull	$171, %eax, %eax
	shrl	$9, %eax
	leal	(%rax,%rax,2), %eax
	addb	%r12b, %al
	jne	.LBB0_8
# %bb.7:                                #   in Loop: Header=BB0_5 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
.LBB0_8:                                #   in Loop: Header=BB0_5 Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx,%r13,4), %xmm0
	movl	$.L.str.2, %edi
	movb	$1, %al
	callq	printf
	incq	%r13
	decb	%r12b
	cmpq	$9, %r13
	jne	.LBB0_5
# %bb.9:
	movl	$10, %edi
	callq	putchar@PLT
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
.LBB0_10:                               # =>This Inner Loop Header: Depth=1
	testq	%r13, %r13
	je	.LBB0_13
# %bb.11:                               #   in Loop: Header=BB0_10 Depth=1
	movzbl	%r13b, %eax
	imull	$171, %eax, %eax
	shrl	$9, %eax
	leal	(%rax,%rax,2), %eax
	addb	%r12b, %al
	jne	.LBB0_13
# %bb.12:                               #   in Loop: Header=BB0_10 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
.LBB0_13:                               #   in Loop: Header=BB0_10 Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r14,%r13,4), %xmm0
	movl	$.L.str.2, %edi
	movb	$1, %al
	callq	printf
	incq	%r13
	decb	%r12b
	cmpq	$9, %r13
	jne	.LBB0_10
# %bb.14:
	movl	$10, %edi
	callq	putchar@PLT
	xorl	%r12d, %r12d
	movq	%r15, %rbp
.LBB0_15:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_16 Depth 2
	xorl	%r13d, %r13d
.LBB0_16:                               #   Parent Loop BB0_15 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	%r12d, %edx
	movl	%r13d, %ecx
	callq	_Z21convolution_2D_OnHostPfS_ii
	movss	%xmm0, (%rbp,%r13,4)
	incq	%r13
	cmpq	$3, %r13
	jne	.LBB0_16
# %bb.17:                               #   in Loop: Header=BB0_15 Depth=1
	incq	%r12
	addq	$12, %rbp
	cmpq	$3, %r12
	jne	.LBB0_15
# %bb.18:
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
.LBB0_19:                               # =>This Inner Loop Header: Depth=1
	testq	%r12, %r12
	je	.LBB0_22
# %bb.20:                               #   in Loop: Header=BB0_19 Depth=1
	movzbl	%r12b, %eax
	imull	$171, %eax, %eax
	shrl	$9, %eax
	leal	(%rax,%rax,2), %eax
	addb	%r13b, %al
	jne	.LBB0_22
# %bb.21:                               #   in Loop: Header=BB0_19 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
.LBB0_22:                               #   in Loop: Header=BB0_19 Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r15,%r12,4), %xmm0
	movl	$.L.str.5, %edi
	movl	%r12d, %esi
	movb	$1, %al
	callq	printf
	incq	%r12
	decb	%r13b
	cmpq	$9, %r12
	jne	.LBB0_19
# %bb.23:
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.globl	_Z21convolution_2D_OnHostPfS_ii # -- Begin function _Z21convolution_2D_OnHostPfS_ii
	.type	_Z21convolution_2D_OnHostPfS_ii,@function
_Z21convolution_2D_OnHostPfS_ii:        # @_Z21convolution_2D_OnHostPfS_ii
	.cfi_startproc
# %bb.0:
                                        # kill: def $ecx killed $ecx def $rcx
                                        # kill: def $edx killed $edx def $rdx
	decl	%ecx
	movslq	%ecx, %rax
	movslq	%edx, %r8
	decl	%edx
	leaq	(%r8,%r8,2), %r8
	shlq	$2, %rax
	leaq	(%rax,%r8,4), %rax
	addq	%rdi, %rax
	addq	$-12, %rax
	xorps	%xmm0, %xmm0
	xorl	%edi, %edi
.LBB1_1:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_2 Depth 2
	leal	(%rdi,%rdx), %r8d
	xorl	%r9d, %r9d
.LBB1_2:                                #   Parent Loop BB1_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpl	$2, %r8d
	ja	.LBB1_5
# %bb.3:                                #   in Loop: Header=BB1_2 Depth=2
	leal	(%rcx,%r9), %r10d
	cmpl	$2, %r10d
	ja	.LBB1_5
# %bb.4:                                #   in Loop: Header=BB1_2 Depth=2
	movss	(%rax,%r9,4), %xmm1             # xmm1 = mem[0],zero,zero,zero
	mulss	(%rsi,%r9,4), %xmm1
	addss	%xmm1, %xmm0
.LBB1_5:                                #   in Loop: Header=BB1_2 Depth=2
	incq	%r9
	cmpq	$3, %r9
	jne	.LBB1_2
# %bb.6:                                #   in Loop: Header=BB1_1 Depth=1
	incq	%rdi
	addq	$12, %rsi
	addq	$12, %rax
	cmpq	$3, %rdi
	jne	.LBB1_1
# %bb.7:
	retq
.Lfunc_end1:
	.size	_Z21convolution_2D_OnHostPfS_ii, .Lfunc_end1-_Z21convolution_2D_OnHostPfS_ii
	.cfi_endproc
                                        # -- End function
	.type	.L.str.2,@object                # @.str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.2:
	.asciz	"%0.2f "
	.size	.L.str.2, 7

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"%d = %0.2f \t"
	.size	.L.str.5, 13

	.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	"\nInput Array:"
	.size	.Lstr, 14

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"\nMask:"
	.size	.Lstr.1, 7

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"\nOutput:"
	.size	.Lstr.2, 9

	.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_

	.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_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
