#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <cstring>
#include <limits>		// radi definiranja beskonačnosti
#include <ctime>		// radi mjerenja vremena izvršavanja
#include <cmath>		// radi "strop" funkcije
using namespace std;

/* Definiramo beskonačnost kao najveći mogući integer broj. */
#define infty 	std::numeric_limits<int>::max()

void printMatrix (int* G, unsigned int dim) {
	cout << "\r\n";
	for (int i = 0; i < dim*dim; i++) {
		if (G[i] < infty) {
			cout << G[i] << "\t";
		}
		else {
			cout << "∞" << "\t";
		}
		/* Ako je ispisao sve za jedan vrh, prijeđi na sljedeći u novi redak. */
		if ((i+1)%dim == 0) {
			cout << "\r\n";
		}
	}
}

/* Kernel za device koji paralelizira unutarnje dvije for petlje Floyd-Warshall algoritma. */
__global__ void FW_Cuda(int k, int* D, int* PI, unsigned int dim) {
    int i = blockDim.y * blockIdx.y + threadIdx.y;
    int j = blockDim.x * blockIdx.x + threadIdx.x;
	
	if (i < dim && j < dim && D[i*dim+k] < INT_MAX && D[k*dim+j] < INT_MAX) {
		if (D[i*dim+j] > D[i*dim+k] + D[k*dim+j]) {
			D[i*dim+j] = D[i*dim+k] + D[k*dim+j];
			PI[i*dim+j] = PI[k*dim+j];
		}
	}
}


void Floyd_Warshall_Cuda (int* W, int* D, int* PI, unsigned int dim) {	
	unsigned int n = dim*dim;
	
    /* Error varijabla za handleanje CUDA errora. */
    cudaError_t err = cudaSuccess;
	
	/* Alociranje device varijabli matrica D i PI. */
    int* d_D = NULL;
    err = cudaMalloc((void**) &d_D, n*sizeof(int));
    if (err != cudaSuccess) {
        fprintf(stderr, "Neuspješno alociranje matrice D (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
    int* d_PI = NULL;
    err = cudaMalloc((void**) &d_PI, n*sizeof(int));
    if (err != cudaSuccess) {
        fprintf(stderr, "Neuspješno alociranje matrice PI (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }    
	
	/* Kopiranje podataka iz host matrica u device. */
    err = cudaMemcpy(d_D, D, n*sizeof(int), cudaMemcpyHostToDevice);
    if (err != cudaSuccess) {
        fprintf(stderr, "Neuspješno kopiranje matrice D iz hosta u device (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
    err = cudaMemcpy(d_PI, PI, n*sizeof(int), cudaMemcpyHostToDevice);
    if (err != cudaSuccess) {
        fprintf(stderr, "Neuspješno kopiranje matrice PI iz hosta u device (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	/* Pozivanje CUDA kernela. */
	int blockDim = 32;									/* Ukoliko je dimenzija bloka 32, imamo 1024 threadova po bloku. */
	int gridDim = ceil((float)dim/(float)blockDim);		/* Računa se kolika mora biti dimenzija grida ovisno o dimenziji blokova. */
	
	cout << "CUDA kernel se pokreće sa " << gridDim*gridDim << " blokova i " << blockDim*blockDim << " threadova po bloku.\r\n";
	
	/* Vanjsku petlju Floyd-Warshall algoritma vrtimo na CPU, unutarnje dvije paraleliziramo. */
	for (int k = 0; k < dim; k++) {
		FW_Cuda<<<dim3(gridDim, gridDim, 1), dim3(blockDim, blockDim, 1)>>> (k, d_D, d_PI, dim);
		
		err = cudaGetLastError();
		if (err != cudaSuccess) {
			fprintf(stderr, "Neuspješno pokrenuta kernel metoda (error code %s)!\n", cudaGetErrorString(err));
			exit(EXIT_FAILURE);
		}
		
		/* Sinkronizacija threadova kako bi se završila k-ta iteracija, te kako bi se prešlo na (k+1). iteraciju. */
		cudaThreadSynchronize();
	}
	
	/* Kopiranje podataka iz device matrica u host. */	
    err = cudaMemcpy(D, d_D, n*sizeof(int), cudaMemcpyDeviceToHost);
    if (err != cudaSuccess) {
        fprintf(stderr, "Neuspješno kopiranje matrice D iz devicea u host (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
    err = cudaMemcpy(PI, d_PI, n*sizeof(int), cudaMemcpyDeviceToHost);
    if (err != cudaSuccess) {
        fprintf(stderr, "Neuspješno kopiranje matrice PI iz devicea u host (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	/* Dealociranje device varijabli matrica D i PI. */
	err = cudaFree(d_D);
    if (err != cudaSuccess) {
        fprintf(stderr, "Neuspješno dealociranje matrice D (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
    err = cudaFree(d_PI);
    if (err != cudaSuccess) {
        fprintf(stderr, "Neuspješno dealociranje matrice PI (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	/* Reset CUDA devicea i završavanje CUDA Floyd-Warshalla. */
    err = cudaDeviceReset();
    if (err != cudaSuccess) {
        fprintf(stderr, "Neuspješno resetiranje devicea (završavanje sa CUDA FW, priprema za sljedeće pokretanje)! error=%s\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
}


/* Metoda koja rekonstruira težinu najkraćeg puta za dani par vrhova koristeći matricu
   prethodnika PI i matricu inicijalnih težina W. */
int getPath (int* W, int* PI, int i, int j, unsigned int dim) {
	if (i == j) {
		return 0;
	}
    else if (PI[i*dim+j] == -1) {
		return infty;
	}
	else {
		int recursivePath = getPath(W, PI, i, PI[i*dim+j], dim);
		if (recursivePath < infty) {
			return recursivePath + W[PI[i*dim+j]*dim+j];
		}
		else {
			return infty;
		}
	}
}


/* Za svaki par vrhova pokreće getPath metodu koja rekonstruira težinu najkraćeg puta
   između njih koristeći matricu prethodnika PI. Tu težinu onda uspoređuje sa dobivenom težinom
   za isti par vrhova u matrici najkraćih putova D. */
bool checkSolutionCorrectness (int* W, int* D, int* PI, unsigned int dim) {
	for (int i = 0; i < dim; i++) {
		for (int j = 0; j < dim; j++) {
			if (getPath(W, PI, i, j, dim) != D[i*dim+j]) {
				return false;
			}
		}
	}
	
	return true;
}


int main() {
	
	/* 
	   V - broj vrhova
	   E - broj bridova
	   u - prvi vrh pri učitavanju grafa iz datoteke
	   v - drugi vrh pri učitavanju grafa iz datoteke
	   w - težina između v1 i v2 pri učitavanju grafa iz datoteke
	*/
	unsigned int V, E;
	int u, v, w;

	ifstream inputGraphFile; inputGraphFile.open("graphFile.txt");
	ofstream outputFile; outputFile.open("output_cuda.txt");
	
	inputGraphFile >> V >> E;
	cout << "V = " << V << ", E = " << E << "\r\n";
	
	unsigned int n = V*V;
	
	/* Inicijalizacija grafova u memoriji. */
	int* W = (int*)malloc(n*sizeof(int));
	int* D = (int*)malloc(n*sizeof(int));
	int* PI = (int*)malloc(n*sizeof(int));
	
	
	/* Postavljanje inicijalnih vrijednosti za matricu prethodnika PI(0),
	   matricu težina W i matricu najkraćih putova D(0). */
	fill_n(W, n, infty); 
	fill_n(PI, n, -1);
	
	for (int i = 0; i < E; i++) {
		inputGraphFile >> u >> v >> w;
		//cout << u << " <-- " << w << " --> " << v << "\r\n";
		
		W[u*V+v] = w;
		if (u != v) {
			PI[u*V+v] = u;
		}
	}
	
	for (int i = 0; i < V; i++) {
		W[i*V+i] = 0;
	}
	
	/* D(0) = W na početku. */
	memcpy (D, W, n*sizeof(int));
	
	// printMatrix(W, V); printMatrix(D, V); printMatrix(PI, V);
	
	/* Početak mjerenja izvršavanja Floyd-Warshall algoritma. */
	clock_t begin = clock();
	
	/* Pozivamo Floyd-Warshall CPU algoritam nad učitanim grafom. */
	Floyd_Warshall_Cuda(W, D, PI, V);
	
	/* Kraj mjerenja izvršavanja Floyd-Warshall algoritma. */
	clock_t end = clock();
	double elapsedTime = double(end - begin) / CLOCKS_PER_SEC;
	
	//printMatrix(W, V); printMatrix(D, V); printMatrix(PI, V);
	
	/* Ispis rezultata u datoteku. */
	outputFile << "|V| = " << V << ", |E| = " << E << "\r\n\r\n";
	for (int i = 0; i < n; i++) {
		if (i%V==0) outputFile << "\r\n";
		if (D[i] < infty)
			outputFile << D[i] << "\t";
		else
			outputFile << "∞" << "\t";
	}
	outputFile << "\r\n\r\n";
	for (int i = 0; i < n; i++) {
		if (i%V==0) outputFile << "\r\n";
		outputFile << PI[i] << "\t";
	}
	
	cout << "Vrijeme izvršavanja Floyd-Warshall algoritma: " << elapsedTime << "s.\r\n";
	
	if (checkSolutionCorrectness(W, D, PI, V) == true)
		cout << "Svi najkraći putevi su točno izračunati!\r\n";
	else
		cout << "Najkraći putevi nisu točno izračunati.\r\n";
	
	inputGraphFile.close();
	outputFile.close();
	free(W); free(D); free(PI);
	
	return 0;
}
	.file	"tmpxft_00214b7a_00000000-6_fw_cuda.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3773:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3773:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"\r\n"
.LC1:
	.string	"\t"
.LC2:
	.string	"\342\210\236"
	.text
	.globl	_Z11printMatrixPij
	.type	_Z11printMatrixPij, @function
_Z11printMatrixPij:
.LFB3766:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %r13
	leaq	_ZSt4cout(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%esi, %ebx
	leaq	.LC0(%rip), %rsi
	pushq	%rdx
	.cfi_def_cfa_offset 64
	movl	%ebx, %r15d
	imull	%ebx, %r15d
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L3:
	movl	%ebp, %r12d
	cmpl	%r15d, %ebp
	jnb	.L11
	movl	0(%r13,%rbp,4), %esi
	cmpl	$2147483647, %esi
	je	.L4
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZNSolsEi@PLT
	jmp	.L9
.L4:
	leaq	.LC2(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L9:
	movq	%rax, %rdi
	movq	%r14, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leal	1(%r12), %eax
	xorl	%edx, %edx
	divl	%ebx
	testl	%edx, %edx
	jne	.L6
	leaq	.LC0(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L6:
	incq	%rbp
	jmp	.L3
.L11:
	popq	%rax
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3766:
	.size	_Z11printMatrixPij, .-_Z11printMatrixPij
	.globl	_Z7getPathPiS_iij
	.type	_Z7getPathPiS_iij, @function
_Z7getPathPiS_iij:
.LFB3768:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	cmpl	%ecx, %edx
	je	.L20
	movl	%edx, %eax
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	imull	%r8d, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%r8d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movl	%ecx, %ebx
	addl	%ecx, %eax
	pushq	%r9
	.cfi_def_cfa_offset 48
	movl	%eax, %eax
	movl	(%rsi,%rax,4), %ebp
	movl	$2147483647, %eax
	cmpl	$-1, %ebp
	je	.L12
	movl	%ebp, %ecx
	movq	%rdi, %r13
	call	_Z7getPathPiS_iij
	cmpl	$2147483647, %eax
	je	.L12
	imull	%r12d, %ebp
	leal	0(%rbp,%rbx), %edx
	addl	0(%r13,%rdx,4), %eax
.L12:
	popq	%rdx
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L20:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	ret
	.cfi_endproc
.LFE3768:
	.size	_Z7getPathPiS_iij, .-_Z7getPathPiS_iij
	.globl	_Z24checkSolutionCorrectnessPiS_S_j
	.type	_Z24checkSolutionCorrectnessPiS_S_j, @function
_Z24checkSolutionCorrectnessPiS_S_j:
.LFB3769:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%ecx, %r13d
	xorl	%r11d, %r11d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rsi, %rbp
	movq	%rdx, %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
	pushq	%r8
	.cfi_def_cfa_offset 48
	movq	%r13, %r8
.L24:
	movl	%r11d, %r12d
	cmpq	%r13, %r11
	je	.L31
	xorl	%r10d, %r10d
.L26:
	movl	%r12d, %edx
	movl	%r10d, %ecx
	call	_Z7getPathPiS_iij
	leal	(%rbx,%r10), %edx
	cmpl	%eax, 0(%rbp,%rdx,4)
	jne	.L27
	incq	%r10
	cmpq	%r13, %r10
	jne	.L26
	incq	%r11
	addl	%r8d, %ebx
	jmp	.L24
.L31:
	movb	$1, %al
	jmp	.L23
.L27:
	xorl	%eax, %eax
.L23:
	popq	%rdx
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3769:
	.size	_Z24checkSolutionCorrectnessPiS_S_j, .-_Z24checkSolutionCorrectnessPiS_S_j
	.globl	_Z30__device_stub__Z7FW_CudaiPiS_jiPiS_j
	.type	_Z30__device_stub__Z7FW_CudaiPiS_jiPiS_j, @function
_Z30__device_stub__Z7FW_CudaiPiS_jiPiS_j:
.LFB3795:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movl	%edi, 28(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 24(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L32
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z7FW_CudaiPiS_j(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L32:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3795:
	.size	_Z30__device_stub__Z7FW_CudaiPiS_jiPiS_j, .-_Z30__device_stub__Z7FW_CudaiPiS_jiPiS_j
	.globl	_Z7FW_CudaiPiS_j
	.type	_Z7FW_CudaiPiS_j, @function
_Z7FW_CudaiPiS_j:
.LFB3796:
	.cfi_startproc
	endbr64
	jmp	_Z30__device_stub__Z7FW_CudaiPiS_jiPiS_j
	.cfi_endproc
.LFE3796:
	.size	_Z7FW_CudaiPiS_j, .-_Z7FW_CudaiPiS_j
	.section	.rodata.str1.1
.LC3:
	.string	"Neuspje\305\241no alociranje matrice D (error code %s)!\n"
.LC4:
	.string	"Neuspje\305\241no alociranje matrice PI (error code %s)!\n"
.LC5:
	.string	"Neuspje\305\241no kopiranje matrice D iz hosta u device (error code %s)!\n"
.LC6:
	.string	"Neuspje\305\241no kopiranje matrice PI iz hosta u device (error code %s)!\n"
.LC8:
	.string	"CUDA kernel se pokre\304\207e sa "
.LC9:
	.string	" blokova i "
.LC10:
	.string	" threadova po bloku.\r\n"
.LC11:
	.string	"Neuspje\305\241no pokrenuta kernel metoda (error code %s)!\n"
.LC12:
	.string	"Neuspje\305\241no kopiranje matrice D iz devicea u host (error code %s)!\n"
.LC13:
	.string	"Neuspje\305\241no kopiranje matrice PI iz devicea u host (error code %s)!\n"
.LC14:
	.string	"Neuspje\305\241no dealociranje matrice D (error code %s)!\n"
.LC15:
	.string	"Neuspje\305\241no dealociranje matrice PI (error code %s)!\n"
.LC16:
	.string	"Neuspje\305\241no resetiranje devicea (zavr\305\241avanje sa CUDA FW, priprema za sljede\304\207e pokretanje)! error=%s\n"
	.text
	.globl	_Z19Floyd_Warshall_CudaPiS_S_j
	.type	_Z19Floyd_Warshall_CudaPiS_S_j, @function
_Z19Floyd_Warshall_CudaPiS_S_j:
.LFB3767:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%ecx, %ebx
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdx, 8(%rsp)
	leaq	16(%rsp), %rdi
	xorl	%edx, %edx
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movl	%ecx, %eax
	movq	%rdx, 16(%rsp)
	imull	%ecx, %eax
	salq	$2, %rax
	movq	%rax, %rsi
	movq	%rax, (%rsp)
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L38
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC3(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L55
.L38:
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	leaq	24(%rsp), %rdi
	movq	%rax, 24(%rsp)
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L39
	call	cudaGetErrorString@PLT
	leaq	.LC4(%rip), %rdx
	movq	%rax, %rcx
.L55:
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L39:
	movq	16(%rsp), %rdi
	movq	(%rsp), %rdx
	movl	$1, %ecx
	movq	%rbp, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L40
	call	cudaGetErrorString@PLT
	leaq	.LC5(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L55
.L40:
	movq	24(%rsp), %rdi
	movq	(%rsp), %rdx
	movl	$1, %ecx
	movq	8(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L41
	call	cudaGetErrorString@PLT
	leaq	.LC6(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L55
.L41:
	movabsq	$137438953504, %r15
	movl	%ebx, %r14d
	xorl	%r12d, %r12d
	cvtsi2ssq	%r14, %xmm0
	mulss	.LC7(%rip), %xmm0
	call	ceilf@PLT
	leaq	.LC8(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	cvttss2sil	%xmm0, %r13d
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	%r13d, %esi
	imull	%r13d, %esi
	call	_ZNSolsEi@PLT
	leaq	.LC9(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$1024, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC10(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L44:
	cmpq	%r14, %r12
	je	.L56
	movl	%r13d, 32(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r15, %rdx
	movl	%r13d, 36(%rsp)
	movq	32(%rsp), %rdi
	movl	$1, %ecx
	movl	$1, %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L45
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	%ebx, %ecx
	movl	%r12d, %edi
	call	_Z30__device_stub__Z7FW_CudaiPiS_jiPiS_j
.L45:
	call	cudaGetLastError@PLT
	incq	%r12
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L46
	call	cudaGetErrorString@PLT
	leaq	.LC11(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L55
.L46:
	call	cudaThreadSynchronize@PLT
	jmp	.L44
.L56:
	movq	(%rsp), %rdx
	movq	16(%rsp), %rsi
	movq	%rbp, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L48
	call	cudaGetErrorString@PLT
	leaq	.LC12(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L55
.L48:
	movq	8(%rsp), %rdi
	movq	(%rsp), %rdx
	movl	$2, %ecx
	movq	24(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L49
	call	cudaGetErrorString@PLT
	leaq	.LC13(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L55
.L49:
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L50
	call	cudaGetErrorString@PLT
	leaq	.LC14(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L55
.L50:
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L51
	call	cudaGetErrorString@PLT
	leaq	.LC15(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L55
.L51:
	call	cudaDeviceReset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L37
	call	cudaGetErrorString@PLT
	leaq	.LC16(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L55
.L37:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L53
	call	__stack_chk_fail@PLT
.L53:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3767:
	.size	_Z19Floyd_Warshall_CudaPiS_S_j, .-_Z19Floyd_Warshall_CudaPiS_S_j
	.section	.rodata.str1.1
.LC17:
	.string	"_Z7FW_CudaiPiS_j"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3798:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC17(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z7FW_CudaiPiS_j(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3798:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC18:
	.string	"graphFile.txt"
.LC19:
	.string	"output_cuda.txt"
.LC20:
	.string	"V = "
.LC21:
	.string	", E = "
.LC23:
	.string	"|V| = "
.LC24:
	.string	", |E| = "
.LC25:
	.string	"\r\n\r\n"
.LC26:
	.string	"Vrijeme izvr\305\241avanja Floyd-Warshall algoritma: "
.LC27:
	.string	"s.\r\n"
.LC28:
	.string	"Svi najkra\304\207i putevi su to\304\215no izra\304\215unati!\r\n"
.LC29:
	.string	"Najkra\304\207i putevi nisu to\304\215no izra\304\215unati.\r\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3770:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3770
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$1112, %rsp
	.cfi_def_cfa_offset 1168
	movq	%fs:40, %rax
	movq	%rax, 1096(%rsp)
	xorl	%eax, %eax
	leaq	576(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 16(%rsp)
.LEHB0:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE0:
	movq	16(%rsp), %rdi
	movl	$8, %edx
	leaq	.LC18(%rip), %rsi
.LEHB1:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	leaq	64(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE1:
	movq	8(%rsp), %rdi
	movl	$16, %edx
	leaq	.LC19(%rip), %rsi
.LEHB2:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movq	16(%rsp), %rdi
	leaq	44(%rsp), %rsi
	call	_ZNSi10_M_extractIjEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	48(%rsp), %rsi
	call	_ZNSi10_M_extractIjEERSiRT_@PLT
	leaq	.LC20(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	44(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC21(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	48(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC0(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	44(%rsp), %r14d
	imull	%r14d, %r14d
	movl	%r14d, %r12d
	salq	$2, %r12
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, %rbx
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, %r13
	call	malloc@PLT
	movq	%rax, %rbp
	testl	%r14d, %r14d
	jne	.L60
.L66:
	leaq	52(%rsp), %rax
	xorl	%r15d, %r15d
	movq	%rax, 24(%rsp)
	jmp	.L61
.L60:
	leaq	(%rbx,%r12), %rdx
	movq	%rbx, %rax
.L62:
	cmpq	%rax, %rdx
	je	.L105
	movl	$2147483647, (%rax)
	addq	$4, %rax
	jmp	.L62
.L105:
	leaq	0(%rbp,%r12), %rdx
	movq	%rbp, %rax
.L64:
	cmpq	%rax, %rdx
	je	.L66
	movl	$-1, (%rax)
	addq	$4, %rax
	jmp	.L64
.L68:
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdi
	call	_ZNSirsERi@PLT
	movq	%rax, %rdi
	leaq	56(%rsp), %rsi
	call	_ZNSirsERi@PLT
	movq	%rax, %rdi
	leaq	60(%rsp), %rsi
	call	_ZNSirsERi@PLT
	movl	52(%rsp), %eax
	movl	44(%rsp), %edx
	movl	56(%rsp), %ecx
	movl	60(%rsp), %esi
	imull	%eax, %edx
	addl	%ecx, %edx
	movl	%edx, %edx
	movl	%esi, (%rbx,%rdx,4)
	cmpl	%ecx, %eax
	je	.L67
	movl	%eax, 0(%rbp,%rdx,4)
.L67:
	incl	%r15d
.L61:
	cmpl	48(%rsp), %r15d
	jb	.L68
	movl	44(%rsp), %ecx
	xorl	%edx, %edx
	xorl	%eax, %eax
	leal	1(%rcx), %esi
.L69:
	cmpl	%ecx, %eax
	je	.L106
	movl	%edx, %edi
	xorl	%r8d, %r8d
	incl	%eax
	addl	%esi, %edx
	movl	%r8d, (%rbx,%rdi,4)
	jmp	.L69
.L106:
	movq	%r12, %rcx
	movq	%r12, %rdx
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	__memcpy_chk@PLT
	call	clock@PLT
	movl	44(%rsp), %ecx
	movq	%rbp, %rdx
	movq	%r13, %rsi
	movq	%rbx, %rdi
	movq	%rax, %r12
	call	_Z19Floyd_Warshall_CudaPiS_S_j
	call	clock@PLT
	movq	8(%rsp), %rdi
	leaq	.LC23(%rip), %rsi
	subq	%r12, %rax
	cvtsi2sdq	%rax, %xmm0
	divsd	.LC22(%rip), %xmm0
	movsd	%xmm0, 24(%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	44(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC24(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	48(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	leaq	.LC25(%rip), %r15
	movq	%rax, %rdi
	movq	%r15, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	xorl	%r12d, %r12d
.L71:
	movl	%r12d, %eax
	cmpl	%r14d, %r12d
	jnb	.L107
	xorl	%edx, %edx
	divl	44(%rsp)
	testl	%edx, %edx
	je	.L72
.L75:
	movl	0(%r13,%r12,4), %esi
	cmpl	$2147483647, %esi
	jne	.L73
	jmp	.L108
.L72:
	movq	8(%rsp), %rdi
	leaq	.LC0(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L75
.L73:
	movq	8(%rsp), %rdi
	call	_ZNSolsEi@PLT
.L102:
	movq	%rax, %rdi
	leaq	.LC1(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	incq	%r12
	jmp	.L71
.L108:
	movq	8(%rsp), %rdi
	leaq	.LC2(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L102
.L107:
	movq	8(%rsp), %rdi
	movq	%r15, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %r15
.L78:
	movl	%r12d, %eax
	cmpl	%r14d, %r12d
	jnb	.L109
	xorl	%edx, %edx
	divl	44(%rsp)
	testl	%edx, %edx
	je	.L79
.L81:
	movl	0(%rbp,%r12,4), %esi
	movq	8(%rsp), %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movq	%r15, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	incq	%r12
	jmp	.L78
.L79:
	movq	8(%rsp), %rdi
	leaq	.LC0(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L81
.L109:
	leaq	.LC26(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	24(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC27(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	44(%rsp), %ecx
	movq	%r13, %rsi
	movq	%rbp, %rdx
	movq	%rbx, %rdi
	call	_Z24checkSolutionCorrectnessPiS_S_j
	leaq	.LC29(%rip), %rsi
	testb	%al, %al
	je	.L104
	leaq	.LC28(%rip), %rsi
.L104:
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	16(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
.LEHE2:
	movq	%rbx, %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	leaq	64(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	576(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	1096(%rsp), %rax
	subq	%fs:40, %rax
	je	.L89
	jmp	.L99
.L93:
	endbr64
	movq	%rax, %rbx
.L86:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L87
.L92:
	endbr64
	movq	%rax, %rbx
.L87:
	movq	16(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	1096(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L99
	movq	%rbx, %rdi
.LEHB3:
	call	_Unwind_Resume@PLT
.LEHE3:
.L99:
	call	__stack_chk_fail@PLT
.L89:
	addq	$1112, %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
.LFE3770:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3770:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3770-.LLSDACSB3770
.LLSDACSB3770:
	.uleb128 .LEHB0-.LFB3770
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3770
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L92-.LFB3770
	.uleb128 0
	.uleb128 .LEHB2-.LFB3770
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L93-.LFB3770
	.uleb128 0
	.uleb128 .LEHB3-.LFB3770
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
.LLSDACSE3770:
	.section	.text.startup
	.size	main, .-main
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC7:
	.long	1023410176
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC22:
	.long	0
	.long	1093567616
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <cstring>
#include <limits>		// radi definiranja beskonačnosti
#include <ctime>		// radi mjerenja vremena izvršavanja
#include <cmath>		// radi "strop" funkcije
using namespace std;

/* Definiramo beskonačnost kao najveći mogući integer broj. */
#define infty 	std::numeric_limits<int>::max()

void printMatrix (int* G, unsigned int dim) {
	cout << "\r\n";
	for (int i = 0; i < dim*dim; i++) {
		if (G[i] < infty) {
			cout << G[i] << "\t";
		}
		else {
			cout << "∞" << "\t";
		}
		/* Ako je ispisao sve za jedan vrh, prijeđi na sljedeći u novi redak. */
		if ((i+1)%dim == 0) {
			cout << "\r\n";
		}
	}
}

/* Kernel za device koji paralelizira unutarnje dvije for petlje Floyd-Warshall algoritma. */
__global__ void FW_Cuda(int k, int* D, int* PI, unsigned int dim) {
    int i = blockDim.y * blockIdx.y + threadIdx.y;
    int j = blockDim.x * blockIdx.x + threadIdx.x;
	
	if (i < dim && j < dim && D[i*dim+k] < INT_MAX && D[k*dim+j] < INT_MAX) {
		if (D[i*dim+j] > D[i*dim+k] + D[k*dim+j]) {
			D[i*dim+j] = D[i*dim+k] + D[k*dim+j];
			PI[i*dim+j] = PI[k*dim+j];
		}
	}
}


void Floyd_Warshall_Cuda (int* W, int* D, int* PI, unsigned int dim) {	
	unsigned int n = dim*dim;
	
    /* Error varijabla za handleanje CUDA errora. */
    hipError_t err = hipSuccess;
	
	/* Alociranje device varijabli matrica D i PI. */
    int* d_D = NULL;
    err = hipMalloc((void**) &d_D, n*sizeof(int));
    if (err != hipSuccess) {
        fprintf(stderr, "Neuspješno alociranje matrice D (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
    int* d_PI = NULL;
    err = hipMalloc((void**) &d_PI, n*sizeof(int));
    if (err != hipSuccess) {
        fprintf(stderr, "Neuspješno alociranje matrice PI (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }    
	
	/* Kopiranje podataka iz host matrica u device. */
    err = hipMemcpy(d_D, D, n*sizeof(int), hipMemcpyHostToDevice);
    if (err != hipSuccess) {
        fprintf(stderr, "Neuspješno kopiranje matrice D iz hosta u device (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
    err = hipMemcpy(d_PI, PI, n*sizeof(int), hipMemcpyHostToDevice);
    if (err != hipSuccess) {
        fprintf(stderr, "Neuspješno kopiranje matrice PI iz hosta u device (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	/* Pozivanje CUDA kernela. */
	int blockDim = 32;									/* Ukoliko je dimenzija bloka 32, imamo 1024 threadova po bloku. */
	int gridDim = ceil((float)dim/(float)blockDim);		/* Računa se kolika mora biti dimenzija grida ovisno o dimenziji blokova. */
	
	cout << "CUDA kernel se pokreće sa " << gridDim*gridDim << " blokova i " << blockDim*blockDim << " threadova po bloku.\r\n";
	
	/* Vanjsku petlju Floyd-Warshall algoritma vrtimo na CPU, unutarnje dvije paraleliziramo. */
	for (int k = 0; k < dim; k++) {
		FW_Cuda<<<dim3(gridDim, gridDim, 1), dim3(blockDim, blockDim, 1)>>> (k, d_D, d_PI, dim);
		
		err = hipGetLastError();
		if (err != hipSuccess) {
			fprintf(stderr, "Neuspješno pokrenuta kernel metoda (error code %s)!\n", hipGetErrorString(err));
			exit(EXIT_FAILURE);
		}
		
		/* Sinkronizacija threadova kako bi se završila k-ta iteracija, te kako bi se prešlo na (k+1). iteraciju. */
		hipDeviceSynchronize();
	}
	
	/* Kopiranje podataka iz device matrica u host. */	
    err = hipMemcpy(D, d_D, n*sizeof(int), hipMemcpyDeviceToHost);
    if (err != hipSuccess) {
        fprintf(stderr, "Neuspješno kopiranje matrice D iz devicea u host (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
    err = hipMemcpy(PI, d_PI, n*sizeof(int), hipMemcpyDeviceToHost);
    if (err != hipSuccess) {
        fprintf(stderr, "Neuspješno kopiranje matrice PI iz devicea u host (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	/* Dealociranje device varijabli matrica D i PI. */
	err = hipFree(d_D);
    if (err != hipSuccess) {
        fprintf(stderr, "Neuspješno dealociranje matrice D (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
    err = hipFree(d_PI);
    if (err != hipSuccess) {
        fprintf(stderr, "Neuspješno dealociranje matrice PI (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
	/* Reset CUDA devicea i završavanje CUDA Floyd-Warshalla. */
    err = hipDeviceReset();
    if (err != hipSuccess) {
        fprintf(stderr, "Neuspješno resetiranje devicea (završavanje sa CUDA FW, priprema za sljedeće pokretanje)! error=%s\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	
}


/* Metoda koja rekonstruira težinu najkraćeg puta za dani par vrhova koristeći matricu
   prethodnika PI i matricu inicijalnih težina W. */
int getPath (int* W, int* PI, int i, int j, unsigned int dim) {
	if (i == j) {
		return 0;
	}
    else if (PI[i*dim+j] == -1) {
		return infty;
	}
	else {
		int recursivePath = getPath(W, PI, i, PI[i*dim+j], dim);
		if (recursivePath < infty) {
			return recursivePath + W[PI[i*dim+j]*dim+j];
		}
		else {
			return infty;
		}
	}
}


/* Za svaki par vrhova pokreće getPath metodu koja rekonstruira težinu najkraćeg puta
   između njih koristeći matricu prethodnika PI. Tu težinu onda uspoređuje sa dobivenom težinom
   za isti par vrhova u matrici najkraćih putova D. */
bool checkSolutionCorrectness (int* W, int* D, int* PI, unsigned int dim) {
	for (int i = 0; i < dim; i++) {
		for (int j = 0; j < dim; j++) {
			if (getPath(W, PI, i, j, dim) != D[i*dim+j]) {
				return false;
			}
		}
	}
	
	return true;
}


int main() {
	
	/* 
	   V - broj vrhova
	   E - broj bridova
	   u - prvi vrh pri učitavanju grafa iz datoteke
	   v - drugi vrh pri učitavanju grafa iz datoteke
	   w - težina između v1 i v2 pri učitavanju grafa iz datoteke
	*/
	unsigned int V, E;
	int u, v, w;

	ifstream inputGraphFile; inputGraphFile.open("graphFile.txt");
	ofstream outputFile; outputFile.open("output_cuda.txt");
	
	inputGraphFile >> V >> E;
	cout << "V = " << V << ", E = " << E << "\r\n";
	
	unsigned int n = V*V;
	
	/* Inicijalizacija grafova u memoriji. */
	int* W = (int*)malloc(n*sizeof(int));
	int* D = (int*)malloc(n*sizeof(int));
	int* PI = (int*)malloc(n*sizeof(int));
	
	
	/* Postavljanje inicijalnih vrijednosti za matricu prethodnika PI(0),
	   matricu težina W i matricu najkraćih putova D(0). */
	fill_n(W, n, infty); 
	fill_n(PI, n, -1);
	
	for (int i = 0; i < E; i++) {
		inputGraphFile >> u >> v >> w;
		//cout << u << " <-- " << w << " --> " << v << "\r\n";
		
		W[u*V+v] = w;
		if (u != v) {
			PI[u*V+v] = u;
		}
	}
	
	for (int i = 0; i < V; i++) {
		W[i*V+i] = 0;
	}
	
	/* D(0) = W na početku. */
	memcpy (D, W, n*sizeof(int));
	
	// printMatrix(W, V); printMatrix(D, V); printMatrix(PI, V);
	
	/* Početak mjerenja izvršavanja Floyd-Warshall algoritma. */
	clock_t begin = clock();
	
	/* Pozivamo Floyd-Warshall CPU algoritam nad učitanim grafom. */
	Floyd_Warshall_Cuda(W, D, PI, V);
	
	/* Kraj mjerenja izvršavanja Floyd-Warshall algoritma. */
	clock_t end = clock();
	double elapsedTime = double(end - begin) / CLOCKS_PER_SEC;
	
	//printMatrix(W, V); printMatrix(D, V); printMatrix(PI, V);
	
	/* Ispis rezultata u datoteku. */
	outputFile << "|V| = " << V << ", |E| = " << E << "\r\n\r\n";
	for (int i = 0; i < n; i++) {
		if (i%V==0) outputFile << "\r\n";
		if (D[i] < infty)
			outputFile << D[i] << "\t";
		else
			outputFile << "∞" << "\t";
	}
	outputFile << "\r\n\r\n";
	for (int i = 0; i < n; i++) {
		if (i%V==0) outputFile << "\r\n";
		outputFile << PI[i] << "\t";
	}
	
	cout << "Vrijeme izvršavanja Floyd-Warshall algoritma: " << elapsedTime << "s.\r\n";
	
	if (checkSolutionCorrectness(W, D, PI, V) == true)
		cout << "Svi najkraći putevi su točno izračunati!\r\n";
	else
		cout << "Najkraći putevi nisu točno izračunati.\r\n";
	
	inputGraphFile.close();
	outputFile.close();
	free(W); free(D); free(PI);
	
	return 0;
}
	.text
	.file	"fw_cuda.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z11printMatrixPij              # -- Begin function _Z11printMatrixPij
	.type	_Z11printMatrixPij,@function
_Z11printMatrixPij:                     # @_Z11printMatrixPij
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	%esi, %ebx
	movq	%rdi, %r14
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$2, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebx, %eax
	imull	%ebx, %eax
	testl	%eax, %eax
	je	.LBB0_8
# %bb.1:                                # %.lr.ph.preheader
	movl	%eax, %r13d
	xorl	%r15d, %r15d
.LBB0_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	(%r14,%r15,4), %esi
	cmpl	$2147483647, %esi               # imm = 0x7FFFFFFF
	jne	.LBB0_3
# %bb.4:                                #   in Loop: Header=BB0_2 Depth=1
	movl	$_ZSt4cout, %r12d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$3, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB0_5
.LBB0_3:                                #   in Loop: Header=BB0_2 Depth=1
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	movq	%rax, %r12
.LBB0_5:                                #   in Loop: Header=BB0_2 Depth=1
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%r12, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	incq	%r15
	movl	%r15d, %eax
	xorl	%edx, %edx
	divl	%ebx
	testl	%edx, %edx
	jne	.LBB0_7
# %bb.6:                                #   in Loop: Header=BB0_2 Depth=1
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$2, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.LBB0_7:                                #   in Loop: Header=BB0_2 Depth=1
	cmpq	%r15, %r13
	jne	.LBB0_2
.LBB0_8:                                # %._crit_edge
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z11printMatrixPij, .Lfunc_end0-_Z11printMatrixPij
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__FW_CudaiPiS_j # -- Begin function _Z22__device_stub__FW_CudaiPiS_j
	.type	_Z22__device_stub__FW_CudaiPiS_j,@function
_Z22__device_stub__FW_CudaiPiS_j:       # @_Z22__device_stub__FW_CudaiPiS_j
	.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	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z7FW_CudaiPiS_j, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	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_end1:
	.size	_Z22__device_stub__FW_CudaiPiS_j, .Lfunc_end1-_Z22__device_stub__FW_CudaiPiS_j
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z19Floyd_Warshall_CudaPiS_S_j
.LCPI2_0:
	.long	0x3d000000                      # float 0.03125
	.text
	.globl	_Z19Floyd_Warshall_CudaPiS_S_j
	.type	_Z19Floyd_Warshall_CudaPiS_S_j,@function
_Z19Floyd_Warshall_CudaPiS_S_j:         # @_Z19Floyd_Warshall_CudaPiS_S_j
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%ecx, %ebp
	movq	%rdx, %r14
	movq	%rsi, %r15
	movl	%ecx, %ebx
	imull	%ebx, %ebx
	leaq	8(%rsp), %rdi
	movq	$0, (%rdi)
	shlq	$2, %rbx
	movq	%rbx, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB2_1
# %bb.3:
	movq	%rsp, %rdi
	movq	$0, (%rdi)
	movq	%rbx, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB2_4
# %bb.5:
	movq	8(%rsp), %rdi
	movq	%r15, %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_6
# %bb.7:
	movq	(%rsp), %rdi
	movq	%r14, 16(%rsp)                  # 8-byte Spill
	movq	%r14, %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_8
# %bb.9:
	movl	%ebp, %eax
	cvtsi2ss	%rax, %xmm0
	mulss	.LCPI2_0(%rip), %xmm0
	callq	ceilf@PLT
	cvttss2si	%xmm0, %r12d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.7, %esi
	movl	$27, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%r12d, %esi
	imull	%r12d, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	movq	%rax, %r14
	movl	$.L.str.8, %esi
	movl	$11, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r14, %rdi
	movl	$1024, %esi                     # imm = 0x400
	callq	_ZNSolsEi
	movl	$.L.str.9, %esi
	movl	$22, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	testl	%ebp, %ebp
	je	.LBB2_16
# %bb.10:                               # %.lr.ph
	movl	%r12d, %eax
	movq	%rax, %r12
	shlq	$32, %r12
	orq	%rax, %r12
	xorl	%r13d, %r13d
	movabsq	$137438953504, %r14             # imm = 0x2000000020
.LBB2_11:                               # =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_13
# %bb.12:                               #   in Loop: Header=BB2_11 Depth=1
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	movl	%r13d, %edi
	movl	%ebp, %ecx
	callq	_Z22__device_stub__FW_CudaiPiS_j
.LBB2_13:                               #   in Loop: Header=BB2_11 Depth=1
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB2_14
# %bb.15:                               #   in Loop: Header=BB2_11 Depth=1
	callq	hipDeviceSynchronize
	incl	%r13d
	cmpl	%r13d, %ebp
	jne	.LBB2_11
.LBB2_16:                               # %._crit_edge
	movq	8(%rsp), %rsi
	movq	%r15, %rdi
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_17
# %bb.18:
	movq	(%rsp), %rsi
	movq	16(%rsp), %rdi                  # 8-byte Reload
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_19
# %bb.20:
	movq	8(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB2_21
# %bb.22:
	movq	(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB2_23
# %bb.24:
	callq	hipDeviceReset
	testl	%eax, %eax
	jne	.LBB2_25
# %bb.26:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB2_14:
	.cfi_def_cfa_offset 80
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.10, %esi
.LBB2_2:
	movq	%rbx, %rdi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.LBB2_1:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.3, %esi
	jmp	.LBB2_2
.LBB2_4:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.4, %esi
	jmp	.LBB2_2
.LBB2_6:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.5, %esi
	jmp	.LBB2_2
.LBB2_8:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.6, %esi
	jmp	.LBB2_2
.LBB2_17:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.11, %esi
	jmp	.LBB2_2
.LBB2_19:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	jmp	.LBB2_2
.LBB2_21:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.13, %esi
	jmp	.LBB2_2
.LBB2_23:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.14, %esi
	jmp	.LBB2_2
.LBB2_25:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.15, %esi
	jmp	.LBB2_2
.Lfunc_end2:
	.size	_Z19Floyd_Warshall_CudaPiS_S_j, .Lfunc_end2-_Z19Floyd_Warshall_CudaPiS_S_j
	.cfi_endproc
                                        # -- End function
	.globl	_Z7getPathPiS_iij               # -- Begin function _Z7getPathPiS_iij
	.type	_Z7getPathPiS_iij,@function
_Z7getPathPiS_iij:                      # @_Z7getPathPiS_iij
	.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	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	xorl	%r15d, %r15d
	cmpl	%ecx, %edx
	je	.LBB3_4
# %bb.1:
	movl	%r8d, %r14d
	movl	%ecx, %ebp
	movl	%r8d, %eax
	imull	%edx, %eax
	addl	%ecx, %eax
	movl	(%rsi,%rax,4), %r12d
	movl	$2147483647, %r15d              # imm = 0x7FFFFFFF
	cmpl	$-1, %r12d
	je	.LBB3_4
# %bb.2:
	movq	%rdi, %rbx
	movl	%r12d, %ecx
	movl	%r14d, %r8d
	callq	_Z7getPathPiS_iij
	cmpl	$2147483647, %eax               # imm = 0x7FFFFFFF
	je	.LBB3_4
# %bb.3:
	imull	%r14d, %r12d
	addl	%ebp, %r12d
	addl	(%rbx,%r12,4), %eax
	movl	%eax, %r15d
.LBB3_4:
	movl	%r15d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z7getPathPiS_iij, .Lfunc_end3-_Z7getPathPiS_iij
	.cfi_endproc
                                        # -- End function
	.globl	_Z24checkSolutionCorrectnessPiS_S_j # -- Begin function _Z24checkSolutionCorrectnessPiS_S_j
	.type	_Z24checkSolutionCorrectnessPiS_S_j,@function
_Z24checkSolutionCorrectnessPiS_S_j:    # @_Z24checkSolutionCorrectnessPiS_S_j
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, 16(%rsp)                  # 8-byte Spill
	movq	%rsi, 8(%rsp)                   # 8-byte Spill
	testl	%ecx, %ecx
	je	.LBB4_1
# %bb.2:                                # %.preheader.preheader
	movl	%ecx, %ebx
	movq	%rdi, %r12
	movl	%ecx, %r14d
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	xorl	%ebp, %ebp
.LBB4_3:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_5 Depth 2
	movq	%rax, (%rsp)                    # 8-byte Spill
	xorl	%r13d, %r13d
.LBB4_5:                                #   Parent Loop BB4_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	%r12, %rdi
	movq	16(%rsp), %rsi                  # 8-byte Reload
	movl	%ebp, %edx
	movl	%r13d, %ecx
	movl	%ebx, %r8d
	callq	_Z7getPathPiS_iij
	leal	(%r15,%r13), %ecx
	movq	8(%rsp), %rdx                   # 8-byte Reload
	cmpl	(%rdx,%rcx,4), %eax
	jne	.LBB4_6
# %bb.4:                                #   in Loop: Header=BB4_5 Depth=2
	incq	%r13
	cmpq	%r13, %r14
	jne	.LBB4_5
# %bb.7:                                #   in Loop: Header=BB4_3 Depth=1
	incl	%ebp
	cmpl	%ebx, %ebp
	setae	%al
	addq	%r14, %r15
	cmpl	%r14d, %ebp
	jne	.LBB4_3
	jmp	.LBB4_8
.LBB4_6:
	movq	(%rsp), %rax                    # 8-byte Reload
	jmp	.LBB4_8
.LBB4_1:
	movb	$1, %al
.LBB4_8:                                # %.thread
	andb	$1, %al
                                        # kill: def $al killed $al killed $rax
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z24checkSolutionCorrectnessPiS_S_j, .Lfunc_end4-_Z24checkSolutionCorrectnessPiS_S_j
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI5_0:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$1080, %rsp                     # imm = 0x438
	.cfi_def_cfa_offset 1136
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	560(%rsp), %rbx
	movq	%rbx, %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev
.Ltmp0:
	movl	$.L.str.16, %esi
	movq	%rbx, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp1:
# %bb.1:
.Ltmp3:
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp4:
# %bb.2:
.Ltmp6:
	leaq	48(%rsp), %rdi
	movl	$.L.str.17, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp7:
# %bb.3:
.Ltmp8:
	leaq	560(%rsp), %rdi
	movq	%rsp, %rsi
	callq	_ZNSi10_M_extractIjEERSiRT_
.Ltmp9:
# %bb.4:                                # %_ZNSirsERj.exit
.Ltmp10:
	leaq	4(%rsp), %rsi
	movq	%rax, %rdi
	callq	_ZNSi10_M_extractIjEERSiRT_
.Ltmp11:
# %bb.5:                                # %_ZNSirsERj.exit69
.Ltmp12:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.18, %esi
	movl	$4, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp13:
# %bb.6:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movl	(%rsp), %esi
.Ltmp14:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
.Ltmp15:
# %bb.7:                                # %_ZNSolsEj.exit
.Ltmp16:
	movq	%rax, %rbx
	movl	$.L.str.19, %esi
	movl	$6, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp17:
# %bb.8:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit70
	movl	4(%rsp), %esi
.Ltmp18:
	movq	%rbx, %rdi
	callq	_ZNSo9_M_insertImEERSoT_
.Ltmp19:
# %bb.9:                                # %_ZNSolsEj.exit71
.Ltmp20:
	movl	$.L.str, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp21:
# %bb.10:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit72
	movl	(%rsp), %r13d
	movl	%r13d, %r14d
	imull	%r14d, %r14d
	leaq	(,%r14,4), %r12
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, %rbx
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movq	%r14, 24(%rsp)                  # 8-byte Spill
	testl	%r14d, %r14d
	je	.LBB5_14
# %bb.11:
	xorl	%eax, %eax
.LBB5_12:                               # %.lr.ph.i.i.i.i
                                        # =>This Inner Loop Header: Depth=1
	movl	$2147483647, (%rbx,%rax)        # imm = 0x7FFFFFFF
	addq	$4, %rax
	cmpq	%rax, %r12
	jne	.LBB5_12
# %bb.13:                               # %_ZSt6fill_nIPijiET_S1_T0_RKT1_.exit
	movq	8(%rsp), %rdi                   # 8-byte Reload
	movl	$255, %esi
	movq	%r12, %rdx
	callq	memset@PLT
.LBB5_14:                               # %_ZSt6fill_nIPijiET_S1_T0_RKT1_.exit77
	cmpl	$0, 4(%rsp)
	je	.LBB5_22
# %bb.15:                               # %.lr.ph.preheader
	xorl	%ebp, %ebp
	leaq	40(%rsp), %r14
	leaq	36(%rsp), %r15
.LBB5_16:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
.Ltmp23:
	leaq	560(%rsp), %rdi
	leaq	44(%rsp), %rsi
	callq	_ZNSirsERi
.Ltmp24:
# %bb.17:                               #   in Loop: Header=BB5_16 Depth=1
.Ltmp25:
	movq	%rax, %rdi
	movq	%r14, %rsi
	callq	_ZNSirsERi
.Ltmp26:
# %bb.18:                               #   in Loop: Header=BB5_16 Depth=1
.Ltmp27:
	movq	%rax, %rdi
	movq	%r15, %rsi
	callq	_ZNSirsERi
.Ltmp28:
# %bb.19:                               #   in Loop: Header=BB5_16 Depth=1
	movl	36(%rsp), %edx
	movl	44(%rsp), %eax
	movl	(%rsp), %r13d
	movl	%r13d, %ecx
	imull	%eax, %ecx
	movl	40(%rsp), %esi
	addl	%esi, %ecx
	movl	%edx, (%rbx,%rcx,4)
	cmpl	%esi, %eax
	je	.LBB5_21
# %bb.20:                               #   in Loop: Header=BB5_16 Depth=1
	movq	8(%rsp), %rdx                   # 8-byte Reload
	movl	%eax, (%rdx,%rcx,4)
.LBB5_21:                               #   in Loop: Header=BB5_16 Depth=1
	incl	%ebp
	cmpl	4(%rsp), %ebp
	jb	.LBB5_16
.LBB5_22:                               # %.preheader
	testl	%r13d, %r13d
	je	.LBB5_25
# %bb.23:                               # %.lr.ph98
	movl	%r13d, %eax
	incl	%r13d
	xorl	%ecx, %ecx
.LBB5_24:                               # =>This Inner Loop Header: Depth=1
	movl	%ecx, %edx
	movl	$0, (%rbx,%rdx,4)
	addl	%r13d, %ecx
	decq	%rax
	jne	.LBB5_24
.LBB5_25:                               # %._crit_edge
	movq	16(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	callq	memcpy@PLT
	callq	clock
	movq	%rax, %r15
	movl	(%rsp), %ecx
.Ltmp30:
	movq	%r14, %rsi
	movq	8(%rsp), %rdx                   # 8-byte Reload
	callq	_Z19Floyd_Warshall_CudaPiS_S_j
.Ltmp31:
# %bb.26:
	callq	clock
	movq	%rax, %r13
.Ltmp33:
	leaq	48(%rsp), %rdi
	movl	$.L.str.20, %esi
	movl	$6, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp34:
# %bb.27:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit78
	movl	(%rsp), %esi
.Ltmp35:
	leaq	48(%rsp), %rbp
	movq	%rbp, %rdi
	callq	_ZNSo9_M_insertImEERSoT_
.Ltmp36:
# %bb.28:                               # %_ZNSolsEj.exit79
.Ltmp37:
	movq	%rax, %r14
	movl	$.L.str.21, %esi
	movl	$8, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp38:
# %bb.29:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit80
	movl	4(%rsp), %esi
.Ltmp39:
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertImEERSoT_
.Ltmp40:
# %bb.30:                               # %_ZNSolsEj.exit81
.Ltmp41:
	movl	$.L.str.22, %esi
	movl	$4, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp42:
# %bb.31:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit82.preheader
	cmpq	$0, 24(%rsp)                    # 8-byte Folded Reload
	je	.LBB5_40
# %bb.32:                               # %.lr.ph100.preheader
	xorl	%r12d, %r12d
.LBB5_33:                               # %.lr.ph100
                                        # =>This Inner Loop Header: Depth=1
	movl	%r12d, %eax
	xorl	%edx, %edx
	divl	(%rsp)
	testl	%edx, %edx
	jne	.LBB5_35
# %bb.34:                               #   in Loop: Header=BB5_33 Depth=1
.Ltmp43:
	movl	$.L.str, %esi
	movl	$2, %edx
	movq	%rbp, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp44:
.LBB5_35:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit84
                                        #   in Loop: Header=BB5_33 Depth=1
	movq	16(%rsp), %rax                  # 8-byte Reload
	movl	(%rax,%r12,4), %esi
	cmpl	$2147483647, %esi               # imm = 0x7FFFFFFF
	jne	.LBB5_37
# %bb.36:                               #   in Loop: Header=BB5_33 Depth=1
.Ltmp47:
	movl	$.L.str.2, %esi
	movl	$3, %edx
	movq	%rbp, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp48:
	movq	%rbp, %rax
	jmp	.LBB5_38
.LBB5_37:                               #   in Loop: Header=BB5_33 Depth=1
.Ltmp45:
	movq	%rbp, %rdi
	callq	_ZNSolsEi
.Ltmp46:
.LBB5_38:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit86.invoke
                                        #   in Loop: Header=BB5_33 Depth=1
.Ltmp49:
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp50:
# %bb.39:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit85
                                        #   in Loop: Header=BB5_33 Depth=1
	incq	%r12
	cmpq	%r12, 24(%rsp)                  # 8-byte Folded Reload
	jne	.LBB5_33
.LBB5_40:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit82._crit_edge
.Ltmp52:
	leaq	48(%rsp), %rdi
	movl	$.L.str.22, %esi
	movl	$4, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp53:
	movq	8(%rsp), %r12                   # 8-byte Reload
# %bb.41:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit83.preheader
	movq	%r15, %rbp
	cmpq	$0, 24(%rsp)                    # 8-byte Folded Reload
	je	.LBB5_48
# %bb.42:                               # %.lr.ph102.preheader
	xorl	%r14d, %r14d
	leaq	48(%rsp), %r15
.LBB5_43:                               # %.lr.ph102
                                        # =>This Inner Loop Header: Depth=1
	movl	%r14d, %eax
	xorl	%edx, %edx
	divl	(%rsp)
	testl	%edx, %edx
	jne	.LBB5_45
# %bb.44:                               #   in Loop: Header=BB5_43 Depth=1
.Ltmp54:
	movl	$.L.str, %esi
	movl	$2, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp55:
.LBB5_45:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit89
                                        #   in Loop: Header=BB5_43 Depth=1
	movl	(%r12,%r14,4), %esi
.Ltmp56:
	movq	%r15, %rdi
	callq	_ZNSolsEi
.Ltmp57:
# %bb.46:                               #   in Loop: Header=BB5_43 Depth=1
.Ltmp58:
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp59:
# %bb.47:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit90
                                        #   in Loop: Header=BB5_43 Depth=1
	incq	%r14
	cmpq	%r14, 24(%rsp)                  # 8-byte Folded Reload
	jne	.LBB5_43
.LBB5_48:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit83._crit_edge
.Ltmp61:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.23, %esi
	movl	$47, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp62:
# %bb.49:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit88
.Ltmp63:
	subq	%rbp, %r13
	cvtsi2sd	%r13, %xmm0
	divsd	.LCPI5_0(%rip), %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp64:
# %bb.50:                               # %_ZNSolsEd.exit
.Ltmp65:
	movl	$.L.str.24, %esi
	movl	$4, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp66:
# %bb.51:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit91
	movl	(%rsp), %ecx
	movq	%rbx, %rdi
	movq	16(%rsp), %rsi                  # 8-byte Reload
	movq	%r12, %rdx
	callq	_Z24checkSolutionCorrectnessPiS_S_j
	movl	$.L.str.25, %ecx
	movl	$.L.str.26, %esi
	testb	%al, %al
	cmovneq	%rcx, %rsi
	movzbl	%al, %eax
	leaq	43(,%rax,2), %rdx
.Ltmp67:
	movl	$_ZSt4cout, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp68:
# %bb.52:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit92
.Ltmp69:
	leaq	560(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp70:
# %bb.53:
.Ltmp71:
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp72:
# %bb.54:
	movq	%rbx, %rdi
	callq	free
	movq	16(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	%r12, %rdi
	callq	free
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	56(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 48(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	296(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	leaq	560(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	xorl	%eax, %eax
	addq	$1080, %rsp                     # imm = 0x438
	.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
.LBB5_55:
	.cfi_def_cfa_offset 1136
.Ltmp32:
	jmp	.LBB5_64
.LBB5_56:
.Ltmp5:
	jmp	.LBB5_58
.LBB5_57:
.Ltmp2:
.LBB5_58:
	movq	%rax, %rbx
	jmp	.LBB5_65
.LBB5_59:
.Ltmp22:
	jmp	.LBB5_64
.LBB5_60:
.Ltmp73:
	jmp	.LBB5_64
.LBB5_61:
.Ltmp60:
	jmp	.LBB5_64
.LBB5_62:
.Ltmp51:
	jmp	.LBB5_64
.LBB5_63:
.Ltmp29:
.LBB5_64:
	movq	%rax, %rbx
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
.LBB5_65:
	leaq	560(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end5:
	.size	main, .Lfunc_end5-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table5:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp4-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp4
	.uleb128 .Ltmp5-.Lfunc_begin0           #     jumps to .Ltmp5
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp21-.Ltmp6                 #   Call between .Ltmp6 and .Ltmp21
	.uleb128 .Ltmp22-.Lfunc_begin0          #     jumps to .Ltmp22
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp21-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp23-.Ltmp21                #   Call between .Ltmp21 and .Ltmp23
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp23-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp28-.Ltmp23                #   Call between .Ltmp23 and .Ltmp28
	.uleb128 .Ltmp29-.Lfunc_begin0          #     jumps to .Ltmp29
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp28-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp30-.Ltmp28                #   Call between .Ltmp28 and .Ltmp30
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp30-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp31-.Ltmp30                #   Call between .Ltmp30 and .Ltmp31
	.uleb128 .Ltmp32-.Lfunc_begin0          #     jumps to .Ltmp32
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp33-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp42-.Ltmp33                #   Call between .Ltmp33 and .Ltmp42
	.uleb128 .Ltmp73-.Lfunc_begin0          #     jumps to .Ltmp73
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp43-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp50-.Ltmp43                #   Call between .Ltmp43 and .Ltmp50
	.uleb128 .Ltmp51-.Lfunc_begin0          #     jumps to .Ltmp51
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp52-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp53-.Ltmp52                #   Call between .Ltmp52 and .Ltmp53
	.uleb128 .Ltmp73-.Lfunc_begin0          #     jumps to .Ltmp73
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp54-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp59-.Ltmp54                #   Call between .Ltmp54 and .Ltmp59
	.uleb128 .Ltmp60-.Lfunc_begin0          #     jumps to .Ltmp60
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp61-.Lfunc_begin0          # >> Call Site 13 <<
	.uleb128 .Ltmp72-.Ltmp61                #   Call between .Ltmp61 and .Ltmp72
	.uleb128 .Ltmp73-.Lfunc_begin0          #     jumps to .Ltmp73
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp72-.Lfunc_begin0          # >> Call Site 14 <<
	.uleb128 .Lfunc_end5-.Ltmp72            #   Call between .Ltmp72 and .Lfunc_end5
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB6_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB6_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z7FW_CudaiPiS_j, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end6:
	.size	__hip_module_ctor, .Lfunc_end6-__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	.LBB7_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
.LBB7_2:
	retq
.Lfunc_end7:
	.size	__hip_module_dtor, .Lfunc_end7-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"\r\n"
	.size	.L.str, 3

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"\342\210\236"
	.size	.L.str.2, 4

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

	.type	.L.str.3,@object                # @.str.3
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.3:
	.asciz	"Neuspje\305\241no alociranje matrice D (error code %s)!\n"
	.size	.L.str.3, 51

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Neuspje\305\241no alociranje matrice PI (error code %s)!\n"
	.size	.L.str.4, 52

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Neuspje\305\241no kopiranje matrice D iz hosta u device (error code %s)!\n"
	.size	.L.str.5, 68

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Neuspje\305\241no kopiranje matrice PI iz hosta u device (error code %s)!\n"
	.size	.L.str.6, 69

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"CUDA kernel se pokre\304\207e sa "
	.size	.L.str.7, 28

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	" blokova i "
	.size	.L.str.8, 12

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	" threadova po bloku.\r\n"
	.size	.L.str.9, 23

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Neuspje\305\241no pokrenuta kernel metoda (error code %s)!\n"
	.size	.L.str.10, 54

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Neuspje\305\241no kopiranje matrice D iz devicea u host (error code %s)!\n"
	.size	.L.str.11, 68

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Neuspje\305\241no kopiranje matrice PI iz devicea u host (error code %s)!\n"
	.size	.L.str.12, 69

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Neuspje\305\241no dealociranje matrice D (error code %s)!\n"
	.size	.L.str.13, 53

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Neuspje\305\241no dealociranje matrice PI (error code %s)!\n"
	.size	.L.str.14, 54

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"Neuspje\305\241no resetiranje devicea (zavr\305\241avanje sa CUDA FW, priprema za sljede\304\207e pokretanje)! error=%s\n"
	.size	.L.str.15, 103

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"graphFile.txt"
	.size	.L.str.16, 14

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"output_cuda.txt"
	.size	.L.str.17, 16

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"V = "
	.size	.L.str.18, 5

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	", E = "
	.size	.L.str.19, 7

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"|V| = "
	.size	.L.str.20, 7

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	", |E| = "
	.size	.L.str.21, 9

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"\r\n\r\n"
	.size	.L.str.22, 5

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"Vrijeme izvr\305\241avanja Floyd-Warshall algoritma: "
	.size	.L.str.23, 48

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	"s.\r\n"
	.size	.L.str.24, 5

	.type	.L.str.25,@object               # @.str.25
.L.str.25:
	.asciz	"Svi najkra\304\207i putevi su to\304\215no izra\304\215unati!\r\n"
	.size	.L.str.25, 46

	.type	.L.str.26,@object               # @.str.26
.L.str.26:
	.asciz	"Najkra\304\207i putevi nisu to\304\215no izra\304\215unati.\r\n"
	.size	.L.str.26, 44

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z7FW_CudaiPiS_j"
	.size	.L__unnamed_1, 17

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

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

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z7FW_CudaiPiS_j        ; -- Begin function _Z7FW_CudaiPiS_j
	.globl	_Z7FW_CudaiPiS_j
	.p2align	8
	.type	_Z7FW_CudaiPiS_j,@function
_Z7FW_CudaiPiS_j:                       ; @_Z7FW_CudaiPiS_j
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s4, s[0:1], 0x18
	v_bfe_u32 v1, v0, 10, 10
	v_and_b32_e32 v4, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s3, s2, 16
	s_and_b32 s2, s2, 0xffff
	v_mad_u64_u32 v[2:3], null, s15, s3, v[1:2]
	v_mad_u64_u32 v[0:1], null, s14, s2, v[4:5]
	s_mov_b32 s2, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_max_u32_e32 v1, v2, v0
	v_cmpx_gt_u32_e64 s4, v1
	s_cbranch_execz .LBB0_5
; %bb.1:
	s_clause 0x1
	s_load_b32 s5, s[0:1], 0x0
	s_load_b128 s[0:3], s[0:1], 0x8
	v_mul_lo_u32 v3, v2, s4
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_mov_b32 v2, 0 :: v_dual_add_nc_u32 v1, s5, v3
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v4, vcc_lo, s0, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s1, v5, vcc_lo
	global_load_b32 v7, v[4:5], off
	s_waitcnt vmcnt(0)
	v_cmp_ne_u32_e32 vcc_lo, 0x7fffffff, v7
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_5
; %bb.2:
	v_mad_u64_u32 v[4:5], null, s4, s5, v[0:1]
	v_mov_b32_e32 v5, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 2, v[4:5]
	v_add_co_u32 v4, vcc_lo, s0, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s1, v2, vcc_lo
	global_load_b32 v8, v[4:5], off
	s_waitcnt vmcnt(0)
	v_cmp_ne_u32_e32 vcc_lo, 0x7fffffff, v8
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_5
; %bb.3:
	v_dual_mov_b32 v4, 0 :: v_dual_add_nc_u32 v3, v3, v0
	v_add_nc_u32_e32 v0, v8, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	v_add_co_u32 v5, vcc_lo, s0, v3
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v6, vcc_lo, s1, v4, vcc_lo
	global_load_b32 v9, v[5:6], off
	s_waitcnt vmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, v9, v0
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_5
; %bb.4:
	v_add_co_u32 v1, vcc_lo, s2, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s3, v2, vcc_lo
	global_store_b32 v[5:6], v0, off
	v_add_co_u32 v0, vcc_lo, s2, v3
	global_load_b32 v2, v[1:2], off
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v4, vcc_lo
	s_waitcnt vmcnt(0)
	global_store_b32 v[0:1], v2, off
.LBB0_5:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7FW_CudaiPiS_j
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 10
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z7FW_CudaiPiS_j, .Lfunc_end0-_Z7FW_CudaiPiS_j
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 384
; NumSgprs: 18
; NumVgprs: 10
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 10
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.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:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .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:           _Z7FW_CudaiPiS_j
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z7FW_CudaiPiS_j.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     10
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
