#include<stdlib.h>
#include<iostream>
#include<cmath>
#include<fstream>
#include<chrono>



//shared host/device constants
int gridWidth,gridHeight,gridDepth,blockWidth,blockHeight,blockDepth,gridWidthBlocks,gridHeightBlocks,gridDepthBlocks,gridArea;
__constant__ int gridWidth_d,gridHeight_d,gridDepth_d,blockWidth_d,blockHeight_d,blockDepth_d,gridWidthBlocks_d,gridHeightBlocks_d,gridDepthBlocks_d;

//host only constants
int timeSteps;



__device__ int arrayPos(const int &x,const int &y,const int &z){
    return (z*gridWidth_d*gridHeight_d)+(y*gridWidth_d)+x;
}



__global__ void solver(bool *grid,bool *grid1){
    int xpos = (blockIdx.x*blockWidth_d)+threadIdx.x;
    int ypos = (blockIdx.y*blockHeight_d)+threadIdx.y;
    int zpos = (blockIdx.z*blockDepth_d)+threadIdx.z;

    if(xpos>0 && xpos<gridWidth_d-1 && ypos>0 && ypos<gridHeight_d-1 && zpos>0 && zpos<gridDepth_d-1){
        int neighbors = grid[arrayPos(xpos+1,ypos,zpos)]+grid[arrayPos(xpos-1,ypos,zpos)]
                        +grid[arrayPos(xpos,ypos+1,zpos)]+grid[arrayPos(xpos,ypos-1,zpos)]
                        +grid[arrayPos(xpos,ypos,zpos+1)]+grid[arrayPos(xpos,ypos,zpos-1)];

        if(grid[arrayPos(xpos,ypos,zpos)]){
            if(neighbors<2 || neighbors>3){
                grid1[arrayPos(xpos,ypos,zpos)] = false;
            }else{
                grid1[arrayPos(xpos,ypos,zpos)] = true;
            }
        }else{
            if(neighbors==3){
                grid1[arrayPos(xpos,ypos,zpos)] = true;
            }else{
                grid1[arrayPos(xpos,ypos,zpos)] = false;
            }
        }
    }
}



//helper function to read grid from a text file
void readTextRepr(const std::string& filename,bool *array){
    std::ifstream file(filename);
    std::string str;
    int index=0;

    while(std::getline(file,str)){
        if(str!="---"){
            for(int i=0;i<str.length();i++){
                //stop reading if file is greater than arrayLength
                if(index<gridArea){
                    if(str[i]!='\n'){
                        if(str[i]=='#'){
                            array[index]=true;
                        }else{
                            array[index]=false;
                        }
                        index++;
                    }
                }
            }
        }
    }
    //fill in excess space with falses if file is too short
    if(index<gridArea){
        for(int i=index;i<gridArea;i++){
            array[index]=false;
        }
    }
}



//helper function to write grid to a text file
void writeTextRepr(const std::string& filename,bool *array){
    std::ofstream file(filename);
    for(int i=0;i<gridArea;i++){
        if(array[i]){
            file<<'#';
        }else{
            file<<' ';
        }
        if((i+1)%gridWidth==0){
            file<<'\n';
        }
        if((i+1)%(gridWidth*gridHeight)==0){
            file<<"---\n";
        }
    }
}



int main(int argc, const char * argv[]){
    //start clock
    auto startTime = std::chrono::high_resolution_clock::now();

    //input and output files
    std::string inFile = "in.txt";
    std::string outFile = "out.txt";

    //time of simulation
    timeSteps = 1;

    //dimensions of the grid
    gridWidth = 16;
    gridHeight = 16;
    gridDepth = 16;

    /*
    Speed testing with varying grid and block sizes, using both 3D and 2D kernel implementations
        16x16x16 grid, 2mil steps:
            3D Kernel
            16x16x1 = 18921ms
            8x8x16  = 21150ms
            8x8x8   = 19432ms
            4x4x4   = 21614ms
            2x2x2   = 24362ms

            2D Kernel
            16x16   = 19389ms
            8x8     = 19425ms
            4x4     = 19992ms

        64x64x64 grid, 2mil steps:
            3D Kernel
            16x16x1 = 44162ms
            8x8x8   = 61221ms
            8x8x4   = 62442ms
            
            2D Kernel
            16x16   = 47543ms

        2048x2048x128 grid, 100 steps:
            3D Kernel
            16x16x1 = 15065ms
            8x8x8   = 18386ms

    The fastest block size across both small and large grids appears to be 16x16x1, using the 3D kernel
    */
    blockWidth = 16;
    blockHeight = 16;
    blockDepth = 1;



    //handle command line arguments
    int optionLen = 0;
    for(int i=1;i<argc;i+=optionLen){
        printf("%d",i);
        if(strcmp(argv[i],"-i")==0){
            optionLen = 2;
            if(i+optionLen<=argc){
                inFile = argv[i+1];
            }else{
                printf("Error: Missing arguments for -i\n");
                return 1;
            }
        }else if(strcmp(argv[i],"-o")==0){
            optionLen = 2;
            if(i+optionLen<=argc){
                outFile = argv[i+1];
            }else{
                printf("Error: Missing arguments for -o\n");
                return 1;
            }
        }else if(strcmp(argv[i],"-t")==0){
            optionLen = 2;
            if(i+optionLen<=argc){
                timeSteps = strtol(argv[i+1],NULL,10);
            }else{
                printf("Error: Missing arguments for -t\n");
                return 1;
            }
        }else if(strcmp(argv[i],"-g")==0){
            optionLen = 4;
            if(i+optionLen<=argc){
                gridWidth = strtol(argv[i+1],NULL,10);
                gridHeight = strtol(argv[i+2],NULL,10);
                gridDepth = strtol(argv[i+3],NULL,10);
            }else{
                printf("Error: Missing arguments for -g\n");
                return 1;
            }
        }else if(strcmp(argv[i],"-b")==0){
            optionLen = 4;
            if(i+optionLen<=argc){
                blockWidth = strtol(argv[i+1],NULL,10);
                blockHeight = strtol(argv[i+2],NULL,10);
                blockDepth = strtol(argv[i+3],NULL,10);
            }else{
                printf("Error: Missing arguments for -b\n");
                return 1;
            }
        }else{
            printf("Error: Parameters must be of form:\n");
            printf("./game [-i infile] [-o outfile] [-t timesteps] [-g griddimensions] [-b blockdimensions]\n");
            return 1;
        }
    }



    //derived values
    gridWidthBlocks = std::ceil((float)gridWidth/(float)blockWidth);
    gridHeightBlocks = std::ceil((float)gridHeight/(float)blockHeight);
    gridDepthBlocks = std::ceil((float)gridDepth/(float)blockDepth);
    gridArea = gridWidth*gridHeight*gridDepth;



    std::cout << "In file = " << inFile << "\n";
    std::cout << "Out file = " << outFile << "\n";
    printf("Time steps = %d\n",timeSteps);
    printf("Grid dimensions = %dx%dx%d\n",gridWidth,gridHeight,gridDepth);
    printf("Block dimensions = %dx%dx%d\n",blockWidth,blockHeight,blockDepth);
    printf("Grid in blocks = %dx%dx%d\n",gridWidthBlocks,gridHeightBlocks,gridDepthBlocks);
    printf("...");

    

    //set device symbols to dimensions of grid,block,etc.
    cudaMemcpyToSymbol(*(&gridWidth_d),&gridWidth,sizeof(int),0,cudaMemcpyHostToDevice);
    cudaMemcpyToSymbol(*(&gridHeight_d),&gridHeight,sizeof(int),0,cudaMemcpyHostToDevice);
    cudaMemcpyToSymbol(*(&gridDepth_d),&gridDepth,sizeof(int),0,cudaMemcpyHostToDevice);
    cudaMemcpyToSymbol(*(&blockWidth_d),&blockWidth,sizeof(int),0,cudaMemcpyHostToDevice);
    cudaMemcpyToSymbol(*(&blockHeight_d),&blockHeight,sizeof(int),0,cudaMemcpyHostToDevice);
    cudaMemcpyToSymbol(*(&blockDepth_d),&blockDepth,sizeof(int),0,cudaMemcpyHostToDevice);
    cudaMemcpyToSymbol(*(&gridWidthBlocks_d),&gridWidthBlocks,sizeof(int),0,cudaMemcpyHostToDevice);
    cudaMemcpyToSymbol(*(&gridHeightBlocks_d),&gridHeightBlocks,sizeof(int),0,cudaMemcpyHostToDevice);
    cudaMemcpyToSymbol(*(&gridDepthBlocks_d),&gridDepthBlocks,sizeof(int),0,cudaMemcpyHostToDevice);

    dim3 numBlocks(gridWidthBlocks,gridHeightBlocks,gridDepthBlocks);
    dim3 blockSize(blockWidth,blockHeight,blockDepth);

    size_t gridSize = gridWidth*gridHeight*gridDepth;

    //device+host grid arrays
    bool *grid_h;
    bool *grid_d,*grid1_d;

    //allocate host memory
    grid_h = (bool *)calloc(gridSize,sizeof(bool));

    //allocate device memory
    cudaMalloc((void **)&grid_d, gridSize);
    cudaMalloc((void **)&grid1_d, gridSize);

    //load grid
    readTextRepr(inFile,grid_h);
    
    //only copy first grid to device, second one is computed by kernel
    cudaMemcpy(grid_d,grid_h,gridSize,cudaMemcpyHostToDevice);

    for(int i=0;i<timeSteps;i++){
        solver<<<numBlocks,blockSize>>>(grid_d,grid1_d);
        cudaDeviceSynchronize();
        std::swap(grid_d,grid1_d);

        cudaError_t error = cudaGetLastError();
        if(error != cudaSuccess){
            std::cout << cudaGetErrorString(error) << std::endl;
        }
    }

    //only copy first grid to host, since it was computed and then swapped by kernel
    cudaMemcpy(grid_h,grid_d,gridSize,cudaMemcpyDeviceToHost);

    //output grid
    writeTextRepr(outFile,grid_h);

    //free host memory
    free(grid_h);
    //free device memory
    cudaFree(grid_d);
    cudaFree(grid1_d);

    //end clock
    auto endTime = std::chrono::high_resolution_clock::now();
    auto timePassed = std::chrono::duration_cast<std::chrono::milliseconds>(endTime-startTime).count();
    printf("Ran in %ld ms\n",timePassed);

    return 0;
}
	.file	"tmpxft_003a6985_00000000-6_game.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3875:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3875:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.type	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.isra.0, @function
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.isra.0:
.LFB4667:
	.cfi_startproc
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movq	(%rdi), %rax
	movb	%sil, 12(%rsp)
	movq	-24(%rax), %rax
	cmpq	$0, 16(%rdi,%rax)
	je	.L3
	leaq	12(%rsp), %rsi
	movl	$1, %edx
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
	jmp	.L2
.L3:
	movsbl	12(%rsp), %esi
	call	_ZNSo3putEc@PLT
.L2:
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4667:
	.size	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.isra.0, .-_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.isra.0
	.globl	_Z8arrayPosRKiS0_S0_
	.type	_Z8arrayPosRKiS0_S0_, @function
_Z8arrayPosRKiS0_S0_:
.LFB3865:
	.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
.LFE3865:
	.size	_Z8arrayPosRKiS0_S0_, .-_Z8arrayPosRKiS0_S0_
	.globl	_Z27__device_stub__Z6solverPbS_PbS_
	.type	_Z27__device_stub__Z6solverPbS_PbS_, @function
_Z27__device_stub__Z6solverPbS_PbS_:
.LFB3897:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movq	%rsi, (%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L9
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z6solverPbS_(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L9:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3897:
	.size	_Z27__device_stub__Z6solverPbS_PbS_, .-_Z27__device_stub__Z6solverPbS_PbS_
	.globl	_Z6solverPbS_
	.type	_Z6solverPbS_, @function
_Z6solverPbS_:
.LFB3898:
	.cfi_startproc
	endbr64
	jmp	_Z27__device_stub__Z6solverPbS_PbS_
	.cfi_endproc
.LFE3898:
	.size	_Z6solverPbS_, .-_Z6solverPbS_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z6solverPbS_"
.LC1:
	.string	"gridWidth_d"
.LC2:
	.string	"gridHeight_d"
.LC3:
	.string	"gridDepth_d"
.LC4:
	.string	"blockWidth_d"
.LC5:
	.string	"blockHeight_d"
.LC6:
	.string	"blockDepth_d"
.LC7:
	.string	"gridWidthBlocks_d"
.LC8:
	.string	"gridHeightBlocks_d"
.LC9:
	.string	"gridDepthBlocks_d"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3900:
	.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	_Z6solverPbS_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC1(%rip), %rdx
	movl	$4, %r9d
	leaq	_ZL11gridWidth_d(%rip), %rsi
	pushq	$1
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC2(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL12gridHeight_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC3(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL11gridDepth_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rdi
	.cfi_def_cfa_offset 24
	popq	%r8
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC4(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL12blockWidth_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%r9
	.cfi_def_cfa_offset 24
	popq	%r10
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC5(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL13blockHeight_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%r11
	.cfi_def_cfa_offset 24
	popq	%rax
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC6(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL12blockDepth_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC7(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL17gridWidthBlocks_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC8(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL18gridHeightBlocks_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rdi
	.cfi_def_cfa_offset 24
	popq	%r8
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC9(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movl	$4, %r9d
	movq	%rdx, %rcx
	leaq	_ZL17gridDepthBlocks_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%r9
	.cfi_def_cfa_offset 24
	popq	%r10
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3900:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC10:
	.string	"---"
	.text
	.globl	_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
	.type	_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb, @function
_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb:
.LFB3866:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3866
	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
	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
	xorl	%ebx, %ebx
	subq	$560, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 552(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rbp
	movq	%rsp, %r13
	movq	%rbp, %rdi
.LEHB0:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode@PLT
.LEHE0:
	leaq	16(%rsp), %rax
	movb	$0, 16(%rsp)
	movq	%rax, (%rsp)
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)
.L19:
	movq	%r13, %rsi
	movq	%rbp, %rdi
.LEHB1:
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
.LEHE1:
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L39
	movq	8(%rsp), %r14
	cmpq	$3, %r14
	jne	.L18
	movq	(%rsp), %rdi
	movl	$3, %edx
	leaq	.LC10(%rip), %rsi
	call	memcmp@PLT
	testl	%eax, %eax
	je	.L19
.L18:
	xorl	%eax, %eax
.L20:
	cmpq	%rax, %r14
	je	.L19
	cmpl	%ebx, gridArea(%rip)
	jle	.L21
	movq	(%rsp), %rdx
	movb	(%rdx,%rax), %dl
	cmpb	$10, %dl
	je	.L21
	movslq	%ebx, %rcx
	cmpb	$35, %dl
	sete	(%r12,%rcx)
	incl	%ebx
.L21:
	incq	%rax
	jmp	.L20
.L39:
	movl	gridArea(%rip), %eax
	cmpl	%ebx, %eax
	jg	.L29
.L25:
	movq	%r13, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	je	.L28
	jmp	.L37
.L29:
	movslq	%ebx, %rdx
.L24:
	incl	%ebx
	movb	$0, (%r12,%rdx)
	cmpl	%ebx, %eax
	jne	.L24
	jmp	.L25
.L30:
	endbr64
	movq	%rax, %rbx
.L26:
	movq	%r13, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	movq	%rbx, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L37:
	call	__stack_chk_fail@PLT
.L28:
	addq	$560, %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
.LFE3866:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3866:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3866-.LLSDACSB3866
.LLSDACSB3866:
	.uleb128 .LEHB0-.LFB3866
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3866
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L30-.LFB3866
	.uleb128 0
	.uleb128 .LEHB2-.LFB3866
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE3866:
	.text
	.size	_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb, .-_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
	.section	.rodata.str1.1
.LC11:
	.string	"---\n"
	.text
	.globl	_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
	.type	_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb, @function
_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb:
.LFB3868:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3868
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	$16, %edx
	leaq	.LC11(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rsi, %r13
	movq	%rdi, %rsi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$528, %rsp
	.cfi_def_cfa_offset 576
	movq	%fs:40, %rax
	movq	%rax, 520(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rbx
	movq	%rbx, %rdi
.LEHB3:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode@PLT
.LEHE3:
.L41:
	cmpl	%ebp, gridArea(%rip)
	jle	.L57
	cmpb	$0, 0(%r13,%rbp)
	movl	$32, %esi
	je	.L56
	movl	$35, %esi
.L56:
	movq	%rbx, %rdi
.LEHB4:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.isra.0
	leal	1(%rbp), %r12d
	movl	%r12d, %eax
	cltd
	idivl	gridWidth(%rip)
	testl	%edx, %edx
	jne	.L44
	movl	$10, %esi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.isra.0
.L44:
	movl	gridWidth(%rip), %ecx
	imull	gridHeight(%rip), %ecx
	movl	%r12d, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L47
	movq	%r14, %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.LEHE4:
.L47:
	incq	%rbp
	jmp	.L41
.L57:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	520(%rsp), %rax
	subq	%fs:40, %rax
	je	.L51
	jmp	.L53
.L52:
	endbr64
	movq	%rax, %rbp
.L49:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	520(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L53
	movq	%rbp, %rdi
.LEHB5:
	call	_Unwind_Resume@PLT
.LEHE5:
.L53:
	call	__stack_chk_fail@PLT
.L51:
	addq	$528, %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
.LFE3868:
	.section	.gcc_except_table
.LLSDA3868:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3868-.LLSDACSB3868
.LLSDACSB3868:
	.uleb128 .LEHB3-.LFB3868
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB4-.LFB3868
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L52-.LFB3868
	.uleb128 0
	.uleb128 .LEHB5-.LFB3868
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
.LLSDACSE3868:
	.text
	.size	_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb, .-_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
	.section	.rodata._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.str1.1,"aMS",@progbits,1
.LC12:
	.string	"basic_string: construction from null is not valid"
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_,comdat
	.align 2
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_:
.LFB4267:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	jne	.L59
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L64
	leaq	.LC12(%rip), %rdi
	call	_ZSt19__throw_logic_errorPKc@PLT
.L59:
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	movq	%rsi, %rbp
	call	strlen@PLT
	movq	%rax, (%rsp)
	leaq	0(%rbp,%rax), %r12
	cmpq	$15, %rax
	jbe	.L61
	movq	%rsp, %rsi
	xorl	%edx, %edx
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
	movq	%rax, (%rbx)
	movq	(%rsp), %rax
	movq	%rax, 16(%rbx)
.L61:
	movq	(%rbx), %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	(%rsp), %rax
	movq	(%rbx), %rdx
	movq	%rax, 8(%rbx)
	movb	$0, (%rdx,%rax)
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L62
.L64:
	call	__stack_chk_fail@PLT
.L62:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4267:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	.set	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.section	.rodata.str1.1
.LC13:
	.string	"in.txt"
.LC14:
	.string	"out.txt"
.LC15:
	.string	"%d"
.LC16:
	.string	"-i"
.LC17:
	.string	"Error: Missing arguments for -i\n"
.LC18:
	.string	"-o"
.LC19:
	.string	"Error: Missing arguments for -o\n"
.LC20:
	.string	"-t"
.LC21:
	.string	"Error: Missing arguments for -t\n"
.LC22:
	.string	"-g"
.LC23:
	.string	"Error: Missing arguments for -g\n"
.LC24:
	.string	"-b"
.LC25:
	.string	"Error: Missing arguments for -b\n"
.LC26:
	.string	"Error: Parameters must be of form:\n"
.LC27:
	.string	"./game [-i infile] [-o outfile] [-t timesteps] [-g griddimensions] [-b blockdimensions]\n"
.LC28:
	.string	"In file = "
.LC29:
	.string	"\n"
.LC30:
	.string	"Out file = "
.LC31:
	.string	"Time steps = %d\n"
.LC32:
	.string	"Grid dimensions = %dx%dx%d\n"
.LC33:
	.string	"Block dimensions = %dx%dx%d\n"
.LC34:
	.string	"Grid in blocks = %dx%dx%d\n"
.LC35:
	.string	"..."
.LC36:
	.string	"Ran in %ld ms\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3869:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3869
	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
	movl	%edi, %r13d
	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
	movq	%rsi, %rbx
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %rbp
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movq	%rbp, %rdx
	leaq	.LC13(%rip), %rsi
	movq	%rax, %r15
	leaq	56(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, (%rsp)
.LEHB6:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE6:
	leaq	88(%rsp), %rax
	movq	%rbp, %rdx
	leaq	.LC14(%rip), %rsi
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
.LEHB7:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE7:
	movl	$1, timeSteps(%rip)
	movl	$1, %ebp
	movl	$16, gridWidth(%rip)
	movl	$16, gridHeight(%rip)
	movl	$16, gridDepth(%rip)
	movl	$16, blockWidth(%rip)
	movl	$16, blockHeight(%rip)
	movl	$1, blockDepth(%rip)
.L66:
	cmpl	%r13d, %ebp
	jge	.L110
	movl	%ebp, %edx
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
.LEHB8:
	call	__printf_chk@PLT
	movslq	%ebp, %rax
	leaq	.LC16(%rip), %rsi
	movq	(%rbx,%rax,8), %r14
	leaq	0(,%rax,8), %r12
	movq	%r14, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L67
	leal	2(%rbp), %eax
	cmpl	%r13d, %eax
	jg	.L68
	movq	8(%rbx,%r12), %r12
	movq	%r12, %rdi
	call	strlen@PLT
	movq	64(%rsp), %rdx
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	movq	%rax, %r8
	movq	%r12, %rcx
	jmp	.L109
.L68:
	leaq	.LC17(%rip), %rsi
.L103:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %ebx
	jmp	.L70
.L67:
	leaq	.LC18(%rip), %rsi
	movq	%r14, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L71
	leal	2(%rbp), %eax
	cmpl	%r13d, %eax
	jg	.L72
	movq	8(%rbx,%r12), %r12
	movq	%r12, %rdi
	call	strlen@PLT
	movq	96(%rsp), %rdx
	movq	%r12, %rcx
	xorl	%esi, %esi
	movq	8(%rsp), %rdi
	movq	%rax, %r8
.L109:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm@PLT
	jmp	.L82
.L72:
	leaq	.LC19(%rip), %rsi
	jmp	.L103
.L71:
	leaq	.LC20(%rip), %rsi
	movq	%r14, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L74
	leal	2(%rbp), %eax
	cmpl	%r13d, %eax
	jg	.L75
	movq	8(%rbx,%r12), %rdi
	movl	$10, %edx
	xorl	%esi, %esi
	call	__isoc23_strtol@PLT
	movl	%eax, timeSteps(%rip)
.L82:
	movl	$2, %eax
	jmp	.L76
.L75:
	leaq	.LC21(%rip), %rsi
	jmp	.L103
.L74:
	leaq	.LC22(%rip), %rsi
	movq	%r14, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L77
	leal	4(%rbp), %eax
	cmpl	%r13d, %eax
	jg	.L78
	movq	8(%rbx,%r12), %rdi
	movl	$10, %edx
	xorl	%esi, %esi
	call	__isoc23_strtol@PLT
	movq	16(%rbx,%r12), %rdi
	movl	$10, %edx
	xorl	%esi, %esi
	movl	%eax, gridWidth(%rip)
	call	__isoc23_strtol@PLT
	movq	24(%rbx,%r12), %rdi
	movl	$10, %edx
	xorl	%esi, %esi
	movl	%eax, gridHeight(%rip)
	call	__isoc23_strtol@PLT
	movl	%eax, gridDepth(%rip)
	jmp	.L79
.L78:
	leaq	.LC23(%rip), %rsi
	jmp	.L103
.L77:
	leaq	.LC24(%rip), %rsi
	movq	%r14, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L80
	leal	4(%rbp), %eax
	cmpl	%r13d, %eax
	jg	.L81
	movq	8(%rbx,%r12), %rdi
	movl	$10, %edx
	xorl	%esi, %esi
	call	__isoc23_strtol@PLT
	movq	16(%rbx,%r12), %rdi
	movl	$10, %edx
	xorl	%esi, %esi
	movl	%eax, blockWidth(%rip)
	call	__isoc23_strtol@PLT
	movq	24(%rbx,%r12), %rdi
	movl	$10, %edx
	xorl	%esi, %esi
	movl	%eax, blockHeight(%rip)
	call	__isoc23_strtol@PLT
	movl	%eax, blockDepth(%rip)
.L79:
	movl	$4, %eax
	jmp	.L76
.L81:
	leaq	.LC25(%rip), %rsi
	jmp	.L103
.L80:
	leaq	.LC26(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC27(%rip), %rsi
	jmp	.L103
.L76:
	addl	%eax, %ebp
	jmp	.L66
.L110:
	movl	gridWidth(%rip), %ebx
	cvtsi2ssl	blockWidth(%rip), %xmm1
	cvtsi2ssl	%ebx, %xmm0
	divss	%xmm1, %xmm0
	call	ceilf@PLT
	movl	gridHeight(%rip), %r12d
	cvtsi2ssl	blockHeight(%rip), %xmm1
	cvttss2sil	%xmm0, %eax
	cvtsi2ssl	%r12d, %xmm0
	imull	%r12d, %ebx
	movl	%eax, gridWidthBlocks(%rip)
	divss	%xmm1, %xmm0
	call	ceilf@PLT
	movl	gridDepth(%rip), %ebp
	cvtsi2ssl	blockDepth(%rip), %xmm1
	cvttss2sil	%xmm0, %eax
	cvtsi2ssl	%ebp, %xmm0
	imull	%ebp, %ebx
	leaq	_ZSt4cout(%rip), %rbp
	movl	%eax, gridHeightBlocks(%rip)
	divss	%xmm1, %xmm0
	call	ceilf@PLT
	leaq	.LC28(%rip), %rsi
	movq	%rbp, %rdi
	movl	%ebx, gridArea(%rip)
	cvttss2sil	%xmm0, %eax
	movl	%eax, gridDepthBlocks(%rip)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	(%rsp), %rsi
	movq	%rax, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	leaq	.LC29(%rip), %rbx
	movq	%rax, %rdi
	movq	%rbx, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC30(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	8(%rsp), %rsi
	movq	%rax, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	%rax, %rdi
	movq	%rbx, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	timeSteps(%rip), %edx
	leaq	.LC31(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	gridDepth(%rip), %r8d
	movl	gridHeight(%rip), %ecx
	xorl	%eax, %eax
	leaq	.LC32(%rip), %rsi
	movl	gridWidth(%rip), %edx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	blockDepth(%rip), %r8d
	movl	blockHeight(%rip), %ecx
	xorl	%eax, %eax
	leaq	.LC33(%rip), %rsi
	movl	blockWidth(%rip), %edx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	gridDepthBlocks(%rip), %r8d
	movl	gridHeightBlocks(%rip), %ecx
	xorl	%eax, %eax
	leaq	.LC34(%rip), %rsi
	movl	gridWidthBlocks(%rip), %edx
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC35(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	gridWidth(%rip), %rsi
	leaq	_ZL11gridWidth_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	gridHeight(%rip), %rsi
	leaq	_ZL12gridHeight_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	gridDepth(%rip), %rsi
	leaq	_ZL11gridDepth_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	blockWidth(%rip), %rsi
	leaq	_ZL12blockWidth_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	blockHeight(%rip), %rsi
	leaq	_ZL13blockHeight_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	blockDepth(%rip), %rsi
	leaq	_ZL12blockDepth_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	gridWidthBlocks(%rip), %rsi
	leaq	_ZL17gridWidthBlocks_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	gridHeightBlocks(%rip), %rsi
	leaq	_ZL18gridHeightBlocks_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	gridDepthBlocks(%rip), %rsi
	leaq	_ZL17gridDepthBlocks_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	gridWidthBlocks(%rip), %eax
	movl	gridWidth(%rip), %ebx
	movl	$1, %esi
	imull	gridHeight(%rip), %ebx
	movl	%eax, 32(%rsp)
	movl	gridHeightBlocks(%rip), %eax
	imull	gridDepth(%rip), %ebx
	movl	%eax, 36(%rsp)
	movl	gridDepthBlocks(%rip), %eax
	movl	%eax, 40(%rsp)
	movl	blockWidth(%rip), %eax
	movslq	%ebx, %rbx
	movq	%rbx, %rdi
	movl	%eax, 44(%rsp)
	movl	blockHeight(%rip), %eax
	movl	%eax, 48(%rsp)
	movl	blockDepth(%rip), %eax
	movl	%eax, 52(%rsp)
	call	calloc@PLT
	leaq	16(%rsp), %rdi
	movq	%rbx, %rsi
	movq	%rax, %rbp
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdi
	movq	%rbp, %rsi
	call	_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	call	cudaMemcpy@PLT
	xorl	%r12d, %r12d
	leaq	_ZSt4cout(%rip), %r13
.L84:
	cmpl	%r12d, timeSteps(%rip)
	jle	.L111
	movl	52(%rsp), %ecx
	movq	44(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	32(%rsp), %rdi
	movl	40(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L85
.L87:
	call	cudaDeviceSynchronize@PLT
	jmp	.L112
.L85:
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdi
	call	_Z27__device_stub__Z6solverPbS_PbS_
	jmp	.L87
.L112:
	movq	16(%rsp), %rax
	movq	24(%rsp), %rdx
	movq	%rax, 24(%rsp)
	movq	%rdx, 16(%rsp)
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L88
.L89:
	incl	%r12d
	jmp	.L84
.L88:
	call	cudaGetErrorString@PLT
	movq	%rax, %rsi
	movq	%r13, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	jmp	.L89
.L111:
	movq	16(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdx
	movq	%rbp, %rdi
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdi
	movq	%rbp, %rsi
	call	_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
	movq	%rbp, %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movl	$1000000, %ecx
	movl	$2, %edi
	leaq	.LC36(%rip), %rsi
	subq	%r15, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.LEHE8:
	xorl	%ebx, %ebx
.L70:
	movq	8(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L94
	jmp	.L100
.L97:
	endbr64
	movq	%rax, %rbx
.L91:
	movq	8(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L92
.L96:
	endbr64
	movq	%rax, %rbx
.L92:
	movq	(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L100
	movq	%rbx, %rdi
.LEHB9:
	call	_Unwind_Resume@PLT
.LEHE9:
.L100:
	call	__stack_chk_fail@PLT
.L94:
	addq	$136, %rsp
	.cfi_def_cfa_offset 56
	movl	%ebx, %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
.LFE3869:
	.section	.gcc_except_table
.LLSDA3869:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3869-.LLSDACSB3869
.LLSDACSB3869:
	.uleb128 .LEHB6-.LFB3869
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB7-.LFB3869
	.uleb128 .LEHE7-.LEHB7
	.uleb128 .L96-.LFB3869
	.uleb128 0
	.uleb128 .LEHB8-.LFB3869
	.uleb128 .LEHE8-.LEHB8
	.uleb128 .L97-.LFB3869
	.uleb128 0
	.uleb128 .LEHB9-.LFB3869
	.uleb128 .LEHE9-.LEHB9
	.uleb128 0
	.uleb128 0
.LLSDACSE3869:
	.section	.text.startup
	.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
	.globl	timeSteps
	.bss
	.align 4
	.type	timeSteps, @object
	.size	timeSteps, 4
timeSteps:
	.zero	4
	.local	_ZL17gridDepthBlocks_d
	.comm	_ZL17gridDepthBlocks_d,4,4
	.local	_ZL18gridHeightBlocks_d
	.comm	_ZL18gridHeightBlocks_d,4,4
	.local	_ZL17gridWidthBlocks_d
	.comm	_ZL17gridWidthBlocks_d,4,4
	.local	_ZL12blockDepth_d
	.comm	_ZL12blockDepth_d,4,4
	.local	_ZL13blockHeight_d
	.comm	_ZL13blockHeight_d,4,4
	.local	_ZL12blockWidth_d
	.comm	_ZL12blockWidth_d,4,4
	.local	_ZL11gridDepth_d
	.comm	_ZL11gridDepth_d,4,4
	.local	_ZL12gridHeight_d
	.comm	_ZL12gridHeight_d,4,4
	.local	_ZL11gridWidth_d
	.comm	_ZL11gridWidth_d,4,4
	.globl	gridArea
	.align 4
	.type	gridArea, @object
	.size	gridArea, 4
gridArea:
	.zero	4
	.globl	gridDepthBlocks
	.align 4
	.type	gridDepthBlocks, @object
	.size	gridDepthBlocks, 4
gridDepthBlocks:
	.zero	4
	.globl	gridHeightBlocks
	.align 4
	.type	gridHeightBlocks, @object
	.size	gridHeightBlocks, 4
gridHeightBlocks:
	.zero	4
	.globl	gridWidthBlocks
	.align 4
	.type	gridWidthBlocks, @object
	.size	gridWidthBlocks, 4
gridWidthBlocks:
	.zero	4
	.globl	blockDepth
	.align 4
	.type	blockDepth, @object
	.size	blockDepth, 4
blockDepth:
	.zero	4
	.globl	blockHeight
	.align 4
	.type	blockHeight, @object
	.size	blockHeight, 4
blockHeight:
	.zero	4
	.globl	blockWidth
	.align 4
	.type	blockWidth, @object
	.size	blockWidth, 4
blockWidth:
	.zero	4
	.globl	gridDepth
	.align 4
	.type	gridDepth, @object
	.size	gridDepth, 4
gridDepth:
	.zero	4
	.globl	gridHeight
	.align 4
	.type	gridHeight, @object
	.size	gridHeight, 4
gridHeight:
	.zero	4
	.globl	gridWidth
	.align 4
	.type	gridWidth, @object
	.size	gridWidth, 4
gridWidth:
	.zero	4
	.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<stdlib.h>
#include<iostream>
#include<cmath>
#include<fstream>
#include<chrono>



//shared host/device constants
int gridWidth,gridHeight,gridDepth,blockWidth,blockHeight,blockDepth,gridWidthBlocks,gridHeightBlocks,gridDepthBlocks,gridArea;
__constant__ int gridWidth_d,gridHeight_d,gridDepth_d,blockWidth_d,blockHeight_d,blockDepth_d,gridWidthBlocks_d,gridHeightBlocks_d,gridDepthBlocks_d;

//host only constants
int timeSteps;



__device__ int arrayPos(const int &x,const int &y,const int &z){
    return (z*gridWidth_d*gridHeight_d)+(y*gridWidth_d)+x;
}



__global__ void solver(bool *grid,bool *grid1){
    int xpos = (blockIdx.x*blockWidth_d)+threadIdx.x;
    int ypos = (blockIdx.y*blockHeight_d)+threadIdx.y;
    int zpos = (blockIdx.z*blockDepth_d)+threadIdx.z;

    if(xpos>0 && xpos<gridWidth_d-1 && ypos>0 && ypos<gridHeight_d-1 && zpos>0 && zpos<gridDepth_d-1){
        int neighbors = grid[arrayPos(xpos+1,ypos,zpos)]+grid[arrayPos(xpos-1,ypos,zpos)]
                        +grid[arrayPos(xpos,ypos+1,zpos)]+grid[arrayPos(xpos,ypos-1,zpos)]
                        +grid[arrayPos(xpos,ypos,zpos+1)]+grid[arrayPos(xpos,ypos,zpos-1)];

        if(grid[arrayPos(xpos,ypos,zpos)]){
            if(neighbors<2 || neighbors>3){
                grid1[arrayPos(xpos,ypos,zpos)] = false;
            }else{
                grid1[arrayPos(xpos,ypos,zpos)] = true;
            }
        }else{
            if(neighbors==3){
                grid1[arrayPos(xpos,ypos,zpos)] = true;
            }else{
                grid1[arrayPos(xpos,ypos,zpos)] = false;
            }
        }
    }
}



//helper function to read grid from a text file
void readTextRepr(const std::string& filename,bool *array){
    std::ifstream file(filename);
    std::string str;
    int index=0;

    while(std::getline(file,str)){
        if(str!="---"){
            for(int i=0;i<str.length();i++){
                //stop reading if file is greater than arrayLength
                if(index<gridArea){
                    if(str[i]!='\n'){
                        if(str[i]=='#'){
                            array[index]=true;
                        }else{
                            array[index]=false;
                        }
                        index++;
                    }
                }
            }
        }
    }
    //fill in excess space with falses if file is too short
    if(index<gridArea){
        for(int i=index;i<gridArea;i++){
            array[index]=false;
        }
    }
}



//helper function to write grid to a text file
void writeTextRepr(const std::string& filename,bool *array){
    std::ofstream file(filename);
    for(int i=0;i<gridArea;i++){
        if(array[i]){
            file<<'#';
        }else{
            file<<' ';
        }
        if((i+1)%gridWidth==0){
            file<<'\n';
        }
        if((i+1)%(gridWidth*gridHeight)==0){
            file<<"---\n";
        }
    }
}



int main(int argc, const char * argv[]){
    //start clock
    auto startTime = std::chrono::high_resolution_clock::now();

    //input and output files
    std::string inFile = "in.txt";
    std::string outFile = "out.txt";

    //time of simulation
    timeSteps = 1;

    //dimensions of the grid
    gridWidth = 16;
    gridHeight = 16;
    gridDepth = 16;

    /*
    Speed testing with varying grid and block sizes, using both 3D and 2D kernel implementations
        16x16x16 grid, 2mil steps:
            3D Kernel
            16x16x1 = 18921ms
            8x8x16  = 21150ms
            8x8x8   = 19432ms
            4x4x4   = 21614ms
            2x2x2   = 24362ms

            2D Kernel
            16x16   = 19389ms
            8x8     = 19425ms
            4x4     = 19992ms

        64x64x64 grid, 2mil steps:
            3D Kernel
            16x16x1 = 44162ms
            8x8x8   = 61221ms
            8x8x4   = 62442ms
            
            2D Kernel
            16x16   = 47543ms

        2048x2048x128 grid, 100 steps:
            3D Kernel
            16x16x1 = 15065ms
            8x8x8   = 18386ms

    The fastest block size across both small and large grids appears to be 16x16x1, using the 3D kernel
    */
    blockWidth = 16;
    blockHeight = 16;
    blockDepth = 1;



    //handle command line arguments
    int optionLen = 0;
    for(int i=1;i<argc;i+=optionLen){
        printf("%d",i);
        if(strcmp(argv[i],"-i")==0){
            optionLen = 2;
            if(i+optionLen<=argc){
                inFile = argv[i+1];
            }else{
                printf("Error: Missing arguments for -i\n");
                return 1;
            }
        }else if(strcmp(argv[i],"-o")==0){
            optionLen = 2;
            if(i+optionLen<=argc){
                outFile = argv[i+1];
            }else{
                printf("Error: Missing arguments for -o\n");
                return 1;
            }
        }else if(strcmp(argv[i],"-t")==0){
            optionLen = 2;
            if(i+optionLen<=argc){
                timeSteps = strtol(argv[i+1],NULL,10);
            }else{
                printf("Error: Missing arguments for -t\n");
                return 1;
            }
        }else if(strcmp(argv[i],"-g")==0){
            optionLen = 4;
            if(i+optionLen<=argc){
                gridWidth = strtol(argv[i+1],NULL,10);
                gridHeight = strtol(argv[i+2],NULL,10);
                gridDepth = strtol(argv[i+3],NULL,10);
            }else{
                printf("Error: Missing arguments for -g\n");
                return 1;
            }
        }else if(strcmp(argv[i],"-b")==0){
            optionLen = 4;
            if(i+optionLen<=argc){
                blockWidth = strtol(argv[i+1],NULL,10);
                blockHeight = strtol(argv[i+2],NULL,10);
                blockDepth = strtol(argv[i+3],NULL,10);
            }else{
                printf("Error: Missing arguments for -b\n");
                return 1;
            }
        }else{
            printf("Error: Parameters must be of form:\n");
            printf("./game [-i infile] [-o outfile] [-t timesteps] [-g griddimensions] [-b blockdimensions]\n");
            return 1;
        }
    }



    //derived values
    gridWidthBlocks = std::ceil((float)gridWidth/(float)blockWidth);
    gridHeightBlocks = std::ceil((float)gridHeight/(float)blockHeight);
    gridDepthBlocks = std::ceil((float)gridDepth/(float)blockDepth);
    gridArea = gridWidth*gridHeight*gridDepth;



    std::cout << "In file = " << inFile << "\n";
    std::cout << "Out file = " << outFile << "\n";
    printf("Time steps = %d\n",timeSteps);
    printf("Grid dimensions = %dx%dx%d\n",gridWidth,gridHeight,gridDepth);
    printf("Block dimensions = %dx%dx%d\n",blockWidth,blockHeight,blockDepth);
    printf("Grid in blocks = %dx%dx%d\n",gridWidthBlocks,gridHeightBlocks,gridDepthBlocks);
    printf("...");

    

    //set device symbols to dimensions of grid,block,etc.
    hipMemcpyToSymbol(HIP_SYMBOL(*(&gridWidth_d)),&gridWidth,sizeof(int),0,hipMemcpyHostToDevice);
    hipMemcpyToSymbol(HIP_SYMBOL(*(&gridHeight_d)),&gridHeight,sizeof(int),0,hipMemcpyHostToDevice);
    hipMemcpyToSymbol(HIP_SYMBOL(*(&gridDepth_d)),&gridDepth,sizeof(int),0,hipMemcpyHostToDevice);
    hipMemcpyToSymbol(HIP_SYMBOL(*(&blockWidth_d)),&blockWidth,sizeof(int),0,hipMemcpyHostToDevice);
    hipMemcpyToSymbol(HIP_SYMBOL(*(&blockHeight_d)),&blockHeight,sizeof(int),0,hipMemcpyHostToDevice);
    hipMemcpyToSymbol(HIP_SYMBOL(*(&blockDepth_d)),&blockDepth,sizeof(int),0,hipMemcpyHostToDevice);
    hipMemcpyToSymbol(HIP_SYMBOL(*(&gridWidthBlocks_d)),&gridWidthBlocks,sizeof(int),0,hipMemcpyHostToDevice);
    hipMemcpyToSymbol(HIP_SYMBOL(*(&gridHeightBlocks_d)),&gridHeightBlocks,sizeof(int),0,hipMemcpyHostToDevice);
    hipMemcpyToSymbol(HIP_SYMBOL(*(&gridDepthBlocks_d)),&gridDepthBlocks,sizeof(int),0,hipMemcpyHostToDevice);

    dim3 numBlocks(gridWidthBlocks,gridHeightBlocks,gridDepthBlocks);
    dim3 blockSize(blockWidth,blockHeight,blockDepth);

    size_t gridSize = gridWidth*gridHeight*gridDepth;

    //device+host grid arrays
    bool *grid_h;
    bool *grid_d,*grid1_d;

    //allocate host memory
    grid_h = (bool *)calloc(gridSize,sizeof(bool));

    //allocate device memory
    hipMalloc((void **)&grid_d, gridSize);
    hipMalloc((void **)&grid1_d, gridSize);

    //load grid
    readTextRepr(inFile,grid_h);
    
    //only copy first grid to device, second one is computed by kernel
    hipMemcpy(grid_d,grid_h,gridSize,hipMemcpyHostToDevice);

    for(int i=0;i<timeSteps;i++){
        solver<<<numBlocks,blockSize>>>(grid_d,grid1_d);
        hipDeviceSynchronize();
        std::swap(grid_d,grid1_d);

        hipError_t error = hipGetLastError();
        if(error != hipSuccess){
            std::cout << hipGetErrorString(error) << std::endl;
        }
    }

    //only copy first grid to host, since it was computed and then swapped by kernel
    hipMemcpy(grid_h,grid_d,gridSize,hipMemcpyDeviceToHost);

    //output grid
    writeTextRepr(outFile,grid_h);

    //free host memory
    free(grid_h);
    //free device memory
    hipFree(grid_d);
    hipFree(grid1_d);

    //end clock
    auto endTime = std::chrono::high_resolution_clock::now();
    auto timePassed = std::chrono::duration_cast<std::chrono::milliseconds>(endTime-startTime).count();
    printf("Ran in %ld ms\n",timePassed);

    return 0;
}
	.text
	.file	"game.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z21__device_stub__solverPbS_   # -- Begin function _Z21__device_stub__solverPbS_
	.type	_Z21__device_stub__solverPbS_,@function
_Z21__device_stub__solverPbS_:          # @_Z21__device_stub__solverPbS_
	.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	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	16(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%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	$_Z6solverPbS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	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	_Z21__device_stub__solverPbS_, .Lfunc_end0-_Z21__device_stub__solverPbS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb # -- Begin function _Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
	.type	_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb,@function
_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb: # @_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %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	$560, %rsp                      # imm = 0x230
	.cfi_def_cfa_offset 608
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %rbx
	movq	%rdi, %rsi
	leaq	40(%rsp), %r14
	movq	%r14, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode
	leaq	24(%rsp), %r12
	movq	%r12, -16(%r12)
	movq	$0, -8(%r12)
	movb	$0, (%r12)
	xorl	%r13d, %r13d
	leaq	8(%rsp), %r15
.LBB1_1:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_9 Depth 2
	movq	40(%rsp), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp0:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp1:
# %bb.2:                                # %.noexc
                                        #   in Loop: Header=BB1_1 Depth=1
.Ltmp2:
	movsbl	%al, %edx
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp3:
# %bb.3:                                #   in Loop: Header=BB1_1 Depth=1
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB1_18
# %bb.4:                                #   in Loop: Header=BB1_1 Depth=1
	movq	16(%rsp), %rax
	testq	%rax, %rax
	je	.LBB1_1
# %bb.5:                                #   in Loop: Header=BB1_1 Depth=1
	cmpq	$3, %rax
	jne	.LBB1_7
# %bb.6:                                #   in Loop: Header=BB1_1 Depth=1
	movq	8(%rsp), %rcx
	movzwl	(%rcx), %edx
	xorl	$11565, %edx                    # imm = 0x2D2D
	movzbl	2(%rcx), %esi
	xorl	$45, %esi
	orw	%dx, %si
	jne	.LBB1_8
	jmp	.LBB1_1
.LBB1_7:                                # %_ZStneIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit.preheader..lr.ph_crit_edge
                                        #   in Loop: Header=BB1_1 Depth=1
	movq	8(%rsp), %rcx
.LBB1_8:                                # %.lr.ph
                                        #   in Loop: Header=BB1_1 Depth=1
	movl	gridArea(%rip), %edx
	cmpq	$1, %rax
	adcq	$0, %rax
	xorl	%esi, %esi
.LBB1_9:                                #   Parent Loop BB1_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpl	%edx, %r13d
	jge	.LBB1_14
# %bb.10:                               #   in Loop: Header=BB1_9 Depth=2
	movzbl	(%rcx,%rsi), %r8d
	cmpl	$10, %r8d
	je	.LBB1_14
# %bb.11:                               #   in Loop: Header=BB1_9 Depth=2
	movb	$1, %dil
	cmpl	$35, %r8d
	je	.LBB1_13
# %bb.12:                               #   in Loop: Header=BB1_9 Depth=2
	xorl	%edi, %edi
.LBB1_13:                               #   in Loop: Header=BB1_9 Depth=2
	movslq	%r13d, %r8
	movb	%dil, (%rbx,%r8)
	incl	%r13d
.LBB1_14:                               # %_ZStneIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit
                                        #   in Loop: Header=BB1_9 Depth=2
	incq	%rsi
	cmpq	%rsi, %rax
	jne	.LBB1_9
	jmp	.LBB1_1
.LBB1_18:
	cmpl	gridArea(%rip), %r13d
	jge	.LBB1_20
# %bb.19:                               # %.preheader
	movslq	%r13d, %rax
	movb	$0, (%rbx,%rax)
.LBB1_20:                               # %.loopexit
	movq	8(%rsp), %rdi
	cmpq	%r12, %rdi
	je	.LBB1_22
# %bb.21:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i22
	callq	_ZdlPv
.LBB1_22:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit24
	leaq	40(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	addq	$560, %rsp                      # imm = 0x230
	.cfi_def_cfa_offset 48
	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
.LBB1_15:
	.cfi_def_cfa_offset 608
.Ltmp4:
	movq	%rax, %rbx
	movq	8(%rsp), %rdi
	cmpq	%r12, %rdi
	je	.LBB1_17
# %bb.16:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB1_17:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	leaq	40(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end1:
	.size	_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb, .Lfunc_end1-_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table1:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp3-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp3
	.uleb128 .Ltmp4-.Lfunc_begin0           #     jumps to .Ltmp4
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Lfunc_end1-.Ltmp3             #   Call between .Ltmp3 and .Lfunc_end1
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb # -- Begin function _Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
	.type	_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb,@function
_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb: # @_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$520, %rsp                      # imm = 0x208
	.cfi_def_cfa_offset 560
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %rbx
	movq	%rdi, %rsi
	leaq	8(%rsp), %rdi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode
	cmpl	$0, gridArea(%rip)
	jle	.LBB2_18
# %bb.1:                                # %.lr.ph.preheader
	xorl	%r14d, %r14d
	leaq	8(%rsp), %r15
	leaq	7(%rsp), %r12
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	cmpb	$0, (%rbx,%r14)
	je	.LBB2_7
# %bb.3:                                #   in Loop: Header=BB2_2 Depth=1
	movb	$35, 7(%rsp)
	movq	8(%rsp), %rax
	movq	-24(%rax), %rax
	cmpq	$0, 24(%rsp,%rax)
	je	.LBB2_5
# %bb.4:                                #   in Loop: Header=BB2_2 Depth=1
.Ltmp5:
	movl	$1, %edx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp6:
	jmp	.LBB2_10
.LBB2_7:                                #   in Loop: Header=BB2_2 Depth=1
	movb	$32, 7(%rsp)
	movq	8(%rsp), %rax
	movq	-24(%rax), %rax
	cmpq	$0, 24(%rsp,%rax)
	je	.LBB2_9
# %bb.8:                                #   in Loop: Header=BB2_2 Depth=1
.Ltmp9:
	movl	$1, %edx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp10:
	jmp	.LBB2_10
.LBB2_5:                                #   in Loop: Header=BB2_2 Depth=1
.Ltmp7:
	movq	%r15, %rdi
	movl	$35, %esi
	callq	_ZNSo3putEc
.Ltmp8:
	jmp	.LBB2_10
.LBB2_9:                                #   in Loop: Header=BB2_2 Depth=1
.Ltmp11:
	movq	%r15, %rdi
	movl	$32, %esi
	callq	_ZNSo3putEc
.Ltmp12:
.LBB2_10:                               #   in Loop: Header=BB2_2 Depth=1
	incq	%r14
	movl	gridWidth(%rip), %ecx
	movl	%r14d, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.LBB2_15
# %bb.11:                               #   in Loop: Header=BB2_2 Depth=1
	movb	$10, 7(%rsp)
	movq	8(%rsp), %rax
	movq	-24(%rax), %rax
	cmpq	$0, 24(%rsp,%rax)
	je	.LBB2_13
# %bb.12:                               #   in Loop: Header=BB2_2 Depth=1
.Ltmp13:
	movl	$1, %edx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp14:
	jmp	.LBB2_14
.LBB2_13:                               #   in Loop: Header=BB2_2 Depth=1
.Ltmp15:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNSo3putEc
.Ltmp16:
.LBB2_14:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.exit18
                                        #   in Loop: Header=BB2_2 Depth=1
	movl	gridWidth(%rip), %ecx
.LBB2_15:                               #   in Loop: Header=BB2_2 Depth=1
	imull	gridHeight(%rip), %ecx
	movl	%r14d, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.LBB2_17
# %bb.16:                               #   in Loop: Header=BB2_2 Depth=1
.Ltmp17:
	movl	$.L.str.1, %esi
	movl	$4, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp18:
.LBB2_17:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB2_2 Depth=1
	movslq	gridArea(%rip), %rax
	cmpq	%rax, %r14
	jl	.LBB2_2
.LBB2_18:                               # %._crit_edge
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	16(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 8(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	256(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	addq	$520, %rsp                      # imm = 0x208
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB2_6:
	.cfi_def_cfa_offset 560
.Ltmp19:
	movq	%rax, %rbx
	leaq	8(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end2:
	.size	_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb, .Lfunc_end2-_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table2:
.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 .Ltmp5-.Lfunc_begin1           #   Call between .Lfunc_begin1 and .Ltmp5
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp5-.Lfunc_begin1           # >> Call Site 2 <<
	.uleb128 .Ltmp18-.Ltmp5                 #   Call between .Ltmp5 and .Ltmp18
	.uleb128 .Ltmp19-.Lfunc_begin1          #     jumps to .Ltmp19
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp18-.Lfunc_begin1          # >> Call Site 3 <<
	.uleb128 .Lfunc_end2-.Ltmp18            #   Call between .Ltmp18 and .Lfunc_end2
	.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
.Lfunc_begin2:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception2
# %bb.0:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit
	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	$120, %rsp
	.cfi_def_cfa_offset 176
	.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, (%rsp)                    # 8-byte Spill
	movl	%edi, %ebp
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, 112(%rsp)                 # 8-byte Spill
	leaq	72(%rsp), %rax
	movq	%rax, -16(%rax)
	leaq	56(%rsp), %rdi
	movl	$.L.str.2, %esi
	movl	$.L.str.2+6, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	leaq	40(%rsp), %rax
	movq	%rax, -16(%rax)
.Ltmp20:
	leaq	24(%rsp), %rdi
	movl	$.L.str.3, %esi
	movl	$.L.str.3+7, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
.Ltmp21:
# %bb.1:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit104
	movl	$1, %r13d
	movl	%r13d, timeSteps(%rip)
	movl	$16, %ebx
	movl	%ebx, gridWidth(%rip)
	movl	%ebx, gridHeight(%rip)
	movl	%ebx, gridDepth(%rip)
	movl	%ebx, blockWidth(%rip)
	movl	%ebx, blockHeight(%rip)
	movl	%r13d, blockDepth(%rip)
	movl	$16, %r14d
	movl	$16, %r12d
	movl	$16, %eax
	movl	$16, %r15d
	cmpl	$2, %ebp
	jl	.LBB3_23
# %bb.2:                                # %.lr.ph
	movl	$1, %r15d
	movq	(%rsp), %r14                    # 8-byte Reload
.LBB3_3:                                # =>This Inner Loop Header: Depth=1
	movl	$.L.str.4, %edi
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	printf
	movl	%r15d, %eax
	leaq	(%r14,%rax,8), %rbx
	movq	(%rbx), %r13
	movl	$.L.str.5, %esi
	movq	%r13, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB3_4
# %bb.8:                                #   in Loop: Header=BB3_3 Depth=1
	movl	$.L.str.7, %esi
	movq	%r13, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB3_9
# %bb.12:                               #   in Loop: Header=BB3_3 Depth=1
	movl	$.L.str.9, %esi
	movq	%r13, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB3_13
# %bb.16:                               #   in Loop: Header=BB3_3 Depth=1
	movl	$.L.str.11, %esi
	movq	%r13, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB3_17
# %bb.54:                               #   in Loop: Header=BB3_3 Depth=1
	movl	$.L.str.13, %esi
	movq	%r13, %rdi
	callq	strcmp
	testl	%eax, %eax
	jne	.LBB3_58
# %bb.55:                               #   in Loop: Header=BB3_3 Depth=1
	addl	$4, %r15d
	cmpl	%ebp, %r15d
	jg	.LBB3_57
# %bb.56:                               #   in Loop: Header=BB3_3 Depth=1
	movl	$blockDepth, %r13d
	movl	$blockHeight, %r12d
	movl	$blockWidth, %r14d
	jmp	.LBB3_19
.LBB3_4:                                #   in Loop: Header=BB3_3 Depth=1
	addl	$2, %r15d
	cmpl	%ebp, %r15d
	jg	.LBB3_6
# %bb.5:                                #   in Loop: Header=BB3_3 Depth=1
	movq	8(%rbx), %r13
	movq	64(%rsp), %rbx
	movq	%r13, %rdi
	callq	strlen
.Ltmp25:
	leaq	56(%rsp), %rdi
	xorl	%esi, %esi
	movq	%rbx, %rdx
	movq	%r13, %rcx
	movq	%rax, %r8
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm
.Ltmp26:
	jmp	.LBB3_21
.LBB3_9:                                #   in Loop: Header=BB3_3 Depth=1
	addl	$2, %r15d
	cmpl	%ebp, %r15d
	jg	.LBB3_11
# %bb.10:                               #   in Loop: Header=BB3_3 Depth=1
	movq	8(%rbx), %rbx
	movq	32(%rsp), %r13
	movq	%rbx, %rdi
	callq	strlen
.Ltmp23:
	leaq	24(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r13, %rdx
	movq	%rbx, %rcx
	movq	%rax, %r8
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm
.Ltmp24:
	jmp	.LBB3_21
.LBB3_13:                               #   in Loop: Header=BB3_3 Depth=1
	addl	$2, %r15d
	cmpl	%ebp, %r15d
	jg	.LBB3_15
# %bb.14:                               #   in Loop: Header=BB3_3 Depth=1
	movl	$timeSteps, %r13d
	movl	$1, %eax
	jmp	.LBB3_20
.LBB3_17:                               #   in Loop: Header=BB3_3 Depth=1
	addl	$4, %r15d
	cmpl	%ebp, %r15d
	jg	.LBB3_53
# %bb.18:                               #   in Loop: Header=BB3_3 Depth=1
	movl	$gridDepth, %r13d
	movl	$gridHeight, %r12d
	movl	$gridWidth, %r14d
.LBB3_19:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit.sink.split.sink.split
                                        #   in Loop: Header=BB3_3 Depth=1
	movq	8(%rbx), %rdi
	xorl	%esi, %esi
	movl	$10, %edx
	callq	__isoc23_strtol
	movl	%eax, (%r14)
	movq	16(%rbx), %rdi
	xorl	%esi, %esi
	movl	$10, %edx
	callq	__isoc23_strtol
	movl	%eax, (%r12)
	movl	$3, %eax
	movq	(%rsp), %r14                    # 8-byte Reload
.LBB3_20:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit.sink.split
                                        #   in Loop: Header=BB3_3 Depth=1
	movq	(%rbx,%rax,8), %rdi
	xorl	%esi, %esi
	movl	$10, %edx
	callq	__isoc23_strtol
	movl	%eax, (%r13)
.LBB3_21:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit
                                        #   in Loop: Header=BB3_3 Depth=1
	cmpl	%ebp, %r15d
	jl	.LBB3_3
# %bb.22:                               # %._crit_edge.loopexit
	movl	gridWidth(%rip), %r15d
	movl	blockWidth(%rip), %eax
	movl	gridHeight(%rip), %r12d
	movl	blockHeight(%rip), %r14d
	movl	gridDepth(%rip), %ebx
	movl	blockDepth(%rip), %r13d
.LBB3_23:                               # %._crit_edge
	cvtsi2ss	%r15d, %xmm0
	cvtsi2ss	%eax, %xmm1
	divss	%xmm1, %xmm0
	callq	ceilf@PLT
	cvttss2si	%xmm0, %eax
	movl	%eax, gridWidthBlocks(%rip)
	xorps	%xmm0, %xmm0
	cvtsi2ss	%r12d, %xmm0
	xorps	%xmm1, %xmm1
	cvtsi2ss	%r14d, %xmm1
	divss	%xmm1, %xmm0
	callq	ceilf@PLT
	cvttss2si	%xmm0, %eax
	movl	%eax, gridHeightBlocks(%rip)
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ebx, %xmm0
	xorps	%xmm1, %xmm1
	cvtsi2ss	%r13d, %xmm1
	divss	%xmm1, %xmm0
	callq	ceilf@PLT
	cvttss2si	%xmm0, %eax
	movl	%eax, gridDepthBlocks(%rip)
	imull	%ebx, %r15d
	imull	%r12d, %r15d
	movl	%r15d, gridArea(%rip)
.Ltmp28:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.17, %esi
	movl	$10, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp29:
# %bb.24:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movq	56(%rsp), %rsi
	movq	64(%rsp), %rdx
.Ltmp30:
	movl	$_ZSt4cout, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp31:
# %bb.25:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit
.Ltmp32:
	movl	$.L.str.18, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp33:
# %bb.26:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit106
.Ltmp34:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.19, %esi
	movl	$11, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp35:
# %bb.27:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit107
	movq	24(%rsp), %rsi
	movq	32(%rsp), %rdx
.Ltmp36:
	movl	$_ZSt4cout, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp37:
# %bb.28:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit108
.Ltmp38:
	movl	$.L.str.18, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp39:
# %bb.29:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit109
	movl	timeSteps(%rip), %esi
	movl	$.L.str.20, %edi
	xorl	%eax, %eax
	callq	printf
	movl	gridWidth(%rip), %esi
	movl	gridHeight(%rip), %edx
	movl	gridDepth(%rip), %ecx
	movl	$.L.str.21, %edi
	xorl	%eax, %eax
	callq	printf
	movl	blockWidth(%rip), %esi
	movl	blockHeight(%rip), %edx
	movl	blockDepth(%rip), %ecx
	movl	$.L.str.22, %edi
	xorl	%eax, %eax
	callq	printf
	movl	gridWidthBlocks(%rip), %esi
	movl	gridHeightBlocks(%rip), %edx
	movl	gridDepthBlocks(%rip), %ecx
	movl	$.L.str.23, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.24, %edi
	xorl	%eax, %eax
	callq	printf
.Ltmp40:
	movl	$gridWidth_d, %edi
	movl	$gridWidth, %esi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
.Ltmp41:
# %bb.30:                               # %_Z17hipMemcpyToSymbolIiE10hipError_tRKT_PKvmm13hipMemcpyKind.exit
.Ltmp42:
	movl	$gridHeight_d, %edi
	movl	$gridHeight, %esi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
.Ltmp43:
# %bb.31:                               # %_Z17hipMemcpyToSymbolIiE10hipError_tRKT_PKvmm13hipMemcpyKind.exit110
.Ltmp44:
	movl	$gridDepth_d, %edi
	movl	$gridDepth, %esi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
.Ltmp45:
# %bb.32:                               # %_Z17hipMemcpyToSymbolIiE10hipError_tRKT_PKvmm13hipMemcpyKind.exit111
.Ltmp46:
	movl	$blockWidth_d, %edi
	movl	$blockWidth, %esi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
.Ltmp47:
# %bb.33:                               # %_Z17hipMemcpyToSymbolIiE10hipError_tRKT_PKvmm13hipMemcpyKind.exit112
.Ltmp48:
	movl	$blockHeight_d, %edi
	movl	$blockHeight, %esi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
.Ltmp49:
# %bb.34:                               # %_Z17hipMemcpyToSymbolIiE10hipError_tRKT_PKvmm13hipMemcpyKind.exit113
.Ltmp50:
	movl	$blockDepth_d, %edi
	movl	$blockDepth, %esi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
.Ltmp51:
# %bb.35:                               # %_Z17hipMemcpyToSymbolIiE10hipError_tRKT_PKvmm13hipMemcpyKind.exit114
.Ltmp52:
	movl	$gridWidthBlocks_d, %edi
	movl	$gridWidthBlocks, %esi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
.Ltmp53:
# %bb.36:                               # %_Z17hipMemcpyToSymbolIiE10hipError_tRKT_PKvmm13hipMemcpyKind.exit115
.Ltmp54:
	movl	$gridHeightBlocks_d, %edi
	movl	$gridHeightBlocks, %esi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
.Ltmp55:
# %bb.37:                               # %_Z17hipMemcpyToSymbolIiE10hipError_tRKT_PKvmm13hipMemcpyKind.exit116
.Ltmp56:
	movl	$gridDepthBlocks_d, %edi
	movl	$gridDepthBlocks, %esi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
.Ltmp57:
# %bb.38:                               # %_Z17hipMemcpyToSymbolIiE10hipError_tRKT_PKvmm13hipMemcpyKind.exit117
	movl	gridWidthBlocks(%rip), %eax
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	movl	gridDepthBlocks(%rip), %ebp
	movl	gridHeightBlocks(%rip), %r15d
	movl	blockWidth(%rip), %eax
	movq	%rax, 96(%rsp)                  # 8-byte Spill
	movl	blockDepth(%rip), %r13d
	movl	blockHeight(%rip), %ebx
	movslq	gridWidth(%rip), %rax
	movslq	gridHeight(%rip), %rcx
	imulq	%rax, %rcx
	movslq	gridDepth(%rip), %r12
	imulq	%rcx, %r12
	movl	$1, %esi
	movq	%r12, %rdi
	callq	calloc
	movq	%rax, %r14
.Ltmp59:
	leaq	8(%rsp), %rdi
	movq	%r12, (%rsp)                    # 8-byte Spill
	movq	%r12, %rsi
	callq	hipMalloc
.Ltmp60:
# %bb.39:
.Ltmp61:
	leaq	16(%rsp), %rdi
	movq	(%rsp), %rsi                    # 8-byte Reload
	callq	hipMalloc
.Ltmp62:
# %bb.40:
.Ltmp63:
	leaq	56(%rsp), %rdi
	movq	%r14, %rsi
	callq	_Z12readTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
.Ltmp64:
# %bb.41:
	movq	8(%rsp), %rdi
.Ltmp65:
	movq	%r14, %rsi
	movq	(%rsp), %rdx                    # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp66:
# %bb.42:                               # %.preheader
	movq	%r14, 104(%rsp)                 # 8-byte Spill
	cmpl	$0, timeSteps(%rip)
	jle	.LBB3_67
# %bb.43:                               # %.lr.ph145.preheader
	shlq	$32, %r15
	addq	88(%rsp), %r15                  # 8-byte Folded Reload
	shlq	$32, %rbx
	addq	96(%rsp), %rbx                  # 8-byte Folded Reload
	xorl	%r12d, %r12d
.LBB3_44:                               # %.lr.ph145
                                        # =>This Inner Loop Header: Depth=1
.Ltmp67:
	movq	%r15, %rdi
	movl	%ebp, %esi
	movq	%rbx, %rdx
	movl	%r13d, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp68:
# %bb.45:                               #   in Loop: Header=BB3_44 Depth=1
	testl	%eax, %eax
	jne	.LBB3_47
# %bb.46:                               #   in Loop: Header=BB3_44 Depth=1
	movq	8(%rsp), %rdi
	movq	16(%rsp), %rsi
.Ltmp69:
	callq	_Z21__device_stub__solverPbS_
.Ltmp70:
.LBB3_47:                               #   in Loop: Header=BB3_44 Depth=1
.Ltmp71:
	callq	hipDeviceSynchronize
.Ltmp72:
# %bb.48:                               #   in Loop: Header=BB3_44 Depth=1
	movq	8(%rsp), %rax
	movq	16(%rsp), %rcx
	movq	%rcx, 8(%rsp)
	movq	%rax, 16(%rsp)
.Ltmp74:
	callq	hipGetLastError
.Ltmp75:
# %bb.49:                               #   in Loop: Header=BB3_44 Depth=1
	testl	%eax, %eax
	je	.LBB3_66
# %bb.50:                               #   in Loop: Header=BB3_44 Depth=1
.Ltmp76:
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp77:
# %bb.51:                               #   in Loop: Header=BB3_44 Depth=1
	movq	%rax, %r14
	testq	%rax, %rax
	je	.LBB3_52
# %bb.62:                               #   in Loop: Header=BB3_44 Depth=1
	movq	%r14, %rdi
	callq	strlen
.Ltmp78:
	movl	$_ZSt4cout, %edi
	movq	%r14, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp79:
	jmp	.LBB3_63
.LBB3_52:                               #   in Loop: Header=BB3_44 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
.Ltmp80:
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp81:
.LBB3_63:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit119
                                        #   in Loop: Header=BB3_44 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
.Ltmp82:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp83:
# %bb.64:                               # %.noexc130
                                        #   in Loop: Header=BB3_44 Depth=1
.Ltmp84:
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp85:
# %bb.65:                               # %.noexc131
                                        #   in Loop: Header=BB3_44 Depth=1
.Ltmp86:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp87:
.LBB3_66:                               # %_ZNSolsEPFRSoS_E.exit
                                        #   in Loop: Header=BB3_44 Depth=1
	incl	%r12d
	cmpl	timeSteps(%rip), %r12d
	jl	.LBB3_44
.LBB3_67:                               # %._crit_edge146
	movq	8(%rsp), %rsi
.Ltmp89:
	movq	104(%rsp), %rbx                 # 8-byte Reload
	movq	%rbx, %rdi
	movq	(%rsp), %rdx                    # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp90:
# %bb.68:
.Ltmp91:
	leaq	24(%rsp), %rdi
	movq	%rbx, %rsi
	callq	_Z13writeTextReprRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb
.Ltmp92:
# %bb.69:
	movq	%rbx, %rdi
	callq	free
	movq	8(%rsp), %rdi
.Ltmp93:
	callq	hipFree
.Ltmp94:
# %bb.70:
	movq	16(%rsp), %rdi
.Ltmp95:
	callq	hipFree
.Ltmp96:
# %bb.71:
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	subq	112(%rsp), %rax                 # 8-byte Folded Reload
	movabsq	$4835703278458516699, %rcx      # imm = 0x431BDE82D7B634DB
	imulq	%rcx
	movq	%rdx, %rsi
	shrq	$63, %rsi
	sarq	$18, %rdx
	addq	%rdx, %rsi
	xorl	%ebx, %ebx
	movl	$.L.str.25, %edi
	xorl	%eax, %eax
	callq	printf
	jmp	.LBB3_72
.LBB3_6:
	movl	$.Lstr.6, %edi
	jmp	.LBB3_7
.LBB3_11:
	movl	$.Lstr.5, %edi
	jmp	.LBB3_7
.LBB3_58:
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	$.Lstr.1, %edi
	jmp	.LBB3_7
.LBB3_57:
	movl	$.Lstr.2, %edi
	jmp	.LBB3_7
.LBB3_15:
	movl	$.Lstr.4, %edi
	jmp	.LBB3_7
.LBB3_53:
	movl	$.Lstr.3, %edi
.LBB3_7:                                # %.thread
	callq	puts@PLT
	movl	$1, %ebx
.LBB3_72:                               # %.thread
	movq	24(%rsp), %rdi
	leaq	40(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB3_74
# %bb.73:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB3_74:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	movq	56(%rsp), %rdi
	leaq	72(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB3_76
# %bb.75:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i121
	callq	_ZdlPv
.LBB3_76:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit123
	movl	%ebx, %eax
	addq	$120, %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
.LBB3_83:
	.cfi_def_cfa_offset 176
.Ltmp22:
	movq	%rax, %rbx
	jmp	.LBB3_80
.LBB3_77:
.Ltmp27:
	jmp	.LBB3_78
.LBB3_60:
.Ltmp97:
	jmp	.LBB3_78
.LBB3_59:
.Ltmp58:
	jmp	.LBB3_78
.LBB3_61:
.Ltmp73:
	jmp	.LBB3_78
.LBB3_84:
.Ltmp88:
.LBB3_78:
	movq	%rax, %rbx
	movq	24(%rsp), %rdi
	leaq	40(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB3_80
# %bb.79:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i124
	callq	_ZdlPv
.LBB3_80:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit126
	movq	56(%rsp), %rdi
	leaq	72(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB3_82
# %bb.81:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i127
	callq	_ZdlPv
.LBB3_82:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit129
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table3:
.Lexception2:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end2-.Lcst_begin2
.Lcst_begin2:
	.uleb128 .Lfunc_begin2-.Lfunc_begin2    # >> Call Site 1 <<
	.uleb128 .Ltmp20-.Lfunc_begin2          #   Call between .Lfunc_begin2 and .Ltmp20
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp20-.Lfunc_begin2          # >> Call Site 2 <<
	.uleb128 .Ltmp21-.Ltmp20                #   Call between .Ltmp20 and .Ltmp21
	.uleb128 .Ltmp22-.Lfunc_begin2          #     jumps to .Ltmp22
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp25-.Lfunc_begin2          # >> Call Site 3 <<
	.uleb128 .Ltmp24-.Ltmp25                #   Call between .Ltmp25 and .Ltmp24
	.uleb128 .Ltmp27-.Lfunc_begin2          #     jumps to .Ltmp27
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp24-.Lfunc_begin2          # >> Call Site 4 <<
	.uleb128 .Ltmp28-.Ltmp24                #   Call between .Ltmp24 and .Ltmp28
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp28-.Lfunc_begin2          # >> Call Site 5 <<
	.uleb128 .Ltmp57-.Ltmp28                #   Call between .Ltmp28 and .Ltmp57
	.uleb128 .Ltmp58-.Lfunc_begin2          #     jumps to .Ltmp58
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp59-.Lfunc_begin2          # >> Call Site 6 <<
	.uleb128 .Ltmp66-.Ltmp59                #   Call between .Ltmp59 and .Ltmp66
	.uleb128 .Ltmp97-.Lfunc_begin2          #     jumps to .Ltmp97
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp67-.Lfunc_begin2          # >> Call Site 7 <<
	.uleb128 .Ltmp72-.Ltmp67                #   Call between .Ltmp67 and .Ltmp72
	.uleb128 .Ltmp73-.Lfunc_begin2          #     jumps to .Ltmp73
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp74-.Lfunc_begin2          # >> Call Site 8 <<
	.uleb128 .Ltmp87-.Ltmp74                #   Call between .Ltmp74 and .Ltmp87
	.uleb128 .Ltmp88-.Lfunc_begin2          #     jumps to .Ltmp88
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp89-.Lfunc_begin2          # >> Call Site 9 <<
	.uleb128 .Ltmp96-.Ltmp89                #   Call between .Ltmp89 and .Ltmp96
	.uleb128 .Ltmp97-.Lfunc_begin2          #     jumps to .Ltmp97
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp96-.Lfunc_begin2          # >> Call Site 10 <<
	.uleb128 .Lfunc_end3-.Ltmp96            #   Call between .Ltmp96 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end2:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB4_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB4_3
.LBB4_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB4_3:
	testq	%r14, %r14
	je	.LBB4_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB4_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB4_7
.LBB4_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB4_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end4-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_endproc
                                        # -- End function
	.text
	.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
	.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:
	subq	$32, %rsp
	.cfi_adjust_cfa_offset 32
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z6solverPbS_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	addq	$32, %rsp
	.cfi_adjust_cfa_offset -32
	movl	$gridWidth_d, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$gridHeight_d, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$gridDepth_d, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$blockWidth_d, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$blockHeight_d, %esi
	movl	$.L__unnamed_6, %edx
	movl	$.L__unnamed_6, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$blockDepth_d, %esi
	movl	$.L__unnamed_7, %edx
	movl	$.L__unnamed_7, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$gridWidthBlocks_d, %esi
	movl	$.L__unnamed_8, %edx
	movl	$.L__unnamed_8, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$gridHeightBlocks_d, %esi
	movl	$.L__unnamed_9, %edx
	movl	$.L__unnamed_9, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$gridDepthBlocks_d, %esi
	movl	$.L__unnamed_10, %edx
	movl	$.L__unnamed_10, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$__hip_module_dtor, %edi
	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	gridWidth,@object               # @gridWidth
	.bss
	.globl	gridWidth
	.p2align	2, 0x0
gridWidth:
	.long	0                               # 0x0
	.size	gridWidth, 4

	.type	gridHeight,@object              # @gridHeight
	.globl	gridHeight
	.p2align	2, 0x0
gridHeight:
	.long	0                               # 0x0
	.size	gridHeight, 4

	.type	gridDepth,@object               # @gridDepth
	.globl	gridDepth
	.p2align	2, 0x0
gridDepth:
	.long	0                               # 0x0
	.size	gridDepth, 4

	.type	blockWidth,@object              # @blockWidth
	.globl	blockWidth
	.p2align	2, 0x0
blockWidth:
	.long	0                               # 0x0
	.size	blockWidth, 4

	.type	blockHeight,@object             # @blockHeight
	.globl	blockHeight
	.p2align	2, 0x0
blockHeight:
	.long	0                               # 0x0
	.size	blockHeight, 4

	.type	blockDepth,@object              # @blockDepth
	.globl	blockDepth
	.p2align	2, 0x0
blockDepth:
	.long	0                               # 0x0
	.size	blockDepth, 4

	.type	gridWidthBlocks,@object         # @gridWidthBlocks
	.globl	gridWidthBlocks
	.p2align	2, 0x0
gridWidthBlocks:
	.long	0                               # 0x0
	.size	gridWidthBlocks, 4

	.type	gridHeightBlocks,@object        # @gridHeightBlocks
	.globl	gridHeightBlocks
	.p2align	2, 0x0
gridHeightBlocks:
	.long	0                               # 0x0
	.size	gridHeightBlocks, 4

	.type	gridDepthBlocks,@object         # @gridDepthBlocks
	.globl	gridDepthBlocks
	.p2align	2, 0x0
gridDepthBlocks:
	.long	0                               # 0x0
	.size	gridDepthBlocks, 4

	.type	gridArea,@object                # @gridArea
	.globl	gridArea
	.p2align	2, 0x0
gridArea:
	.long	0                               # 0x0
	.size	gridArea, 4

	.type	gridWidth_d,@object             # @gridWidth_d
	.local	gridWidth_d
	.comm	gridWidth_d,4,4
	.type	gridHeight_d,@object            # @gridHeight_d
	.local	gridHeight_d
	.comm	gridHeight_d,4,4
	.type	gridDepth_d,@object             # @gridDepth_d
	.local	gridDepth_d
	.comm	gridDepth_d,4,4
	.type	blockWidth_d,@object            # @blockWidth_d
	.local	blockWidth_d
	.comm	blockWidth_d,4,4
	.type	blockHeight_d,@object           # @blockHeight_d
	.local	blockHeight_d
	.comm	blockHeight_d,4,4
	.type	blockDepth_d,@object            # @blockDepth_d
	.local	blockDepth_d
	.comm	blockDepth_d,4,4
	.type	gridWidthBlocks_d,@object       # @gridWidthBlocks_d
	.local	gridWidthBlocks_d
	.comm	gridWidthBlocks_d,4,4
	.type	gridHeightBlocks_d,@object      # @gridHeightBlocks_d
	.local	gridHeightBlocks_d
	.comm	gridHeightBlocks_d,4,4
	.type	gridDepthBlocks_d,@object       # @gridDepthBlocks_d
	.local	gridDepthBlocks_d
	.comm	gridDepthBlocks_d,4,4
	.type	timeSteps,@object               # @timeSteps
	.globl	timeSteps
	.p2align	2, 0x0
timeSteps:
	.long	0                               # 0x0
	.size	timeSteps, 4

	.type	_Z6solverPbS_,@object           # @_Z6solverPbS_
	.section	.rodata,"a",@progbits
	.globl	_Z6solverPbS_
	.p2align	3, 0x0
_Z6solverPbS_:
	.quad	_Z21__device_stub__solverPbS_
	.size	_Z6solverPbS_, 8

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

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"---\n"
	.size	.L.str.1, 5

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"in.txt"
	.size	.L.str.2, 7

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"out.txt"
	.size	.L.str.3, 8

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"%d"
	.size	.L.str.4, 3

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"-i"
	.size	.L.str.5, 3

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"-o"
	.size	.L.str.7, 3

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"-t"
	.size	.L.str.9, 3

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"-g"
	.size	.L.str.11, 3

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"-b"
	.size	.L.str.13, 3

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"In file = "
	.size	.L.str.17, 11

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"\n"
	.size	.L.str.18, 2

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"Out file = "
	.size	.L.str.19, 12

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"Time steps = %d\n"
	.size	.L.str.20, 17

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	"Grid dimensions = %dx%dx%d\n"
	.size	.L.str.21, 28

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"Block dimensions = %dx%dx%d\n"
	.size	.L.str.22, 29

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"Grid in blocks = %dx%dx%d\n"
	.size	.L.str.23, 27

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	"..."
	.size	.L.str.24, 4

	.type	.L.str.25,@object               # @.str.25
.L.str.25:
	.asciz	"Ran in %ld ms\n"
	.size	.L.str.25, 15

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z6solverPbS_"
	.size	.L__unnamed_1, 14

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"gridWidth_d"
	.size	.L__unnamed_2, 12

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"gridHeight_d"
	.size	.L__unnamed_3, 13

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"gridDepth_d"
	.size	.L__unnamed_4, 12

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"blockWidth_d"
	.size	.L__unnamed_5, 13

	.type	.L__unnamed_6,@object           # @5
.L__unnamed_6:
	.asciz	"blockHeight_d"
	.size	.L__unnamed_6, 14

	.type	.L__unnamed_7,@object           # @6
.L__unnamed_7:
	.asciz	"blockDepth_d"
	.size	.L__unnamed_7, 13

	.type	.L__unnamed_8,@object           # @7
.L__unnamed_8:
	.asciz	"gridWidthBlocks_d"
	.size	.L__unnamed_8, 18

	.type	.L__unnamed_9,@object           # @8
.L__unnamed_9:
	.asciz	"gridHeightBlocks_d"
	.size	.L__unnamed_9, 19

	.type	.L__unnamed_10,@object          # @9
.L__unnamed_10:
	.asciz	"gridDepthBlocks_d"
	.size	.L__unnamed_10, 18

	.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	"Error: Parameters must be of form:"
	.size	.Lstr, 35

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"./game [-i infile] [-o outfile] [-t timesteps] [-g griddimensions] [-b blockdimensions]"
	.size	.Lstr.1, 88

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"Error: Missing arguments for -b"
	.size	.Lstr.2, 32

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"Error: Missing arguments for -g"
	.size	.Lstr.3, 32

	.type	.Lstr.4,@object                 # @str.4
.Lstr.4:
	.asciz	"Error: Missing arguments for -t"
	.size	.Lstr.4, 32

	.type	.Lstr.5,@object                 # @str.5
.Lstr.5:
	.asciz	"Error: Missing arguments for -o"
	.size	.Lstr.5, 32

	.type	.Lstr.6,@object                 # @str.6
.Lstr.6:
	.asciz	"Error: Missing arguments for -i"
	.size	.Lstr.6, 32

	.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 _Z21__device_stub__solverPbS_
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym gridWidth
	.addrsig_sym gridHeight
	.addrsig_sym gridDepth
	.addrsig_sym blockWidth
	.addrsig_sym blockHeight
	.addrsig_sym blockDepth
	.addrsig_sym gridWidthBlocks
	.addrsig_sym gridHeightBlocks
	.addrsig_sym gridDepthBlocks
	.addrsig_sym gridWidth_d
	.addrsig_sym gridHeight_d
	.addrsig_sym gridDepth_d
	.addrsig_sym blockWidth_d
	.addrsig_sym blockHeight_d
	.addrsig_sym blockDepth_d
	.addrsig_sym gridWidthBlocks_d
	.addrsig_sym gridHeightBlocks_d
	.addrsig_sym gridDepthBlocks_d
	.addrsig_sym _Z6solverPbS_
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z6solverPbS_           ; -- Begin function _Z6solverPbS_
	.globl	_Z6solverPbS_
	.p2align	8
	.type	_Z6solverPbS_,@function
_Z6solverPbS_:                          ; @_Z6solverPbS_
; %bb.0:
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, blockWidth_d@rel32@lo+4
	s_addc_u32 s3, s3, blockWidth_d@rel32@hi+12
	v_and_b32_e32 v3, 0x3ff, v0
	s_load_b32 s2, s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s2, s13, v[3:4]
	s_mov_b32 s2, exec_lo
	v_cmpx_lt_i32_e32 0, v1
	s_cbranch_execz .LBB0_15
; %bb.1:
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, blockHeight_d@rel32@lo+4
	s_addc_u32 s3, s3, blockHeight_d@rel32@hi+12
	v_bfe_u32 v4, v0, 10, 10
	s_load_b32 s5, s[2:3], 0x0
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, gridWidth_d@rel32@lo+4
	s_addc_u32 s3, s3, gridWidth_d@rel32@hi+12
	s_load_b32 s4, s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[2:3], null, s5, s14, v[4:5]
	s_add_i32 s2, s4, -1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e32 vcc_lo, s2, v1
	v_cmp_lt_i32_e64 s2, 0, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_b32 exec_lo, exec_lo, s2
	s_cbranch_execz .LBB0_15
; %bb.2:
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, blockDepth_d@rel32@lo+4
	s_addc_u32 s3, s3, blockDepth_d@rel32@hi+12
	v_bfe_u32 v0, v0, 20, 10
	s_load_b32 s6, s[2:3], 0x0
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, gridHeight_d@rel32@lo+4
	s_addc_u32 s3, s3, gridHeight_d@rel32@hi+12
	s_load_b32 s5, s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[3:4], null, s6, s15, v[0:1]
	s_add_i32 s2, s5, -1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e32 vcc_lo, s2, v2
	v_cmp_lt_i32_e64 s2, 0, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_b32 exec_lo, exec_lo, s2
	s_cbranch_execz .LBB0_15
; %bb.3:
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, gridDepth_d@rel32@lo+4
	s_addc_u32 s3, s3, gridDepth_d@rel32@hi+12
	s_load_b32 s2, s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	s_add_i32 s2, s2, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	v_cmp_gt_i32_e32 vcc_lo, s2, v3
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_15
; %bb.4:
	v_mul_lo_u32 v0, s5, v3
	s_load_b128 s[0:3], s[0:1], 0x0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v5, v0, v2
	v_add_nc_u32_e32 v0, s5, v0
	s_lshl_b32 s5, s5, 1
	v_mad_u64_u32 v[3:4], null, v5, s4, v[1:2]
	v_add_nc_u32_e32 v6, -1, v5
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v7, v0, v2
	v_subrev_nc_u32_e32 v0, s5, v0
	v_mad_u64_u32 v[4:5], null, v6, s4, v[1:2]
	v_add_nc_u32_e32 v8, 1, v3
	v_add_nc_u32_e32 v9, -1, v3
	v_mad_u64_u32 v[5:6], null, v7, s4, v[1:2]
	v_add_nc_u32_e32 v0, v0, v2
	s_delay_alu instid0(VALU_DEP_4)
	v_ashrrev_i32_e32 v2, 31, v8
	v_add_nc_u32_e32 v10, s4, v3
	v_ashrrev_i32_e32 v11, 31, v9
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v6, vcc_lo, s0, v8
	v_add_co_ci_u32_e32 v7, vcc_lo, s1, v2, vcc_lo
	v_add_co_u32 v8, vcc_lo, s0, v9
	v_ashrrev_i32_e32 v12, 31, v10
	v_add_co_ci_u32_e32 v9, vcc_lo, s1, v11, vcc_lo
	v_add_co_u32 v10, vcc_lo, s0, v10
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v11, vcc_lo, s1, v12, vcc_lo
	s_clause 0x1
	global_load_u8 v2, v[6:7], off
	global_load_u8 v12, v[8:9], off
	v_ashrrev_i32_e32 v13, 31, v4
	v_add_co_u32 v6, vcc_lo, s0, v4
	v_ashrrev_i32_e32 v4, 31, v5
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v7, vcc_lo, s1, v13, vcc_lo
	s_waitcnt vmcnt(1)
	v_mad_u64_u32 v[8:9], null, v0, s4, v[1:2]
	v_add_co_u32 v0, vcc_lo, s0, v5
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v4, vcc_lo
	s_clause 0x2
	global_load_u8 v9, v[10:11], off
	global_load_u8 v7, v[6:7], off
	global_load_u8 v10, v[0:1], off
	v_ashrrev_i32_e32 v1, 31, v8
	v_ashrrev_i32_e32 v4, 31, v3
	v_add_co_u32 v0, vcc_lo, s0, v8
	s_waitcnt vmcnt(3)
	v_add_nc_u16 v2, v12, v2
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	v_add_co_u32 v5, vcc_lo, s0, v3
	v_add_co_ci_u32_e32 v6, vcc_lo, s1, v4, vcc_lo
	s_clause 0x1
	global_load_u8 v0, v[0:1], off
	global_load_u8 v1, v[5:6], off
	s_mov_b32 s0, exec_lo
	s_waitcnt vmcnt(4)
	v_add_nc_u16 v2, v2, v9
	s_waitcnt vmcnt(3)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_nc_u16 v2, v2, v7
	s_waitcnt vmcnt(2)
	v_add_nc_u16 v2, v2, v10
	s_waitcnt vmcnt(1)
	s_delay_alu instid0(VALU_DEP_1)
	v_add_nc_u16 v0, v2, v0
	s_waitcnt vmcnt(0)
	v_cmpx_ne_u16_e32 0, v1
	s_xor_b32 s1, exec_lo, s0
	s_cbranch_execz .LBB0_10
; %bb.5:
	v_and_b32_e32 v0, 0xfe, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_ne_u16_e32 vcc_lo, 2, v0
	v_add_co_u32 v0, s0, s2, v3
	v_add_co_ci_u32_e64 v1, s0, s3, v4, s0
	s_and_saveexec_b32 s0, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_xor_b32 s0, exec_lo, s0
	s_cbranch_execz .LBB0_7
; %bb.6:
	v_mov_b32_e32 v2, 0
	global_store_b8 v[0:1], v2, off
                                        ; implicit-def: $vgpr0_vgpr1
.LBB0_7:                                ; %Flow
	s_and_not1_saveexec_b32 s0, s0
	s_cbranch_execz .LBB0_9
; %bb.8:
	v_mov_b32_e32 v2, 1
	global_store_b8 v[0:1], v2, off
.LBB0_9:                                ; %Flow91
	s_or_b32 exec_lo, exec_lo, s0
                                        ; implicit-def: $vgpr0
                                        ; implicit-def: $vgpr3_vgpr4
.LBB0_10:                               ; %Flow94
	s_and_not1_saveexec_b32 s0, s1
	s_cbranch_execz .LBB0_15
; %bb.11:
	v_and_b32_e32 v0, 0xff, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_ne_u16_e32 vcc_lo, 3, v0
	v_add_co_u32 v0, s0, s2, v3
	v_add_co_ci_u32_e64 v1, s0, s3, v4, s0
	s_and_saveexec_b32 s0, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_xor_b32 s0, exec_lo, s0
	s_cbranch_execz .LBB0_13
; %bb.12:
	v_mov_b32_e32 v2, 0
	global_store_b8 v[0:1], v2, off
                                        ; implicit-def: $vgpr0_vgpr1
.LBB0_13:                               ; %Flow92
	s_and_not1_saveexec_b32 s0, s0
	s_cbranch_execz .LBB0_15
; %bb.14:
	v_mov_b32_e32 v2, 1
	global_store_b8 v[0:1], v2, off
.LBB0_15:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6solverPbS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 16
		.amdhsa_user_sgpr_count 13
		.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 1
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 2
		.amdhsa_next_free_vgpr 14
		.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	_Z6solverPbS_, .Lfunc_end0-_Z6solverPbS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 908
; NumSgprs: 18
; NumVgprs: 14
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 14
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 13
; 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: 1
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 2
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.protected	gridWidth_d             ; @gridWidth_d
	.type	gridWidth_d,@object
	.section	.bss,"aw",@nobits
	.globl	gridWidth_d
	.p2align	2, 0x0
gridWidth_d:
	.long	0                               ; 0x0
	.size	gridWidth_d, 4

	.protected	gridHeight_d            ; @gridHeight_d
	.type	gridHeight_d,@object
	.globl	gridHeight_d
	.p2align	2, 0x0
gridHeight_d:
	.long	0                               ; 0x0
	.size	gridHeight_d, 4

	.protected	gridDepth_d             ; @gridDepth_d
	.type	gridDepth_d,@object
	.globl	gridDepth_d
	.p2align	2, 0x0
gridDepth_d:
	.long	0                               ; 0x0
	.size	gridDepth_d, 4

	.protected	blockWidth_d            ; @blockWidth_d
	.type	blockWidth_d,@object
	.globl	blockWidth_d
	.p2align	2, 0x0
blockWidth_d:
	.long	0                               ; 0x0
	.size	blockWidth_d, 4

	.protected	blockHeight_d           ; @blockHeight_d
	.type	blockHeight_d,@object
	.globl	blockHeight_d
	.p2align	2, 0x0
blockHeight_d:
	.long	0                               ; 0x0
	.size	blockHeight_d, 4

	.protected	blockDepth_d            ; @blockDepth_d
	.type	blockDepth_d,@object
	.globl	blockDepth_d
	.p2align	2, 0x0
blockDepth_d:
	.long	0                               ; 0x0
	.size	blockDepth_d, 4

	.protected	gridWidthBlocks_d       ; @gridWidthBlocks_d
	.type	gridWidthBlocks_d,@object
	.globl	gridWidthBlocks_d
	.p2align	2, 0x0
gridWidthBlocks_d:
	.long	0                               ; 0x0
	.size	gridWidthBlocks_d, 4

	.protected	gridHeightBlocks_d      ; @gridHeightBlocks_d
	.type	gridHeightBlocks_d,@object
	.globl	gridHeightBlocks_d
	.p2align	2, 0x0
gridHeightBlocks_d:
	.long	0                               ; 0x0
	.size	gridHeightBlocks_d, 4

	.protected	gridDepthBlocks_d       ; @gridDepthBlocks_d
	.type	gridDepthBlocks_d,@object
	.globl	gridDepthBlocks_d
	.p2align	2, 0x0
gridDepthBlocks_d:
	.long	0                               ; 0x0
	.size	gridDepthBlocks_d, 4

	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym gridWidth_d
	.addrsig_sym gridHeight_d
	.addrsig_sym gridDepth_d
	.addrsig_sym blockWidth_d
	.addrsig_sym blockHeight_d
	.addrsig_sym blockDepth_d
	.addrsig_sym gridWidthBlocks_d
	.addrsig_sym gridHeightBlocks_d
	.addrsig_sym gridDepthBlocks_d
	.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
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 16
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z6solverPbS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z6solverPbS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     14
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
