#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define MAX_DIST 5000

typedef struct graphVertices {
	int startIndex;
	int numberOfNeighbours;
	
} graphVertices;

__global__ void bfs_unoptimized(graphVertices* graphVertice_gpu, int* NeighboursVertices_gpu, int numberOfNodes, int* result_gpu, bool* gpu_done) {
	
	// Thread index
	int tid = blockIdx.x*blockDim.x + threadIdx.x;
	
	int numOfThreads = blockDim.x * gridDim.x;

	// All the threads traverse the adjancy list
	for(int v = 0; v < numberOfNodes; v += numOfThreads) {
		
		// different index for different thread
		int vertex = v + tid;
	
		// check boundary condition
		if(vertex < numberOfNodes) {
		
			// traverse all the neighbouring vertex concurrently
			for(int n=0;n<graphVertice_gpu[vertex].numberOfNeighbours;n++) {
				int neighbour = NeighboursVertices_gpu[graphVertice_gpu[vertex].startIndex + n];
			
				// computation of the cost and traversal
				if (result_gpu[neighbour] > result_gpu[vertex] + 1) {
 					result_gpu[neighbour] = result_gpu[vertex] + 1;
					*gpu_done = 0;									
 
				}
				

			}

		}
	} 
	
	
}

int main( int argc, char* argv[] ) { 
	// input from user
	int NUM_NODES = atoi(argv[1]);

	// kernel parameters
	int block_size = 1024;
	int grid_size = NUM_NODES/block_size;

	// structure declaration
	graphVertices vertice[NUM_NODES];

	// Array of neighbouring nodes
	int neighbourVertices[NUM_NODES];  

	// populate the graph
	for(int i=0;i<NUM_NODES;i++) {
		vertice[i].numberOfNeighbours = 2;// (rand() % 5)+1;
	}
	
	vertice[0].startIndex = 0;
	for(int j=1;j<NUM_NODES;j++) {
		vertice[j].startIndex = vertice[j-1].startIndex + vertice[j-1].numberOfNeighbours;
	}

	for(int k=0;k<NUM_NODES*2;k++) {
		neighbourVertices[k] = k+1;
	}

	int start_vertex = neighbourVertices[1];

	cudaSetDevice(0);
        
	// Time Variables
	cudaEvent_t start, stop;
	float time;
	cudaEventCreate (&start);
	cudaEventCreate (&stop);

	// Variable declaration for GPU
	graphVertices* graphVertice_gpu;
	int* neighbourVertices_gpu;
	int* result_gpu;
	bool* gpu_done;

	// Memory allocation for GPU variables
	cudaMalloc((void**)&graphVertice_gpu, sizeof(graphVertices)*NUM_NODES);
	cudaMalloc((void**)&neighbourVertices_gpu, sizeof(int)*NUM_NODES*2);
	cudaMalloc((void**)&result_gpu, sizeof(int)*NUM_NODES);
	cudaMalloc((void**)&gpu_done, sizeof(bool) * 1);

	int kernel_call_count;		
	int* result_cpu;
	bool* cpu_done = new bool[1];
	result_cpu = new int[NUM_NODES];

	for(int i=0;i<NUM_NODES;i++) {
		result_cpu[i] = MAX_DIST;
	}

	result_cpu[start_vertex] = 0;

	// Transfer data from CPU to GPU
	cudaMemcpy(result_gpu, result_cpu, sizeof(int) * NUM_NODES, cudaMemcpyHostToDevice);
	cudaMemcpy(graphVertice_gpu, vertice, sizeof(graphVertices)*NUM_NODES, cudaMemcpyHostToDevice);
	cudaMemcpy(neighbourVertices_gpu, neighbourVertices, sizeof(int)*NUM_NODES*2, cudaMemcpyHostToDevice);

	printf("Running parallel job.\n");

	cudaEventRecord(start,0);
	bool false_value = 1;

	do
	{
		kernel_call_count++;		
		cudaMemcpy(gpu_done, &false_value, sizeof(bool) * 1, cudaMemcpyHostToDevice);

		// call the kernel
		bfs_unoptimized<<<grid_size, block_size>>>(graphVertice_gpu, neighbourVertices_gpu, NUM_NODES, result_gpu, gpu_done);
		
		cudaMemcpy(cpu_done, gpu_done , sizeof(bool) * 1, cudaMemcpyDeviceToHost);
	} while(*cpu_done != 0);

	// Transfer result back from GPU to CPU
	cudaMemcpy(result_cpu, result_gpu, sizeof(int)*NUM_NODES, cudaMemcpyDeviceToHost);

	printf("Kernel call : %d\n", kernel_call_count);
	
	cudaEventRecord(stop,0);
	cudaEventSynchronize(stop);

	cudaEventElapsedTime(&time, start, stop);
	printf("Parallel Job Time: %.2f ms\n", time);

	cudaFree(graphVertice_gpu);
	cudaFree(neighbourVertices_gpu);
	cudaFree(result_gpu);
	cudaFree(gpu_done);
	
	return 0;
}


	.file	"tmpxft_00277033_00000000-6_bfs_unoptimized.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2030:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2030:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z57__device_stub__Z15bfs_unoptimizedP13graphVerticesPiiS1_PbP13graphVerticesPiiS1_Pb
	.type	_Z57__device_stub__Z15bfs_unoptimizedP13graphVerticesPiiS1_PbP13graphVerticesPiiS1_Pb, @function
_Z57__device_stub__Z15bfs_unoptimizedP13graphVerticesPiiS1_PbP13graphVerticesPiiS1_Pb:
.LFB2052:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movl	%edx, 28(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	56(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	56(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 192
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L2:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2052:
	.size	_Z57__device_stub__Z15bfs_unoptimizedP13graphVerticesPiiS1_PbP13graphVerticesPiiS1_Pb, .-_Z57__device_stub__Z15bfs_unoptimizedP13graphVerticesPiiS1_PbP13graphVerticesPiiS1_Pb
	.globl	_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb
	.type	_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb, @function
_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb:
.LFB2053:
	.cfi_startproc
	endbr64
	jmp	_Z57__device_stub__Z15bfs_unoptimizedP13graphVerticesPiiS1_PbP13graphVerticesPiiS1_Pb
	.cfi_endproc
.LFE2053:
	.size	_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb, .-_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Running parallel job.\n"
.LC1:
	.string	"Kernel call : %d\n"
.LC2:
	.string	"Parallel Job Time: %.2f ms\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$136, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	8(%rsi), %rdi
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	atoi@PLT
	movl	$1024, %ecx
	movslq	%eax, %r13
	movl	%r13d, %eax
	leaq	0(,%r13,8), %r14
	movq	%r13, %rbx
	cltd
	idivl	%ecx
	leaq	15(%r14), %rdx
	movq	%rsp, %rcx
	movl	%eax, -172(%rbp)
	movq	%rdx, %rax
	andq	$-4096, %rdx
	andq	$-16, %rax
	subq	%rdx, %rcx
.L9:
	cmpq	%rcx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L11
	orq	$0, -8(%rsp,%rax)
.L11:
	leaq	0(,%r13,4), %rax
	leaq	3(%rsp), %r12
	movq	%rsp, %rsi
	leaq	15(%rax), %rdx
	movq	%r12, %rcx
	movq	%rax, -152(%rbp)
	andq	$-4, %r12
	movq	%rdx, %rax
	andq	$-4096, %rdx
	shrq	$2, %rcx
	andq	$-16, %rax
	subq	%rdx, %rsi
.L12:
	cmpq	%rsi, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L14
	orq	$0, -8(%rsp,%rax)
.L14:
	leaq	3(%rsp), %rax
	movq	%rax, %rsi
	andq	$-4, %rax
	movq	%rax, -160(%rbp)
	shrq	$2, %rsi
	xorl	%eax, %eax
.L15:
	cmpl	%eax, %ebx
	jle	.L37
	movl	$2, 4(%r12,%rax,8)
	incq	%rax
	jmp	.L15
.L37:
	xorl	%edi, %edi
	xorl	%eax, %eax
	movl	%edi, 0(,%rcx,4)
.L17:
	incq	%rax
	cmpl	%eax, %ebx
	jle	.L38
	movl	-4(%r12,%rax,8), %edx
	addl	-8(%r12,%rax,8), %edx
	movl	%edx, (%r12,%rax,8)
	jmp	.L17
.L38:
	leal	(%rbx,%rbx), %edx
	xorl	%eax, %eax
.L19:
	cmpl	%eax, %edx
	jle	.L39
	movq	-160(%rbp), %rdi
	leal	1(%rax), %ecx
	movl	%ecx, (%rdi,%rax,4)
	incq	%rax
	jmp	.L19
.L39:
	movl	4(,%rsi,4), %eax
	xorl	%edi, %edi
	movl	%eax, -168(%rbp)
	call	cudaSetDevice@PLT
	leaq	-128(%rbp), %rdi
	call	cudaEventCreate@PLT
	leaq	-120(%rbp), %rdi
	call	cudaEventCreate@PLT
	leaq	-112(%rbp), %rdi
	movq	%r14, %rsi
	call	cudaMalloc@PLT
	leaq	-104(%rbp), %rdi
	movq	%r14, %rsi
	call	cudaMalloc@PLT
	movq	-152(%rbp), %rsi
	leaq	-96(%rbp), %rdi
	call	cudaMalloc@PLT
	leaq	-88(%rbp), %rdi
	movl	$1, %esi
	call	cudaMalloc@PLT
	movl	$1, %edi
	call	_Znam@PLT
	movq	%rax, %r15
	movabsq	$2305843009213693950, %rax
	cmpq	%r13, %rax
	jb	.L21
	movq	-152(%rbp), %rdi
	call	_Znam@PLT
	movq	%rax, %r13
	xorl	%eax, %eax
	jmp	.L22
.L21:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L36
	call	__cxa_throw_bad_array_new_length@PLT
.L22:
	cmpl	%eax, %ebx
	jle	.L40
	movl	$5000, 0(%r13,%rax,4)
	incq	%rax
	jmp	.L22
.L40:
	movslq	-168(%rbp), %rax
	xorl	%edx, %edx
	movq	-96(%rbp), %rdi
	movq	%r13, %rsi
	movl	$1, %ecx
	movl	%edx, 0(%r13,%rax,4)
	movq	-152(%rbp), %rdx
	call	cudaMemcpy@PLT
	movq	-112(%rbp), %rdi
	movq	%r12, %rsi
	movq	%r14, %rdx
	movabsq	$4294968320, %r12
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	-160(%rbp), %rsi
	movq	-104(%rbp), %rdi
	movq	%r14, %rdx
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-128(%rbp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movb	$1, -129(%rbp)
.L26:
	movq	-88(%rbp), %rdi
	movl	$1, %ecx
	movl	$1, %edx
	leaq	-129(%rbp), %rsi
	incl	-164(%rbp)
	call	cudaMemcpy@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r12, %rdx
	movl	-172(%rbp), %eax
	movl	$1, %ecx
	movq	%r12, -68(%rbp)
	movl	$1, -60(%rbp)
	movl	%eax, -80(%rbp)
	movabsq	$4294967297, %rax
	movq	%rax, -76(%rbp)
	movq	-80(%rbp), %rdi
	movl	-72(%rbp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L25
	movq	-88(%rbp), %r8
	movq	-96(%rbp), %rcx
	movl	%ebx, %edx
	movq	-104(%rbp), %rsi
	movq	-112(%rbp), %rdi
	call	_Z57__device_stub__Z15bfs_unoptimizedP13graphVerticesPiiS1_PbP13graphVerticesPiiS1_Pb
.L25:
	movq	-88(%rbp), %rsi
	movl	$2, %ecx
	movl	$1, %edx
	movq	%r15, %rdi
	call	cudaMemcpy@PLT
	cmpb	$0, (%r15)
	jne	.L26
	movq	-152(%rbp), %rdx
	movq	-96(%rbp), %rsi
	movl	$2, %ecx
	movq	%r13, %rdi
	call	cudaMemcpy@PLT
	movl	-164(%rbp), %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	-120(%rbp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	-120(%rbp), %rdi
	call	cudaEventSynchronize@PLT
	movq	-120(%rbp), %rdx
	movq	-128(%rbp), %rsi
	leaq	-68(%rbp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	-68(%rbp), %xmm0
	call	__printf_chk@PLT
	movq	-112(%rbp), %rdi
	call	cudaFree@PLT
	movq	-104(%rbp), %rdi
	call	cudaFree@PLT
	movq	-96(%rbp), %rdi
	call	cudaFree@PLT
	movq	-88(%rbp), %rdi
	call	cudaFree@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L27
.L36:
	call	__stack_chk_fail@PLT
.L27:
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2027:
	.size	main, .-main
	.section	.rodata.str1.1
.LC3:
	.string	"_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2055:
	.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	.LC3(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb(%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
.LFE2055:
	.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 <math.h>
#include <string.h>

#define MAX_DIST 5000

typedef struct graphVertices {
	int startIndex;
	int numberOfNeighbours;
	
} graphVertices;

__global__ void bfs_unoptimized(graphVertices* graphVertice_gpu, int* NeighboursVertices_gpu, int numberOfNodes, int* result_gpu, bool* gpu_done) {
	
	// Thread index
	int tid = blockIdx.x*blockDim.x + threadIdx.x;
	
	int numOfThreads = blockDim.x * gridDim.x;

	// All the threads traverse the adjancy list
	for(int v = 0; v < numberOfNodes; v += numOfThreads) {
		
		// different index for different thread
		int vertex = v + tid;
	
		// check boundary condition
		if(vertex < numberOfNodes) {
		
			// traverse all the neighbouring vertex concurrently
			for(int n=0;n<graphVertice_gpu[vertex].numberOfNeighbours;n++) {
				int neighbour = NeighboursVertices_gpu[graphVertice_gpu[vertex].startIndex + n];
			
				// computation of the cost and traversal
				if (result_gpu[neighbour] > result_gpu[vertex] + 1) {
 					result_gpu[neighbour] = result_gpu[vertex] + 1;
					*gpu_done = 0;									
 
				}
				

			}

		}
	} 
	
	
}

int main( int argc, char* argv[] ) { 
	// input from user
	int NUM_NODES = atoi(argv[1]);

	// kernel parameters
	int block_size = 1024;
	int grid_size = NUM_NODES/block_size;

	// structure declaration
	graphVertices vertice[NUM_NODES];

	// Array of neighbouring nodes
	int neighbourVertices[NUM_NODES];  

	// populate the graph
	for(int i=0;i<NUM_NODES;i++) {
		vertice[i].numberOfNeighbours = 2;// (rand() % 5)+1;
	}
	
	vertice[0].startIndex = 0;
	for(int j=1;j<NUM_NODES;j++) {
		vertice[j].startIndex = vertice[j-1].startIndex + vertice[j-1].numberOfNeighbours;
	}

	for(int k=0;k<NUM_NODES*2;k++) {
		neighbourVertices[k] = k+1;
	}

	int start_vertex = neighbourVertices[1];

	hipSetDevice(0);
        
	// Time Variables
	hipEvent_t start, stop;
	float time;
	hipEventCreate (&start);
	hipEventCreate (&stop);

	// Variable declaration for GPU
	graphVertices* graphVertice_gpu;
	int* neighbourVertices_gpu;
	int* result_gpu;
	bool* gpu_done;

	// Memory allocation for GPU variables
	hipMalloc((void**)&graphVertice_gpu, sizeof(graphVertices)*NUM_NODES);
	hipMalloc((void**)&neighbourVertices_gpu, sizeof(int)*NUM_NODES*2);
	hipMalloc((void**)&result_gpu, sizeof(int)*NUM_NODES);
	hipMalloc((void**)&gpu_done, sizeof(bool) * 1);

	int kernel_call_count;		
	int* result_cpu;
	bool* cpu_done = new bool[1];
	result_cpu = new int[NUM_NODES];

	for(int i=0;i<NUM_NODES;i++) {
		result_cpu[i] = MAX_DIST;
	}

	result_cpu[start_vertex] = 0;

	// Transfer data from CPU to GPU
	hipMemcpy(result_gpu, result_cpu, sizeof(int) * NUM_NODES, hipMemcpyHostToDevice);
	hipMemcpy(graphVertice_gpu, vertice, sizeof(graphVertices)*NUM_NODES, hipMemcpyHostToDevice);
	hipMemcpy(neighbourVertices_gpu, neighbourVertices, sizeof(int)*NUM_NODES*2, hipMemcpyHostToDevice);

	printf("Running parallel job.\n");

	hipEventRecord(start,0);
	bool false_value = 1;

	do
	{
		kernel_call_count++;		
		hipMemcpy(gpu_done, &false_value, sizeof(bool) * 1, hipMemcpyHostToDevice);

		// call the kernel
		bfs_unoptimized<<<grid_size, block_size>>>(graphVertice_gpu, neighbourVertices_gpu, NUM_NODES, result_gpu, gpu_done);
		
		hipMemcpy(cpu_done, gpu_done , sizeof(bool) * 1, hipMemcpyDeviceToHost);
	} while(*cpu_done != 0);

	// Transfer result back from GPU to CPU
	hipMemcpy(result_cpu, result_gpu, sizeof(int)*NUM_NODES, hipMemcpyDeviceToHost);

	printf("Kernel call : %d\n", kernel_call_count);
	
	hipEventRecord(stop,0);
	hipEventSynchronize(stop);

	hipEventElapsedTime(&time, start, stop);
	printf("Parallel Job Time: %.2f ms\n", time);

	hipFree(graphVertice_gpu);
	hipFree(neighbourVertices_gpu);
	hipFree(result_gpu);
	hipFree(gpu_done);
	
	return 0;
}


	.text
	.file	"bfs_unoptimized.hip"
	.globl	_Z30__device_stub__bfs_unoptimizedP13graphVerticesPiiS1_Pb # -- Begin function _Z30__device_stub__bfs_unoptimizedP13graphVerticesPiiS1_Pb
	.type	_Z30__device_stub__bfs_unoptimizedP13graphVerticesPiiS1_Pb,@function
_Z30__device_stub__bfs_unoptimizedP13graphVerticesPiiS1_Pb: # @_Z30__device_stub__bfs_unoptimizedP13graphVerticesPiiS1_Pb
	.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	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	32(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z30__device_stub__bfs_unoptimizedP13graphVerticesPiiS1_Pb, .Lfunc_end0-_Z30__device_stub__bfs_unoptimizedP13graphVerticesPiiS1_Pb
	.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
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	8(%rsi), %rdi
	callq	atoi
                                        # kill: def $eax killed $eax def $rax
	leal	1023(%rax), %edi
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	movl	%eax, %ebx
	movq	%rsp, %r14
	leaq	15(,%rbx,8), %rcx
	andq	$-16, %rcx
	subq	%rcx, %r14
	movq	%r14, %rsp
	movq	%rsp, %rsi
	leaq	15(,%rbx,4), %rcx
	andq	$-16, %rcx
	subq	%rcx, %rsi
	movq	%rsi, %rsp
	testl	%eax, %eax
	movq	%rsi, -136(%rbp)                # 8-byte Spill
	jle	.LBB1_19
# %bb.1:                                # %.lr.ph.preheader
	xorl	%eax, %eax
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$2, 4(%r14,%rax,8)
	incq	%rax
	cmpq	%rax, %rbx
	jne	.LBB1_2
# %bb.3:                                # %._crit_edge
	movl	$0, (%r14)
	cmpl	$1, %ebx
	je	.LBB1_6
# %bb.4:                                # %.lr.ph59.preheader
	movl	$1, %eax
.LBB1_5:                                # %.lr.ph59
                                        # =>This Inner Loop Header: Depth=1
	movl	-4(%r14,%rax,8), %ecx
	addl	-8(%r14,%rax,8), %ecx
	movl	%ecx, (%r14,%rax,8)
	incq	%rax
	cmpq	%rax, %rbx
	jne	.LBB1_5
.LBB1_6:                                # %.preheader
	testl	%ebx, %ebx
	jle	.LBB1_7
# %bb.17:                               # %.lr.ph61.preheader
	leal	(%rbx,%rbx), %ecx
	cmpl	$2, %ecx
	movl	$1, %eax
	cmovgel	%ecx, %eax
	xorl	%ecx, %ecx
.LBB1_18:                               # %.lr.ph61
                                        # =>This Inner Loop Header: Depth=1
	leaq	1(%rcx), %rdx
	movl	%edx, (%rsi,%rcx,4)
	movq	%rdx, %rcx
	cmpq	%rdx, %rax
	jne	.LBB1_18
# %bb.8:                                # %._crit_edge62.loopexit
	movslq	4(%rsi), %rax
	jmp	.LBB1_9
.LBB1_19:                               # %.preheader.thread
	movl	$0, (%r14)
.LBB1_7:
	xorl	%eax, %eax
.LBB1_9:                                # %._crit_edge62
	movq	%rax, -56(%rbp)                 # 8-byte Spill
	sarl	$10, %edi
	movl	%edi, -100(%rbp)                # 4-byte Spill
	xorl	%edi, %edi
	callq	hipSetDevice
	leaq	-120(%rbp), %rdi
	callq	hipEventCreate
	leaq	-96(%rbp), %rdi
	callq	hipEventCreate
	movslq	%ebx, %r15
	leaq	(,%r15,8), %r13
	leaq	-88(%rbp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	leaq	(,%r15,4), %r12
	leaq	-80(%rbp), %rdi
	movq	%r13, -128(%rbp)                # 8-byte Spill
	movq	%r13, %rsi
	callq	hipMalloc
	leaq	-72(%rbp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	leaq	-64(%rbp), %rdi
	movl	$1, %esi
	callq	hipMalloc
	movl	$1, %edi
	callq	_Znam
	movq	%rax, %r13
	testl	%r15d, %r15d
	movq	$-1, %rdi
	movq	%r12, -112(%rbp)                # 8-byte Spill
	cmovnsq	%r12, %rdi
	callq	_Znam
	testl	%r15d, %r15d
	jle	.LBB1_12
# %bb.10:                               # %.lr.ph65.preheader
	xorl	%ecx, %ecx
.LBB1_11:                               # %.lr.ph65
                                        # =>This Inner Loop Header: Depth=1
	movl	$5000, (%rax,%rcx,4)            # imm = 0x1388
	incq	%rcx
	cmpq	%rcx, %rbx
	jne	.LBB1_11
.LBB1_12:                               # %._crit_edge66
	movabsq	$4294967296, %r15               # imm = 0x100000000
	movq	-56(%rbp), %rcx                 # 8-byte Reload
	movl	$0, (%rax,%rcx,4)
	movq	-72(%rbp), %rdi
	movq	%rax, -56(%rbp)                 # 8-byte Spill
	movq	%rax, %rsi
	movq	-112(%rbp), %rdx                # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	movq	-88(%rbp), %rdi
	movq	%r14, %rsi
	movq	-128(%rbp), %r14                # 8-byte Reload
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	-80(%rbp), %rdi
	movq	-136(%rbp), %rsi                # 8-byte Reload
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$.Lstr, %edi
	callq	puts@PLT
	movq	-120(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	leaq	-41(%rbp), %rax
	movb	$1, (%rax)
	movl	-100(%rbp), %r12d               # 4-byte Reload
	btsq	$32, %r12
	addq	$1024, %r15                     # imm = 0x400
                                        # implicit-def: $r14d
.LBB1_13:                               # =>This Inner Loop Header: Depth=1
	movq	-64(%rbp), %rdi
	movl	$1, %edx
	leaq	-41(%rbp), %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB1_15
# %bb.14:                               #   in Loop: Header=BB1_13 Depth=1
	movq	-88(%rbp), %rdi
	movq	-80(%rbp), %rsi
	movq	-72(%rbp), %rcx
	movq	-64(%rbp), %r8
	movl	%ebx, %edx
	callq	_Z30__device_stub__bfs_unoptimizedP13graphVerticesPiiS1_Pb
.LBB1_15:                               #   in Loop: Header=BB1_13 Depth=1
	movq	-64(%rbp), %rsi
	movl	$1, %edx
	movq	%r13, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	incl	%r14d
	cmpb	$0, (%r13)
	jne	.LBB1_13
# %bb.16:
	movq	-72(%rbp), %rsi
	movq	-56(%rbp), %rdi                 # 8-byte Reload
	movq	-112(%rbp), %rdx                # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$.L.str.1, %edi
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	printf
	movq	-96(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	-96(%rbp), %rdi
	callq	hipEventSynchronize
	movq	-120(%rbp), %rsi
	movq	-96(%rbp), %rdx
	leaq	-140(%rbp), %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	cvtss2sd	(%rbx), %xmm0
	movl	$.L.str.2, %edi
	movb	$1, %al
	callq	printf
	movq	-88(%rbp), %rdi
	callq	hipFree
	movq	-80(%rbp), %rdi
	callq	hipFree
	movq	-72(%rbp), %rdi
	callq	hipFree
	movq	-64(%rbp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.Lfunc_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB2_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB2_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb, %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_end2:
	.size	__hip_module_ctor, .Lfunc_end2-__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	.LBB3_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
.LBB3_2:
	retq
.Lfunc_end3:
	.size	__hip_module_dtor, .Lfunc_end3-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb,@object # @_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb
	.section	.rodata,"a",@progbits
	.globl	_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb
	.p2align	3, 0x0
_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb:
	.quad	_Z30__device_stub__bfs_unoptimizedP13graphVerticesPiiS1_Pb
	.size	_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb, 8

	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"Kernel call : %d\n"
	.size	.L.str.1, 18

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Parallel Job Time: %.2f ms\n"
	.size	.L.str.2, 28

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb"
	.size	.L__unnamed_1, 44

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

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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"Running parallel job."
	.size	.Lstr, 22

	.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 _Z30__device_stub__bfs_unoptimizedP13graphVerticesPiiS1_Pb
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb ; -- Begin function _Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb
	.globl	_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb
	.p2align	8
	.type	_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb,@function
_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb: ; @_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb
; %bb.0:
	s_load_b32 s10, s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s10, 1
	s_cbranch_scc1 .LBB0_9
; %bb.1:                                ; %.lr.ph34.preheader
	s_clause 0x3
	s_load_b32 s8, s[0:1], 0x34
	s_load_b32 s11, s[0:1], 0x28
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b128 s[0:3], s[0:1], 0x18
	s_mov_b32 s12, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s8, s8, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1)
	v_mad_u64_u32 v[1:2], null, s15, s8, v[0:1]
	v_mov_b32_e32 v0, 0
	s_mul_i32 s11, s11, s8
.LBB0_2:                                ; %.lr.ph34
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v4, s12, v1
	s_mov_b32 s13, exec_lo
	v_cmpx_gt_i32_e64 s10, v4
	s_cbranch_execz .LBB0_8
; %bb.3:                                ; %.preheader
                                        ;   in Loop: Header=BB0_2 Depth=1
	v_ashrrev_i32_e32 v5, 31, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 3, v[4:5]
	v_add_co_u32 v2, vcc_lo, s4, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v3, vcc_lo
	global_load_b32 v10, v[2:3], off offset:4
	s_waitcnt vmcnt(0)
	v_cmp_lt_i32_e32 vcc_lo, 0, v10
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_8
; %bb.4:                                ; %.lr.ph
                                        ;   in Loop: Header=BB0_2 Depth=1
	v_lshlrev_b64 v[6:7], 2, v[4:5]
	v_add_co_u32 v4, vcc_lo, v2, 4
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v3, vcc_lo
	s_mov_b64 s[8:9], 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v6, vcc_lo, s0, v6
	v_add_co_ci_u32_e32 v7, vcc_lo, s1, v7, vcc_lo
	s_mov_b32 s14, 0
.LBB0_5:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	global_load_b32 v8, v[2:3], off
	s_mov_b32 s15, exec_lo
	s_waitcnt vmcnt(0)
	v_ashrrev_i32_e32 v9, 31, v8
	v_add_co_u32 v8, vcc_lo, s8, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v9, vcc_lo, s9, v9, vcc_lo
	v_lshlrev_b64 v[8:9], 2, v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v8, vcc_lo, s6, v8
	v_add_co_ci_u32_e32 v9, vcc_lo, s7, v9, vcc_lo
	global_load_b32 v8, v[8:9], off
	s_waitcnt vmcnt(0)
	v_ashrrev_i32_e32 v9, 31, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[8:9], 2, v[8:9]
	v_add_co_u32 v8, vcc_lo, s0, v8
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v9, vcc_lo, s1, v9, vcc_lo
	s_clause 0x1
	global_load_b32 v11, v[6:7], off
	global_load_b32 v12, v[8:9], off
	s_waitcnt vmcnt(1)
	v_add_nc_u32_e32 v11, 1, v11
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 v12, v11
	s_cbranch_execz .LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=2
	global_store_b32 v[8:9], v11, off
	global_load_b32 v10, v[4:5], off
	global_store_b8 v0, v0, s[2:3]
.LBB0_7:                                ;   in Loop: Header=BB0_5 Depth=2
	s_or_b32 exec_lo, exec_lo, s15
	s_add_u32 s8, s8, 1
	s_addc_u32 s9, s9, 0
	s_waitcnt vmcnt(0)
	v_cmp_ge_i32_e32 vcc_lo, s8, v10
	s_or_b32 s14, vcc_lo, s14
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s14
	s_cbranch_execnz .LBB0_5
.LBB0_8:                                ; %.loopexit
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s13
	s_add_i32 s12, s12, s11
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_ge_i32 s12, s10
	s_cbranch_scc0 .LBB0_2
.LBB0_9:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.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 13
		.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	_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb, .Lfunc_end0-_Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 460
; NumSgprs: 18
; NumVgprs: 13
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 13
; Occupancy: 16
; WaveLimiterHint : 1
; 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
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z15bfs_unoptimizedP13graphVerticesPiiS1_Pb.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     13
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
