#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define WIDTH 100
#define HEIGHT 100
#define GRID_SIZE WIDTH * HEIGHT
#define ACTUAL_GRID_SIZE sizeof(char) * GRID_SIZE
#define BLOCK_WIDTH 1
#define BLOCK_HEIGHT 1
#define NO_OF_GENERATIONS_TO_RUN 500

//#define DUMPFULL
//#define DUMPCOUNT
#define CUBE


__global__ void runGeneration(char currentModel[], char nextModel[]);
__device__ void getBlock(int x, int y, int* topLeftXOfBlock, int* topLeftYOfBlock);
__device__ void getCountOfNeighbours(char model[], int x, int y, int* neighbourCount);
__device__ void addCellValue(char model[], int x, int y, int* value);
__device__ void runRules(char model[], int x, int y, char* fate);

void printGrid(char grid[]);

int main(int argc, char** args) {
    printf("%d;%d\n", WIDTH, HEIGHT);
    srand( time(NULL) );

     char clientModel[GRID_SIZE];
    char* deviceModel = 0;
    char* deviceModel2 = 0;
       
    for(int index = 0 ; index < GRID_SIZE ; index++){
    	clientModel[index] =  rand() % 2;
    }

    printGrid(clientModel);

    cudaMalloc( (void**)&deviceModel, ACTUAL_GRID_SIZE);
    cudaMalloc( (void**)&deviceModel2, ACTUAL_GRID_SIZE);
    dim3 grid(WIDTH, HEIGHT);

    cudaMemcpy( deviceModel, clientModel, ACTUAL_GRID_SIZE, cudaMemcpyHostToDevice);

    char* swapPointer = 0;
    for (int generation = 0; generation < NO_OF_GENERATIONS_TO_RUN; generation++) {
	runGeneration<<<grid,1>>>(deviceModel, deviceModel2);
	swapPointer = deviceModel;
	deviceModel = deviceModel2;
	deviceModel2 = swapPointer;
    
    	cudaMemcpy( clientModel, deviceModel, ACTUAL_GRID_SIZE, cudaMemcpyDeviceToHost );
    	printGrid(clientModel);
    }

    cudaFree(deviceModel);
    cudaFree(deviceModel2);
}

void printGrid(char grid[]) {
#ifdef CUBE
    system("clear");

    for(int y = 0; y < HEIGHT ; y++) {
       	for(int x = 0; x < WIDTH; x++) {
	    printf("%d", grid[x + y * WIDTH]);
	}
	printf("\n");	
    }
    printf("\n");
#endif

#ifdef DUMPFULL 

    for(int y = 0; y < HEIGHT ; y++) {
       	for(int x = 0; x < WIDTH; x++) {
	    printf("%d", grid[x + y * WIDTH]);
	}
    }

#endif

#ifdef DUMPCOUNT

    int count = 0;
    for(int x = 0; x < GRID_SIZE ; x++){
	if(grid[x] == 1) count++;
    }
    printf("%d\n", count);

#endif

}

__global__ void runGeneration(char currentModel[], char nextModel[]) {
    int startx, starty;

    getBlock(blockIdx.x, blockIdx.y, &startx, &starty);
    for (int x = startx; x < startx + BLOCK_WIDTH; x++) {
        for (int y = starty; y < starty + BLOCK_HEIGHT; y++) {
            int index = x + (y * WIDTH);
            runRules(currentModel, x, y, nextModel + index);
        }
    }
}

__device__ void getBlock(int x, int y, int* topLeftXOfBlock, int* topLeftYOfBlock) {
    *topLeftXOfBlock = x;
    *topLeftYOfBlock = y;
}

__device__ void getCountOfNeighbours(char model[], int x, int y, int* neighbourCount) {
   *neighbourCount = 0;
    addCellValue(model, x + 1, y, neighbourCount);
    addCellValue(model, x + 1, y + 1, neighbourCount);
    addCellValue(model, x + 1, y - 1, neighbourCount);
    addCellValue(model, x, y + 1, neighbourCount);
    addCellValue(model, x, y - 1, neighbourCount);
    addCellValue(model, x - 1, y, neighbourCount);
    addCellValue(model, x - 1, y + 1, neighbourCount);
    addCellValue(model, x - 1, y - 1, neighbourCount);
}

__device__ void addCellValue(char model[], int x, int y, int* value) {
    if (x < 0 || y < 0) return;
    if (x >= WIDTH || y >= HEIGHT) return;
    *value += model[x + y * WIDTH];
}

__device__ void runRules(char model[], int x, int y, char* fate) {
    int count;
    getCountOfNeighbours(model, x, y, &count);
    int index = x + (y * WIDTH);
    
    if (model[index] == 1) {
        if (count < 2 || count > 3) *fate = 0;
        if (count == 2 || count == 3) *fate = 1;
    } else {
        if (count == 3) { *fate = 1; }
        else { *fate = 0; }
    } 
}

	.file	"tmpxft_00326112_00000000-6_main.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2035:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2035:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"clear"
.LC1:
	.string	"%d"
.LC2:
	.string	"\n"
	.text
	.globl	_Z9printGridPc
	.type	_Z9printGridPc, @function
_Z9printGridPc:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	leaq	.LC0(%rip), %rdi
	pushq	%rcx
	.cfi_def_cfa_offset 48
	leaq	10000(%rbx), %r12
	call	system@PLT
.L3:
	xorl	%ebp, %ebp
.L4:
	movsbl	(%rbx,%rbp), %edx
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%rbp
	call	__printf_chk@PLT
	cmpq	$100, %rbp
	jne	.L4
	leaq	.LC2(%rip), %rbp
	movl	$2, %edi
	xorl	%eax, %eax
	addq	$100, %rbx
	movq	%rbp, %rsi
	call	__printf_chk@PLT
	cmpq	%r12, %rbx
	jne	.L3
	popq	%rdx
	.cfi_def_cfa_offset 40
	movq	%rbp, %rsi
	popq	%rbx
	.cfi_def_cfa_offset 32
	movl	$2, %edi
	popq	%rbp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2028:
	.size	_Z9printGridPc, .-_Z9printGridPc
	.globl	_Z8getBlockiiPiS_
	.type	_Z8getBlockiiPiS_, @function
_Z8getBlockiiPiS_:
.LFB2029:
	.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
.LFE2029:
	.size	_Z8getBlockiiPiS_, .-_Z8getBlockiiPiS_
	.globl	_Z20getCountOfNeighboursPciiPi
	.type	_Z20getCountOfNeighboursPciiPi, @function
_Z20getCountOfNeighboursPciiPi:
.LFB2030:
	.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
.LFE2030:
	.size	_Z20getCountOfNeighboursPciiPi, .-_Z20getCountOfNeighboursPciiPi
	.globl	_Z12addCellValuePciiPi
	.type	_Z12addCellValuePciiPi, @function
_Z12addCellValuePciiPi:
.LFB2177:
	.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
.LFE2177:
	.size	_Z12addCellValuePciiPi, .-_Z12addCellValuePciiPi
	.globl	_Z8runRulesPciiS_
	.type	_Z8runRulesPciiS_, @function
_Z8runRulesPciiS_:
.LFB2179:
	.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
.LFE2179:
	.size	_Z8runRulesPciiS_, .-_Z8runRulesPciiS_
	.globl	_Z35__device_stub__Z13runGenerationPcS_PcS_
	.type	_Z35__device_stub__Z13runGenerationPcS_PcS_, @function
_Z35__device_stub__Z13runGenerationPcS_PcS_:
.LFB2057:
	.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	.L17
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z13runGenerationPcS_(%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
.L17:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2057:
	.size	_Z35__device_stub__Z13runGenerationPcS_PcS_, .-_Z35__device_stub__Z13runGenerationPcS_PcS_
	.globl	_Z13runGenerationPcS_
	.type	_Z13runGenerationPcS_, @function
_Z13runGenerationPcS_:
.LFB2058:
	.cfi_startproc
	endbr64
	jmp	_Z35__device_stub__Z13runGenerationPcS_PcS_
	.cfi_endproc
.LFE2058:
	.size	_Z13runGenerationPcS_, .-_Z13runGenerationPcS_
	.section	.rodata.str1.1
.LC3:
	.string	"%d;%d\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.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	$4096, %rsp
	.cfi_def_cfa_offset 4128
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8224
	orq	$0, (%rsp)
	subq	$1856, %rsp
	.cfi_def_cfa_offset 10080
	movl	$100, %ecx
	movl	$100, %edx
	movl	$2, %edi
	leaq	.LC3(%rip), %rsi
	xorl	%ebp, %ebp
	movq	%fs:40, %rax
	movq	%rax, 10040(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rbx
	call	__printf_chk@PLT
	xorl	%edi, %edi
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
	xorl	%eax, %eax
	movq	%rax, (%rsp)
	movq	%rax, 8(%rsp)
.L23:
	call	rand@PLT
	movl	$2, %ecx
	incq	%rbp
	cltd
	idivl	%ecx
	movb	%dl, -1(%rbp,%rbx)
	cmpq	$10000, %rbp
	jne	.L23
	movq	%rbx, %rdi
	movl	$500, %ebp
	movabsq	$4294967297, %r12
	call	_Z9printGridPc
	movq	%rsp, %rdi
	movl	$10000, %esi
	call	cudaMalloc@PLT
	leaq	8(%rsp), %rdi
	movl	$10000, %esi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movabsq	$429496729700, %rax
	movl	$10000, %edx
	movl	$1, 24(%rsp)
	movq	%rax, 16(%rsp)
	call	cudaMemcpy@PLT
.L25:
	movq	16(%rsp), %rdi
	movl	24(%rsp), %esi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r12, %rdx
	movl	$1, %ecx
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L24
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	call	_Z35__device_stub__Z13runGenerationPcS_PcS_
.L24:
	movq	(%rsp), %rax
	movq	8(%rsp), %rsi
	movq	%rbx, %rdi
	movl	$2, %ecx
	movl	$10000, %edx
	movq	%rsi, (%rsp)
	movq	%rax, 8(%rsp)
	call	cudaMemcpy@PLT
	movq	%rbx, %rdi
	call	_Z9printGridPc
	decl	%ebp
	jne	.L25
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	10040(%rsp), %rax
	subq	%fs:40, %rax
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	addq	$10048, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	main, .-main
	.section	.rodata.str1.1
.LC4:
	.string	"_Z13runGenerationPcS_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2060:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 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	.LC4(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z13runGenerationPcS_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2060:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.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 <stdio.h>
#include <stdlib.h>
#include <time.h>

#define WIDTH 100
#define HEIGHT 100
#define GRID_SIZE WIDTH * HEIGHT
#define ACTUAL_GRID_SIZE sizeof(char) * GRID_SIZE
#define BLOCK_WIDTH 1
#define BLOCK_HEIGHT 1
#define NO_OF_GENERATIONS_TO_RUN 500

//#define DUMPFULL
//#define DUMPCOUNT
#define CUBE


__global__ void runGeneration(char currentModel[], char nextModel[]);
__device__ void getBlock(int x, int y, int* topLeftXOfBlock, int* topLeftYOfBlock);
__device__ void getCountOfNeighbours(char model[], int x, int y, int* neighbourCount);
__device__ void addCellValue(char model[], int x, int y, int* value);
__device__ void runRules(char model[], int x, int y, char* fate);

void printGrid(char grid[]);

int main(int argc, char** args) {
    printf("%d;%d\n", WIDTH, HEIGHT);
    srand( time(NULL) );

     char clientModel[GRID_SIZE];
    char* deviceModel = 0;
    char* deviceModel2 = 0;
       
    for(int index = 0 ; index < GRID_SIZE ; index++){
    	clientModel[index] =  rand() % 2;
    }

    printGrid(clientModel);

    hipMalloc( (void**)&deviceModel, ACTUAL_GRID_SIZE);
    hipMalloc( (void**)&deviceModel2, ACTUAL_GRID_SIZE);
    dim3 grid(WIDTH, HEIGHT);

    hipMemcpy( deviceModel, clientModel, ACTUAL_GRID_SIZE, hipMemcpyHostToDevice);

    char* swapPointer = 0;
    for (int generation = 0; generation < NO_OF_GENERATIONS_TO_RUN; generation++) {
	runGeneration<<<grid,1>>>(deviceModel, deviceModel2);
	swapPointer = deviceModel;
	deviceModel = deviceModel2;
	deviceModel2 = swapPointer;
    
    	hipMemcpy( clientModel, deviceModel, ACTUAL_GRID_SIZE, hipMemcpyDeviceToHost );
    	printGrid(clientModel);
    }

    hipFree(deviceModel);
    hipFree(deviceModel2);
}

void printGrid(char grid[]) {
#ifdef CUBE
    system("clear");

    for(int y = 0; y < HEIGHT ; y++) {
       	for(int x = 0; x < WIDTH; x++) {
	    printf("%d", grid[x + y * WIDTH]);
	}
	printf("\n");	
    }
    printf("\n");
#endif

#ifdef DUMPFULL 

    for(int y = 0; y < HEIGHT ; y++) {
       	for(int x = 0; x < WIDTH; x++) {
	    printf("%d", grid[x + y * WIDTH]);
	}
    }

#endif

#ifdef DUMPCOUNT

    int count = 0;
    for(int x = 0; x < GRID_SIZE ; x++){
	if(grid[x] == 1) count++;
    }
    printf("%d\n", count);

#endif

}

__global__ void runGeneration(char currentModel[], char nextModel[]) {
    int startx, starty;

    getBlock(blockIdx.x, blockIdx.y, &startx, &starty);
    for (int x = startx; x < startx + BLOCK_WIDTH; x++) {
        for (int y = starty; y < starty + BLOCK_HEIGHT; y++) {
            int index = x + (y * WIDTH);
            runRules(currentModel, x, y, nextModel + index);
        }
    }
}

__device__ void getBlock(int x, int y, int* topLeftXOfBlock, int* topLeftYOfBlock) {
    *topLeftXOfBlock = x;
    *topLeftYOfBlock = y;
}

__device__ void getCountOfNeighbours(char model[], int x, int y, int* neighbourCount) {
   *neighbourCount = 0;
    addCellValue(model, x + 1, y, neighbourCount);
    addCellValue(model, x + 1, y + 1, neighbourCount);
    addCellValue(model, x + 1, y - 1, neighbourCount);
    addCellValue(model, x, y + 1, neighbourCount);
    addCellValue(model, x, y - 1, neighbourCount);
    addCellValue(model, x - 1, y, neighbourCount);
    addCellValue(model, x - 1, y + 1, neighbourCount);
    addCellValue(model, x - 1, y - 1, neighbourCount);
}

__device__ void addCellValue(char model[], int x, int y, int* value) {
    if (x < 0 || y < 0) return;
    if (x >= WIDTH || y >= HEIGHT) return;
    *value += model[x + y * WIDTH];
}

__device__ void runRules(char model[], int x, int y, char* fate) {
    int count;
    getCountOfNeighbours(model, x, y, &count);
    int index = x + (y * WIDTH);
    
    if (model[index] == 1) {
        if (count < 2 || count > 3) *fate = 0;
        if (count == 2 || count == 3) *fate = 1;
    } else {
        if (count == 3) { *fate = 1; }
        else { *fate = 0; }
    } 
}

	.text
	.file	"main.hip"
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$10024, %rsp                    # imm = 0x2728
	.cfi_def_cfa_offset 10064
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	xorl	%ebx, %ebx
	movl	$.L.str, %edi
	movl	$100, %esi
	movl	$100, %edx
	xorl	%eax, %eax
	callq	printf
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	movq	%rbx, 8(%rsp)
	movq	%rbx, (%rsp)
.LBB0_1:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	andl	$254, %ecx
	subl	%ecx, %eax
	movb	%al, 16(%rsp,%rbx)
	incq	%rbx
	cmpq	$10000, %rbx                    # imm = 0x2710
	jne	.LBB0_1
# %bb.2:
	leaq	16(%rsp), %rbx
	movq	%rbx, %rdi
	callq	_Z9printGridPc
	leaq	8(%rsp), %r14
	movl	$10000, %esi                    # imm = 0x2710
	movq	%r14, %rdi
	callq	hipMalloc
	movq	%rsp, %rdi
	movl	$10000, %esi                    # imm = 0x2710
	callq	hipMalloc
	movq	(%r14), %rdi
	movl	$10000, %edx                    # imm = 0x2710
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$500, %ebp                      # imm = 0x1F4
	movabsq	$429496729700, %r14             # imm = 0x6400000064
	movabsq	$4294967297, %r15               # imm = 0x100000001
.LBB0_3:                                # =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB0_5
# %bb.4:                                #   in Loop: Header=BB0_3 Depth=1
	movq	8(%rsp), %rdi
	movq	(%rsp), %rsi
	callq	_Z28__device_stub__runGenerationPcS_
.LBB0_5:                                #   in Loop: Header=BB0_3 Depth=1
	movq	8(%rsp), %rax
	movq	(%rsp), %rsi
	movq	%rsi, 8(%rsp)
	movq	%rax, (%rsp)
	movl	$10000, %edx                    # imm = 0x2710
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	%rbx, %rdi
	callq	_Z9printGridPc
	decl	%ebp
	jne	.LBB0_3
# %bb.6:
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	addq	$10024, %rsp                    # imm = 0x2728
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.globl	_Z9printGridPc                  # -- Begin function _Z9printGridPc
	.type	_Z9printGridPc,@function
_Z9printGridPc:                         # @_Z9printGridPc
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movl	$.L.str.1, %edi
	callq	system
	xorl	%r14d, %r14d
.LBB1_1:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_2 Depth 2
	movq	$-100, %r15
.LBB1_2:                                #   Parent Loop BB1_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsbl	100(%rbx,%r15), %esi
	movl	$.L.str.2, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r15
	jne	.LBB1_2
# %bb.3:                                #   in Loop: Header=BB1_1 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r14
	addq	$100, %rbx
	cmpq	$100, %r14
	jne	.LBB1_1
# %bb.4:
	movl	$10, %edi
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	putchar@PLT                     # TAILCALL
.Lfunc_end1:
	.size	_Z9printGridPc, .Lfunc_end1-_Z9printGridPc
	.cfi_endproc
                                        # -- End function
	.globl	_Z28__device_stub__runGenerationPcS_ # -- Begin function _Z28__device_stub__runGenerationPcS_
	.type	_Z28__device_stub__runGenerationPcS_,@function
_Z28__device_stub__runGenerationPcS_:   # @_Z28__device_stub__runGenerationPcS_
	.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	$_Z13runGenerationPcS_, %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_end2:
	.size	_Z28__device_stub__runGenerationPcS_, .Lfunc_end2-_Z28__device_stub__runGenerationPcS_
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB3_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB3_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13runGenerationPcS_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end3:
	.size	__hip_module_ctor, .Lfunc_end3-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB4_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB4_2:
	retq
.Lfunc_end4:
	.size	__hip_module_dtor, .Lfunc_end4-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%d;%d\n"
	.size	.L.str, 7

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

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

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

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z13runGenerationPcS_"
	.size	.L__unnamed_1, 22

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

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

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z13runGenerationPcS_   ; -- Begin function _Z13runGenerationPcS_
	.globl	_Z13runGenerationPcS_
	.p2align	8
	.type	_Z13runGenerationPcS_,@function
_Z13runGenerationPcS_:                  ; @_Z13runGenerationPcS_
; %bb.0:                                ; %.preheader
	s_load_b128 s[0:3], s[0:1], 0x0
	s_add_i32 s10, s14, 1
	s_cmpk_gt_i32 s14, 0x62
	v_mov_b32_e32 v0, 0
	s_cselect_b32 s11, -1, 0
	s_or_b32 s4, s15, s10
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(SALU_CYCLE_1)
	s_cmp_lt_i32 s4, 0
	s_cselect_b32 s4, -1, 0
	s_cmpk_gt_i32 s15, 0x63
	s_cselect_b32 s5, -1, 0
	s_or_b32 s6, s5, s11
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s4, s6, s4
	s_and_b32 vcc_lo, exec_lo, s4
	s_mul_i32 s4, s15, 0x64
	s_cbranch_vccnz .LBB0_2
; %bb.1:
	s_add_i32 s6, s4, s10
	s_delay_alu instid0(SALU_CYCLE_1)
	v_mov_b32_e32 v0, s6
	s_waitcnt lgkmcnt(0)
	global_load_i8 v0, v0, s[0:1]
.LBB0_2:                                ; %_Z12addCellValuePciiPi.exit.i.i
	s_add_i32 s6, s15, 1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s7, s6, s10
	s_cmp_lt_i32 s7, 0
	s_cselect_b32 s7, -1, 0
	s_cmpk_gt_i32 s15, 0x62
	s_cselect_b32 s8, -1, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s7, s8, s7
	s_or_b32 s7, s7, s11
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 vcc_lo, exec_lo, s7
	s_cbranch_vccnz .LBB0_4
; %bb.3:
	s_mul_i32 s7, s6, 0x64
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s7, s7, s10
	v_mov_b32_e32 v1, s7
	s_waitcnt lgkmcnt(0)
	global_load_i8 v1, v1, s[0:1]
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v0, v1
.LBB0_4:                                ; %_Z12addCellValuePciiPi.exit34.i.i
	s_add_i32 s7, s15, -1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s9, s7, s10
	s_cmp_lt_i32 s9, 0
	s_cselect_b32 s12, -1, 0
	s_cmpk_gt_i32 s15, 0x64
	s_cselect_b32 s9, -1, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s12, s9, s12
	s_or_b32 s11, s12, s11
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 vcc_lo, exec_lo, s11
	s_cbranch_vccnz .LBB0_6
; %bb.5:
	s_add_i32 s10, s4, s10
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_addk_i32 s10, 0xff9c
	v_mov_b32_e32 v1, s10
	s_waitcnt lgkmcnt(0)
	global_load_i8 v1, v1, s[0:1]
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v0, v1
.LBB0_6:                                ; %_Z12addCellValuePciiPi.exit37.i.i
	s_cmpk_gt_i32 s14, 0x63
	s_cselect_b32 s10, -1, 0
	s_or_b32 s11, s6, s14
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_cmp_lt_i32 s11, 0
	s_cselect_b32 s11, -1, 0
	s_or_b32 s11, s8, s11
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s11, s11, s10
	s_and_b32 vcc_lo, exec_lo, s11
	s_cbranch_vccnz .LBB0_8
; %bb.7:
	s_add_i32 s11, s4, s14
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_addk_i32 s11, 0x64
	v_mov_b32_e32 v1, s11
	s_waitcnt lgkmcnt(0)
	global_load_i8 v1, v1, s[0:1]
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v0, v1
.LBB0_8:                                ; %_Z12addCellValuePciiPi.exit40.i.i
	s_or_b32 s11, s7, s14
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_cmp_lt_i32 s11, 0
	s_cselect_b32 s11, -1, 0
	s_or_b32 s11, s9, s11
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s10, s11, s10
	s_and_b32 vcc_lo, exec_lo, s10
	s_cbranch_vccnz .LBB0_10
; %bb.9:
	s_add_i32 s10, s4, s14
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_addk_i32 s10, 0xff9c
	v_mov_b32_e32 v1, s10
	s_waitcnt lgkmcnt(0)
	global_load_i8 v1, v1, s[0:1]
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v0, v1
.LBB0_10:                               ; %_Z12addCellValuePciiPi.exit43.i.i
	s_add_i32 s10, s14, -1
	s_cmpk_gt_i32 s14, 0x64
	s_cselect_b32 s11, -1, 0
	s_or_b32 s12, s15, s10
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_cmp_lt_i32 s12, 0
	s_cselect_b32 s12, -1, 0
	s_or_b32 s5, s5, s12
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s5, s5, s11
	s_and_b32 vcc_lo, exec_lo, s5
	s_cbranch_vccnz .LBB0_12
; %bb.11:
	s_add_i32 s5, s4, s10
	s_delay_alu instid0(SALU_CYCLE_1)
	v_mov_b32_e32 v1, s5
	s_waitcnt lgkmcnt(0)
	global_load_i8 v1, v1, s[0:1]
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v0, v1
.LBB0_12:                               ; %_Z12addCellValuePciiPi.exit46.i.i
	s_or_b32 s5, s6, s10
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_cmp_lt_i32 s5, 0
	s_cselect_b32 s5, -1, 0
	s_or_b32 s5, s8, s5
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s5, s5, s11
	s_and_b32 vcc_lo, exec_lo, s5
	s_cbranch_vccnz .LBB0_14
; %bb.13:
	s_add_i32 s5, s4, s10
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_addk_i32 s5, 0x64
	v_mov_b32_e32 v1, s5
	s_waitcnt lgkmcnt(0)
	global_load_i8 v1, v1, s[0:1]
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v0, v1
.LBB0_14:                               ; %_Z12addCellValuePciiPi.exit49.i.i
	s_or_b32 s5, s7, s10
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_cmp_lt_i32 s5, 0
	s_cselect_b32 s5, -1, 0
	s_or_b32 s5, s9, s5
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s5, s5, s11
	s_and_b32 vcc_lo, exec_lo, s5
	s_cbranch_vccnz .LBB0_16
; %bb.15:
	s_add_i32 s5, s4, s10
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_addk_i32 s5, 0xff9c
	v_mov_b32_e32 v1, s5
	s_waitcnt lgkmcnt(0)
	global_load_i8 v1, v1, s[0:1]
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v0, v1
.LBB0_16:                               ; %_Z20getCountOfNeighboursPciiPi.exit.i
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_and_b32_e32 v3, -2, v0
	v_cmp_eq_u32_e32 vcc_lo, 3, v0
	s_add_i32 s4, s4, s14
	s_ashr_i32 s5, s4, 31
	s_waitcnt lgkmcnt(0)
	s_add_u32 s2, s2, s4
	v_cndmask_b32_e64 v0, 0, 1, vcc_lo
	v_cmp_eq_u32_e32 vcc_lo, 2, v3
	s_addc_u32 s3, s3, s5
	s_add_u32 s0, s0, s4
	s_addc_u32 s1, s1, s5
	v_cndmask_b32_e64 v3, 0, 1, vcc_lo
	v_mov_b32_e32 v1, 0
	global_load_u8 v2, v1, s[0:1]
	s_waitcnt vmcnt(0)
	v_cmp_eq_u16_e32 vcc_lo, 1, v2
	v_cndmask_b32_e32 v0, v0, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_and_b32_e32 v0, 1, v0
	global_store_b8 v1, v0, s[2:3]
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13runGenerationPcS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 16
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 4
		.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	_Z13runGenerationPcS_, .Lfunc_end0-_Z13runGenerationPcS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 772
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
    .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:           _Z13runGenerationPcS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z13runGenerationPcS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
