//
// CUDA code to compute minimu distance between n points
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>

#define MAX_POINTS 1048576
#define BLOCK_SIZE 1024

// ----------------------------------------------------------------------------
// Kernel Function to compute distance between all pairs of points
// Input:
//      X: X[i] = x-coordinate of the ith point
//      Y: Y[i] = y-coordinate of the ith point
//      n: number of points
//
// Output:
//      D: D[0] = minimum distance
//
__global__ void minimum_distance(float * X, float * Y, float * D, float * Glob,
		int n) {
	unsigned int i = ((blockIdx.x * blockDim.x) + threadIdx.x);
	int j = 0;
	if (i < n) {
		// complete first stop to initalize!!!!!!
		float xFirst = X[i], yFirst = Y[i];
		float xComp = X[i + 1], yComp = Y[i + 1];
		float sqX = (xComp - xFirst);
		float sqY = (yComp - yFirst);
		D[i] = sqrtf(sqX * sqX + sqY * sqY);

		for (j = i + 1; j < n; j++) {
			xComp = X[j];
			yComp = Y[j];
			float sqX = (xComp - xFirst);
			float sqY = (yComp - yFirst);
			float distance = sqrtf(sqX * sqX + sqY * sqY);
			if (distance < D[i])
				D[i] = distance;
		}

	}
	__syncthreads();
	if (i < blockDim.x && i < n) {
		float sdata;
		int tid = threadIdx.x;
		int shift = n;
		if (blockDim.x < n) {
			shift = n / blockDim.x;
			sdata = D[tid * shift];
			for (j = 1; j < shift; j++) {
				if (sdata > D[(tid * shift) + j])
					sdata = D[(tid * shift) + j];
			}
			shift = blockDim.x;
			D[tid] = sdata;
		}

		__syncthreads();

		for (unsigned int s = shift / 2; s > 0; s >>= 1) {
			if (tid < s) {
				if (D[tid] > D[tid + s]) {
					D[tid] = D[tid + s];
				}
			}
			__syncthreads();
		}

		if (i == 0)
			*Glob = D[0];
	}

}
// ----------------------------------------------------------------------------
// Main program - initializes points and computes minimum distance
// between the points
//
int main(int argc, char* argv[]) {

	// Host Data
	float * hVx;                // host x-coordinate array
	float * hVy;                // host y-coordinate array
	float * hmin_dist;          // minimum value on host

	// Device Data
	float * dVx;                // device x-coordinate array
	float * dVy;                // device x-coordinate array
	float * dmin_dist;          // minimum value on device
	float * dVd;

	int i, j, size, num_points, threads, blocks;
	float dx, dy, Dij, distance;
	unsigned int seed = 0;

	cudaEvent_t start, stop;            // GPU timing variables

	struct timeval cpu_start, cpu_stop; // CPU timing variables

	float time_array[10];

	// Timing initializations
	cudaEventCreate(&start);
	cudaEventCreate(&stop);

	// Check input
	if (argc != 2) {
		printf("Use: %s <number of points>\n", argv[0]);
		exit(0);
	}
	if ((num_points = atoi(argv[argc - 1])) > MAX_POINTS) {
		printf("Maximum number of points allowed: %d\n", MAX_POINTS);
		exit(0);
	}

	// Allocate host coordinate arrays
	size = num_points * sizeof(float);
	hVx = (float *) malloc(size);
	hVy = (float *) malloc(size);
	hmin_dist = (float *) malloc(sizeof(float));

	// Initialize points
	for (i = 0; i < num_points; i++) {
		hVx[i] = (float) (rand_r(&seed)) / (float) (RAND_MAX);
		hVy[i] = (float) (rand_r(&seed)) / (float) (RAND_MAX);
	}

	// Allocate device coordinate arrays
	cudaMalloc(&dVx, size);
	cudaMalloc(&dVy, size);
	cudaMalloc(&dmin_dist, sizeof(float));
	cudaMalloc(&dVd, size);

	// Copy coordinate arrays from host memory to device memory
	cudaEventRecord(start, 0);

	cudaMemcpy(dVx, hVx, size, cudaMemcpyHostToDevice);
	cudaMemcpy(dVy, hVy, size, cudaMemcpyHostToDevice);

	cudaEventRecord(stop, 0);
	cudaEventSynchronize(stop);
	cudaEventElapsedTime(&(time_array[0]), start, stop);

	// Invoke kernel
	cudaEventRecord(start, 0);

	threads = 256;
	blocks = 1;
	if (num_points > threads) {
		blocks = num_points / threads;
	}

	minimum_distance<<<blocks,threads>>>(dVx, dVy, dVd, dmin_dist, num_points);

	cudaEventRecord(stop, 0);
	cudaEventSynchronize(stop);
	cudaEventElapsedTime(&(time_array[1]), start, stop);

	// Copy result from device memory to host memory
	cudaEventRecord(start, 0);

	cudaMemcpy(hmin_dist, dmin_dist, sizeof(float), cudaMemcpyDeviceToHost);

	cudaEventRecord(stop, 0);
	cudaEventSynchronize(stop);
	cudaEventElapsedTime(&(time_array[2]), start, stop);

	printf("Number of Points = %d\n", num_points);
	printf("GPU Host-to-device = %f ms \n", time_array[0]);
	printf("GPU execution time = %f ms \n", time_array[1]);
	printf("GPU Device-to-host = %f ms \n", time_array[2]);
	printf("Minimum distance (GPU) = %e\n", hmin_dist[0]);

	// Compute minimum distance on host to check device computation
	gettimeofday(&cpu_start, NULL);
	dx = hVx[1] - hVx[0];
	dy = hVy[1] - hVy[0];
	distance = sqrtf(dx * dx + dy * dy);
	for (i = 0; i < num_points; i++) {
		for (j = i + 1; j < num_points; j++) {
			dx = hVx[j] - hVx[i];
			dy = hVy[j] - hVy[i];
			Dij = sqrtf(dx * dx + dy * dy);
			if (distance > Dij)
				distance = Dij;
		}
	}
	gettimeofday(&cpu_stop, NULL);
	time_array[3] = 1000 * (cpu_stop.tv_sec - cpu_start.tv_sec)
			+ 0.000001 * (cpu_stop.tv_usec - cpu_start.tv_usec);
	printf("CPU execution time = %f ms\n", time_array[3]);
	printf("Minimum distance (CPU) = %e\n", distance);

	// Free device memory
	cudaFree(dVx);
	cudaFree(dVy);
	cudaFree(dmin_dist);
	cudaFree(dVd);

	// Free host memory
	free(hVx);
	free(hVy);
	free(hmin_dist);

	return 0;
}


	.file	"tmpxft_0021371d_00000000-6_nbody.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2030:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2030:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z43__device_stub__Z16minimum_distancePfS_S_S_iPfS_S_S_i
	.type	_Z43__device_stub__Z16minimum_distancePfS_S_S_iPfS_S_S_i, @function
_Z43__device_stub__Z16minimum_distancePfS_S_S_iPfS_S_S_i:
.LFB2052:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	56(%rsp), %rcx
	movl	%r8d, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	56(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z16minimum_distancePfS_S_S_i(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 192
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L2:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2052:
	.size	_Z43__device_stub__Z16minimum_distancePfS_S_S_iPfS_S_S_i, .-_Z43__device_stub__Z16minimum_distancePfS_S_S_iPfS_S_S_i
	.globl	_Z16minimum_distancePfS_S_S_i
	.type	_Z16minimum_distancePfS_S_S_i, @function
_Z16minimum_distancePfS_S_S_i:
.LFB2053:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z16minimum_distancePfS_S_S_iPfS_S_S_i
	.cfi_endproc
.LFE2053:
	.size	_Z16minimum_distancePfS_S_S_i, .-_Z16minimum_distancePfS_S_S_i
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Use: %s <number of points>\n"
.LC1:
	.string	"Maximum number of points allowed: %d\n"
.LC3:
	.string	"Number of Points = %d\n"
.LC4:
	.string	"GPU Host-to-device = %f ms \n"
.LC5:
	.string	"GPU execution time = %f ms \n"
.LC6:
	.string	"GPU Device-to-host = %f ms \n"
.LC7:
	.string	"Minimum distance (GPU) = %e\n"
.LC9:
	.string	"CPU execution time = %f ms\n"
.LC10:
	.string	"Minimum distance (CPU) = %e\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.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
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$168, %rsp
	.cfi_def_cfa_offset 224
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	64(%rsp), %rdi
	xorl	%eax, %eax
	movl	%eax, 28(%rsp)
	call	cudaEventCreate@PLT
	leaq	72(%rsp), %rdi
	call	cudaEventCreate@PLT
	cmpl	$2, %ebp
	je	.L9
	movq	(%rbx), %rdx
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
.L9:
	movq	8(%rbx), %rdi
	call	atoi@PLT
	movl	%eax, %ebx
	cmpl	$1048576, %eax
	jle	.L10
	movl	$1048576, %edx
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L23:
	xorl	%edi, %edi
	call	exit@PLT
.L10:
	leal	0(,%rax,4), %r13d
	xorl	%r15d, %r15d
	movslq	%r13d, %r13
	movq	%r13, %rdi
	call	malloc@PLT
	movq	%r13, %rdi
	movq	%rax, %r12
	call	malloc@PLT
	movl	$4, %edi
	movq	%rax, %rbp
	call	malloc@PLT
	movq	%rax, %r14
.L11:
	cmpl	%r15d, %ebx
	jle	.L24
	leaq	28(%rsp), %rdi
	movq	%rdi, 8(%rsp)
	call	rand_r@PLT
	movq	8(%rsp), %rdi
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC2(%rip), %xmm0
	movss	%xmm0, (%r12,%r15,4)
	call	rand_r@PLT
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC2(%rip), %xmm0
	movss	%xmm0, 0(%rbp,%r15,4)
	incq	%r15
	jmp	.L11
.L24:
	leaq	32(%rsp), %rdi
	movq	%r13, %rsi
	call	cudaMalloc@PLT
	leaq	40(%rsp), %rdi
	movq	%r13, %rsi
	call	cudaMalloc@PLT
	leaq	48(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	leaq	56(%rsp), %rdi
	movq	%r13, %rsi
	call	cudaMalloc@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rdi
	movq	%r13, %rdx
	movq	%r12, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	40(%rsp), %rdi
	movq	%r13, %rdx
	movq	%rbp, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	72(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	leaq	112(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$1, %eax
	cmpl	$256, %ebx
	jle	.L13
	movl	%ebx, %eax
	sarl	$8, %eax
.L13:
	movl	%eax, 80(%rsp)
	movl	$16777217, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movabsq	$4294967297, %rax
	salq	$8, %rdx
	movl	$1, %ecx
	movl	$1, 104(%rsp)
	movq	%rax, 84(%rsp)
	movq	80(%rsp), %rdi
	movl	88(%rsp), %esi
	movq	%rdx, 96(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L14
	movq	48(%rsp), %rcx
	movq	56(%rsp), %rdx
	movl	%ebx, %r8d
	movq	40(%rsp), %rsi
	movq	32(%rsp), %rdi
	call	_Z43__device_stub__Z16minimum_distancePfS_S_S_iPfS_S_S_i
.L14:
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	movl	$1, %r13d
	call	cudaEventRecord@PLT
	movq	72(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	leaq	116(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	48(%rsp), %rsi
	movl	$2, %ecx
	movq	%r14, %rdi
	movl	$4, %edx
	call	cudaMemcpy@PLT
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	72(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	leaq	120(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movl	%ebx, %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	112(%rsp), %xmm0
	call	__printf_chk@PLT
	movl	$2, %edi
	movb	$1, %al
	leaq	.LC5(%rip), %rsi
	cvtss2sd	116(%rsp), %xmm0
	call	__printf_chk@PLT
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	120(%rsp), %xmm0
	call	__printf_chk@PLT
	movl	$2, %edi
	leaq	.LC7(%rip), %rsi
	movb	$1, %al
	cvtss2sd	(%r14), %xmm0
	call	__printf_chk@PLT
	leaq	80(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	movss	4(%r12), %xmm0
	movss	4(%rbp), %xmm1
	subss	(%r12), %xmm0
	subss	0(%rbp), %xmm1
	mulss	%xmm0, %xmm0
	mulss	%xmm1, %xmm1
	addss	%xmm1, %xmm0
	call	sqrtf@PLT
	movss	%xmm0, 8(%rsp)
.L15:
	leal	-1(%r13), %eax
	cmpl	%eax, %ebx
	jle	.L25
	movq	%r13, %r15
.L18:
	cmpl	%r15d, %ebx
	jle	.L26
	movss	(%r12,%r15,4), %xmm0
	movss	0(%rbp,%r15,4), %xmm1
	incq	%r15
	subss	-4(%r12,%r13,4), %xmm0
	subss	-4(%rbp,%r13,4), %xmm1
	mulss	%xmm0, %xmm0
	mulss	%xmm1, %xmm1
	addss	%xmm1, %xmm0
	call	sqrtf@PLT
	minss	8(%rsp), %xmm0
	movss	%xmm0, 8(%rsp)
	jmp	.L18
.L26:
	incq	%r13
	jmp	.L15
.L25:
	xorl	%esi, %esi
	leaq	96(%rsp), %rdi
	call	gettimeofday@PLT
	movq	96(%rsp), %rax
	subq	80(%rsp), %rax
	leaq	.LC9(%rip), %rsi
	imulq	$1000, %rax, %rax
	movl	$2, %edi
	cvtsi2sdq	%rax, %xmm0
	movq	104(%rsp), %rax
	subq	88(%rsp), %rax
	cvtsi2sdq	%rax, %xmm1
	mulsd	.LC8(%rip), %xmm1
	movb	$1, %al
	addsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, 124(%rsp)
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	leaq	.LC10(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	8(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%r14, %rdi
	call	free@PLT
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	addq	$168, %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
.LFE2027:
	.size	main, .-main
	.section	.rodata.str1.1
.LC11:
	.string	"_Z16minimum_distancePfS_S_S_i"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2055:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC11(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z16minimum_distancePfS_S_S_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2055:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC2:
	.long	805306368
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC8:
	.long	-1598689907
	.long	1051772663
	.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:

//
// CUDA code to compute minimu distance between n points
//

#include <hip/hip_runtime.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>

#define MAX_POINTS 1048576
#define BLOCK_SIZE 1024

// ----------------------------------------------------------------------------
// Kernel Function to compute distance between all pairs of points
// Input:
//      X: X[i] = x-coordinate of the ith point
//      Y: Y[i] = y-coordinate of the ith point
//      n: number of points
//
// Output:
//      D: D[0] = minimum distance
//
__global__ void minimum_distance(float * X, float * Y, float * D, float * Glob,
		int n) {
	unsigned int i = ((blockIdx.x * blockDim.x) + threadIdx.x);
	int j = 0;
	if (i < n) {
		// complete first stop to initalize!!!!!!
		float xFirst = X[i], yFirst = Y[i];
		float xComp = X[i + 1], yComp = Y[i + 1];
		float sqX = (xComp - xFirst);
		float sqY = (yComp - yFirst);
		D[i] = sqrtf(sqX * sqX + sqY * sqY);

		for (j = i + 1; j < n; j++) {
			xComp = X[j];
			yComp = Y[j];
			float sqX = (xComp - xFirst);
			float sqY = (yComp - yFirst);
			float distance = sqrtf(sqX * sqX + sqY * sqY);
			if (distance < D[i])
				D[i] = distance;
		}

	}
	__syncthreads();
	if (i < blockDim.x && i < n) {
		float sdata;
		int tid = threadIdx.x;
		int shift = n;
		if (blockDim.x < n) {
			shift = n / blockDim.x;
			sdata = D[tid * shift];
			for (j = 1; j < shift; j++) {
				if (sdata > D[(tid * shift) + j])
					sdata = D[(tid * shift) + j];
			}
			shift = blockDim.x;
			D[tid] = sdata;
		}

		__syncthreads();

		for (unsigned int s = shift / 2; s > 0; s >>= 1) {
			if (tid < s) {
				if (D[tid] > D[tid + s]) {
					D[tid] = D[tid + s];
				}
			}
			__syncthreads();
		}

		if (i == 0)
			*Glob = D[0];
	}

}
// ----------------------------------------------------------------------------
// Main program - initializes points and computes minimum distance
// between the points
//
int main(int argc, char* argv[]) {

	// Host Data
	float * hVx;                // host x-coordinate array
	float * hVy;                // host y-coordinate array
	float * hmin_dist;          // minimum value on host

	// Device Data
	float * dVx;                // device x-coordinate array
	float * dVy;                // device x-coordinate array
	float * dmin_dist;          // minimum value on device
	float * dVd;

	int i, j, size, num_points, threads, blocks;
	float dx, dy, Dij, distance;
	unsigned int seed = 0;

	hipEvent_t start, stop;            // GPU timing variables

	struct timeval cpu_start, cpu_stop; // CPU timing variables

	float time_array[10];

	// Timing initializations
	hipEventCreate(&start);
	hipEventCreate(&stop);

	// Check input
	if (argc != 2) {
		printf("Use: %s <number of points>\n", argv[0]);
		exit(0);
	}
	if ((num_points = atoi(argv[argc - 1])) > MAX_POINTS) {
		printf("Maximum number of points allowed: %d\n", MAX_POINTS);
		exit(0);
	}

	// Allocate host coordinate arrays
	size = num_points * sizeof(float);
	hVx = (float *) malloc(size);
	hVy = (float *) malloc(size);
	hmin_dist = (float *) malloc(sizeof(float));

	// Initialize points
	for (i = 0; i < num_points; i++) {
		hVx[i] = (float) (rand_r(&seed)) / (float) (RAND_MAX);
		hVy[i] = (float) (rand_r(&seed)) / (float) (RAND_MAX);
	}

	// Allocate device coordinate arrays
	hipMalloc(&dVx, size);
	hipMalloc(&dVy, size);
	hipMalloc(&dmin_dist, sizeof(float));
	hipMalloc(&dVd, size);

	// Copy coordinate arrays from host memory to device memory
	hipEventRecord(start, 0);

	hipMemcpy(dVx, hVx, size, hipMemcpyHostToDevice);
	hipMemcpy(dVy, hVy, size, hipMemcpyHostToDevice);

	hipEventRecord(stop, 0);
	hipEventSynchronize(stop);
	hipEventElapsedTime(&(time_array[0]), start, stop);

	// Invoke kernel
	hipEventRecord(start, 0);

	threads = 256;
	blocks = 1;
	if (num_points > threads) {
		blocks = num_points / threads;
	}

	minimum_distance<<<blocks,threads>>>(dVx, dVy, dVd, dmin_dist, num_points);

	hipEventRecord(stop, 0);
	hipEventSynchronize(stop);
	hipEventElapsedTime(&(time_array[1]), start, stop);

	// Copy result from device memory to host memory
	hipEventRecord(start, 0);

	hipMemcpy(hmin_dist, dmin_dist, sizeof(float), hipMemcpyDeviceToHost);

	hipEventRecord(stop, 0);
	hipEventSynchronize(stop);
	hipEventElapsedTime(&(time_array[2]), start, stop);

	printf("Number of Points = %d\n", num_points);
	printf("GPU Host-to-device = %f ms \n", time_array[0]);
	printf("GPU execution time = %f ms \n", time_array[1]);
	printf("GPU Device-to-host = %f ms \n", time_array[2]);
	printf("Minimum distance (GPU) = %e\n", hmin_dist[0]);

	// Compute minimum distance on host to check device computation
	gettimeofday(&cpu_start, NULL);
	dx = hVx[1] - hVx[0];
	dy = hVy[1] - hVy[0];
	distance = sqrtf(dx * dx + dy * dy);
	for (i = 0; i < num_points; i++) {
		for (j = i + 1; j < num_points; j++) {
			dx = hVx[j] - hVx[i];
			dy = hVy[j] - hVy[i];
			Dij = sqrtf(dx * dx + dy * dy);
			if (distance > Dij)
				distance = Dij;
		}
	}
	gettimeofday(&cpu_stop, NULL);
	time_array[3] = 1000 * (cpu_stop.tv_sec - cpu_start.tv_sec)
			+ 0.000001 * (cpu_stop.tv_usec - cpu_start.tv_usec);
	printf("CPU execution time = %f ms\n", time_array[3]);
	printf("Minimum distance (CPU) = %e\n", distance);

	// Free device memory
	hipFree(dVx);
	hipFree(dVy);
	hipFree(dmin_dist);
	hipFree(dVd);

	// Free host memory
	free(hVx);
	free(hVy);
	free(hmin_dist);

	return 0;
}


	.text
	.file	"nbody.hip"
	.globl	_Z31__device_stub__minimum_distancePfS_S_S_i # -- Begin function _Z31__device_stub__minimum_distancePfS_S_S_i
	.type	_Z31__device_stub__minimum_distancePfS_S_S_i,@function
_Z31__device_stub__minimum_distancePfS_S_S_i: # @_Z31__device_stub__minimum_distancePfS_S_S_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	12(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z16minimum_distancePfS_S_S_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z31__device_stub__minimum_distancePfS_S_S_i, .Lfunc_end0-_Z31__device_stub__minimum_distancePfS_S_S_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI1_0:
	.long	0x30000000                      # float 4.65661287E-10
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI1_1:
	.quad	0x3eb0c6f7a0b5ed8d              # double 9.9999999999999995E-7
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$152, %rsp
	.cfi_def_cfa_offset 208
	.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	%rsi, %rbx
	movl	%edi, %ebp
	movl	$0, 44(%rsp)
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
	leaq	8(%rsp), %rdi
	callq	hipEventCreate
	cmpl	$2, %ebp
	jne	.LBB1_16
# %bb.1:
	movq	8(%rbx), %rdi
	callq	atoi
	cmpl	$1048577, %eax                  # imm = 0x100001
	jge	.LBB1_17
# %bb.2:
	movl	%eax, %r15d
	leal	(,%r15,4), %eax
	movslq	%eax, %r13
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, %rbx
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, %r14
	movl	$4, %edi
	callq	malloc
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	movl	%r15d, %ebp
	movq	%r15, 24(%rsp)                  # 8-byte Spill
	testl	%r15d, %r15d
	jle	.LBB1_5
# %bb.3:                                # %.lr.ph.preheader
	xorl	%r12d, %r12d
	leaq	44(%rsp), %r15
.LBB1_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	rand_r
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	.LCPI1_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm1, %xmm0
	movss	%xmm0, (%rbx,%r12,4)
	movq	%r15, %rdi
	callq	rand_r
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	.LCPI1_0(%rip), %xmm0
	movss	%xmm0, (%r14,%r12,4)
	incq	%r12
	cmpq	%r12, %rbp
	jne	.LBB1_4
.LBB1_5:                                # %._crit_edge
	leaq	64(%rsp), %r15
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	leaq	56(%rsp), %r12
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	leaq	32(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	leaq	48(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%r15), %rdi
	movl	$1, %r15d
	movq	%rbx, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r12), %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	leaq	96(%rsp), %rdi
	callq	hipEventElapsedTime
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	24(%rsp), %rax                  # 8-byte Reload
	movl	%eax, %edi
	shrl	$8, %edi
	cmpl	$257, %eax                      # imm = 0x101
	cmovll	%r15d, %edi
	movq	%rax, %r15
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$256, %rdx                      # imm = 0x100
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB1_7
# %bb.6:
	movq	64(%rsp), %rdi
	movq	56(%rsp), %rsi
	movq	48(%rsp), %rdx
	movq	32(%rsp), %rcx
	movl	%r15d, %r8d
	callq	_Z31__device_stub__minimum_distancePfS_S_S_i
.LBB1_7:
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	leaq	100(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	callq	hipEventElapsedTime
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	32(%rsp), %rsi
	movl	$4, %edx
	movq	72(%rsp), %r12                  # 8-byte Reload
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	leaq	104(%rsp), %r13
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movq	%r13, %rdi
	callq	hipEventElapsedTime
	movl	$.L.str.2, %edi
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	printf
	cvtss2sd	-8(%r13), %xmm0
	movl	$.L.str.3, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	-4(%r13), %xmm0
	movl	$.L.str.4, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r13), %xmm0
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r12), %xmm0
	movl	$.L.str.6, %edi
	movb	$1, %al
	callq	printf
	leaq	80(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movss	4(%rbx), %xmm0                  # xmm0 = mem[0],zero,zero,zero
	subss	(%rbx), %xmm0
	movss	4(%r14), %xmm1                  # xmm1 = mem[0],zero,zero,zero
	subss	(%r14), %xmm1
	mulss	%xmm0, %xmm0
	mulss	%xmm1, %xmm1
	addss	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	sqrtss	%xmm1, %xmm0
	testl	%r15d, %r15d
	jle	.LBB1_14
# %bb.8:                                # %.lr.ph86.preheader
	xorl	%esi, %esi
	movq	%rbp, %rax
	movq	%rbx, %rcx
	movq	%r14, %rdx
.LBB1_9:                                # %.lr.ph86
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_11 Depth 2
	movq	%rsi, %rdi
	incq	%rsi
	cmpq	%rbp, %rsi
	jae	.LBB1_12
# %bb.10:                               # %.lr.ph82
                                        #   in Loop: Header=BB1_9 Depth=1
	movss	(%rbx,%rdi,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	movss	(%r14,%rdi,4), %xmm2            # xmm2 = mem[0],zero,zero,zero
	movl	$1, %edi
.LBB1_11:                               #   Parent Loop BB1_9 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%rcx,%rdi,4), %xmm3            # xmm3 = mem[0],zero,zero,zero
	subss	%xmm1, %xmm3
	movss	(%rdx,%rdi,4), %xmm4            # xmm4 = mem[0],zero,zero,zero
	subss	%xmm2, %xmm4
	mulss	%xmm3, %xmm3
	mulss	%xmm4, %xmm4
	addss	%xmm3, %xmm4
	xorps	%xmm3, %xmm3
	sqrtss	%xmm4, %xmm3
	minss	%xmm0, %xmm3
	incq	%rdi
	movaps	%xmm3, %xmm0
	cmpq	%rdi, %rax
	jne	.LBB1_11
	jmp	.LBB1_13
.LBB1_12:                               #   in Loop: Header=BB1_9 Depth=1
	movaps	%xmm0, %xmm3
.LBB1_13:                               # %.loopexit
                                        #   in Loop: Header=BB1_9 Depth=1
	addq	$4, %rdx
	addq	$4, %rcx
	decq	%rax
	movaps	%xmm3, %xmm0
	cmpq	%rbp, %rsi
	jne	.LBB1_9
	jmp	.LBB1_15
.LBB1_14:
	movaps	%xmm0, %xmm3
.LBB1_15:                               # %._crit_edge87
	movss	%xmm3, 24(%rsp)                 # 4-byte Spill
	leaq	136(%rsp), %r15
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%r15), %rax
	subq	80(%rsp), %rax
	movq	8(%r15), %rcx
	imulq	$1000, %rax, %rax               # imm = 0x3E8
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	subq	88(%rsp), %rcx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rcx, %xmm1
	mulsd	.LCPI1_1(%rip), %xmm1
	addsd	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtsd2ss	%xmm1, %xmm0
	movss	%xmm0, 108(%rsp)
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.7, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	24(%rsp), %xmm0                 # 4-byte Folded Reload
	movl	$.L.str.8, %edi
	movb	$1, %al
	callq	printf
	movq	64(%rsp), %rdi
	callq	hipFree
	movq	56(%rsp), %rdi
	callq	hipFree
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	xorl	%eax, %eax
	addq	$152, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB1_16:
	.cfi_def_cfa_offset 208
	movq	(%rbx), %rsi
	movl	$.L.str, %edi
	xorl	%eax, %eax
	callq	printf
	jmp	.LBB1_18
.LBB1_17:
	movl	$.L.str.1, %edi
	movl	$1048576, %esi                  # imm = 0x100000
	xorl	%eax, %eax
	callq	printf
.LBB1_18:
	xorl	%edi, %edi
	callq	exit
.Lfunc_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB2_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB2_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z16minimum_distancePfS_S_S_i, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end2:
	.size	__hip_module_ctor, .Lfunc_end2-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB3_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB3_2:
	retq
.Lfunc_end3:
	.size	__hip_module_dtor, .Lfunc_end3-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z16minimum_distancePfS_S_S_i,@object # @_Z16minimum_distancePfS_S_S_i
	.section	.rodata,"a",@progbits
	.globl	_Z16minimum_distancePfS_S_S_i
	.p2align	3, 0x0
_Z16minimum_distancePfS_S_S_i:
	.quad	_Z31__device_stub__minimum_distancePfS_S_S_i
	.size	_Z16minimum_distancePfS_S_S_i, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Use: %s <number of points>\n"
	.size	.L.str, 28

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Maximum number of points allowed: %d\n"
	.size	.L.str.1, 38

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Number of Points = %d\n"
	.size	.L.str.2, 23

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"GPU Host-to-device = %f ms \n"
	.size	.L.str.3, 29

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"GPU execution time = %f ms \n"
	.size	.L.str.4, 29

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"GPU Device-to-host = %f ms \n"
	.size	.L.str.5, 29

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Minimum distance (GPU) = %e\n"
	.size	.L.str.6, 29

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"CPU execution time = %f ms\n"
	.size	.L.str.7, 28

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Minimum distance (CPU) = %e\n"
	.size	.L.str.8, 29

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z16minimum_distancePfS_S_S_i"
	.size	.L__unnamed_1, 30

	.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 _Z31__device_stub__minimum_distancePfS_S_S_i
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z16minimum_distancePfS_S_S_i
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z16minimum_distancePfS_S_S_i ; -- Begin function _Z16minimum_distancePfS_S_S_i
	.globl	_Z16minimum_distancePfS_S_S_i
	.p2align	8
	.type	_Z16minimum_distancePfS_S_S_i,@function
_Z16minimum_distancePfS_S_S_i:          ; @_Z16minimum_distancePfS_S_S_i
; %bb.0:
	s_clause 0x2
	s_load_b32 s3, s[0:1], 0x34
	s_load_b32 s2, s[0:1], 0x20
	s_load_b256 s[4:11], s[0:1], 0x0
	s_mov_b32 s12, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s3, s3, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s3, v[0:1]
	v_cmp_le_u32_e32 vcc_lo, s2, v1
	v_cmpx_gt_u32_e64 s2, v1
	s_cbranch_execz .LBB0_6
; %bb.1:
	v_mov_b32_e32 v2, 0
	s_mov_b32 s13, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[7:8], 2, v[1:2]
	v_add_co_u32 v2, s0, s6, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v3, s0, s7, v8, s0
	v_add_co_u32 v4, s0, s4, v7
	v_add_co_ci_u32_e64 v5, s0, s5, v8, s0
	global_load_b64 v[2:3], v[2:3], off
	global_load_b64 v[4:5], v[4:5], off
	s_waitcnt vmcnt(1)
	v_sub_f32_e32 v3, v3, v2
	s_waitcnt vmcnt(0)
	v_sub_f32_e32 v5, v5, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v3, v3, v3
	v_fmac_f32_e32 v3, v5, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v5, 0x4f800000, v3
	v_cmp_gt_f32_e64 s0, 0xf800000, v3
	v_cndmask_b32_e64 v3, v3, v5, s0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_sqrt_f32_e32 v5, v3
	s_waitcnt_depctr 0xfff
	v_add_nc_u32_e32 v6, -1, v5
	v_add_nc_u32_e32 v9, 1, v5
	v_fma_f32 v10, -v6, v5, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v11, -v9, v5, v3
	v_cmp_ge_f32_e64 s1, 0, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v5, v5, v6, s1
	v_cmp_lt_f32_e64 s1, 0, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v5, v5, v9, s1
	v_mul_f32_e32 v6, 0x37800000, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v6, v5, v6, s0
	v_cmp_class_f32_e64 s0, v3, 0x260
	v_add_nc_u32_e32 v5, 1, v1
	v_cndmask_b32_e64 v3, v6, v3, s0
	v_add_co_u32 v7, s0, s8, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_ci_u32_e64 v8, s0, s9, v8, s0
	v_cmp_gt_i32_e64 s0, s2, v5
	global_store_b32 v[7:8], v3, off
	s_and_b32 exec_lo, exec_lo, s0
	s_cbranch_execz .LBB0_6
; %bb.2:                                ; %.lr.ph.preheader
	v_ashrrev_i32_e32 v6, 31, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[11:12], 2, v[5:6]
	v_add_co_u32 v9, s0, s4, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v10, s0, s5, v12, s0
	v_add_co_u32 v11, s0, s6, v11
	v_add_co_ci_u32_e64 v12, s0, s7, v12, s0
.LBB0_3:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	global_load_b32 v6, v[11:12], off
	global_load_b32 v13, v[9:10], off
	s_waitcnt vmcnt(0)
	v_dual_sub_f32 v6, v6, v2 :: v_dual_sub_f32 v13, v13, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v6, v6, v6
	v_fmac_f32_e32 v6, v13, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v13, 0x4f800000, v6
	v_cmp_gt_f32_e64 s0, 0xf800000, v6
	v_cndmask_b32_e64 v6, v6, v13, s0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_sqrt_f32_e32 v13, v6
	s_waitcnt_depctr 0xfff
	v_add_nc_u32_e32 v15, 1, v13
	v_add_nc_u32_e32 v14, -1, v13
	v_fma_f32 v17, -v15, v13, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v16, -v14, v13, v6
	v_cmp_ge_f32_e64 s1, 0, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_cndmask_b32_e64 v13, v13, v14, s1
	v_cmp_lt_f32_e64 s1, 0, v17
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v13, v13, v15, s1
	s_mov_b32 s1, exec_lo
	v_mul_f32_e32 v14, 0x37800000, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v13, v13, v14, s0
	v_cmp_class_f32_e64 s0, v6, 0x260
	v_cndmask_b32_e64 v6, v13, v6, s0
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_lt_f32_e32 v6, v3
	s_cbranch_execz .LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	v_mov_b32_e32 v3, v6
	global_store_b32 v[7:8], v6, off
.LBB0_5:                                ;   in Loop: Header=BB0_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	v_add_nc_u32_e32 v5, 1, v5
	v_add_co_u32 v9, s0, v9, 4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e64 v10, s0, 0, v10, s0
	v_cmp_le_i32_e64 s0, s2, v5
	v_add_co_u32 v11, s1, v11, 4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e64 v12, s1, 0, v12, s1
	s_or_b32 s13, s0, s13
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s13
	s_cbranch_execnz .LBB0_3
.LBB0_6:                                ; %.loopexit
	s_or_b32 exec_lo, exec_lo, s12
	v_cmp_gt_u32_e64 s0, s3, v1
	s_xor_b32 s1, vcc_lo, -1
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_and_b32 s0, s0, s1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s1, s0
	s_cbranch_execz .LBB0_20
; %bb.7:
	s_cmp_ge_u32 s3, s2
	s_cbranch_scc1 .LBB0_12
; %bb.8:
	v_cvt_f32_u32_e32 v2, s3
	s_sub_i32 s1, 0, s3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v2, v2
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v2, 0x4f7ffffe, v2
	v_cvt_u32_f32_e32 v2, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_readfirstlane_b32 s0, v2
	s_mul_i32 s1, s1, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s1, s0, s1
	s_add_i32 s0, s0, s1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s0, s2, s0
	s_mul_i32 s1, s0, s3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_sub_i32 s1, s2, s1
	s_add_i32 s2, s0, 1
	s_sub_i32 s4, s1, s3
	s_cmp_ge_u32 s1, s3
	s_cselect_b32 s0, s2, s0
	s_cselect_b32 s1, s4, s1
	s_add_i32 s2, s0, 1
	s_cmp_ge_u32 s1, s3
	s_mov_b32 s1, 1
	s_cselect_b32 s0, s2, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v2, s0, v0
	s_cmp_lt_i32 s0, 2
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[3:4], 2, v[2:3]
	v_add_co_u32 v3, vcc_lo, s8, v3
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v4, vcc_lo, s9, v4, vcc_lo
	global_load_b32 v4, v[3:4], off
	s_cbranch_scc1 .LBB0_11
; %bb.9:                                ; %.lr.ph104.preheader
	v_dual_mov_b32 v3, 0 :: v_dual_add_nc_u32 v2, 1, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_add_co_u32 v2, vcc_lo, s8, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s9, v3, vcc_lo
.LBB0_10:                               ; %.lr.ph104
                                        ; =>This Inner Loop Header: Depth=1
	global_load_b32 v5, v[2:3], off
	v_add_co_u32 v2, vcc_lo, v2, 4
	v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
	s_add_i32 s1, s1, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lt_i32 s1, s0
	s_waitcnt vmcnt(0)
	v_cmp_gt_f32_e32 vcc_lo, v4, v5
	v_cndmask_b32_e32 v4, v4, v5, vcc_lo
	s_cbranch_scc1 .LBB0_10
.LBB0_11:                               ; %._crit_edge
	v_lshlrev_b32_e32 v2, 2, v0
	s_mov_b32 s2, s3
	s_waitcnt vmcnt(0)
	global_store_b32 v2, v4, s[8:9]
.LBB0_12:
	s_cmp_lt_u32 s2, 2
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB0_18
; %bb.13:                               ; %.lr.ph109
	v_lshlrev_b32_e32 v2, 2, v0
	s_mov_b32 s3, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v2, s0, s8, v2
	v_add_co_ci_u32_e64 v3, null, s9, 0, s0
.LBB0_14:                               ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s0, s2
	s_lshr_b32 s2, s2, 1
	s_mov_b32 s1, exec_lo
	v_cmpx_gt_u32_e64 s2, v0
	s_cbranch_execz .LBB0_17
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	s_lshl_b64 s[4:5], s[2:3], 2
	s_delay_alu instid0(SALU_CYCLE_1)
	v_add_co_u32 v4, vcc_lo, v2, s4
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v3, vcc_lo
	s_clause 0x1
	global_load_b32 v6, v[2:3], off
	global_load_b32 v4, v[4:5], off
	s_waitcnt vmcnt(0)
	v_cmp_gt_f32_e32 vcc_lo, v6, v4
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_14 Depth=1
	global_store_b32 v[2:3], v4, off
.LBB0_17:                               ;   in Loop: Header=BB0_14 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	s_cmp_lt_u32 s0, 4
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB0_14
.LBB0_18:                               ; %._crit_edge110
	v_cmp_eq_u32_e32 vcc_lo, 0, v1
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_20
; %bb.19:
	v_mov_b32_e32 v0, 0
	global_load_b32 v1, v0, s[8:9]
	s_waitcnt vmcnt(0)
	global_store_b32 v0, v1, s[10:11]
.LBB0_20:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z16minimum_distancePfS_S_S_i
		.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 18
		.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	_Z16minimum_distancePfS_S_S_i, .Lfunc_end0-_Z16minimum_distancePfS_S_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1264
; NumSgprs: 18
; NumVgprs: 18
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 18
; 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:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .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:           _Z16minimum_distancePfS_S_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z16minimum_distancePfS_S_S_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     18
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
