#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <iomanip>
void  printGrid(float* grid, int rows, int cols);
/**
 *Kernel will update the matrix to keep the heater cells constant.
 */
__global__ void copyHeaters(float* stateGrid, float* heaterGrid, int nRows, int nCols, int iteration) {
    dim3 gIdx;
    gIdx.y = blockIdx.y * blockDim.y + threadIdx.y; //row
    gIdx.x = blockIdx.x * blockDim.x + threadIdx.x; // col
    int i = gIdx.y;
    int j = gIdx.x;
   
    if(gIdx.x < nCols && gIdx.y < nRows){
            float heatValue = heaterGrid[i*nCols +j];
            if(heatValue != 0)
                stateGrid[i*nCols + j] =heatValue;
    }
}

__global__ void updateGrid(float* inGrid, float* outGrid, float k, int nRows, int nCols) {
    dim3 gIdx;
    gIdx.y = blockIdx.y * blockDim.y + threadIdx.y; //row
    gIdx.x = blockIdx.x * blockDim.x + threadIdx.x; // col
    int i = gIdx.y;
    int j = gIdx.x;

    //Find these values from the inGrid
    int Tlft, Trite, Tup, Tdown;
    if(gIdx.x < nCols && gIdx.y < nRows){
           int currentPosition = i*nCols+j;
           Tlft = currentPosition -1;
           Trite = currentPosition +1;
           Tup = currentPosition -nCols;
           Tdown = currentPosition +nCols;
           float Tnew = inGrid[currentPosition];
           float Top, Tbottom, Tleft, Tright;
           Tbottom = (Tdown >= nCols*nRows) ? Tnew : inGrid[Tdown];
           Top = (Tup < 0) ? Tnew : inGrid[Tup];
           Tright = (Trite >= nCols*nRows) ?  Tnew : inGrid[Trite];
           Tleft = (Tlft < 0) ? Tnew : inGrid[Tlft]; 
           
           Tnew = Tnew + k*(Top + Tbottom + Tleft + Tright - (4*Tnew));

           outGrid[currentPosition] = Tnew;
   }
}

/*------------------------------------------------------------------------------
readHeaterFile

Assumes heaterGrid points to a flattened 2d array of size [rows,cols]
Fille heaterGrid with heaters from the heater file
------------------------------------------------------------------------------*/
void readHeaterFile(const char* fileName, float* heaterGrid, int rows, int cols) {
    std::ifstream inFile(fileName); 

    int numHeaters;
    inFile >> numHeaters;

    for(int i = 0; i < numHeaters; ++i) {
        int hRow, hCol;
        inFile >> hRow;
        inFile >> hCol;
        
        float temp;
        inFile >> temp; 

        heaterGrid[hRow * cols + hCol] = temp;
    }

    inFile.close();
}


/*------------------------------------------------------------------------------
printGrid
------------------------------------------------------------------------------*/
__device__ void printGrid(float* grid, int rows, int cols) {
    //std::cout << std::fixed << std::setprecision(2);
    for(int i = 0; i < rows; ++i) {
        for(int j = 0; j < cols; ++j) {
     //       std::cout << std::setw(6) << grid[i*cols+j] << " ";
            printf("%f ", grid[i*cols+j]);
        }
        //std::cout << std::endl;
        printf("\n");
    }
}

/*------------------------------------------------------------------------------
printGridToFile
------------------------------------------------------------------------------*/
void printGridToFile(float* grid, int rows, int cols, char* fileName) {
    std::ofstream outFile(fileName);
    outFile << std::fixed << std::setprecision(2);
    for(int i = 0; i < rows; ++i) {
        for(int j = 0; j < cols; ++j) {
            outFile << std::setw(6) << grid[i*cols+j] << " ";
        }
        outFile<< std::endl;
    }
    outFile.close();
}

/*------------------------------------------------------------------------------
main
------------------------------------------------------------------------------*/
int main(int argc, char** argv) {
    if(argc != 6) {
        std::cout << "Usage: " << argv[0] << 
            " <numRows> <numCols> <k> <timesteps> <heaterFileName>" << std::endl;

        return 0;
    }

    //Input arguments
    int rows = atoi(argv[1]);
    int cols = atoi(argv[2]);
    float k = atof(argv[3]);
    int timeSteps = atoi(argv[4]);

    //Allocate heater grid
    int gridSize = rows * cols * sizeof(float);
    float* heaterGrid_h = (float*)malloc(gridSize);

    //Read in heater file
    readHeaterFile(argv[5], heaterGrid_h, rows, cols); 

    float* heaterGrid_d; //device pointer
    //TODO Copy heater grid to device
    cudaMalloc(&heaterGrid_d, gridSize);
    cudaMemcpy(heaterGrid_d, heaterGrid_h, gridSize, cudaMemcpyHostToDevice);


    //Input grid
    float* inGrid_h = (float*)malloc(gridSize);
    memset(inGrid_h, 0, gridSize);
    float* inGrid_d; //device pointer
    //TODO Allocate and copy inGrid to device
    cudaMalloc(&inGrid_d, gridSize);
    cudaMemcpy(inGrid_d, inGrid_h, gridSize, cudaMemcpyHostToDevice);

    //Output grid
    float* outGrid_h = (float*)malloc(gridSize);
    memset(outGrid_h, 0, gridSize);
    float* outGrid_d; //device pointer
    //TODO Allocate and copy outGrid to device
    cudaMalloc(&outGrid_d, gridSize);
    cudaMemcpy(outGrid_d, outGrid_h, gridSize, cudaMemcpyHostToDevice);

    dim3 bDim(16, 16);
    dim3 gDim;
    gDim.x = (rows + 16 - 1) / 16; //ceil(num_rows/16)
    gDim.y = (rows + 16 - 1) / 16;


    //TODO fill in update loop
    for(int i = 0; i < timeSteps; ++i) {
        //copy heater temps to inGrid_d (kernel call)
        copyHeaters<<<gDim, bDim>>>(inGrid_d, heaterGrid_d, rows, cols, i);

        //update outGrid_d based on inGrid_d (kernel call)
        updateGrid<<<gDim, bDim>>>(inGrid_d, outGrid_d, k, rows, cols);

        //swap pointers inGrid_d and outGrid_d
        float* temp = inGrid_d;
        inGrid_d = outGrid_d;
        outGrid_d = temp;
    }
    
    //TODO copy inGrid_d back to host (to inGrid_h)
    cudaMemcpy(inGrid_h, inGrid_d, gridSize, cudaMemcpyDeviceToHost); 
    printGridToFile(inGrid_h, rows, cols, "output_two.txt");

    return 0;
}

	.file	"tmpxft_0029e968_00000000-6_main_skel.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.section	.text._ZSt5fixedRSt8ios_base,"axG",@progbits,_ZSt5fixedRSt8ios_base,comdat
	.weak	_ZSt5fixedRSt8ios_base
	.type	_ZSt5fixedRSt8ios_base, @function
_ZSt5fixedRSt8ios_base:
.LFB3285:
	.cfi_startproc
	endbr64
	movl	24(%rdi), %edx
	movq	%rdi, %rax
	andl	$-261, %edx
	orl	$4, %edx
	movl	%edx, 24(%rdi)
	ret
	.cfi_endproc
.LFE3285:
	.size	_ZSt5fixedRSt8ios_base, .-_ZSt5fixedRSt8ios_base
	.text
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4011:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4011:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z9printGridPfii
	.type	_Z9printGridPfii, @function
_Z9printGridPfii:
.LFB4006:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4006:
	.size	_Z9printGridPfii, .-_Z9printGridPfii
	.globl	_Z36__device_stub__Z11copyHeatersPfS_iiiPfS_iii
	.type	_Z36__device_stub__Z11copyHeatersPfS_iiiPfS_iii, @function
_Z36__device_stub__Z11copyHeatersPfS_iiiPfS_iii:
.LFB4033:
	.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
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, 4(%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	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%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	.L5
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z11copyHeatersPfS_iii(%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
.L5:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4033:
	.size	_Z36__device_stub__Z11copyHeatersPfS_iiiPfS_iii, .-_Z36__device_stub__Z11copyHeatersPfS_iiiPfS_iii
	.globl	_Z11copyHeatersPfS_iii
	.type	_Z11copyHeatersPfS_iii, @function
_Z11copyHeatersPfS_iii:
.LFB4034:
	.cfi_startproc
	endbr64
	jmp	_Z36__device_stub__Z11copyHeatersPfS_iiiPfS_iii
	.cfi_endproc
.LFE4034:
	.size	_Z11copyHeatersPfS_iii, .-_Z11copyHeatersPfS_iii
	.globl	_Z35__device_stub__Z10updateGridPfS_fiiPfS_fii
	.type	_Z35__device_stub__Z10updateGridPfS_fiiPfS_fii, @function
_Z35__device_stub__Z10updateGridPfS_fiiPfS_fii:
.LFB4035:
	.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
	movl	%edx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	40(%rsp), %rcx
	movss	%xmm0, 12(%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	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%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	.L11
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z10updateGridPfS_fii(%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
.L11:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4035:
	.size	_Z35__device_stub__Z10updateGridPfS_fiiPfS_fii, .-_Z35__device_stub__Z10updateGridPfS_fiiPfS_fii
	.globl	_Z10updateGridPfS_fii
	.type	_Z10updateGridPfS_fii, @function
_Z10updateGridPfS_fii:
.LFB4036:
	.cfi_startproc
	endbr64
	jmp	_Z35__device_stub__Z10updateGridPfS_fiiPfS_fii
	.cfi_endproc
.LFE4036:
	.size	_Z10updateGridPfS_fii, .-_Z10updateGridPfS_fii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z10updateGridPfS_fii"
.LC1:
	.string	"_Z11copyHeatersPfS_iii"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4038:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z10updateGridPfS_fii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC1(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z11copyHeatersPfS_iii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4038:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.text
	.globl	_Z14readHeaterFilePKcPfii
	.type	_Z14readHeaterFilePKcPfii, @function
_Z14readHeaterFilePKcPfii:
.LFB4005:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4005
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	$8, %edx
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movl	%ecx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rsi, %r12
	movq	%rdi, %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$544, %rsp
	.cfi_def_cfa_offset 592
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbx
	movq	%rbx, %rdi
.LEHB0:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE0:
	movq	%rsp, %rsi
	movq	%rbx, %rdi
.LEHB1:
	call	_ZNSirsERi@PLT
	xorl	%ebp, %ebp
	leaq	4(%rsp), %r14
.L19:
	cmpl	%ebp, (%rsp)
	jle	.L29
	movq	%r14, %rsi
	movq	%rbx, %rdi
	call	_ZNSirsERi@PLT
	leaq	8(%rsp), %rsi
	movq	%rbx, %rdi
	call	_ZNSirsERi@PLT
	leaq	12(%rsp), %rsi
	movq	%rbx, %rdi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	movl	4(%rsp), %eax
	movss	12(%rsp), %xmm0
	incl	%ebp
	imull	%r13d, %eax
	addl	8(%rsp), %eax
	cltq
	movss	%xmm0, (%r12,%rax,4)
	jmp	.L19
.L29:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
.LEHE1:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	je	.L23
	jmp	.L27
.L25:
	endbr64
	movq	%rax, %rbp
.L21:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	movq	%rbp, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L27:
	call	__stack_chk_fail@PLT
.L23:
	addq	$544, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4005:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4005:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4005-.LLSDACSB4005
.LLSDACSB4005:
	.uleb128 .LEHB0-.LFB4005
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4005
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L25-.LFB4005
	.uleb128 0
	.uleb128 .LEHB2-.LFB4005
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE4005:
	.text
	.size	_Z14readHeaterFilePKcPfii, .-_Z14readHeaterFilePKcPfii
	.section	.rodata.str1.1
.LC2:
	.string	" "
	.text
	.globl	_Z15printGridToFilePfiiPc
	.type	_Z15printGridToFilePfiiPc, @function
_Z15printGridToFilePfiiPc:
.LFB4007:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4007
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%esi, %r15d
	movq	%rcx, %rsi
	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
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edx, %ebp
	movl	$16, %edx
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$552, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, (%rsp)
.LEHB3:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE3:
	movq	(%rsp), %rdi
	leaq	_ZSt5fixedRSt8ios_base(%rip), %rsi
.LEHB4:
	call	_ZNSolsEPFRSt8ios_baseS0_E@PLT
	movq	(%rax), %rdx
	xorl	%r13d, %r13d
	xorl	%r14d, %r14d
	movq	-24(%rdx), %rdx
	movq	$2, 8(%rax,%rdx)
.L31:
	cmpl	%r15d, %r14d
	jge	.L33
	movslq	%r13d, %rax
	xorl	%ebx, %ebx
	leaq	(%r12,%rax,4), %rax
	movq	%rax, 8(%rsp)
.L34:
	cmpl	%ebx, %ebp
	jle	.L41
	movq	24(%rsp), %rax
	movq	(%rsp), %rdi
	movq	-24(%rax), %rax
	movq	$6, 40(%rsp,%rax)
	movq	8(%rsp), %rax
	cvtss2sd	(%rax,%rbx,4), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC2(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	incq	%rbx
	jmp	.L34
.L41:
	movq	(%rsp), %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	incl	%r14d
	addl	%ebp, %r13d
	jmp	.L31
.L33:
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
.LEHE4:
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	je	.L37
	jmp	.L39
.L38:
	endbr64
	movq	%rax, %rbx
.L35:
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L39
	movq	%rbx, %rdi
.LEHB5:
	call	_Unwind_Resume@PLT
.LEHE5:
.L39:
	call	__stack_chk_fail@PLT
.L37:
	addq	$552, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4007:
	.section	.gcc_except_table
.LLSDA4007:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4007-.LLSDACSB4007
.LLSDACSB4007:
	.uleb128 .LEHB3-.LFB4007
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB4-.LFB4007
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L38-.LFB4007
	.uleb128 0
	.uleb128 .LEHB5-.LFB4007
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
.LLSDACSE4007:
	.text
	.size	_Z15printGridToFilePfiiPc, .-_Z15printGridToFilePfiiPc
	.section	.rodata.str1.1
.LC3:
	.string	"Usage: "
.LC4:
	.string	" <numRows> <numCols> <k> <timesteps> <heaterFileName>"
.LC5:
	.string	"output_two.txt"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4008:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	cmpl	$6, %edi
	je	.L43
	leaq	.LC3(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	(%r15), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC4(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	jmp	.L44
.L43:
	movq	8(%rsi), %rdi
	call	atoi@PLT
	movq	16(%r15), %rdi
	movl	%eax, %ebp
	call	atoi@PLT
	movl	%ebp, %ebx
	movq	24(%r15), %rdi
	movl	%eax, %r12d
	call	atof@PLT
	imull	%r12d, %ebx
	movq	32(%r15), %rdi
	cvtsd2ss	%xmm0, %xmm1
	movss	%xmm1, 12(%rsp)
	call	atoi@PLT
	sall	$2, %ebx
	movl	%eax, %r14d
	movslq	%ebx, %rbx
	movq	%rbx, %rdi
	call	malloc@PLT
	movq	40(%r15), %rdi
	movl	%r12d, %ecx
	movl	%ebp, %edx
	movq	%rax, %rsi
	movq	%rax, %r13
	call	_Z14readHeaterFilePKcPfii
	leaq	24(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	24(%rsp), %rdi
	movq	%r13, %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	%rbx, %rdi
	call	malloc@PLT
	movq	%rbx, %rcx
	movq	%rbx, %rdx
	xorl	%esi, %esi
	movq	%rax, %rdi
	movq	%rax, %r15
	call	__memset_chk@PLT
	leaq	32(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	32(%rsp), %rdi
	movq	%rbx, %rdx
	movq	%r15, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	%rbx, %rdi
	call	malloc@PLT
	movq	%rbx, %rcx
	movq	%rbx, %rdx
	xorl	%esi, %esi
	movq	%rax, %rdi
	movq	%rax, %r13
	call	__memset_chk@PLT
	leaq	40(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	40(%rsp), %rdi
	movq	%rbx, %rdx
	movq	%r13, %rsi
	movl	$1, %ecx
	xorl	%r13d, %r13d
	call	cudaMemcpy@PLT
	movl	$16, %ecx
	movabsq	$68719476752, %rax
	movl	$1, 56(%rsp)
	movq	%rax, 48(%rsp)
	leal	15(%rbp), %eax
	cltd
	movl	$1, 68(%rsp)
	idivl	%ecx
	movl	%eax, 60(%rsp)
	movl	%eax, 64(%rsp)
.L45:
	cmpl	%r14d, %r13d
	jge	.L51
	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	.L46
	movq	24(%rsp), %rsi
	movq	32(%rsp), %rdi
	movl	%r13d, %r8d
	movl	%r12d, %ecx
	movl	%ebp, %edx
	call	_Z36__device_stub__Z11copyHeatersPfS_iiiPfS_iii
.L46:
	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	.L47
	movss	12(%rsp), %xmm0
	movq	40(%rsp), %rsi
	movl	%r12d, %ecx
	movl	%ebp, %edx
	movq	32(%rsp), %rdi
	call	_Z35__device_stub__Z10updateGridPfS_fiiPfS_fii
.L47:
	movq	32(%rsp), %rax
	movq	40(%rsp), %rdx
	incl	%r13d
	movq	%rdx, 32(%rsp)
	movq	%rax, 40(%rsp)
	jmp	.L45
.L51:
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdx
	movq	%r15, %rdi
	call	cudaMemcpy@PLT
	movl	%r12d, %edx
	movl	%ebp, %esi
	movq	%r15, %rdi
	leaq	.LC5(%rip), %rcx
	call	_Z15printGridToFilePfiiPc
.L44:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L49
	call	__stack_chk_fail@PLT
.L49:
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4008:
	.size	main, .-main
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <iomanip>
void  printGrid(float* grid, int rows, int cols);
/**
 *Kernel will update the matrix to keep the heater cells constant.
 */
__global__ void copyHeaters(float* stateGrid, float* heaterGrid, int nRows, int nCols, int iteration) {
    dim3 gIdx;
    gIdx.y = blockIdx.y * blockDim.y + threadIdx.y; //row
    gIdx.x = blockIdx.x * blockDim.x + threadIdx.x; // col
    int i = gIdx.y;
    int j = gIdx.x;
   
    if(gIdx.x < nCols && gIdx.y < nRows){
            float heatValue = heaterGrid[i*nCols +j];
            if(heatValue != 0)
                stateGrid[i*nCols + j] =heatValue;
    }
}

__global__ void updateGrid(float* inGrid, float* outGrid, float k, int nRows, int nCols) {
    dim3 gIdx;
    gIdx.y = blockIdx.y * blockDim.y + threadIdx.y; //row
    gIdx.x = blockIdx.x * blockDim.x + threadIdx.x; // col
    int i = gIdx.y;
    int j = gIdx.x;

    //Find these values from the inGrid
    int Tlft, Trite, Tup, Tdown;
    if(gIdx.x < nCols && gIdx.y < nRows){
           int currentPosition = i*nCols+j;
           Tlft = currentPosition -1;
           Trite = currentPosition +1;
           Tup = currentPosition -nCols;
           Tdown = currentPosition +nCols;
           float Tnew = inGrid[currentPosition];
           float Top, Tbottom, Tleft, Tright;
           Tbottom = (Tdown >= nCols*nRows) ? Tnew : inGrid[Tdown];
           Top = (Tup < 0) ? Tnew : inGrid[Tup];
           Tright = (Trite >= nCols*nRows) ?  Tnew : inGrid[Trite];
           Tleft = (Tlft < 0) ? Tnew : inGrid[Tlft]; 
           
           Tnew = Tnew + k*(Top + Tbottom + Tleft + Tright - (4*Tnew));

           outGrid[currentPosition] = Tnew;
   }
}

/*------------------------------------------------------------------------------
readHeaterFile

Assumes heaterGrid points to a flattened 2d array of size [rows,cols]
Fille heaterGrid with heaters from the heater file
------------------------------------------------------------------------------*/
void readHeaterFile(const char* fileName, float* heaterGrid, int rows, int cols) {
    std::ifstream inFile(fileName); 

    int numHeaters;
    inFile >> numHeaters;

    for(int i = 0; i < numHeaters; ++i) {
        int hRow, hCol;
        inFile >> hRow;
        inFile >> hCol;
        
        float temp;
        inFile >> temp; 

        heaterGrid[hRow * cols + hCol] = temp;
    }

    inFile.close();
}


/*------------------------------------------------------------------------------
printGrid
------------------------------------------------------------------------------*/
__device__ void printGrid(float* grid, int rows, int cols) {
    //std::cout << std::fixed << std::setprecision(2);
    for(int i = 0; i < rows; ++i) {
        for(int j = 0; j < cols; ++j) {
     //       std::cout << std::setw(6) << grid[i*cols+j] << " ";
            printf("%f ", grid[i*cols+j]);
        }
        //std::cout << std::endl;
        printf("\n");
    }
}

/*------------------------------------------------------------------------------
printGridToFile
------------------------------------------------------------------------------*/
void printGridToFile(float* grid, int rows, int cols, char* fileName) {
    std::ofstream outFile(fileName);
    outFile << std::fixed << std::setprecision(2);
    for(int i = 0; i < rows; ++i) {
        for(int j = 0; j < cols; ++j) {
            outFile << std::setw(6) << grid[i*cols+j] << " ";
        }
        outFile<< std::endl;
    }
    outFile.close();
}

/*------------------------------------------------------------------------------
main
------------------------------------------------------------------------------*/
int main(int argc, char** argv) {
    if(argc != 6) {
        std::cout << "Usage: " << argv[0] << 
            " <numRows> <numCols> <k> <timesteps> <heaterFileName>" << std::endl;

        return 0;
    }

    //Input arguments
    int rows = atoi(argv[1]);
    int cols = atoi(argv[2]);
    float k = atof(argv[3]);
    int timeSteps = atoi(argv[4]);

    //Allocate heater grid
    int gridSize = rows * cols * sizeof(float);
    float* heaterGrid_h = (float*)malloc(gridSize);

    //Read in heater file
    readHeaterFile(argv[5], heaterGrid_h, rows, cols); 

    float* heaterGrid_d; //device pointer
    //TODO Copy heater grid to device
    hipMalloc(&heaterGrid_d, gridSize);
    hipMemcpy(heaterGrid_d, heaterGrid_h, gridSize, hipMemcpyHostToDevice);


    //Input grid
    float* inGrid_h = (float*)malloc(gridSize);
    memset(inGrid_h, 0, gridSize);
    float* inGrid_d; //device pointer
    //TODO Allocate and copy inGrid to device
    hipMalloc(&inGrid_d, gridSize);
    hipMemcpy(inGrid_d, inGrid_h, gridSize, hipMemcpyHostToDevice);

    //Output grid
    float* outGrid_h = (float*)malloc(gridSize);
    memset(outGrid_h, 0, gridSize);
    float* outGrid_d; //device pointer
    //TODO Allocate and copy outGrid to device
    hipMalloc(&outGrid_d, gridSize);
    hipMemcpy(outGrid_d, outGrid_h, gridSize, hipMemcpyHostToDevice);

    dim3 bDim(16, 16);
    dim3 gDim;
    gDim.x = (rows + 16 - 1) / 16; //ceil(num_rows/16)
    gDim.y = (rows + 16 - 1) / 16;


    //TODO fill in update loop
    for(int i = 0; i < timeSteps; ++i) {
        //copy heater temps to inGrid_d (kernel call)
        copyHeaters<<<gDim, bDim>>>(inGrid_d, heaterGrid_d, rows, cols, i);

        //update outGrid_d based on inGrid_d (kernel call)
        updateGrid<<<gDim, bDim>>>(inGrid_d, outGrid_d, k, rows, cols);

        //swap pointers inGrid_d and outGrid_d
        float* temp = inGrid_d;
        inGrid_d = outGrid_d;
        outGrid_d = temp;
    }
    
    //TODO copy inGrid_d back to host (to inGrid_h)
    hipMemcpy(inGrid_h, inGrid_d, gridSize, hipMemcpyDeviceToHost); 
    printGridToFile(inGrid_h, rows, cols, "output_two.txt");

    return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z26__device_stub__copyHeatersPfS_iii # -- Begin function _Z26__device_stub__copyHeatersPfS_iii
	.type	_Z26__device_stub__copyHeatersPfS_iii,@function
_Z26__device_stub__copyHeatersPfS_iii:  # @_Z26__device_stub__copyHeatersPfS_iii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z11copyHeatersPfS_iii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z26__device_stub__copyHeatersPfS_iii, .Lfunc_end0-_Z26__device_stub__copyHeatersPfS_iii
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__updateGridPfS_fii # -- Begin function _Z25__device_stub__updateGridPfS_fii
	.type	_Z25__device_stub__updateGridPfS_fii,@function
_Z25__device_stub__updateGridPfS_fii:   # @_Z25__device_stub__updateGridPfS_fii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movss	%xmm0, (%rsi)
	leaq	8(%rsp), %r8
	movl	%edx, (%r8)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%r8, 24(%rbx)
	movq	%rdx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z10updateGridPfS_fii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z25__device_stub__updateGridPfS_fii, .Lfunc_end1-_Z25__device_stub__updateGridPfS_fii
	.cfi_endproc
                                        # -- End function
	.globl	_Z14readHeaterFilePKcPfii       # -- Begin function _Z14readHeaterFilePKcPfii
	.type	_Z14readHeaterFilePKcPfii,@function
_Z14readHeaterFilePKcPfii:              # @_Z14readHeaterFilePKcPfii
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$536, %rsp                      # imm = 0x218
	.cfi_def_cfa_offset 592
	.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	%ecx, %r15d
	movq	%rsi, %rbx
	movq	%rdi, %rsi
	leaq	16(%rsp), %r14
	movq	%r14, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
.Ltmp0:
	movq	%rsp, %rsi
	movq	%r14, %rdi
	callq	_ZNSirsERi
.Ltmp1:
# %bb.1:                                # %.preheader
	cmpl	$0, (%rsp)
	jle	.LBB2_7
# %bb.2:                                # %.lr.ph.preheader
	xorl	%ebp, %ebp
	leaq	16(%rsp), %r14
	leaq	8(%rsp), %r12
	leaq	4(%rsp), %r13
	movslq	%r15d, %r15
.LBB2_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
.Ltmp2:
	movq	%r14, %rdi
	leaq	12(%rsp), %rsi
	callq	_ZNSirsERi
.Ltmp3:
# %bb.4:                                #   in Loop: Header=BB2_3 Depth=1
.Ltmp4:
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_ZNSirsERi
.Ltmp5:
# %bb.5:                                #   in Loop: Header=BB2_3 Depth=1
.Ltmp7:
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp8:
# %bb.6:                                # %_ZNSirsERf.exit
                                        #   in Loop: Header=BB2_3 Depth=1
	movss	4(%rsp), %xmm0                  # xmm0 = mem[0],zero,zero,zero
	movslq	12(%rsp), %rax
	imulq	%r15, %rax
	movslq	8(%rsp), %rcx
	addq	%rax, %rcx
	movss	%xmm0, (%rbx,%rcx,4)
	incl	%ebp
	cmpl	(%rsp), %ebp
	jl	.LBB2_3
.LBB2_7:                                # %._crit_edge
.Ltmp10:
	leaq	16(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp11:
# %bb.8:
	leaq	16(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	addq	$536, %rsp                      # imm = 0x218
	.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
.LBB2_11:
	.cfi_def_cfa_offset 592
.Ltmp12:
	jmp	.LBB2_12
.LBB2_10:
.Ltmp9:
	jmp	.LBB2_12
.LBB2_9:
.Ltmp6:
.LBB2_12:
	movq	%rax, %rbx
	leaq	16(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end2:
	.size	_Z14readHeaterFilePKcPfii, .Lfunc_end2-_Z14readHeaterFilePKcPfii
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table2:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp12-.Lfunc_begin0          #     jumps to .Ltmp12
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp2-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp5-.Ltmp2                  #   Call between .Ltmp2 and .Ltmp5
	.uleb128 .Ltmp6-.Lfunc_begin0           #     jumps to .Ltmp6
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp7-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp8-.Ltmp7                  #   Call between .Ltmp7 and .Ltmp8
	.uleb128 .Ltmp9-.Lfunc_begin0           #     jumps to .Ltmp9
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp10-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp11-.Ltmp10                #   Call between .Ltmp10 and .Ltmp11
	.uleb128 .Ltmp12-.Lfunc_begin0          #     jumps to .Ltmp12
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp11-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Lfunc_end2-.Ltmp11            #   Call between .Ltmp11 and .Lfunc_end2
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z15printGridToFilePfiiPc       # -- Begin function _Z15printGridToFilePfiiPc
	.type	_Z15printGridToFilePfiiPc,@function
_Z15printGridToFilePfiiPc:              # @_Z15printGridToFilePfiiPc
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$536, %rsp                      # imm = 0x218
	.cfi_def_cfa_offset 592
	.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	%edx, %ebx
	movl	%esi, %ebp
	movq	%rdi, 8(%rsp)                   # 8-byte Spill
	leaq	24(%rsp), %r15
	movq	%r15, %rdi
	movq	%rcx, %rsi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
	movq	(%r15), %rax
	movq	-24(%rax), %rcx
	movl	$-261, %edx                     # imm = 0xFEFB
	andl	48(%rsp,%rcx), %edx
	orl	$4, %edx
	movl	%edx, 48(%rsp,%rcx)
	movq	-24(%rax), %rax
	movq	$2, 32(%rsp,%rax)
	testl	%ebp, %ebp
	jle	.LBB3_11
# %bb.1:                                # %.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
.LBB3_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_4 Depth 2
	testl	%ebx, %ebx
	jle	.LBB3_7
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB3_2 Depth=1
	movl	%ebp, %eax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	leaq	(%rcx,%rax,4), %r12
	xorl	%ebx, %ebx
.LBB3_4:                                #   Parent Loop BB3_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	24(%rsp), %rax
	movq	-24(%rax), %rax
	movq	$6, 40(%rsp,%rax)
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r12,%rbx,4), %xmm0
.Ltmp13:
	movq	%r15, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp14:
# %bb.5:                                # %_ZNSolsEf.exit
                                        #   in Loop: Header=BB3_4 Depth=2
.Ltmp15:
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp16:
# %bb.6:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB3_4 Depth=2
	incq	%rbx
	cmpq	%rbx, %r13
	jne	.LBB3_4
.LBB3_7:                                # %._crit_edge
                                        #   in Loop: Header=BB3_2 Depth=1
	movq	24(%rsp), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
.Ltmp18:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp19:
# %bb.8:                                # %.noexc
                                        #   in Loop: Header=BB3_2 Depth=1
.Ltmp20:
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
.Ltmp21:
# %bb.9:                                # %.noexc20
                                        #   in Loop: Header=BB3_2 Depth=1
.Ltmp22:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp23:
# %bb.10:                               # %_ZNSolsEPFRSoS_E.exit
                                        #   in Loop: Header=BB3_2 Depth=1
	incq	%r14
	movl	4(%rsp), %ebx                   # 4-byte Reload
	addl	%ebx, %ebp
	cmpq	16(%rsp), %r14                  # 8-byte Folded Reload
	jne	.LBB3_2
.LBB3_11:                               # %._crit_edge24
.Ltmp25:
	leaq	24(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp26:
# %bb.12:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	32(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 24(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	272(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	addq	$536, %rsp                      # imm = 0x218
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB3_13:
	.cfi_def_cfa_offset 592
.Ltmp27:
	jmp	.LBB3_14
.LBB3_16:
.Ltmp24:
	jmp	.LBB3_14
.LBB3_15:
.Ltmp17:
.LBB3_14:
	movq	%rax, %rbx
	leaq	24(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	_Z15printGridToFilePfiiPc, .Lfunc_end3-_Z15printGridToFilePfiiPc
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table3:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Lfunc_begin1-.Lfunc_begin1    # >> Call Site 1 <<
	.uleb128 .Ltmp13-.Lfunc_begin1          #   Call between .Lfunc_begin1 and .Ltmp13
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp13-.Lfunc_begin1          # >> Call Site 2 <<
	.uleb128 .Ltmp16-.Ltmp13                #   Call between .Ltmp13 and .Ltmp16
	.uleb128 .Ltmp17-.Lfunc_begin1          #     jumps to .Ltmp17
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp18-.Lfunc_begin1          # >> Call Site 3 <<
	.uleb128 .Ltmp23-.Ltmp18                #   Call between .Ltmp18 and .Ltmp23
	.uleb128 .Ltmp24-.Lfunc_begin1          #     jumps to .Ltmp24
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp25-.Lfunc_begin1          # >> Call Site 4 <<
	.uleb128 .Ltmp26-.Ltmp25                #   Call between .Ltmp25 and .Ltmp26
	.uleb128 .Ltmp27-.Lfunc_begin1          #     jumps to .Ltmp27
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp26-.Lfunc_begin1          # >> Call Site 5 <<
	.uleb128 .Lfunc_end3-.Ltmp26            #   Call between .Ltmp26 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r14
	cmpl	$6, %edi
	jne	.LBB4_1
# %bb.5:
	movq	8(%r14), %rdi
	callq	atoi
	movl	%eax, %ebx
	movq	16(%r14), %rdi
	callq	atoi
	movl	%eax, %ebp
	movq	24(%r14), %rdi
	callq	atof
	movsd	%xmm0, 16(%rsp)                 # 8-byte Spill
	movq	32(%r14), %rdi
	callq	atoi
	movl	%eax, %r15d
	movl	%ebx, %eax
	imull	%ebp, %eax
	shll	$2, %eax
	movslq	%eax, %r13
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, %r12
	movq	40(%r14), %rdi
	movq	%rax, %rsi
	movl	%ebp, %ecx
	callq	_Z14readHeaterFilePKcPfii
	leaq	48(%rsp), %r14
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	movq	(%r14), %rdi
	movq	%r12, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$1, %edi
	movq	%r13, %rsi
	callq	calloc@PLT
	movq	%rax, %r12
	leaq	8(%rsp), %r14
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	movq	(%r14), %rdi
	movq	%r12, 32(%rsp)                  # 8-byte Spill
	movq	%r12, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$1, %edi
	movq	%r13, %rsi
	callq	calloc@PLT
	movq	%rax, %r14
	leaq	24(%rsp), %r12
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	movq	(%r12), %rdi
	movq	%r14, %rsi
	movq	%r13, 40(%rsp)                  # 8-byte Spill
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leal	15(%rbx), %ecx
	movl	%ebx, %eax
	addl	$30, %eax
	testl	%ecx, %ecx
	cmovnsl	%ecx, %eax
	testl	%r15d, %r15d
	jle	.LBB4_12
# %bb.6:                                # %.lr.ph.preheader
	xorps	%xmm0, %xmm0
	cvtsd2ss	16(%rsp), %xmm0                 # 8-byte Folded Reload
	movss	%xmm0, 16(%rsp)                 # 4-byte Spill
	sarl	$4, %eax
	movq	%rax, %r13
	shlq	$32, %r13
	orq	%rax, %r13
	xorl	%r12d, %r12d
	movabsq	$68719476752, %r14              # imm = 0x1000000010
.LBB4_7:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_9
# %bb.8:                                #   in Loop: Header=BB4_7 Depth=1
	movq	8(%rsp), %rdi
	movq	48(%rsp), %rsi
	movl	%ebx, %edx
	movl	%ebp, %ecx
	movl	%r12d, %r8d
	callq	_Z26__device_stub__copyHeatersPfS_iii
.LBB4_9:                                #   in Loop: Header=BB4_7 Depth=1
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_11
# %bb.10:                               #   in Loop: Header=BB4_7 Depth=1
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movss	16(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	movl	%ebx, %edx
	movl	%ebp, %ecx
	callq	_Z25__device_stub__updateGridPfS_fii
.LBB4_11:                               #   in Loop: Header=BB4_7 Depth=1
	movq	8(%rsp), %rax
	movq	24(%rsp), %rsi
	movq	%rsi, 8(%rsp)
	movq	%rax, 24(%rsp)
	incl	%r12d
	cmpl	%r12d, %r15d
	jne	.LBB4_7
	jmp	.LBB4_13
.LBB4_1:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$7, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r14), %rbx
	testq	%rbx, %rbx
	je	.LBB4_2
# %bb.3:
	movq	%rbx, %rdi
	callq	strlen
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB4_4
.LBB4_12:                               # %.._crit_edge_crit_edge
	movq	8(%rsp), %rsi
.LBB4_13:                               # %._crit_edge
	movq	32(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rdi
	movq	40(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$.L.str.3, %ecx
	movq	%r14, %rdi
	movl	%ebx, %esi
	movl	%ebp, %edx
	callq	_Z15printGridToFilePfiiPc
	jmp	.LBB4_14
.LBB4_2:
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB4_4:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$53, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.LBB4_14:
	xorl	%eax, %eax
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z11copyHeatersPfS_iii, %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	$_Z10updateGridPfS_fii, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %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_end5:
	.size	__hip_module_ctor, .Lfunc_end5-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB6_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB6_2:
	retq
.Lfunc_end6:
	.size	__hip_module_dtor, .Lfunc_end6-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z11copyHeatersPfS_iii,@object  # @_Z11copyHeatersPfS_iii
	.section	.rodata,"a",@progbits
	.globl	_Z11copyHeatersPfS_iii
	.p2align	3, 0x0
_Z11copyHeatersPfS_iii:
	.quad	_Z26__device_stub__copyHeatersPfS_iii
	.size	_Z11copyHeatersPfS_iii, 8

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

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

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	" <numRows> <numCols> <k> <timesteps> <heaterFileName>"
	.size	.L.str.2, 54

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"output_two.txt"
	.size	.L.str.3, 15

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z11copyHeatersPfS_iii"
	.size	.L__unnamed_1, 23

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z10updateGridPfS_fii"
	.size	.L__unnamed_2, 22

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

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

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z26__device_stub__copyHeatersPfS_iii
	.addrsig_sym _Z25__device_stub__updateGridPfS_fii
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z11copyHeatersPfS_iii
	.addrsig_sym _Z10updateGridPfS_fii
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z11copyHeatersPfS_iii  ; -- Begin function _Z11copyHeatersPfS_iii
	.globl	_Z11copyHeatersPfS_iii
	.p2align	8
	.type	_Z11copyHeatersPfS_iii,@function
_Z11copyHeatersPfS_iii:                 ; @_Z11copyHeatersPfS_iii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	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_lshr_b32 s3, s2, 16
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[0:1], null, s14, s2, v[2:3]
	v_mad_u64_u32 v[1:2], null, s15, s3, v[3:4]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_u32_e32 vcc_lo, s5, v0
	v_cmp_gt_u32_e64 s2, s4, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB0_3
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_mad_u64_u32 v[2:3], null, v1, s5, 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
	global_load_b32 v2, v[2:3], off
	s_waitcnt vmcnt(0)
	v_cmp_neq_f32_e32 vcc_lo, 0, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_3
; %bb.2:
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
.LBB0_3:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11copyHeatersPfS_iii
		.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_end0:
	.size	_Z11copyHeatersPfS_iii, .Lfunc_end0-_Z11copyHeatersPfS_iii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 212
; 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	_Z10updateGridPfS_fii   ; -- Begin function _Z10updateGridPfS_fii
	.globl	_Z10updateGridPfS_fii
	.p2align	8
	.type	_Z10updateGridPfS_fii,@function
_Z10updateGridPfS_fii:                  ; @_Z10updateGridPfS_fii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b128 s[4:7], s[0:1], 0x10
	v_and_b32_e32 v2, 0x3ff, v0
	v_bfe_u32 v3, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s3, s2, 16
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[0:1], null, s14, s2, v[2:3]
	v_mad_u64_u32 v[1:2], null, s15, s3, v[3:4]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_u32_e32 vcc_lo, s6, v0
	v_cmp_gt_u32_e64 s2, s5, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB1_10
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_mad_u64_u32 v[2:3], null, v1, s6, v[0:1]
	s_mul_i32 s5, s6, s5
	s_mov_b32 s8, exec_lo
	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 v3, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v1, vcc_lo
	global_load_b32 v7, v[3:4], off
	s_waitcnt vmcnt(0)
	v_dual_mov_b32 v8, v7 :: v_dual_add_nc_u32 v5, s6, v2
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s5, v5
	s_cbranch_execz .LBB1_3
; %bb.2:
	s_ashr_i32 s7, s6, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[10:11], s[6:7], 2
	v_add_co_u32 v5, vcc_lo, v3, s10
	v_add_co_ci_u32_e32 v6, vcc_lo, s11, v4, vcc_lo
	global_load_b32 v8, v[5:6], off
.LBB1_3:
	s_or_b32 exec_lo, exec_lo, s8
	v_subrev_nc_u32_e32 v5, s6, v2
	v_mov_b32_e32 v6, v7
	s_mov_b32 s6, exec_lo
	s_delay_alu instid0(VALU_DEP_2)
	v_cmpx_lt_i32_e32 -1, v5
	s_cbranch_execz .LBB1_5
; %bb.4:
	v_mov_b32_e32 v6, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[5:6], 2, v[5:6]
	v_add_co_u32 v5, vcc_lo, s0, v5
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v6, vcc_lo, s1, v6, vcc_lo
	global_load_b32 v6, v[5:6], off
.LBB1_5:
	s_or_b32 exec_lo, exec_lo, s6
	v_add_nc_u32_e32 v5, 1, v2
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s5, v5
	v_mov_b32_e32 v5, v7
	s_and_saveexec_b32 s5, vcc_lo
	s_cbranch_execz .LBB1_7
; %bb.6:
	global_load_b32 v5, v[3:4], off offset:4
.LBB1_7:
	s_or_b32 exec_lo, exec_lo, s5
	v_mov_b32_e32 v3, v7
	s_mov_b32 s5, exec_lo
	v_cmpx_lt_i32_e32 0, v2
	s_cbranch_execz .LBB1_9
; %bb.8:
	v_mov_b32_e32 v3, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_add_co_u32 v2, vcc_lo, s0, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v3, vcc_lo
	global_load_b32 v3, v[2:3], off offset:-4
.LBB1_9:
	s_or_b32 exec_lo, exec_lo, s5
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v2, v8, v6
	v_add_co_u32 v0, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v2, v2, v3
	v_add_f32_e32 v2, v5, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v2, -4.0, v7
	v_fmac_f32_e32 v7, s4, v2
	global_store_b32 v[0:1], v7, off
.LBB1_10:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10updateGridPfS_fii
		.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 9
		.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	_Z10updateGridPfS_fii, .Lfunc_end1-_Z10updateGridPfS_fii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 464
; NumSgprs: 18
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 9
; 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:         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:           _Z11copyHeatersPfS_iii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z11copyHeatersPfS_iii.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
      - .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:         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:           _Z10updateGridPfS_fii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z10updateGridPfS_fii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
