#include <iostream>
#include <stdio.h>
#include <stdbool.h> /*helps with bool data type*/
#include <string.h> /* memset */
#include <unistd.h> /* close */
#include <emmintrin.h>
#include <sys/time.h> /*allows system type*/





struct timeval start, end;
void starttime() {
  gettimeofday( &start, 0 );
}

void endtime(const char* c) {
   gettimeofday( &end, 0 );
   double elapsed = ( end.tv_sec - start.tv_sec ) * 1000.0 + ( end.tv_usec - start.tv_usec ) / 1000.0;
   printf("%s: %f ms\n", c, elapsed); 
}

//initializes matrix values to 0,
//AS OF RIGHT NOW , ONLY USES THREADS!!!
__global__ void initTo(int *matx, int vs, int set){
	int index = threadIdx.x;
  	int stride = blockDim.x;
	for(int i = index ; i < vs; i += stride ){
		matx[i] = set;
	}

}
//initializes truth table to true
////AS OF RIGHT NOW , ONLY USES THREADS!!!
__global__ void initTo(bool *t_table, int vs, bool set){
	int index = threadIdx.x;
  	int stride = blockDim.x;
	for(int i = index ; i < vs; i += stride ){
		t_table[i] = set;
	}

}

__global__ void checkPathsTH(int *matrix, int vertices, int pathsize, int *paths, bool *t_table){
	//int index = threadIdx.x;
  	int stride = blockDim.x;
	int index = blockIdx.x*blockDim.x + threadIdx.x;

	//printf("%i\n",stride);
	//index is the actual index!!!
	//so 0-95
	//stops trash from going out of bounds
/*
	if(index<(pathsize)){
		for(int j = 0;j<vertices;j++){
			printf("%i's own %i called %i ",index,j,paths[(index*vertices)+j]);
			//THIS GETS YOU WHAT YOU NEED paths[(index*vertices)+j]
		}
		//printf("%i, %i, %i\n",index,stride,paths[index]);
	}
*/


	for(int i = index ; i < pathsize; i += stride){

		for(int j = 0;j<vertices;j++){

			if(j==0){
				if(matrix[(paths[(index*vertices)+j] * vertices) + paths[(index*vertices)+j+1]] != 1 &&
					matrix[(paths[(index*vertices)+j+1] * vertices) + paths[(index*vertices)+j]] != 1 )
				{
					t_table[index] = false;
					break;
				}
			}else if(j > 0 && j < vertices-1){
				if( (matrix[(paths[(index*vertices)+j] * vertices) + paths[(index*vertices)+j+1]] != 1 &&
					matrix[(paths[(index*vertices)+j+1] * vertices) + paths[(index*vertices)+j]] != 1 )
					||
				    (matrix[(paths[(index*vertices)+j] * vertices) + paths[(index*vertices)+j-1]] != 1 &&
					matrix[(paths[(index*vertices)+j-1] * vertices) + paths[(index*vertices)+j]] != 1 )
					)
					
				{
					t_table[index] = false;
					break;
				}

			}else if(j== vertices -1){
				if(matrix[(paths[(index*vertices)+j] * vertices) + paths[(index*vertices)+j-1]] != 1 &&
					matrix[(paths[(index*vertices)+j-1] * vertices) + paths[(index*vertices)+j]] != 1 )
				{
					t_table[index] = false;
					break;
				}


			}
			
		}
	}	

	//__syncthreads();
}


void checkPathLocal(int *ptr_path,int vertices,int pathsize, int *matrix, bool *possiblePaths ){
	for(int outcount = 0; outcount < pathsize;outcount++){
        for (int i = 0; i < vertices; i++){

            //the first one only checks the next one, checks if the path is even possible
            if(i == 0){
                if(matrix[(ptr_path[(outcount*vertices)+i] * vertices) + ptr_path[(outcount*vertices)+i+1]] != 1 &&
                   matrix[(ptr_path[(outcount*vertices)+i+1] * vertices) + ptr_path[(outcount*vertices)+i]] != 1)
                {
                    possiblePaths[outcount] = false;
                    break;
                }
            }
            else if(i > 0 && i < vertices - 1){
                if( (matrix[(ptr_path[(outcount*vertices)+i] * vertices) + ptr_path[(outcount*vertices)+i+1]] != 1 &&
                     matrix[(ptr_path[(outcount*vertices)+i+1] * vertices) + ptr_path[(outcount*vertices)+i]] != 1) 
                    ||
                    (matrix[(ptr_path[(outcount*vertices)+i] * vertices) + ptr_path[(outcount*vertices)+i-1]] != 1  &&
                     matrix[(ptr_path[(outcount*vertices)+i-1] * vertices) + ptr_path[(outcount*vertices)+i]] != 1)
                    )
                {
                    possiblePaths[outcount] = false;
                    break;
                }
            }
            else if(i == vertices - 1){
                if( matrix[(ptr_path[(outcount*vertices)+i] * vertices) + ptr_path[(outcount*vertices)+i-1]] != 1  &&
                    matrix[(ptr_path[(outcount*vertices)+i-1] * vertices) + ptr_path[(outcount*vertices)+i]] != 1)
                {
                    possiblePaths[outcount] = false;
                    break;
                } 
            }
        }   
    }
	endtime("NORMAL");
}




//just makes unweighted edges in a 1D array
void makeEdge(int to, int from, int *num, int vertices) {
        *(num + (((to) * (vertices)) + (from))) = 1;
	*(num + (((from) * (vertices)) + (to))) = 1;
	//matrix[((to) * (vertices)) + (from)] = 1;
        //matrix[((from) * (vertices)) + (to)] = 1;
        //matrix[from][to] = 1;
}

//swaps values, assists permute
    int swap(int a[], int i, int j)
    {
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;
        return a[j];
    }


//places in array
void getArray(int ha[] , int *ptr_path , int vertices, int pathsize){
        //finds the first path that is empty and places the array there!!!
        for(int i = 0; i < pathsize ;i++){
            //finds the first one that wasn't touched
            if( *(ptr_path + (i*vertices))  == -1){
                //maybe there could be a way to binary search this to make it faster!
                //i dunno :3
                //paths[i] = ha;
                for(int j =0; j < vertices ; j++){
                    //write to the original array
                    *(ptr_path + (i*vertices)+j) = ha[j];
                }
                //stops when found
                return;
            }
        }
}


void permute(int str[] , int l, int r, int *ptr_path, int vertices, int pathsize){
        //printf("Value of paths = %p\n",ptr_path);
        if (l == r){
            //array created to save each combination
            int raw [vertices]; 
            //prints the combinations and save them to the array.
            for(int j=0; j < vertices ;j++){
                //printf("%i", str[j]);
                raw[j] = str[j];
            }
           getArray(raw,ptr_path,vertices,pathsize);
           //printf("+++\n");
            //count = 0;
        }
        else
        {
            for (int i = l; i <= r; i++)
            {
                str[i] = swap(str,l,i);
                //permute(str, l+1, r);
                permute(str, l+1, r,ptr_path, vertices, pathsize);
                str[i] = swap(str,l,i);    
            }
        }
        
    }





int main(void) {

	const int vertices = 5;

	int *matrix;
	//int matrix[vertices*vertices] ;
 	//memset(matrix, 0, sizeof matrix);
	
	//1D MATRIX ARRAY INNITIALLIZED IN 
	//ALLOCATES
	cudaMallocManaged(&matrix, (vertices*vertices)*sizeof(int));
	//initiates to 0
	initTo<<<1,100>>>(matrix,vertices*vertices,0);
	cudaDeviceSynchronize();


	int pathsize = 1;
    	for (int i = 1; i < vertices + 1; i++)
    	{
        	pathsize = pathsize * i;
    	}
    	printf("%i\n",pathsize);

	bool *possiblePaths;
	cudaMallocManaged(&possiblePaths, (pathsize)*sizeof(bool));

	//bool possiblePaths[pathsize];
	//initialize to true
    	//memset(possiblePaths, true, sizeof possiblePaths);
	initTo<<<1,100>>>(possiblePaths,pathsize,true);
	cudaDeviceSynchronize();
	
	int *allPaths;
	cudaMallocManaged(&allPaths, (pathsize*vertices)*sizeof(int));
	initTo<<<1,100>>>(allPaths,pathsize*vertices,-1);
	cudaDeviceSynchronize();



//creating the graph 
	// ---
	//| / |
	// ---

	
	makeEdge(0,2,matrix,vertices);
	makeEdge(0,3,matrix,vertices);
   	makeEdge(1,4,matrix,vertices);
    	makeEdge(1,3,matrix,vertices);
	makeEdge(2,4,matrix,vertices);

	printf("The adjacency matrix for the given graph is: ");
   	 printf("\n  ");
    	for (int i = 0; i < vertices; i++)
       		printf("%i ",i+1);
    
    	for (int j = 0; j < vertices*vertices; j++) {
        	if(j % vertices == 0)
                	printf("\n%i ",(j/4)+1);
            printf("%i ", matrix[j]);
    	}
        printf("\n");

printf("%i\n",allPaths[0]);
printf("%i\n",allPaths[95]);	

int arr[vertices];
	for(int pattern = 0 ; pattern < vertices; pattern++){
        	arr[pattern] = pattern;
}

permute(arr,0,vertices - 1,allPaths,vertices,pathsize);

//printf("%i\n",allPaths[0]);
//printf("%i\n",allPaths[95]);
for (int i = 0; i < pathsize; i++)
        {
            if(i<10)
            printf(" %i |",i);
            else
                printf("%i |",i);

            for (int j = 0; j < vertices; j++)
            {
                printf("%d ", allPaths[(i*vertices)+j]);
            }
            //ptr_path++;
            printf("\n");
		
        }
/*
printf("%i\n",allPaths[92]);
printf("%i\n",allPaths[93]);
printf("%i\n",allPaths[94]);
printf("%i\n",allPaths[95]);
*/


starttime();
checkPathLocal(allPaths,vertices,pathsize,matrix,possiblePaths);
cudaDeviceSynchronize();

printf("POSSIBLE PATHS\n");
for(int wow = 0 ; wow<pathsize;wow++){
        //printf("");
        if(possiblePaths[wow] == true){
            for(int innerwow = 0 ; innerwow < vertices ; innerwow++){
                printf("%i", allPaths[(wow*vertices)+innerwow]);
            }
            printf("\n");
        }
        //printf("%d ",possiblePaths[wow]);
    }
printf("\n");

cudaDeviceSynchronize();
initTo<<<1,100>>>(possiblePaths,pathsize,true);
cudaDeviceSynchronize();

cudaDeviceSynchronize();
starttime();
checkPathsTH<<<2,75>>>(matrix,vertices,pathsize,allPaths,possiblePaths);
endtime("GPU THREADS");
cudaDeviceSynchronize();

cudaDeviceSynchronize();
printf("POSSIBLE PATHS\n");
for(int wow = 0 ; wow<pathsize;wow++){
        //printf("");
        if(possiblePaths[wow] == true){
            for(int innerwow = 0 ; innerwow < vertices ; innerwow++){
                printf("%i", allPaths[(wow*vertices)+innerwow]);
            }
            printf("\n");
        }
        //printf("%d ",possiblePaths[wow]);
    }
printf("\n");




	 // Free memory
  	cudaFree(matrix);
	cudaFree(possiblePaths);
	cudaFree(allPaths);
	//free(matrix);

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

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4179:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4179:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z9starttimev
	.type	_Z9starttimev, @function
_Z9starttimev:
.LFB4169:
	.cfi_startproc
	endbr64
	xorl	%esi, %esi
	leaq	start(%rip), %rdi
	jmp	gettimeofday@PLT
	.cfi_endproc
.LFE4169:
	.size	_Z9starttimev, .-_Z9starttimev
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%s: %f ms\n"
	.text
	.globl	_Z7endtimePKc
	.type	_Z7endtimePKc, @function
_Z7endtimePKc:
.LFB4170:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	xorl	%esi, %esi
	movq	%rdi, %rbx
	leaq	end(%rip), %rdi
	call	gettimeofday@PLT
	movq	end(%rip), %rax
	movq	%rbx, %rdx
	popq	%rbx
	.cfi_def_cfa_offset 8
	subq	start(%rip), %rax
	movsd	.LC0(%rip), %xmm2
	movl	$2, %edi
	leaq	.LC1(%rip), %rsi
	cvtsi2sdq	%rax, %xmm0
	movq	8+end(%rip), %rax
	subq	8+start(%rip), %rax
	cvtsi2sdq	%rax, %xmm1
	movb	$1, %al
	mulsd	%xmm2, %xmm0
	divsd	%xmm2, %xmm1
	addsd	%xmm1, %xmm0
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE4170:
	.size	_Z7endtimePKc, .-_Z7endtimePKc
	.section	.rodata.str1.1
.LC2:
	.string	"NORMAL"
	.text
	.globl	_Z14checkPathLocalPiiiS_Pb
	.type	_Z14checkPathLocalPiiiS_Pb, @function
_Z14checkPathLocalPiiiS_Pb:
.LFB4171:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%esi, %eax
	xorl	%r11d, %r11d
	xorl	%r9d, %r9d
	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
	leal	-1(%rsi), %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, -12(%rsp)
	movq	%rcx, %rdx
.L6:
	cmpl	%r9d, -12(%rsp)
	jle	.L14
	movslq	%r11d, %rcx
	xorl	%esi, %esi
	salq	$2, %rcx
	leaq	(%rdi,%rcx), %r15
	leaq	4(%rdi,%rcx), %r14
.L15:
	cmpl	%eax, %esi
	jge	.L9
	testl	%esi, %esi
	jne	.L7
	movl	(%r15), %ebx
	movl	(%r14), %ecx
	jmp	.L24
.L7:
	cmpl	%esi, %r12d
	jle	.L10
	leal	(%rsi,%r11), %ecx
	movslq	%ecx, %rcx
	movl	(%rdi,%rcx,4), %ebx
	leaq	0(,%rcx,4), %r13
	movl	4(%rdi,%r13), %ecx
	movl	%ebx, %r10d
	imull	%eax, %r10d
	leal	(%r10,%rcx), %ebp
	movslq	%ebp, %rbp
	cmpl	$1, (%rdx,%rbp,4)
	je	.L11
	imull	%eax, %ecx
	addl	%ebx, %ecx
	movslq	%ecx, %rcx
	cmpl	$1, (%rdx,%rcx,4)
	jne	.L17
.L11:
	movl	-4(%rdi,%r13), %ecx
	jmp	.L22
.L10:
	jne	.L8
	leal	(%r12,%r11), %ecx
	movslq	%ecx, %rcx
	movl	(%rdi,%rcx,4), %ebx
	movl	-4(%rdi,%rcx,4), %ecx
.L24:
	movl	%ebx, %r10d
	imull	%eax, %r10d
.L22:
	addl	%ecx, %r10d
	movslq	%r10d, %r10
	cmpl	$1, (%rdx,%r10,4)
	je	.L8
	imull	%eax, %ecx
	addl	%ebx, %ecx
	movslq	%ecx, %rcx
	cmpl	$1, (%rdx,%rcx,4)
	je	.L8
.L17:
	movb	$0, (%r8,%r9)
	jmp	.L9
.L8:
	incl	%esi
	jmp	.L15
.L9:
	incq	%r9
	addl	%eax, %r11d
	jmp	.L6
.L14:
	popq	%rbx
	.cfi_def_cfa_offset 48
	leaq	.LC2(%rip), %rdi
	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	_Z7endtimePKc
	.cfi_endproc
.LFE4171:
	.size	_Z14checkPathLocalPiiiS_Pb, .-_Z14checkPathLocalPiiiS_Pb
	.globl	_Z8makeEdgeiiPii
	.type	_Z8makeEdgeiiPii, @function
_Z8makeEdgeiiPii:
.LFB4172:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	imull	%ecx, %eax
	imull	%esi, %ecx
	addl	%esi, %eax
	addl	%edi, %ecx
	cltq
	movslq	%ecx, %rcx
	movl	$1, (%rdx,%rax,4)
	movl	$1, (%rdx,%rcx,4)
	ret
	.cfi_endproc
.LFE4172:
	.size	_Z8makeEdgeiiPii, .-_Z8makeEdgeiiPii
	.globl	_Z4swapPiii
	.type	_Z4swapPiii, @function
_Z4swapPiii:
.LFB4173:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	movslq	%edx, %rdx
	leaq	(%rdi,%rsi,4), %rcx
	leaq	(%rdi,%rdx,4), %rdx
	movl	(%rcx), %eax
	movl	(%rdx), %esi
	movl	%esi, (%rcx)
	movl	%eax, (%rdx)
	ret
	.cfi_endproc
.LFE4173:
	.size	_Z4swapPiii, .-_Z4swapPiii
	.globl	_Z8getArrayPiS_ii
	.type	_Z8getArrayPiS_ii, @function
_Z8getArrayPiS_ii:
.LFB4174:
	.cfi_startproc
	endbr64
	movslq	%edx, %r10
	movq	%rdi, %r9
	xorl	%eax, %eax
	xorl	%edi, %edi
	imulq	$-4, %r10, %r8
	addq	%rsi, %r8
.L29:
	cmpl	%ecx, %eax
	jge	.L35
	leaq	(%rdi,%r10), %r11
	cmpl	$-1, (%r8,%r11,4)
	jne	.L30
	leaq	(%rsi,%rdi,4), %rcx
	xorl	%eax, %eax
.L31:
	cmpl	%eax, %edx
	jle	.L36
	movl	(%r9,%rax,4), %esi
	movl	%esi, (%rcx,%rax,4)
	incq	%rax
	jmp	.L31
.L36:
	ret
.L30:
	incl	%eax
	movq	%r11, %rdi
	jmp	.L29
.L35:
	ret
	.cfi_endproc
.LFE4174:
	.size	_Z8getArrayPiS_ii, .-_Z8getArrayPiS_ii
	.globl	_Z7permutePiiiS_ii
	.type	_Z7permutePiiiS_ii, @function
_Z7permutePiiiS_ii:
.LFB4175:
	.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
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	movl	%r8d, %r13d
	pushq	%r12
	pushq	%rbx
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$56, %rsp
	movq	%rcx, -80(%rbp)
	movl	%r9d, -72(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	cmpl	%edx, %esi
	je	.L38
	leal	1(%rsi), %eax
	movl	%esi, %r12d
	movl	%edx, %r14d
	movslq	%esi, %r15
	movl	%eax, -84(%rbp)
	jmp	.L39
.L38:
	movslq	%r8d, %rax
	movq	%rsp, %rcx
	movq	%rsp, %r12
	leaq	15(,%rax,4), %rdx
	movq	%rdx, %rax
	andq	$-4096, %rdx
	andq	$-16, %rax
	subq	%rdx, %rcx
.L40:
	cmpq	%rcx, %rsp
	je	.L41
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L40
.L41:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L42
	orq	$0, -8(%rsp,%rax)
.L42:
	movq	%rsp, %rdi
	xorl	%eax, %eax
.L43:
	cmpl	%eax, %r13d
	jle	.L52
	movl	(%rbx,%rax,4), %edx
	movl	%edx, (%rdi,%rax,4)
	incq	%rax
	jmp	.L43
.L52:
	movl	-72(%rbp), %ecx
	movq	-80(%rbp), %rsi
	movl	%r13d, %edx
	call	_Z8getArrayPiS_ii
	movq	%r12, %rsp
	jmp	.L37
.L39:
	cmpl	%r15d, %r14d
	jl	.L37
	movl	%r15d, %edx
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	%r15d, -68(%rbp)
	call	_Z4swapPiii
	movq	-80(%rbp), %rcx
	movl	-84(%rbp), %esi
	movl	%r14d, %edx
	movl	%eax, (%rbx,%r15,4)
	movl	-72(%rbp), %r9d
	movl	%r13d, %r8d
	call	_Z7permutePiiiS_ii
	movl	-68(%rbp), %edx
	movl	%r12d, %esi
	movq	%rbx, %rdi
	call	_Z4swapPiii
	movl	%eax, (%rbx,%r15,4)
	incq	%r15
	jmp	.L39
.L37:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L47
	call	__stack_chk_fail@PLT
.L47:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4175:
	.size	_Z7permutePiiiS_ii, .-_Z7permutePiiiS_ii
	.globl	_Z27__device_stub__Z6initToPiiiPiii
	.type	_Z27__device_stub__Z6initToPiiiPiii, @function
_Z27__device_stub__Z6initToPiiiPiii:
.LFB4201:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	24(%rsp), %rcx
	leaq	32(%rsp), %rdi
	movl	%esi, 4(%rsp)
	leaq	44(%rsp), %rsi
	movl	%edx, (%rsp)
	leaq	16(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 40(%rsp)
	movq	%rax, 80(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L53
	pushq	24(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z6initToPiii(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 144
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L53:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L55
	call	__stack_chk_fail@PLT
.L55:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4201:
	.size	_Z27__device_stub__Z6initToPiiiPiii, .-_Z27__device_stub__Z6initToPiiiPiii
	.globl	_Z6initToPiii
	.type	_Z6initToPiii, @function
_Z6initToPiii:
.LFB4202:
	.cfi_startproc
	endbr64
	jmp	_Z27__device_stub__Z6initToPiiiPiii
	.cfi_endproc
.LFE4202:
	.size	_Z6initToPiii, .-_Z6initToPiii
	.globl	_Z27__device_stub__Z6initToPbibPbib
	.type	_Z27__device_stub__Z6initToPbibPbib, @function
_Z27__device_stub__Z6initToPbibPbib:
.LFB4203:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	24(%rsp), %rcx
	leaq	32(%rsp), %rdi
	movl	%esi, 4(%rsp)
	leaq	44(%rsp), %rsi
	movb	%dl, (%rsp)
	leaq	16(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 40(%rsp)
	movq	%rax, 80(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L58
	pushq	24(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z6initToPbib(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 144
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L58:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L60
	call	__stack_chk_fail@PLT
.L60:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4203:
	.size	_Z27__device_stub__Z6initToPbibPbib, .-_Z27__device_stub__Z6initToPbibPbib
	.globl	_Z6initToPbib
	.type	_Z6initToPbib, @function
_Z6initToPbib:
.LFB4204:
	.cfi_startproc
	endbr64
	movzbl	%dl, %edx
	jmp	_Z27__device_stub__Z6initToPbibPbib
	.cfi_endproc
.LFE4204:
	.size	_Z6initToPbib, .-_Z6initToPbib
	.globl	_Z38__device_stub__Z12checkPathsTHPiiiS_PbPiiiS_Pb
	.type	_Z38__device_stub__Z12checkPathsTHPiiiS_PbPiiiS_Pb, @function
_Z38__device_stub__Z12checkPathsTHPiiiS_PbPiiiS_Pb:
.LFB4205:
	.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
	movq	%rcx, 8(%rsp)
	leaq	40(%rsp), %rcx
	movq	%r8, (%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	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%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	.L63
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z12checkPathsTHPiiiS_Pb(%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
.L63:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L65
	call	__stack_chk_fail@PLT
.L65:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4205:
	.size	_Z38__device_stub__Z12checkPathsTHPiiiS_PbPiiiS_Pb, .-_Z38__device_stub__Z12checkPathsTHPiiiS_PbPiiiS_Pb
	.globl	_Z12checkPathsTHPiiiS_Pb
	.type	_Z12checkPathsTHPiiiS_Pb, @function
_Z12checkPathsTHPiiiS_Pb:
.LFB4206:
	.cfi_startproc
	endbr64
	jmp	_Z38__device_stub__Z12checkPathsTHPiiiS_PbPiiiS_Pb
	.cfi_endproc
.LFE4206:
	.size	_Z12checkPathsTHPiiiS_Pb, .-_Z12checkPathsTHPiiiS_Pb
	.section	.rodata.str1.1
.LC3:
	.string	"%i\n"
.LC4:
	.string	"The adjacency matrix for the given graph is: "
.LC5:
	.string	"\n  "
.LC6:
	.string	"%i "
.LC7:
	.string	"\n%i "
.LC8:
	.string	"\n"
.LC9:
	.string	" %i |"
.LC10:
	.string	"%i |"
.LC11:
	.string	"%d "
.LC12:
	.string	"POSSIBLE PATHS\n"
.LC13:
	.string	"%i"
.LC14:
	.string	"GPU THREADS"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB4176:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$1, %edx
	movl	$100, %esi
	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	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rdi
	call	cudaMallocManaged@PLT
	movl	$1073741849, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$2, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%rdx, 40(%rsp)
	movl	$1, 48(%rsp)
	movq	%rdi, 28(%rsp)
	movl	$1, 36(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L69
	movq	(%rsp), %rdi
	xorl	%edx, %edx
	movl	$25, %esi
	call	_Z27__device_stub__Z6initToPiiiPiii
.L69:
	call	cudaDeviceSynchronize@PLT
	leaq	.LC3(%rip), %rbp
	movl	$120, %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	8(%rsp), %rdi
	movl	$1, %edx
	movl	$120, %esi
	call	cudaMallocManaged@PLT
	movl	$1073741849, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$2, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%rdx, 40(%rsp)
	movl	$1, 48(%rsp)
	movq	%rdi, 28(%rsp)
	movl	$1, 36(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L70
	movq	8(%rsp), %rdi
	movl	$1, %edx
	movl	$120, %esi
	call	_Z27__device_stub__Z6initToPbibPbib
.L70:
	call	cudaDeviceSynchronize@PLT
	leaq	16(%rsp), %rdi
	movl	$1, %edx
	movl	$2400, %esi
	call	cudaMallocManaged@PLT
	movl	$1073741849, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$2, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%rdx, 40(%rsp)
	movl	$1, 48(%rsp)
	movq	%rdi, 28(%rsp)
	movl	$1, 36(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L71
	movq	16(%rsp), %rdi
	orl	$-1, %edx
	movl	$600, %esi
	call	_Z27__device_stub__Z6initToPiiiPiii
.L71:
	call	cudaDeviceSynchronize@PLT
	movq	(%rsp), %rax
	movl	$2, %edi
	xorl	%ebx, %ebx
	leaq	.LC4(%rip), %rsi
	leaq	.LC6(%rip), %r12
	movabsq	$4294967297, %rdx
	movq	%rdx, 8(%rax)
	movq	%rdx, 32(%rax)
	movq	%rdx, 56(%rax)
	movq	%rdx, 84(%rax)
	movl	$1, 40(%rax)
	movl	$1, 64(%rax)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L72:
	incl	%ebx
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$2, %edi
	movl	%ebx, %edx
	call	__printf_chk@PLT
	cmpl	$5, %ebx
	jne	.L72
	xorl	%ebx, %ebx
	leaq	.LC7(%rip), %r13
.L74:
	movl	%ebx, %eax
	movl	$5, %ecx
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L73
	movl	%ebx, %edx
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	sarl	$2, %edx
	incl	%edx
	call	__printf_chk@PLT
.L73:
	movq	(%rsp), %rax
	movq	%r12, %rsi
	movl	$2, %edi
	movl	(%rax,%rbx,4), %edx
	xorl	%eax, %eax
	incq	%rbx
	call	__printf_chk@PLT
	cmpq	$25, %rbx
	jne	.L74
	leaq	.LC8(%rip), %rbx
	movl	$2, %edi
	xorl	%eax, %eax
	movq	%rbx, %rsi
	leaq	.LC10(%rip), %r13
	call	__printf_chk@PLT
	movq	16(%rsp), %rax
	movq	%rbp, %rsi
	movl	$2, %edi
	movl	(%rax), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%rsp), %rax
	movq	%rbp, %rsi
	movl	$2, %edi
	xorl	%ebp, %ebp
	movl	380(%rax), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %eax
	movq	16(%rsp), %rcx
	xorl	%esi, %esi
	salq	$32, %rax
	leaq	52(%rsp), %rdi
	movl	$4, %edx
	movl	$120, %r9d
	movq	%rax, 52(%rsp)
	movl	$5, %r8d
	movabsq	$12884901890, %rax
	movq	%rax, 60(%rsp)
	movl	$4, 68(%rsp)
	call	_Z7permutePiiiS_ii
.L78:
	movl	%ebp, %edx
	leaq	.LC9(%rip), %rsi
	cmpq	$9, %rbp
	jbe	.L97
	movq	%r13, %rsi
.L97:
	imulq	$20, %rbp, %r15
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	call	__printf_chk@PLT
	leaq	.LC11(%rip), %r14
.L77:
	leaq	0(,%r12,4), %rax
	addq	16(%rsp), %rax
	movq	%r14, %rsi
	movl	$2, %edi
	movl	(%rax,%r15), %edx
	incq	%r12
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpq	$5, %r12
	jne	.L77
	movq	%rbx, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%rbp
	call	__printf_chk@PLT
	cmpq	$120, %rbp
	jne	.L78
	call	_Z9starttimev
	movq	8(%rsp), %r8
	xorl	%ebp, %ebp
	movq	(%rsp), %rcx
	movq	16(%rsp), %rdi
	movl	$120, %edx
	movl	$5, %esi
	leaq	.LC12(%rip), %r13
	leaq	.LC13(%rip), %r14
	call	_Z14checkPathLocalPiiiS_Pb
	call	cudaDeviceSynchronize@PLT
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L81:
	movq	8(%rsp), %rax
	cmpb	$0, (%rax,%rbp)
	je	.L79
	imulq	$20, %rbp, %r15
	xorl	%r12d, %r12d
.L80:
	leaq	0(,%r12,4), %rax
	addq	16(%rsp), %rax
	movq	%r14, %rsi
	movl	$2, %edi
	movl	(%rax,%r15), %edx
	incq	%r12
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpq	$5, %r12
	jne	.L80
	movq	%rbx, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L79:
	incq	%rbp
	cmpq	$120, %rbp
	jne	.L81
	movq	%rbx, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	cudaDeviceSynchronize@PLT
	movl	$1073741849, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$2, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%rdx, 40(%rsp)
	movl	$1, 48(%rsp)
	movq	%rdi, 28(%rsp)
	movl	$1, 36(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L82
	movq	8(%rsp), %rdi
	movl	$1, %edx
	movl	$120, %esi
	call	_Z27__device_stub__Z6initToPbibPbib
.L82:
	call	cudaDeviceSynchronize@PLT
	call	cudaDeviceSynchronize@PLT
	call	_Z9starttimev
	movl	$2147483649, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	addq	%rdi, %rdi
	movl	$1, %ecx
	movabsq	$4294967371, %rdx
	movl	$1, %esi
	movq	%rdx, 40(%rsp)
	movl	$1, 48(%rsp)
	movq	%rdi, 28(%rsp)
	movl	$1, 36(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L83
	movq	8(%rsp), %r8
	movq	16(%rsp), %rcx
	movl	$120, %edx
	movl	$5, %esi
	movq	(%rsp), %rdi
	call	_Z38__device_stub__Z12checkPathsTHPiiiS_PbPiiiS_Pb
.L83:
	leaq	.LC14(%rip), %rdi
	xorl	%ebp, %ebp
	call	_Z7endtimePKc
	call	cudaDeviceSynchronize@PLT
	call	cudaDeviceSynchronize@PLT
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC13(%rip), %r13
.L86:
	movq	8(%rsp), %rax
	cmpb	$0, (%rax,%rbp)
	je	.L84
	imulq	$20, %rbp, %r14
	xorl	%r12d, %r12d
.L85:
	leaq	0(,%r12,4), %rax
	addq	16(%rsp), %rax
	movq	%r13, %rsi
	movl	$2, %edi
	movl	(%rax,%r14), %edx
	incq	%r12
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpq	$5, %r12
	jne	.L85
	movq	%rbx, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L84:
	incq	%rbp
	cmpq	$120, %rbp
	jne	.L86
	movq	%rbx, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L87
	call	__stack_chk_fail@PLT
.L87:
	addq	$88, %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
.LFE4176:
	.size	main, .-main
	.section	.rodata.str1.1
.LC15:
	.string	"_Z12checkPathsTHPiiiS_Pb"
.LC16:
	.string	"_Z6initToPbib"
.LC17:
	.string	"_Z6initToPiii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4208:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC15(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z12checkPathsTHPiiiS_Pb(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC16(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z6initToPbib(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC17(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z6initToPiii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	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	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4208:
	.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
	.globl	end
	.bss
	.align 16
	.type	end, @object
	.size	end, 16
end:
	.zero	16
	.globl	start
	.align 16
	.type	start, @object
	.size	start, 16
start:
	.zero	16
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	0
	.long	1083129856
	.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 <stdio.h>
#include <stdbool.h> /*helps with bool data type*/
#include <string.h> /* memset */
#include <unistd.h> /* close */
#include <emmintrin.h>
#include <sys/time.h> /*allows system type*/





struct timeval start, end;
void starttime() {
  gettimeofday( &start, 0 );
}

void endtime(const char* c) {
   gettimeofday( &end, 0 );
   double elapsed = ( end.tv_sec - start.tv_sec ) * 1000.0 + ( end.tv_usec - start.tv_usec ) / 1000.0;
   printf("%s: %f ms\n", c, elapsed); 
}

//initializes matrix values to 0,
//AS OF RIGHT NOW , ONLY USES THREADS!!!
__global__ void initTo(int *matx, int vs, int set){
	int index = threadIdx.x;
  	int stride = blockDim.x;
	for(int i = index ; i < vs; i += stride ){
		matx[i] = set;
	}

}
//initializes truth table to true
////AS OF RIGHT NOW , ONLY USES THREADS!!!
__global__ void initTo(bool *t_table, int vs, bool set){
	int index = threadIdx.x;
  	int stride = blockDim.x;
	for(int i = index ; i < vs; i += stride ){
		t_table[i] = set;
	}

}

__global__ void checkPathsTH(int *matrix, int vertices, int pathsize, int *paths, bool *t_table){
	//int index = threadIdx.x;
  	int stride = blockDim.x;
	int index = blockIdx.x*blockDim.x + threadIdx.x;

	//printf("%i\n",stride);
	//index is the actual index!!!
	//so 0-95
	//stops trash from going out of bounds
/*
	if(index<(pathsize)){
		for(int j = 0;j<vertices;j++){
			printf("%i's own %i called %i ",index,j,paths[(index*vertices)+j]);
			//THIS GETS YOU WHAT YOU NEED paths[(index*vertices)+j]
		}
		//printf("%i, %i, %i\n",index,stride,paths[index]);
	}
*/


	for(int i = index ; i < pathsize; i += stride){

		for(int j = 0;j<vertices;j++){

			if(j==0){
				if(matrix[(paths[(index*vertices)+j] * vertices) + paths[(index*vertices)+j+1]] != 1 &&
					matrix[(paths[(index*vertices)+j+1] * vertices) + paths[(index*vertices)+j]] != 1 )
				{
					t_table[index] = false;
					break;
				}
			}else if(j > 0 && j < vertices-1){
				if( (matrix[(paths[(index*vertices)+j] * vertices) + paths[(index*vertices)+j+1]] != 1 &&
					matrix[(paths[(index*vertices)+j+1] * vertices) + paths[(index*vertices)+j]] != 1 )
					||
				    (matrix[(paths[(index*vertices)+j] * vertices) + paths[(index*vertices)+j-1]] != 1 &&
					matrix[(paths[(index*vertices)+j-1] * vertices) + paths[(index*vertices)+j]] != 1 )
					)
					
				{
					t_table[index] = false;
					break;
				}

			}else if(j== vertices -1){
				if(matrix[(paths[(index*vertices)+j] * vertices) + paths[(index*vertices)+j-1]] != 1 &&
					matrix[(paths[(index*vertices)+j-1] * vertices) + paths[(index*vertices)+j]] != 1 )
				{
					t_table[index] = false;
					break;
				}


			}
			
		}
	}	

	//__syncthreads();
}


void checkPathLocal(int *ptr_path,int vertices,int pathsize, int *matrix, bool *possiblePaths ){
	for(int outcount = 0; outcount < pathsize;outcount++){
        for (int i = 0; i < vertices; i++){

            //the first one only checks the next one, checks if the path is even possible
            if(i == 0){
                if(matrix[(ptr_path[(outcount*vertices)+i] * vertices) + ptr_path[(outcount*vertices)+i+1]] != 1 &&
                   matrix[(ptr_path[(outcount*vertices)+i+1] * vertices) + ptr_path[(outcount*vertices)+i]] != 1)
                {
                    possiblePaths[outcount] = false;
                    break;
                }
            }
            else if(i > 0 && i < vertices - 1){
                if( (matrix[(ptr_path[(outcount*vertices)+i] * vertices) + ptr_path[(outcount*vertices)+i+1]] != 1 &&
                     matrix[(ptr_path[(outcount*vertices)+i+1] * vertices) + ptr_path[(outcount*vertices)+i]] != 1) 
                    ||
                    (matrix[(ptr_path[(outcount*vertices)+i] * vertices) + ptr_path[(outcount*vertices)+i-1]] != 1  &&
                     matrix[(ptr_path[(outcount*vertices)+i-1] * vertices) + ptr_path[(outcount*vertices)+i]] != 1)
                    )
                {
                    possiblePaths[outcount] = false;
                    break;
                }
            }
            else if(i == vertices - 1){
                if( matrix[(ptr_path[(outcount*vertices)+i] * vertices) + ptr_path[(outcount*vertices)+i-1]] != 1  &&
                    matrix[(ptr_path[(outcount*vertices)+i-1] * vertices) + ptr_path[(outcount*vertices)+i]] != 1)
                {
                    possiblePaths[outcount] = false;
                    break;
                } 
            }
        }   
    }
	endtime("NORMAL");
}




//just makes unweighted edges in a 1D array
void makeEdge(int to, int from, int *num, int vertices) {
        *(num + (((to) * (vertices)) + (from))) = 1;
	*(num + (((from) * (vertices)) + (to))) = 1;
	//matrix[((to) * (vertices)) + (from)] = 1;
        //matrix[((from) * (vertices)) + (to)] = 1;
        //matrix[from][to] = 1;
}

//swaps values, assists permute
    int swap(int a[], int i, int j)
    {
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;
        return a[j];
    }


//places in array
void getArray(int ha[] , int *ptr_path , int vertices, int pathsize){
        //finds the first path that is empty and places the array there!!!
        for(int i = 0; i < pathsize ;i++){
            //finds the first one that wasn't touched
            if( *(ptr_path + (i*vertices))  == -1){
                //maybe there could be a way to binary search this to make it faster!
                //i dunno :3
                //paths[i] = ha;
                for(int j =0; j < vertices ; j++){
                    //write to the original array
                    *(ptr_path + (i*vertices)+j) = ha[j];
                }
                //stops when found
                return;
            }
        }
}


void permute(int str[] , int l, int r, int *ptr_path, int vertices, int pathsize){
        //printf("Value of paths = %p\n",ptr_path);
        if (l == r){
            //array created to save each combination
            int raw [vertices]; 
            //prints the combinations and save them to the array.
            for(int j=0; j < vertices ;j++){
                //printf("%i", str[j]);
                raw[j] = str[j];
            }
           getArray(raw,ptr_path,vertices,pathsize);
           //printf("+++\n");
            //count = 0;
        }
        else
        {
            for (int i = l; i <= r; i++)
            {
                str[i] = swap(str,l,i);
                //permute(str, l+1, r);
                permute(str, l+1, r,ptr_path, vertices, pathsize);
                str[i] = swap(str,l,i);    
            }
        }
        
    }





int main(void) {

	const int vertices = 5;

	int *matrix;
	//int matrix[vertices*vertices] ;
 	//memset(matrix, 0, sizeof matrix);
	
	//1D MATRIX ARRAY INNITIALLIZED IN 
	//ALLOCATES
	hipMallocManaged(&matrix, (vertices*vertices)*sizeof(int));
	//initiates to 0
	initTo<<<1,100>>>(matrix,vertices*vertices,0);
	hipDeviceSynchronize();


	int pathsize = 1;
    	for (int i = 1; i < vertices + 1; i++)
    	{
        	pathsize = pathsize * i;
    	}
    	printf("%i\n",pathsize);

	bool *possiblePaths;
	hipMallocManaged(&possiblePaths, (pathsize)*sizeof(bool));

	//bool possiblePaths[pathsize];
	//initialize to true
    	//memset(possiblePaths, true, sizeof possiblePaths);
	initTo<<<1,100>>>(possiblePaths,pathsize,true);
	hipDeviceSynchronize();
	
	int *allPaths;
	hipMallocManaged(&allPaths, (pathsize*vertices)*sizeof(int));
	initTo<<<1,100>>>(allPaths,pathsize*vertices,-1);
	hipDeviceSynchronize();



//creating the graph 
	// ---
	//| / |
	// ---

	
	makeEdge(0,2,matrix,vertices);
	makeEdge(0,3,matrix,vertices);
   	makeEdge(1,4,matrix,vertices);
    	makeEdge(1,3,matrix,vertices);
	makeEdge(2,4,matrix,vertices);

	printf("The adjacency matrix for the given graph is: ");
   	 printf("\n  ");
    	for (int i = 0; i < vertices; i++)
       		printf("%i ",i+1);
    
    	for (int j = 0; j < vertices*vertices; j++) {
        	if(j % vertices == 0)
                	printf("\n%i ",(j/4)+1);
            printf("%i ", matrix[j]);
    	}
        printf("\n");

printf("%i\n",allPaths[0]);
printf("%i\n",allPaths[95]);	

int arr[vertices];
	for(int pattern = 0 ; pattern < vertices; pattern++){
        	arr[pattern] = pattern;
}

permute(arr,0,vertices - 1,allPaths,vertices,pathsize);

//printf("%i\n",allPaths[0]);
//printf("%i\n",allPaths[95]);
for (int i = 0; i < pathsize; i++)
        {
            if(i<10)
            printf(" %i |",i);
            else
                printf("%i |",i);

            for (int j = 0; j < vertices; j++)
            {
                printf("%d ", allPaths[(i*vertices)+j]);
            }
            //ptr_path++;
            printf("\n");
		
        }
/*
printf("%i\n",allPaths[92]);
printf("%i\n",allPaths[93]);
printf("%i\n",allPaths[94]);
printf("%i\n",allPaths[95]);
*/


starttime();
checkPathLocal(allPaths,vertices,pathsize,matrix,possiblePaths);
hipDeviceSynchronize();

printf("POSSIBLE PATHS\n");
for(int wow = 0 ; wow<pathsize;wow++){
        //printf("");
        if(possiblePaths[wow] == true){
            for(int innerwow = 0 ; innerwow < vertices ; innerwow++){
                printf("%i", allPaths[(wow*vertices)+innerwow]);
            }
            printf("\n");
        }
        //printf("%d ",possiblePaths[wow]);
    }
printf("\n");

hipDeviceSynchronize();
initTo<<<1,100>>>(possiblePaths,pathsize,true);
hipDeviceSynchronize();

hipDeviceSynchronize();
starttime();
checkPathsTH<<<2,75>>>(matrix,vertices,pathsize,allPaths,possiblePaths);
endtime("GPU THREADS");
hipDeviceSynchronize();

hipDeviceSynchronize();
printf("POSSIBLE PATHS\n");
for(int wow = 0 ; wow<pathsize;wow++){
        //printf("");
        if(possiblePaths[wow] == true){
            for(int innerwow = 0 ; innerwow < vertices ; innerwow++){
                printf("%i", allPaths[(wow*vertices)+innerwow]);
            }
            printf("\n");
        }
        //printf("%d ",possiblePaths[wow]);
    }
printf("\n");




	 // Free memory
  	hipFree(matrix);
	hipFree(possiblePaths);
	hipFree(allPaths);
	//free(matrix);

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

                                        # End of file scope inline assembly
	.globl	_Z9starttimev                   # -- Begin function _Z9starttimev
	.type	_Z9starttimev,@function
_Z9starttimev:                          # @_Z9starttimev
	.cfi_startproc
# %bb.0:
	movl	$start, %edi
	xorl	%esi, %esi
	jmp	gettimeofday                    # TAILCALL
.Lfunc_end0:
	.size	_Z9starttimev, .Lfunc_end0-_Z9starttimev
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z7endtimePKc
.LCPI1_0:
	.quad	0x408f400000000000              # double 1000
	.text
	.globl	_Z7endtimePKc
	.type	_Z7endtimePKc,@function
_Z7endtimePKc:                          # @_Z7endtimePKc
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movl	$end, %edi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	end(%rip), %rax
	subq	start(%rip), %rax
	cvtsi2sd	%rax, %xmm1
	movsd	.LCPI1_0(%rip), %xmm2           # xmm2 = mem[0],zero
	mulsd	%xmm2, %xmm1
	movq	end+8(%rip), %rax
	subq	start+8(%rip), %rax
	cvtsi2sd	%rax, %xmm0
	divsd	%xmm2, %xmm0
	addsd	%xmm1, %xmm0
	movl	$.L.str, %edi
	movq	%rbx, %rsi
	movb	$1, %al
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	printf                          # TAILCALL
.Lfunc_end1:
	.size	_Z7endtimePKc, .Lfunc_end1-_Z7endtimePKc
	.cfi_endproc
                                        # -- End function
	.globl	_Z21__device_stub__initToPiii   # -- Begin function _Z21__device_stub__initToPiii
	.type	_Z21__device_stub__initToPiii,@function
_Z21__device_stub__initToPiii:          # @_Z21__device_stub__initToPiii
	.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	$96, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	4(%rsp), %rcx
	movl	%esi, (%rcx)
	movq	%rsp, %rsi
	movl	%edx, (%rsi)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%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	$_Z6initToPiii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$112, %rsp
	.cfi_adjust_cfa_offset -112
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z21__device_stub__initToPiii, .Lfunc_end2-_Z21__device_stub__initToPiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z21__device_stub__initToPbib   # -- Begin function _Z21__device_stub__initToPbib
	.type	_Z21__device_stub__initToPbib,@function
_Z21__device_stub__initToPbib:          # @_Z21__device_stub__initToPbib
	.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	$96, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	4(%rsp), %rcx
	movl	%esi, (%rcx)
	leaq	3(%rsp), %rsi
	movb	%dl, (%rsi)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%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	$_Z6initToPbib, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$112, %rsp
	.cfi_adjust_cfa_offset -112
	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__initToPbib, .Lfunc_end3-_Z21__device_stub__initToPbib
	.cfi_endproc
                                        # -- End function
	.globl	_Z27__device_stub__checkPathsTHPiiiS_Pb # -- Begin function _Z27__device_stub__checkPathsTHPiiiS_Pb
	.type	_Z27__device_stub__checkPathsTHPiiiS_Pb,@function
_Z27__device_stub__checkPathsTHPiiiS_Pb: # @_Z27__device_stub__checkPathsTHPiiiS_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	$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	4(%rsp), %rdi
	movl	%esi, (%rdi)
	movq	%rsp, %rsi
	movl	%edx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%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	16(%rsp), %r12
	leaq	8(%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	$_Z12checkPathsTHPiiiS_Pb, %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_end4:
	.size	_Z27__device_stub__checkPathsTHPiiiS_Pb, .Lfunc_end4-_Z27__device_stub__checkPathsTHPiiiS_Pb
	.cfi_endproc
                                        # -- End function
	.globl	_Z14checkPathLocalPiiiS_Pb      # -- Begin function _Z14checkPathLocalPiiiS_Pb
	.type	_Z14checkPathLocalPiiiS_Pb,@function
_Z14checkPathLocalPiiiS_Pb:             # @_Z14checkPathLocalPiiiS_Pb
	.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
	movq	%r8, -32(%rsp)                  # 8-byte Spill
                                        # kill: def $esi killed $esi def $rsi
	testl	%edx, %edx
	jle	.LBB5_19
# %bb.1:                                # %.preheader.lr.ph
	leal	-1(%rsi), %eax
	movslq	%eax, %r9
	movslq	%esi, %r8
	movl	%edx, %edx
	movq	%rdx, -8(%rsp)                  # 8-byte Spill
	movl	%r8d, %r11d
	leaq	(%rdi,%rax,4), %rbx
	leaq	4(%rdi), %r14
	movq	%r8, -24(%rsp)                  # 8-byte Spill
	leaq	(,%r8,4), %rdx
	movq	%rdx, -16(%rsp)                 # 8-byte Spill
	xorl	%r12d, %r12d
.LBB5_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_4 Depth 2
	testl	%esi, %esi
	jle	.LBB5_18
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB5_2 Depth=1
	movq	%r12, %r13
	imulq	-24(%rsp), %r13                 # 8-byte Folded Reload
	xorl	%ebp, %ebp
.LBB5_4:                                #   Parent Loop BB5_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	testq	%rbp, %rbp
	je	.LBB5_5
# %bb.6:                                #   in Loop: Header=BB5_4 Depth=2
	cmpq	%r9, %rbp
	jge	.LBB5_11
# %bb.7:                                #   in Loop: Header=BB5_4 Depth=2
	movl	-4(%r14,%rbp,4), %r10d
	movl	(%r14,%rbp,4), %edx
	movl	%r10d, %r8d
	imull	%esi, %r8d
	leal	(%r8,%rdx), %r15d
	movslq	%r15d, %r15
	cmpl	$1, (%rcx,%r15,4)
	je	.LBB5_9
# %bb.8:                                #   in Loop: Header=BB5_4 Depth=2
	imull	%esi, %edx
	addl	%r10d, %edx
	movslq	%edx, %rdx
	cmpl	$1, (%rcx,%rdx,4)
	jne	.LBB5_17
.LBB5_9:                                #   in Loop: Header=BB5_4 Depth=2
	movl	-8(%r14,%rbp,4), %edx
	addl	%edx, %r8d
	movslq	%r8d, %r8
	cmpl	$1, (%rcx,%r8,4)
	je	.LBB5_16
# %bb.10:                               #   in Loop: Header=BB5_4 Depth=2
	imull	%esi, %edx
	addl	%r10d, %edx
	movslq	%edx, %rdx
	jmp	.LBB5_15
.LBB5_5:                                #   in Loop: Header=BB5_4 Depth=2
	movl	(%rdi,%r13,4), %edx
	movl	4(%rdi,%r13,4), %r8d
	jmp	.LBB5_13
.LBB5_11:                               #   in Loop: Header=BB5_4 Depth=2
	cmpq	%rbp, %rax
	jne	.LBB5_16
# %bb.12:                               #   in Loop: Header=BB5_4 Depth=2
	movl	-4(%rbx,%r13,4), %r8d
	movl	(%rbx,%r13,4), %edx
.LBB5_13:                               #   in Loop: Header=BB5_4 Depth=2
	movl	%edx, %r10d
	imull	%esi, %r10d
	addl	%r8d, %r10d
	movslq	%r10d, %r10
	cmpl	$1, (%rcx,%r10,4)
	je	.LBB5_16
# %bb.14:                               #   in Loop: Header=BB5_4 Depth=2
	imull	%esi, %r8d
	addl	%edx, %r8d
	movslq	%r8d, %rdx
.LBB5_15:                               #   in Loop: Header=BB5_4 Depth=2
	cmpl	$1, (%rcx,%rdx,4)
	jne	.LBB5_17
.LBB5_16:                               #   in Loop: Header=BB5_4 Depth=2
	incq	%rbp
	cmpq	%rbp, %r11
	jne	.LBB5_4
	jmp	.LBB5_18
.LBB5_17:                               # %.loopexit.sink.split
                                        #   in Loop: Header=BB5_2 Depth=1
	movq	-32(%rsp), %rdx                 # 8-byte Reload
	movb	$0, (%rdx,%r12)
.LBB5_18:                               # %.loopexit
                                        #   in Loop: Header=BB5_2 Depth=1
	incq	%r12
	addq	-16(%rsp), %r14                 # 8-byte Folded Reload
	cmpq	-8(%rsp), %r12                  # 8-byte Folded Reload
	jne	.LBB5_2
.LBB5_19:                               # %._crit_edge
	movl	$.L.str.1, %edi
	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	_Z7endtimePKc                   # TAILCALL
.Lfunc_end5:
	.size	_Z14checkPathLocalPiiiS_Pb, .Lfunc_end5-_Z14checkPathLocalPiiiS_Pb
	.cfi_endproc
                                        # -- End function
	.globl	_Z8makeEdgeiiPii                # -- Begin function _Z8makeEdgeiiPii
	.type	_Z8makeEdgeiiPii,@function
_Z8makeEdgeiiPii:                       # @_Z8makeEdgeiiPii
	.cfi_startproc
# %bb.0:
	movl	%ecx, %eax
	imull	%edi, %eax
	addl	%esi, %eax
	cltq
	movl	$1, %r8d
	movl	%r8d, (%rdx,%rax,4)
	imull	%esi, %ecx
	addl	%edi, %ecx
	movslq	%ecx, %rax
	movl	%r8d, (%rdx,%rax,4)
	retq
.Lfunc_end6:
	.size	_Z8makeEdgeiiPii, .Lfunc_end6-_Z8makeEdgeiiPii
	.cfi_endproc
                                        # -- End function
	.globl	_Z4swapPiii                     # -- Begin function _Z4swapPiii
	.type	_Z4swapPiii,@function
_Z4swapPiii:                            # @_Z4swapPiii
	.cfi_startproc
# %bb.0:
	movslq	%esi, %rcx
	movl	(%rdi,%rcx,4), %eax
	movslq	%edx, %rdx
	movl	(%rdi,%rdx,4), %esi
	movl	%esi, (%rdi,%rcx,4)
	movl	%eax, (%rdi,%rdx,4)
	retq
.Lfunc_end7:
	.size	_Z4swapPiii, .Lfunc_end7-_Z4swapPiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z8getArrayPiS_ii               # -- Begin function _Z8getArrayPiS_ii
	.type	_Z8getArrayPiS_ii,@function
_Z8getArrayPiS_ii:                      # @_Z8getArrayPiS_ii
	.cfi_startproc
# %bb.0:
	testl	%ecx, %ecx
	jle	.LBB8_7
# %bb.1:                                # %.lr.ph.preheader
	movslq	%edx, %rax
	movl	%ecx, %ecx
	shlq	$2, %rax
.LBB8_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	cmpl	$-1, (%rsi)
	je	.LBB8_4
# %bb.2:                                #   in Loop: Header=BB8_3 Depth=1
	addq	%rax, %rsi
	decq	%rcx
	jne	.LBB8_3
	jmp	.LBB8_7
.LBB8_4:                                # %.preheader
	testl	%edx, %edx
	jle	.LBB8_7
# %bb.5:                                # %.lr.ph19.preheader
	movl	%edx, %eax
	xorl	%ecx, %ecx
.LBB8_6:                                # %.lr.ph19
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rdi,%rcx,4), %edx
	movl	%edx, (%rsi)
	incq	%rcx
	addq	$4, %rsi
	cmpq	%rcx, %rax
	jne	.LBB8_6
.LBB8_7:                                # %.loopexit
	retq
.Lfunc_end8:
	.size	_Z8getArrayPiS_ii, .Lfunc_end8-_Z8getArrayPiS_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z7permutePiiiS_ii              # -- Begin function _Z7permutePiiiS_ii
	.type	_Z7permutePiiiS_ii,@function
_Z7permutePiiiS_ii:                     # @_Z7permutePiiiS_ii
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r8d, %r15d
	movq	%rdi, %r10
	cmpl	%edx, %esi
	jne	.LBB9_1
# %bb.4:
	movq	%rsp, %rbx
	movl	%r15d, %r14d
	movq	%rsp, %r13
	leaq	15(,%r14,4), %rax
	andq	$-16, %rax
	subq	%rax, %r13
	movq	%r13, %rsp
	testl	%r15d, %r15d
	jle	.LBB9_6
# %bb.5:                                # %.lr.ph41.preheader
	leaq	(,%r14,4), %rdx
	movq	%r13, %rdi
	movq	%r10, %rsi
	movq	%rbx, -48(%rbp)                 # 8-byte Spill
	movl	%r9d, %ebx
	movq	%rcx, %r12
	callq	memcpy@PLT
	movq	%r12, %rcx
	movl	%ebx, %r9d
	movq	-48(%rbp), %rbx                 # 8-byte Reload
.LBB9_6:                                # %._crit_edge
	testl	%r9d, %r9d
	jle	.LBB9_12
# %bb.7:                                # %.lr.ph.preheader.i
	movslq	%r15d, %rax
	movl	%r9d, %edx
	shlq	$2, %rax
.LBB9_9:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	cmpl	$-1, (%rcx)
	je	.LBB9_10
# %bb.8:                                #   in Loop: Header=BB9_9 Depth=1
	addq	%rax, %rcx
	decq	%rdx
	jne	.LBB9_9
	jmp	.LBB9_12
.LBB9_1:                                # %.preheader
	jg	.LBB9_13
# %bb.2:                                # %.lr.ph
	movl	%r15d, %r12d
	movslq	%esi, %rax
	movq	%rax, -80(%rbp)                 # 8-byte Spill
	leaq	(%r10,%rax,4), %rax
	movq	%rax, -72(%rbp)                 # 8-byte Spill
	movl	%edx, %eax
	subl	%esi, %eax
	incl	%esi
	incl	%eax
	movq	%rax, -64(%rbp)                 # 8-byte Spill
	xorl	%r14d, %r14d
	movq	%r10, -48(%rbp)                 # 8-byte Spill
	movq	%rcx, -88(%rbp)                 # 8-byte Spill
	movl	%edx, -56(%rbp)                 # 4-byte Spill
	movl	%esi, -52(%rbp)                 # 4-byte Spill
	movq	-80(%rbp), %r13                 # 8-byte Reload
	movq	-72(%rbp), %r15                 # 8-byte Reload
.LBB9_3:                                # =>This Inner Loop Header: Depth=1
	movl	(%r10,%r13,4), %eax
	movl	(%r15,%r14,4), %edi
	movl	%edi, (%r10,%r13,4)
	movl	%eax, (%r15,%r14,4)
	movq	%r10, %rdi
	movl	%r12d, %r8d
	movl	%r9d, %ebx
	callq	_Z7permutePiiiS_ii
	movl	-52(%rbp), %esi                 # 4-byte Reload
	movl	-56(%rbp), %edx                 # 4-byte Reload
	movq	-48(%rbp), %r10                 # 8-byte Reload
	movq	-88(%rbp), %rcx                 # 8-byte Reload
	movl	%ebx, %r9d
	movl	(%r10,%r13,4), %eax
	movl	(%r15,%r14,4), %edi
	movl	%edi, (%r10,%r13,4)
	movl	%eax, (%r15,%r14,4)
	incq	%r14
	cmpl	%r14d, -64(%rbp)                # 4-byte Folded Reload
	jne	.LBB9_3
	jmp	.LBB9_13
.LBB9_10:                               # %.preheader.i
	testl	%r15d, %r15d
	jle	.LBB9_12
# %bb.11:                               # %.lr.ph19.i.preheader
	shlq	$2, %r14
	movq	%rcx, %rdi
	movq	%r13, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB9_12:                               # %_Z8getArrayPiS_ii.exit
	movq	%rbx, %rsp
.LBB9_13:                               # %.loopexit
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.Lfunc_end9:
	.size	_Z7permutePiiiS_ii, .Lfunc_end9-_Z7permutePiiiS_ii
	.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	$56, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movabsq	$4294967297, %rbx               # imm = 0x100000001
	leaq	24(%rsp), %rdi
	movl	$100, %esi
	movl	$1, %edx
	callq	hipMallocManaged
	leaq	99(%rbx), %r14
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB10_2
# %bb.1:
	movq	24(%rsp), %rdi
	movl	$25, %esi
	xorl	%edx, %edx
	callq	_Z21__device_stub__initToPiii
.LBB10_2:
	callq	hipDeviceSynchronize
	movl	$.L.str.2, %edi
	movl	$120, %esi
	xorl	%eax, %eax
	callq	printf
	leaq	16(%rsp), %rdi
	movl	$120, %esi
	movl	$1, %edx
	callq	hipMallocManaged
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB10_4
# %bb.3:
	movq	16(%rsp), %rdi
	movl	$120, %esi
	movl	$1, %edx
	callq	_Z21__device_stub__initToPbib
.LBB10_4:
	callq	hipDeviceSynchronize
	leaq	8(%rsp), %rdi
	movl	$1, %ebp
	movl	$2400, %esi                     # imm = 0x960
	movl	$1, %edx
	callq	hipMallocManaged
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB10_6
# %bb.5:
	movq	8(%rsp), %rdi
	movl	$600, %esi                      # imm = 0x258
	movl	$-1, %edx
	callq	_Z21__device_stub__initToPiii
.LBB10_6:
	callq	hipDeviceSynchronize
	movq	24(%rsp), %rax
	movq	%rbx, 8(%rax)
	movl	%ebp, 40(%rax)
	movq	%rbx, 84(%rax)
	movq	%rbx, 32(%rax)
	movl	%ebp, 64(%rax)
	movq	%rbx, 56(%rax)
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.4, %edi
	xorl	%eax, %eax
	callq	printf
.LBB10_7:                               # =>This Inner Loop Header: Depth=1
	movl	$.L.str.5, %edi
	movl	%ebp, %esi
	xorl	%eax, %eax
	callq	printf
	incl	%ebp
	cmpl	$6, %ebp
	jne	.LBB10_7
# %bb.8:                                # %.preheader120.preheader
	xorl	%r15d, %r15d
	xorl	%r12d, %r12d
.LBB10_9:                               # %.preheader120
                                        # =>This Inner Loop Header: Depth=1
	movzbl	%r12b, %eax
	imull	$205, %eax, %eax
	shrl	$10, %eax
	leal	(%rax,%rax,4), %eax
	addb	%r15b, %al
	jne	.LBB10_11
# %bb.10:                               #   in Loop: Header=BB10_9 Depth=1
	movl	%r12d, %esi
	shrl	$2, %esi
	incl	%esi
	movl	$.L.str.6, %edi
	xorl	%eax, %eax
	callq	printf
.LBB10_11:                              #   in Loop: Header=BB10_9 Depth=1
	movq	24(%rsp), %rax
	movl	(%rax,%r12,4), %esi
	movl	$.L.str.5, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r12
	decb	%r15b
	cmpq	$25, %r12
	jne	.LBB10_9
# %bb.12:
	movl	$10, %edi
	callq	putchar@PLT
	movq	8(%rsp), %rax
	movl	(%rax), %esi
	xorl	%r15d, %r15d
	movl	$.L.str.2, %edi
	xorl	%eax, %eax
	callq	printf
	movq	8(%rsp), %rax
	movl	380(%rax), %esi
	movl	$.L.str.2, %edi
	xorl	%eax, %eax
	callq	printf
.LBB10_13:                              # =>This Inner Loop Header: Depth=1
	movl	%r15d, 32(%rsp,%r15,4)
	incq	%r15
	cmpq	$5, %r15
	jne	.LBB10_13
# %bb.14:                               # %.lr.ph.preheader
	movq	8(%rsp), %rcx
	leaq	32(%rsp), %rdi
	xorl	%esi, %esi
	movl	$4, %edx
	movl	$5, %r8d
	movl	$120, %r9d
	callq	_Z7permutePiiiS_ii
	movl	$.L.str.8, %r12d
	xorl	%r13d, %r13d
	xorl	%r15d, %r15d
.LBB10_15:                              # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB10_16 Depth 2
	cmpq	$10, %r15
	movl	$.L.str.9, %edi
	cmovbq	%r12, %rdi
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	printf
	xorl	%ebp, %ebp
.LBB10_16:                              #   Parent Loop BB10_15 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	8(%rsp), %rax
	addq	%r13, %rax
	movl	(%rax,%rbp,4), %esi
	movl	$.L.str.10, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%rbp
	cmpq	$5, %rbp
	jne	.LBB10_16
# %bb.17:                               #   in Loop: Header=BB10_15 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r15
	addq	$20, %r13
	cmpq	$120, %r15
	jne	.LBB10_15
# %bb.18:                               # %.lr.ph131.preheader
	movl	$start, %edi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rcx
	movq	16(%rsp), %r8
	movl	$5, %esi
	movl	$120, %edx
	callq	_Z14checkPathLocalPiiiS_Pb
	callq	hipDeviceSynchronize
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	xorl	%r15d, %r15d
	xorl	%r12d, %r12d
.LBB10_19:                              # %.lr.ph131
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB10_21 Depth 2
	movq	16(%rsp), %rax
	cmpb	$0, (%rax,%r12)
	je	.LBB10_23
# %bb.20:                               # %.preheader119
                                        #   in Loop: Header=BB10_19 Depth=1
	xorl	%r13d, %r13d
.LBB10_21:                              #   Parent Loop BB10_19 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	8(%rsp), %rax
	addq	%r15, %rax
	movl	(%rax,%r13,4), %esi
	movl	$.L.str.12, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r13
	cmpq	$5, %r13
	jne	.LBB10_21
# %bb.22:                               #   in Loop: Header=BB10_19 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
.LBB10_23:                              #   in Loop: Header=BB10_19 Depth=1
	incq	%r12
	addq	$20, %r15
	cmpq	$120, %r12
	jne	.LBB10_19
# %bb.24:                               # %._crit_edge132
	movl	$10, %edi
	callq	putchar@PLT
	callq	hipDeviceSynchronize
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB10_26
# %bb.25:
	movq	16(%rsp), %rdi
	movl	$120, %esi
	movl	$1, %edx
	callq	_Z21__device_stub__initToPbib
.LBB10_26:
	callq	hipDeviceSynchronize
	callq	hipDeviceSynchronize
	movl	$start, %edi
	xorl	%esi, %esi
	callq	gettimeofday
	leaq	1(%rbx), %rdi
	addq	$74, %rbx
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB10_28
# %bb.27:
	movq	24(%rsp), %rdi
	movq	8(%rsp), %rcx
	movq	16(%rsp), %r8
	movl	$5, %esi
	movl	$120, %edx
	callq	_Z27__device_stub__checkPathsTHPiiiS_Pb
.LBB10_28:                              # %.lr.ph136.preheader
	movl	$.L.str.13, %edi
	callq	_Z7endtimePKc
	callq	hipDeviceSynchronize
	callq	hipDeviceSynchronize
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	xorl	%ebx, %ebx
	xorl	%r14d, %r14d
.LBB10_29:                              # %.lr.ph136
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB10_31 Depth 2
	movq	16(%rsp), %rax
	cmpb	$0, (%rax,%r14)
	je	.LBB10_33
# %bb.30:                               # %.preheader
                                        #   in Loop: Header=BB10_29 Depth=1
	xorl	%r15d, %r15d
.LBB10_31:                              #   Parent Loop BB10_29 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	8(%rsp), %rax
	addq	%rbx, %rax
	movl	(%rax,%r15,4), %esi
	movl	$.L.str.12, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r15
	cmpq	$5, %r15
	jne	.LBB10_31
# %bb.32:                               #   in Loop: Header=BB10_29 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
.LBB10_33:                              #   in Loop: Header=BB10_29 Depth=1
	incq	%r14
	addq	$20, %rbx
	cmpq	$120, %r14
	jne	.LBB10_29
# %bb.34:                               # %._crit_edge137
	movl	$10, %edi
	callq	putchar@PLT
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	addq	$56, %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_end10:
	.size	main, .Lfunc_end10-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:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB11_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB11_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z6initToPiii, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z6initToPbib, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z12checkPathsTHPiiiS_Pb, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end11:
	.size	__hip_module_ctor, .Lfunc_end11-__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	.LBB12_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
.LBB12_2:
	retq
.Lfunc_end12:
	.size	__hip_module_dtor, .Lfunc_end12-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	start,@object                   # @start
	.bss
	.globl	start
	.p2align	3, 0x0
start:
	.zero	16
	.size	start, 16

	.type	end,@object                     # @end
	.globl	end
	.p2align	3, 0x0
end:
	.zero	16
	.size	end, 16

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%s: %f ms\n"
	.size	.L.str, 11

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

	.type	_Z6initToPbib,@object           # @_Z6initToPbib
	.globl	_Z6initToPbib
	.p2align	3, 0x0
_Z6initToPbib:
	.quad	_Z21__device_stub__initToPbib
	.size	_Z6initToPbib, 8

	.type	_Z12checkPathsTHPiiiS_Pb,@object # @_Z12checkPathsTHPiiiS_Pb
	.globl	_Z12checkPathsTHPiiiS_Pb
	.p2align	3, 0x0
_Z12checkPathsTHPiiiS_Pb:
	.quad	_Z27__device_stub__checkPathsTHPiiiS_Pb
	.size	_Z12checkPathsTHPiiiS_Pb, 8

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"%i\n"
	.size	.L.str.2, 4

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"The adjacency matrix for the given graph is: "
	.size	.L.str.3, 46

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

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"%i "
	.size	.L.str.5, 4

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"\n%i "
	.size	.L.str.6, 5

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	" %i |"
	.size	.L.str.8, 6

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"%i |"
	.size	.L.str.9, 5

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

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"%i"
	.size	.L.str.12, 3

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"GPU THREADS"
	.size	.L.str.13, 12

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

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z6initToPbib"
	.size	.L__unnamed_2, 14

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z12checkPathsTHPiiiS_Pb"
	.size	.L__unnamed_3, 25

	.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.1,@object                 # @str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr.1:
	.asciz	"POSSIBLE PATHS"
	.size	.Lstr.1, 15

	.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__initToPiii
	.addrsig_sym _Z21__device_stub__initToPbib
	.addrsig_sym _Z27__device_stub__checkPathsTHPiiiS_Pb
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym start
	.addrsig_sym end
	.addrsig_sym _Z6initToPiii
	.addrsig_sym _Z6initToPbib
	.addrsig_sym _Z12checkPathsTHPiiiS_Pb
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z6initToPiii           ; -- Begin function _Z6initToPiii
	.globl	_Z6initToPiii
	.p2align	8
	.type	_Z6initToPiii,@function
_Z6initToPiii:                          ; @_Z6initToPiii
; %bb.0:
	s_load_b64 s[2:3], s[0:1], 0x8
	s_mov_b32 s4, exec_lo
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_i32_e64 s2, v0
	s_cbranch_execz .LBB0_3
; %bb.1:                                ; %.lr.ph.preheader
	s_clause 0x1
	s_load_b64 s[4:5], s[0:1], 0x0
	s_load_b32 s0, s[0:1], 0x1c
	v_lshlrev_b32_e32 v1, 2, v0
	v_mov_b32_e32 v3, s3
	s_mov_b32 s3, 0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v1, s1, s4, v1
	v_add_co_ci_u32_e64 v2, null, s5, 0, s1
	s_and_b32 s1, s0, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1)
	s_lshl_b32 s4, s1, 2
.LBB0_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	v_add_nc_u32_e32 v0, s1, v0
	global_store_b32 v[1:2], v3, off
	v_add_co_u32 v1, s0, v1, s4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_add_co_ci_u32_e64 v2, s0, 0, v2, s0
	v_cmp_le_i32_e32 vcc_lo, s2, v0
	s_or_b32 s3, vcc_lo, s3
	s_and_not1_b32 exec_lo, exec_lo, s3
	s_cbranch_execnz .LBB0_2
.LBB0_3:                                ; %Flow17
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6initToPiii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.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 4
		.amdhsa_next_free_sgpr 6
		.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	_Z6initToPiii, .Lfunc_end0-_Z6initToPiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 160
; NumSgprs: 8
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 8
; NumVGPRsForWavesPerEU: 4
; 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
	.protected	_Z6initToPbib           ; -- Begin function _Z6initToPbib
	.globl	_Z6initToPbib
	.p2align	8
	.type	_Z6initToPbib,@function
_Z6initToPbib:                          ; @_Z6initToPbib
; %bb.0:
	s_load_b64 s[2:3], s[0:1], 0x8
	s_mov_b32 s4, exec_lo
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_i32_e64 s2, v0
	s_cbranch_execz .LBB1_3
; %bb.1:                                ; %.lr.ph.preheader
	s_clause 0x1
	s_load_b32 s6, s[0:1], 0x1c
	s_load_b64 s[4:5], s[0:1], 0x0
	v_and_b32_e64 v1, s3, 1
	v_mov_b32_e32 v2, 0
	s_mov_b32 s3, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s1, s6, 0xffff
.LBB1_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	v_add_co_u32 v3, vcc_lo, s4, v0
	v_add_co_u32 v0, s0, v0, s1
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v2, vcc_lo
	v_add_co_ci_u32_e64 v2, vcc_lo, 0, v2, s0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_cmp_le_i32_e32 vcc_lo, s2, v0
	global_store_b8 v[3:4], v1, off
	s_or_b32 s3, vcc_lo, s3
	s_and_not1_b32 exec_lo, exec_lo, s3
	s_cbranch_execnz .LBB1_2
.LBB1_3:                                ; %Flow13
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6initToPbib
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.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 5
		.amdhsa_next_free_sgpr 7
		.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_end1:
	.size	_Z6initToPbib, .Lfunc_end1-_Z6initToPbib
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 144
; NumSgprs: 9
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 1
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 9
; NumVGPRsForWavesPerEU: 5
; 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
	.protected	_Z12checkPathsTHPiiiS_Pb ; -- Begin function _Z12checkPathsTHPiiiS_Pb
	.globl	_Z12checkPathsTHPiiiS_Pb
	.p2align	8
	.type	_Z12checkPathsTHPiiiS_Pb,@function
_Z12checkPathsTHPiiiS_Pb:               ; @_Z12checkPathsTHPiiiS_Pb
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x2c
	s_load_b64 s[2:3], s[0:1], 0x8
	s_mov_b32 s5, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB2_33
; %bb.1:                                ; %.preheader.lr.ph
	s_load_b128 s[8:11], s[0:1], 0x10
	v_mul_lo_u32 v2, v1, s2
	s_load_b64 s[0:1], s[0:1], 0x0
	s_cmp_gt_i32 s2, 0
	v_ashrrev_i32_e32 v0, 31, v1
	s_mov_b32 s6, s2
	s_cselect_b32 s5, -1, 0
	s_ashr_i32 s7, s2, 31
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	s_lshl_b64 s[6:7], s[6:7], 2
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, v2, s8
	v_add_co_ci_u32_e32 v3, vcc_lo, s9, v3, vcc_lo
	v_add_co_u32 v4, vcc_lo, s10, v1
	v_add_co_ci_u32_e32 v5, vcc_lo, s11, v0, vcc_lo
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v6, vcc_lo, v2, s6
	v_add_co_ci_u32_e32 v7, vcc_lo, s7, v3, vcc_lo
	v_add_co_u32 v8, vcc_lo, v2, 4
	v_add_co_ci_u32_e32 v9, vcc_lo, 0, v3, vcc_lo
	v_mov_b32_e32 v0, 0
	s_mov_b32 s6, 0
	s_add_i32 s7, s2, -1
.LBB2_2:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB2_4 Depth 2
	s_and_not1_b32 vcc_lo, exec_lo, s5
	s_cbranch_vccnz .LBB2_32
; %bb.3:                                ; %.lr.ph.preheader
                                        ;   in Loop: Header=BB2_2 Depth=1
	v_dual_mov_b32 v11, v9 :: v_dual_mov_b32 v10, v8
	s_mov_b32 s8, 0
	s_mov_b32 s10, 0
                                        ; implicit-def: $sgpr9
                                        ; implicit-def: $sgpr11
.LBB2_4:                                ; %.lr.ph
                                        ;   Parent Loop BB2_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s10, 0
	s_cbranch_scc0 .LBB2_11
; %bb.5:                                ;   in Loop: Header=BB2_4 Depth=2
	s_cmp_ge_i32 s10, s7
	s_cbranch_scc0 .LBB2_12
; %bb.6:                                ;   in Loop: Header=BB2_4 Depth=2
	s_cmp_eq_u32 s7, s10
	s_mov_b32 s12, -1
                                        ; implicit-def: $sgpr13
	s_cbranch_scc0 .LBB2_10
; %bb.7:                                ;   in Loop: Header=BB2_4 Depth=2
	global_load_b64 v[12:13], v[6:7], off offset:-8
	s_mov_b32 s14, exec_lo
                                        ; implicit-def: $sgpr13
	s_waitcnt vmcnt(0)
	v_mad_u64_u32 v[14:15], null, v13, s2, v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v15, 31, v14
	v_lshlrev_b64 v[14:15], 2, v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v14, vcc_lo, s0, v14
	v_add_co_ci_u32_e32 v15, vcc_lo, s1, v15, vcc_lo
	global_load_b32 v14, v[14:15], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e64 s12, 1, v14
	v_cmpx_ne_u32_e32 1, v14
	s_xor_b32 s14, exec_lo, s14
	s_cbranch_execz .LBB2_9
; %bb.8:                                ;   in Loop: Header=BB2_4 Depth=2
	v_mad_u64_u32 v[14:15], null, v12, s2, v[13:14]
	s_and_not1_b32 s12, s12, exec_lo
	s_mov_b32 s13, -1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v15, 31, v14
	v_lshlrev_b64 v[12:13], 2, v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v12, vcc_lo, s0, v12
	v_add_co_ci_u32_e32 v13, vcc_lo, s1, v13, vcc_lo
	global_load_b32 v12, v[12:13], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, 1, v12
	s_and_b32 s15, vcc_lo, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s12, s12, s15
.LBB2_9:                                ; %Flow135
                                        ;   in Loop: Header=BB2_4 Depth=2
	s_or_b32 exec_lo, exec_lo, s14
.LBB2_10:                               ; %Flow134
                                        ;   in Loop: Header=BB2_4 Depth=2
	s_mov_b32 s14, 0
	s_branch .LBB2_13
.LBB2_11:                               ;   in Loop: Header=BB2_4 Depth=2
	s_mov_b32 s14, -1
	s_mov_b32 s12, 0
                                        ; implicit-def: $sgpr13
	s_branch .LBB2_22
.LBB2_12:                               ;   in Loop: Header=BB2_4 Depth=2
	s_mov_b32 s14, -1
	s_mov_b32 s12, 0
                                        ; implicit-def: $sgpr13
.LBB2_13:                               ; %Flow133
                                        ;   in Loop: Header=BB2_4 Depth=2
	s_and_b32 vcc_lo, exec_lo, s14
	s_cbranch_vccz .LBB2_21
; %bb.14:                               ;   in Loop: Header=BB2_4 Depth=2
	global_load_b64 v[12:13], v[10:11], off offset:-4
	s_mov_b32 s14, exec_lo
                                        ; implicit-def: $sgpr13
	s_waitcnt vmcnt(0)
	v_mul_lo_u32 v14, v12, s2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v15, v14, v13
	v_ashrrev_i32_e32 v16, 31, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[15:16], 2, v[15:16]
	v_add_co_u32 v15, vcc_lo, s0, v15
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v16, vcc_lo, s1, v16, vcc_lo
	global_load_b32 v15, v[15:16], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e64 s15, 1, v15
	v_cmpx_ne_u32_e32 1, v15
	s_cbranch_execz .LBB2_16
; %bb.15:                               ;   in Loop: Header=BB2_4 Depth=2
	v_mad_u64_u32 v[15:16], null, v13, s2, v[12:13]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	s_and_not1_b32 s15, s15, exec_lo
	s_mov_b32 s13, -1
	v_ashrrev_i32_e32 v16, 31, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[15:16], 2, v[15:16]
	v_add_co_u32 v15, vcc_lo, s0, v15
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(SALU_CYCLE_1)
	v_add_co_ci_u32_e32 v16, vcc_lo, s1, v16, vcc_lo
	global_load_b32 v13, v[15:16], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, 1, v13
	s_and_b32 s16, vcc_lo, exec_lo
	s_or_b32 s15, s15, s16
.LBB2_16:                               ; %Flow137
                                        ;   in Loop: Header=BB2_4 Depth=2
	s_or_b32 exec_lo, exec_lo, s14
	s_delay_alu instid0(VALU_DEP_2)
	s_and_saveexec_b32 s14, s15
	s_cbranch_execz .LBB2_20
; %bb.17:                               ;   in Loop: Header=BB2_4 Depth=2
	global_load_b32 v13, v[10:11], off offset:-8
	s_mov_b32 s16, -1
	s_mov_b32 s15, exec_lo
                                        ; implicit-def: $sgpr17
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v14, v13, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v15, 31, v14
	v_lshlrev_b64 v[14:15], 2, v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v14, vcc_lo, s0, v14
	v_add_co_ci_u32_e32 v15, vcc_lo, s1, v15, vcc_lo
	global_load_b32 v14, v[14:15], off
	s_waitcnt vmcnt(0)
	v_cmpx_ne_u32_e32 1, v14
	s_xor_b32 s15, exec_lo, s15
	s_cbranch_execz .LBB2_19
; %bb.18:                               ;   in Loop: Header=BB2_4 Depth=2
	v_mad_u64_u32 v[14:15], null, v13, s2, v[12:13]
	s_mov_b32 s17, -1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v15, 31, v14
	v_lshlrev_b64 v[12:13], 2, v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v12, vcc_lo, s0, v12
	v_add_co_ci_u32_e32 v13, vcc_lo, s1, v13, vcc_lo
	global_load_b32 v12, v[12:13], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, 1, v12
	s_or_not1_b32 s16, vcc_lo, exec_lo
.LBB2_19:                               ; %Flow139
                                        ;   in Loop: Header=BB2_4 Depth=2
	s_or_b32 exec_lo, exec_lo, s15
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 s13, s13, exec_lo
	s_and_b32 s15, s17, exec_lo
	s_and_not1_b32 s12, s12, exec_lo
	s_and_b32 s16, s16, exec_lo
	s_or_b32 s13, s13, s15
	s_or_b32 s12, s12, s16
.LBB2_20:                               ; %Flow138
                                        ;   in Loop: Header=BB2_4 Depth=2
	s_or_b32 exec_lo, exec_lo, s14
.LBB2_21:                               ; %Flow136
                                        ;   in Loop: Header=BB2_4 Depth=2
	s_mov_b32 s14, 0
.LBB2_22:                               ; %Flow132
                                        ;   in Loop: Header=BB2_4 Depth=2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 vcc_lo, exec_lo, s14
	s_cbranch_vccz .LBB2_26
; %bb.23:                               ;   in Loop: Header=BB2_4 Depth=2
	global_load_b64 v[12:13], v[2:3], off
	s_mov_b32 s14, exec_lo
                                        ; implicit-def: $sgpr13
	s_waitcnt vmcnt(0)
	v_mov_b32_e32 v14, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[15:16], null, v12, s2, v[14:15]
	v_ashrrev_i32_e32 v16, 31, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[14:15], 2, v[15:16]
	v_add_co_u32 v14, vcc_lo, s0, v14
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v15, vcc_lo, s1, v15, vcc_lo
	global_load_b32 v14, v[14:15], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e64 s12, 1, v14
	v_cmpx_ne_u32_e32 1, v14
	s_cbranch_execz .LBB2_25
; %bb.24:                               ;   in Loop: Header=BB2_4 Depth=2
	v_mad_u64_u32 v[14:15], null, v13, s2, v[12:13]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	s_and_not1_b32 s12, s12, exec_lo
	s_mov_b32 s13, -1
	v_ashrrev_i32_e32 v15, 31, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[12:13], 2, v[14:15]
	v_add_co_u32 v12, vcc_lo, s0, v12
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(SALU_CYCLE_1)
	v_add_co_ci_u32_e32 v13, vcc_lo, s1, v13, vcc_lo
	global_load_b32 v12, v[12:13], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, 1, v12
	s_and_b32 s15, vcc_lo, exec_lo
	s_or_b32 s12, s12, s15
.LBB2_25:                               ; %Flow141
                                        ;   in Loop: Header=BB2_4 Depth=2
	s_or_b32 exec_lo, exec_lo, s14
.LBB2_26:                               ; %Flow140
                                        ;   in Loop: Header=BB2_4 Depth=2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 s11, s11, exec_lo
	s_and_b32 s13, s13, exec_lo
	s_mov_b32 s14, -1
	s_or_b32 s11, s11, s13
	s_and_saveexec_b32 s13, s12
; %bb.27:                               ;   in Loop: Header=BB2_4 Depth=2
	s_add_i32 s10, s10, 1
	v_add_co_u32 v10, vcc_lo, v10, 4
	s_cmp_eq_u32 s2, s10
	v_add_co_ci_u32_e32 v11, vcc_lo, 0, v11, vcc_lo
	s_cselect_b32 s12, -1, 0
	s_and_not1_b32 s11, s11, exec_lo
	s_or_not1_b32 s14, s12, exec_lo
; %bb.28:                               ; %Flow142
                                        ;   in Loop: Header=BB2_4 Depth=2
	s_or_b32 exec_lo, exec_lo, s13
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s12, exec_lo, s14
	s_or_b32 s8, s12, s8
	s_and_not1_b32 s9, s9, exec_lo
	s_and_b32 s12, s11, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s9, s9, s12
	s_and_not1_b32 exec_lo, exec_lo, s8
	s_cbranch_execnz .LBB2_4
; %bb.29:                               ; %loop.exit.guard
                                        ;   in Loop: Header=BB2_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s8
	s_and_saveexec_b32 s8, s9
	s_delay_alu instid0(SALU_CYCLE_1)
	s_xor_b32 s8, exec_lo, s8
	s_cbranch_execz .LBB2_31
; %bb.30:                               ; %.loopexit.sink.split
                                        ;   in Loop: Header=BB2_2 Depth=1
	global_store_b8 v[4:5], v0, off
.LBB2_31:                               ; %Flow
                                        ;   in Loop: Header=BB2_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s8
.LBB2_32:                               ; %.loopexit
                                        ;   in Loop: Header=BB2_2 Depth=1
	v_add_nc_u32_e32 v1, s4, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_le_i32_e32 vcc_lo, s3, v1
	s_or_b32 s6, vcc_lo, s6
	s_and_not1_b32 exec_lo, exec_lo, s6
	s_cbranch_execnz .LBB2_2
.LBB2_33:                               ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z12checkPathsTHPiiiS_Pb
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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 17
		.amdhsa_next_free_sgpr 18
		.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_end2:
	.size	_Z12checkPathsTHPiiiS_Pb, .Lfunc_end2-_Z12checkPathsTHPiiiS_Pb
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1172
; NumSgprs: 20
; NumVgprs: 17
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 20
; NumVGPRsForWavesPerEU: 17
; 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
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z6initToPiii
    .private_segment_fixed_size: 0
    .sgpr_count:     8
    .sgpr_spill_count: 0
    .symbol:         _Z6initToPiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           1
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z6initToPbib
    .private_segment_fixed_size: 0
    .sgpr_count:     9
    .sgpr_spill_count: 0
    .symbol:         _Z6initToPbib.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .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
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z12checkPathsTHPiiiS_Pb
    .private_segment_fixed_size: 0
    .sgpr_count:     20
    .sgpr_spill_count: 0
    .symbol:         _Z12checkPathsTHPiiiS_Pb.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     17
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
