#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cuda_runtime.h>

// Grid dimensions
#define BLOCK_SIZE 16
#define WIDTH 512
#define HEIGHT 512

// Simulation parameters
#define MAX_ITERATIONS 10000
#define TOLERANCE 1e-6
#define ALPHA 0.25f  // Thermal diffusivity constant

// Boundary conditions
#define TOP_TEMP 100.0f
#define BOTTOM_TEMP 0.0f
#define LEFT_TEMP 0.0f
#define RIGHT_TEMP 0.0f

// Error checking macro
#define CHECK_CUDA_ERROR(call) \
do { \
    cudaError_t err = call; \
    if (err != cudaSuccess) { \
        fprintf(stderr, "CUDA Error: %s at %s:%d\n", \
                cudaGetErrorString(err), __FILE__, __LINE__); \
        exit(EXIT_FAILURE); \
    } \
} while (0)

// CUDA kernel for heat equation using finite difference method
__global__ void heatKernel(float *u, float *u_new, int width, int height, float alpha, float dx, float dy, float dt) {
    int col = blockIdx.x * blockDim.x + threadIdx.x;
    int row = blockIdx.y * blockDim.y + threadIdx.y;
    int idx = row * width + col;
    
    // Skip boundary cells
    if (col > 0 && col < width - 1 && row > 0 && row < height - 1) {
        // 5-point stencil for 2D heat equation
        u_new[idx] = u[idx] + alpha * dt * (
            (u[idx + 1] - 2.0f * u[idx] + u[idx - 1]) / (dx * dx) +  // x-direction
            (u[idx + width] - 2.0f * u[idx] + u[idx - width]) / (dy * dy)  // y-direction
        );
    }
}

// CUDA kernel to set boundary conditions
__global__ void setBoundariesKernel(float *u, int width, int height, 
                                  float top, float bottom, float left, float right) {
    int col = blockIdx.x * blockDim.x + threadIdx.x;
    int row = blockIdx.y * blockDim.y + threadIdx.y;
    
    if (col < width && row < height) {
        // Top boundary
        if (row == 0) {
            u[row * width + col] = top;
        }
        // Bottom boundary
        else if (row == height - 1) {
            u[row * width + col] = bottom;
        }
        // Left boundary
        else if (col == 0) {
            u[row * width + col] = left;
        }
        // Right boundary
        else if (col == width - 1) {
            u[row * width + col] = right;
        }
    }
}

// CUDA kernel to compute maximum difference between two arrays
__global__ void computeMaxDiffKernel(float *u, float *u_new, float *max_diff, int width, int height) {
    int col = blockIdx.x * blockDim.x + threadIdx.x;
    int row = blockIdx.y * blockDim.y + threadIdx.y;
    int idx = row * width + col;
    
    __shared__ float block_max_diff[BLOCK_SIZE * BLOCK_SIZE];
    int thread_idx = threadIdx.y * blockDim.x + threadIdx.x;
    
    float local_diff = 0.0f;
    if (col < width && row < height) {
        local_diff = fabsf(u_new[idx] - u[idx]);
    }
    
    block_max_diff[thread_idx] = local_diff;
    __syncthreads();
    
    // Reduce within block
    for (int stride = blockDim.x * blockDim.y / 2; stride > 0; stride >>= 1) {
        if (thread_idx < stride) {
            block_max_diff[thread_idx] = fmaxf(block_max_diff[thread_idx], block_max_diff[thread_idx + stride]);
        }
        __syncthreads();
    }
    
    // Write result for this block to global memory
    if (thread_idx == 0) {
        atomicMax((int*)max_diff, __float_as_int(block_max_diff[0]));
    }
}

// Function to copy array in the same device
__global__ void copyArrayKernel(float *dst, float *src, int width, int height) {
    int col = blockIdx.x * blockDim.x + threadIdx.x;
    int row = blockIdx.y * blockDim.y + threadIdx.y;
    
    if (col < width && row < height) {
        dst[row * width + col] = src[row * width + col];
    }
}

// Utility function to save solution to a file
void saveToFile(float *h_solution, int width, int height, const char *filename) {
    FILE *fp = fopen(filename, "w");
    if (!fp) {
        fprintf(stderr, "Error: Could not open file %s\n", filename);
        return;
    }
    
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            fprintf(fp, "%f ", h_solution[i * width + j]);
        }
        fprintf(fp, "\n");
    }
    
    fclose(fp);
}

int main() {
    size_t size = WIDTH * HEIGHT * sizeof(float);
    
    // Host arrays
    float *h_solution = (float*)malloc(size);
    float h_max_diff;
    
    // Device arrays
    float *d_u, *d_u_new, *d_max_diff;
    
    // Allocate memory on the device
    CHECK_CUDA_ERROR(cudaMalloc((void**)&d_u, size));
    CHECK_CUDA_ERROR(cudaMalloc((void**)&d_u_new, size));
    CHECK_CUDA_ERROR(cudaMalloc((void**)&d_max_diff, sizeof(float)));
    
    // Initialize arrays on the device
    CHECK_CUDA_ERROR(cudaMemset(d_u, 0, size));  // Initial temperature is 0 everywhere
    CHECK_CUDA_ERROR(cudaMemset(d_u_new, 0, size));
    
    // Grid and block dimensions for kernels
    dim3 blockSize(BLOCK_SIZE, BLOCK_SIZE);
    dim3 gridSize((WIDTH + BLOCK_SIZE - 1) / BLOCK_SIZE, (HEIGHT + BLOCK_SIZE - 1) / BLOCK_SIZE);
    
    // Physical parameters
    float dx = 1.0f / (WIDTH - 1);
    float dy = 1.0f / (HEIGHT - 1);
    float dt = 0.25f * fminf(dx * dx, dy * dy) / ALPHA;  // CFL stability condition
    
    printf("Starting 2D heat transfer simulation...\n");
    printf("Grid size: %d x %d\n", WIDTH, HEIGHT);
    printf("dx = %f, dy = %f, dt = %f\n", dx, dy, dt);
    
    int iter = 0;
    float max_diff = TOLERANCE + 1.0f;  // Ensure we enter the loop
    
    // Main simulation loop
    while (iter < MAX_ITERATIONS && max_diff > TOLERANCE) {
        // Set boundary conditions
        setBoundariesKernel<<<gridSize, blockSize>>>(d_u, WIDTH, HEIGHT, 
                                                   TOP_TEMP, BOTTOM_TEMP, LEFT_TEMP, RIGHT_TEMP);
        
        // Compute new temperature values
        heatKernel<<<gridSize, blockSize>>>(d_u, d_u_new, WIDTH, HEIGHT, ALPHA, dx, dy, dt);
        
        // Initialize max_diff to 0
        CHECK_CUDA_ERROR(cudaMemset(d_max_diff, 0, sizeof(float)));
        
        // Compute maximum difference
        computeMaxDiffKernel<<<gridSize, blockSize>>>(d_u, d_u_new, d_max_diff, WIDTH, HEIGHT);
        
        // Copy max_diff back to host
        CHECK_CUDA_ERROR(cudaMemcpy(&h_max_diff, d_max_diff, sizeof(float), cudaMemcpyDeviceToHost));
        max_diff = h_max_diff;
        
        // Swap pointers
        float *temp = d_u;
        d_u = d_u_new;
        d_u_new = temp;
        
        if (iter % 100 == 0) {
            printf("Iteration %d, max difference = %f\n", iter, max_diff);
        }
        
        iter++;
    }
    
    printf("Simulation completed after %d iterations with max difference %f\n", iter, max_diff);
    
    // Copy final solution back to host
    CHECK_CUDA_ERROR(cudaMemcpy(h_solution, d_u, size, cudaMemcpyDeviceToHost));
    
    // Save solution to file
    saveToFile(h_solution, WIDTH, HEIGHT, "heat_solution.txt");
    printf("Solution saved to heat_solution.txt\n");
    
    // Clean up
    free(h_solution);
    CHECK_CUDA_ERROR(cudaFree(d_u));
    CHECK_CUDA_ERROR(cudaFree(d_u_new));
    CHECK_CUDA_ERROR(cudaFree(d_max_diff));
    
    return 0;
}
	.file	"tmpxft_00047da8_00000000-6_22.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB1983:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE1983:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"w"
.LC1:
	.string	"Error: Could not open file %s\n"
.LC2:
	.string	"%f "
.LC3:
	.string	"\n"
	.text
	.globl	_Z10saveToFilePfiiPKc
	.type	_Z10saveToFilePfiiPKc, @function
_Z10saveToFilePfiiPKc:
.LFB1979:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdi, %rbp
	movq	%rcx, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%esi, %ebx
	leaq	.LC0(%rip), %rsi
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%rcx, 16(%rsp)
	movl	%edx, 12(%rsp)
	call	fopen@PLT
	movq	16(%rsp), %rcx
	testq	%rax, %rax
	je	.L3
	movq	%rax, %r14
	xorl	%r12d, %r12d
	leaq	.LC2(%rip), %r15
	xorl	%r13d, %r13d
	jmp	.L4
.L3:
	movq	stderr(%rip), %rdi
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	leaq	.LC1(%rip), %rdx
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	movl	$1, %esi
	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	__fprintf_chk@PLT
.L10:
	.cfi_restore_state
	leaq	.LC3(%rip), %rdx
	movq	%r14, %rdi
	xorl	%eax, %eax
	incl	%r13d
	movl	$1, %esi
	addl	%ebx, %r12d
	call	__fprintf_chk@PLT
.L4:
	cmpl	12(%rsp), %r13d
	jge	.L6
	movslq	%r12d, %rax
	xorl	%ecx, %ecx
	leaq	0(%rbp,%rax,4), %r8
.L7:
	cmpl	%ecx, %ebx
	jle	.L10
	movq	%r15, %rdx
	movl	$1, %esi
	movq	%r14, %rdi
	movb	$1, %al
	cvtss2sd	(%r8,%rcx,4), %xmm0
	movq	%r8, 24(%rsp)
	movq	%rcx, 16(%rsp)
	call	__fprintf_chk@PLT
	movq	16(%rsp), %rcx
	movq	24(%rsp), %r8
	incq	%rcx
	jmp	.L7
.L6:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	movq	%r14, %rdi
	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
	jmp	fclose@PLT
	.cfi_endproc
.LFE1979:
	.size	_Z10saveToFilePfiiPKc, .-_Z10saveToFilePfiiPKc
	.globl	_Z38__device_stub__Z10heatKernelPfS_iiffffPfS_iiffff
	.type	_Z38__device_stub__Z10heatKernelPfS_iiffffPfS_iiffff, @function
_Z38__device_stub__Z10heatKernelPfS_iiffffPfS_iiffff:
.LFB2005:
	.cfi_startproc
	endbr64
	subq	$200, %rsp
	.cfi_def_cfa_offset 208
	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
	movss	%xmm0, 20(%rsp)
	movss	%xmm1, 16(%rsp)
	movss	%xmm2, 12(%rsp)
	movss	%xmm3, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 184(%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	20(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 176(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L11
	pushq	64(%rsp)
	.cfi_def_cfa_offset 216
	leaq	_Z10heatKernelPfS_iiffff(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 224
	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 216
	popq	%rdx
	.cfi_def_cfa_offset 208
.L11:
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	addq	$200, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2005:
	.size	_Z38__device_stub__Z10heatKernelPfS_iiffffPfS_iiffff, .-_Z38__device_stub__Z10heatKernelPfS_iiffffPfS_iiffff
	.globl	_Z10heatKernelPfS_iiffff
	.type	_Z10heatKernelPfS_iiffff, @function
_Z10heatKernelPfS_iiffff:
.LFB2006:
	.cfi_startproc
	endbr64
	jmp	_Z38__device_stub__Z10heatKernelPfS_iiffffPfS_iiffff
	.cfi_endproc
.LFE2006:
	.size	_Z10heatKernelPfS_iiffff, .-_Z10heatKernelPfS_iiffff
	.globl	_Z45__device_stub__Z19setBoundariesKernelPfiiffffPfiiffff
	.type	_Z45__device_stub__Z19setBoundariesKernelPfiiffffPfiiffff, @function
_Z45__device_stub__Z19setBoundariesKernelPfiiffffPfiiffff:
.LFB2007:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	32(%rsp), %rdx
	movss	%xmm0, 12(%rsp)
	movss	%xmm1, 8(%rsp)
	movss	%xmm2, 4(%rsp)
	movss	%xmm3, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	20(%rsp), %rax
	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, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L16
	pushq	40(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z19setBoundariesKernelPfiiffff(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 192
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L16:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2007:
	.size	_Z45__device_stub__Z19setBoundariesKernelPfiiffffPfiiffff, .-_Z45__device_stub__Z19setBoundariesKernelPfiiffffPfiiffff
	.globl	_Z19setBoundariesKernelPfiiffff
	.type	_Z19setBoundariesKernelPfiiffff, @function
_Z19setBoundariesKernelPfiiffff:
.LFB2008:
	.cfi_startproc
	endbr64
	jmp	_Z45__device_stub__Z19setBoundariesKernelPfiiffffPfiiffff
	.cfi_endproc
.LFE2008:
	.size	_Z19setBoundariesKernelPfiiffff, .-_Z19setBoundariesKernelPfiiffff
	.globl	_Z46__device_stub__Z20computeMaxDiffKernelPfS_S_iiPfS_S_ii
	.type	_Z46__device_stub__Z20computeMaxDiffKernelPfS_S_iiPfS_S_ii, @function
_Z46__device_stub__Z20computeMaxDiffKernelPfS_S_iiPfS_S_ii:
.LFB2009:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L21
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z20computeMaxDiffKernelPfS_S_ii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L21:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2009:
	.size	_Z46__device_stub__Z20computeMaxDiffKernelPfS_S_iiPfS_S_ii, .-_Z46__device_stub__Z20computeMaxDiffKernelPfS_S_iiPfS_S_ii
	.globl	_Z20computeMaxDiffKernelPfS_S_ii
	.type	_Z20computeMaxDiffKernelPfS_S_ii, @function
_Z20computeMaxDiffKernelPfS_S_ii:
.LFB2010:
	.cfi_startproc
	endbr64
	jmp	_Z46__device_stub__Z20computeMaxDiffKernelPfS_S_iiPfS_S_ii
	.cfi_endproc
.LFE2010:
	.size	_Z20computeMaxDiffKernelPfS_S_ii, .-_Z20computeMaxDiffKernelPfS_S_ii
	.section	.rodata.str1.1
.LC4:
	.string	"22.cu"
.LC5:
	.string	"CUDA Error: %s at %s:%d\n"
.LC6:
	.string	"Starting 2D heat transfer simulation...\n"
.LC7:
	.string	"Grid size: %d x %d\n"
.LC10:
	.string	"dx = %f, dy = %f, dt = %f\n"
.LC16:
	.string	"Iteration %d, max difference = %f\n"
.LC18:
	.string	"Simulation completed after %d iterations with max difference %f\n"
.LC19:
	.string	"heat_solution.txt"
.LC20:
	.string	"Solution saved to heat_solution.txt\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB1980:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	$1048576, %edi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	subq	$88, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	leaq	24(%rsp), %rdi
	movl	$1048576, %esi
	movq	%rax, %rbp
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L27
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$145, %r9d
	movq	%rax, %rcx
	jmp	.L50
.L27:
	leaq	32(%rsp), %rdi
	movl	$1048576, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L28
	call	cudaGetErrorString@PLT
	movl	$146, %r9d
	movq	%rax, %rcx
.L50:
	movq	stderr(%rip), %rdi
	leaq	.LC4(%rip), %r8
	leaq	.LC5(%rip), %rdx
	xorl	%eax, %eax
	movl	$1, %esi
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L28:
	leaq	40(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L29
	call	cudaGetErrorString@PLT
	movl	$147, %r9d
	movq	%rax, %rcx
	jmp	.L50
.L29:
	movq	24(%rsp), %rdi
	movl	$1048576, %edx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L30
	call	cudaGetErrorString@PLT
	movl	$150, %r9d
	movq	%rax, %rcx
	jmp	.L50
.L30:
	movq	32(%rsp), %rdi
	movl	$1048576, %edx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L31
	call	cudaGetErrorString@PLT
	movl	$151, %r9d
	movq	%rax, %rcx
	jmp	.L50
.L31:
	leaq	.LC6(%rip), %rsi
	movl	$1, %edi
	xorl	%r12d, %r12d
	movabsq	$68719476752, %rax
	movq	%rax, 48(%rsp)
	movabsq	$137438953504, %rax
	movq	%rax, 60(%rsp)
	xorl	%eax, %eax
	movl	$1, 56(%rsp)
	movl	$1, 68(%rsp)
	call	__printf_chk@PLT
	movl	$512, %ecx
	movl	$512, %edx
	xorl	%eax, %eax
	leaq	.LC7(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movsd	.LC9(%rip), %xmm0
	movl	$1, %edi
	movb	$3, %al
	movsd	.LC8(%rip), %xmm2
	leaq	.LC10(%rip), %rsi
	movaps	%xmm0, %xmm1
	call	__printf_chk@PLT
.L39:
	movl	56(%rsp), %ecx
	movq	48(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	60(%rsp), %rdi
	movl	68(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L32
	xorps	%xmm3, %xmm3
	movq	24(%rsp), %rdi
	movl	$512, %edx
	movss	.LC12(%rip), %xmm0
	movaps	%xmm3, %xmm2
	movaps	%xmm3, %xmm1
	movl	$512, %esi
	call	_Z45__device_stub__Z19setBoundariesKernelPfiiffffPfiiffff
.L32:
	movl	56(%rsp), %ecx
	movq	48(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	60(%rsp), %rdi
	movl	68(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L33
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdi
	movl	$512, %ecx
	movl	$512, %edx
	movss	.LC14(%rip), %xmm2
	movss	.LC13(%rip), %xmm3
	movss	.LC15(%rip), %xmm0
	movaps	%xmm2, %xmm1
	call	_Z38__device_stub__Z10heatKernelPfS_iiffffPfS_iiffff
.L33:
	movq	40(%rsp), %rdi
	movl	$4, %edx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L34
	call	cudaGetErrorString@PLT
	movl	$179, %r9d
	movq	%rax, %rcx
	jmp	.L50
.L34:
	movl	56(%rsp), %ecx
	movq	48(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	60(%rsp), %rdi
	movl	68(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L35
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	$512, %ecx
	movl	$512, %r8d
	movq	24(%rsp), %rdi
	call	_Z46__device_stub__Z20computeMaxDiffKernelPfS_S_iiPfS_S_ii
.L35:
	movq	40(%rsp), %rsi
	leaq	20(%rsp), %rdi
	movl	$2, %ecx
	movl	$4, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L36
	call	cudaGetErrorString@PLT
	movl	$185, %r9d
	movq	%rax, %rcx
	jmp	.L50
.L36:
	movq	24(%rsp), %rax
	movq	32(%rsp), %rdx
	movl	$100, %ecx
	cvtss2sd	20(%rsp), %xmm0
	movq	%rax, 32(%rsp)
	movl	%r12d, %eax
	movq	%rdx, 24(%rsp)
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L37
	movl	%r12d, %edx
	movl	$1, %edi
	movb	$1, %al
	movsd	%xmm0, 8(%rsp)
	leaq	.LC16(%rip), %rsi
	call	__printf_chk@PLT
	movsd	8(%rsp), %xmm0
.L37:
	incl	%r12d
	cmpl	$10000, %r12d
	je	.L38
	comisd	.LC17(%rip), %xmm0
	ja	.L39
.L38:
	movl	%r12d, %edx
	leaq	.LC18(%rip), %rsi
	movl	$1, %edi
	movb	$1, %al
	call	__printf_chk@PLT
	movq	24(%rsp), %rsi
	movq	%rbp, %rdi
	movl	$2, %ecx
	movl	$1048576, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L40
	call	cudaGetErrorString@PLT
	movl	$203, %r9d
	movq	%rax, %rcx
	jmp	.L50
.L40:
	leaq	.LC19(%rip), %rcx
	movl	$512, %edx
	movl	$512, %esi
	movq	%rbp, %rdi
	call	_Z10saveToFilePfiiPKc
	leaq	.LC20(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L41
	call	cudaGetErrorString@PLT
	movl	$211, %r9d
	movq	%rax, %rcx
	jmp	.L50
.L41:
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L42
	call	cudaGetErrorString@PLT
	movl	$212, %r9d
	movq	%rax, %rcx
	jmp	.L50
.L42:
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L43
	call	cudaGetErrorString@PLT
	movl	$213, %r9d
	movq	%rax, %rcx
	jmp	.L50
.L43:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L44
	call	__stack_chk_fail@PLT
.L44:
	addq	$88, %rsp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE1980:
	.size	main, .-main
	.text
	.globl	_Z39__device_stub__Z15copyArrayKernelPfS_iiPfS_ii
	.type	_Z39__device_stub__Z15copyArrayKernelPfS_iiPfS_ii, @function
_Z39__device_stub__Z15copyArrayKernelPfS_iiPfS_ii:
.LFB2011:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L51
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z15copyArrayKernelPfS_ii(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L51:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L53
	call	__stack_chk_fail@PLT
.L53:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2011:
	.size	_Z39__device_stub__Z15copyArrayKernelPfS_iiPfS_ii, .-_Z39__device_stub__Z15copyArrayKernelPfS_iiPfS_ii
	.globl	_Z15copyArrayKernelPfS_ii
	.type	_Z15copyArrayKernelPfS_ii, @function
_Z15copyArrayKernelPfS_ii:
.LFB2012:
	.cfi_startproc
	endbr64
	jmp	_Z39__device_stub__Z15copyArrayKernelPfS_iiPfS_ii
	.cfi_endproc
.LFE2012:
	.size	_Z15copyArrayKernelPfS_ii, .-_Z15copyArrayKernelPfS_ii
	.section	.rodata.str1.1
.LC21:
	.string	"_Z15copyArrayKernelPfS_ii"
.LC22:
	.string	"_Z20computeMaxDiffKernelPfS_S_ii"
.LC23:
	.string	"_Z19setBoundariesKernelPfiiffff"
.LC24:
	.string	"_Z10heatKernelPfS_iiffff"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2014:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -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	.LC21(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbp
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z15copyArrayKernelPfS_ii(%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	%rbp, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC22(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z20computeMaxDiffKernelPfS_S_ii(%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	%rbp, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC23(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z19setBoundariesKernelPfiiffff(%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	%rbp, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC24(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z10heatKernelPfS_iiffff(%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	%rbp
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2014:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC8:
	.long	0
	.long	1053822988
	.align 8
.LC9:
	.long	0
	.long	1063258116
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC12:
	.long	1120403456
	.align 4
.LC13:
	.long	914391136
	.align 4
.LC14:
	.long	989872160
	.align 4
.LC15:
	.long	1048576000
	.section	.rodata.cst8
	.align 8
.LC17:
	.long	-1598689907
	.long	1051772663
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.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 <stdlib.h>
#include <math.h>
#include <hip/hip_runtime.h>

// Grid dimensions
#define BLOCK_SIZE 16
#define WIDTH 512
#define HEIGHT 512

// Simulation parameters
#define MAX_ITERATIONS 10000
#define TOLERANCE 1e-6
#define ALPHA 0.25f  // Thermal diffusivity constant

// Boundary conditions
#define TOP_TEMP 100.0f
#define BOTTOM_TEMP 0.0f
#define LEFT_TEMP 0.0f
#define RIGHT_TEMP 0.0f

// Error checking macro
#define CHECK_HIP_ERROR(call) \
do { \
    hipError_t err = call; \
    if (err != hipSuccess) { \
        fprintf(stderr, "HIP Error: %s at %s:%d\n", \
                hipGetErrorString(err), __FILE__, __LINE__); \
        exit(EXIT_FAILURE); \
    } \
} while (0)

// HIP kernel for heat equation using finite difference method
__global__ void heatKernel(float *u, float *u_new, int width, int height, float alpha, float dx, float dy, float dt) {
    int col = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x;
    int row = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y;
    int idx = row * width + col;
    
    // Skip boundary cells
    if (col > 0 && col < width - 1 && row > 0 && row < height - 1) {
        // 5-point stencil for 2D heat equation
        u_new[idx] = u[idx] + alpha * dt * (
            (u[idx + 1] - 2.0f * u[idx] + u[idx - 1]) / (dx * dx) +  // x-direction
            (u[idx + width] - 2.0f * u[idx] + u[idx - width]) / (dy * dy)  // y-direction
        );
    }
}

// HIP kernel to set boundary conditions
__global__ void setBoundariesKernel(float *u, int width, int height, 
                                  float top, float bottom, float left, float right) {
    int col = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x;
    int row = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y;
    
    if (col < width && row < height) {
        // Top boundary
        if (row == 0) {
            u[row * width + col] = top;
        }
        // Bottom boundary
        else if (row == height - 1) {
            u[row * width + col] = bottom;
        }
        // Left boundary
        else if (col == 0) {
            u[row * width + col] = left;
        }
        // Right boundary
        else if (col == width - 1) {
            u[row * width + col] = right;
        }
    }
}

// HIP kernel to compute maximum difference between two arrays
__global__ void computeMaxDiffKernel(float *u, float *u_new, float *max_diff, int width, int height) {
    int col = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x;
    int row = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y;
    int idx = row * width + col;
    
    __shared__ float block_max_diff[BLOCK_SIZE * BLOCK_SIZE];
    int thread_idx = hipThreadIdx_y * hipBlockDim_x + hipThreadIdx_x;
    
    float local_diff = 0.0f;
    if (col < width && row < height) {
        local_diff = fabsf(u_new[idx] - u[idx]);
    }
    
    block_max_diff[thread_idx] = local_diff;
    __syncthreads();
    
    // Reduce within block
    for (int stride = hipBlockDim_x * hipBlockDim_y / 2; stride > 0; stride >>= 1) {
        if (thread_idx < stride) {
            block_max_diff[thread_idx] = fmaxf(block_max_diff[thread_idx], block_max_diff[thread_idx + stride]);
        }
        __syncthreads();
    }
    
    // Write result for this block to global memory
    if (thread_idx == 0) {
        // Use atomicMax with floats in HIP - using built-in conversion functions
        atomicMax((unsigned int*)max_diff, __float_as_uint(block_max_diff[0]));
    }
}

// Function to copy array in the same device
__global__ void copyArrayKernel(float *dst, float *src, int width, int height) {
    int col = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x;
    int row = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y;
    
    if (col < width && row < height) {
        dst[row * width + col] = src[row * width + col];
    }
}

// Note: Using built-in __float_as_uint and __uint_as_float functions from HIP runtime

// Utility function to save solution to a file
void saveToFile(float *h_solution, int width, int height, const char *filename) {
    FILE *fp = fopen(filename, "w");
    if (!fp) {
        fprintf(stderr, "Error: Could not open file %s\n", filename);
        return;
    }
    
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            fprintf(fp, "%f ", h_solution[i * width + j]);
        }
        fprintf(fp, "\n");
    }
    
    fclose(fp);
}

int main() {
    size_t size = WIDTH * HEIGHT * sizeof(float);
    
    // Host arrays
    float *h_solution = (float*)malloc(size);
    float h_max_diff;
    
    // Device arrays
    float *d_u, *d_u_new, *d_max_diff;
    
    // Allocate memory on the device
    CHECK_HIP_ERROR(hipMalloc((void**)&d_u, size));
    CHECK_HIP_ERROR(hipMalloc((void**)&d_u_new, size));
    CHECK_HIP_ERROR(hipMalloc((void**)&d_max_diff, sizeof(float)));
    
    // Initialize arrays on the device
    CHECK_HIP_ERROR(hipMemset(d_u, 0, size));  // Initial temperature is 0 everywhere
    CHECK_HIP_ERROR(hipMemset(d_u_new, 0, size));
    
    // Grid and block dimensions for kernels
    dim3 blockSize(BLOCK_SIZE, BLOCK_SIZE);
    dim3 gridSize((WIDTH + BLOCK_SIZE - 1) / BLOCK_SIZE, (HEIGHT + BLOCK_SIZE - 1) / BLOCK_SIZE);
    
    // Physical parameters
    float dx = 1.0f / (WIDTH - 1);
    float dy = 1.0f / (HEIGHT - 1);
    float dt = 0.25f * fminf(dx * dx, dy * dy) / ALPHA;  // CFL stability condition
    
    printf("Starting 2D heat transfer simulation...\n");
    printf("Grid size: %d x %d\n", WIDTH, HEIGHT);
    printf("dx = %f, dy = %f, dt = %f\n", dx, dy, dt);
    
    int iter = 0;
    float max_diff = TOLERANCE + 1.0f;  // Ensure we enter the loop
    
    // Main simulation loop
    while (iter < MAX_ITERATIONS && max_diff > TOLERANCE) {
        // Set boundary conditions
        hipLaunchKernelGGL(setBoundariesKernel, gridSize, blockSize, 0, 0, 
                          d_u, WIDTH, HEIGHT, TOP_TEMP, BOTTOM_TEMP, LEFT_TEMP, RIGHT_TEMP);
        
        // Compute new temperature values
        hipLaunchKernelGGL(heatKernel, gridSize, blockSize, 0, 0,
                          d_u, d_u_new, WIDTH, HEIGHT, ALPHA, dx, dy, dt);
        
        // Initialize max_diff to 0
        CHECK_HIP_ERROR(hipMemset(d_max_diff, 0, sizeof(float)));
        
        // Compute maximum difference
        hipLaunchKernelGGL(computeMaxDiffKernel, gridSize, blockSize, 0, 0,
                           d_u, d_u_new, d_max_diff, WIDTH, HEIGHT);
        
        // Copy max_diff back to host
        CHECK_HIP_ERROR(hipMemcpy(&h_max_diff, d_max_diff, sizeof(float), hipMemcpyDeviceToHost));
        max_diff = h_max_diff;
        
        // Swap pointers
        float *temp = d_u;
        d_u = d_u_new;
        d_u_new = temp;
        
        if (iter % 100 == 0) {
            printf("Iteration %d, max difference = %f\n", iter, max_diff);
        }
        
        iter++;
    }
    
    printf("Simulation completed after %d iterations with max difference %f\n", iter, max_diff);
    
    // Copy final solution back to host
    CHECK_HIP_ERROR(hipMemcpy(h_solution, d_u, size, hipMemcpyDeviceToHost));
    
    // Save solution to file
    saveToFile(h_solution, WIDTH, HEIGHT, "heat_solution.txt");
    printf("Solution saved to heat_solution.txt\n");
    
    // Clean up
    free(h_solution);
    CHECK_HIP_ERROR(hipFree(d_u));
    CHECK_HIP_ERROR(hipFree(d_u_new));
    CHECK_HIP_ERROR(hipFree(d_max_diff));
    
    return 0;
}
	.text
	.file	"22.cpp"
	.globl	_Z25__device_stub__heatKernelPfS_iiffff # -- Begin function _Z25__device_stub__heatKernelPfS_iiffff
	.p2align	4, 0x90
	.type	_Z25__device_stub__heatKernelPfS_iiffff,@function
_Z25__device_stub__heatKernelPfS_iiffff: # @_Z25__device_stub__heatKernelPfS_iiffff
	.cfi_startproc
# %bb.0:
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 88(%rsp)
	movq	%rsi, 80(%rsp)
	movl	%edx, 28(%rsp)
	movl	%ecx, 24(%rsp)
	movss	%xmm0, 20(%rsp)
	movss	%xmm1, 16(%rsp)
	movss	%xmm2, 12(%rsp)
	movss	%xmm3, 8(%rsp)
	leaq	88(%rsp), %rax
	movq	%rax, 96(%rsp)
	leaq	80(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	64(%rsp), %rdi
	leaq	48(%rsp), %rsi
	leaq	40(%rsp), %rdx
	leaq	32(%rsp), %rcx
	callq	__hipPopCallConfiguration
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	movq	48(%rsp), %rcx
	movl	56(%rsp), %r8d
	leaq	96(%rsp), %r9
	movl	$_Z10heatKernelPfS_iiffff, %edi
	pushq	32(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	48(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$184, %rsp
	.cfi_adjust_cfa_offset -184
	retq
.Lfunc_end0:
	.size	_Z25__device_stub__heatKernelPfS_iiffff, .Lfunc_end0-_Z25__device_stub__heatKernelPfS_iiffff
	.cfi_endproc
                                        # -- End function
	.globl	_Z34__device_stub__setBoundariesKernelPfiiffff # -- Begin function _Z34__device_stub__setBoundariesKernelPfiiffff
	.p2align	4, 0x90
	.type	_Z34__device_stub__setBoundariesKernelPfiiffff,@function
_Z34__device_stub__setBoundariesKernelPfiiffff: # @_Z34__device_stub__setBoundariesKernelPfiiffff
	.cfi_startproc
# %bb.0:
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 72(%rsp)
	movl	%esi, 20(%rsp)
	movl	%edx, 16(%rsp)
	movss	%xmm0, 12(%rsp)
	movss	%xmm1, 8(%rsp)
	movss	%xmm2, 4(%rsp)
	movss	%xmm3, (%rsp)
	leaq	72(%rsp), %rax
	movq	%rax, 80(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 88(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 96(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	leaq	56(%rsp), %rdi
	leaq	40(%rsp), %rsi
	leaq	32(%rsp), %rdx
	leaq	24(%rsp), %rcx
	callq	__hipPopCallConfiguration
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	movq	40(%rsp), %rcx
	movl	48(%rsp), %r8d
	leaq	80(%rsp), %r9
	movl	$_Z19setBoundariesKernelPfiiffff, %edi
	pushq	24(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	40(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$152, %rsp
	.cfi_adjust_cfa_offset -152
	retq
.Lfunc_end1:
	.size	_Z34__device_stub__setBoundariesKernelPfiiffff, .Lfunc_end1-_Z34__device_stub__setBoundariesKernelPfiiffff
	.cfi_endproc
                                        # -- End function
	.globl	_Z35__device_stub__computeMaxDiffKernelPfS_S_ii # -- Begin function _Z35__device_stub__computeMaxDiffKernelPfS_S_ii
	.p2align	4, 0x90
	.type	_Z35__device_stub__computeMaxDiffKernelPfS_S_ii,@function
_Z35__device_stub__computeMaxDiffKernelPfS_S_ii: # @_Z35__device_stub__computeMaxDiffKernelPfS_S_ii
	.cfi_startproc
# %bb.0:
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 72(%rsp)
	movq	%rsi, 64(%rsp)
	movq	%rdx, 56(%rsp)
	movl	%ecx, 4(%rsp)
	movl	%r8d, (%rsp)
	leaq	72(%rsp), %rax
	movq	%rax, 80(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 88(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 96(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 104(%rsp)
	movq	%rsp, %rax
	movq	%rax, 112(%rsp)
	leaq	40(%rsp), %rdi
	leaq	24(%rsp), %rsi
	leaq	16(%rsp), %rdx
	leaq	8(%rsp), %rcx
	callq	__hipPopCallConfiguration
	movq	40(%rsp), %rsi
	movl	48(%rsp), %edx
	movq	24(%rsp), %rcx
	movl	32(%rsp), %r8d
	leaq	80(%rsp), %r9
	movl	$_Z20computeMaxDiffKernelPfS_S_ii, %edi
	pushq	8(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	24(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$136, %rsp
	.cfi_adjust_cfa_offset -136
	retq
.Lfunc_end2:
	.size	_Z35__device_stub__computeMaxDiffKernelPfS_S_ii, .Lfunc_end2-_Z35__device_stub__computeMaxDiffKernelPfS_S_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__copyArrayKernelPfS_ii # -- Begin function _Z30__device_stub__copyArrayKernelPfS_ii
	.p2align	4, 0x90
	.type	_Z30__device_stub__copyArrayKernelPfS_ii,@function
_Z30__device_stub__copyArrayKernelPfS_ii: # @_Z30__device_stub__copyArrayKernelPfS_ii
	.cfi_startproc
# %bb.0:
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 72(%rsp)
	movq	%rsi, 64(%rsp)
	movl	%edx, 12(%rsp)
	movl	%ecx, 8(%rsp)
	leaq	72(%rsp), %rax
	movq	%rax, 80(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 88(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 96(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	48(%rsp), %rdi
	leaq	32(%rsp), %rsi
	leaq	24(%rsp), %rdx
	leaq	16(%rsp), %rcx
	callq	__hipPopCallConfiguration
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	movq	32(%rsp), %rcx
	movl	40(%rsp), %r8d
	leaq	80(%rsp), %r9
	movl	$_Z15copyArrayKernelPfS_ii, %edi
	pushq	16(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	32(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$136, %rsp
	.cfi_adjust_cfa_offset -136
	retq
.Lfunc_end3:
	.size	_Z30__device_stub__copyArrayKernelPfS_ii, .Lfunc_end3-_Z30__device_stub__copyArrayKernelPfS_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z10saveToFilePfiiPKc           # -- Begin function _Z10saveToFilePfiiPKc
	.p2align	4, 0x90
	.type	_Z10saveToFilePfiiPKc,@function
_Z10saveToFilePfiiPKc:                  # @_Z10saveToFilePfiiPKc
	.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	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rcx, %r12
	movl	%edx, %ebp
	movl	%esi, %ebx
	movq	%rdi, 8(%rsp)                   # 8-byte Spill
	movl	$.L.str, %esi
	movq	%rcx, %rdi
	callq	fopen
	testq	%rax, %rax
	je	.LBB4_8
# %bb.1:                                # %.preheader18
	movq	%rax, %r15
	testl	%ebp, %ebp
	jle	.LBB4_7
# %bb.2:                                # %.preheader.lr.ph
	movl	%ebp, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	%ebx, %r13d
	xorl	%ebp, %ebp
	xorl	%r14d, %r14d
	movl	%ebx, 4(%rsp)                   # 4-byte Spill
	jmp	.LBB4_3
	.p2align	4, 0x90
.LBB4_6:                                # %._crit_edge
                                        #   in Loop: Header=BB4_3 Depth=1
	movl	$10, %edi
	movq	%r15, %rsi
	callq	fputc@PLT
	incq	%r14
	movl	4(%rsp), %ebx                   # 4-byte Reload
	addl	%ebx, %ebp
	cmpq	16(%rsp), %r14                  # 8-byte Folded Reload
	je	.LBB4_7
.LBB4_3:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_5 Depth 2
	testl	%ebx, %ebx
	jle	.LBB4_6
# %bb.4:                                # %.lr.ph
                                        #   in Loop: Header=BB4_3 Depth=1
	movl	%ebp, %eax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	leaq	(%rcx,%rax,4), %r12
	xorl	%ebx, %ebx
	.p2align	4, 0x90
.LBB4_5:                                #   Parent Loop BB4_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%r12,%rbx,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.2, %esi
	movq	%r15, %rdi
	movb	$1, %al
	callq	fprintf
	incq	%rbx
	cmpq	%rbx, %r13
	jne	.LBB4_5
	jmp	.LBB4_6
.LBB4_7:                                # %._crit_edge21
	movq	%r15, %rdi
	addq	$24, %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	fclose                          # TAILCALL
.LBB4_8:
	.cfi_def_cfa_offset 80
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movq	%r12, %rdx
	xorl	%eax, %eax
	addq	$24, %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	fprintf                         # TAILCALL
.Lfunc_end4:
	.size	_Z10saveToFilePfiiPKc, .Lfunc_end4-_Z10saveToFilePfiiPKc
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI5_0:
	.quad	0x3f60080400000000              # double 0.0019569471478462219
.LCPI5_1:
	.quad	0x3ed0100c00000000              # double 3.8296420825645328E-6
.LCPI5_2:
	.quad	0x3eb0c6f7a0b5ed8d              # double 9.9999999999999995E-7
	.text
	.globl	main
	.p2align	4, 0x90
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$200, %rsp
	.cfi_def_cfa_offset 256
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$1048576, %edi                  # imm = 0x100000
	callq	malloc
	movq	%rax, %rbx
	leaq	8(%rsp), %rdi
	movl	$1048576, %esi                  # imm = 0x100000
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB5_1
# %bb.3:
	leaq	24(%rsp), %rdi
	movl	$1048576, %esi                  # imm = 0x100000
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB5_4
# %bb.5:
	leaq	88(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB5_6
# %bb.7:
	movq	8(%rsp), %rdi
	movl	$1048576, %edx                  # imm = 0x100000
	xorl	%esi, %esi
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB5_8
# %bb.9:
	movq	%rbx, 192(%rsp)                 # 8-byte Spill
	movq	24(%rsp), %rdi
	xorl	%r14d, %r14d
	movl	$1048576, %edx                  # imm = 0x100000
	xorl	%esi, %esi
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB5_10
# %bb.11:
	movabsq	$137438953504, %r15             # imm = 0x2000000020
	movabsq	$68719476752, %r12              # imm = 0x1000000010
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	$.L.str.7, %edi
	movl	$512, %esi                      # imm = 0x200
	movl	$512, %edx                      # imm = 0x200
	xorl	%eax, %eax
	callq	printf
	movsd	.LCPI5_0(%rip), %xmm0           # xmm0 = mem[0],zero
	movsd	.LCPI5_1(%rip), %xmm2           # xmm2 = mem[0],zero
	movl	$.L.str.8, %edi
	movaps	%xmm0, %xmm1
	movb	$3, %al
	callq	printf
	leaq	104(%rsp), %rbp
	leaq	96(%rsp), %rbx
	leaq	128(%rsp), %r13
	.p2align	4, 0x90
.LBB5_12:                               # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_14
# %bb.13:                               #   in Loop: Header=BB5_12 Depth=1
	movq	8(%rsp), %rax
	movq	%rax, 80(%rsp)
	movl	$512, 40(%rsp)                  # imm = 0x200
	movl	$512, 32(%rsp)                  # imm = 0x200
	movl	$1120403456, 4(%rsp)            # imm = 0x42C80000
	movl	$0, (%rsp)
	movl	$0, 20(%rsp)
	movl	$0, 16(%rsp)
	leaq	80(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	%rsp, %rax
	movq	%rax, 160(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	64(%rsp), %rdi
	leaq	48(%rsp), %rsi
	movq	%rbp, %rdx
	movq	%rbx, %rcx
	callq	__hipPopCallConfiguration
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	movq	48(%rsp), %rcx
	movl	56(%rsp), %r8d
	movl	$_Z19setBoundariesKernelPfiiffff, %edi
	movq	%r13, %r9
	pushq	96(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	112(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB5_14:                               #   in Loop: Header=BB5_12 Depth=1
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_16
# %bb.15:                               #   in Loop: Header=BB5_12 Depth=1
	movq	8(%rsp), %rax
	movq	24(%rsp), %rcx
	movq	%rax, 80(%rsp)
	movq	%rcx, 104(%rsp)
	movl	$512, 32(%rsp)                  # imm = 0x200
	movl	$512, 4(%rsp)                   # imm = 0x200
	movl	$1048576000, (%rsp)             # imm = 0x3E800000
	movl	$989872160, 20(%rsp)            # imm = 0x3B004020
	movl	$989872160, 16(%rsp)            # imm = 0x3B004020
	movl	$914391136, 116(%rsp)           # imm = 0x36808060
	leaq	80(%rsp), %rax
	movq	%rax, 128(%rsp)
	movq	%rbp, 136(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	%rsp, %rax
	movq	%rax, 160(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	116(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	64(%rsp), %rdi
	leaq	48(%rsp), %rsi
	movq	%rbx, %rdx
	leaq	40(%rsp), %rcx
	callq	__hipPopCallConfiguration
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	movq	48(%rsp), %rcx
	movl	56(%rsp), %r8d
	movl	$_Z10heatKernelPfS_iiffff, %edi
	movq	%r13, %r9
	pushq	40(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	104(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB5_16:                               #   in Loop: Header=BB5_12 Depth=1
	movq	88(%rsp), %rdi
	movl	$4, %edx
	xorl	%esi, %esi
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB5_17
# %bb.18:                               #   in Loop: Header=BB5_12 Depth=1
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_20
# %bb.19:                               #   in Loop: Header=BB5_12 Depth=1
	movq	8(%rsp), %rax
	movq	24(%rsp), %rcx
	movq	88(%rsp), %rdx
	movq	%rax, 80(%rsp)
	movq	%rcx, 104(%rsp)
	movq	%rdx, 96(%rsp)
	movl	$512, 4(%rsp)                   # imm = 0x200
	movl	$512, (%rsp)                    # imm = 0x200
	leaq	80(%rsp), %rax
	movq	%rax, 128(%rsp)
	movq	%rbp, 136(%rsp)
	movq	%rbx, 144(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	%rsp, %rax
	movq	%rax, 160(%rsp)
	leaq	64(%rsp), %rdi
	leaq	48(%rsp), %rsi
	leaq	40(%rsp), %rdx
	leaq	32(%rsp), %rcx
	callq	__hipPopCallConfiguration
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	movq	48(%rsp), %rcx
	movl	56(%rsp), %r8d
	movl	$_Z20computeMaxDiffKernelPfS_S_ii, %edi
	movq	%r13, %r9
	pushq	32(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	48(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB5_20:                               #   in Loop: Header=BB5_12 Depth=1
	movq	88(%rsp), %rsi
	movl	$4, %edx
	leaq	112(%rsp), %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB5_21
# %bb.22:                               #   in Loop: Header=BB5_12 Depth=1
	movl	%r14d, %eax
	imulq	$1374389535, %rax, %rax         # imm = 0x51EB851F
	shrq	$37, %rax
	imull	$100, %eax, %eax
	movss	112(%rsp), %xmm0                # xmm0 = mem[0],zero,zero,zero
	movq	8(%rsp), %rcx
	movq	24(%rsp), %rdx
	movq	%rdx, 8(%rsp)
	movq	%rcx, 24(%rsp)
	cvtss2sd	%xmm0, %xmm0
	cmpl	%r14d, %eax
	jne	.LBB5_24
# %bb.23:                               #   in Loop: Header=BB5_12 Depth=1
	movl	$.L.str.9, %edi
	movl	%r14d, %esi
	movsd	%xmm0, 120(%rsp)                # 8-byte Spill
	movsd	120(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movsd	120(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
.LBB5_24:                               #   in Loop: Header=BB5_12 Depth=1
	leal	1(%r14), %esi
	cmpl	$9998, %r14d                    # imm = 0x270E
	ja	.LBB5_26
# %bb.25:                               #   in Loop: Header=BB5_12 Depth=1
	ucomisd	.LCPI5_2(%rip), %xmm0
	movl	%esi, %r14d
	ja	.LBB5_12
.LBB5_26:
	movl	$.L.str.10, %edi
	movb	$1, %al
	callq	printf
	movq	8(%rsp), %rsi
	movl	$1048576, %edx                  # imm = 0x100000
	movq	192(%rsp), %r13                 # 8-byte Reload
	movq	%r13, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB5_27
# %bb.28:
	movl	$.L.str.11, %edi
	movl	$.L.str, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB5_34
# %bb.29:                               # %.preheader.i.preheader
	movq	%rax, %rbx
	xorl	%r14d, %r14d
	movq	%r13, %r15
	.p2align	4, 0x90
.LBB5_30:                               # %.preheader.i
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_31 Depth 2
	xorl	%r12d, %r12d
	.p2align	4, 0x90
.LBB5_31:                               #   Parent Loop BB5_30 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%r15,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	movb	$1, %al
	callq	fprintf
	incq	%r12
	cmpq	$512, %r12                      # imm = 0x200
	jne	.LBB5_31
# %bb.32:                               # %._crit_edge.i
                                        #   in Loop: Header=BB5_30 Depth=1
	movl	$10, %edi
	movq	%rbx, %rsi
	callq	fputc@PLT
	incq	%r14
	addq	$2048, %r15                     # imm = 0x800
	cmpq	$512, %r14                      # imm = 0x200
	jne	.LBB5_30
# %bb.33:                               # %._crit_edge21.i
	movq	%rbx, %rdi
	callq	fclose
.LBB5_35:                               # %_Z10saveToFilePfiiPKc.exit
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movq	%r13, %rdi
	callq	free
	movq	8(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB5_36
# %bb.37:
	movq	24(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB5_38
# %bb.39:
	movq	88(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB5_40
# %bb.41:
	xorl	%eax, %eax
	addq	$200, %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
.LBB5_34:
	.cfi_def_cfa_offset 256
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.11, %edx
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB5_35
.LBB5_21:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$190, %r8d
	jmp	.LBB5_2
.LBB5_17:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$183, %r8d
.LBB5_2:
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.LBB5_1:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$148, %r8d
	jmp	.LBB5_2
.LBB5_4:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$149, %r8d
	jmp	.LBB5_2
.LBB5_6:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$150, %r8d
	jmp	.LBB5_2
.LBB5_8:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$153, %r8d
	jmp	.LBB5_2
.LBB5_10:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$154, %r8d
	jmp	.LBB5_2
.LBB5_27:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$208, %r8d
	jmp	.LBB5_2
.LBB5_36:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$216, %r8d
	jmp	.LBB5_2
.LBB5_38:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$217, %r8d
	jmp	.LBB5_2
.LBB5_40:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$218, %r8d
	jmp	.LBB5_2
.Lfunc_end5:
	.size	main, .Lfunc_end5-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
	cmpq	$0, __hip_gpubin_handle(%rip)
	jne	.LBB6_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB6_2:
	movq	__hip_gpubin_handle(%rip), %rbx
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10heatKernelPfS_iiffff, %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	$_Z19setBoundariesKernelPfiiffff, %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	$_Z20computeMaxDiffKernelPfS_S_ii, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z15copyArrayKernelPfS_ii, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %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_end6:
	.size	__hip_module_ctor, .Lfunc_end6-__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	.LBB7_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
.LBB7_2:
	retq
.Lfunc_end7:
	.size	__hip_module_dtor, .Lfunc_end7-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z10heatKernelPfS_iiffff,@object # @_Z10heatKernelPfS_iiffff
	.section	.rodata,"a",@progbits
	.globl	_Z10heatKernelPfS_iiffff
	.p2align	3, 0x0
_Z10heatKernelPfS_iiffff:
	.quad	_Z25__device_stub__heatKernelPfS_iiffff
	.size	_Z10heatKernelPfS_iiffff, 8

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

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

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"w"
	.size	.L.str, 2

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Error: Could not open file %s\n"
	.size	.L.str.1, 31

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"%f "
	.size	.L.str.2, 4

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"HIP Error: %s at %s:%d\n"
	.size	.L.str.4, 24

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"22.cpp"
	.size	.L.str.5, 7

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Grid size: %d x %d\n"
	.size	.L.str.7, 20

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"dx = %f, dy = %f, dt = %f\n"
	.size	.L.str.8, 27

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Iteration %d, max difference = %f\n"
	.size	.L.str.9, 35

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Simulation completed after %d iterations with max difference %f\n"
	.size	.L.str.10, 65

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"heat_solution.txt"
	.size	.L.str.11, 18

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z10heatKernelPfS_iiffff"
	.size	.L__unnamed_1, 25

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z19setBoundariesKernelPfiiffff"
	.size	.L__unnamed_2, 32

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z20computeMaxDiffKernelPfS_S_ii"
	.size	.L__unnamed_3, 33

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z15copyArrayKernelPfS_ii"
	.size	.L__unnamed_4, 26

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

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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"Starting 2D heat transfer simulation..."
	.size	.Lstr, 40

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Solution saved to heat_solution.txt"
	.size	.Lstr.1, 36

	.section	".linker-options","e",@llvm_linker_options
	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z25__device_stub__heatKernelPfS_iiffff
	.addrsig_sym _Z34__device_stub__setBoundariesKernelPfiiffff
	.addrsig_sym _Z35__device_stub__computeMaxDiffKernelPfS_S_ii
	.addrsig_sym _Z30__device_stub__copyArrayKernelPfS_ii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z10heatKernelPfS_iiffff
	.addrsig_sym _Z19setBoundariesKernelPfiiffff
	.addrsig_sym _Z20computeMaxDiffKernelPfS_S_ii
	.addrsig_sym _Z15copyArrayKernelPfS_ii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z10heatKernelPfS_iiffff ; -- Begin function _Z10heatKernelPfS_iiffff
	.globl	_Z10heatKernelPfS_iiffff
	.p2align	8
	.type	_Z10heatKernelPfS_iiffff,@function
_Z10heatKernelPfS_iiffff:               ; @_Z10heatKernelPfS_iiffff
; %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_and_b32 s3, s2, 0xffff
	s_lshr_b32 s2, s2, 16
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[0:1], null, s14, s3, v[2:3]
	v_mad_u64_u32 v[1:2], null, s15, s2, v[3:4]
	s_add_i32 s2, s8, -1
	s_add_i32 s3, s9, -1
	v_cmp_gt_i32_e32 vcc_lo, s2, v0
	v_cmp_lt_i32_e64 s4, 0, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e64 s2, s3, v1
	v_cmp_lt_i32_e64 s3, 0, v1
	s_and_b32 s2, vcc_lo, s2
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, s2, s3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, s4, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB0_2
; %bb.1:
	v_mad_u64_u32 v[2:3], null, v1, s8, v[0:1]
	s_load_b128 s[4:7], s[0:1], 0x0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v0, s8, v2
	v_ashrrev_i32_e32 v3, 31, v2
	v_subrev_nc_u32_e32 v4, s8, v2
	s_load_b128 s[8:11], s[0:1], 0x18
	v_ashrrev_i32_e32 v1, 31, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_ashrrev_i32_e32 v5, 31, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	v_lshlrev_b64 v[4:5], 2, v[4:5]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_add_co_u32 v6, vcc_lo, s4, v2
	v_add_co_ci_u32_e32 v7, vcc_lo, s5, v3, vcc_lo
	v_add_co_u32 v0, vcc_lo, s4, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	v_add_co_u32 v4, vcc_lo, s4, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v5, vcc_lo
	s_clause 0x3
	global_load_b64 v[8:9], v[6:7], off
	global_load_b32 v0, v[0:1], off
	global_load_b32 v1, v[4:5], off
	global_load_b32 v4, v[6:7], off offset:-4
	v_mul_f32_e64 v5, s9, s9
	v_mul_f32_e64 v6, s10, s10
	s_waitcnt vmcnt(3)
	v_fmac_f32_e32 v9, -2.0, v8
	s_waitcnt vmcnt(2)
	v_fmac_f32_e32 v0, -2.0, v8
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f32_e32 v4, v9, v4
	v_add_f32_e32 v0, v0, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_div_scale_f32 v1, null, v5, v5, v4
	v_div_scale_f32 v7, null, v6, v6, v0
	v_div_scale_f32 v13, vcc_lo, v4, v5, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_rcp_f32_e32 v9, v1
	v_rcp_f32_e32 v10, v7
	s_waitcnt_depctr 0xfff
	v_fma_f32 v11, -v1, v9, 1.0
	v_fma_f32 v12, -v7, v10, 1.0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_fmac_f32_e32 v9, v11, v9
	v_div_scale_f32 v11, s0, v0, v6, v0
	v_fmac_f32_e32 v10, v12, v10
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f32_e32 v12, v13, v9
	v_mul_f32_e32 v14, v11, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v15, -v1, v12, v13
	v_fma_f32 v16, -v7, v14, v11
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v12, v15, v9
	v_fmac_f32_e32 v14, v16, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v1, -v1, v12, v13
	v_fma_f32 v7, -v7, v14, v11
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_fmas_f32 v1, v1, v9, v12
	s_mov_b32 vcc_lo, s0
	v_div_fmas_f32 v7, v7, v10, v14
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_div_fixup_f32 v1, v1, v5, v4
	v_mul_f32_e64 v4, s8, s11
	v_div_fixup_f32 v0, v7, v6, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v0, v1, v0
	v_fma_f32 v4, v4, v0, v8
	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_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10heatKernelPfS_iiffff
		.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 17
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z10heatKernelPfS_iiffff, .Lfunc_end0-_Z10heatKernelPfS_iiffff
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 592
; NumSgprs: 18
; NumVgprs: 17
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 17
; 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	_Z19setBoundariesKernelPfiiffff ; -- Begin function _Z19setBoundariesKernelPfiiffff
	.globl	_Z19setBoundariesKernelPfiiffff
	.p2align	8
	.type	_Z19setBoundariesKernelPfiiffff,@function
_Z19setBoundariesKernelPfiiffff:        ; @_Z19setBoundariesKernelPfiiffff
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b64 s[4:5], s[0:1], 0x8
	v_and_b32_e32 v2, 0x3ff, v0
	v_bfe_u32 v3, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s3, s2, 0xffff
	s_lshr_b32 s2, s2, 16
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[0:1], null, s14, s3, v[2:3]
	v_mad_u64_u32 v[1:2], null, s15, s2, v[3:4]
	v_cmp_gt_i32_e32 vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_gt_i32_e64 s2, s5, v1
	s_and_b32 s2, vcc_lo, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB1_15
; %bb.1:
	s_load_b32 s2, s[0:1], 0x10
	s_mov_b32 s6, 0
	s_mov_b32 s3, -1
	s_waitcnt lgkmcnt(0)
	v_mov_b32_e32 v3, s2
	s_mov_b32 s2, exec_lo
	v_cmpx_ne_u32_e32 0, v1
	s_cbranch_execz .LBB1_13
; %bb.2:
	s_add_i32 s3, s5, -1
                                        ; implicit-def: $vgpr3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_ne_u32_e32 vcc_lo, s3, v1
	s_and_saveexec_b32 s3, vcc_lo
	s_xor_b32 s3, exec_lo, s3
	s_cbranch_execz .LBB1_10
; %bb.3:
	s_mov_b32 s5, 0
	s_mov_b32 s7, exec_lo
                                        ; implicit-def: $sgpr6
	v_cmpx_ne_u32_e32 0, v0
	s_xor_b32 s7, exec_lo, s7
	s_cbranch_execz .LBB1_7
; %bb.4:
	s_add_i32 s5, s4, -1
                                        ; implicit-def: $sgpr6
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_cmp_eq_u32_e32 vcc_lo, s5, v0
	s_mov_b32 s5, 0
	s_and_saveexec_b32 s8, vcc_lo
	s_xor_b32 s8, exec_lo, s8
	s_cbranch_execz .LBB1_6
; %bb.5:
	s_load_b32 s6, s[0:1], 0x1c
	v_mad_u64_u32 v[2:3], null, v1, s4, v[0:1]
	s_mov_b32 s5, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_mov_b32_e32 v0, v2
.LBB1_6:                                ; %Flow54
	s_or_b32 exec_lo, exec_lo, s8
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 s5, s5, exec_lo
                                        ; implicit-def: $vgpr1_vgpr2
.LBB1_7:                                ; %Flow53
	s_or_saveexec_b32 s7, s7
	s_waitcnt lgkmcnt(0)
	v_mov_b32_e32 v3, s6
	s_xor_b32 exec_lo, exec_lo, s7
	s_cbranch_execz .LBB1_9
; %bb.8:
	s_load_b32 s6, s[0:1], 0x18
	v_mul_lo_u32 v0, v1, s4
	s_or_b32 s5, s5, exec_lo
	s_waitcnt lgkmcnt(0)
	v_mov_b32_e32 v3, s6
.LBB1_9:                                ; %Flow55
	s_or_b32 exec_lo, exec_lo, s7
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 s6, s5, exec_lo
                                        ; implicit-def: $vgpr1_vgpr2
.LBB1_10:                               ; %Flow52
	s_and_not1_saveexec_b32 s3, s3
	s_cbranch_execz .LBB1_12
; %bb.11:
	s_load_b32 s5, s[0:1], 0x14
	v_mad_u64_u32 v[2:3], null, v1, s4, v[0:1]
	s_or_b32 s6, s6, exec_lo
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_dual_mov_b32 v0, v2 :: v_dual_mov_b32 v3, s5
.LBB1_12:                               ; %Flow56
	s_or_b32 exec_lo, exec_lo, s3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_not1_b32 s3, s6, exec_lo
.LBB1_13:                               ; %Flow
	s_or_b32 exec_lo, exec_lo, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 exec_lo, exec_lo, s3
	s_cbranch_execz .LBB1_15
; %bb.14:                               ; %.sink.split
	s_load_b64 s[0:1], s[0:1], 0x0
	v_ashrrev_i32_e32 v1, 31, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v3, off
.LBB1_15:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z19setBoundariesKernelPfiiffff
		.amdhsa_group_segment_fixed_size 0
		.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 1
		.amdhsa_next_free_vgpr 5
		.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	_Z19setBoundariesKernelPfiiffff, .Lfunc_end1-_Z19setBoundariesKernelPfiiffff
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 448
; NumSgprs: 18
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 5
; 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	_Z20computeMaxDiffKernelPfS_S_ii ; -- Begin function _Z20computeMaxDiffKernelPfS_S_ii
	.globl	_Z20computeMaxDiffKernelPfS_S_ii
	.p2align	8
	.type	_Z20computeMaxDiffKernelPfS_S_ii,@function
_Z20computeMaxDiffKernelPfS_S_ii:       ; @_Z20computeMaxDiffKernelPfS_S_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b64 s[4:5], s[0:1], 0x18
	v_and_b32_e32 v1, 0x3ff, v0
	v_bfe_u32 v0, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s3, s2, 0xffff
	s_lshr_b32 s6, s2, 16
	v_mad_u64_u32 v[2:3], null, s14, s3, v[1:2]
	v_mad_u64_u32 v[3:4], null, s15, s6, v[0:1]
	v_mov_b32_e32 v4, 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cmp_gt_i32_e32 vcc_lo, s4, v2
	v_cmp_gt_i32_e64 s2, s5, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s5, vcc_lo, s2
	s_and_saveexec_b32 s2, s5
	s_cbranch_execz .LBB2_2
; %bb.1:
	s_load_b128 s[8:11], s[0:1], 0x0
	v_mad_u64_u32 v[4:5], null, v3, s4, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v5, 31, v4
	v_lshlrev_b64 v[2:3], 2, v[4:5]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v4, vcc_lo, s10, v2
	v_add_co_ci_u32_e32 v5, vcc_lo, s11, v3, vcc_lo
	v_add_co_u32 v2, vcc_lo, s8, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s9, v3, vcc_lo
	global_load_b32 v4, v[4:5], off
	global_load_b32 v2, v[2:3], off
	s_waitcnt vmcnt(0)
	v_sub_f32_e32 v2, v4, v2
	s_delay_alu instid0(VALU_DEP_1)
	v_and_b32_e32 v4, 0x7fffffff, v2
.LBB2_2:
	s_or_b32 exec_lo, exec_lo, s2
	v_mad_u32_u24 v0, v0, s3, v1
	s_mul_i32 s2, s6, s3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_cmp_lt_u32 s2, 2
	v_lshlrev_b32_e32 v1, 2, v0
	ds_store_b32 v1, v4
	s_waitcnt lgkmcnt(0)
	s_barrier
	s_branch .LBB2_4
	.p2align	6
.LBB2_3:                                ;   in Loop: Header=BB2_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s4
	s_waitcnt lgkmcnt(0)
	s_barrier
	s_cmp_lt_u32 s2, 4
	s_mov_b32 s2, s3
.LBB2_4:                                ; =>This Inner Loop Header: Depth=1
	buffer_gl0_inv
	s_cbranch_scc1 .LBB2_7
; %bb.5:                                ; %.lr.ph
                                        ;   in Loop: Header=BB2_4 Depth=1
	s_lshr_b32 s3, s2, 1
	s_mov_b32 s4, exec_lo
	v_cmpx_gt_u32_e64 s3, v0
	s_cbranch_execz .LBB2_3
; %bb.6:                                ;   in Loop: Header=BB2_4 Depth=1
	v_add_lshl_u32 v2, s3, v0, 2
	ds_load_b32 v2, v2
	ds_load_b32 v3, v1
	s_waitcnt lgkmcnt(0)
	v_dual_max_f32 v2, v2, v2 :: v_dual_max_f32 v3, v3, v3
	s_delay_alu instid0(VALU_DEP_1)
	v_max_f32_e32 v2, v3, v2
	ds_store_b32 v1, v2
	s_branch .LBB2_3
.LBB2_7:                                ; %._crit_edge
	s_mov_b32 s2, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB2_10
; %bb.8:
	v_mbcnt_lo_u32_b32 v0, exec_lo, 0
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_eq_u32_e32 vcc_lo, 0, v0
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB2_10
; %bb.9:
	v_mov_b32_e32 v0, 0
	s_load_b64 s[0:1], s[0:1], 0x10
	ds_load_b32 v1, v0
	s_waitcnt lgkmcnt(0)
	global_atomic_max_u32 v0, v1, s[0:1]
.LBB2_10:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z20computeMaxDiffKernelPfS_S_ii
		.amdhsa_group_segment_fixed_size 1024
		.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 1
		.amdhsa_next_free_vgpr 6
		.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	_Z20computeMaxDiffKernelPfS_S_ii, .Lfunc_end2-_Z20computeMaxDiffKernelPfS_S_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 440
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 1024 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 6
; 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	_Z15copyArrayKernelPfS_ii ; -- Begin function _Z15copyArrayKernelPfS_ii
	.globl	_Z15copyArrayKernelPfS_ii
	.p2align	8
	.type	_Z15copyArrayKernelPfS_ii,@function
_Z15copyArrayKernelPfS_ii:              ; @_Z15copyArrayKernelPfS_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b64 s[4:5], s[0:1], 0x10
	v_and_b32_e32 v2, 0x3ff, v0
	v_bfe_u32 v3, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s3, s2, 0xffff
	s_lshr_b32 s2, s2, 16
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[0:1], null, s14, s3, v[2:3]
	v_mad_u64_u32 v[1:2], null, s15, s2, v[3:4]
	v_cmp_gt_i32_e32 vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_gt_i32_e64 s2, s5, v1
	s_and_b32 s2, vcc_lo, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB3_2
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_mad_u64_u32 v[2:3], null, v1, s4, v[0:1]
	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 v2, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v3, vcc_lo, s3, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b32 v2, v[2:3], off
	s_waitcnt vmcnt(0)
	global_store_b32 v[0:1], v2, off
.LBB3_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15copyArrayKernelPfS_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 5
		.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_end3:
	.size	_Z15copyArrayKernelPfS_ii, .Lfunc_end3-_Z15copyArrayKernelPfS_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 200
; NumSgprs: 18
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 5
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         36
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     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:           _Z10heatKernelPfS_iiffff
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z10heatKernelPfS_iiffff.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     17
    .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
      - .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
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z19setBoundariesKernelPfiiffff
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z19setBoundariesKernelPfiiffff.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .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
      - .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
    .group_segment_fixed_size: 1024
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z20computeMaxDiffKernelPfS_S_ii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z20computeMaxDiffKernelPfS_S_ii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .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
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15copyArrayKernelPfS_ii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z15copyArrayKernelPfS_ii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
