#include <iostream>
#include <cuda_runtime.h>
#include <cooperative_groups.h>

using namespace cooperative_groups;

#define BLOCK_WIDTH 16
#define BLOCK_HEIGHT 16
#define FILTER_RADIUS 1
#define FILTER_SIZE (2 * FILTER_RADIUS + 1)

__constant__ float gaussian[9]; // Precomputed Gaussian kernel

// Bilateral filter kernel
__global__ void bilateralFilterKernel(const float* input, float* output, int width, int height, float sigma_d, float sigma_r) {
    grid_group grid = this_grid();
    int x = blockIdx.x * blockDim.x + threadIdx.x;
    int y = blockIdx.y * blockDim.y + threadIdx.y;

    if (x >= width || y >= height) return;

    float sum = 0.0f;
    float norm = 0.0f;
    float centerPixel = input[y * width + x];

    // Shared memory to store a block of input data
    __shared__ float sharedInput[BLOCK_HEIGHT + 2 * FILTER_RADIUS][BLOCK_WIDTH + 2 * FILTER_RADIUS];

    // Load data into shared memory
    int sharedX = threadIdx.x + FILTER_RADIUS;
    int sharedY = threadIdx.y + FILTER_RADIUS;

    if (y - FILTER_RADIUS + threadIdx.y < height && x - FILTER_RADIUS + threadIdx.x < width) {
        sharedInput[sharedY][sharedX] = input[(y - FILTER_RADIUS + threadIdx.y) * width + (x - FILTER_RADIUS + threadIdx.x)];
    } else {
        sharedInput[sharedY][sharedX] = 0.0f;
    }

    // Ensure all data is loaded into shared memory before proceeding
    grid.sync();

    // Apply bilateral filter
    for (int j = -FILTER_RADIUS; j <= FILTER_RADIUS; ++j) {
        for (int i = -FILTER_RADIUS; i <= FILTER_RADIUS; ++i) {
            int currentX = x + i;
            int currentY = y + j;

            if (currentX >= 0 && currentX < width && currentY >= 0 && currentY < height) {
                float pixelValue = sharedInput[sharedY + j][sharedX + i];
                float spatialWeight = gaussian[(j + FILTER_RADIUS) * FILTER_SIZE + (i + FILTER_RADIUS)];
                float rangeWeight = expf(-powf(pixelValue - centerPixel, 2) / (2 * sigma_r * sigma_r));
                float weight = spatialWeight * rangeWeight;

                sum += weight * pixelValue;
                norm += weight;
            }
        }
    }

    // Store the result in the output image
    output[y * width + x] = sum / norm;
}

// Function to compute Gaussian weights
void computeGaussian(float* kernel, float sigma, int size) {
    float sum = 0.0f;
    for (int i = 0; i < size; ++i) {
        for (int j = 0; j < size; ++j) {
            int x = i - size / 2;
            int y = j - size / 2;
            kernel[i * size + j] = expf(-(x * x + y * y) / (2 * sigma * sigma)) / (2 * M_PI * sigma * sigma);
            sum += kernel[i * size + j];
        }
    }
    // Normalize the kernel
    for (int i = 0; i < size * size; ++i) {
        kernel[i] /= sum;
    }
}

int main() {
    int width = 512;
    int height = 512;
    float sigma_d = 1.0f; // Spatial standard deviation
    float sigma_r = 10.0f; // Range standard deviation

    // Allocate and initialize input image
    float* h_input = new float[width * height];
    for (int i = 0; i < width * height; ++i) {
        h_input[i] = static_cast<float>(i % 256); // Simple gradient for testing
    }

    float* h_output = new float[width * height];
    float* d_input, *d_output;

    // Allocate device memory
    cudaError_t err = cudaMalloc(&d_input, width * height * sizeof(float));
    if (err != cudaSuccess) {
        std::cerr << "Failed to allocate device input memory: " << cudaGetErrorString(err) << std::endl;
        return -1;
    }

    err = cudaMalloc(&d_output, width * height * sizeof(float));
    if (err != cudaSuccess) {
        std::cerr << "Failed to allocate device output memory: " << cudaGetErrorString(err) << std::endl;
        cudaFree(d_input);
        return -1;
    }

    // Copy input image to device
    err = cudaMemcpy(d_input, h_input, width * height * sizeof(float), cudaMemcpyHostToDevice);
    if (err != cudaSuccess) {
        std::cerr << "Failed to copy input image to device: " << cudaGetErrorString(err) << std::endl;
        cudaFree(d_input);
        cudaFree(d_output);
        delete[] h_input;
        delete[] h_output;
        return -1;
    }

    // Compute Gaussian kernel
    float* h_gaussian = new float[FILTER_SIZE * FILTER_SIZE];
    computeGaussian(h_gaussian, sigma_d, FILTER_SIZE);

    // Copy Gaussian kernel to constant memory
    err = cudaMemcpyToSymbol(gaussian, h_gaussian, FILTER_SIZE * FILTER_SIZE * sizeof(float));
    if (err != cudaSuccess) {
        std::cerr << "Failed to copy Gaussian kernel to constant memory: " << cudaGetErrorString(err) << std::endl;
        cudaFree(d_input);
        cudaFree(d_output);
        delete[] h_input;
        delete[] h_output;
        delete[] h_gaussian;
        return -1;
    }

    // Launch kernel
    dim3 blockSize(BLOCK_WIDTH, BLOCK_HEIGHT);
    dim3 gridSize((width + BLOCK_WIDTH - 1) / BLOCK_WIDTH, (height + BLOCK_HEIGHT - 1) / BLOCK_HEIGHT);
    bilateralFilterKernel<<<gridSize, blockSize>>>(d_input, d_output, width, height, sigma_d, sigma_r);

    // Check for errors in kernel launch
    err = cudaGetLastError();
    if (err != cudaSuccess) {
        std::cerr << "Kernel launch failed: " << cudaGetErrorString(err) << std::endl;
        cudaFree(d_input);
        cudaFree(d_output);
        delete[] h_input;
        delete[] h_output;
        delete[] h_gaussian;
        return -1;
    }

    // Copy output image back to host
    err = cudaMemcpy(h_output, d_output, width * height * sizeof(float), cudaMemcpyDeviceToHost);
    if (err != cudaSuccess) {
        std::cerr << "Failed to copy output image to host: " << cudaGetErrorString(err) << std::endl;
        cudaFree(d_input);
        cudaFree(d_output);
        delete[] h_input;
        delete[] h_output;
        delete[] h_gaussian;
        return -1;
    }

    // Free resources
    cudaFree(d_input);
    cudaFree(d_output);
    delete[] h_input;
    delete[] h_output;
    delete[] h_gaussian;

    std::cout << "Bilateral filter completed successfully." << std::endl;
    return 0;
}
	.file	"tmpxft_000bea6f_00000000-6_cuda_code_056681.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB6836:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE6836:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB7720:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE7720:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.globl	_Z15computeGaussianPffi
	.type	_Z15computeGaussianPffi, @function
_Z15computeGaussianPffi:
.LFB6832:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$2, %ecx
	movaps	%xmm0, %xmm1
	xorps	%xmm3, %xmm3
	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
	movslq	%esi, %r12
	movq	%rdi, %rsi
	movl	%r12d, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdi, %rbp
	cltd
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r12, %rbx
	idivl	%ecx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	xorl	%edx, %edx
	movl	%eax, %r13d
	leaq	0(,%r12,4), %rax
	movq	%rax, 16(%rsp)
	negl	%r13d
.L4:
	cmpl	%ebx, %edx
	jl	.L6
	imull	%ebx, %ebx
	xorl	%eax, %eax
	jmp	.L7
.L6:
	movaps	%xmm1, %xmm0
	leal	(%rdx,%r13), %r15d
	movl	%r13d, %r14d
	movq	%rsi, %r12
	addss	%xmm1, %xmm0
	leal	(%rbx,%r13), %edi
	imull	%r15d, %r15d
	mulss	%xmm1, %xmm0
	movss	%xmm0, 12(%rsp)
.L5:
	movl	%r14d, %eax
	movq	%rsi, 32(%rsp)
	addq	$4, %r12
	imull	%r14d, %eax
	movl	%edi, 40(%rsp)
	incl	%r14d
	movl	%edx, 24(%rsp)
	movss	%xmm1, 44(%rsp)
	addl	%r15d, %eax
	movss	%xmm3, 28(%rsp)
	negl	%eax
	cvtsi2ssl	%eax, %xmm0
	divss	12(%rsp), %xmm0
	call	expf@PLT
	movss	44(%rsp), %xmm1
	movl	40(%rsp), %edi
	movsd	.LC1(%rip), %xmm4
	cvtss2sd	%xmm0, %xmm0
	movss	28(%rsp), %xmm3
	cvtss2sd	%xmm1, %xmm2
	movl	24(%rsp), %edx
	movq	32(%rsp), %rsi
	mulsd	%xmm2, %xmm4
	mulsd	%xmm4, %xmm2
	divsd	%xmm2, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, -4(%r12)
	cmpl	%edi, %r14d
	addss	%xmm0, %xmm3
	jne	.L5
	movq	16(%rsp), %rax
	incl	%edx
	addq	%rax, %rsi
	jmp	.L4
.L7:
	cmpl	%eax, %ebx
	jle	.L12
	movss	0(%rbp,%rax,4), %xmm0
	divss	%xmm3, %xmm0
	movss	%xmm0, 0(%rbp,%rax,4)
	incq	%rax
	jmp	.L7
.L12:
	addq	$56, %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
.LFE6832:
	.size	_Z15computeGaussianPffi, .-_Z15computeGaussianPffi
	.globl	_Z48__device_stub__Z21bilateralFilterKernelPKfPfiiffPKfPfiiff
	.type	_Z48__device_stub__Z21bilateralFilterKernelPKfPfiiffPKfPfiiff, @function
_Z48__device_stub__Z21bilateralFilterKernelPKfPfiiffPKfPfiiff:
.LFB6858:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	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
	movss	%xmm0, 4(%rsp)
	movss	%xmm1, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%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)
	leaq	4(%rsp), %rax
	movq	%rax, 136(%rsp)
	movq	%rsp, %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L13
	pushq	48(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z21bilateralFilterKernelPKfPfiiff(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 192
	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 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L13:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE6858:
	.size	_Z48__device_stub__Z21bilateralFilterKernelPKfPfiiffPKfPfiiff, .-_Z48__device_stub__Z21bilateralFilterKernelPKfPfiiffPKfPfiiff
	.globl	_Z21bilateralFilterKernelPKfPfiiff
	.type	_Z21bilateralFilterKernelPKfPfiiff, @function
_Z21bilateralFilterKernelPKfPfiiff:
.LFB6859:
	.cfi_startproc
	endbr64
	jmp	_Z48__device_stub__Z21bilateralFilterKernelPKfPfiiffPKfPfiiff
	.cfi_endproc
.LFE6859:
	.size	_Z21bilateralFilterKernelPKfPfiiff, .-_Z21bilateralFilterKernelPKfPfiiff
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"Failed to allocate device input memory: "
.LC3:
	.string	"Failed to allocate device output memory: "
.LC4:
	.string	"Failed to copy input image to device: "
.LC6:
	.string	"Failed to copy Gaussian kernel to constant memory: "
.LC8:
	.string	"Kernel launch failed: "
.LC9:
	.string	"Failed to copy output image to host: "
.LC10:
	.string	"Bilateral filter completed successfully."
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB6833:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	$1048576, %edi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$48, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	_Znam@PLT
	movq	%rax, %rbx
	xorl	%eax, %eax
.L19:
	movzbl	%al, %edx
	cvtsi2ssl	%edx, %xmm0
	movss	%xmm0, (%rbx,%rax,4)
	incq	%rax
	cmpq	$262144, %rax
	jne	.L19
	movl	$1048576, %edi
	call	_Znam@PLT
	movq	%rsp, %rdi
	movl	$1048576, %esi
	movq	%rax, %r12
	call	cudaMalloc@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L20
	leaq	.LC2(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %edi
	movq	%rax, %rbx
	call	cudaGetErrorString@PLT
	movq	%rbx, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	jmp	.L21
.L20:
	leaq	8(%rsp), %rdi
	movl	$1048576, %esi
	call	cudaMalloc@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L22
	leaq	.LC3(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %edi
	movq	%rax, %rbx
	call	cudaGetErrorString@PLT
	movq	%rbx, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	(%rsp), %rdi
	call	cudaFree@PLT
.L21:
	orl	$-1, %eax
	jmp	.L18
.L22:
	movq	(%rsp), %rdi
	movl	$1, %ecx
	movl	$1048576, %edx
	movq	%rbx, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L24
	leaq	.LC4(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %edi
	movq	%rax, %r13
	call	cudaGetErrorString@PLT
	movq	%r13, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbx, %rdi
	call	_ZdaPv@PLT
	movq	%r12, %rdi
	jmp	.L33
.L24:
	movl	$36, %edi
	call	_Znam@PLT
	movss	.LC5(%rip), %xmm0
	movl	$3, %esi
	movq	%rax, %rbp
	movq	%rax, %rdi
	call	_Z15computeGaussianPffi
	movq	%rbp, %rsi
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$36, %edx
	leaq	_ZL8gaussian(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	leaq	.LC6(%rip), %rsi
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	.L32
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movl	$1, %esi
	movabsq	$68719476752, %rdx
	movabsq	$137438953504, %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L26
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movl	$512, %ecx
	movl	$512, %edx
	movss	.LC7(%rip), %xmm1
	movss	.LC5(%rip), %xmm0
	call	_Z48__device_stub__Z21bilateralFilterKernelPKfPfiiffPKfPfiiff
.L26:
	call	cudaGetLastError@PLT
	leaq	.LC8(%rip), %rsi
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	.L32
	movq	8(%rsp), %rsi
	movl	$2, %ecx
	movl	$1048576, %edx
	movq	%r12, %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %r13d
	testl	%eax, %eax
	je	.L28
	leaq	.LC9(%rip), %rsi
.L32:
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r13d, %edi
	movq	%rax, %r14
	call	cudaGetErrorString@PLT
	movq	%r14, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbx, %rdi
	call	_ZdaPv@PLT
	movq	%r12, %rdi
	call	_ZdaPv@PLT
	movq	%rbp, %rdi
.L33:
	call	_ZdaPv@PLT
	jmp	.L21
.L28:
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbx, %rdi
	call	_ZdaPv@PLT
	movq	%r12, %rdi
	call	_ZdaPv@PLT
	movq	%rbp, %rdi
	call	_ZdaPv@PLT
	leaq	.LC10(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	xorl	%eax, %eax
.L18:
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	addq	$48, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE6833:
	.size	main, .-main
	.section	.rodata.str1.1
.LC11:
	.string	"_Z21bilateralFilterKernelPKfPfiiff"
.LC12:
	.string	"gaussian"
.LC13:
	.string	"_ZN50_INTERNAL_2ba667a8_19_cuda_code_056681_cu_d8c775504cuda3std3__419piecewise_constructE"
.LC14:
	.string	"_ZN50_INTERNAL_2ba667a8_19_cuda_code_056681_cu_d8c775504cuda3std6ranges3__45__cpo4swapE"
.LC15:
	.string	"_ZN50_INTERNAL_2ba667a8_19_cuda_code_056681_cu_d8c775504cuda3std6ranges3__45__cpo9iter_moveE"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB6861:
	.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	.LC11(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z21bilateralFilterKernelPKfPfiiff(%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	%r8d, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC12(%rip), %rdx
	movl	$36, %r9d
	leaq	_ZL8gaussian(%rip), %rsi
	pushq	$1
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC13(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$1, %r9d
	leaq	_ZN4cuda3std3__419piecewise_constructE(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC14(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$1, %r9d
	leaq	_ZN4cuda3std6ranges3__45__cpo4swapE(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rdi
	.cfi_def_cfa_offset 24
	popq	%r8
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC15(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movl	$1, %r9d
	movq	%rdx, %rcx
	leaq	_ZN4cuda3std6ranges3__45__cpo9iter_moveE(%rip), %rsi
	call	__cudaRegisterVar@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%r9
	.cfi_def_cfa_offset 24
	popq	%r10
	.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
.LFE6861:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.local	_ZL8gaussian
	.comm	_ZL8gaussian,36,32
	.weak	_ZN4cuda3std3__419piecewise_constructE
	.section	.rodata._ZN4cuda3std3__419piecewise_constructE,"aG",@progbits,_ZN4cuda3std3__419piecewise_constructE,comdat
	.type	_ZN4cuda3std3__419piecewise_constructE, @gnu_unique_object
	.size	_ZN4cuda3std3__419piecewise_constructE, 1
_ZN4cuda3std3__419piecewise_constructE:
	.zero	1
	.weak	_ZN4cuda3std6ranges3__45__cpo9iter_moveE
	.section	.rodata._ZN4cuda3std6ranges3__45__cpo9iter_moveE,"aG",@progbits,_ZN4cuda3std6ranges3__45__cpo9iter_moveE,comdat
	.type	_ZN4cuda3std6ranges3__45__cpo9iter_moveE, @gnu_unique_object
	.size	_ZN4cuda3std6ranges3__45__cpo9iter_moveE, 1
_ZN4cuda3std6ranges3__45__cpo9iter_moveE:
	.zero	1
	.weak	_ZN4cuda3std6ranges3__45__cpo4swapE
	.section	.rodata._ZN4cuda3std6ranges3__45__cpo4swapE,"aG",@progbits,_ZN4cuda3std6ranges3__45__cpo4swapE,comdat
	.type	_ZN4cuda3std6ranges3__45__cpo4swapE, @gnu_unique_object
	.size	_ZN4cuda3std6ranges3__45__cpo4swapE, 1
_ZN4cuda3std6ranges3__45__cpo4swapE:
	.zero	1
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	1413754136
	.long	1075388923
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC5:
	.long	1065353216
	.align 4
.LC7:
	.long	1092616192
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <iostream>
#include <hip/hip_runtime.h>
#include <hip/hip_cooperative_groups.h>

using namespace cooperative_groups;

#define BLOCK_WIDTH 16
#define BLOCK_HEIGHT 16
#define FILTER_RADIUS 1
#define FILTER_SIZE (2 * FILTER_RADIUS + 1)

__constant__ float gaussian[9]; // Precomputed Gaussian kernel

// Bilateral filter kernel
__global__ void bilateralFilterKernel(const float* input, float* output, int width, int height, float sigma_d, float sigma_r) {
    grid_group grid = this_grid();
    int x = blockIdx.x * blockDim.x + threadIdx.x;
    int y = blockIdx.y * blockDim.y + threadIdx.y;

    if (x >= width || y >= height) return;

    float sum = 0.0f;
    float norm = 0.0f;
    float centerPixel = input[y * width + x];

    // Shared memory to store a block of input data
    __shared__ float sharedInput[BLOCK_HEIGHT + 2 * FILTER_RADIUS][BLOCK_WIDTH + 2 * FILTER_RADIUS];

    // Load data into shared memory
    int sharedX = threadIdx.x + FILTER_RADIUS;
    int sharedY = threadIdx.y + FILTER_RADIUS;

    if (y - FILTER_RADIUS + threadIdx.y < height && x - FILTER_RADIUS + threadIdx.x < width) {
        sharedInput[sharedY][sharedX] = input[(y - FILTER_RADIUS + threadIdx.y) * width + (x - FILTER_RADIUS + threadIdx.x)];
    } else {
        sharedInput[sharedY][sharedX] = 0.0f;
    }

    // Ensure all data is loaded into shared memory before proceeding
    grid.sync();

    // Apply bilateral filter
    for (int j = -FILTER_RADIUS; j <= FILTER_RADIUS; ++j) {
        for (int i = -FILTER_RADIUS; i <= FILTER_RADIUS; ++i) {
            int currentX = x + i;
            int currentY = y + j;

            if (currentX >= 0 && currentX < width && currentY >= 0 && currentY < height) {
                float pixelValue = sharedInput[sharedY + j][sharedX + i];
                float spatialWeight = gaussian[(j + FILTER_RADIUS) * FILTER_SIZE + (i + FILTER_RADIUS)];
                float rangeWeight = expf(-powf(pixelValue - centerPixel, 2) / (2 * sigma_r * sigma_r));
                float weight = spatialWeight * rangeWeight;

                sum += weight * pixelValue;
                norm += weight;
            }
        }
    }

    // Store the result in the output image
    output[y * width + x] = sum / norm;
}

// Function to compute Gaussian weights
void computeGaussian(float* kernel, float sigma, int size) {
    float sum = 0.0f;
    for (int i = 0; i < size; ++i) {
        for (int j = 0; j < size; ++j) {
            int x = i - size / 2;
            int y = j - size / 2;
            kernel[i * size + j] = expf(-(x * x + y * y) / (2 * sigma * sigma)) / (2 * M_PI * sigma * sigma);
            sum += kernel[i * size + j];
        }
    }
    // Normalize the kernel
    for (int i = 0; i < size * size; ++i) {
        kernel[i] /= sum;
    }
}

int main() {
    int width = 512;
    int height = 512;
    float sigma_d = 1.0f; // Spatial standard deviation
    float sigma_r = 10.0f; // Range standard deviation

    // Allocate and initialize input image
    float* h_input = new float[width * height];
    for (int i = 0; i < width * height; ++i) {
        h_input[i] = static_cast<float>(i % 256); // Simple gradient for testing
    }

    float* h_output = new float[width * height];
    float* d_input, *d_output;

    // Allocate device memory
    hipError_t err = hipMalloc(&d_input, width * height * sizeof(float));
    if (err != hipSuccess) {
        std::cerr << "Failed to allocate device input memory: " << hipGetErrorString(err) << std::endl;
        return -1;
    }

    err = hipMalloc(&d_output, width * height * sizeof(float));
    if (err != hipSuccess) {
        std::cerr << "Failed to allocate device output memory: " << hipGetErrorString(err) << std::endl;
        hipFree(d_input);
        return -1;
    }

    // Copy input image to device
    err = hipMemcpy(d_input, h_input, width * height * sizeof(float), hipMemcpyHostToDevice);
    if (err != hipSuccess) {
        std::cerr << "Failed to copy input image to device: " << hipGetErrorString(err) << std::endl;
        hipFree(d_input);
        hipFree(d_output);
        delete[] h_input;
        delete[] h_output;
        return -1;
    }

    // Compute Gaussian kernel
    float* h_gaussian = new float[FILTER_SIZE * FILTER_SIZE];
    computeGaussian(h_gaussian, sigma_d, FILTER_SIZE);

    // Copy Gaussian kernel to constant memory
    err = hipMemcpyToSymbol(HIP_SYMBOL(gaussian), h_gaussian, FILTER_SIZE * FILTER_SIZE * sizeof(float));
    if (err != hipSuccess) {
        std::cerr << "Failed to copy Gaussian kernel to constant memory: " << hipGetErrorString(err) << std::endl;
        hipFree(d_input);
        hipFree(d_output);
        delete[] h_input;
        delete[] h_output;
        delete[] h_gaussian;
        return -1;
    }

    // Launch kernel
    dim3 blockSize(BLOCK_WIDTH, BLOCK_HEIGHT);
    dim3 gridSize((width + BLOCK_WIDTH - 1) / BLOCK_WIDTH, (height + BLOCK_HEIGHT - 1) / BLOCK_HEIGHT);
    bilateralFilterKernel<<<gridSize, blockSize>>>(d_input, d_output, width, height, sigma_d, sigma_r);

    // Check for errors in kernel launch
    err = hipGetLastError();
    if (err != hipSuccess) {
        std::cerr << "Kernel launch failed: " << hipGetErrorString(err) << std::endl;
        hipFree(d_input);
        hipFree(d_output);
        delete[] h_input;
        delete[] h_output;
        delete[] h_gaussian;
        return -1;
    }

    // Copy output image back to host
    err = hipMemcpy(h_output, d_output, width * height * sizeof(float), hipMemcpyDeviceToHost);
    if (err != hipSuccess) {
        std::cerr << "Failed to copy output image to host: " << hipGetErrorString(err) << std::endl;
        hipFree(d_input);
        hipFree(d_output);
        delete[] h_input;
        delete[] h_output;
        delete[] h_gaussian;
        return -1;
    }

    // Free resources
    hipFree(d_input);
    hipFree(d_output);
    delete[] h_input;
    delete[] h_output;
    delete[] h_gaussian;

    std::cout << "Bilateral filter completed successfully." << std::endl;
    return 0;
}
	.text
	.file	"cuda_code_056681.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z36__device_stub__bilateralFilterKernelPKfPfiiff # -- Begin function _Z36__device_stub__bilateralFilterKernelPKfPfiiff
	.type	_Z36__device_stub__bilateralFilterKernelPKfPfiiff,@function
_Z36__device_stub__bilateralFilterKernelPKfPfiiff: # @_Z36__device_stub__bilateralFilterKernelPKfPfiiff
	.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	$128, %rsp
	.cfi_def_cfa_offset 176
	.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	4(%rsp), %rcx
	movss	%xmm0, (%rcx)
	movq	%rsp, %r8
	movss	%xmm1, (%r8)
	leaq	80(%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	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	$_Z21bilateralFilterKernelPKfPfiiff, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	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	_Z36__device_stub__bilateralFilterKernelPKfPfiiff, .Lfunc_end0-_Z36__device_stub__bilateralFilterKernelPKfPfiiff
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z15computeGaussianPffi
.LCPI1_0:
	.quad	0x401921fb54442d18              # double 6.2831853071795862
	.text
	.globl	_Z15computeGaussianPffi
	.type	_Z15computeGaussianPffi,@function
_Z15computeGaussianPffi:                # @_Z15computeGaussianPffi
	.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	$56, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
                                        # kill: def $esi killed $esi def $rsi
	testl	%esi, %esi
	jle	.LBB1_1
# %bb.6:                                # %.preheader37.lr.ph
	movl	%esi, %eax
	shrl	%eax
	movaps	%xmm0, %xmm2
	addss	%xmm0, %xmm2
	mulss	%xmm0, %xmm2
	cvtss2sd	%xmm0, %xmm0
	movsd	.LCPI1_0(%rip), %xmm3           # xmm3 = mem[0],zero
	mulsd	%xmm0, %xmm3
	mulsd	%xmm0, %xmm3
	movl	%esi, %r15d
	movl	%eax, 12(%rsp)                  # 4-byte Spill
	movl	%eax, %r12d
	negl	%r12d
	xorps	%xmm1, %xmm1
	xorl	%eax, %eax
	xorl	%ebp, %ebp
	movq	%rsi, 32(%rsp)                  # 8-byte Spill
	movq	%rdi, 24(%rsp)                  # 8-byte Spill
	movss	%xmm2, 16(%rsp)                 # 4-byte Spill
	movsd	%xmm3, 48(%rsp)                 # 8-byte Spill
.LBB1_7:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_8 Depth 2
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	movl	%eax, %eax
	leaq	(%rdi,%rax,4), %rbx
	movl	%ebp, %r14d
	subl	12(%rsp), %r14d                 # 4-byte Folded Reload
	imull	%r14d, %r14d
	xorl	%r13d, %r13d
.LBB1_8:                                #   Parent Loop BB1_7 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	%xmm1, 20(%rsp)                 # 4-byte Spill
	leal	(%r12,%r13), %eax
	imull	%eax, %eax
	addl	%r14d, %eax
	negl	%eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	divss	%xmm2, %xmm0
	callq	expf
	movsd	48(%rsp), %xmm3                 # 8-byte Reload
                                        # xmm3 = mem[0],zero
	movss	16(%rsp), %xmm2                 # 4-byte Reload
                                        # xmm2 = mem[0],zero,zero,zero
	movss	20(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	cvtss2sd	%xmm0, %xmm0
	divsd	%xmm3, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%rbx,%r13,4)
	addss	%xmm0, %xmm1
	incq	%r13
	cmpq	%r13, %r15
	jne	.LBB1_8
# %bb.9:                                # %._crit_edge
                                        #   in Loop: Header=BB1_7 Depth=1
	incq	%rbp
	movq	32(%rsp), %rsi                  # 8-byte Reload
	movq	40(%rsp), %rax                  # 8-byte Reload
	addl	%esi, %eax
	cmpq	%r15, %rbp
	movq	24(%rsp), %rdi                  # 8-byte Reload
	jne	.LBB1_7
	jmp	.LBB1_2
.LBB1_1:
	xorps	%xmm1, %xmm1
.LBB1_2:                                # %.preheader
	testl	%esi, %esi
	je	.LBB1_5
# %bb.3:                                # %.lr.ph44.preheader
	imull	%esi, %esi
	cmpl	$1, %esi
	adcl	$0, %esi
	xorl	%eax, %eax
.LBB1_4:                                # %.lr.ph44
                                        # =>This Inner Loop Header: Depth=1
	movss	(%rdi,%rax,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	divss	%xmm1, %xmm0
	movss	%xmm0, (%rdi,%rax,4)
	incq	%rax
	cmpq	%rax, %rsi
	jne	.LBB1_4
.LBB1_5:                                # %._crit_edge45
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z15computeGaussianPffi, .Lfunc_end1-_Z15computeGaussianPffi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI2_0:
	.long	0x3f800000                      # float 1
.LCPI2_1:
	.long	0x41200000                      # float 10
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$1048576, %edi                  # imm = 0x100000
	callq	_Znam
	movq	%rax, %rbx
	xorl	%eax, %eax
.LBB2_1:                                # =>This Inner Loop Header: Depth=1
	movzbl	%al, %ecx
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ecx, %xmm0
	movss	%xmm0, (%rbx,%rax,4)
	incq	%rax
	cmpq	$262144, %rax                   # imm = 0x40000
	jne	.LBB2_1
# %bb.2:
	movl	$1048576, %edi                  # imm = 0x100000
	callq	_Znam
	movq	%rax, %r14
	movq	%rsp, %rdi
	movl	$1048576, %esi                  # imm = 0x100000
	callq	hipMalloc
	testl	%eax, %eax
	je	.LBB2_5
# %bb.3:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str, %esi
	movl	$40, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %edi
	callq	hipGetErrorString
	testq	%rax, %rax
	je	.LBB2_8
# %bb.4:
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	strlen
	movl	$_ZSt4cerr, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB2_9
.LBB2_5:
	leaq	8(%rsp), %rdi
	movl	$1048576, %esi                  # imm = 0x100000
	callq	hipMalloc
	testl	%eax, %eax
	je	.LBB2_10
# %bb.6:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.1, %esi
	movl	$41, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %edi
	callq	hipGetErrorString
	testq	%rax, %rax
	je	.LBB2_13
# %bb.7:
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	strlen
	movl	$_ZSt4cerr, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB2_14
.LBB2_8:
	movq	_ZSt4cerr(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cerr(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB2_9:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movq	_ZSt4cerr(%rip), %rax
	movl	$_ZSt4cerr, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cerr, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	jmp	.LBB2_31
.LBB2_10:
	movq	(%rsp), %rdi
	movl	$1048576, %edx                  # imm = 0x100000
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	je	.LBB2_15
# %bb.11:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.2, %esi
	movl	$38, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %edi
	callq	hipGetErrorString
	testq	%rax, %rax
	je	.LBB2_18
# %bb.12:
	movq	%rax, %r15
	movq	%rax, %rdi
	callq	strlen
	movl	$_ZSt4cerr, %edi
	movq	%r15, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB2_19
.LBB2_13:
	movq	_ZSt4cerr(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cerr(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB2_14:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit76
	movq	_ZSt4cerr(%rip), %rax
	movl	$_ZSt4cerr, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cerr, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	(%rsp), %rdi
	callq	hipFree
	jmp	.LBB2_31
.LBB2_15:
	movl	$36, %edi
	callq	_Znam
	movq	%rax, %r15
	movss	.LCPI2_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movq	%rax, %rdi
	movl	$3, %esi
	callq	_Z15computeGaussianPffi
	movl	$gaussian, %edi
	movl	$36, %edx
	movq	%r15, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	testl	%eax, %eax
	je	.LBB2_20
# %bb.16:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.3, %esi
	movl	$51, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %edi
	callq	hipGetErrorString
	testq	%rax, %rax
	je	.LBB2_24
# %bb.17:
	movq	%rax, %r12
	movq	%rax, %rdi
	callq	strlen
	movl	$_ZSt4cerr, %edi
	movq	%r12, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB2_25
.LBB2_18:
	movq	_ZSt4cerr(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cerr(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB2_19:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit78
	movq	_ZSt4cerr(%rip), %rax
	movl	$_ZSt4cerr, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cerr, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	%rbx, %rdi
	callq	_ZdaPv
	movq	%r14, %rdi
	jmp	.LBB2_30
.LBB2_20:
	movabsq	$137438953504, %rdi             # imm = 0x2000000020
	movabsq	$68719476752, %rdx              # imm = 0x1000000010
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_22
# %bb.21:
	movq	(%rsp), %rdi
	movq	8(%rsp), %rsi
	movss	.LCPI2_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movss	.LCPI2_1(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	movl	$512, %edx                      # imm = 0x200
	movl	$512, %ecx                      # imm = 0x200
	callq	_Z36__device_stub__bilateralFilterKernelPKfPfiiff
.LBB2_22:
	callq	hipGetLastError
	testl	%eax, %eax
	je	.LBB2_26
# %bb.23:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.4, %esi
	movl	$22, %edx
	jmp	.LBB2_28
.LBB2_24:
	movq	_ZSt4cerr(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cerr(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB2_25:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit80
	movq	_ZSt4cerr(%rip), %rax
	movl	$_ZSt4cerr, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cerr, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	jmp	.LBB2_29
.LBB2_26:
	movq	8(%rsp), %rsi
	movl	$1048576, %edx                  # imm = 0x100000
	movq	%r14, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	je	.LBB2_33
# %bb.27:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.5, %esi
	movl	$37, %edx
.LBB2_28:
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %edi
	callq	hipGetErrorString
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.LBB2_29:
	movq	(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	%rbx, %rdi
	callq	_ZdaPv
	movq	%r14, %rdi
	callq	_ZdaPv
	movq	%r15, %rdi
.LBB2_30:
	callq	_ZdaPv
.LBB2_31:
	movl	$-1, %eax
.LBB2_32:
	addq	$16, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB2_33:
	.cfi_def_cfa_offset 64
	movq	(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	%rbx, %rdi
	callq	_ZdaPv
	movq	%r14, %rdi
	callq	_ZdaPv
	movq	%r15, %rdi
	callq	_ZdaPv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.6, %esi
	movl	$40, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	xorl	%eax, %eax
	jmp	.LBB2_32
.Lfunc_end2:
	.size	main, .Lfunc_end2-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:
	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	.LBB3_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB3_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z21bilateralFilterKernelPKfPfiiff, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$0, 8(%rsp)
	movl	$1, (%rsp)
	movl	$gaussian, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movl	$36, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end3:
	.size	__hip_module_ctor, .Lfunc_end3-__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	.LBB4_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
.LBB4_2:
	retq
.Lfunc_end4:
	.size	__hip_module_dtor, .Lfunc_end4-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	gaussian,@object                # @gaussian
	.local	gaussian
	.comm	gaussian,36,16
	.type	_Z21bilateralFilterKernelPKfPfiiff,@object # @_Z21bilateralFilterKernelPKfPfiiff
	.section	.rodata,"a",@progbits
	.globl	_Z21bilateralFilterKernelPKfPfiiff
	.p2align	3, 0x0
_Z21bilateralFilterKernelPKfPfiiff:
	.quad	_Z36__device_stub__bilateralFilterKernelPKfPfiiff
	.size	_Z21bilateralFilterKernelPKfPfiiff, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Failed to allocate device input memory: "
	.size	.L.str, 41

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Failed to allocate device output memory: "
	.size	.L.str.1, 42

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Failed to copy input image to device: "
	.size	.L.str.2, 39

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Failed to copy Gaussian kernel to constant memory: "
	.size	.L.str.3, 52

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Kernel launch failed: "
	.size	.L.str.4, 23

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Failed to copy output image to host: "
	.size	.L.str.5, 38

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Bilateral filter completed successfully."
	.size	.L.str.6, 41

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z21bilateralFilterKernelPKfPfiiff"
	.size	.L__unnamed_1, 35

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"gaussian"
	.size	.L__unnamed_2, 9

	.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 _Z36__device_stub__bilateralFilterKernelPKfPfiiff
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym gaussian
	.addrsig_sym _Z21bilateralFilterKernelPKfPfiiff
	.addrsig_sym _ZSt4cerr
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z21bilateralFilterKernelPKfPfiiff ; -- Begin function _Z21bilateralFilterKernelPKfPfiiff
	.globl	_Z21bilateralFilterKernelPKfPfiiff
	.p2align	8
	.type	_Z21bilateralFilterKernelPKfPfiiff,@function
_Z21bilateralFilterKernelPKfPfiiff:     ; @_Z21bilateralFilterKernelPKfPfiiff
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b64 s[8:9], s[0:1], 0x10
	v_and_b32_e32 v6, 0x3ff, v0
	v_bfe_u32 v7, v0, 10, 10
	s_add_u32 s10, s0, 32
	s_addc_u32 s11, s1, 0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s3, s2, 16
	s_and_b32 s2, s2, 0xffff
	v_mad_u64_u32 v[1:2], null, s15, s3, v[7:8]
	v_mad_u64_u32 v[4:5], null, s14, s2, v[6:7]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e64 s2, s9, v1
	v_cmp_gt_i32_e32 vcc_lo, s8, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, s2, vcc_lo
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB0_24
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[2:3], null, v1, s8, v[4:5]
	v_add3_u32 v10, v7, v1, -1
	s_mov_b32 s2, exec_lo
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v8, vcc_lo, s4, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v9, vcc_lo, s5, v3, vcc_lo
	global_load_b32 v8, v[8:9], off
	v_mov_b32_e32 v9, 0
	v_cmpx_gt_u32_e64 s9, v10
	s_cbranch_execz .LBB0_5
; %bb.2:
	v_add3_u32 v5, v6, v4, -1
	v_mov_b32_e32 v9, 0
	s_mov_b32 s3, exec_lo
	s_delay_alu instid0(VALU_DEP_2)
	v_cmpx_gt_u32_e64 s8, v5
	s_cbranch_execz .LBB0_4
; %bb.3:
	v_mad_u64_u32 v[11:12], null, v10, s8, v[5:6]
	v_mov_b32_e32 v12, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[9:10], 2, v[11:12]
	v_add_co_u32 v9, vcc_lo, s4, v9
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v10, vcc_lo, s5, v10, vcc_lo
	global_load_b32 v9, v[9:10], off
.LBB0_4:                                ; %Flow119
	s_or_b32 exec_lo, exec_lo, s3
.LBB0_5:
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	s_or_b32 exec_lo, exec_lo, s2
	v_bfe_u32 v0, v0, 20, 10
	v_lshlrev_b32_e32 v5, 2, v6
	s_mov_b32 s4, exec_lo
	v_or3_b32 v6, v7, v0, v6
	s_delay_alu instid0(VALU_DEP_2)
	v_mad_u32_u24 v0, 0x48, v7, v5
	s_waitcnt vmcnt(0)
	ds_store_b32 v0, v9 offset:76
	s_waitcnt lgkmcnt(0)
	buffer_gl1_inv
	buffer_gl0_inv
	s_barrier
	v_cmpx_eq_u32_e32 0, v6
	s_cbranch_execz .LBB0_15
; %bb.6:
	s_load_b64 s[2:3], s[10:11], 0x58
	s_mov_b32 s12, exec_lo
	s_mov_b32 s10, exec_lo
	v_mbcnt_lo_u32_b32 v5, s12, 0
                                        ; implicit-def: $vgpr6
	s_waitcnt lgkmcnt(0)
	s_load_b32 s5, s[2:3], 0x28
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v5
	s_cbranch_execz .LBB0_8
; %bb.7:
	s_bcnt1_i32_b32 s11, s12
	s_delay_alu instid0(SALU_CYCLE_1)
	v_dual_mov_b32 v6, 0 :: v_dual_mov_b32 v7, s11
	global_atomic_add_u32 v6, v6, v7, s[2:3] offset:32 glc
.LBB0_8:
	s_or_b32 exec_lo, exec_lo, s10
	s_waitcnt vmcnt(0)
	v_readfirstlane_b32 s10, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v5, s10, v5
	s_waitcnt lgkmcnt(0)
	s_add_i32 s10, s5, -1
	v_and_b32_e32 v6, 0xffff, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_ne_u32_e32 vcc_lo, s10, v6
	s_and_saveexec_b32 s10, vcc_lo
	s_xor_b32 s10, exec_lo, s10
	s_cbranch_execz .LBB0_12
; %bb.9:                                ; %.preheader.i.i.i.preheader
	v_mov_b32_e32 v6, 0
	s_mov_b32 s11, 0
.LBB0_10:                               ; %.preheader.i.i.i
                                        ; =>This Inner Loop Header: Depth=1
	s_sleep 1
	global_load_b32 v7, v6, s[2:3] offset:32 glc
	s_waitcnt vmcnt(0)
	v_xor_b32_e32 v7, v7, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_lt_u32_e32 vcc_lo, 0xffff, v7
	s_or_b32 s11, vcc_lo, s11
	s_and_not1_b32 exec_lo, exec_lo, s11
	s_cbranch_execnz .LBB0_10
; %bb.11:                               ; %Flow114
	s_or_b32 exec_lo, exec_lo, s11
.LBB0_12:                               ; %Flow116
	s_and_not1_saveexec_b32 s10, s10
	s_cbranch_execz .LBB0_15
; %bb.13:
	s_mov_b32 s10, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mbcnt_lo_u32_b32 v5, s10, 0
	v_cmp_eq_u32_e32 vcc_lo, 0, v5
	s_and_b32 s11, exec_lo, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 exec_lo, s11
	s_cbranch_execz .LBB0_15
; %bb.14:
	s_sub_i32 s5, 0x10000, s5
	s_bcnt1_i32_b32 s10, s10
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s5, s5, s10
	v_dual_mov_b32 v5, 0 :: v_dual_mov_b32 v6, s5
	global_atomic_add_u32 v5, v6, s[2:3] offset:32
.LBB0_15:                               ; %Flow118
	s_or_b32 exec_lo, exec_lo, s4
	s_load_b32 s0, s[0:1], 0x1c
	s_getpc_b64 s[4:5]
	s_add_u32 s4, s4, gaussian@rel32@lo+4
	s_addc_u32 s5, s5, gaussian@rel32@hi+12
	s_mov_b32 s12, -1
	s_mov_b32 s13, 0x3e76c4e1
	s_waitcnt lgkmcnt(0)
	s_waitcnt_vscnt null, 0x0
	s_barrier
	v_add_f32_e64 v5, s0, s0
	v_add_nc_u32_e32 v6, -1, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_dual_mov_b32 v4, 0 :: v_dual_mul_f32 v7, s0, v5
	v_mov_b32_e32 v5, 0
.LBB0_16:                               ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_17 Depth 2
	v_add_nc_u32_e32 v9, s12, v1
	s_mov_b32 s14, -12
	s_mov_b64 s[10:11], s[4:5]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_lt_i32_e64 s0, -1, v9
	v_cmp_gt_i32_e64 s1, s9, v9
	v_mov_b32_e32 v9, v6
.LBB0_17:                               ;   Parent Loop BB0_16 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_mov_b32 s15, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_lt_i32_e32 -1, v9
	s_cbranch_execz .LBB0_21
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=2
	v_cmp_gt_i32_e32 vcc_lo, s8, v9
	s_and_b32 s2, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, s2, s1
	s_and_saveexec_b32 s16, s2
	s_cbranch_execz .LBB0_20
; %bb.19:                               ;   in Loop: Header=BB0_17 Depth=2
	v_add_nc_u32_e32 v10, s14, v0
	ds_load_b32 v10, v10 offset:12
	s_waitcnt lgkmcnt(0)
	v_sub_f32_e32 v11, v10, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_frexp_mant_f32_e64 v12, |v11|
	v_cmp_gt_f32_e32 vcc_lo, 0x3f2aaaab, v12
	v_cndmask_b32_e64 v13, 0, 1, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ldexp_f32 v12, v12, v13
	v_add_f32_e32 v13, 1.0, v12
	v_add_f32_e32 v15, -1.0, v12
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v17, -1.0, v13
	v_sub_f32_e32 v12, v12, v17
	v_rcp_f32_e32 v14, v13
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v16, v15, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v18, v13, v16
	v_fma_f32 v13, v16, v13, -v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v13, v16, v12
	v_add_f32_e32 v12, v18, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_f32_e32 v17, v15, v12
	v_dual_sub_f32 v15, v15, v17 :: v_dual_sub_f32 v18, v12, v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_sub_f32 v12, v15, v12 :: v_dual_sub_f32 v13, v18, v13
	v_add_f32_e32 v12, v13, v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v12, v17, v12
	v_mul_f32_e32 v12, v14, v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v13, v16, v12
	v_sub_f32_e32 v14, v13, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_mul_f32 v15, v13, v13 :: v_dual_sub_f32 v12, v12, v14
	v_fma_f32 v14, v13, v13, -v15
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v16, v12, v12
	v_fmac_f32_e32 v14, v13, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v16, v15, v14
	v_fmaak_f32 v17, s13, v16, 0x3e91f4c4
	v_sub_f32_e32 v15, v16, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_fmaak_f32 v17, v16, v17, 0x3ecccdef :: v_dual_sub_f32 v14, v14, v15
	v_mul_f32_e32 v18, v16, v17
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v15, v16, v17, -v18
	v_dual_fmac_f32 v15, v14, v17 :: v_dual_mul_f32 v20, v13, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f32_e32 v17, v18, v15
	v_fma_f32 v21, v16, v13, -v20
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_dual_sub_f32 v18, v17, v18 :: v_dual_fmac_f32 v21, v16, v12
	v_add_f32_e32 v19, 0x3f2aaaaa, v17
	v_ldexp_f32 v12, v12, 1
	v_sub_f32_e32 v15, v15, v18
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_fmac_f32_e32 v21, v14, v13
	v_ldexp_f32 v13, v13, 1
	v_add_f32_e32 v15, 0x31739010, v15
	v_add_f32_e32 v18, 0xbf2aaaaa, v19
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_f32_e32 v17, v17, v18
	v_add_f32_e32 v15, v15, v17
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v14, v19, v15
	v_dual_add_f32 v16, v20, v21 :: v_dual_sub_f32 v17, v19, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_mul_f32_e32 v18, v16, v14
	v_sub_f32_e32 v19, v16, v20
	v_add_f32_e32 v15, v15, v17
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f32 v17, v16, v14, -v18
	v_sub_f32_e32 v19, v21, v19
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v17, v16, v15
	v_frexp_exp_i32_f32_e32 v15, v11
	v_fmac_f32_e32 v17, v19, v14
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_subrev_co_ci_u32_e32 v14, vcc_lo, 0, v15, vcc_lo
	v_cmp_eq_f32_e32 vcc_lo, 1.0, v11
	v_add_f32_e32 v15, v18, v17
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cvt_f32_i32_e32 v14, v14
	v_sub_f32_e32 v18, v15, v18
	v_add_f32_e32 v16, v13, v15
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_f32_e32 v17, v17, v18
	v_dual_mul_f32 v19, 0x3f317218, v14 :: v_dual_add_f32 v12, v12, v17
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v18, 0x3f317218, v14, -v19
	v_dual_fmac_f32 v18, 0xb102e308, v14 :: v_dual_sub_f32 v13, v16, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_f32_e32 v13, v15, v13
	v_add_f32_e32 v12, v12, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_add_f32 v14, v16, v12 :: v_dual_add_f32 v13, v19, v18
	v_dual_sub_f32 v16, v14, v16 :: v_dual_add_f32 v15, v13, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_sub_f32 v12, v12, v16 :: v_dual_sub_f32 v17, v15, v13
	v_dual_sub_f32 v14, v14, v17 :: v_dual_sub_f32 v19, v13, v19
	v_sub_f32_e32 v20, v15, v17
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_f32_e32 v18, v18, v19
	v_add_f32_e32 v16, v18, v12
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_f32_e32 v13, v13, v20
	v_dual_add_f32 v13, v14, v13 :: v_dual_sub_f32 v14, v16, v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_f32_e32 v12, v12, v14
	v_add_f32_e32 v13, v16, v13
	v_sub_f32_e32 v16, v16, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_sub_f32 v14, v18, v16 :: v_dual_add_f32 v17, v15, v13
	v_dual_add_f32 v12, v12, v14 :: v_dual_sub_f32 v15, v17, v15
	v_cndmask_b32_e64 v14, 2.0, 1.0, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_f32_e32 v13, v13, v15
	v_add_f32_e32 v12, v12, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v13, v17, v12
	v_sub_f32_e32 v15, v13, v17
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_sub_f32_e32 v12, v12, v15
	v_mul_f32_e32 v16, v14, v13
	v_fma_f32 v13, v14, v13, -v16
	v_cmp_class_f32_e64 vcc_lo, v16, 0x204
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v13, v14, v12
	v_add_f32_e32 v12, v16, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v15, v12, v16, vcc_lo
	v_cmp_eq_f32_e32 vcc_lo, 0x42b17218, v15
	v_cndmask_b32_e64 v17, 0, 0x37000000, vcc_lo
	v_cmp_neq_f32_e64 vcc_lo, 0x7f800000, |v15|
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_f32_e32 v18, v15, v17
	v_trunc_f32_e32 v15, v14
	v_mul_f32_e32 v19, 0x3fb8aa3b, v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f32 v20, 0x3fb8aa3b, v18, -v19
	v_rndne_f32_e32 v21, v19
	v_dual_fmac_f32 v20, 0x32a5705f, v18 :: v_dual_sub_f32 v19, v19, v21
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_add_f32_e32 v19, v19, v20
	v_sub_f32_e32 v12, v12, v16
	v_cvt_i32_f32_e32 v16, v21
	v_exp_f32_e32 v19, v19
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(VALU_DEP_3)
	v_sub_f32_e32 v12, v13, v12
	s_waitcnt_depctr 0xfff
	v_ldexp_f32 v13, v19, v16
	v_cndmask_b32_e32 v12, 0, v12, vcc_lo
	v_cmp_ngt_f32_e32 vcc_lo, 0xc2ce8ed0, v18
	v_dual_mul_f32 v16, 0.5, v14 :: v_dual_cndmask_b32 v13, 0, v13
	v_cmp_nlt_f32_e32 vcc_lo, 0x42b17218, v18
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_trunc_f32_e32 v19, v16
	v_dual_add_f32 v12, v17, v12 :: v_dual_cndmask_b32 v13, 0x7f800000, v13
	v_cmp_eq_f32_e32 vcc_lo, v15, v14
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cmp_neq_f32_e64 s2, v19, v16
	v_fma_f32 v12, v13, v12, v13
	v_cmp_eq_f32_e64 s3, 0x7f800000, v13
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	v_cndmask_b32_e64 v14, 1.0, v11, s2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v12, v12, v13, s3
	v_cmp_eq_f32_e64 s3, 0, v11
	v_bfi_b32 v12, 0x7fffffff, v12, v14
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_cndmask_b32_e64 v13, 0x7f800000, 0, s3
	v_cndmask_b32_e64 v14, 0, v11, s2
	v_cmp_class_f32_e64 s2, v11, 0x204
	v_cndmask_b32_e32 v15, 0x7fc00000, v12, vcc_lo
	v_cmp_gt_f32_e32 vcc_lo, 0, v11
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_bfi_b32 v13, 0x7fffffff, v13, v14
	v_cndmask_b32_e32 v12, v12, v15, vcc_lo
	s_or_b32 vcc_lo, s3, s2
	s_load_b32 s2, s[10:11], 0x0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v12, v12, v13, vcc_lo
	v_cmp_o_f32_e32 vcc_lo, v11, v11
	v_cndmask_b32_e32 v11, 0x7fc00000, v12, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f32 v12, null, v7, v7, -v11
	v_div_scale_f32 v15, vcc_lo, -v11, v7, -v11
	v_rcp_f32_e32 v13, v12
	s_waitcnt_depctr 0xfff
	v_fma_f32 v14, -v12, v13, 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v13, v14, v13
	v_mul_f32_e32 v14, v15, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v16, -v12, v14, v15
	v_fmac_f32_e32 v14, v16, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v12, -v12, v14, v15
	v_div_fmas_f32 v12, v12, v13, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f32 v11, v12, v7, -v11
	v_mul_f32_e32 v12, 0x3fb8aa3b, v11
	v_cmp_ngt_f32_e32 vcc_lo, 0xc2ce8ed0, v11
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f32 v13, 0x3fb8aa3b, v11, -v12
	v_rndne_f32_e32 v14, v12
	v_dual_fmac_f32 v13, 0x32a5705f, v11 :: v_dual_sub_f32 v12, v12, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f32_e32 v12, v12, v13
	v_cvt_i32_f32_e32 v13, v14
	v_exp_f32_e32 v12, v12
	s_waitcnt_depctr 0xfff
	v_ldexp_f32 v12, v12, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v12, 0, v12, vcc_lo
	v_cmp_nlt_f32_e32 vcc_lo, 0x42b17218, v11
	v_cndmask_b32_e32 v11, 0x7f800000, v12, vcc_lo
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v5, s2, v11
	v_mul_f32_e32 v12, s2, v11
	v_fmac_f32_e32 v4, v10, v12
.LBB0_20:                               ; %Flow
                                        ;   in Loop: Header=BB0_17 Depth=2
	s_or_b32 exec_lo, exec_lo, s16
.LBB0_21:                               ;   in Loop: Header=BB0_17 Depth=2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_4) | instid1(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s15
	s_add_u32 s10, s10, 4
	v_add_nc_u32_e32 v9, 1, v9
	s_addc_u32 s11, s11, 0
	s_add_i32 s14, s14, 4
	s_cmp_eq_u32 s14, 0
	s_cbranch_scc0 .LBB0_17
; %bb.22:                               ;   in Loop: Header=BB0_16 Depth=1
	s_add_i32 s12, s12, 1
	v_add_nc_u32_e32 v0, 0x48, v0
	s_add_u32 s4, s4, 12
	s_addc_u32 s5, s5, 0
	s_cmp_eq_u32 s12, 2
	s_cbranch_scc0 .LBB0_16
; %bb.23:
	v_div_scale_f32 v0, null, v5, v5, v4
	v_div_scale_f32 v7, vcc_lo, v4, v5, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f32_e32 v1, v0
	s_waitcnt_depctr 0xfff
	v_fma_f32 v6, -v0, v1, 1.0
	v_fmac_f32_e32 v1, v6, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v6, v7, v1
	v_fma_f32 v8, -v0, v6, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v8, v1
	v_fma_f32 v0, -v0, v6, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f32 v0, v0, v1, v6
	v_div_fixup_f32 v4, v0, v5, v4
	v_add_co_u32 v0, vcc_lo, s6, v2
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v3, vcc_lo
	global_store_b32 v[0:1], v4, off
.LBB0_24:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z21bilateralFilterKernelPKfPfiiff
		.amdhsa_group_segment_fixed_size 1296
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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 2
		.amdhsa_next_free_vgpr 22
		.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	_Z21bilateralFilterKernelPKfPfiiff, .Lfunc_end0-_Z21bilateralFilterKernelPKfPfiiff
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 2268
; NumSgprs: 19
; NumVgprs: 22
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 1296 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 19
; NumVGPRsForWavesPerEU: 22
; 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: 2
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.protected	gaussian                ; @gaussian
	.type	gaussian,@object
	.section	.bss,"aw",@nobits
	.globl	gaussian
	.p2align	4, 0x0
gaussian:
	.zero	36
	.size	gaussian, 36

	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.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 gaussian
	.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:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
      - .offset:         120
        .size:           8
        .value_kind:     hidden_multigrid_sync_arg
    .group_segment_fixed_size: 1296
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z21bilateralFilterKernelPKfPfiiff
    .private_segment_fixed_size: 0
    .sgpr_count:     19
    .sgpr_spill_count: 0
    .symbol:         _Z21bilateralFilterKernelPKfPfiiff.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     22
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
