//// gol.cu 
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <assert.h>
// Game of Life rules


// global memory only

typedef bool GolCell;

inline GolCell GetNeighbourCell (GolCell *input, int mapCellIdx, int mapWidth, int x_off, int y_off) {
	return input[mapCellIdx + (mapWidth * y_off) + x_off];
}

inline  void UpdateNeighbourhood(int &neighbourhood, GolCell &neighbourValue) {
	neighbourhood += neighbourValue;
} 

inline  GolCell GetCell(GolCell *grid, int x, int y, int gridWidth) {
	return grid[x + (y * gridWidth)];
}

inline  bool IsAlive(GolCell &cell) {
	return (true == cell);
}

// A cell is alive the next generation if it is currently alive and has
// either 2 or 3 neighbours OR if it is dead and has 3 neighbours.
inline void UpdateState(GolCell &thisCell, int &neighbourhood) {
	if(IsAlive(thisCell)) {
		thisCell = (neighbourhood == 2 || neighbourhood == 3);
	} else {
		thisCell = (neighbourhood == 3);
	} 
}


void RunGoL(GolCell *input, GolCell *output, int gridWidth, int gridHeight, int iterations, bool wrapAround) {
	for(int iter = 0; iter < iterations; iter = iter + 1) {
		for(int glbl_x = 0; glbl_x < gridWidth; glbl_x = glbl_x + 1) {
			for(int glbl_y = 0; glbl_y < gridHeight; glbl_y = glbl_y + 1) {
				//Assume row-major here
				int mapCell = (gridWidth * glbl_y) + glbl_x;
				GolCell thisCell = input[mapCell];
				// The variable we use to track the status of the cells surrounding this one
				// A basic implementation will be one where for each neighbour that is alive
				// the neighbourhood value increases by one
				int neighbourhood = 0;
				
				// As is right now, this is a lot of overhead, but I wrote it
				// like this so we can easily add in optis later. At the end,
				// if the CUDA compiler does not do inlining for us, we can manually
				// do inlining of these functions.

				// Here we assume that (0,0) is the top left of the grid (although there is)
				// nothing stopping it from being the bottom left.
				// **JUSTIN** - let me know if you have preference -> it doesn't bother me either way

				int x_left = (glbl_x == 0) ? gridWidth - 1 : glbl_x - 1;
				int x_right = (glbl_x == gridWidth - 1) ? 0 : glbl_x + 1;
				int y_above = (glbl_y == 0) ? gridHeight - 1 : glbl_y - 1;
				int y_below = (glbl_y == gridHeight - 1) ? 0 : glbl_y + 1;
				
				GolCell neighbourValue;
				// TOP LEFT
				neighbourValue = GetCell(input, x_left, y_above, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue);
			 
				// TOP
				neighbourValue = GetCell(input, glbl_x, y_above, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 

				// TOP RIGHT
				neighbourValue = GetCell(input, x_right, y_above, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 

				// RIGHT
				neighbourValue = GetCell(input, x_right, glbl_y, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 

				// BOTTOM RIGHT
				neighbourValue = GetCell(input, x_right, y_below, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 

				// BOTTOM
				neighbourValue = GetCell(input, glbl_x, y_below, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 
				
				// BOTTOM LEFT
				neighbourValue = GetCell(input, x_left, y_below, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 

				// LEFT
				neighbourValue = GetCell(input, x_left, glbl_y, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 

				UpdateState(thisCell, neighbourhood);

				output[mapCell] = thisCell;

			}
		}
		GolCell *bufferSwap = input;
		input = output;
		output = bufferSwap;
	}
} 

void InitializeBoard(GolCell *input, int gridWidth, int gridHeight, char *startingFile, bool bGenGridFromScratch) {
    FILE *file = NULL;
	if(!bGenGridFromScratch) {
		fopen(startingFile, "r");    
    	assert(file);
	}

    for(int i = 0; i < gridHeight; i = i + 1) {
        for(int j = 0; j < gridWidth; j = j + 1) {
            char cell = '\n';
			if(!bGenGridFromScratch) {
				fgetc(file);
			} else {
				cell = (rand() % 3  == 0) ? '1' : '0'; 
			}
            
            int index = j + gridWidth * i;
            

            // Sorry about this - I would like a nicer way to deal with newline
            // oddities across windows/Linux plats but we can hack it for now
            while(cell != '1' && cell != 'X' && cell != '0'&& cell != ' ' && cell != '_' && !bGenGridFromScratch) {
                cell = fgetc(file);
            }

            if((cell == '1' || cell == 'X')) {
                input[index] = 1;
            } else if((cell == '0' || cell == ' ' || cell == '_')) {
                input[index] = 0;
            }
        }
    }
	if(!bGenGridFromScratch) {
    	fclose(file);
	}
}


int main (int argc, char *argv[]) {
	if(argc != 5 && argc != 4) {
		return 0;
	}
	
	int gridWidth = atoi(argv[1]);
	int gridHeight = atoi(argv[2]);
	int iterations = atoi(argv[3]);
	int gridSize  = gridWidth * gridHeight;
	char *startingFile = argv[4];


	GolCell *input = (GolCell *)malloc(gridSize * sizeof(GolCell));
	GolCell *output = (GolCell *)malloc(gridSize * sizeof(GolCell));
	
	InitializeBoard(input, gridWidth, gridHeight, startingFile, argc == 4);

	cudaEvent_t start, end;
	cudaEventCreate(&start);
	cudaEventCreate(&end);
	
	cudaEventRecord(start, 0);
	RunGoL(input, output, gridWidth, gridHeight, iterations, true);

	cudaEventRecord(end, 0);
	cudaEventSynchronize(end);
	float time_ms;
	cudaEventElapsedTime(&time_ms, start, end);
	std::cout <<"time: "<<time_ms<<std::endl;
	
	if(0 == (iterations & 0x1)) { // even number of iterations -> true output buffer is stored at input
		output = input;
	}
//	std::cout <<"Ending BOARD"<<std::endl;
//	for(int j = 0; j < gridHeight; j = j + 1) {
//		for(int i = 0; i < gridWidth; i = i + 1) {
//			std::cout << (output[j * gridWidth + i] ? '#' : ' ');
//		}
//		std::cout << "|" << std::endl;
//	}
}


	.file	"tmpxft_003742fd_00000000-6_gol_cpu.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3645:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3645:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z6RunGoLPbS_iiib
	.type	_Z6RunGoLPbS_iiib, @function
_Z6RunGoLPbS_iiib:
.LFB3640:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %r9
	movl	%ecx, %r15d
	xorl	%esi, %esi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	decl	%ecx
	movq	%rdi, %rax
	movl	%edx, %edi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leal	-1(%rdx), %ebx
	movl	%ebx, -24(%rsp)
	movslq	%edx, %rbx
	movl	%r8d, -12(%rsp)
	movl	%esi, -40(%rsp)
	movq	%rbx, -32(%rsp)
	movl	%ecx, -20(%rsp)
.L3:
	movl	-12(%rsp), %ecx
	cmpl	%ecx, -40(%rsp)
	jge	.L17
	xorl	%ecx, %ecx
.L11:
	movl	%ecx, %r13d
	cmpl	%ecx, %edi
	jle	.L9
	movl	%ecx, %ebx
	leal	1(%rcx), %r8d
	movq	%rcx, %r10
	subl	$1, %ebx
	cmovc	-24(%rsp), %ebx
	xorl	%esi, %esi
	cmpl	%ecx, -24(%rsp)
	cmove	%esi, %r8d
	movslq	%ebx, %rdx
	movq	%rdx, -8(%rsp)
	movslq	%r8d, %r14
	leaq	(%rax,%r14), %r11
.L10:
	cmpl	%r15d, %esi
	jge	.L18
	movb	(%rax,%r10), %dl
	movb	%dl, -13(%rsp)
	movl	-20(%rsp), %edx
	testl	%esi, %esi
	je	.L4
	leal	-1(%rsi), %edx
.L4:
	leal	1(%rsi), %ebp
	movl	%ebp, -36(%rsp)
	movl	-20(%rsp), %ebp
	cmpl	%ebp, %esi
	movl	$0, %esi
	cmovne	-36(%rsp), %esi
	imull	%edi, %edx
	imull	%edi, %esi
	leal	0(%r13,%rdx), %ebp
	movslq	%ebp, %rbp
	movzbl	(%rax,%rbp), %ebp
	movl	%ebp, %r12d
	leal	(%rbx,%rdx), %ebp
	addl	%r8d, %edx
	movslq	%ebp, %rbp
	movslq	%edx, %rdx
	movzbl	(%rax,%rbp), %ebp
	movzbl	(%rax,%rdx), %edx
	addl	%r12d, %ebp
	addl	%ebp, %edx
	movzbl	(%r11), %ebp
	addl	%ebp, %edx
	leal	(%r8,%rsi), %ebp
	movslq	%ebp, %rbp
	movzbl	(%rax,%rbp), %ebp
	addl	%ebp, %edx
	leal	0(%r13,%rsi), %ebp
	addl	%ebx, %esi
	movslq	%ebp, %rbp
	movslq	%esi, %rsi
	movzbl	(%rax,%rbp), %ebp
	addl	%ebp, %edx
	movzbl	(%rax,%rsi), %ebp
	movq	-8(%rsp), %rsi
	addl	%edx, %ebp
	movq	%r11, %rdx
	subq	%r14, %rdx
	movzbl	(%rdx,%rsi), %edx
	addl	%edx, %ebp
	cmpb	$0, -13(%rsp)
	je	.L6
	subl	$2, %ebp
	cmpl	$1, %ebp
	setbe	%dl
	jmp	.L7
.L6:
	cmpl	$3, %ebp
	sete	%dl
.L7:
	movq	-32(%rsp), %rsi
	movb	%dl, (%r9,%r10)
	addq	%rsi, %r11
	addq	%rsi, %r10
	movl	-36(%rsp), %esi
	jmp	.L10
.L18:
	incq	%rcx
	jmp	.L11
.L9:
	incl	-40(%rsp)
	xchgq	%r9, %rax
	jmp	.L3
.L17:
	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
.LFE3640:
	.size	_Z6RunGoLPbS_iiib, .-_Z6RunGoLPbS_iiib
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"r"
	.text
	.globl	_Z15InitializeBoardPbiiPcb
	.type	_Z15InitializeBoardPbiiPcb, @function
_Z15InitializeBoardPbiiPcb:
.LFB3641:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%r8d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%r8d, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%rdi, (%rsp)
	movl	%edx, 12(%rsp)
	testb	%r8b, %r8b
	jne	.L20
	movq	%rcx, %rdi
	leaq	.LC0(%rip), %rsi
	call	fopen@PLT
.L20:
	xorl	%r13d, %r13d
	xorl	%r14d, %r14d
.L21:
	movl	12(%rsp), %eax
	cmpl	%eax, %r14d
	jge	.L33
	movq	(%rsp), %rax
	movslq	%r13d, %rbx
	addq	%rax, %rbx
	xorl	%eax, %eax
	movl	%eax, 8(%rsp)
.L34:
	cmpl	%r12d, 8(%rsp)
	jge	.L46
	testb	%r15b, %r15b
	jne	.L22
	xorl	%edi, %edi
	call	fgetc@PLT
	movb	$10, %al
	jmp	.L24
.L22:
	call	rand@PLT
	movl	$3, %ecx
	cltd
	idivl	%ecx
	movb	$48, %al
	cmpl	$1, %edx
	adcb	$0, %al
	jmp	.L24
.L47:
	movabsq	$-9151314442816651263, %rcx
	btq	%rdx, %rcx
	jc	.L26
.L25:
	testb	%r15b, %r15b
	jne	.L26
	xorl	%edi, %edi
	call	fgetc@PLT
.L24:
	leal	-32(%rax), %edx
	cmpb	$63, %dl
	ja	.L25
	jmp	.L47
.L26:
	cmpb	$49, %al
	je	.L37
	cmpb	$88, %al
	jne	.L28
.L37:
	movb	$1, (%rbx)
	jmp	.L30
.L28:
	movl	%eax, %edx
	andl	$-17, %edx
	cmpb	$32, %dl
	je	.L38
	cmpb	$95, %al
	jne	.L30
.L38:
	movb	$0, (%rbx)
.L30:
	incl	8(%rsp)
	incq	%rbx
	jmp	.L34
.L46:
	incl	%r14d
	addl	%r12d, %r13d
	jmp	.L21
.L33:
	testb	%bpl, %bpl
	jne	.L19
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%edi, %edi
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	fclose@PLT
.L19:
	.cfi_restore_state
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3641:
	.size	_Z15InitializeBoardPbiiPcb, .-_Z15InitializeBoardPbiiPcb
	.section	.rodata.str1.1
.LC1:
	.string	"time: "
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3642:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leal	-4(%rdi), %eax
	cmpl	$1, %eax
	ja	.L49
	movl	%edi, %r13d
	movq	8(%rsi), %rdi
	movq	%rsi, %rbx
	call	atoi@PLT
	movq	16(%rbx), %rdi
	movl	%eax, %ebp
	call	atoi@PLT
	movl	%ebp, %r15d
	movq	24(%rbx), %rdi
	movl	%eax, %r12d
	call	atoi@PLT
	imull	%r12d, %r15d
	movq	32(%rbx), %rcx
	movl	%eax, %r14d
	movq	%rcx, 8(%rsp)
	movslq	%r15d, %r15
	movq	%r15, %rdi
	call	malloc@PLT
	movq	%r15, %rdi
	movq	%rax, %rbx
	call	malloc@PLT
	movq	8(%rsp), %rcx
	xorl	%r8d, %r8d
	movl	%r12d, %edx
	cmpl	$4, %r13d
	movl	%ebp, %esi
	movq	%rbx, %rdi
	movq	%rax, %r15
	sete	%r8b
	call	_Z15InitializeBoardPbiiPcb
	leaq	24(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$1, %r9d
	movl	%r14d, %r8d
	movl	%ebp, %edx
	movl	%r12d, %ecx
	movq	%r15, %rsi
	movq	%rbx, %rdi
	call	_Z6RunGoLPbS_iiib
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	leaq	20(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC1(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtss2sd	20(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.L49:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L50
	call	__stack_chk_fail@PLT
.L50:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3642:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3668:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3668:
	.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:

//// gol.cu 

#include <hip/hip_runtime.h>
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <assert.h>
// Game of Life rules


// global memory only

typedef bool GolCell;

inline GolCell GetNeighbourCell (GolCell *input, int mapCellIdx, int mapWidth, int x_off, int y_off) {
	return input[mapCellIdx + (mapWidth * y_off) + x_off];
}

inline  void UpdateNeighbourhood(int &neighbourhood, GolCell &neighbourValue) {
	neighbourhood += neighbourValue;
} 

inline  GolCell GetCell(GolCell *grid, int x, int y, int gridWidth) {
	return grid[x + (y * gridWidth)];
}

inline  bool IsAlive(GolCell &cell) {
	return (true == cell);
}

// A cell is alive the next generation if it is currently alive and has
// either 2 or 3 neighbours OR if it is dead and has 3 neighbours.
inline void UpdateState(GolCell &thisCell, int &neighbourhood) {
	if(IsAlive(thisCell)) {
		thisCell = (neighbourhood == 2 || neighbourhood == 3);
	} else {
		thisCell = (neighbourhood == 3);
	} 
}


void RunGoL(GolCell *input, GolCell *output, int gridWidth, int gridHeight, int iterations, bool wrapAround) {
	for(int iter = 0; iter < iterations; iter = iter + 1) {
		for(int glbl_x = 0; glbl_x < gridWidth; glbl_x = glbl_x + 1) {
			for(int glbl_y = 0; glbl_y < gridHeight; glbl_y = glbl_y + 1) {
				//Assume row-major here
				int mapCell = (gridWidth * glbl_y) + glbl_x;
				GolCell thisCell = input[mapCell];
				// The variable we use to track the status of the cells surrounding this one
				// A basic implementation will be one where for each neighbour that is alive
				// the neighbourhood value increases by one
				int neighbourhood = 0;
				
				// As is right now, this is a lot of overhead, but I wrote it
				// like this so we can easily add in optis later. At the end,
				// if the CUDA compiler does not do inlining for us, we can manually
				// do inlining of these functions.

				// Here we assume that (0,0) is the top left of the grid (although there is)
				// nothing stopping it from being the bottom left.
				// **JUSTIN** - let me know if you have preference -> it doesn't bother me either way

				int x_left = (glbl_x == 0) ? gridWidth - 1 : glbl_x - 1;
				int x_right = (glbl_x == gridWidth - 1) ? 0 : glbl_x + 1;
				int y_above = (glbl_y == 0) ? gridHeight - 1 : glbl_y - 1;
				int y_below = (glbl_y == gridHeight - 1) ? 0 : glbl_y + 1;
				
				GolCell neighbourValue;
				// TOP LEFT
				neighbourValue = GetCell(input, x_left, y_above, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue);
			 
				// TOP
				neighbourValue = GetCell(input, glbl_x, y_above, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 

				// TOP RIGHT
				neighbourValue = GetCell(input, x_right, y_above, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 

				// RIGHT
				neighbourValue = GetCell(input, x_right, glbl_y, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 

				// BOTTOM RIGHT
				neighbourValue = GetCell(input, x_right, y_below, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 

				// BOTTOM
				neighbourValue = GetCell(input, glbl_x, y_below, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 
				
				// BOTTOM LEFT
				neighbourValue = GetCell(input, x_left, y_below, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 

				// LEFT
				neighbourValue = GetCell(input, x_left, glbl_y, gridWidth);
				UpdateNeighbourhood(neighbourhood, neighbourValue); 

				UpdateState(thisCell, neighbourhood);

				output[mapCell] = thisCell;

			}
		}
		GolCell *bufferSwap = input;
		input = output;
		output = bufferSwap;
	}
} 

void InitializeBoard(GolCell *input, int gridWidth, int gridHeight, char *startingFile, bool bGenGridFromScratch) {
    FILE *file = NULL;
	if(!bGenGridFromScratch) {
		fopen(startingFile, "r");    
    	assert(file);
	}

    for(int i = 0; i < gridHeight; i = i + 1) {
        for(int j = 0; j < gridWidth; j = j + 1) {
            char cell = '\n';
			if(!bGenGridFromScratch) {
				fgetc(file);
			} else {
				cell = (rand() % 3  == 0) ? '1' : '0'; 
			}
            
            int index = j + gridWidth * i;
            

            // Sorry about this - I would like a nicer way to deal with newline
            // oddities across windows/Linux plats but we can hack it for now
            while(cell != '1' && cell != 'X' && cell != '0'&& cell != ' ' && cell != '_' && !bGenGridFromScratch) {
                cell = fgetc(file);
            }

            if((cell == '1' || cell == 'X')) {
                input[index] = 1;
            } else if((cell == '0' || cell == ' ' || cell == '_')) {
                input[index] = 0;
            }
        }
    }
	if(!bGenGridFromScratch) {
    	fclose(file);
	}
}


int main (int argc, char *argv[]) {
	if(argc != 5 && argc != 4) {
		return 0;
	}
	
	int gridWidth = atoi(argv[1]);
	int gridHeight = atoi(argv[2]);
	int iterations = atoi(argv[3]);
	int gridSize  = gridWidth * gridHeight;
	char *startingFile = argv[4];


	GolCell *input = (GolCell *)malloc(gridSize * sizeof(GolCell));
	GolCell *output = (GolCell *)malloc(gridSize * sizeof(GolCell));
	
	InitializeBoard(input, gridWidth, gridHeight, startingFile, argc == 4);

	hipEvent_t start, end;
	hipEventCreate(&start);
	hipEventCreate(&end);
	
	hipEventRecord(start, 0);
	RunGoL(input, output, gridWidth, gridHeight, iterations, true);

	hipEventRecord(end, 0);
	hipEventSynchronize(end);
	float time_ms;
	hipEventElapsedTime(&time_ms, start, end);
	std::cout <<"time: "<<time_ms<<std::endl;
	
	if(0 == (iterations & 0x1)) { // even number of iterations -> true output buffer is stored at input
		output = input;
	}
//	std::cout <<"Ending BOARD"<<std::endl;
//	for(int j = 0; j < gridHeight; j = j + 1) {
//		for(int i = 0; i < gridWidth; i = i + 1) {
//			std::cout << (output[j * gridWidth + i] ? '#' : ' ');
//		}
//		std::cout << "|" << std::endl;
//	}
}


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

                                        # End of file scope inline assembly
	.globl	_Z6RunGoLPbS_iiib               # -- Begin function _Z6RunGoLPbS_iiib
	.type	_Z6RunGoLPbS_iiib,@function
_Z6RunGoLPbS_iiib:                      # @_Z6RunGoLPbS_iiib
	.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
	.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 $ecx killed $ecx def $rcx
	movq	%rcx, -64(%rsp)                 # 8-byte Spill
                                        # kill: def $edx killed $edx def $rdx
	movq	%rsi, -80(%rsp)                 # 8-byte Spill
	movl	%r8d, -72(%rsp)                 # 4-byte Spill
	testl	%r8d, %r8d
	jle	.LBB0_8
# %bb.1:                                # %.preheader91.lr.ph
	leal	-1(%rdx), %eax
	movq	%rax, -56(%rsp)                 # 8-byte Spill
	movq	-64(%rsp), %rax                 # 8-byte Reload
	leal	-1(%rax), %r9d
	movslq	%edx, %rsi
	movl	%esi, %ecx
	movq	%rcx, -48(%rsp)                 # 8-byte Spill
	movl	%eax, %r10d
	xorl	%r11d, %r11d
	movl	$0, -84(%rsp)                   # 4-byte Folded Spill
.LBB0_2:                                # %.preheader91
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_4 Depth 2
                                        #       Child Loop BB0_10 Depth 3
	movq	%rdi, %r15
	testl	%edx, %edx
	jle	.LBB0_7
# %bb.3:                                # %.preheader.preheader
                                        #   in Loop: Header=BB0_2 Depth=1
	xorl	%ebp, %ebp
.LBB0_4:                                # %.preheader
                                        #   Parent Loop BB0_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB0_10 Depth 3
	cmpl	$0, -64(%rsp)                   # 4-byte Folded Reload
	jle	.LBB0_5
# %bb.9:                                # %.lr.ph
                                        #   in Loop: Header=BB0_4 Depth=2
	leal	-1(%rbp), %r13d
	testq	%rbp, %rbp
	movq	-56(%rsp), %rax                 # 8-byte Reload
	cmovel	%eax, %r13d
	leaq	1(%rbp), %rcx
	cmpq	%rax, %rbp
	movq	%rcx, -40(%rsp)                 # 8-byte Spill
	movl	%ecx, %eax
	cmovel	%r11d, %eax
	movl	%eax, -68(%rsp)                 # 4-byte Spill
	cltq
	movslq	%r13d, %rcx
	addq	%r15, %rcx
	movq	%rcx, -8(%rsp)                  # 8-byte Spill
	leaq	(%r15,%rax), %rcx
	movq	%rcx, -16(%rsp)                 # 8-byte Spill
	movq	-80(%rsp), %rcx                 # 8-byte Reload
	addq	%rbp, %rcx
	movq	%rcx, -24(%rsp)                 # 8-byte Spill
	leaq	(%r15,%rbp), %rcx
	movq	%rcx, -32(%rsp)                 # 8-byte Spill
	movl	%eax, %eax
	movl	%ebp, %r12d
	xorl	%r14d, %r14d
	xorl	%edi, %edi
.LBB0_10:                               #   Parent Loop BB0_2 Depth=1
                                        #     Parent Loop BB0_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movq	%rdi, %rbx
	subq	$1, %rbx
	cmovbl	%r9d, %ebx
	cmpq	%rdi, %r9
	leaq	1(%rdi), %rdi
	movq	%r10, %r8
	movl	%edi, %r10d
	cmovel	%r11d, %r10d
	imull	%edx, %ebx
	leal	(%rbx,%r13), %r11d
	movslq	%r11d, %r11
	movzbl	(%r15,%r11), %r11d
	movslq	%ebx, %rbx
	movq	%rsi, %rcx
	leaq	(%rbx,%rbp), %rsi
	movzbl	(%r15,%rsi), %esi
	addl	%r11d, %esi
	addl	-68(%rsp), %ebx                 # 4-byte Folded Reload
	movslq	%ebx, %r11
	movzbl	(%r15,%r11), %r11d
	movq	-16(%rsp), %rbx                 # 8-byte Reload
	movzbl	(%rbx,%r14), %ebx
	addl	%r11d, %ebx
	addl	%esi, %ebx
	imull	%edx, %r10d
	leaq	(%r10,%rax), %rsi
	movzbl	(%r15,%rsi), %esi
	leaq	(%r10,%r12), %r11
	movzbl	(%r15,%r11), %r11d
	addl	%esi, %r11d
	addl	%r13d, %r10d
	movslq	%r10d, %rsi
	movzbl	(%r15,%rsi), %esi
	addl	%r11d, %esi
	movq	-8(%rsp), %r10                  # 8-byte Reload
	movzbl	(%r10,%r14), %r10d
	addl	%esi, %r10d
	addl	%ebx, %r10d
	xorl	%esi, %esi
	cmpl	$3, %r10d
	sete	%sil
	andl	$254, %r10d
	xorl	%r11d, %r11d
	cmpl	$2, %r10d
	movq	%r8, %r10
	sete	%r11b
	movq	-32(%rsp), %r8                  # 8-byte Reload
	cmpb	$0, (%r8,%r14)
	cmovel	%esi, %r11d
	movq	%rcx, %rsi
	movq	-24(%rsp), %rcx                 # 8-byte Reload
	movb	%r11b, (%rcx,%r14)
	xorl	%r11d, %r11d
	addq	%rsi, %r14
	cmpq	%rdi, %r10
	jne	.LBB0_10
# %bb.11:                               #   in Loop: Header=BB0_4 Depth=2
	movq	-40(%rsp), %rax                 # 8-byte Reload
	movq	%rax, %rbp
	jmp	.LBB0_6
.LBB0_5:                                # %.preheader.._crit_edge_crit_edge
                                        #   in Loop: Header=BB0_4 Depth=2
	incq	%rbp
	movq	%rbp, %rax
.LBB0_6:                                # %._crit_edge
                                        #   in Loop: Header=BB0_4 Depth=2
	cmpq	-48(%rsp), %rax                 # 8-byte Folded Reload
	jne	.LBB0_4
.LBB0_7:                                # %._crit_edge94
                                        #   in Loop: Header=BB0_2 Depth=1
	movl	-84(%rsp), %eax                 # 4-byte Reload
	incl	%eax
	movq	-80(%rsp), %rdi                 # 8-byte Reload
	movq	%r15, -80(%rsp)                 # 8-byte Spill
	movl	%eax, -84(%rsp)                 # 4-byte Spill
	cmpl	-72(%rsp), %eax                 # 4-byte Folded Reload
	jne	.LBB0_2
.LBB0_8:                                # %._crit_edge98
	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_end0:
	.size	_Z6RunGoLPbS_iiib, .Lfunc_end0-_Z6RunGoLPbS_iiib
	.cfi_endproc
                                        # -- End function
	.globl	_Z15InitializeBoardPbiiPcb      # -- Begin function _Z15InitializeBoardPbiiPcb
	.type	_Z15InitializeBoardPbiiPcb,@function
_Z15InitializeBoardPbiiPcb:             # @_Z15InitializeBoardPbiiPcb
	.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
	movl	%r8d, %ebx
	movl	%edx, %r15d
	movl	%esi, 4(%rsp)                   # 4-byte Spill
	movq	%rdi, 8(%rsp)                   # 8-byte Spill
	testl	%r8d, %r8d
	jne	.LBB1_2
# %bb.1:
	movl	$.L.str, %esi
	movq	%rcx, %rdi
	callq	fopen
.LBB1_2:
	testl	%r15d, %r15d
	jle	.LBB1_9
# %bb.3:                                # %.preheader.lr.ph
	movl	%ebx, %r12d
	xorb	$1, %r12b
	movl	%r15d, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	4(%rsp), %r13d                  # 4-byte Reload
	xorl	%r15d, %r15d
.LBB1_4:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_6 Depth 2
                                        #       Child Loop BB1_12 Depth 3
	cmpl	$0, 4(%rsp)                     # 4-byte Folded Reload
	jle	.LBB1_8
# %bb.5:                                # %.lr.ph58
                                        #   in Loop: Header=BB1_4 Depth=1
	movl	%r15d, %r14d
	imull	4(%rsp), %r14d                  # 4-byte Folded Reload
	addq	8(%rsp), %r14                   # 8-byte Folded Reload
	xorl	%ebp, %ebp
.LBB1_6:                                #   Parent Loop BB1_4 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB1_12 Depth 3
	testb	%bl, %bl
	je	.LBB1_11
# %bb.7:                                # %.thread
                                        #   in Loop: Header=BB1_6 Depth=2
	callq	rand
	imull	$-1431655765, %eax, %eax        # imm = 0xAAAAAAAB
	addl	$715827882, %eax                # imm = 0x2AAAAAAA
	cmpl	$1431655765, %eax               # imm = 0x55555555
	movl	$0, %eax
	adcl	$48, %eax
	movl	%eax, %ecx
	shll	$24, %ecx
	jmp	.LBB1_13
.LBB1_11:                               # %.lr.ph.preheader
                                        #   in Loop: Header=BB1_6 Depth=2
	xorl	%edi, %edi
	callq	fgetc
.LBB1_12:                               # %.lr.ph
                                        #   Parent Loop BB1_4 Depth=1
                                        #     Parent Loop BB1_6 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	xorl	%edi, %edi
	callq	fgetc
	movl	%eax, %ecx
	shll	$24, %ecx
	cmpl	$1476395008, %ecx               # imm = 0x58000000
	setne	%dl
	movl	%eax, %esi
	andl	$254, %esi
	cmpl	$48, %esi
	setne	%sil
	andb	%dl, %sil
	cmpl	$536870912, %ecx                # imm = 0x20000000
	setne	%dl
	cmpl	$1593835520, %ecx               # imm = 0x5F000000
	setne	%dil
	andb	%dl, %dil
	andb	%sil, %dil
	testb	%r12b, %dil
	jne	.LBB1_12
.LBB1_13:                               # %._crit_edge
                                        #   in Loop: Header=BB1_6 Depth=2
	movb	$1, %dl
	cmpl	$822083584, %ecx                # imm = 0x31000000
	je	.LBB1_17
# %bb.14:                               # %._crit_edge
                                        #   in Loop: Header=BB1_6 Depth=2
	cmpl	$1476395008, %ecx               # imm = 0x58000000
	jne	.LBB1_15
.LBB1_17:                               # %.sink.split
                                        #   in Loop: Header=BB1_6 Depth=2
	movb	%dl, (%r14,%rbp)
.LBB1_18:                               #   in Loop: Header=BB1_6 Depth=2
	incq	%rbp
	cmpq	%r13, %rbp
	jne	.LBB1_6
	jmp	.LBB1_8
.LBB1_15:                               # %._crit_edge.thread
                                        #   in Loop: Header=BB1_6 Depth=2
	andl	$239, %eax
	xorl	%edx, %edx
	cmpl	$32, %eax
	je	.LBB1_17
# %bb.16:                               # %._crit_edge.thread
                                        #   in Loop: Header=BB1_6 Depth=2
	cmpl	$1593835520, %ecx               # imm = 0x5F000000
	jne	.LBB1_18
	jmp	.LBB1_17
.LBB1_8:                                # %._crit_edge59
                                        #   in Loop: Header=BB1_4 Depth=1
	incq	%r15
	cmpq	16(%rsp), %r15                  # 8-byte Folded Reload
	jne	.LBB1_4
.LBB1_9:                                # %._crit_edge61
	testb	%bl, %bl
	je	.LBB1_10
# %bb.19:
	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
.LBB1_10:
	.cfi_def_cfa_offset 80
	xorl	%edi, %edi
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	fclose                          # TAILCALL
.Lfunc_end1:
	.size	_Z15InitializeBoardPbiiPcb, .Lfunc_end1-_Z15InitializeBoardPbiiPcb
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$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
	movl	%edi, %r15d
	leal	-6(%r15), %eax
	cmpl	$-2, %eax
	jb	.LBB2_2
# %bb.1:
	movq	%rsi, %r14
	movq	8(%rsi), %rdi
	callq	atoi
	movl	%eax, %ebx
	movq	16(%r14), %rdi
	callq	atoi
	movl	%eax, %ebp
	movq	24(%r14), %rdi
	callq	atoi
	movl	%eax, (%rsp)                    # 4-byte Spill
	movl	%ebp, %eax
	imull	%ebx, %eax
	movq	32(%r14), %r14
	movslq	%eax, %r13
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, %r12
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, %r13
	xorl	%r8d, %r8d
	cmpl	$4, %r15d
	sete	%r8b
	movq	%r12, %rdi
	movl	%ebx, %esi
	movl	%ebp, %edx
	movq	%r14, %rcx
	callq	_Z15InitializeBoardPbiiPcb
	leaq	16(%rsp), %r15
	movq	%r15, %rdi
	callq	hipEventCreate
	leaq	8(%rsp), %r14
	movq	%r14, %rdi
	callq	hipEventCreate
	movq	(%r15), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	%r12, %rdi
	movq	%r13, %rsi
	movl	%ebx, %edx
	movl	%ebp, %ecx
	movl	(%rsp), %r8d                    # 4-byte Reload
	xorl	%r9d, %r9d
	callq	_Z6RunGoLPbS_iiib
	movq	(%r14), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%r14), %rdi
	callq	hipEventSynchronize
	movq	(%r15), %rsi
	movq	(%r14), %rdx
	leaq	4(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$6, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	cvtss2sd	(%rbx), %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.LBB2_2:
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	main, .Lfunc_end2-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"r"
	.size	.L.str, 2

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

	.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 _ZSt4cout
	.addrsig_sym __hip_cuid_

	.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_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
