/*
 * This is a CUDA version of bellman_ford algorithm
 * Compile: nvcc -std=c++11 -arch=sm_52 -o cuda_bellman_ford cuda_bellman_ford.cu
 * Run: ./cuda_bellman_ford <input file> <number of blocks per grid> <number of threads per block>, you will find the output file 'output.txt'
 * */

#include <string>
#include <cassert>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <sys/time.h>

#include <cuda_runtime.h>
#include <device_launch_parameters.h>

using std::string;
using std::cout;
using std::endl;

#define INF 1000000

/*
 * This is a CHECK function to check CUDA calls
 */
#define CHECK(call)                                                            \
		{                                                                              \
	const cudaError_t error = call;                                            \
	if (error != cudaSuccess)                                                  \
	{                                                                          \
		fprintf(stderr, "Error: %s:%d, ", __FILE__, __LINE__);                 \
		fprintf(stderr, "code: %d, reason: %s\n", error,                       \
				cudaGetErrorString(error));                                    \
				exit(1);                                                               \
	}                                                                          \
		}


/**
 * utils is a namespace for utility functions
 * including I/O (read input file and print results) and matrix dimension convert(2D->1D) function
 */
namespace utils {
int N; //number of vertices
int *mat; // the adjacency matrix

void abort_with_error_message(string msg) {
	std::cerr << msg << endl;
	abort();
}

//translate 2-dimension coordinate to 1-dimension
int convert_dimension_2D_1D(int x, int y, int n) {
	return x * n + y;
}

int read_file(string filename) {
	std::ifstream inputf(filename, std::ifstream::in);
	if (!inputf.good()) {
		abort_with_error_message("ERROR OCCURRED WHILE READING INPUT FILE");
	}
	inputf >> N;
	//input matrix should be smaller than 20MB * 20MB (400MB, we don't have too much memory for multi-processors)
	assert(N < (1024 * 1024 * 20));
	mat = (int *) malloc(N * N * sizeof(int));
	for (int i = 0; i < N; i++)
		for (int j = 0; j < N; j++) {
			inputf >> mat[convert_dimension_2D_1D(i, j, N)];
		}
	return 0;
}

int print_result(bool has_negative_cycle, int *dist) {
	std::ofstream outputf("output.txt", std::ofstream::out);
	if (!has_negative_cycle) {
		for (int i = 0; i < N; i++) {
			if (dist[i] > INF)
				dist[i] = INF;
			outputf << dist[i] << '\n';
		}
		outputf.flush();
	} else {
		outputf << "FOUND NEGATIVE CYCLE!" << endl;
	}
	outputf.close();
	return 0;
}
}//namespace utils


__global__ void bellman_ford_one_iter(int n, int *d_mat, int *d_dist, bool *d_has_next, int iter_num){
	int global_tid = blockDim.x * blockIdx.x + threadIdx.x;
	int elementSkip = blockDim.x * gridDim.x;

	if(global_tid >= n) return;
	for(int u = 0 ; u < n ; u ++){
		for(int v = global_tid; v < n; v+= elementSkip){
			int weight = d_mat[u * n + v];
			if(weight < INF){
				int new_dist = d_dist[u] + weight;
				if(new_dist < d_dist[v]){
					d_dist[v] = new_dist;
					*d_has_next = true;
				}
			}
		}
	}

}

/**
 * Bellman-Ford algorithm. Find the shortest path from vertex 0 to other vertices.
 * @param blockPerGrid number of blocks per grid
 * @param threadsPerBlock number of threads per block
 * @param n input size
 * @param *mat input adjacency matrix
 * @param *dist distance array
 * @param *has_negative_cycle a bool variable to recode if there are negative cycles
 */
void bellman_ford(int blocksPerGrid, int threadsPerBlock, int n, int *mat, int *dist, bool *has_negative_cycle) {
	dim3 blocks(blocksPerGrid);
	dim3 threads(threadsPerBlock);

	int iter_num = 0;
	int *d_mat, *d_dist;
	bool *d_has_next, h_has_next;

	cudaMalloc(&d_mat, sizeof(int) * n * n);
	cudaMalloc(&d_dist, sizeof(int) *n);
	cudaMalloc(&d_has_next, sizeof(bool));


	*has_negative_cycle = false;

	for(int i = 0 ; i < n; i ++){
		dist[i] = INF;
	}

	dist[0] = 0;
	cudaMemcpy(d_mat, mat, sizeof(int) * n * n, cudaMemcpyHostToDevice);
	cudaMemcpy(d_dist, dist, sizeof(int) * n, cudaMemcpyHostToDevice);

	for(;;){
		h_has_next = false;
		cudaMemcpy(d_has_next, &h_has_next, sizeof(bool), cudaMemcpyHostToDevice);

		bellman_ford_one_iter<<<blocks, threads>>>(n, d_mat, d_dist, d_has_next, iter_num);
		CHECK(cudaDeviceSynchronize());
		cudaMemcpy(&h_has_next, d_has_next, sizeof(bool), cudaMemcpyDeviceToHost);

		iter_num++;
		if(iter_num >= n-1){
			*has_negative_cycle = true;
			break;
		}
		if(!h_has_next){
			break;
		}

	}
	if(! *has_negative_cycle){
		cudaMemcpy(dist, d_dist, sizeof(int) * n, cudaMemcpyDeviceToHost);
	}

	cudaFree(d_mat);
	cudaFree(d_dist);
	cudaFree(d_has_next);
}

int main(int argc, char **argv) {
	if (argc <= 1) {
		utils::abort_with_error_message("INPUT FILE WAS NOT FOUND!");
	}
	if (argc <= 3) {
		utils::abort_with_error_message("blocksPerGrid or threadsPerBlock WAS NOT FOUND!");
	}

	string filename = argv[1];
	int blockPerGrid = atoi(argv[2]);
	int threadsPerBlock = atoi(argv[3]);

	int *dist;
	bool has_negative_cycle = false;


	assert(utils::read_file(filename) == 0);
	dist = (int *) calloc(sizeof(int), utils::N);


	//time counter
	timeval start_wall_time_t, end_wall_time_t;
	float ms_wall;
	cudaDeviceReset();
	//start timer
	gettimeofday(&start_wall_time_t, nullptr);
	//bellman-ford algorithm
	bellman_ford(blockPerGrid, threadsPerBlock, utils::N, utils::mat, dist, &has_negative_cycle);
	CHECK(cudaDeviceSynchronize());
	//end timer
	gettimeofday(&end_wall_time_t, nullptr);
	ms_wall = ((end_wall_time_t.tv_sec - start_wall_time_t.tv_sec) * 1000 * 1000
			+ end_wall_time_t.tv_usec - start_wall_time_t.tv_usec) / 1000.0;

	std::cerr.setf(std::ios::fixed);
	std::cerr << std::setprecision(6) << "Time(s): " << (ms_wall/1000.0) << endl;
	utils::print_result(has_negative_cycle, dist);
	free(dist);
	free(utils::mat);

	return 0;
}

	.file	"tmpxft_0035841c_00000000-6_cuda_bellman_ford.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4267:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4267:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.type	_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, @function
_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE:
.LFB4259:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rdi, %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	call	abort@PLT
	.cfi_endproc
.LFE4259:
	.size	_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, .-_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.globl	_ZN5utils23convert_dimension_2D_1DEiii
	.type	_ZN5utils23convert_dimension_2D_1DEiii, @function
_ZN5utils23convert_dimension_2D_1DEiii:
.LFB4260:
	.cfi_startproc
	endbr64
	imull	%edx, %edi
	leal	(%rdi,%rsi), %eax
	ret
	.cfi_endproc
.LFE4260:
	.size	_ZN5utils23convert_dimension_2D_1DEiii, .-_ZN5utils23convert_dimension_2D_1DEiii
	.globl	_Z47__device_stub__Z21bellman_ford_one_iteriPiS_PbiiPiS_Pbi
	.type	_Z47__device_stub__Z21bellman_ford_one_iteriPiS_PbiiPiS_Pbi, @function
_Z47__device_stub__Z21bellman_ford_one_iteriPiS_PbiiPiS_Pbi:
.LFB4289:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movl	%edi, 28(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, 24(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movq	%rsp, %rax
	movq	%rax, 120(%rsp)
	leaq	24(%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	.L5
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z21bellman_ford_one_iteriPiS_Pbi(%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
.L5:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4289:
	.size	_Z47__device_stub__Z21bellman_ford_one_iteriPiS_PbiiPiS_Pbi, .-_Z47__device_stub__Z21bellman_ford_one_iteriPiS_PbiiPiS_Pbi
	.globl	_Z21bellman_ford_one_iteriPiS_Pbi
	.type	_Z21bellman_ford_one_iteriPiS_Pbi, @function
_Z21bellman_ford_one_iteriPiS_Pbi:
.LFB4290:
	.cfi_startproc
	endbr64
	jmp	_Z47__device_stub__Z21bellman_ford_one_iteriPiS_PbiiPiS_Pbi
	.cfi_endproc
.LFE4290:
	.size	_Z21bellman_ford_one_iteriPiS_Pbi, .-_Z21bellman_ford_one_iteriPiS_Pbi
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/qiansunn/BellmanFord/master/cuda_bellman_ford.cu"
.LC1:
	.string	"Error: %s:%d, "
.LC2:
	.string	"code: %d, reason: %s\n"
	.text
	.globl	_Z12bellman_fordiiiPiS_Pb
	.type	_Z12bellman_fordiiiPiS_Pb, @function
_Z12bellman_fordiiiPiS_Pb:
.LFB4263:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rcx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%r15, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	imulq	%r15, %r13
	movq	%r9, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r15, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r8, %rbx
	salq	$2, %r13
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	movl	%edi, 48(%rsp)
	leaq	24(%rsp), %rdi
	movabsq	$4294967297, %rax
	movl	%esi, 60(%rsp)
	movq	%r13, %rsi
	movq	%rax, 52(%rsp)
	movq	%rax, 64(%rsp)
	call	cudaMalloc@PLT
	leaq	0(,%r15,4), %rax
	leaq	32(%rsp), %rdi
	movq	%rax, %rsi
	movq	%rax, 8(%rsp)
	call	cudaMalloc@PLT
	leaq	40(%rsp), %rdi
	movl	$1, %esi
	call	cudaMalloc@PLT
	movb	$0, (%r12)
	xorl	%eax, %eax
.L12:
	cmpl	%eax, %ebp
	jle	.L22
	movl	$1000000, (%rbx,%rax,4)
	incq	%rax
	jmp	.L12
.L22:
	xorl	%eax, %eax
	movq	24(%rsp), %rdi
	movq	%r14, %rsi
	movl	$1, %ecx
	movl	%eax, (%rbx)
	movq	%r13, %rdx
	xorl	%r14d, %r14d
	leaq	23(%rsp), %r15
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdx
	movq	32(%rsp), %rdi
	movq	%rbx, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
.L18:
	movq	40(%rsp), %rdi
	movl	$1, %ecx
	movl	$1, %edx
	movq	%r15, %rsi
	movb	$0, 23(%rsp)
	call	cudaMemcpy@PLT
	movl	68(%rsp), %ecx
	movl	56(%rsp), %esi
	xorl	%r9d, %r9d
	movq	60(%rsp), %rdx
	movq	48(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L14
	movq	40(%rsp), %rcx
	movq	32(%rsp), %rdx
	movl	%r14d, %r8d
	movl	%ebp, %edi
	movq	24(%rsp), %rsi
	call	_Z47__device_stub__Z21bellman_ford_one_iteriPiS_PbiiPiS_Pbi
.L14:
	call	cudaDeviceSynchronize@PLT
	movl	%eax, %r13d
	testl	%eax, %eax
	je	.L15
	movq	stderr(%rip), %rdi
	movl	$150, %r8d
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rcx
	leaq	.LC1(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%r13d, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	%r13d, %ecx
	leaq	.LC2(%rip), %rdx
	movq	%rax, %r8
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L15:
	movq	40(%rsp), %rsi
	movl	$2, %ecx
	movq	%r15, %rdi
	incl	%r14d
	movl	$1, %edx
	call	cudaMemcpy@PLT
	leal	-1(%rbp), %eax
	cmpl	%r14d, %eax
	jg	.L16
	movb	$1, (%r12)
	jmp	.L17
.L16:
	cmpb	$0, 23(%rsp)
	jne	.L18
	cmpb	$0, (%r12)
	jne	.L17
	movq	8(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
.L17:
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	addq	$88, %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
.LFE4263:
	.size	_Z12bellman_fordiiiPiS_Pb, .-_Z12bellman_fordiiiPiS_Pb
	.section	.rodata.str1.1
.LC3:
	.string	"_Z21bellman_ford_one_iteriPiS_Pbi"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4292:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC3(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z21bellman_ford_one_iteriPiS_Pbi(%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
.LFE4292:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.str1.1,"aMS",@progbits,1
.LC4:
	.string	"basic_string: construction from null is not valid"
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_,comdat
	.align 2
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_:
.LFB4620:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	jne	.L26
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	leaq	.LC4(%rip), %rdi
	call	_ZSt19__throw_logic_errorPKc@PLT
.L26:
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	movq	%rsi, %rbp
	call	strlen@PLT
	movq	%rax, (%rsp)
	leaq	0(%rbp,%rax), %r12
	cmpq	$15, %rax
	jbe	.L28
	movq	%rsp, %rsi
	xorl	%edx, %edx
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
	movq	%rax, (%rbx)
	movq	(%rsp), %rax
	movq	%rax, 16(%rbx)
.L28:
	movq	(%rbx), %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	(%rsp), %rax
	movq	(%rbx), %rdx
	movq	%rax, 8(%rbx)
	movb	$0, (%rdx,%rax)
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L29
.L31:
	call	__stack_chk_fail@PLT
.L29:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4620:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	.set	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.section	.rodata.str1.1
.LC5:
	.string	"ERROR OCCURRED WHILE READING INPUT FILE"
	.text
	.globl	_ZN5utils9read_fileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.type	_ZN5utils9read_fileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, @function
_ZN5utils9read_fileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE:
.LFB4261:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4261
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rdi, %rsi
	movl	$8, %edx
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$576, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 568(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rbp
	movq	%rbp, %rdi
.LEHB0:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode@PLT
.LEHE0:
	cmpl	$0, 336(%rsp)
	je	.L33
	leaq	16(%rsp), %r12
	leaq	15(%rsp), %rdx
	leaq	.LC5(%rip), %rsi
	movq	%r12, %rdi
.LEHB1:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE1:
	movq	568(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L45
	movq	%r12, %rdi
.LEHB2:
	call	_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
.LEHE2:
.L33:
	leaq	_ZN5utils1NE(%rip), %rsi
	movq	%rbp, %rdi
.LEHB3:
	call	_ZNSirsERi@PLT
	movl	_ZN5utils1NE(%rip), %edi
	xorl	%ebx, %ebx
	imull	%edi, %edi
	movslq	%edi, %rdi
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, _ZN5utils3matE(%rip)
.L35:
	cmpl	%ebx, _ZN5utils1NE(%rip)
	jle	.L48
	xorl	%r12d, %r12d
.L37:
	movl	_ZN5utils1NE(%rip), %eax
	cmpl	%r12d, %eax
	jle	.L49
	imull	%ebx, %eax
	movq	_ZN5utils3matE(%rip), %rdx
	movq	%rbp, %rdi
	addl	%r12d, %eax
	cltq
	leaq	(%rdx,%rax,4), %rsi
	call	_ZNSirsERi@PLT
.LEHE3:
	incl	%r12d
	jmp	.L37
.L49:
	incl	%ebx
	jmp	.L35
.L48:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	568(%rsp), %rax
	subq	%fs:40, %rax
	je	.L41
	jmp	.L45
.L44:
	endbr64
	movq	%rax, %rbx
.L38:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L39
.L43:
	endbr64
	movq	%rax, %rbx
.L39:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	568(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L45
	movq	%rbx, %rdi
.LEHB4:
	call	_Unwind_Resume@PLT
.LEHE4:
.L45:
	call	__stack_chk_fail@PLT
.L41:
	addq	$576, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4261:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4261:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4261-.LLSDACSB4261
.LLSDACSB4261:
	.uleb128 .LEHB0-.LFB4261
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4261
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L43-.LFB4261
	.uleb128 0
	.uleb128 .LEHB2-.LFB4261
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L44-.LFB4261
	.uleb128 0
	.uleb128 .LEHB3-.LFB4261
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L43-.LFB4261
	.uleb128 0
	.uleb128 .LEHB4-.LFB4261
	.uleb128 .LEHE4-.LEHB4
	.uleb128 0
	.uleb128 0
.LLSDACSE4261:
	.text
	.size	_ZN5utils9read_fileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, .-_ZN5utils9read_fileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.section	.rodata.str1.1
.LC6:
	.string	"output.txt"
.LC7:
	.string	"FOUND NEGATIVE CYCLE!"
	.text
	.globl	_ZN5utils12print_resultEbPi
	.type	_ZN5utils12print_resultEbPi, @function
_ZN5utils12print_resultEbPi:
.LFB4262:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4262
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$16, %edx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rsi, %r12
	leaq	.LC6(%rip), %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$536, %rsp
	.cfi_def_cfa_offset 576
	movq	%fs:40, %rax
	movq	%rax, 520(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rbx
	movq	%rbx, %rdi
.LEHB5:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE5:
	testb	%bpl, %bpl
	jne	.L51
	xorl	%ebp, %ebp
	leaq	7(%rsp), %r13
.L52:
	cmpl	%ebp, _ZN5utils1NE(%rip)
	jle	.L66
	cmpl	$1000000, (%r12,%rbp,4)
	jle	.L53
	movl	$1000000, (%r12,%rbp,4)
.L53:
	movl	(%r12,%rbp,4), %esi
	movq	%rbx, %rdi
.LEHB6:
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movq	(%rax), %rax
	movb	$10, 7(%rsp)
	movq	-24(%rax), %rax
	cmpq	$0, 16(%rdi,%rax)
	je	.L54
	movl	$1, %edx
	movq	%r13, %rsi
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
.L55:
	incq	%rbp
	jmp	.L52
.L54:
	movl	$10, %esi
	call	_ZNSo3putEc@PLT
	jmp	.L55
.L66:
	movq	%rbx, %rdi
	call	_ZNSo5flushEv@PLT
.L58:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	jmp	.L67
.L51:
	leaq	.LC7(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.LEHE6:
	jmp	.L58
.L67:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	520(%rsp), %rax
	subq	%fs:40, %rax
	je	.L61
	jmp	.L64
.L62:
	endbr64
	movq	%rax, %rbp
.L59:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	520(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L64
	movq	%rbp, %rdi
.LEHB7:
	call	_Unwind_Resume@PLT
.LEHE7:
.L64:
	call	__stack_chk_fail@PLT
.L61:
	addq	$536, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4262:
	.section	.gcc_except_table
.LLSDA4262:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4262-.LLSDACSB4262
.LLSDACSB4262:
	.uleb128 .LEHB5-.LFB4262
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB6-.LFB4262
	.uleb128 .LEHE6-.LEHB6
	.uleb128 .L62-.LFB4262
	.uleb128 0
	.uleb128 .LEHB7-.LFB4262
	.uleb128 .LEHE7-.LEHB7
	.uleb128 0
	.uleb128 0
.LLSDACSE4262:
	.text
	.size	_ZN5utils12print_resultEbPi, .-_ZN5utils12print_resultEbPi
	.section	.rodata.str1.1
.LC8:
	.string	"INPUT FILE WAS NOT FOUND!"
.LC9:
	.string	"blocksPerGrid or threadsPerBlock WAS NOT FOUND!"
.LC11:
	.string	"Time(s): "
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4264:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4264
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$80, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	cmpl	$1, %edi
	leaq	24(%rsp), %r13
	leaq	40(%rsp), %rbx
	jg	.L69
	movq	%r13, %rdx
	leaq	.LC8(%rip), %rsi
	movq	%rbx, %rdi
.LEHB8:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE8:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L84
	movq	%rbx, %rdi
.LEHB9:
	call	_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
.LEHE9:
.L69:
	cmpl	$3, %edi
	jg	.L71
	movq	%r13, %rdx
	leaq	.LC9(%rip), %rsi
	movq	%rbx, %rdi
.LEHB10:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE10:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L84
	movq	%rbx, %rdi
.LEHB11:
	call	_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
.LEHE11:
.L71:
	movq	%rsi, %rbp
	movq	8(%rsi), %rsi
	movq	%r13, %rdx
	movq	%rbx, %rdi
.LEHB12:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE12:
	movq	16(%rbp), %rdi
	call	atoi@PLT
	movq	24(%rbp), %rdi
	movl	%eax, %r12d
	call	atoi@PLT
	movl	$4, %edi
	movb	$0, 7(%rsp)
	movslq	_ZN5utils1NE(%rip), %rsi
	movl	%eax, %r14d
	call	calloc@PLT
	movq	%rax, %rbp
.LEHB13:
	call	cudaDeviceReset@PLT
	leaq	8(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	leaq	7(%rsp), %r9
	movq	%rbp, %r8
	movl	%r14d, %esi
	movq	_ZN5utils3matE(%rip), %rcx
	movl	_ZN5utils1NE(%rip), %edx
	movl	%r12d, %edi
	call	_Z12bellman_fordiiiPiS_Pb
	call	cudaDeviceSynchronize@PLT
	movl	%eax, %r12d
	testl	%eax, %eax
	je	.L73
	movq	stderr(%rip), %rdi
	movl	$200, %r8d
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rcx
	leaq	.LC1(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%r12d, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movq	%rax, %r8
	movl	%r12d, %ecx
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L73:
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	gettimeofday@PLT
	movq	24(%rsp), %rax
	subq	8(%rsp), %rax
	leaq	_ZSt4cerr(%rip), %rdi
	imulq	$1000000, %rax, %rax
	addq	32(%rsp), %rax
	subq	16(%rsp), %rax
	cvtsi2sdq	%rax, %xmm0
	movq	_ZSt4cerr(%rip), %rax
	orl	$4, 32+_ZSt4cerr(%rip)
	leaq	.LC11(%rip), %rsi
	divsd	.LC10(%rip), %xmm0
	cvtsd2ss	%xmm0, %xmm1
	movd	%xmm1, %r14d
	movq	-24(%rax), %rax
	movq	$6, 8(%rdi,%rax)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movd	%r14d, %xmm2
	movq	%rax, %rdi
	cvtss2sd	%xmm2, %xmm0
	divsd	.LC10(%rip), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	movzbl	7(%rsp), %edi
	movq	%rbp, %rsi
	call	_ZN5utils12print_resultEbPi
.LEHE13:
	movq	%rbp, %rdi
	call	free@PLT
	movq	_ZN5utils3matE(%rip), %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L80
	jmp	.L84
.L81:
	endbr64
	jmp	.L87
.L82:
	endbr64
	jmp	.L87
.L83:
	endbr64
.L87:
	movq	%rax, %rbp
.L78:
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L84
	movq	%rbp, %rdi
.LEHB14:
	call	_Unwind_Resume@PLT
.LEHE14:
.L84:
	call	__stack_chk_fail@PLT
.L80:
	addq	$80, %rsp
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4264:
	.section	.gcc_except_table
.LLSDA4264:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4264-.LLSDACSB4264
.LLSDACSB4264:
	.uleb128 .LEHB8-.LFB4264
	.uleb128 .LEHE8-.LEHB8
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB9-.LFB4264
	.uleb128 .LEHE9-.LEHB9
	.uleb128 .L81-.LFB4264
	.uleb128 0
	.uleb128 .LEHB10-.LFB4264
	.uleb128 .LEHE10-.LEHB10
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB11-.LFB4264
	.uleb128 .LEHE11-.LEHB11
	.uleb128 .L82-.LFB4264
	.uleb128 0
	.uleb128 .LEHB12-.LFB4264
	.uleb128 .LEHE12-.LEHB12
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB13-.LFB4264
	.uleb128 .LEHE13-.LEHB13
	.uleb128 .L83-.LFB4264
	.uleb128 0
	.uleb128 .LEHB14-.LFB4264
	.uleb128 .LEHE14-.LEHB14
	.uleb128 0
	.uleb128 0
.LLSDACSE4264:
	.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
	.globl	_ZN5utils3matE
	.bss
	.align 8
	.type	_ZN5utils3matE, @object
	.size	_ZN5utils3matE, 8
_ZN5utils3matE:
	.zero	8
	.globl	_ZN5utils1NE
	.align 4
	.type	_ZN5utils1NE, @object
	.size	_ZN5utils1NE, 4
_ZN5utils1NE:
	.zero	4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC10:
	.long	0
	.long	1083129856
	.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:

/*
 * This is a CUDA version of bellman_ford algorithm
 * Compile: nvcc -std=c++11 -arch=sm_52 -o cuda_bellman_ford cuda_bellman_ford.cu
 * Run: ./cuda_bellman_ford <input file> <number of blocks per grid> <number of threads per block>, you will find the output file 'output.txt'
 * */

#include <string>
#include <cassert>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <sys/time.h>

#include <hip/hip_runtime.h>


using std::string;
using std::cout;
using std::endl;

#define INF 1000000

/*
 * This is a CHECK function to check CUDA calls
 */
#define CHECK(call)                                                            \
		{                                                                              \
	const hipError_t error = call;                                            \
	if (error != hipSuccess)                                                  \
	{                                                                          \
		fprintf(stderr, "Error: %s:%d, ", __FILE__, __LINE__);                 \
		fprintf(stderr, "code: %d, reason: %s\n", error,                       \
				hipGetErrorString(error));                                    \
				exit(1);                                                               \
	}                                                                          \
		}


/**
 * utils is a namespace for utility functions
 * including I/O (read input file and print results) and matrix dimension convert(2D->1D) function
 */
namespace utils {
int N; //number of vertices
int *mat; // the adjacency matrix

void abort_with_error_message(string msg) {
	std::cerr << msg << endl;
	abort();
}

//translate 2-dimension coordinate to 1-dimension
int convert_dimension_2D_1D(int x, int y, int n) {
	return x * n + y;
}

int read_file(string filename) {
	std::ifstream inputf(filename, std::ifstream::in);
	if (!inputf.good()) {
		abort_with_error_message("ERROR OCCURRED WHILE READING INPUT FILE");
	}
	inputf >> N;
	//input matrix should be smaller than 20MB * 20MB (400MB, we don't have too much memory for multi-processors)
	assert(N < (1024 * 1024 * 20));
	mat = (int *) malloc(N * N * sizeof(int));
	for (int i = 0; i < N; i++)
		for (int j = 0; j < N; j++) {
			inputf >> mat[convert_dimension_2D_1D(i, j, N)];
		}
	return 0;
}

int print_result(bool has_negative_cycle, int *dist) {
	std::ofstream outputf("output.txt", std::ofstream::out);
	if (!has_negative_cycle) {
		for (int i = 0; i < N; i++) {
			if (dist[i] > INF)
				dist[i] = INF;
			outputf << dist[i] << '\n';
		}
		outputf.flush();
	} else {
		outputf << "FOUND NEGATIVE CYCLE!" << endl;
	}
	outputf.close();
	return 0;
}
}//namespace utils


__global__ void bellman_ford_one_iter(int n, int *d_mat, int *d_dist, bool *d_has_next, int iter_num){
	int global_tid = blockDim.x * blockIdx.x + threadIdx.x;
	int elementSkip = blockDim.x * gridDim.x;

	if(global_tid >= n) return;
	for(int u = 0 ; u < n ; u ++){
		for(int v = global_tid; v < n; v+= elementSkip){
			int weight = d_mat[u * n + v];
			if(weight < INF){
				int new_dist = d_dist[u] + weight;
				if(new_dist < d_dist[v]){
					d_dist[v] = new_dist;
					*d_has_next = true;
				}
			}
		}
	}

}

/**
 * Bellman-Ford algorithm. Find the shortest path from vertex 0 to other vertices.
 * @param blockPerGrid number of blocks per grid
 * @param threadsPerBlock number of threads per block
 * @param n input size
 * @param *mat input adjacency matrix
 * @param *dist distance array
 * @param *has_negative_cycle a bool variable to recode if there are negative cycles
 */
void bellman_ford(int blocksPerGrid, int threadsPerBlock, int n, int *mat, int *dist, bool *has_negative_cycle) {
	dim3 blocks(blocksPerGrid);
	dim3 threads(threadsPerBlock);

	int iter_num = 0;
	int *d_mat, *d_dist;
	bool *d_has_next, h_has_next;

	hipMalloc(&d_mat, sizeof(int) * n * n);
	hipMalloc(&d_dist, sizeof(int) *n);
	hipMalloc(&d_has_next, sizeof(bool));


	*has_negative_cycle = false;

	for(int i = 0 ; i < n; i ++){
		dist[i] = INF;
	}

	dist[0] = 0;
	hipMemcpy(d_mat, mat, sizeof(int) * n * n, hipMemcpyHostToDevice);
	hipMemcpy(d_dist, dist, sizeof(int) * n, hipMemcpyHostToDevice);

	for(;;){
		h_has_next = false;
		hipMemcpy(d_has_next, &h_has_next, sizeof(bool), hipMemcpyHostToDevice);

		bellman_ford_one_iter<<<blocks, threads>>>(n, d_mat, d_dist, d_has_next, iter_num);
		CHECK(hipDeviceSynchronize());
		hipMemcpy(&h_has_next, d_has_next, sizeof(bool), hipMemcpyDeviceToHost);

		iter_num++;
		if(iter_num >= n-1){
			*has_negative_cycle = true;
			break;
		}
		if(!h_has_next){
			break;
		}

	}
	if(! *has_negative_cycle){
		hipMemcpy(dist, d_dist, sizeof(int) * n, hipMemcpyDeviceToHost);
	}

	hipFree(d_mat);
	hipFree(d_dist);
	hipFree(d_has_next);
}

int main(int argc, char **argv) {
	if (argc <= 1) {
		utils::abort_with_error_message("INPUT FILE WAS NOT FOUND!");
	}
	if (argc <= 3) {
		utils::abort_with_error_message("blocksPerGrid or threadsPerBlock WAS NOT FOUND!");
	}

	string filename = argv[1];
	int blockPerGrid = atoi(argv[2]);
	int threadsPerBlock = atoi(argv[3]);

	int *dist;
	bool has_negative_cycle = false;


	assert(utils::read_file(filename) == 0);
	dist = (int *) calloc(sizeof(int), utils::N);


	//time counter
	timeval start_wall_time_t, end_wall_time_t;
	float ms_wall;
	hipDeviceReset();
	//start timer
	gettimeofday(&start_wall_time_t, nullptr);
	//bellman-ford algorithm
	bellman_ford(blockPerGrid, threadsPerBlock, utils::N, utils::mat, dist, &has_negative_cycle);
	CHECK(hipDeviceSynchronize());
	//end timer
	gettimeofday(&end_wall_time_t, nullptr);
	ms_wall = ((end_wall_time_t.tv_sec - start_wall_time_t.tv_sec) * 1000 * 1000
			+ end_wall_time_t.tv_usec - start_wall_time_t.tv_usec) / 1000.0;

	std::cerr.setf(std::ios::fixed);
	std::cerr << std::setprecision(6) << "Time(s): " << (ms_wall/1000.0) << endl;
	utils::print_result(has_negative_cycle, dist);
	free(dist);
	free(utils::mat);

	return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE # -- Begin function _ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.type	_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE,@function
_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: # @_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rdi, %rsi
	movl	$_ZSt4cerr, %edi
	callq	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	callq	abort
.Lfunc_end0:
	.size	_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, .Lfunc_end0-_ZN5utils24abort_with_error_messageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.cfi_endproc
                                        # -- End function
	.globl	_ZN5utils23convert_dimension_2D_1DEiii # -- Begin function _ZN5utils23convert_dimension_2D_1DEiii
	.type	_ZN5utils23convert_dimension_2D_1DEiii,@function
_ZN5utils23convert_dimension_2D_1DEiii: # @_ZN5utils23convert_dimension_2D_1DEiii
	.cfi_startproc
# %bb.0:
                                        # kill: def $esi killed $esi def $rsi
                                        # kill: def $edi killed $edi def $rdi
	imull	%edx, %edi
	leal	(%rdi,%rsi), %eax
	retq
.Lfunc_end1:
	.size	_ZN5utils23convert_dimension_2D_1DEiii, .Lfunc_end1-_ZN5utils23convert_dimension_2D_1DEiii
	.cfi_endproc
                                        # -- End function
	.globl	_ZN5utils9read_fileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE # -- Begin function _ZN5utils9read_fileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.type	_ZN5utils9read_fileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE,@function
_ZN5utils9read_fileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: # @_ZN5utils9read_fileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
.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	%rbx
	.cfi_def_cfa_offset 40
	subq	$552, %rsp                      # imm = 0x228
	.cfi_def_cfa_offset 592
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdi, %rsi
	leaq	32(%rsp), %rbx
	movq	%rbx, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode
	movq	(%rbx), %rax
	movq	-24(%rax), %rax
	cmpl	$0, 64(%rsp,%rax)
	jne	.LBB2_1
# %bb.9:
.Ltmp8:
	leaq	32(%rsp), %rdi
	movl	$_ZN5utils1NE, %esi
	callq	_ZNSirsERi
.Ltmp9:
# %bb.10:
	movl	_ZN5utils1NE(%rip), %ebp
	movl	%ebp, %edi
	imull	%edi, %edi
	shlq	$2, %rdi
	callq	malloc
	movq	%rax, _ZN5utils3matE(%rip)
	testl	%ebp, %ebp
	jle	.LBB2_17
# %bb.11:                               # %.preheader.preheader
	xorl	%r14d, %r14d
	leaq	32(%rsp), %rbx
.LBB2_12:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_14 Depth 2
	testl	%ebp, %ebp
	jle	.LBB2_16
# %bb.13:                               # %.lr.ph.preheader
                                        #   in Loop: Header=BB2_12 Depth=1
	xorl	%r15d, %r15d
.LBB2_14:                               # %.lr.ph
                                        #   Parent Loop BB2_12 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	imull	%r14d, %ebp
	movslq	%ebp, %rsi
	addq	%r15, %rsi
	shlq	$2, %rsi
	addq	_ZN5utils3matE(%rip), %rsi
.Ltmp11:
	movq	%rbx, %rdi
	callq	_ZNSirsERi
.Ltmp12:
# %bb.15:                               #   in Loop: Header=BB2_14 Depth=2
	movl	_ZN5utils1NE(%rip), %ebp
	incq	%r15
	cmpl	%ebp, %r15d
	jl	.LBB2_14
.LBB2_16:                               # %._crit_edge
                                        #   in Loop: Header=BB2_12 Depth=1
	incl	%r14d
	cmpl	%ebp, %r14d
	jl	.LBB2_12
.LBB2_17:                               # %._crit_edge22
	leaq	32(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	xorl	%eax, %eax
	addq	$552, %rsp                      # imm = 0x228
	.cfi_def_cfa_offset 40
	popq	%rbx
	.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_1:
	.cfi_def_cfa_offset 592
	leaq	16(%rsp), %r14
	movq	%r14, -16(%r14)
.Ltmp0:
	movq	%rsp, %rdi
	movl	$.L.str, %esi
	movl	$.L.str+39, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
.Ltmp1:
# %bb.2:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdx
.Ltmp3:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp4:
# %bb.3:                                # %.noexc
.Ltmp5:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp6:
# %bb.4:                                # %.noexc15
	callq	abort
.LBB2_7:
.Ltmp7:
	movq	%rax, %rbx
	movq	(%rsp), %rdi
	cmpq	%r14, %rdi
	je	.LBB2_20
# %bb.8:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i16
	callq	_ZdlPv
	jmp	.LBB2_20
.LBB2_6:
.Ltmp2:
	jmp	.LBB2_19
.LBB2_5:
.Ltmp10:
	jmp	.LBB2_19
.LBB2_18:
.Ltmp13:
.LBB2_19:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit18
	movq	%rax, %rbx
.LBB2_20:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit18
	leaq	32(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end2:
	.size	_ZN5utils9read_fileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, .Lfunc_end2-_ZN5utils9read_fileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table2:
.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 .Ltmp8-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp8
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp8-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp9-.Ltmp8                  #   Call between .Ltmp8 and .Ltmp9
	.uleb128 .Ltmp10-.Lfunc_begin0          #     jumps to .Ltmp10
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp11-.Lfunc_begin0          # >> Call Site 3 <<
	.uleb128 .Ltmp12-.Ltmp11                #   Call between .Ltmp11 and .Ltmp12
	.uleb128 .Ltmp13-.Lfunc_begin0          #     jumps to .Ltmp13
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 4 <<
	.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 5 <<
	.uleb128 .Ltmp6-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp6
	.uleb128 .Ltmp7-.Lfunc_begin0           #     jumps to .Ltmp7
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 6 <<
	.uleb128 .Lfunc_end2-.Ltmp6             #   Call between .Ltmp6 and .Lfunc_end2
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_ # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	je	.LBB3_1
# %bb.2:
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	strlen
	leaq	(%rax,%rbx), %rdx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # TAILCALL
.LBB3_1:
	.cfi_def_cfa_offset 32
	movl	$.L.str.9, %edi
	callq	_ZSt19__throw_logic_errorPKc
.Lfunc_end3:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .Lfunc_end3-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_endproc
                                        # -- End function
	.text
	.globl	_ZN5utils12print_resultEbPi     # -- Begin function _ZN5utils12print_resultEbPi
	.type	_ZN5utils12print_resultEbPi,@function
_ZN5utils12print_resultEbPi:            # @_ZN5utils12print_resultEbPi
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$528, %rsp                      # imm = 0x210
	.cfi_def_cfa_offset 576
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r14
	movl	%edi, %ebp
	leaq	16(%rsp), %rbx
	movl	$.L.str.1, %esi
	movq	%rbx, %rdi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
	testl	%ebp, %ebp
	je	.LBB4_1
# %bb.11:
.Ltmp21:
	leaq	16(%rsp), %rbx
	movl	$.L.str.2, %esi
	movl	$21, %edx
	movq	%rbx, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp22:
# %bb.12:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movq	16(%rsp), %rax
	addq	-24(%rax), %rbx
.Ltmp23:
	movq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp24:
# %bb.13:                               # %.noexc16
.Ltmp25:
	movsbl	%al, %esi
	leaq	16(%rsp), %rdi
	callq	_ZNSo3putEc
.Ltmp26:
# %bb.14:
	movq	%rax, %rbx
	jmp	.LBB4_15
.LBB4_1:                                # %.preheader
	cmpl	$0, _ZN5utils1NE(%rip)
	jle	.LBB4_15
# %bb.2:                                # %.lr.ph.preheader
	xorl	%r12d, %r12d
	leaq	16(%rsp), %rbx
	leaq	15(%rsp), %r15
.LBB4_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	(%r14,%r12,4), %esi
	cmpl	$1000001, %esi                  # imm = 0xF4241
	jl	.LBB4_5
# %bb.4:                                #   in Loop: Header=BB4_3 Depth=1
	movl	$1000000, (%r14,%r12,4)         # imm = 0xF4240
	movl	$1000000, %esi                  # imm = 0xF4240
.LBB4_5:                                #   in Loop: Header=BB4_3 Depth=1
.Ltmp14:
	movq	%rbx, %rdi
	callq	_ZNSolsEi
.Ltmp15:
# %bb.6:                                #   in Loop: Header=BB4_3 Depth=1
	movb	$10, 15(%rsp)
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	cmpq	$0, 16(%rax,%rcx)
	je	.LBB4_8
# %bb.7:                                #   in Loop: Header=BB4_3 Depth=1
.Ltmp16:
	movl	$1, %edx
	movq	%rax, %rdi
	movq	%r15, %rsi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp17:
	jmp	.LBB4_9
.LBB4_8:                                #   in Loop: Header=BB4_3 Depth=1
.Ltmp18:
	movq	%rax, %rdi
	movl	$10, %esi
	callq	_ZNSo3putEc
.Ltmp19:
.LBB4_9:                                #   in Loop: Header=BB4_3 Depth=1
	incq	%r12
	movslq	_ZN5utils1NE(%rip), %rax
	cmpq	%rax, %r12
	jl	.LBB4_3
.LBB4_15:                               # %.noexc17.invoke
.Ltmp27:
	movq	%rbx, %rdi
	callq	_ZNSo5flushEv
.Ltmp28:
# %bb.16:                               # %_ZNSolsEPFRSoS_E.exit
.Ltmp29:
	leaq	16(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp30:
# %bb.17:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	24(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 16(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	264(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	xorl	%eax, %eax
	addq	$528, %rsp                      # imm = 0x210
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB4_10:
	.cfi_def_cfa_offset 576
.Ltmp31:
	jmp	.LBB4_19
.LBB4_18:
.Ltmp20:
.LBB4_19:
	movq	%rax, %rbx
	leaq	16(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end4:
	.size	_ZN5utils12print_resultEbPi, .Lfunc_end4-_ZN5utils12print_resultEbPi
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table4:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Lfunc_begin1-.Lfunc_begin1    # >> Call Site 1 <<
	.uleb128 .Ltmp21-.Lfunc_begin1          #   Call between .Lfunc_begin1 and .Ltmp21
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp21-.Lfunc_begin1          # >> Call Site 2 <<
	.uleb128 .Ltmp26-.Ltmp21                #   Call between .Ltmp21 and .Ltmp26
	.uleb128 .Ltmp31-.Lfunc_begin1          #     jumps to .Ltmp31
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp14-.Lfunc_begin1          # >> Call Site 3 <<
	.uleb128 .Ltmp19-.Ltmp14                #   Call between .Ltmp14 and .Ltmp19
	.uleb128 .Ltmp20-.Lfunc_begin1          #     jumps to .Ltmp20
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp27-.Lfunc_begin1          # >> Call Site 4 <<
	.uleb128 .Ltmp30-.Ltmp27                #   Call between .Ltmp27 and .Ltmp30
	.uleb128 .Ltmp31-.Lfunc_begin1          #     jumps to .Ltmp31
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp30-.Lfunc_begin1          # >> Call Site 5 <<
	.uleb128 .Lfunc_end4-.Ltmp30            #   Call between .Ltmp30 and .Lfunc_end4
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z36__device_stub__bellman_ford_one_iteriPiS_Pbi # -- Begin function _Z36__device_stub__bellman_ford_one_iteriPiS_Pbi
	.type	_Z36__device_stub__bellman_ford_one_iteriPiS_Pbi,@function
_Z36__device_stub__bellman_ford_one_iteriPiS_Pbi: # @_Z36__device_stub__bellman_ford_one_iteriPiS_Pbi
	.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	4(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	24(%rsp), %rdx
	movq	%rcx, (%rdx)
	movq	%rsp, %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	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	$_Z21bellman_ford_one_iteriPiS_Pbi, %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_end5:
	.size	_Z36__device_stub__bellman_ford_one_iteriPiS_Pbi, .Lfunc_end5-_Z36__device_stub__bellman_ford_one_iteriPiS_Pbi
	.cfi_endproc
                                        # -- End function
	.globl	_Z12bellman_fordiiiPiS_Pb       # -- Begin function _Z12bellman_fordiiiPiS_Pb
	.type	_Z12bellman_fordiiiPiS_Pb,@function
_Z12bellman_fordiiiPiS_Pb:              # @_Z12bellman_fordiiiPiS_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
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	.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	%r9, %r13
	movq	%r8, %rbx
	movq	%rcx, 64(%rsp)                  # 8-byte Spill
                                        # kill: def $edx killed $edx def $rdx
	movl	%edi, %eax
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	movl	%esi, %ebp
	movq	%rdx, 24(%rsp)                  # 8-byte Spill
	movslq	%edx, %r12
	leaq	(,%r12,4), %r15
	movq	%r15, %r14
	imulq	%r12, %r14
	leaq	32(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	leaq	16(%rsp), %rdi
	movq	%r15, 48(%rsp)                  # 8-byte Spill
	movq	%r15, %rsi
	callq	hipMalloc
	leaq	8(%rsp), %rdi
	movl	$1, %esi
	callq	hipMalloc
	movq	%r13, 40(%rsp)                  # 8-byte Spill
	movb	$0, (%r13)
	testl	%r12d, %r12d
	jle	.LBB6_3
# %bb.1:                                # %.lr.ph.preheader
	movl	24(%rsp), %eax                  # 4-byte Reload
	xorl	%ecx, %ecx
.LBB6_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$1000000, (%rbx,%rcx,4)         # imm = 0xF4240
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB6_2
.LBB6_3:                                # %._crit_edge
	btsq	$32, 56(%rsp)                   # 8-byte Folded Spill
	btsq	$32, %rbp
	movl	$0, (%rbx)
	movq	32(%rsp), %rdi
	movl	$1, %r12d
	movq	64(%rsp), %rsi                  # 8-byte Reload
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	16(%rsp), %rdi
	movq	%rbx, %rsi
	movq	48(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rax                  # 8-byte Reload
	leal	-1(%rax), %r13d
	cmpl	$2, %r13d
	cmovll	%r12d, %r13d
	decl	%r13d
	xorl	%r14d, %r14d
	leaq	7(%rsp), %r15
.LBB6_4:                                # =>This Inner Loop Header: Depth=1
	movb	$0, 7(%rsp)
	movq	8(%rsp), %rdi
	movl	$1, %edx
	movq	%r15, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	56(%rsp), %rdi                  # 8-byte Reload
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_6
# %bb.5:                                #   in Loop: Header=BB6_4 Depth=1
	movq	32(%rsp), %rsi
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rcx
	movq	24(%rsp), %rdi                  # 8-byte Reload
                                        # kill: def $edi killed $edi killed $rdi
	movl	%r14d, %r8d
	callq	_Z36__device_stub__bellman_ford_one_iteriPiS_Pbi
.LBB6_6:                                #   in Loop: Header=BB6_4 Depth=1
	callq	hipDeviceSynchronize
	testl	%eax, %eax
	jne	.LBB6_13
# %bb.7:                                #   in Loop: Header=BB6_4 Depth=1
	movq	8(%rsp), %rsi
	movl	$1, %edx
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	cmpl	%r14d, %r13d
	je	.LBB6_8
# %bb.9:                                #   in Loop: Header=BB6_4 Depth=1
	incl	%r14d
	cmpb	$0, 7(%rsp)
	jne	.LBB6_4
# %bb.10:
	movq	40(%rsp), %rax                  # 8-byte Reload
	cmpb	$0, (%rax)
	jne	.LBB6_12
# %bb.11:
	movq	16(%rsp), %rsi
	movq	%rbx, %rdi
	movq	48(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
	jmp	.LBB6_12
.LBB6_8:                                # %.thread
	movq	40(%rsp), %rax                  # 8-byte Reload
	movb	$1, (%rax)
.LBB6_12:
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	addq	$72, %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
.LBB6_13:
	.cfi_def_cfa_offset 128
	movl	%eax, %r12d
	movq	stderr(%rip), %rdi
	movl	$.L.str.3, %esi
	movl	$.L.str.4, %edx
	movl	$150, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
	movl	%r12d, %edi
	callq	hipGetErrorString
	movl	$.L.str.5, %esi
	movq	%rbx, %rdi
	movl	%r12d, %edx
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.Lfunc_end6:
	.size	_Z12bellman_fordiiiPiS_Pb, .Lfunc_end6-_Z12bellman_fordiiiPiS_Pb
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI7_0:
	.quad	0x408f400000000000              # double 1000
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.Lfunc_begin2:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception2
# %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	$136, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	cmpl	$1, %edi
	jle	.LBB7_1
# %bb.6:
	cmpl	$3, %edi
	jbe	.LBB7_7
# %bb.10:
	movq	%rsi, %rbx
	movq	8(%rsi), %rsi
.Ltmp32:
	leaq	24(%rsp), %rdi
	leaq	8(%rsp), %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
.Ltmp33:
# %bb.11:
	movq	16(%rbx), %rdi
	callq	atoi
	movl	%eax, %ebp
	movq	24(%rbx), %rdi
	callq	atoi
	movl	%eax, %r14d
	movb	$0, 7(%rsp)
	movslq	_ZN5utils1NE(%rip), %rsi
	movl	$4, %edi
	callq	calloc
	movq	%rax, %rbx
.Ltmp35:
	callq	hipDeviceReset
.Ltmp36:
# %bb.12:
	leaq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movl	_ZN5utils1NE(%rip), %edx
	movq	_ZN5utils3matE(%rip), %rcx
.Ltmp37:
	leaq	7(%rsp), %r9
	movl	%ebp, %edi
	movl	%r14d, %esi
	movq	%rbx, %r8
	callq	_Z12bellman_fordiiiPiS_Pb
.Ltmp38:
# %bb.13:
.Ltmp39:
	callq	hipDeviceSynchronize
.Ltmp40:
# %bb.14:
	movl	%eax, %ebp
	testl	%eax, %eax
	jne	.LBB7_15
# %bb.19:
	leaq	120(%rsp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%r14), %r15
	movq	8(%r14), %r14
	movq	_ZSt4cerr(%rip), %rax
	movq	-24(%rax), %rcx
	orl	$4, _ZSt4cerr+24(%rcx)
	movq	8(%rsp), %r13
	movq	16(%rsp), %r12
	movq	-24(%rax), %rax
	movq	$6, _ZSt4cerr+8(%rax)
.Ltmp44:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.8, %esi
	movl	$9, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp45:
# %bb.20:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	subq	%r13, %r15
	imulq	$1000000, %r15, %rax            # imm = 0xF4240
	addq	%r14, %rax
	subq	%r12, %rax
	cvtsi2sd	%rax, %xmm0
	movsd	.LCPI7_0(%rip), %xmm1           # xmm1 = mem[0],zero
	divsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	cvtss2sd	%xmm0, %xmm0
	divsd	%xmm1, %xmm0
.Ltmp46:
	movl	$_ZSt4cerr, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp47:
# %bb.21:                               # %_ZNSolsEd.exit
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp48:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp49:
# %bb.22:                               # %.noexc56
.Ltmp50:
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
.Ltmp51:
# %bb.23:                               # %.noexc57
.Ltmp52:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp53:
# %bb.24:                               # %_ZNSolsEPFRSoS_E.exit
	movzbl	7(%rsp), %edi
.Ltmp54:
	movq	%rbx, %rsi
	callq	_ZN5utils12print_resultEbPi
.Ltmp55:
# %bb.25:
	movq	%rbx, %rdi
	callq	free
	movq	_ZN5utils3matE(%rip), %rdi
	callq	free
	leaq	40(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB7_27
# %bb.26:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i47
	callq	_ZdlPv
.LBB7_27:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit49
	xorl	%eax, %eax
	addq	$136, %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
.LBB7_15:
	.cfi_def_cfa_offset 192
	movq	stderr(%rip), %rdi
	movl	$.L.str.3, %esi
	movl	$.L.str.4, %edx
	movl	$200, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
.Ltmp41:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp42:
# %bb.16:
	movl	$.L.str.5, %esi
	movq	%rbx, %rdi
	movl	%ebp, %edx
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.LBB7_1:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit
	leaq	104(%rsp), %r14
	movq	%r14, -16(%r14)
	leaq	88(%rsp), %rbx
	movl	$.L.str.6, %esi
	movl	$.L.str.6+25, %edx
	movq	%rbx, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	movq	(%rbx), %rsi
	movq	8(%rbx), %rdx
.Ltmp62:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp63:
# %bb.2:                                # %.noexc
.Ltmp64:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp65:
	jmp	.LBB7_3
.LBB7_7:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit34
	leaq	72(%rsp), %r14
	movq	%r14, -16(%r14)
	leaq	56(%rsp), %rbx
	movl	$.L.str.7, %esi
	movl	$.L.str.7+47, %edx
	movq	%rbx, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	movq	(%rbx), %rsi
	movq	8(%rbx), %rdx
.Ltmp57:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp58:
# %bb.8:                                # %.noexc35
.Ltmp59:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp60:
.LBB7_3:                                # %.noexc29
	callq	abort
.LBB7_9:
.Ltmp61:
	movq	%rax, %rbx
	movq	56(%rsp), %rdi
	jmp	.LBB7_5
.LBB7_4:
.Ltmp66:
	movq	%rax, %rbx
	movq	88(%rsp), %rdi
.LBB7_5:
	cmpq	%r14, %rdi
	jne	.LBB7_30
	jmp	.LBB7_31
.LBB7_17:
.Ltmp34:
	movq	%rax, %rbx
	jmp	.LBB7_31
.LBB7_28:
.Ltmp56:
	jmp	.LBB7_29
.LBB7_18:
.Ltmp43:
.LBB7_29:
	movq	%rax, %rbx
	leaq	40(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB7_31
.LBB7_30:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i50
	callq	_ZdlPv
.LBB7_31:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit32
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end7:
	.size	main, .Lfunc_end7-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table7:
.Lexception2:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end2-.Lcst_begin2
.Lcst_begin2:
	.uleb128 .Ltmp32-.Lfunc_begin2          # >> Call Site 1 <<
	.uleb128 .Ltmp33-.Ltmp32                #   Call between .Ltmp32 and .Ltmp33
	.uleb128 .Ltmp34-.Lfunc_begin2          #     jumps to .Ltmp34
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp35-.Lfunc_begin2          # >> Call Site 2 <<
	.uleb128 .Ltmp38-.Ltmp35                #   Call between .Ltmp35 and .Ltmp38
	.uleb128 .Ltmp56-.Lfunc_begin2          #     jumps to .Ltmp56
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp39-.Lfunc_begin2          # >> Call Site 3 <<
	.uleb128 .Ltmp40-.Ltmp39                #   Call between .Ltmp39 and .Ltmp40
	.uleb128 .Ltmp43-.Lfunc_begin2          #     jumps to .Ltmp43
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp44-.Lfunc_begin2          # >> Call Site 4 <<
	.uleb128 .Ltmp55-.Ltmp44                #   Call between .Ltmp44 and .Ltmp55
	.uleb128 .Ltmp56-.Lfunc_begin2          #     jumps to .Ltmp56
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp41-.Lfunc_begin2          # >> Call Site 5 <<
	.uleb128 .Ltmp42-.Ltmp41                #   Call between .Ltmp41 and .Ltmp42
	.uleb128 .Ltmp43-.Lfunc_begin2          #     jumps to .Ltmp43
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp42-.Lfunc_begin2          # >> Call Site 6 <<
	.uleb128 .Ltmp62-.Ltmp42                #   Call between .Ltmp42 and .Ltmp62
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp62-.Lfunc_begin2          # >> Call Site 7 <<
	.uleb128 .Ltmp65-.Ltmp62                #   Call between .Ltmp62 and .Ltmp65
	.uleb128 .Ltmp66-.Lfunc_begin2          #     jumps to .Ltmp66
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp65-.Lfunc_begin2          # >> Call Site 8 <<
	.uleb128 .Ltmp57-.Ltmp65                #   Call between .Ltmp65 and .Ltmp57
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp57-.Lfunc_begin2          # >> Call Site 9 <<
	.uleb128 .Ltmp60-.Ltmp57                #   Call between .Ltmp57 and .Ltmp60
	.uleb128 .Ltmp61-.Lfunc_begin2          #     jumps to .Ltmp61
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp60-.Lfunc_begin2          # >> Call Site 10 <<
	.uleb128 .Lfunc_end7-.Ltmp60            #   Call between .Ltmp60 and .Lfunc_end7
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end2:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB8_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB8_3
.LBB8_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB8_3:
	testq	%r14, %r14
	je	.LBB8_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB8_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB8_7
.LBB8_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB8_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end8-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_endproc
                                        # -- 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	.LBB9_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB9_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z21bellman_ford_one_iteriPiS_Pbi, %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_end9:
	.size	__hip_module_ctor, .Lfunc_end9-__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	.LBB10_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
.LBB10_2:
	retq
.Lfunc_end10:
	.size	__hip_module_dtor, .Lfunc_end10-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_ZN5utils1NE,@object            # @_ZN5utils1NE
	.bss
	.globl	_ZN5utils1NE
	.p2align	2, 0x0
_ZN5utils1NE:
	.long	0                               # 0x0
	.size	_ZN5utils1NE, 4

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"ERROR OCCURRED WHILE READING INPUT FILE"
	.size	.L.str, 40

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"output.txt"
	.size	.L.str.1, 11

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"FOUND NEGATIVE CYCLE!"
	.size	.L.str.2, 22

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

	.type	.L.str.3,@object                # @.str.3
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.3:
	.asciz	"Error: %s:%d, "
	.size	.L.str.3, 15

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/qiansunn/BellmanFord/master/cuda_bellman_ford.hip"
	.size	.L.str.4, 112

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"code: %d, reason: %s\n"
	.size	.L.str.5, 22

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"INPUT FILE WAS NOT FOUND!"
	.size	.L.str.6, 26

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"blocksPerGrid or threadsPerBlock WAS NOT FOUND!"
	.size	.L.str.7, 48

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Time(s): "
	.size	.L.str.8, 10

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"basic_string: construction from null is not valid"
	.size	.L.str.9, 50

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z21bellman_ford_one_iteriPiS_Pbi"
	.size	.L__unnamed_1, 34

	.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 __gxx_personality_v0
	.addrsig_sym _Z36__device_stub__bellman_ford_one_iteriPiS_Pbi
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _ZN5utils1NE
	.addrsig_sym _ZSt4cerr
	.addrsig_sym _Z21bellman_ford_one_iteriPiS_Pbi
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z21bellman_ford_one_iteriPiS_Pbi ; -- Begin function _Z21bellman_ford_one_iteriPiS_Pbi
	.globl	_Z21bellman_ford_one_iteriPiS_Pbi
	.p2align	8
	.type	_Z21bellman_ford_one_iteriPiS_Pbi,@function
_Z21bellman_ford_one_iteriPiS_Pbi:      ; @_Z21bellman_ford_one_iteriPiS_Pbi
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x34
	s_load_b32 s16, s[0:1], 0x0
	s_add_u32 s4, s0, 40
	s_addc_u32 s5, s1, 0
	s_mov_b32 s3, 0
	s_mov_b32 s6, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	v_max_i32_e32 v0, 0, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s16, v0
	s_cbranch_execz .LBB0_8
; %bb.1:                                ; %.preheader.preheader
	s_load_b32 s8, s[4:5], 0x0
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x8
	s_load_b64 s[0:1], s[0:1], 0x18
	v_ashrrev_i32_e32 v2, 31, v1
	v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v5, 1
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[3:4], 2, v[1:2]
	v_mov_b32_e32 v2, v1
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s8, s8, s2
	v_add_co_u32 v6, vcc_lo, s6, v3
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v7, vcc_lo, s7, v4, vcc_lo
	s_ashr_i32 s9, s8, 31
	s_mov_b32 s2, s3
	s_lshl_b64 s[10:11], s[8:9], 2
.LBB0_2:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
	s_delay_alu instid0(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	s_lshl_b64 s[12:13], s[2:3], 2
	v_mov_b32_e32 v10, v1
	s_add_u32 s12, s6, s12
	s_addc_u32 s13, s7, s13
	v_lshlrev_b64 v[3:4], 2, v[2:3]
	s_mov_b64 s[14:15], 0
	s_mov_b32 s9, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v8, vcc_lo, s4, v3
	v_add_co_ci_u32_e32 v9, vcc_lo, s5, v4, vcc_lo
.LBB0_3:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, v8, s14
	v_add_co_ci_u32_e32 v4, vcc_lo, s15, v9, vcc_lo
	s_mov_b32 s17, exec_lo
	global_load_b32 v11, v[3:4], off
	s_waitcnt vmcnt(0)
	v_cmpx_gt_i32_e32 0xf4240, v11
	s_cbranch_execz .LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=2
	v_add_co_u32 v3, vcc_lo, v6, s14
	v_add_co_ci_u32_e32 v4, vcc_lo, s15, v7, vcc_lo
	s_clause 0x1
	global_load_b32 v12, v0, s[12:13]
	global_load_b32 v13, v[3:4], off
	s_waitcnt vmcnt(1)
	v_add_nc_u32_e32 v11, v12, v11
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_lt_i32_e32 vcc_lo, v11, v13
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=2
	global_store_b32 v[3:4], v11, off
	global_store_b8 v0, v5, s[0:1]
.LBB0_6:                                ;   in Loop: Header=BB0_3 Depth=2
	s_or_b32 exec_lo, exec_lo, s17
	v_add_nc_u32_e32 v10, s8, v10
	s_add_u32 s14, s14, s10
	s_addc_u32 s15, s15, s11
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_le_i32_e32 vcc_lo, s16, v10
	s_or_b32 s9, vcc_lo, s9
	s_and_not1_b32 exec_lo, exec_lo, s9
	s_cbranch_execnz .LBB0_3
; %bb.7:                                ; %._crit_edge
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s9
	v_add_nc_u32_e32 v2, s16, v2
	s_add_i32 s2, s2, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s2, s16
	s_cbranch_scc0 .LBB0_2
.LBB0_8:                                ; %.loopexit
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z21bellman_ford_one_iteriPiS_Pbi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 14
		.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_end0:
	.size	_Z21bellman_ford_one_iteriPiS_Pbi, .Lfunc_end0-_Z21bellman_ford_one_iteriPiS_Pbi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 420
; NumSgprs: 20
; NumVgprs: 14
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 20
; NumVGPRsForWavesPerEU: 14
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .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
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z21bellman_ford_one_iteriPiS_Pbi
    .private_segment_fixed_size: 0
    .sgpr_count:     20
    .sgpr_spill_count: 0
    .symbol:         _Z21bellman_ford_one_iteriPiS_Pbi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     14
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
