#include <stdio.h>
#include <fstream>
#include <iostream>
#define BLUR_SIZE 3
using namespace std;

__global__
void blurKernel(float * in, float * out, int w, int h)
{
  //Obtencion de los datos del thread en X y Y
  int Col = blockIdx.x * blockDim.x + threadIdx.x;
  int Row = blockIdx.y * blockDim.y + threadIdx.y;

  //Comprobando que el thread este dentro de los limites
  if (Col < w && Row < h)
  {
    int pixVal = 0;
    int pixels = 0;

    //Calculando el promedio del valor de la sub matriz del pixel de 2xBLUR_SIZE x 2xBLUR_SIZE
    //EJE Y
    for(int blurRow = -BLUR_SIZE; blurRow < BLUR_SIZE+1; ++blurRow)
    {
      //EJE X
      for(int blurCol = -BLUR_SIZE; blurCol < BLUR_SIZE+1; ++blurCol)
      {
        //Calculo de la posicion actual
        int curRow = Row + blurRow;
        int curCol = Col + blurCol;

        //Comprobacion de los limites
        if(curRow > -1 && curRow < h && curCol > -1 && curCol < w)
        {
          //Linealizando la sub matriz de 2xBLUR_SIZE x 2xBLUR_SIZE
          //Estos valores seran usados para el promedio 
          pixVal += in[curRow * w + curCol];
          pixels++; // Contador del numero de pixeles usados para el blur
        }
      }
    }
    // Write our new pixel value out
    // Escribiendo el nuevo valor del pixel segun el promedio de los datos calculados anteriormente
    //Acceso lineal a la memoria para la salida
    out[Row * w + Col] = (float)(pixVal / pixels);
  }
}


//Funcion auxiliar para guardar la data en una imagen .dat
void save_data(float r[225][225], float g[225][225], float b[225][225])
{
  ofstream archivo("bluur.dat");
  for (int i = 0; i < 225; ++i)
  {
    for (int j = 0; j < 225; ++j)
    {
          archivo<<r[i][j]<<" "<<g[i][j]<<" "<<b[i][j]<<" ";
    }
    archivo<<endl;
  }
}


void Blur(float r[225][225], float g[225][225], float b[225][225], int width, int height)
{
  //Vectores de salida rgb
  float o_r[225][225];
  float o_g[225][225];
  float o_b[225][225];

  //tamaño de imagen
  int size = width * height;

  //cantidad de memoria necesaria
  int memSize = size * sizeof(float);

  //Direcciones de memoria del device
  float *d_A, *d_B;

  //Separando memoria en el device
  cudaMalloc((void **) &d_A, memSize);
  cudaMalloc((void **) &d_B, memSize);

  //COLOR ROJO
  //Copia del host al device
  cudaMemcpy(d_A, r, memSize, cudaMemcpyHostToDevice);

  //Grid 3D (aunque solo se usa 2D) de bloques
  dim3 DimGrid(floor((width-1)/16 + 1), floor((height-1)/16+1), 1);
  //Bloque 3D de threads
  dim3 DimBlock(16, 16, 1);
  //Llamado al kernel
  blurKernel<<<DimGrid,DimBlock>>>(d_A, d_B, width, height);
  //Copia de memoria del device al host (Salida Roja)
  cudaMemcpy(o_r, d_B, memSize, cudaMemcpyDeviceToHost);


  //COLOR VERDE
  cudaMemcpy(d_A, g, memSize, cudaMemcpyHostToDevice);

  //Llamado al kernel
  blurKernel<<<DimGrid,DimBlock>>>(d_A, d_B, width, height);
  //Copia de memoria del device al host (Salida Verde)
  cudaMemcpy(o_g, d_B, memSize, cudaMemcpyDeviceToHost);

  //Copia del host al device
  cudaMemcpy(d_A, b, memSize, cudaMemcpyHostToDevice);



  //COLOR AZUL
  //Llamado al kernel 
  blurKernel<<<DimGrid,DimBlock>>>(d_A, d_B, width, height);

  //Copia del device al host (salida Azul)
  cudaMemcpy(o_b, d_B, memSize, cudaMemcpyDeviceToHost);

  //Liberando memoria del device
  cudaFree(d_A);
  cudaFree(d_B);
  //Guardar la data en imagen .dat
  save_data(o_r,o_g,o_b);
}


//Funcion de apoyo para la lectura de la imagen
void leer_data(const char *file, float r[225][225], float g[225][225], float b[225][225])
{
  char buffer[100];
  ifstream archivo2("lena.dat");
  for (int ii = 0; ii < 225; ++ii)
  {
    for (int jj = 0; jj < 225; ++jj)
    {
          archivo2>>r[ii][jj]>>g[ii][jj]>>b[ii][jj];
    }
    archivo2.getline(buffer,100);
  }
}


int main()
{
  int width=225, height=225;
  float r[225][225];
  float g[225][225];
  float b[225][225];
  leer_data("lena.dat",r,g,b);
  Blur(r,g,b,width,height);
  printf("HECHO\n");
  return EXIT_SUCCESS;
}

	.file	"tmpxft_00300998_00000000-6_image_blur.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3772:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3772:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z34__device_stub__Z10blurKernelPfS_iiPfS_ii
	.type	_Z34__device_stub__Z10blurKernelPfS_iiPfS_ii, @function
_Z34__device_stub__Z10blurKernelPfS_iiPfS_ii:
.LFB3794:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z10blurKernelPfS_ii(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L2:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3794:
	.size	_Z34__device_stub__Z10blurKernelPfS_iiPfS_ii, .-_Z34__device_stub__Z10blurKernelPfS_iiPfS_ii
	.globl	_Z10blurKernelPfS_ii
	.type	_Z10blurKernelPfS_ii, @function
_Z10blurKernelPfS_ii:
.LFB3795:
	.cfi_startproc
	endbr64
	jmp	_Z34__device_stub__Z10blurKernelPfS_iiPfS_ii
	.cfi_endproc
.LFE3795:
	.size	_Z10blurKernelPfS_ii, .-_Z10blurKernelPfS_ii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z10blurKernelPfS_ii"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3797:
	.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	_Z10blurKernelPfS_ii(%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
.LFE3797:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC1:
	.string	"bluur.dat"
.LC2:
	.string	" "
	.text
	.globl	_Z9save_dataPA225_fS0_S0_
	.type	_Z9save_dataPA225_fS0_S0_, @function
_Z9save_dataPA225_fS0_S0_:
.LFB3766:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3766
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rsi, %r12
	leaq	.LC1(%rip), %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$568, %rsp
	.cfi_def_cfa_offset 624
	movq	%rdx, 24(%rsp)
	movl	$16, %edx
	movq	%fs:40, %rax
	movq	%rax, 552(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
.LEHB0:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE0:
.L11:
	movq	24(%rsp), %rax
	leaq	0(%r13,%rbp), %r15
	leaq	(%r12,%rbp), %r14
	xorl	%ebx, %ebx
	addq	%rbp, %rax
	movq	%rax, 16(%rsp)
.L12:
	movq	8(%rsp), %rdi
	cvtss2sd	(%r15,%rbx), %xmm0
.LEHB1:
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC2(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	cvtss2sd	(%r14,%rbx), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC2(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	16(%rsp), %rax
	cvtss2sd	(%rax,%rbx), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC2(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	addq	$4, %rbx
	cmpq	$900, %rbx
	jne	.L12
	movq	8(%rsp), %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.LEHE1:
	addq	$900, %rbp
	cmpq	$202500, %rbp
	jne	.L11
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	je	.L16
	jmp	.L19
.L17:
	endbr64
	movq	%rax, %rbx
.L14:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	movq	%rbx, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L19:
	call	__stack_chk_fail@PLT
.L16:
	addq	$568, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3766:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3766:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3766-.LLSDACSB3766
.LLSDACSB3766:
	.uleb128 .LEHB0-.LFB3766
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3766
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L17-.LFB3766
	.uleb128 0
	.uleb128 .LEHB2-.LFB3766
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE3766:
	.text
	.size	_Z9save_dataPA225_fS0_S0_, .-_Z9save_dataPA225_fS0_S0_
	.globl	_Z4BlurPA225_fS0_S0_ii
	.type	_Z4BlurPA225_fS0_S0_ii, @function
_Z4BlurPA225_fS0_S0_ii:
.LFB3767:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-606208(%rsp), %r11
	.cfi_def_cfa 11, 606264
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1352, %rsp
	.cfi_def_cfa_offset 607616
	movl	%ecx, %ebx
	movq	%rdi, %r15
	movq	%rsi, %r14
	movq	%rsp, %rdi
	imull	%r8d, %ebx
	movl	%r8d, %r12d
	movl	%ecx, %ebp
	movq	%rdx, %r13
	movq	%fs:40, %rax
	movq	%rax, 607544(%rsp)
	xorl	%eax, %eax
	sall	$2, %ebx
	movslq	%ebx, %rbx
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	leaq	8(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdi
	movq	%rbx, %rdx
	movq	%r15, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	leal	-1(%rbp), %eax
	movl	$16, %ecx
	xorl	%r9d, %r9d
	cltd
	xorl	%r8d, %r8d
	movl	$1, %esi
	movl	$1, 28(%rsp)
	idivl	%ecx
	movl	$1, 40(%rsp)
	incl	%eax
	movl	%eax, 20(%rsp)
	leal	-1(%r12), %eax
	cltd
	idivl	%ecx
	movabsq	$68719476752, %rdx
	movl	$1, %ecx
	movq	%rdx, 32(%rsp)
	incl	%eax
	movl	%eax, 24(%rsp)
	movq	20(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L22
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movl	%r12d, %ecx
	movl	%ebp, %edx
	call	_Z34__device_stub__Z10blurKernelPfS_iiPfS_ii
.L22:
	movq	8(%rsp), %rsi
	leaq	44(%rsp), %r15
	movl	$2, %ecx
	movq	%rbx, %rdx
	movq	%r15, %rdi
	call	cudaMemcpy@PLT
	movq	(%rsp), %rdi
	movq	%rbx, %rdx
	movq	%r14, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	40(%rsp), %ecx
	movl	28(%rsp), %esi
	xorl	%r9d, %r9d
	movq	32(%rsp), %rdx
	movq	20(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L23
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movl	%r12d, %ecx
	movl	%ebp, %edx
	call	_Z34__device_stub__Z10blurKernelPfS_iiPfS_ii
.L23:
	movq	8(%rsp), %rsi
	leaq	202544(%rsp), %r14
	movl	$2, %ecx
	movq	%rbx, %rdx
	movq	%r14, %rdi
	call	cudaMemcpy@PLT
	movq	(%rsp), %rdi
	movq	%rbx, %rdx
	movq	%r13, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	40(%rsp), %ecx
	movl	28(%rsp), %esi
	xorl	%r9d, %r9d
	movq	32(%rsp), %rdx
	movq	20(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L24
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movl	%r12d, %ecx
	movl	%ebp, %edx
	call	_Z34__device_stub__Z10blurKernelPfS_iiPfS_ii
.L24:
	movq	8(%rsp), %rsi
	leaq	405044(%rsp), %rbp
	movq	%rbx, %rdx
	movl	$2, %ecx
	movq	%rbp, %rdi
	call	cudaMemcpy@PLT
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbp, %rdx
	movq	%r14, %rsi
	movq	%r15, %rdi
	call	_Z9save_dataPA225_fS0_S0_
	movq	607544(%rsp), %rax
	subq	%fs:40, %rax
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	addq	$607560, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3767:
	.size	_Z4BlurPA225_fS0_S0_ii, .-_Z4BlurPA225_fS0_S0_ii
	.section	.rodata.str1.1
.LC3:
	.string	"lena.dat"
	.text
	.globl	_Z9leer_dataPKcPA225_fS2_S2_
	.type	_Z9leer_dataPKcPA225_fS2_S2_, @function
_Z9leer_dataPKcPA225_fS2_S2_:
.LFB3768:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3768
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rcx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdx, %r14
	movl	$8, %edx
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	leaq	.LC3(%rip), %rsi
	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
	xorl	%ebx, %ebx
	subq	$680, %rsp
	.cfi_def_cfa_offset 736
	movq	%fs:40, %rax
	movq	%rax, 664(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
.LEHB3:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE3:
	leaq	564(%rsp), %rax
	movq	%rax, 24(%rsp)
.L28:
	leaq	0(%r13,%rbx), %rax
	movq	%rbx, %r12
	xorl	%ebp, %ebp
	movq	%rax, 16(%rsp)
.L29:
	movq	16(%rsp), %rax
	movq	8(%rsp), %rdi
	leaq	(%rax,%rbp), %rsi
.LEHB4:
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	(%r14,%r12), %rsi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	(%r15,%r12), %rsi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	addq	$4, %rbp
	addq	$4, %r12
	cmpq	$900, %rbp
	jne	.L29
	movq	40(%rsp), %rax
	movq	-24(%rax), %rax
	movq	280(%rsp,%rax), %rbp
	testq	%rbp, %rbp
	jne	.L30
	movq	664(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	call	_ZSt16__throw_bad_castv@PLT
.L30:
	cmpb	$0, 56(%rbp)
	je	.L32
	movb	67(%rbp), %al
	jmp	.L33
.L32:
	movq	%rbp, %rdi
	call	_ZNKSt5ctypeIcE13_M_widen_initEv@PLT
	movq	0(%rbp), %rax
	movl	$10, %esi
	movq	%rbp, %rdi
	call	*48(%rax)
.L33:
	movq	24(%rsp), %rsi
	movq	8(%rsp), %rdi
	movsbl	%al, %ecx
	movl	$100, %edx
	call	_ZNSi7getlineEPclc@PLT
.LEHE4:
	addq	$900, %rbx
	cmpq	$202500, %rbx
	jne	.L28
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	664(%rsp), %rax
	subq	%fs:40, %rax
	je	.L37
	jmp	.L40
.L38:
	endbr64
	movq	%rax, %rbx
.L35:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	664(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	movq	%rbx, %rdi
.LEHB5:
	call	_Unwind_Resume@PLT
.LEHE5:
.L40:
	call	__stack_chk_fail@PLT
.L37:
	addq	$680, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3768:
	.section	.gcc_except_table
.LLSDA3768:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3768-.LLSDACSB3768
.LLSDACSB3768:
	.uleb128 .LEHB3-.LFB3768
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB4-.LFB3768
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L38-.LFB3768
	.uleb128 0
	.uleb128 .LEHB5-.LFB3768
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
.LLSDACSE3768:
	.text
	.size	_Z9leer_dataPKcPA225_fS2_S2_, .-_Z9leer_dataPKcPA225_fS2_S2_
	.section	.rodata.str1.1
.LC4:
	.string	"HECHO\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3769:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-606208(%rsp), %r11
	.cfi_def_cfa 11, 606240
.LPSRL1:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL1
	.cfi_def_cfa_register 7
	subq	$1312, %rsp
	.cfi_def_cfa_offset 607552
	leaq	.LC3(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 607512(%rsp)
	xorl	%eax, %eax
	leaq	405012(%rsp), %r12
	leaq	202512(%rsp), %rbp
	leaq	12(%rsp), %rbx
	movq	%r12, %rcx
	movq	%rbp, %rdx
	movq	%rbx, %rsi
	call	_Z9leer_dataPKcPA225_fS2_S2_
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	movl	$225, %ecx
	movl	$225, %r8d
	movq	%r12, %rdx
	call	_Z4BlurPA225_fS0_S0_ii
	xorl	%eax, %eax
	movl	$2, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	607512(%rsp), %rax
	subq	%fs:40, %rax
	je	.L44
	call	__stack_chk_fail@PLT
.L44:
	addq	$607520, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3769:
	.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 <hip/hip_runtime.h>
#include <stdio.h>
#include <fstream>
#include <iostream>
#define BLUR_SIZE 3
using namespace std;

__global__
void blurKernel(float * in, float * out, int w, int h)
{
  //Obtencion de los datos del thread en X y Y
  int Col = blockIdx.x * blockDim.x + threadIdx.x;
  int Row = blockIdx.y * blockDim.y + threadIdx.y;

  //Comprobando que el thread este dentro de los limites
  if (Col < w && Row < h)
  {
    int pixVal = 0;
    int pixels = 0;

    //Calculando el promedio del valor de la sub matriz del pixel de 2xBLUR_SIZE x 2xBLUR_SIZE
    //EJE Y
    for(int blurRow = -BLUR_SIZE; blurRow < BLUR_SIZE+1; ++blurRow)
    {
      //EJE X
      for(int blurCol = -BLUR_SIZE; blurCol < BLUR_SIZE+1; ++blurCol)
      {
        //Calculo de la posicion actual
        int curRow = Row + blurRow;
        int curCol = Col + blurCol;

        //Comprobacion de los limites
        if(curRow > -1 && curRow < h && curCol > -1 && curCol < w)
        {
          //Linealizando la sub matriz de 2xBLUR_SIZE x 2xBLUR_SIZE
          //Estos valores seran usados para el promedio 
          pixVal += in[curRow * w + curCol];
          pixels++; // Contador del numero de pixeles usados para el blur
        }
      }
    }
    // Write our new pixel value out
    // Escribiendo el nuevo valor del pixel segun el promedio de los datos calculados anteriormente
    //Acceso lineal a la memoria para la salida
    out[Row * w + Col] = (float)(pixVal / pixels);
  }
}


//Funcion auxiliar para guardar la data en una imagen .dat
void save_data(float r[225][225], float g[225][225], float b[225][225])
{
  ofstream archivo("bluur.dat");
  for (int i = 0; i < 225; ++i)
  {
    for (int j = 0; j < 225; ++j)
    {
          archivo<<r[i][j]<<" "<<g[i][j]<<" "<<b[i][j]<<" ";
    }
    archivo<<endl;
  }
}


void Blur(float r[225][225], float g[225][225], float b[225][225], int width, int height)
{
  //Vectores de salida rgb
  float o_r[225][225];
  float o_g[225][225];
  float o_b[225][225];

  //tamaño de imagen
  int size = width * height;

  //cantidad de memoria necesaria
  int memSize = size * sizeof(float);

  //Direcciones de memoria del device
  float *d_A, *d_B;

  //Separando memoria en el device
  hipMalloc((void **) &d_A, memSize);
  hipMalloc((void **) &d_B, memSize);

  //COLOR ROJO
  //Copia del host al device
  hipMemcpy(d_A, r, memSize, hipMemcpyHostToDevice);

  //Grid 3D (aunque solo se usa 2D) de bloques
  dim3 DimGrid(floor((width-1)/16 + 1), floor((height-1)/16+1), 1);
  //Bloque 3D de threads
  dim3 DimBlock(16, 16, 1);
  //Llamado al kernel
  blurKernel<<<DimGrid,DimBlock>>>(d_A, d_B, width, height);
  //Copia de memoria del device al host (Salida Roja)
  hipMemcpy(o_r, d_B, memSize, hipMemcpyDeviceToHost);


  //COLOR VERDE
  hipMemcpy(d_A, g, memSize, hipMemcpyHostToDevice);

  //Llamado al kernel
  blurKernel<<<DimGrid,DimBlock>>>(d_A, d_B, width, height);
  //Copia de memoria del device al host (Salida Verde)
  hipMemcpy(o_g, d_B, memSize, hipMemcpyDeviceToHost);

  //Copia del host al device
  hipMemcpy(d_A, b, memSize, hipMemcpyHostToDevice);



  //COLOR AZUL
  //Llamado al kernel 
  blurKernel<<<DimGrid,DimBlock>>>(d_A, d_B, width, height);

  //Copia del device al host (salida Azul)
  hipMemcpy(o_b, d_B, memSize, hipMemcpyDeviceToHost);

  //Liberando memoria del device
  hipFree(d_A);
  hipFree(d_B);
  //Guardar la data en imagen .dat
  save_data(o_r,o_g,o_b);
}


//Funcion de apoyo para la lectura de la imagen
void leer_data(const char *file, float r[225][225], float g[225][225], float b[225][225])
{
  char buffer[100];
  ifstream archivo2("lena.dat");
  for (int ii = 0; ii < 225; ++ii)
  {
    for (int jj = 0; jj < 225; ++jj)
    {
          archivo2>>r[ii][jj]>>g[ii][jj]>>b[ii][jj];
    }
    archivo2.getline(buffer,100);
  }
}


int main()
{
  int width=225, height=225;
  float r[225][225];
  float g[225][225];
  float b[225][225];
  leer_data("lena.dat",r,g,b);
  Blur(r,g,b,width,height);
  printf("HECHO\n");
  return EXIT_SUCCESS;
}

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

                                        # End of file scope inline assembly
	.globl	_Z25__device_stub__blurKernelPfS_ii # -- Begin function _Z25__device_stub__blurKernelPfS_ii
	.type	_Z25__device_stub__blurKernelPfS_ii,@function
_Z25__device_stub__blurKernelPfS_ii:    # @_Z25__device_stub__blurKernelPfS_ii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z10blurKernelPfS_ii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z25__device_stub__blurKernelPfS_ii, .Lfunc_end0-_Z25__device_stub__blurKernelPfS_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z9save_dataPA225_fS0_S0_       # -- Begin function _Z9save_dataPA225_fS0_S0_
	.type	_Z9save_dataPA225_fS0_S0_,@function
_Z9save_dataPA225_fS0_S0_:              # @_Z9save_dataPA225_fS0_S0_
.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	$520, %rsp                      # imm = 0x208
	.cfi_def_cfa_offset 576
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, %rbx
	movq	%rsi, %r14
	movq	%rdi, %r15
	leaq	8(%rsp), %r12
	movl	$.L.str, %esi
	movq	%r12, %rdi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
	xorl	%r13d, %r13d
.LBB1_1:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_2 Depth 2
	movq	%r13, (%rsp)                    # 8-byte Spill
	xorl	%ebp, %ebp
.LBB1_2:                                #   Parent Loop BB1_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r15,%rbp,4), %xmm0
.Ltmp0:
	movq	%r12, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp1:
# %bb.3:                                # %_ZNSolsEf.exit
                                        #   in Loop: Header=BB1_2 Depth=2
.Ltmp2:
	movq	%rax, %r13
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp3:
# %bb.4:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB1_2 Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r14,%rbp,4), %xmm0
.Ltmp4:
	movq	%r13, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp5:
# %bb.5:                                # %_ZNSolsEf.exit18
                                        #   in Loop: Header=BB1_2 Depth=2
.Ltmp6:
	movq	%rax, %r13
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp7:
# %bb.6:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit19
                                        #   in Loop: Header=BB1_2 Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx,%rbp,4), %xmm0
.Ltmp8:
	movq	%r13, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp9:
# %bb.7:                                # %_ZNSolsEf.exit20
                                        #   in Loop: Header=BB1_2 Depth=2
.Ltmp10:
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp11:
# %bb.8:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit21
                                        #   in Loop: Header=BB1_2 Depth=2
	incq	%rbp
	cmpq	$225, %rbp
	jne	.LBB1_2
# %bb.9:                                #   in Loop: Header=BB1_1 Depth=1
	movq	8(%rsp), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
.Ltmp13:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp14:
	movq	(%rsp), %r13                    # 8-byte Reload
# %bb.10:                               # %.noexc
                                        #   in Loop: Header=BB1_1 Depth=1
.Ltmp15:
	movsbl	%al, %esi
	movq	%r12, %rdi
	callq	_ZNSo3putEc
.Ltmp16:
# %bb.11:                               # %.noexc22
                                        #   in Loop: Header=BB1_1 Depth=1
.Ltmp17:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp18:
# %bb.12:                               # %_ZNSolsEPFRSoS_E.exit
                                        #   in Loop: Header=BB1_1 Depth=1
	incq	%r13
	movl	$900, %eax                      # imm = 0x384
	addq	%rax, %rbx
	addq	%rax, %r14
	addq	%rax, %r15
	cmpq	$225, %r13
	jne	.LBB1_1
# %bb.13:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	16(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 8(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	256(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	addq	$520, %rsp                      # imm = 0x208
	.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_14:
	.cfi_def_cfa_offset 576
.Ltmp19:
	jmp	.LBB1_15
.LBB1_16:
.Ltmp12:
.LBB1_15:
	movq	%rax, %rbx
	leaq	8(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end1:
	.size	_Z9save_dataPA225_fS0_S0_, .Lfunc_end1-_Z9save_dataPA225_fS0_S0_
	.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 .Ltmp11-.Ltmp0                 #   Call between .Ltmp0 and .Ltmp11
	.uleb128 .Ltmp12-.Lfunc_begin0          #     jumps to .Ltmp12
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp13-.Lfunc_begin0          # >> Call Site 3 <<
	.uleb128 .Ltmp18-.Ltmp13                #   Call between .Ltmp13 and .Ltmp18
	.uleb128 .Ltmp19-.Lfunc_begin0          #     jumps to .Ltmp19
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp18-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Lfunc_end1-.Ltmp18            #   Call between .Ltmp18 and .Lfunc_end1
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z4BlurPA225_fS0_S0_ii          # -- Begin function _Z4BlurPA225_fS0_S0_ii
	.type	_Z4BlurPA225_fS0_S0_ii,@function
_Z4BlurPA225_fS0_S0_ii:                 # @_Z4BlurPA225_fS0_S0_ii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$607560, %rsp                   # imm = 0x94548
	.cfi_def_cfa_offset 607616
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%r8d, %ebx
	movl	%ecx, %r15d
	movq	%rdx, 24(%rsp)                  # 8-byte Spill
	movq	%rsi, 16(%rsp)                  # 8-byte Spill
	movq	%rdi, %rbp
	movabsq	$68719476752, %r12              # imm = 0x1000000010
	movl	%ecx, %eax
	imull	%r8d, %eax
	shll	$2, %eax
	movslq	%eax, %r14
	leaq	8(%rsp), %r13
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	movq	%rsp, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	movq	(%r13), %rdi
	movq	%rbp, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leal	-1(%r15), %eax
	leal	14(%r15), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$4, %ecx
	incl	%ecx
	leal	-1(%rbx), %eax
	leal	14(%rbx), %ebp
	testl	%eax, %eax
	cmovnsl	%eax, %ebp
	sarl	$4, %ebp
	incl	%ebp
	shlq	$32, %rbp
	orq	%rcx, %rbp
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_2
# %bb.1:
	movq	8(%rsp), %rdi
	movq	(%rsp), %rsi
	movl	%r15d, %edx
	movl	%ebx, %ecx
	callq	_Z25__device_stub__blurKernelPfS_ii
.LBB2_2:
	movq	(%rsp), %rsi
	leaq	202544(%rsp), %rdi
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	movq	16(%rsp), %rsi                  # 8-byte Reload
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_4
# %bb.3:
	movq	8(%rsp), %rdi
	movq	(%rsp), %rsi
	movl	%r15d, %edx
	movl	%ebx, %ecx
	callq	_Z25__device_stub__blurKernelPfS_ii
.LBB2_4:
	movq	(%rsp), %rsi
	leaq	32(%rsp), %rdi
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi                  # 8-byte Reload
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_6
# %bb.5:
	movq	8(%rsp), %rdi
	movq	(%rsp), %rsi
	movl	%r15d, %edx
	movl	%ebx, %ecx
	callq	_Z25__device_stub__blurKernelPfS_ii
.LBB2_6:
	movq	(%rsp), %rsi
	leaq	405056(%rsp), %rbx
	movq	%rbx, %rdi
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	(%rsp), %rdi
	callq	hipFree
	leaq	202544(%rsp), %rdi
	leaq	32(%rsp), %rsi
	movq	%rbx, %rdx
	callq	_Z9save_dataPA225_fS0_S0_
	addq	$607560, %rsp                   # imm = 0x94548
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z4BlurPA225_fS0_S0_ii, .Lfunc_end2-_Z4BlurPA225_fS0_S0_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z9leer_dataPKcPA225_fS2_S2_    # -- Begin function _Z9leer_dataPKcPA225_fS2_S2_
	.type	_Z9leer_dataPKcPA225_fS2_S2_,@function
_Z9leer_dataPKcPA225_fS2_S2_:           # @_Z9leer_dataPKcPA225_fS2_S2_
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %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	$632, %rsp                      # imm = 0x278
	.cfi_def_cfa_offset 688
	.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	%rcx, %rbx
	movq	%rdx, %r14
	movq	%rsi, %r15
	leaq	112(%rsp), %r12
	movl	$.L.str.2, %esi
	movq	%r12, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
	xorl	%ebp, %ebp
.LBB3_1:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_2 Depth 2
	xorl	%r13d, %r13d
.LBB3_2:                                #   Parent Loop BB3_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leaq	(%r15,%r13), %rsi
.Ltmp20:
	movq	%r12, %rdi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp21:
# %bb.3:                                # %_ZNSirsERf.exit
                                        #   in Loop: Header=BB3_2 Depth=2
	leaq	(%r14,%r13), %rsi
.Ltmp22:
	movq	%rax, %rdi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp23:
# %bb.4:                                # %_ZNSirsERf.exit21
                                        #   in Loop: Header=BB3_2 Depth=2
	leaq	(%rbx,%r13), %rsi
.Ltmp24:
	movq	%rax, %rdi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp25:
# %bb.5:                                # %_ZNSirsERf.exit23
                                        #   in Loop: Header=BB3_2 Depth=2
	addq	$4, %r13
	cmpq	$900, %r13                      # imm = 0x384
	jne	.LBB3_2
# %bb.6:                                #   in Loop: Header=BB3_1 Depth=1
	movq	112(%rsp), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
.Ltmp27:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp28:
# %bb.7:                                # %.noexc
                                        #   in Loop: Header=BB3_1 Depth=1
.Ltmp29:
	movsbl	%al, %ecx
	movl	$100, %edx
	movq	%r12, %rdi
	movq	%rsp, %rsi
	callq	_ZNSi7getlineEPclc
.Ltmp30:
# %bb.8:                                # %_ZNSi7getlineEPcl.exit
                                        #   in Loop: Header=BB3_1 Depth=1
	incq	%rbp
	movl	$900, %eax                      # imm = 0x384
	addq	%rax, %rbx
	addq	%rax, %r14
	addq	%rax, %r15
	cmpq	$225, %rbp
	jne	.LBB3_1
# %bb.9:
	leaq	112(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	addq	$632, %rsp                      # imm = 0x278
	.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
.LBB3_10:
	.cfi_def_cfa_offset 688
.Ltmp31:
	jmp	.LBB3_11
.LBB3_12:
.Ltmp26:
.LBB3_11:
	movq	%rax, %rbx
	leaq	112(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	_Z9leer_dataPKcPA225_fS2_S2_, .Lfunc_end3-_Z9leer_dataPKcPA225_fS2_S2_
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table3:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Lfunc_begin1-.Lfunc_begin1    # >> Call Site 1 <<
	.uleb128 .Ltmp20-.Lfunc_begin1          #   Call between .Lfunc_begin1 and .Ltmp20
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp20-.Lfunc_begin1          # >> Call Site 2 <<
	.uleb128 .Ltmp25-.Ltmp20                #   Call between .Ltmp20 and .Ltmp25
	.uleb128 .Ltmp26-.Lfunc_begin1          #     jumps to .Ltmp26
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp27-.Lfunc_begin1          # >> Call Site 3 <<
	.uleb128 .Ltmp30-.Ltmp27                #   Call between .Ltmp27 and .Ltmp30
	.uleb128 .Ltmp31-.Lfunc_begin1          #     jumps to .Ltmp31
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp30-.Lfunc_begin1          # >> Call Site 4 <<
	.uleb128 .Lfunc_end3-.Ltmp30            #   Call between .Ltmp30 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$607536, %rsp                   # imm = 0x94530
	.cfi_def_cfa_offset 607568
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	405024(%rsp), %rbx
	leaq	202512(%rsp), %r14
	movq	%rsp, %r15
	movq	%rbx, %rsi
	movq	%r14, %rdx
	movq	%r15, %rcx
	callq	_Z9leer_dataPKcPA225_fS2_S2_
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	movl	$225, %ecx
	movl	$225, %r8d
	callq	_Z4BlurPA225_fS0_S0_ii
	movl	$.Lstr, %edi
	callq	puts@PLT
	xorl	%eax, %eax
	addq	$607536, %rsp                   # imm = 0x94530
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10blurKernelPfS_ii, %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_end5:
	.size	__hip_module_ctor, .Lfunc_end5-__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	.LBB6_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
.LBB6_2:
	retq
.Lfunc_end6:
	.size	__hip_module_dtor, .Lfunc_end6-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z10blurKernelPfS_ii,@object    # @_Z10blurKernelPfS_ii
	.section	.rodata,"a",@progbits
	.globl	_Z10blurKernelPfS_ii
	.p2align	3, 0x0
_Z10blurKernelPfS_ii:
	.quad	_Z25__device_stub__blurKernelPfS_ii
	.size	_Z10blurKernelPfS_ii, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"bluur.dat"
	.size	.L.str, 10

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"lena.dat"
	.size	.L.str.2, 9

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z10blurKernelPfS_ii"
	.size	.L__unnamed_1, 21

	.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	"HECHO"
	.size	.Lstr, 6

	.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 _Z25__device_stub__blurKernelPfS_ii
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z10blurKernelPfS_ii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z10blurKernelPfS_ii    ; -- Begin function _Z10blurKernelPfS_ii
	.globl	_Z10blurKernelPfS_ii
	.p2align	8
	.type	_Z10blurKernelPfS_ii,@function
_Z10blurKernelPfS_ii:                   ; @_Z10blurKernelPfS_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b64 s[8:9], s[0:1], 0x10
	v_and_b32_e32 v2, 0x3ff, v0
	v_bfe_u32 v3, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s3, s2, 16
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[0:1], null, s14, s2, v[2:3]
	v_mad_u64_u32 v[1:2], null, s15, s3, v[3:4]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e32 vcc_lo, s8, v0
	v_cmp_gt_i32_e64 s2, s9, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB0_10
; %bb.1:                                ; %.preheader.preheader
	s_load_b128 s[4:7], s[0:1], 0x0
	v_dual_mov_b32 v3, 0 :: v_dual_add_nc_u32 v2, -3, v1
	v_add_nc_u32_e32 v5, -3, v0
	s_mov_b32 s3, -3
	s_delay_alu instid0(VALU_DEP_2)
	v_mul_lo_u32 v4, s8, v2
	v_mov_b32_e32 v2, 0
.LBB0_2:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
	v_add_nc_u32_e32 v6, s3, v1
	s_mov_b32 s10, 7
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_lt_i32_e32 vcc_lo, -1, v6
	v_cmp_gt_i32_e64 s0, s9, v6
	v_mov_b32_e32 v6, v5
.LBB0_3:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_and_saveexec_b32 s11, vcc_lo
	s_cbranch_execz .LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cmp_lt_i32_e64 s1, -1, v6
	v_cmp_gt_i32_e64 s2, s8, v6
	s_and_b32 s1, s0, s1
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	s_and_b32 s1, s1, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s2, s1
	s_cbranch_execz .LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=2
	v_add_nc_u32_e32 v7, v4, v6
	v_cvt_f32_i32_e32 v2, v2
	v_add_nc_u32_e32 v3, 1, v3
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v8, 31, v7
	v_lshlrev_b64 v[7:8], 2, v[7:8]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v7, s1, s4, v7
	v_add_co_ci_u32_e64 v8, s1, s5, v8, s1
	global_load_b32 v7, v[7:8], off
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v2, v7, v2
	s_delay_alu instid0(VALU_DEP_1)
	v_cvt_i32_f32_e32 v2, v2
.LBB0_6:                                ; %Flow
                                        ;   in Loop: Header=BB0_3 Depth=2
	s_or_b32 exec_lo, exec_lo, s2
.LBB0_7:                                ;   in Loop: Header=BB0_3 Depth=2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_or_b32 exec_lo, exec_lo, s11
	v_add_nc_u32_e32 v6, 1, v6
	s_add_i32 s10, s10, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s10, 0
	s_cbranch_scc0 .LBB0_3
; %bb.8:                                ;   in Loop: Header=BB0_2 Depth=1
	v_add_nc_u32_e32 v4, s8, v4
	s_add_i32 s3, s3, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s3, 4
	s_cbranch_scc0 .LBB0_2
; %bb.9:
	v_ashrrev_i32_e32 v4, 31, v3
	v_ashrrev_i32_e32 v7, 31, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v3, v3, v4
	v_add_nc_u32_e32 v2, v2, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v5, v3, v4
	v_xor_b32_e32 v2, v2, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cvt_f32_u32_e32 v3, v5
	v_sub_nc_u32_e32 v6, 0, v5
	v_rcp_iflag_f32_e32 v3, v3
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v3, 0x4f7ffffe, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_u32_f32_e32 v3, v3
	v_mul_lo_u32 v6, v6, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v6, v3, v6
	v_add_nc_u32_e32 v3, v3, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v3, v2, v3
	v_mul_lo_u32 v6, v3, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v2, v2, v6
	v_add_nc_u32_e32 v6, 1, v3
	v_sub_nc_u32_e32 v8, v2, v5
	v_cmp_ge_u32_e32 vcc_lo, v2, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_cndmask_b32_e32 v8, v2, v8, vcc_lo
	v_cndmask_b32_e32 v6, v3, v6, vcc_lo
	v_mad_u64_u32 v[2:3], null, v1, s8, v[0:1]
	v_xor_b32_e32 v0, v7, v4
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_cmp_ge_u32_e32 vcc_lo, v8, v5
	v_add_nc_u32_e32 v9, 1, v6
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v3, 31, v2
	v_cndmask_b32_e32 v1, v6, v9, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v1, v1, v0
	v_sub_nc_u32_e32 v4, v1, v0
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[0:1], 2, v[2:3]
	v_cvt_f32_i32_e32 v2, v4
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v0, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
.LBB0_10:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10blurKernelPfS_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 10
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z10blurKernelPfS_ii, .Lfunc_end0-_Z10blurKernelPfS_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 600
; NumSgprs: 18
; NumVgprs: 10
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 10
; 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
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10blurKernelPfS_ii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z10blurKernelPfS_ii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     10
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
