
#include "cuda_runtime.h"
#include "cuda.h"
#include "device_launch_parameters.h"
#include "iostream"
#include "stdlib.h"
#include <thread>         // std::this_thread::sleep_for
#include <chrono>         // std::chrono::seconds
#include "time.h"
#include <ctime>
#include "fstream"



using namespace std;

int getPos(int m, int n, const int width) {
	return m* width + n;
}

void printCells(int* cells, int const height, int const width) {
	for (int i = 0; i < height + 2; i++) {
		for (int j = 0; j < width + 2; j++) { 
			if (cells[getPos(i, j, width)] == 1) {
				cout << "O" << " ";
			}
			else {
				cout << "-" << " ";
			}
		}
		cout << endl;
	}
	cout << endl;
	std::this_thread::sleep_for(std::chrono::milliseconds(100));
	system("cls");
}

void populateArray(int* cellArray, int arraySize) {
	for (int i = 0; i < arraySize; i++) { 
		cellArray[i] = rand() % 2;
	}
}

__device__ int getX(int i, int width) {
	return i % width;
}

__device__ int getY(int i, int width) {
	return i / width;
}

__device__ int getI(int m, int n, int width) {
	return m * width + n;
}


//Gets the neigbour cells via von Neuman Neigbourhood 
__device__ int getNeigbours(int m, int n, int* cells, int width, int height) {
	int neigbours = 0;
	for (int i = m - 1; i <= m + 1; i++) {
		for (int j = n - 1; j <= n + 1; j++) {
			if (i >= 0 && i < height && j >= 0 && j < width) {
				neigbours += cells[getI(i, j, width)];
			}
			else {
				neigbours += cells[getI((i + height) % height, (j + width) % width, width)];
			}
		}
	}
	return neigbours;
}

// rules that determines the state of the cell
__device__ int rules(int neigbours, int state) {
	int n = neigbours - state;
	if (state == 1) {
		if (n > 1 && n < 4) {
			return 1;
		}
		else {
			return 0;
		}
	}
	else {
		if (n == 3){
			return 1;
		}
		return 0;
	}

}

// creates the new state of the world
__global__ void evolve(int* cells, const int height, const int width, const int arraySize, const int cellsPerThread) {
	extern __shared__ int sharedCells[];
	int i = threadIdx.x + blockIdx.x * blockDim.x;
	for (int k = i * cellsPerThread; k < ((i + 1) * cellsPerThread); k++) {		
		sharedCells[k] = cells[k];
		int x, y, neigbours;
		x = getX(k, width);
		y = getY(k, width);
		neigbours = getNeigbours(y, x, sharedCells, width, height);
		cells[k] = rules(neigbours, sharedCells[getI(y, x, width)]);
		__syncthreads();
	}

	
}

// Runs the simulation
int main() {
	srand(1);
	const int height = 100, width = 100, arraySize = 10000, timeSteps = 10000, cellsPerThread = 10, gridSize = 10;
	char b;
	int* cells; // CPU
	int* cellsDev; // GPU

	cells = (int*)malloc(sizeof(int)*arraySize); // creating arrays
	populateArray(cells, arraySize);

	cudaMalloc((void**)&cellsDev, sizeof(float)*arraySize); // creating space on gpu

	cudaMemcpy(cellsDev, cells, sizeof(int)*arraySize, cudaMemcpyHostToDevice); // copying arrays to gpu
	clock_t begin = clock();
	for (int i = 1; i < timeSteps; i++) {
		evolve <<<gridSize, arraySize / cellsPerThread / gridSize >>>(cellsDev, height, width, arraySize, cellsPerThread); // running evolution iteration	
	}
	clock_t end = clock();
	
	cudaMemcpy(cells, cellsDev, sizeof(int)*arraySize, cudaMemcpyDeviceToHost); // copying cells back from gpu to cpu	
	cudaFree(cellsDev);

	double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
	cout << elapsed_secs;

	ofstream myfile;
	myfile.open("para4.txt");
	for (int i = 0; i < arraySize; i++) {
		myfile << cells[i] << endl;
	}
	free(cells);
	myfile.close();
	cin >> b;
	return 0;
}

	.file	"tmpxft_00218786_00000000-6_Para4.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3987:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3987:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z6getPosiii
	.type	_Z6getPosiii, @function
_Z6getPosiii:
.LFB3976:
	.cfi_startproc
	endbr64
	imull	%edx, %edi
	leal	(%rdi,%rsi), %eax
	ret
	.cfi_endproc
.LFE3976:
	.size	_Z6getPosiii, .-_Z6getPosiii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"O"
.LC1:
	.string	" "
.LC2:
	.string	"-"
.LC3:
	.string	"cls"
	.text
	.globl	_Z10printCellsPiii
	.type	_Z10printCellsPiii, @function
_Z10printCellsPiii:
.LFB3977:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%esi, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edx, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%rdi, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
.L4:
	leal	1(%r14), %eax
	cmpl	%r13d, %eax
	jl	.L8
	movq	8(%rsp), %rcx
	movslq	%r12d, %rax
	xorl	%ebp, %ebp
	leaq	(%rcx,%rax,4), %r15
.L9:
	leal	1(%rbx), %eax
	cmpl	%ebp, %eax
	jl	.L18
	cmpl	$1, (%r15,%rbp,4)
	leaq	.LC0(%rip), %rsi
	je	.L16
	leaq	.LC2(%rip), %rsi
.L16:
	leaq	_ZSt4cout(%rip), %rdi
	incq	%rbp
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L9
.L18:
	leaq	_ZSt4cout(%rip), %rdi
	incl	%r13d
	addl	%ebx, %r12d
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	jmp	.L4
.L8:
	leaq	_ZSt4cout(%rip), %rdi
	leaq	24(%rsp), %rbx
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	xorl	%eax, %eax
	movq	$100000000, 32(%rsp)
	movq	%rax, 24(%rsp)
.L11:
	movq	%rbx, %rsi
	movq	%rbx, %rdi
	call	nanosleep@PLT
	incl	%eax
	jne	.L10
	call	__errno_location@PLT
	cmpl	$4, (%rax)
	je	.L11
.L10:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	leaq	.LC3(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	system@PLT
	.cfi_endproc
.LFE3977:
	.size	_Z10printCellsPiii, .-_Z10printCellsPiii
	.globl	_Z13populateArrayPii
	.type	_Z13populateArrayPii, @function
_Z13populateArrayPii:
.LFB3978:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$2, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
	pushq	%rdx
	.cfi_def_cfa_offset 48
.L20:
	cmpl	%ebx, %ebp
	jle	.L23
	call	rand@PLT
	cltd
	idivl	%r13d
	movl	%edx, (%r12,%rbx,4)
	incq	%rbx
	jmp	.L20
.L23:
	popq	%rax
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3978:
	.size	_Z13populateArrayPii, .-_Z13populateArrayPii
	.globl	_Z4getXii
	.type	_Z4getXii, @function
_Z4getXii:
.LFB3979:
	.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
.LFE3979:
	.size	_Z4getXii, .-_Z4getXii
	.globl	_Z4getYii
	.type	_Z4getYii, @function
_Z4getYii:
.LFB4767:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	_Z4getXii
	.cfi_endproc
.LFE4767:
	.size	_Z4getYii, .-_Z4getYii
	.globl	_Z4getIiii
	.type	_Z4getIiii, @function
_Z4getIiii:
.LFB3981:
	.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
.LFE3981:
	.size	_Z4getIiii, .-_Z4getIiii
	.globl	_Z12getNeigboursiiPiii
	.type	_Z12getNeigboursiiPiii, @function
_Z12getNeigboursiiPiii:
.LFB3982:
	.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
.LFE3982:
	.size	_Z12getNeigboursiiPiii, .-_Z12getNeigboursiiPiii
	.globl	_Z5rulesii
	.type	_Z5rulesii, @function
_Z5rulesii:
.LFB4769:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	_Z4getXii
	.cfi_endproc
.LFE4769:
	.size	_Z5rulesii, .-_Z5rulesii
	.globl	_Z29__device_stub__Z6evolvePiiiiiPiiiii
	.type	_Z29__device_stub__Z6evolvePiiiiiPiiiii, @function
_Z29__device_stub__Z6evolvePiiiiiPiiiii:
.LFB4009:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 12(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L34
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z6evolvePiiiii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L34:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L36
	call	__stack_chk_fail@PLT
.L36:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4009:
	.size	_Z29__device_stub__Z6evolvePiiiiiPiiiii, .-_Z29__device_stub__Z6evolvePiiiiiPiiiii
	.globl	_Z6evolvePiiiii
	.type	_Z6evolvePiiiii, @function
_Z6evolvePiiiii:
.LFB4010:
	.cfi_startproc
	endbr64
	jmp	_Z29__device_stub__Z6evolvePiiiiiPiiiii
	.cfi_endproc
.LFE4010:
	.size	_Z6evolvePiiiii, .-_Z6evolvePiiiii
	.section	.rodata.str1.1
.LC4:
	.string	"_Z6evolvePiiiii"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4012:
	.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	_Z6evolvePiiiii(%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
.LFE4012:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC6:
	.string	"para4.txt"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3984:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3984
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$1, %edi
	movabsq	$4294967396, %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	$9999, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$568, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 552(%rsp)
	xorl	%eax, %eax
	call	srand@PLT
	movl	$40000, %edi
	call	malloc@PLT
	movl	$10000, %esi
	movq	%rax, %rdi
	movq	%rax, %rbx
	call	_Z13populateArrayPii
	leaq	8(%rsp), %rdi
	movl	$40000, %esi
.LEHB0:
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$40000, %edx
	call	cudaMemcpy@PLT
	call	clock@PLT
	movq	%rax, %r12
.L43:
	movl	$2147483653, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r13, %rdx
	addq	%rdi, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movq	%r13, 28(%rsp)
	movl	$1, 36(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L42
	movq	8(%rsp), %rdi
	movl	$10, %r8d
	movl	$10000, %ecx
	movl	$100, %edx
	movl	$100, %esi
	call	_Z29__device_stub__Z6evolvePiiiiiPiiiii
.L42:
	decl	%ebp
	jne	.L43
	call	clock@PLT
	movq	8(%rsp), %rsi
	movl	$40000, %edx
	movq	%rbx, %rdi
	movl	$2, %ecx
	movq	%rax, %rbp
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdi
	subq	%r12, %rbp
	call	cudaFree@PLT
	cvtsi2sdq	%rbp, %xmm0
	leaq	_ZSt4cout(%rip), %rdi
	divsd	.LC5(%rip), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	40(%rsp), %rbp
	movq	%rbp, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE0:
	movl	$16, %edx
	leaq	.LC6(%rip), %rsi
	movq	%rbp, %rdi
.LEHB1:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	xorl	%r12d, %r12d
.L44:
	movl	(%rbx,%r12,4), %esi
	movq	%rbp, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	incq	%r12
	cmpq	$10000, %r12
	jne	.L44
	movq	%rbx, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	leaq	28(%rsp), %rsi
	leaq	_ZSt3cin(%rip), %rdi
	call	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_@PLT
.LEHE1:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	je	.L47
	jmp	.L51
.L48:
	endbr64
	movq	%rax, %rbx
.L45:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	movq	%rbx, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L51:
	call	__stack_chk_fail@PLT
.L47:
	addq	$568, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3984:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3984:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3984-.LLSDACSB3984
.LLSDACSB3984:
	.uleb128 .LEHB0-.LFB3984
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3984
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L48-.LFB3984
	.uleb128 0
	.uleb128 .LEHB2-.LFB3984
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE3984:
	.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
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC5:
	.long	0
	.long	1093567616
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include "hip/hip_runtime.h"


#include "iostream"
#include "stdlib.h"
#include <thread>         // std::this_thread::sleep_for
#include <chrono>         // std::chrono::seconds
#include "time.h"
#include <ctime>
#include "fstream"



using namespace std;

int getPos(int m, int n, const int width) {
	return m* width + n;
}

void printCells(int* cells, int const height, int const width) {
	for (int i = 0; i < height + 2; i++) {
		for (int j = 0; j < width + 2; j++) { 
			if (cells[getPos(i, j, width)] == 1) {
				cout << "O" << " ";
			}
			else {
				cout << "-" << " ";
			}
		}
		cout << endl;
	}
	cout << endl;
	std::this_thread::sleep_for(std::chrono::milliseconds(100));
	system("cls");
}

void populateArray(int* cellArray, int arraySize) {
	for (int i = 0; i < arraySize; i++) { 
		cellArray[i] = rand() % 2;
	}
}

__device__ int getX(int i, int width) {
	return i % width;
}

__device__ int getY(int i, int width) {
	return i / width;
}

__device__ int getI(int m, int n, int width) {
	return m * width + n;
}


//Gets the neigbour cells via von Neuman Neigbourhood 
__device__ int getNeigbours(int m, int n, int* cells, int width, int height) {
	int neigbours = 0;
	for (int i = m - 1; i <= m + 1; i++) {
		for (int j = n - 1; j <= n + 1; j++) {
			if (i >= 0 && i < height && j >= 0 && j < width) {
				neigbours += cells[getI(i, j, width)];
			}
			else {
				neigbours += cells[getI((i + height) % height, (j + width) % width, width)];
			}
		}
	}
	return neigbours;
}

// rules that determines the state of the cell
__device__ int rules(int neigbours, int state) {
	int n = neigbours - state;
	if (state == 1) {
		if (n > 1 && n < 4) {
			return 1;
		}
		else {
			return 0;
		}
	}
	else {
		if (n == 3){
			return 1;
		}
		return 0;
	}

}

// creates the new state of the world
__global__ void evolve(int* cells, const int height, const int width, const int arraySize, const int cellsPerThread) {
	extern __shared__ int sharedCells[];
	int i = threadIdx.x + blockIdx.x * blockDim.x;
	for (int k = i * cellsPerThread; k < ((i + 1) * cellsPerThread); k++) {		
		sharedCells[k] = cells[k];
		int x, y, neigbours;
		x = getX(k, width);
		y = getY(k, width);
		neigbours = getNeigbours(y, x, sharedCells, width, height);
		cells[k] = rules(neigbours, sharedCells[getI(y, x, width)]);
		__syncthreads();
	}

	
}

// Runs the simulation
int main() {
	srand(1);
	const int height = 100, width = 100, arraySize = 10000, timeSteps = 10000, cellsPerThread = 10, gridSize = 10;
	char b;
	int* cells; // CPU
	int* cellsDev; // GPU

	cells = (int*)malloc(sizeof(int)*arraySize); // creating arrays
	populateArray(cells, arraySize);

	hipMalloc((void**)&cellsDev, sizeof(float)*arraySize); // creating space on gpu

	hipMemcpy(cellsDev, cells, sizeof(int)*arraySize, hipMemcpyHostToDevice); // copying arrays to gpu
	clock_t begin = clock();
	for (int i = 1; i < timeSteps; i++) {
		evolve <<<gridSize, arraySize / cellsPerThread / gridSize >>>(cellsDev, height, width, arraySize, cellsPerThread); // running evolution iteration	
	}
	clock_t end = clock();
	
	hipMemcpy(cells, cellsDev, sizeof(int)*arraySize, hipMemcpyDeviceToHost); // copying cells back from gpu to cpu	
	hipFree(cellsDev);

	double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
	cout << elapsed_secs;

	ofstream myfile;
	myfile.open("para4.txt");
	for (int i = 0; i < arraySize; i++) {
		myfile << cells[i] << endl;
	}
	free(cells);
	myfile.close();
	cin >> b;
	return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z6getPosiii                    # -- Begin function _Z6getPosiii
	.type	_Z6getPosiii,@function
_Z6getPosiii:                           # @_Z6getPosiii
	.cfi_startproc
# %bb.0:
                                        # kill: def $esi killed $esi def $rsi
                                        # kill: def $edi killed $edi def $rdi
	imull	%edx, %edi
	leal	(%rdi,%rsi), %eax
	retq
.Lfunc_end0:
	.size	_Z6getPosiii, .Lfunc_end0-_Z6getPosiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z10printCellsPiii              # -- Begin function _Z10printCellsPiii
	.type	_Z10printCellsPiii,@function
_Z10printCellsPiii:                     # @_Z10printCellsPiii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
                                        # kill: def $edx killed $edx def $rdx
	movq	%rdx, (%rsp)                    # 8-byte Spill
	cmpl	$-1, %esi
	jl	.LBB1_8
# %bb.1:                                # %.preheader.lr.ph
	movl	%esi, %r14d
	movq	%rdi, %r15
	movq	(%rsp), %rax                    # 8-byte Reload
	leal	2(%rax), %r12d
	movslq	%eax, %r13
	addl	$2, %r14d
	shlq	$2, %r13
	xorl	%ebp, %ebp
.LBB1_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_4 Depth 2
	cmpl	$-1, (%rsp)                     # 4-byte Folded Reload
	jl	.LBB1_7
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB1_2 Depth=1
	xorl	%ebx, %ebx
.LBB1_4:                                #   Parent Loop BB1_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpl	$1, (%r15,%rbx,4)
	movl	$.L.str, %esi
	je	.LBB1_6
# %bb.5:                                #   in Loop: Header=BB1_4 Depth=2
	movl	$.L.str.2, %esi
.LBB1_6:                                #   in Loop: Header=BB1_4 Depth=2
	movl	$_ZSt4cout, %edi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	incq	%rbx
	cmpq	%rbx, %r12
	jne	.LBB1_4
.LBB1_7:                                # %._crit_edge
                                        #   in Loop: Header=BB1_2 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	incq	%rbp
	addq	%r13, %r15
	cmpq	%r14, %rbp
	jne	.LBB1_2
.LBB1_8:                                # %._crit_edge12
	movq	_ZSt4cout(%rip), %rax
	movl	$_ZSt4cout, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	leaq	8(%rsp), %rbx
	movq	$0, (%rbx)
	movq	$100000000, 8(%rbx)             # imm = 0x5F5E100
.LBB1_9:                                # =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movq	%rbx, %rsi
	callq	nanosleep
	cmpl	$-1, %eax
	jne	.LBB1_11
# %bb.10:                               #   in Loop: Header=BB1_9 Depth=1
	callq	__errno_location
	cmpl	$4, (%rax)
	je	.LBB1_9
.LBB1_11:                               # %_ZNSt11this_thread9sleep_forIlSt5ratioILl1ELl1000EEEEvRKNSt6chrono8durationIT_T0_EE.exit
	movl	$.L.str.3, %edi
	callq	system
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z10printCellsPiii, .Lfunc_end1-_Z10printCellsPiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z13populateArrayPii            # -- Begin function _Z13populateArrayPii
	.type	_Z13populateArrayPii,@function
_Z13populateArrayPii:                   # @_Z13populateArrayPii
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB2_4
# %bb.1:                                # %.lr.ph.preheader
	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	%esi, %r14d
	xorl	%r15d, %r15d
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	andl	$-2, %ecx
	subl	%ecx, %eax
	movl	%eax, (%rbx,%r15,4)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB2_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB2_4:                                # %._crit_edge
	retq
.Lfunc_end2:
	.size	_Z13populateArrayPii, .Lfunc_end2-_Z13populateArrayPii
	.cfi_endproc
                                        # -- End function
	.globl	_Z21__device_stub__evolvePiiiii # -- Begin function _Z21__device_stub__evolvePiiiii
	.type	_Z21__device_stub__evolvePiiiii,@function
_Z21__device_stub__evolvePiiiii:        # @_Z21__device_stub__evolvePiiiii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	20(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	16(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	12(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	8(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%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	$_Z6evolvePiiiii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z21__device_stub__evolvePiiiii, .Lfunc_end3-_Z21__device_stub__evolvePiiiii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI4_0:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$528, %rsp                      # imm = 0x210
	.cfi_def_cfa_offset 576
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$1, %edi
	callq	srand
	movl	$40000, %edi                    # imm = 0x9C40
	callq	malloc
	movq	%rax, %rbx
	xorl	%r14d, %r14d
.LBB4_1:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	andl	$-2, %ecx
	subl	%ecx, %eax
	movl	%eax, (%rbx,%r14,4)
	incq	%r14
	cmpq	$10000, %r14                    # imm = 0x2710
	jne	.LBB4_1
# %bb.2:                                # %_Z13populateArrayPii.exit
	movabsq	$4294967306, %r14               # imm = 0x10000000A
	leaq	8(%rsp), %r15
	movl	$40000, %esi                    # imm = 0x9C40
	movq	%r15, %rdi
	callq	hipMalloc
	movq	(%r15), %rdi
	movl	$40000, %edx                    # imm = 0x9C40
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$9999, %ebp                     # imm = 0x270F
	callq	clock
	movq	%rax, %r15
	leaq	90(%r14), %r12
.LBB4_3:                                # =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_5
# %bb.4:                                #   in Loop: Header=BB4_3 Depth=1
	movq	8(%rsp), %rdi
	movl	$100, %esi
	movl	$100, %edx
	movl	$10000, %ecx                    # imm = 0x2710
	movl	$10, %r8d
	callq	_Z21__device_stub__evolvePiiiii
.LBB4_5:                                #   in Loop: Header=BB4_3 Depth=1
	decl	%ebp
	jne	.LBB4_3
# %bb.6:
	callq	clock
	movq	%rax, %r14
	movq	8(%rsp), %rsi
	movl	$40000, %edx                    # imm = 0x9C40
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	callq	hipFree
	subq	%r15, %r14
	cvtsi2sd	%r14, %xmm0
	divsd	.LCPI4_0(%rip), %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	leaq	16(%rsp), %r14
	movq	%r14, %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp0:
	movl	$.L.str.4, %esi
	movq	%r14, %rdi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp1:
# %bb.7:                                # %.preheader.preheader
	xorl	%r12d, %r12d
	leaq	16(%rsp), %r14
.LBB4_8:                                # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rbx,%r12,4), %esi
.Ltmp2:
	movq	%r14, %rdi
	callq	_ZNSolsEi
.Ltmp3:
# %bb.9:                                #   in Loop: Header=BB4_8 Depth=1
	movq	%rax, %r15
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
.Ltmp4:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp5:
# %bb.10:                               # %.noexc
                                        #   in Loop: Header=BB4_8 Depth=1
.Ltmp6:
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
.Ltmp7:
# %bb.11:                               # %.noexc21
                                        #   in Loop: Header=BB4_8 Depth=1
.Ltmp8:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp9:
# %bb.12:                               # %_ZNSolsEPFRSoS_E.exit
                                        #   in Loop: Header=BB4_8 Depth=1
	incq	%r12
	cmpq	$10000, %r12                    # imm = 0x2710
	jne	.LBB4_8
# %bb.13:
	movq	%rbx, %rdi
	callq	free
.Ltmp11:
	leaq	16(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp12:
# %bb.14:
.Ltmp13:
	leaq	7(%rsp), %rsi
	movl	$_ZSt3cin, %edi
	callq	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_
.Ltmp14:
# %bb.15:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	24(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 16(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	264(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	xorl	%eax, %eax
	addq	$528, %rsp                      # imm = 0x210
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB4_16:
	.cfi_def_cfa_offset 576
.Ltmp15:
	jmp	.LBB4_17
.LBB4_18:
.Ltmp10:
.LBB4_17:
	movq	%rax, %rbx
	leaq	16(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table4:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp15-.Lfunc_begin0          #     jumps to .Ltmp15
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp2-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp9-.Ltmp2                  #   Call between .Ltmp2 and .Ltmp9
	.uleb128 .Ltmp10-.Lfunc_begin0          #     jumps to .Ltmp10
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp11-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp14-.Ltmp11                #   Call between .Ltmp11 and .Ltmp14
	.uleb128 .Ltmp15-.Lfunc_begin0          #     jumps to .Ltmp15
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp14-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Lfunc_end4-.Ltmp14            #   Call between .Ltmp14 and .Lfunc_end4
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- 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:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z6evolvePiiiii, %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_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	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"O"
	.size	.L.str, 2

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"-"
	.size	.L.str.2, 2

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

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

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

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z6evolvePiiiii"
	.size	.L__unnamed_1, 16

	.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 _Z21__device_stub__evolvePiiiii
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _ZSt4cout
	.addrsig_sym _Z6evolvePiiiii
	.addrsig_sym _ZSt3cin
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z6evolvePiiiii         ; -- Begin function _Z6evolvePiiiii
	.globl	_Z6evolvePiiiii
	.p2align	8
	.type	_Z6evolvePiiiii,@function
_Z6evolvePiiiii:                        ; @_Z6evolvePiiiii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b32 s3, s[0:1], 0x14
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_mul_lo_u32 v0, v1, s3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v4, s3, v0
	v_cmpx_lt_i32_e64 v0, v4
	s_cbranch_execz .LBB0_11
; %bb.1:                                ; %.lr.ph.preheader
	s_load_b128 s[4:7], s[0:1], 0x0
	s_mov_b32 s9, 0
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s2, s7, 31
	s_ashr_i32 s0, s6, 31
	s_add_i32 s1, s7, s2
	s_add_i32 s8, s6, s0
	s_xor_b32 s3, s1, s2
	s_xor_b32 s8, s8, s0
	v_cvt_f32_u32_e32 v1, s3
	v_cvt_f32_u32_e32 v2, s8
	s_sub_i32 s0, 0, s3
	s_sub_i32 s1, 0, s8
	s_not_b32 s10, s7
	v_rcp_iflag_f32_e32 v1, v1
	v_rcp_iflag_f32_e32 v2, v2
	s_waitcnt_depctr 0xfff
	v_dual_mul_f32 v1, 0x4f7ffffe, v1 :: v_dual_mul_f32 v2, 0x4f7ffffe, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cvt_u32_f32_e32 v1, v1
	v_cvt_u32_f32_e32 v2, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v3, s0, v1
	v_mul_lo_u32 v5, s1, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_hi_u32 v3, v1, v3
	v_mul_hi_u32 v6, v2, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v5, v1, v3
	v_add_nc_u32_e32 v6, v2, v6
.LBB0_2:                                ; %.lr.ph
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
                                        ;       Child Loop BB0_4 Depth 3
	v_ashrrev_i32_e32 v1, 31, v0
	s_mov_b32 s0, s7
	v_add_nc_u32_e32 v11, s10, v0
	s_mov_b32 s11, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[0:1]
	v_add_nc_u32_e32 v7, v0, v1
	v_xor_b32_e32 v7, v7, v1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v2, vcc_lo, s4, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v8, v7, v5
	global_load_b32 v14, v[2:3], off
	v_mul_lo_u32 v9, v8, s3
	v_sub_nc_u32_e32 v7, v7, v9
	v_add_nc_u32_e32 v9, 1, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v10, s3, v7
	v_cmp_le_u32_e32 vcc_lo, s3, v7
	v_dual_cndmask_b32 v8, v8, v9 :: v_dual_cndmask_b32 v7, v7, v10
	v_xor_b32_e32 v10, s2, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v9, 1, v8
	v_cmp_le_u32_e32 vcc_lo, s3, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v1, v8, v9, vcc_lo
	v_xor_b32_e32 v7, v1, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v1, v7, v10
	v_sub_nc_u32_e32 v7, v10, v7
	v_mul_lo_u32 v8, v1, s7
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_mad_u64_u32 v[9:10], null, s7, v7, s[0:1]
	v_lshl_add_u32 v7, v0, 2, 0
	v_add_nc_u32_e32 v13, -1, v1
	v_sub_nc_u32_e32 v8, v0, v8
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add3_u32 v12, v0, v9, -1
	v_dual_mov_b32 v9, 0 :: v_dual_add_nc_u32 v10, -1, v8
	s_waitcnt vmcnt(0)
	ds_store_b32 v7, v14
.LBB0_3:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_4 Depth 3
	s_delay_alu instid0(VALU_DEP_1)
	v_add_nc_u32_e32 v14, s6, v13
	v_cmp_gt_i32_e64 s0, s6, v13
	v_cmp_gt_i32_e64 s12, 0, v13
	s_mov_b32 s13, 0
	v_mov_b32_e32 v17, v10
	v_ashrrev_i32_e32 v15, 31, v14
	s_xor_b32 s14, s0, -1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v14, v14, v15
	v_xor_b32_e32 v14, v14, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v16, v14, v6
	v_mul_lo_u32 v16, v16, s8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v14, v14, v16
	v_subrev_nc_u32_e32 v16, s8, v14
	v_cmp_le_u32_e32 vcc_lo, s8, v14
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v14, v14, v16, vcc_lo
	v_subrev_nc_u32_e32 v16, s8, v14
	v_cmp_le_u32_e32 vcc_lo, s8, v14
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v14, v14, v16, vcc_lo
	v_cmp_lt_i32_e32 vcc_lo, -1, v13
	v_mov_b32_e32 v16, v11
	v_xor_b32_e32 v14, v14, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v14, v14, v15
	v_mov_b32_e32 v15, v12
	v_mul_lo_u32 v14, v14, s7
.LBB0_4:                                ;   Parent Loop BB0_2 Depth=1
                                        ;     Parent Loop BB0_3 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	s_mov_b32 s0, s12
	s_and_saveexec_b32 s15, vcc_lo
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=3
	v_cmp_gt_i32_e64 s0, 0, v17
	v_cmp_le_i32_e64 s1, s7, v17
	s_delay_alu instid0(VALU_DEP_2)
	s_or_b32 s0, s14, s0
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	s_or_b32 s0, s1, s0
	s_and_not1_b32 s1, s12, exec_lo
	s_and_b32 s0, s0, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s0, s1, s0
; %bb.6:                                ; %Flow
                                        ;   in Loop: Header=BB0_4 Depth=3
	s_or_b32 exec_lo, exec_lo, s15
	v_mov_b32_e32 v18, v16
	s_and_saveexec_b32 s1, s0
	s_cbranch_execz .LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=3
	v_ashrrev_i32_e32 v18, 31, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v19, v15, v18
	v_xor_b32_e32 v19, v19, v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v20, v19, v5
	v_mul_lo_u32 v20, v20, s3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v19, v19, v20
	v_subrev_nc_u32_e32 v20, s3, v19
	v_cmp_le_u32_e64 s0, s3, v19
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v19, v19, v20, s0
	v_subrev_nc_u32_e32 v20, s3, v19
	v_cmp_le_u32_e64 s0, s3, v19
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v19, v19, v20, s0
	v_xor_b32_e32 v19, v19, v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v18, v19, v18
	v_add_nc_u32_e32 v18, v14, v18
.LBB0_8:                                ;   in Loop: Header=BB0_4 Depth=3
	s_or_b32 exec_lo, exec_lo, s1
	s_delay_alu instid0(VALU_DEP_1)
	v_lshl_add_u32 v18, v18, 2, 0
	v_add_nc_u32_e32 v19, 1, v17
	v_cmp_gt_i32_e64 s0, v17, v8
	v_add_nc_u32_e32 v16, 1, v16
	v_add_nc_u32_e32 v15, 1, v15
	ds_load_b32 v18, v18
	v_mov_b32_e32 v17, v19
	s_or_b32 s13, s0, s13
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v9, v18, v9
	s_and_not1_b32 exec_lo, exec_lo, s13
	s_cbranch_execnz .LBB0_4
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=2
	s_or_b32 exec_lo, exec_lo, s13
	v_add_nc_u32_e32 v14, 1, v13
	v_cmp_gt_i32_e32 vcc_lo, v13, v1
	v_add_nc_u32_e32 v11, s7, v11
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_mov_b32_e32 v13, v14
	s_or_b32 s11, vcc_lo, s11
	s_and_not1_b32 exec_lo, exec_lo, s11
	s_cbranch_execnz .LBB0_3
; %bb.10:                               ; %_Z12getNeigboursiiPiii.exit
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s11
	ds_load_b32 v1, v7
	v_add_nc_u32_e32 v0, 1, v0
	s_waitcnt lgkmcnt(0)
	v_sub_nc_u32_e32 v7, v9, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_and_b32_e32 v8, -2, v7
	v_cmp_eq_u32_e32 vcc_lo, 3, v7
	v_cndmask_b32_e64 v7, 0, 1, vcc_lo
	v_cmp_eq_u32_e32 vcc_lo, 2, v8
	v_cndmask_b32_e64 v8, 0, 1, vcc_lo
	v_cmp_eq_u32_e32 vcc_lo, 1, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v1, v7, v8, vcc_lo
	v_cmp_eq_u32_e32 vcc_lo, v0, v4
	v_and_b32_e32 v1, 1, v1
	s_or_b32 s9, vcc_lo, s9
	global_store_b32 v[2:3], v1, off
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_and_not1_b32 exec_lo, exec_lo, s9
	s_cbranch_execnz .LBB0_2
.LBB0_11:                               ; %Flow39
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6evolvePiiiii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.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 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 21
		.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	_Z6evolvePiiiii, .Lfunc_end0-_Z6evolvePiiiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 984
; NumSgprs: 18
; NumVgprs: 21
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 21
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; 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
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
      - .offset:         144
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z6evolvePiiiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z6evolvePiiiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     21
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
