#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cuda_runtime_api.h>
#include <cassert>
#include <algorithm>

#define checkCudaErrors(val) check( (val), #val, __FILE__, __LINE__)

template<typename T>
void check(T err, const char* const func, const char* const file, const int line) {
  if (err != cudaSuccess) {
    std::cerr << "CUDA error at: " << file << ":" << line << std::endl;
    std::cerr << cudaGetErrorString(err) << " " << func << std::endl;
    exit(1);
  }
}

#include <stdio.h>
__global__
void gaussian_blur(const unsigned char* const inputChannel,
                   unsigned char* const outputChannel,
                   int numRows, int numCols,
                   const float* const filter, const int filterWidth)
{
    const int2 p = make_int2( blockIdx.x * blockDim.x + threadIdx.x,
                               blockIdx.y * blockDim.y + threadIdx.y);
    const int m = p.y * numCols + p.x;

    if(p.x >= numCols || p.y >= numRows)
         return;

    float color = 0.0f;
    //filterWidth = 18;
    for(int f_y = 0; f_y < filterWidth; f_y++) {
        for(int f_x = 0; f_x < filterWidth; f_x++) {

            int c_x = p.x + f_x - filterWidth/2;
            int c_y = p.y + f_y - filterWidth/2;
            c_x = min(max(c_x, 0), numCols - 1);
            c_y = min(max(c_y, 0), numRows - 1);
            float filter_value = filter[f_y*filterWidth + f_x];
            color += filter_value*static_cast<float>(inputChannel[c_y*numCols + c_x]);

        }
    }

    outputChannel[m] = color;

}

__global__
void separateChannels(const uchar4* const inputImageRGBA,
                      int numRows,
                      int numCols,
                      unsigned char* const redChannel,
                      unsigned char* const greenChannel,
                      unsigned char* const blueChannel)
{

  const int2 p = make_int2( blockIdx.x * blockDim.x + threadIdx.x,
                             blockIdx.y * blockDim.y + threadIdx.y);
  const int m = p.y * numCols + p.x;

  if(p.x >= numCols || p.y >= numRows)
      return;
  redChannel[m]   = inputImageRGBA[m].x;
  greenChannel[m] = inputImageRGBA[m].y;
  blueChannel[m]  = inputImageRGBA[m].z;
}

__global__
void recombineChannels(const unsigned char* const redChannel,
                       const unsigned char* const greenChannel,
                       const unsigned char* const blueChannel,
                       uchar4* const outputImageRGBA,
                       int numRows,
                       int numCols)
{
  const int2 thread_2D_pos = make_int2( blockIdx.x * blockDim.x + threadIdx.x,
                                        blockIdx.y * blockDim.y + threadIdx.y);

  const int thread_1D_pos = thread_2D_pos.y * numCols + thread_2D_pos.x;

  if (thread_2D_pos.x >= numCols || thread_2D_pos.y >= numRows)
    return;

  unsigned char red   = redChannel[thread_1D_pos];
  unsigned char green = greenChannel[thread_1D_pos];
  unsigned char blue  = blueChannel[thread_1D_pos];

  uchar4 outputPixel = make_uchar4(red, green, blue, 255);

  outputImageRGBA[thread_1D_pos] = outputPixel;
}

unsigned char *d_red, *d_green, *d_blue;
float         *d_filter;

void allocateMemoryAndCopyToGPU(const size_t numRowsImage, const size_t numColsImage,
                                const float* const h_filter, const size_t filterWidth)
{

  checkCudaErrors(cudaMalloc(&d_red,   sizeof(unsigned char) * numRowsImage * numColsImage));
  checkCudaErrors(cudaMalloc(&d_green, sizeof(unsigned char) * numRowsImage * numColsImage));
  checkCudaErrors(cudaMalloc(&d_blue,  sizeof(unsigned char) * numRowsImage * numColsImage));
  checkCudaErrors(cudaMalloc(&d_filter, sizeof( float) * filterWidth * filterWidth));
  checkCudaErrors(cudaMemcpy(d_filter, h_filter, sizeof(float) * filterWidth * filterWidth, cudaMemcpyHostToDevice));

}

void gaussian_blur(const uchar4 * const h_inputImageRGBA, uchar4 * const d_inputImageRGBA,
                        uchar4* const d_outputImageRGBA, const size_t numRows, const size_t numCols,
                        unsigned char *d_redBlurred,
                        unsigned char *d_greenBlurred,
                        unsigned char *d_blueBlurred,
                        const int filterWidth)
{
  const dim3 blockSize(32, 32);

  const dim3 gridSize(numCols/blockSize.x + 1, numRows/blockSize.y + 1);

  separateChannels<<<gridSize, blockSize>>>(d_inputImageRGBA,
                                            numRows,
                                            numCols,
                                            d_red,
                                            d_green,
                                            d_blue);
  cudaDeviceSynchronize(); checkCudaErrors(cudaGetLastError());

  gaussian_blur<<<gridSize, blockSize>>>(
      d_red,
      d_redBlurred,
      numRows,
      numCols,
      d_filter,
      filterWidth);
  cudaDeviceSynchronize(); checkCudaErrors(cudaGetLastError());

  gaussian_blur<<<gridSize, blockSize>>>(
      d_blue,
      d_blueBlurred,
      numRows,
      numCols,
      d_filter,
      filterWidth);
  cudaDeviceSynchronize(); checkCudaErrors(cudaGetLastError());

  gaussian_blur<<<gridSize, blockSize>>>(
      d_green,
      d_greenBlurred,
      numRows,
      numCols,
      d_filter,
      filterWidth);
  cudaDeviceSynchronize(); checkCudaErrors(cudaGetLastError());

  recombineChannels<<<gridSize, blockSize>>>(d_redBlurred,
                                             d_greenBlurred,
                                             d_blueBlurred,
                                             d_outputImageRGBA,
                                             numRows,
                                             numCols);
  cudaDeviceSynchronize(); checkCudaErrors(cudaGetLastError());
}

void cleanup() {
  checkCudaErrors(cudaFree(d_red));
  checkCudaErrors(cudaFree(d_green));
  checkCudaErrors(cudaFree(d_blue));
}

	.file	"tmpxft_00374e40_00000000-6_cuda_processing.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4175:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4175:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z42__device_stub__Z13gaussian_blurPKhPhiiPKfiPKhPhiiPKfi
	.type	_Z42__device_stub__Z13gaussian_blurPKhPhiiPKfiPKhPhiiPKfi, @function
_Z42__device_stub__Z13gaussian_blurPKhPhiiPKfiPKhPhiiPKfi:
.LFB4197:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movl	%edx, 28(%rsp)
	leaq	56(%rsp), %rdx
	movl	%ecx, 24(%rsp)
	leaq	64(%rsp), %rcx
	movq	%r8, 16(%rsp)
	movl	%r9d, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z13gaussian_blurPKhPhiiPKfi(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 208
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L2:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4197:
	.size	_Z42__device_stub__Z13gaussian_blurPKhPhiiPKfiPKhPhiiPKfi, .-_Z42__device_stub__Z13gaussian_blurPKhPhiiPKfiPKhPhiiPKfi
	.globl	_Z13gaussian_blurPKhPhiiPKfi
	.type	_Z13gaussian_blurPKhPhiiPKfi, @function
_Z13gaussian_blurPKhPhiiPKfi:
.LFB4198:
	.cfi_startproc
	endbr64
	jmp	_Z42__device_stub__Z13gaussian_blurPKhPhiiPKfiPKhPhiiPKfi
	.cfi_endproc
.LFE4198:
	.size	_Z13gaussian_blurPKhPhiiPKfi, .-_Z13gaussian_blurPKhPhiiPKfi
	.globl	_Z53__device_stub__Z16separateChannelsPK6uchar4iiPhS2_S2_PK6uchar4iiPhS2_S2_
	.type	_Z53__device_stub__Z16separateChannelsPK6uchar4iiPhS2_S2_PK6uchar4iiPhS2_S2_, @function
_Z53__device_stub__Z16separateChannelsPK6uchar4iiPhS2_S2_PK6uchar4iiPhS2_S2_:
.LFB4199:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movl	%esi, 36(%rsp)
	leaq	84(%rsp), %rsi
	movl	%edx, 32(%rsp)
	leaq	56(%rsp), %rdx
	movq	%rcx, 24(%rsp)
	leaq	64(%rsp), %rcx
	movq	%r8, 16(%rsp)
	movq	%r9, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L8
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z16separateChannelsPK6uchar4iiPhS2_S2_(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 208
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L8:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4199:
	.size	_Z53__device_stub__Z16separateChannelsPK6uchar4iiPhS2_S2_PK6uchar4iiPhS2_S2_, .-_Z53__device_stub__Z16separateChannelsPK6uchar4iiPhS2_S2_PK6uchar4iiPhS2_S2_
	.globl	_Z16separateChannelsPK6uchar4iiPhS2_S2_
	.type	_Z16separateChannelsPK6uchar4iiPhS2_S2_, @function
_Z16separateChannelsPK6uchar4iiPhS2_S2_:
.LFB4200:
	.cfi_startproc
	endbr64
	jmp	_Z53__device_stub__Z16separateChannelsPK6uchar4iiPhS2_S2_PK6uchar4iiPhS2_S2_
	.cfi_endproc
.LFE4200:
	.size	_Z16separateChannelsPK6uchar4iiPhS2_S2_, .-_Z16separateChannelsPK6uchar4iiPhS2_S2_
	.globl	_Z54__device_stub__Z17recombineChannelsPKhS0_S0_P6uchar4iiPKhS0_S0_P6uchar4ii
	.type	_Z54__device_stub__Z17recombineChannelsPKhS0_S0_P6uchar4iiPKhS0_S0_P6uchar4ii, @function
_Z54__device_stub__Z17recombineChannelsPKhS0_S0_P6uchar4iiPKhS0_S0_P6uchar4ii:
.LFB4201:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	56(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	64(%rsp), %rcx
	movl	%r8d, 12(%rsp)
	movl	%r9d, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L13
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z17recombineChannelsPKhS0_S0_P6uchar4ii(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 208
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L13:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4201:
	.size	_Z54__device_stub__Z17recombineChannelsPKhS0_S0_P6uchar4iiPKhS0_S0_P6uchar4ii, .-_Z54__device_stub__Z17recombineChannelsPKhS0_S0_P6uchar4iiPKhS0_S0_P6uchar4ii
	.globl	_Z17recombineChannelsPKhS0_S0_P6uchar4ii
	.type	_Z17recombineChannelsPKhS0_S0_P6uchar4ii, @function
_Z17recombineChannelsPKhS0_S0_P6uchar4ii:
.LFB4202:
	.cfi_startproc
	endbr64
	jmp	_Z54__device_stub__Z17recombineChannelsPKhS0_S0_P6uchar4iiPKhS0_S0_P6uchar4ii
	.cfi_endproc
.LFE4202:
	.size	_Z17recombineChannelsPKhS0_S0_P6uchar4ii, .-_Z17recombineChannelsPKhS0_S0_P6uchar4ii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z17recombineChannelsPKhS0_S0_P6uchar4ii"
.LC1:
	.string	"_Z16separateChannelsPK6uchar4iiPhS2_S2_"
.LC2:
	.string	"_Z13gaussian_blurPKhPhiiPKfi"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4204:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z17recombineChannelsPKhS0_S0_P6uchar4ii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC1(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z16separateChannelsPK6uchar4iiPhS2_S2_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC2(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13gaussian_blurPKhPhiiPKfi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4204:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata._Z5checkI9cudaErrorEvT_PKcS3_i.str1.1,"aMS",@progbits,1
.LC3:
	.string	"CUDA error at: "
.LC4:
	.string	":"
.LC5:
	.string	" "
	.section	.text._Z5checkI9cudaErrorEvT_PKcS3_i,"axG",@progbits,_Z5checkI9cudaErrorEvT_PKcS3_i,comdat
	.weak	_Z5checkI9cudaErrorEvT_PKcS3_i
	.type	_Z5checkI9cudaErrorEvT_PKcS3_i, @function
_Z5checkI9cudaErrorEvT_PKcS3_i:
.LFB4519:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L20
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rdx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movl	%ecx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	_ZSt4cerr(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rsi, %rbp
	leaq	.LC3(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movl	%edi, %ebx
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC4(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r13d, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	movl	%ebx, %edi
	call	cudaGetErrorString@PLT
	movq	%r12, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC5(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	movl	$1, %edi
	call	exit@PLT
.L20:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	ret
	.cfi_endproc
.LFE4519:
	.size	_Z5checkI9cudaErrorEvT_PKcS3_i, .-_Z5checkI9cudaErrorEvT_PKcS3_i
	.section	.rodata.str1.1
.LC6:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/NicolasRestrepoTorres/parallel-and-distributed-computing-practices/master/Practice2/cuda_processing.cu"
.LC7:
	.string	"cudaMalloc(&d_red, sizeof(unsigned char) * numRowsImage * numColsImage)"
.LC8:
	.string	"cudaMalloc(&d_green, sizeof(unsigned char) * numRowsImage * numColsImage)"
.LC9:
	.string	"cudaMalloc(&d_blue, sizeof(unsigned char) * numRowsImage * numColsImage)"
.LC10:
	.string	"cudaMalloc(&d_filter, sizeof( float) * filterWidth * filterWidth)"
.LC11:
	.string	"cudaMemcpy(d_filter, h_filter, sizeof(float) * filterWidth * filterWidth, cudaMemcpyHostToDevice)"
	.text
	.globl	_Z26allocateMemoryAndCopyToGPUmmPKfm
	.type	_Z26allocateMemoryAndCopyToGPUmmPKfm, @function
_Z26allocateMemoryAndCopyToGPUmmPKfm:
.LFB4170:
	.cfi_startproc
	endbr64
	imulq	%rsi, %rdi
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	.LC6(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %r12
	movq	%rdi, %rsi
	leaq	d_red(%rip), %rdi
	pushq	%rax
	.cfi_def_cfa_offset 48
	movq	%rcx, %rbx
	imulq	%rbx, %rbx
	call	cudaMalloc@PLT
	movq	%rbp, %rdx
	movl	$106, %ecx
	leaq	.LC7(%rip), %rsi
	movl	%eax, %edi
	salq	$2, %rbx
	call	_Z5checkI9cudaErrorEvT_PKcS3_i
	movq	%r12, %rsi
	leaq	d_green(%rip), %rdi
	call	cudaMalloc@PLT
	movq	%rbp, %rdx
	movl	$107, %ecx
	leaq	.LC8(%rip), %rsi
	movl	%eax, %edi
	call	_Z5checkI9cudaErrorEvT_PKcS3_i
	movq	%r12, %rsi
	leaq	d_blue(%rip), %rdi
	call	cudaMalloc@PLT
	movq	%rbp, %rdx
	movl	$108, %ecx
	leaq	.LC9(%rip), %rsi
	movl	%eax, %edi
	call	_Z5checkI9cudaErrorEvT_PKcS3_i
	movq	%rbx, %rsi
	leaq	d_filter(%rip), %rdi
	call	cudaMalloc@PLT
	movq	%rbp, %rdx
	movl	$109, %ecx
	leaq	.LC10(%rip), %rsi
	movl	%eax, %edi
	call	_Z5checkI9cudaErrorEvT_PKcS3_i
	movq	%rbx, %rdx
	movq	%r13, %rsi
	movl	$1, %ecx
	movq	d_filter(%rip), %rdi
	call	cudaMemcpy@PLT
	popq	%r8
	.cfi_def_cfa_offset 40
	movq	%rbp, %rdx
	popq	%rbx
	.cfi_def_cfa_offset 32
	movl	%eax, %edi
	popq	%rbp
	.cfi_def_cfa_offset 24
	movl	$110, %ecx
	popq	%r12
	.cfi_def_cfa_offset 16
	leaq	.LC11(%rip), %rsi
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	_Z5checkI9cudaErrorEvT_PKcS3_i
	.cfi_endproc
.LFE4170:
	.size	_Z26allocateMemoryAndCopyToGPUmmPKfm, .-_Z26allocateMemoryAndCopyToGPUmmPKfm
	.section	.rodata.str1.1
.LC12:
	.string	"cudaGetLastError()"
	.text
	.globl	_Z13gaussian_blurPK6uchar4PS_S2_mmPhS3_S3_i
	.type	_Z13gaussian_blurPK6uchar4PS_S2_mmPhS3_S3_i, @function
_Z13gaussian_blurPK6uchar4PS_S2_mmPhS3_S3_i:
.LFB4171:
	.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
	movq	%rsi, %r14
	movl	$1, %esi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdx, %r12
	movabsq	$137438953504, %rdx
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r8, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rcx, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	112(%rsp), %rax
	movq	%r9, (%rsp)
	xorl	%r9d, %r9d
	movl	$1, 44(%rsp)
	movq	120(%rsp), %r15
	movq	%rax, 8(%rsp)
	movq	%r8, %rax
	xorl	%r8d, %r8d
	movl	128(%rsp), %r13d
	shrq	$5, %rax
	movq	%rdx, 24(%rsp)
	incl	%eax
	movl	$1, 32(%rsp)
	movl	%eax, 36(%rsp)
	movq	%rcx, %rax
	movl	$1, %ecx
	shrq	$5, %rax
	incl	%eax
	movl	%eax, 40(%rsp)
	movq	36(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L28
	movq	d_blue(%rip), %r9
	movl	%ebp, %edx
	movl	%ebx, %esi
	movq	%r14, %rdi
	movq	d_green(%rip), %r8
	movq	d_red(%rip), %rcx
	call	_Z53__device_stub__Z16separateChannelsPK6uchar4iiPhS2_S2_PK6uchar4iiPhS2_S2_
.L28:
	call	cudaDeviceSynchronize@PLT
	leaq	.LC6(%rip), %r14
	call	cudaGetLastError@PLT
	movl	$131, %ecx
	movq	%r14, %rdx
	leaq	.LC12(%rip), %rsi
	movl	%eax, %edi
	call	_Z5checkI9cudaErrorEvT_PKcS3_i
	movl	32(%rsp), %ecx
	movl	44(%rsp), %esi
	xorl	%r9d, %r9d
	movq	24(%rsp), %rdx
	movq	36(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L29
	movq	d_filter(%rip), %r8
	movq	(%rsp), %rsi
	movl	%r13d, %r9d
	movl	%ebp, %ecx
	movq	d_red(%rip), %rdi
	movl	%ebx, %edx
	call	_Z42__device_stub__Z13gaussian_blurPKhPhiiPKfiPKhPhiiPKfi
.L29:
	call	cudaDeviceSynchronize@PLT
	call	cudaGetLastError@PLT
	movl	$140, %ecx
	movq	%r14, %rdx
	leaq	.LC12(%rip), %rsi
	movl	%eax, %edi
	call	_Z5checkI9cudaErrorEvT_PKcS3_i
	movl	32(%rsp), %ecx
	movl	44(%rsp), %esi
	xorl	%r9d, %r9d
	movq	24(%rsp), %rdx
	movq	36(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L30
	movq	d_filter(%rip), %r8
	movl	%r13d, %r9d
	movl	%ebp, %ecx
	movl	%ebx, %edx
	movq	d_blue(%rip), %rdi
	movq	%r15, %rsi
	call	_Z42__device_stub__Z13gaussian_blurPKhPhiiPKfiPKhPhiiPKfi
.L30:
	call	cudaDeviceSynchronize@PLT
	call	cudaGetLastError@PLT
	movl	$149, %ecx
	movq	%r14, %rdx
	leaq	.LC12(%rip), %rsi
	movl	%eax, %edi
	call	_Z5checkI9cudaErrorEvT_PKcS3_i
	movl	32(%rsp), %ecx
	movl	44(%rsp), %esi
	xorl	%r9d, %r9d
	movq	24(%rsp), %rdx
	movq	36(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L31
	movq	d_filter(%rip), %r8
	movq	8(%rsp), %rsi
	movl	%ebp, %ecx
	movl	%ebx, %edx
	movq	d_green(%rip), %rdi
	movl	%r13d, %r9d
	call	_Z42__device_stub__Z13gaussian_blurPKhPhiiPKfiPKhPhiiPKfi
.L31:
	call	cudaDeviceSynchronize@PLT
	call	cudaGetLastError@PLT
	movl	$158, %ecx
	movq	%r14, %rdx
	leaq	.LC12(%rip), %rsi
	movl	%eax, %edi
	call	_Z5checkI9cudaErrorEvT_PKcS3_i
	movl	32(%rsp), %ecx
	movl	44(%rsp), %esi
	xorl	%r9d, %r9d
	movq	24(%rsp), %rdx
	movq	36(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L32
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movl	%ebp, %r9d
	movl	%ebx, %r8d
	movq	%r12, %rcx
	movq	%r15, %rdx
	call	_Z54__device_stub__Z17recombineChannelsPKhS0_S0_P6uchar4iiPKhS0_S0_P6uchar4ii
.L32:
	call	cudaDeviceSynchronize@PLT
	call	cudaGetLastError@PLT
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	movq	%r14, %rdx
	movl	$166, %ecx
	popq	%rbx
	.cfi_def_cfa_offset 48
	movl	%eax, %edi
	leaq	.LC12(%rip), %rsi
	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
	jmp	_Z5checkI9cudaErrorEvT_PKcS3_i
	.cfi_endproc
.LFE4171:
	.size	_Z13gaussian_blurPK6uchar4PS_S2_mmPhS3_S3_i, .-_Z13gaussian_blurPK6uchar4PS_S2_mmPhS3_S3_i
	.section	.rodata.str1.1
.LC13:
	.string	"cudaFree(d_red)"
.LC14:
	.string	"cudaFree(d_green)"
.LC15:
	.string	"cudaFree(d_blue)"
	.text
	.globl	_Z7cleanupv
	.type	_Z7cleanupv, @function
_Z7cleanupv:
.LFB4172:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	d_red(%rip), %rdi
	leaq	.LC6(%rip), %rbx
	call	cudaFree@PLT
	movq	%rbx, %rdx
	movl	$170, %ecx
	leaq	.LC13(%rip), %rsi
	movl	%eax, %edi
	call	_Z5checkI9cudaErrorEvT_PKcS3_i
	movq	d_green(%rip), %rdi
	call	cudaFree@PLT
	movq	%rbx, %rdx
	movl	$171, %ecx
	leaq	.LC14(%rip), %rsi
	movl	%eax, %edi
	call	_Z5checkI9cudaErrorEvT_PKcS3_i
	movq	d_blue(%rip), %rdi
	call	cudaFree@PLT
	movq	%rbx, %rdx
	popq	%rbx
	.cfi_def_cfa_offset 8
	movl	$172, %ecx
	movl	%eax, %edi
	leaq	.LC15(%rip), %rsi
	jmp	_Z5checkI9cudaErrorEvT_PKcS3_i
	.cfi_endproc
.LFE4172:
	.size	_Z7cleanupv, .-_Z7cleanupv
	.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
	.globl	d_filter
	.bss
	.align 8
	.type	d_filter, @object
	.size	d_filter, 8
d_filter:
	.zero	8
	.globl	d_blue
	.align 8
	.type	d_blue, @object
	.size	d_blue, 8
d_blue:
	.zero	8
	.globl	d_green
	.align 8
	.type	d_green, @object
	.size	d_green, 8
d_green:
	.zero	8
	.globl	d_red
	.align 8
	.type	d_red, @object
	.size	d_red, 8
d_red:
	.zero	8
	.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 <stdio.h>
#include <iostream>
#include <iomanip>
#include <hip/hip_runtime.h>

#include <hip/hip_runtime_api.h>
#include <cassert>
#include <algorithm>

#define checkCudaErrors(val) check( (val), #val, __FILE__, __LINE__)

template<typename T>
void check(T err, const char* const func, const char* const file, const int line) {
  if (err != hipSuccess) {
    std::cerr << "CUDA error at: " << file << ":" << line << std::endl;
    std::cerr << hipGetErrorString(err) << " " << func << std::endl;
    exit(1);
  }
}

#include <stdio.h>
__global__
void gaussian_blur(const unsigned char* const inputChannel,
                   unsigned char* const outputChannel,
                   int numRows, int numCols,
                   const float* const filter, const int filterWidth)
{
    const int2 p = make_int2( blockIdx.x * blockDim.x + threadIdx.x,
                               blockIdx.y * blockDim.y + threadIdx.y);
    const int m = p.y * numCols + p.x;

    if(p.x >= numCols || p.y >= numRows)
         return;

    float color = 0.0f;
    //filterWidth = 18;
    for(int f_y = 0; f_y < filterWidth; f_y++) {
        for(int f_x = 0; f_x < filterWidth; f_x++) {

            int c_x = p.x + f_x - filterWidth/2;
            int c_y = p.y + f_y - filterWidth/2;
            c_x = min(max(c_x, 0), numCols - 1);
            c_y = min(max(c_y, 0), numRows - 1);
            float filter_value = filter[f_y*filterWidth + f_x];
            color += filter_value*static_cast<float>(inputChannel[c_y*numCols + c_x]);

        }
    }

    outputChannel[m] = color;

}

__global__
void separateChannels(const uchar4* const inputImageRGBA,
                      int numRows,
                      int numCols,
                      unsigned char* const redChannel,
                      unsigned char* const greenChannel,
                      unsigned char* const blueChannel)
{

  const int2 p = make_int2( blockIdx.x * blockDim.x + threadIdx.x,
                             blockIdx.y * blockDim.y + threadIdx.y);
  const int m = p.y * numCols + p.x;

  if(p.x >= numCols || p.y >= numRows)
      return;
  redChannel[m]   = inputImageRGBA[m].x;
  greenChannel[m] = inputImageRGBA[m].y;
  blueChannel[m]  = inputImageRGBA[m].z;
}

__global__
void recombineChannels(const unsigned char* const redChannel,
                       const unsigned char* const greenChannel,
                       const unsigned char* const blueChannel,
                       uchar4* const outputImageRGBA,
                       int numRows,
                       int numCols)
{
  const int2 thread_2D_pos = make_int2( blockIdx.x * blockDim.x + threadIdx.x,
                                        blockIdx.y * blockDim.y + threadIdx.y);

  const int thread_1D_pos = thread_2D_pos.y * numCols + thread_2D_pos.x;

  if (thread_2D_pos.x >= numCols || thread_2D_pos.y >= numRows)
    return;

  unsigned char red   = redChannel[thread_1D_pos];
  unsigned char green = greenChannel[thread_1D_pos];
  unsigned char blue  = blueChannel[thread_1D_pos];

  uchar4 outputPixel = make_uchar4(red, green, blue, 255);

  outputImageRGBA[thread_1D_pos] = outputPixel;
}

unsigned char *d_red, *d_green, *d_blue;
float         *d_filter;

void allocateMemoryAndCopyToGPU(const size_t numRowsImage, const size_t numColsImage,
                                const float* const h_filter, const size_t filterWidth)
{

  checkCudaErrors(hipMalloc(&d_red,   sizeof(unsigned char) * numRowsImage * numColsImage));
  checkCudaErrors(hipMalloc(&d_green, sizeof(unsigned char) * numRowsImage * numColsImage));
  checkCudaErrors(hipMalloc(&d_blue,  sizeof(unsigned char) * numRowsImage * numColsImage));
  checkCudaErrors(hipMalloc(&d_filter, sizeof( float) * filterWidth * filterWidth));
  checkCudaErrors(hipMemcpy(d_filter, h_filter, sizeof(float) * filterWidth * filterWidth, hipMemcpyHostToDevice));

}

void gaussian_blur(const uchar4 * const h_inputImageRGBA, uchar4 * const d_inputImageRGBA,
                        uchar4* const d_outputImageRGBA, const size_t numRows, const size_t numCols,
                        unsigned char *d_redBlurred,
                        unsigned char *d_greenBlurred,
                        unsigned char *d_blueBlurred,
                        const int filterWidth)
{
  const dim3 blockSize(32, 32);

  const dim3 gridSize(numCols/blockSize.x + 1, numRows/blockSize.y + 1);

  separateChannels<<<gridSize, blockSize>>>(d_inputImageRGBA,
                                            numRows,
                                            numCols,
                                            d_red,
                                            d_green,
                                            d_blue);
  hipDeviceSynchronize(); checkCudaErrors(hipGetLastError());

  gaussian_blur<<<gridSize, blockSize>>>(
      d_red,
      d_redBlurred,
      numRows,
      numCols,
      d_filter,
      filterWidth);
  hipDeviceSynchronize(); checkCudaErrors(hipGetLastError());

  gaussian_blur<<<gridSize, blockSize>>>(
      d_blue,
      d_blueBlurred,
      numRows,
      numCols,
      d_filter,
      filterWidth);
  hipDeviceSynchronize(); checkCudaErrors(hipGetLastError());

  gaussian_blur<<<gridSize, blockSize>>>(
      d_green,
      d_greenBlurred,
      numRows,
      numCols,
      d_filter,
      filterWidth);
  hipDeviceSynchronize(); checkCudaErrors(hipGetLastError());

  recombineChannels<<<gridSize, blockSize>>>(d_redBlurred,
                                             d_greenBlurred,
                                             d_blueBlurred,
                                             d_outputImageRGBA,
                                             numRows,
                                             numCols);
  hipDeviceSynchronize(); checkCudaErrors(hipGetLastError());
}

void cleanup() {
  checkCudaErrors(hipFree(d_red));
  checkCudaErrors(hipFree(d_green));
  checkCudaErrors(hipFree(d_blue));
}

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

                                        # End of file scope inline assembly
	.globl	_Z28__device_stub__gaussian_blurPKhPhiiPKfi # -- Begin function _Z28__device_stub__gaussian_blurPKhPhiiPKfi
	.type	_Z28__device_stub__gaussian_blurPKhPhiiPKfi,@function
_Z28__device_stub__gaussian_blurPKhPhiiPKfi: # @_Z28__device_stub__gaussian_blurPKhPhiiPKfi
	.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	$144, %rsp
	.cfi_def_cfa_offset 192
	.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	20(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	16(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	40(%rsp), %rcx
	movq	%r8, (%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	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	$_Z13gaussian_blurPKhPhiiPKfi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	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	_Z28__device_stub__gaussian_blurPKhPhiiPKfi, .Lfunc_end0-_Z28__device_stub__gaussian_blurPKhPhiiPKfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z31__device_stub__separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_ # -- Begin function _Z31__device_stub__separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
	.type	_Z31__device_stub__separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_,@function
_Z31__device_stub__separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_: # @_Z31__device_stub__separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
	.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	$144, %rsp
	.cfi_def_cfa_offset 192
	.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	12(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	8(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	48(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	40(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	32(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z31__device_stub__separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_, .Lfunc_end1-_Z31__device_stub__separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
	.cfi_endproc
                                        # -- End function
	.globl	_Z32__device_stub__recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii # -- Begin function _Z32__device_stub__recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
	.type	_Z32__device_stub__recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii,@function
_Z32__device_stub__recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii: # @_Z32__device_stub__recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
	.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	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	12(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	8(%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	80(%rsp), %r14
	leaq	64(%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	$_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	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_end2:
	.size	_Z32__device_stub__recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii, .Lfunc_end2-_Z32__device_stub__recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
	.cfi_endproc
                                        # -- End function
	.globl	_Z26allocateMemoryAndCopyToGPUmmPKfm # -- Begin function _Z26allocateMemoryAndCopyToGPUmmPKfm
	.type	_Z26allocateMemoryAndCopyToGPUmmPKfm,@function
_Z26allocateMemoryAndCopyToGPUmmPKfm:   # @_Z26allocateMemoryAndCopyToGPUmmPKfm
	.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
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rcx, %rbx
	movq	%rdx, %r14
	movq	%rsi, %r15
	imulq	%rdi, %r15
	movl	$d_red, %edi
	movq	%r15, %rsi
	callq	hipMalloc
	movl	$.L.str, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$106, %ecx
	callq	_Z5checkI10hipError_tEvT_PKcS3_i
	movl	$d_green, %edi
	movq	%r15, %rsi
	callq	hipMalloc
	movl	$.L.str.2, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$107, %ecx
	callq	_Z5checkI10hipError_tEvT_PKcS3_i
	movl	$d_blue, %edi
	movq	%r15, %rsi
	callq	hipMalloc
	movl	$.L.str.3, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$108, %ecx
	callq	_Z5checkI10hipError_tEvT_PKcS3_i
	imulq	%rbx, %rbx
	shlq	$2, %rbx
	movl	$d_filter, %edi
	movq	%rbx, %rsi
	callq	hipMalloc
	movl	$.L.str.4, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$109, %ecx
	callq	_Z5checkI10hipError_tEvT_PKcS3_i
	movq	d_filter(%rip), %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$.L.str.5, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$110, %ecx
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	_Z5checkI10hipError_tEvT_PKcS3_i # TAILCALL
.Lfunc_end3:
	.size	_Z26allocateMemoryAndCopyToGPUmmPKfm, .Lfunc_end3-_Z26allocateMemoryAndCopyToGPUmmPKfm
	.cfi_endproc
                                        # -- End function
	.section	.text._Z5checkI10hipError_tEvT_PKcS3_i,"axG",@progbits,_Z5checkI10hipError_tEvT_PKcS3_i,comdat
	.weak	_Z5checkI10hipError_tEvT_PKcS3_i # -- Begin function _Z5checkI10hipError_tEvT_PKcS3_i
	.type	_Z5checkI10hipError_tEvT_PKcS3_i,@function
_Z5checkI10hipError_tEvT_PKcS3_i:       # @_Z5checkI10hipError_tEvT_PKcS3_i
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jne	.LBB4_2
# %bb.1:
	retq
.LBB4_2:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%ecx, %r14d
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movl	%edi, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movq	%r15, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.11, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	%r14d, %esi
	callq	_ZNSolsEi
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	%ebp, %edi
	callq	hipGetErrorString
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.12, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movq	%rbx, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.Lfunc_end4:
	.size	_Z5checkI10hipError_tEvT_PKcS3_i, .Lfunc_end4-_Z5checkI10hipError_tEvT_PKcS3_i
	.cfi_endproc
                                        # -- End function
	.text
	.globl	_Z13gaussian_blurPK15HIP_vector_typeIhLj4EEPS0_S3_mmPhS4_S4_i # -- Begin function _Z13gaussian_blurPK15HIP_vector_typeIhLj4EEPS0_S3_mmPhS4_S4_i
	.type	_Z13gaussian_blurPK15HIP_vector_typeIhLj4EEPS0_S3_mmPhS4_S4_i,@function
_Z13gaussian_blurPK15HIP_vector_typeIhLj4EEPS0_S3_mmPhS4_S4_i: # @_Z13gaussian_blurPK15HIP_vector_typeIhLj4EEPS0_S3_mmPhS4_S4_i
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, 24(%rsp)                   # 8-byte Spill
	movq	%r8, %rbx
	movq	%rcx, %r14
	movq	%rdx, 32(%rsp)                  # 8-byte Spill
	movq	%rsi, %rbp
	movl	112(%rsp), %r13d
	movq	104(%rsp), %rax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movq	96(%rsp), %rax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movabsq	$137438953504, %r15             # imm = 0x2000000020
	movq	%r8, %rax
	shrq	$5, %rax
	incl	%eax
	andq	$-32, %rcx
	shlq	$27, %rcx
	orq	%rax, %rcx
	movabsq	$4294967296, %r12               # imm = 0x100000000
	addq	%rcx, %r12
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_2
# %bb.1:
	movq	d_red(%rip), %rcx
	movq	d_green(%rip), %r8
	movq	d_blue(%rip), %r9
	movq	%rbp, %rdi
	movl	%r14d, %esi
	movl	%ebx, %edx
	callq	_Z31__device_stub__separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
.LBB5_2:
	callq	hipDeviceSynchronize
	callq	hipGetLastError
	movl	$.L.str.6, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$131, %ecx
	callq	_Z5checkI10hipError_tEvT_PKcS3_i
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_4
# %bb.3:
	movq	d_red(%rip), %rdi
	movq	d_filter(%rip), %r8
	movq	24(%rsp), %rsi                  # 8-byte Reload
	movl	%r14d, %edx
	movl	%ebx, %ecx
	movl	%r13d, %r9d
	callq	_Z28__device_stub__gaussian_blurPKhPhiiPKfi
.LBB5_4:
	callq	hipDeviceSynchronize
	callq	hipGetLastError
	movl	$.L.str.6, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$140, %ecx
	callq	_Z5checkI10hipError_tEvT_PKcS3_i
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_6
# %bb.5:
	movq	d_blue(%rip), %rdi
	movq	d_filter(%rip), %r8
	movq	16(%rsp), %rsi                  # 8-byte Reload
	movl	%r14d, %edx
	movl	%ebx, %ecx
	movl	%r13d, %r9d
	callq	_Z28__device_stub__gaussian_blurPKhPhiiPKfi
.LBB5_6:
	callq	hipDeviceSynchronize
	callq	hipGetLastError
	movl	$.L.str.6, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$149, %ecx
	callq	_Z5checkI10hipError_tEvT_PKcS3_i
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_8
# %bb.7:
	movq	d_green(%rip), %rdi
	movq	d_filter(%rip), %r8
	movq	8(%rsp), %rsi                   # 8-byte Reload
	movl	%r14d, %edx
	movl	%ebx, %ecx
	movl	%r13d, %r9d
	callq	_Z28__device_stub__gaussian_blurPKhPhiiPKfi
.LBB5_8:
	callq	hipDeviceSynchronize
	callq	hipGetLastError
	movl	$.L.str.6, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$158, %ecx
	callq	_Z5checkI10hipError_tEvT_PKcS3_i
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_10
# %bb.9:
	movq	24(%rsp), %rdi                  # 8-byte Reload
	movq	8(%rsp), %rsi                   # 8-byte Reload
	movq	16(%rsp), %rdx                  # 8-byte Reload
	movq	32(%rsp), %rcx                  # 8-byte Reload
	movl	%r14d, %r8d
	movl	%ebx, %r9d
	callq	_Z32__device_stub__recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
.LBB5_10:
	callq	hipDeviceSynchronize
	callq	hipGetLastError
	movl	$.L.str.6, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$166, %ecx
	addq	$40, %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
	jmp	_Z5checkI10hipError_tEvT_PKcS3_i # TAILCALL
.Lfunc_end5:
	.size	_Z13gaussian_blurPK15HIP_vector_typeIhLj4EEPS0_S3_mmPhS4_S4_i, .Lfunc_end5-_Z13gaussian_blurPK15HIP_vector_typeIhLj4EEPS0_S3_mmPhS4_S4_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z7cleanupv                     # -- Begin function _Z7cleanupv
	.type	_Z7cleanupv,@function
_Z7cleanupv:                            # @_Z7cleanupv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	d_red(%rip), %rdi
	callq	hipFree
	movl	$.L.str.7, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$170, %ecx
	callq	_Z5checkI10hipError_tEvT_PKcS3_i
	movq	d_green(%rip), %rdi
	callq	hipFree
	movl	$.L.str.8, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$171, %ecx
	callq	_Z5checkI10hipError_tEvT_PKcS3_i
	movq	d_blue(%rip), %rdi
	callq	hipFree
	movl	$.L.str.9, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$172, %ecx
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Z5checkI10hipError_tEvT_PKcS3_i # TAILCALL
.Lfunc_end6:
	.size	_Z7cleanupv, .Lfunc_end6-_Z7cleanupv
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13gaussian_blurPKhPhiiPKfi, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__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	.LBB8_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
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z13gaussian_blurPKhPhiiPKfi,@object # @_Z13gaussian_blurPKhPhiiPKfi
	.section	.rodata,"a",@progbits
	.globl	_Z13gaussian_blurPKhPhiiPKfi
	.p2align	3, 0x0
_Z13gaussian_blurPKhPhiiPKfi:
	.quad	_Z28__device_stub__gaussian_blurPKhPhiiPKfi
	.size	_Z13gaussian_blurPKhPhiiPKfi, 8

	.type	_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_,@object # @_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
	.globl	_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
	.p2align	3, 0x0
_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_:
	.quad	_Z31__device_stub__separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
	.size	_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_, 8

	.type	_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii,@object # @_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
	.globl	_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
	.p2align	3, 0x0
_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii:
	.quad	_Z32__device_stub__recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
	.size	_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii, 8

	.type	d_red,@object                   # @d_red
	.bss
	.globl	d_red
	.p2align	3, 0x0
d_red:
	.quad	0
	.size	d_red, 8

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

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

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"hipMalloc(&d_red, sizeof(unsigned char) * numRowsImage * numColsImage)"
	.size	.L.str, 71

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/NicolasRestrepoTorres/parallel-and-distributed-computing-practices/master/Practice2/cuda_processing.hip"
	.size	.L.str.1, 166

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"hipMalloc(&d_green, sizeof(unsigned char) * numRowsImage * numColsImage)"
	.size	.L.str.2, 73

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"hipMalloc(&d_blue, sizeof(unsigned char) * numRowsImage * numColsImage)"
	.size	.L.str.3, 72

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"hipMalloc(&d_filter, sizeof( float) * filterWidth * filterWidth)"
	.size	.L.str.4, 65

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"hipMemcpy(d_filter, h_filter, sizeof(float) * filterWidth * filterWidth, hipMemcpyHostToDevice)"
	.size	.L.str.5, 96

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"hipGetLastError()"
	.size	.L.str.6, 18

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"hipFree(d_red)"
	.size	.L.str.7, 15

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"hipFree(d_green)"
	.size	.L.str.8, 17

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"hipFree(d_blue)"
	.size	.L.str.9, 16

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"CUDA error at: "
	.size	.L.str.10, 16

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

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

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z13gaussian_blurPKhPhiiPKfi"
	.size	.L__unnamed_1, 29

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_"
	.size	.L__unnamed_2, 57

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii"
	.size	.L__unnamed_3, 58

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

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

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z28__device_stub__gaussian_blurPKhPhiiPKfi
	.addrsig_sym _Z31__device_stub__separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
	.addrsig_sym _Z32__device_stub__recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z13gaussian_blurPKhPhiiPKfi
	.addrsig_sym _Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
	.addrsig_sym _Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
	.addrsig_sym d_red
	.addrsig_sym d_green
	.addrsig_sym d_blue
	.addrsig_sym d_filter
	.addrsig_sym _ZSt4cerr
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z13gaussian_blurPKhPhiiPKfi ; -- Begin function _Z13gaussian_blurPKhPhiiPKfi
	.globl	_Z13gaussian_blurPKhPhiiPKfi
	.p2align	8
	.type	_Z13gaussian_blurPKhPhiiPKfi,@function
_Z13gaussian_blurPKhPhiiPKfi:           ; @_Z13gaussian_blurPKhPhiiPKfi
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x34
	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, s9, v0
	v_cmp_gt_i32_e64 s2, s8, 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_9
; %bb.1:                                ; %.preheader43
	s_clause 0x1
	s_load_b32 s12, s[0:1], 0x20
	s_load_b128 s[4:7], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s12, 1
	s_cbranch_scc1 .LBB0_7
; %bb.2:                                ; %.preheader.lr.ph
	s_load_b64 s[0:1], s[0:1], 0x18
	s_lshr_b32 s2, s12, 1
	v_mov_b32_e32 v4, 0
	v_subrev_nc_u32_e32 v2, s2, v1
	v_subrev_nc_u32_e32 v3, s2, v0
	s_mov_b32 s3, 0
	s_add_i32 s13, s9, -1
	s_add_i32 s8, s8, -1
	s_mov_b32 s2, s3
	s_mov_b32 s14, s3
.LBB0_3:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_4 Depth 2
	s_delay_alu instid0(SALU_CYCLE_1)
	v_add_nc_u32_e32 v5, s14, v2
	s_lshl_b64 s[10:11], s[2:3], 2
	s_mov_b32 s15, 0
	s_waitcnt lgkmcnt(0)
	s_add_u32 s10, s0, s10
	s_addc_u32 s11, s1, s11
	v_maxmin_i32 v5, v5, 0, s8
	s_delay_alu instid0(VALU_DEP_1)
	v_mul_lo_u32 v5, v5, s9
.LBB0_4:                                ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	v_add_nc_u32_e32 v6, s15, v3
	s_load_b32 s16, s[10:11], 0x0
	s_add_i32 s15, s15, 1
	s_add_u32 s10, s10, 4
	s_addc_u32 s11, s11, 0
	v_maxmin_i32 v6, v6, 0, s13
	s_cmp_eq_u32 s12, s15
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v6, v6, v5
	v_ashrrev_i32_e32 v7, 31, v6
	v_add_co_u32 v6, vcc_lo, s4, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v7, vcc_lo, s5, v7, vcc_lo
	global_load_u8 v6, v[6:7], off
	s_waitcnt vmcnt(0)
	v_cvt_f32_ubyte0_e32 v6, v6
	s_waitcnt lgkmcnt(0)
	v_fmac_f32_e32 v4, s16, v6
	s_cbranch_scc0 .LBB0_4
; %bb.5:                                ; %._crit_edge
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_add_i32 s14, s14, 1
	s_add_i32 s2, s2, s12
	s_cmp_eq_u32 s14, s12
	s_cbranch_scc0 .LBB0_3
; %bb.6:                                ; %._crit_edge48.loopexit
	v_cvt_i32_f32_e32 v2, v4
	s_branch .LBB0_8
.LBB0_7:
	v_mov_b32_e32 v2, 0
.LBB0_8:                                ; %._crit_edge48
	v_mad_u64_u32 v[3:4], null, v1, s9, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v1, 31, v3
	v_add_co_u32 v0, vcc_lo, s6, v3
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	global_store_b8 v[0:1], v2, off
.LBB0_9:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13gaussian_blurPKhPhiiPKfi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.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 8
		.amdhsa_next_free_sgpr 17
		.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	_Z13gaussian_blurPKhPhiiPKfi, .Lfunc_end0-_Z13gaussian_blurPKhPhiiPKfi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 396
; NumSgprs: 19
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 19
; NumVGPRsForWavesPerEU: 8
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_ ; -- Begin function _Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
	.globl	_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
	.p2align	8
	.type	_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_,@function
_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_: ; @_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x34
	s_load_b64 s[2:3], s[0:1], 0x8
	v_and_b32_e32 v2, 0x3ff, v0
	v_bfe_u32 v3, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s5, s4, 16
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[0:1], null, s14, s4, v[2:3]
	v_mad_u64_u32 v[1:2], null, s15, s5, v[3:4]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e32 vcc_lo, s3, v0
	v_cmp_gt_i32_e64 s2, s2, 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 s4, s2
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_clause 0x1
	s_load_b64 s[8:9], s[0:1], 0x0
	s_load_b128 s[4:7], s[0:1], 0x10
	v_mad_u64_u32 v[2:3], null, v1, s3, v[0:1]
	s_load_b64 s[0:1], s[0:1], 0x20
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[0:1], 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 v0, vcc_lo, s8, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s9, v1, vcc_lo
	v_add_co_u32 v4, vcc_lo, s4, v2
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v3, vcc_lo
	global_load_u8 v6, v[0:1], off
	s_waitcnt vmcnt(0)
	global_store_b8 v[4:5], v6, off
	global_load_u8 v6, v[0:1], off offset:1
	v_add_co_u32 v4, vcc_lo, s6, v2
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v3, vcc_lo
	s_waitcnt vmcnt(0)
	global_store_b8 v[4:5], v6, off
	global_load_u8 v4, v[0:1], off offset:2
	v_add_co_u32 v0, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v3, vcc_lo
	s_waitcnt vmcnt(0)
	global_store_b8 v[0:1], v4, off
.LBB1_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.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 7
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_, .Lfunc_end1-_Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 284
; NumSgprs: 18
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 7
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii ; -- Begin function _Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
	.globl	_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
	.p2align	8
	.type	_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii,@function
_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii: ; @_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x34
	s_load_b64 s[2:3], s[0:1], 0x20
	v_and_b32_e32 v2, 0x3ff, v0
	v_bfe_u32 v3, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s5, s4, 16
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[0:1], null, s14, s4, v[2:3]
	v_mad_u64_u32 v[1:2], null, s15, s5, v[3:4]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e32 vcc_lo, s3, v0
	v_cmp_gt_i32_e64 s2, s2, 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 s4, s2
	s_cbranch_execz .LBB2_2
; %bb.1:
	s_load_b256 s[4:11], s[0:1], 0x0
	v_mad_u64_u32 v[2:3], null, v1, s3, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v3, 31, v2
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s4, v2
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v3, vcc_lo
	v_add_co_u32 v4, vcc_lo, s6, v2
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v3, vcc_lo
	v_add_co_u32 v6, vcc_lo, s8, v2
	v_add_co_ci_u32_e32 v7, vcc_lo, s9, v3, vcc_lo
	global_load_u8 v4, v[4:5], off
	global_load_u8 v5, v[6:7], off
	global_load_u8 v0, v[0:1], off
	s_waitcnt vmcnt(2)
	v_lshlrev_b16 v1, 8, v4
	s_waitcnt vmcnt(1)
	v_or_b32_e32 v4, 0xffffff00, v5
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_or_b32_e32 v0, v0, v1
	v_lshlrev_b32_e32 v4, 16, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_and_b32_e32 v5, 0xffff, v0
	v_lshlrev_b64 v[0:1], 2, v[2:3]
	v_or_b32_e32 v2, v5, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v0, vcc_lo, s10, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s11, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
.LBB2_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.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 8
		.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_end2:
	.size	_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii, .Lfunc_end2-_Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 292
; NumSgprs: 18
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 8
; 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
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13gaussian_blurPKhPhiiPKfi
    .private_segment_fixed_size: 0
    .sgpr_count:     19
    .sgpr_spill_count: 0
    .symbol:         _Z13gaussian_blurPKhPhiiPKfi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z16separateChannelsPK15HIP_vector_typeIhLj4EEiiPhS3_S3_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         36
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z17recombineChannelsPKhS0_S0_P15HIP_vector_typeIhLj4EEii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
