#include <iostream>
#include <vector>
#include <string>
#include <fstream>

using namespace std;

#define BLOCK_SIZE 1024

__global__ void countEntriesPartA(int *A, int *B, int size)
{
	int i = blockIdx.x * blockDim.x + threadIdx.x;

	if (i < size)
	{
		int range = A[i] / 100;
		atomicAdd(&B[range], 1);
	}

	__syncthreads();
}

__global__ void countEntriesPartB(int *A, int *B2, int size)
{
	__shared__ int localB[10];
	int tid = threadIdx.x;
	int i = blockIdx.x * blockDim.x + threadIdx.x;

	if (tid == 0)
	{
		for (int j = 0; j < 10; j++)
			localB[j] = 0;
	}

	if (i < size)
	{
		int range = A[i] / 100;
		atomicAdd(&localB[range], 1);
	}

	__syncthreads();

	if (tid == 0)
	{
		for (int j = 0; j < 10; ++j)
		{
			atomicAdd(&B2[j], localB[j]);
			//B2[j] += localB[j];
		}
	}

	__syncthreads();
}

__global__ void countEntriesPartC(int *B, int *C, int size)
{
	extern __shared__ int smem[];
	int tid = threadIdx.x;

	if (tid < 10)
	{
		smem[2 * tid] = B[2 * tid];
		smem[2 * tid + 1] = B[2 * tid + 1];
	}

	else
	{
		smem[2 * tid] = 0;
		smem[2 * tid + 1] = 0;
	}

	int offset = 1;
	for (int d = size >> 1; d > 0; d >>= 1)
	{
		__syncthreads();

		if (tid < d)
		{
			int ai = offset * (2 * tid + 1) - 1;
			int bi = offset * (2 * tid + 2) - 1;
			smem[bi] += smem[ai];
		}
		offset *= 2;
	}

	if (tid == 0)
	{
		smem[size - 1] = 0;
	}

	for (int d = 1; d < size; d *= 2)
	{
		offset >>= 1;
		__syncthreads();
		if (tid < d)
		{
			int ai = offset * (2 * tid + 1) - 1;
			int bi = offset * (2 * tid + 2) - 1;
			int temp = smem[ai];
			smem[ai] = smem[bi];
			smem[bi] += temp;
		}
	}

	__syncthreads();

	C[2 * tid] = smem[2 * tid + 1];
	C[2 * tid + 1] = smem[2 * tid + 2];
	if ((2 * tid + 1) == 9)
	{
		C[2 * tid + 1] = smem[2 * tid + 1] + B[9];
	}
}

int main()
{
	vector<int> data;
	int *A, *B, *C;
	int *B2;
	int *d_A, *d_B, *d_B2, *d_C;
	int size;
	int Bsize = 10 * sizeof(int);

	ifstream infile;
	infile.open("inp.txt");

	// Read file input and push to vector
	if (infile.is_open())
	{
		while (infile.good())
		{
			char cNum[10];
			infile.getline(cNum, 256, ',');
			int num = atoi(cNum);
			data.push_back(num);
		}
		size = data.size() * sizeof(int);
		infile.close();
	}
	else
	{
		cout << "Error opening file";
	}

	// Alloc space for host copies
	A = (int *)malloc(size);
	B = (int *)calloc(10, sizeof(int));
	B2 = (int *)calloc(10, sizeof(int));
	C = (int *)calloc(10, sizeof(int));

	// Alloc space for device copies
	cudaMalloc((void **)&d_A, size);
	cudaMalloc((void **)&d_B, Bsize);
	cudaMalloc((void **)&d_B2, Bsize);
	cudaMalloc((void **)&d_C, Bsize);

	// Copy inputs to device
	cudaMemcpy(d_A, data.data(), size, cudaMemcpyHostToDevice);

	countEntriesPartA<<<data.size() / BLOCK_SIZE + 1, BLOCK_SIZE>>>(d_A, d_B, data.size());
	countEntriesPartB<<<data.size() / BLOCK_SIZE + 1, BLOCK_SIZE>>>(d_A, d_B2, data.size());
	countEntriesPartC<<<1, 5, 2 * 16 * sizeof(int)>>>(d_B, d_C, 16);
	// Copy result back to host
	cudaMemcpy(B, d_B, Bsize, cudaMemcpyDeviceToHost);
	cudaMemcpy(B2, d_B2, Bsize, cudaMemcpyDeviceToHost);
	cudaMemcpy(C, d_C, Bsize, cudaMemcpyDeviceToHost);

	// for (int i = 0; i < 10; ++i)
	// {
	// 	cout << B[i] << ' ';
	// }
	// cout << '\n';

	// for (int i = 0; i < 10; ++i)
	// {
	// 	cout << B2[i] << ' ';
	// }
	// cout << '\n';

	// for (int i = 0; i < 10; ++i)
	// {
	// 	cout << C[i] << ' ';
	// }
	// cout << '\n';

	ofstream outfile;
	outfile.open("q2a.txt");

	if (outfile.is_open())
	{

		for (int i = 0; i < 10; i++)
		{
			outfile << 	B[i] << ", ";
		}

		outfile.close();
	}
	else
	{
		cout << "Error opening file";
	}

	outfile.open("q2b.txt");

	if (outfile.is_open())
	{

		for (int i = 0; i < 10; i++)
		{
			outfile << 	B2[i] << ", ";
		}

		outfile.close();
	}
	else
	{
		cout << "Error opening file";
	}


	outfile.open("q2c.txt");

	if (outfile.is_open())
	{

		for (int i = 0; i < 10; i++)
		{
			outfile << 	C[i] << ", ";
		}

		outfile.close();
	}
	else
	{
		cout << "Error opening file";
	}

	// Cleanup
	free(A);
	free(B);
	free(B2);
	free(C);
	cudaFree(d_A);
	cudaFree(d_B);
	cudaFree(d_B2);
	cudaFree(d_C);

	return 0;
}

	.file	"tmpxft_00329d13_00000000-6_q2.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4142:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4142:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.type	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0, @function
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0:
.LFB4937:
	.cfi_startproc
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	testq	%rsi, %rsi
	jne	.L3
	movq	(%rdi), %rax
	movl	$1, %esi
	addq	-24(%rax), %rbx
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate@PLT
.L3:
	.cfi_restore_state
	movq	%rsi, %rdi
	movq	%rsi, 8(%rsp)
	call	strlen@PLT
	movq	8(%rsp), %rsi
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	movq	%rax, %rdx
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
	.cfi_endproc
.LFE4937:
	.size	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0, .-_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
	.globl	_Z40__device_stub__Z17countEntriesPartAPiS_iPiS_i
	.type	_Z40__device_stub__Z17countEntriesPartAPiS_iPiS_i, @function
_Z40__device_stub__Z17countEntriesPartAPiS_iPiS_i:
.LFB4164:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L6
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z17countEntriesPartAPiS_i(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	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 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L6:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4164:
	.size	_Z40__device_stub__Z17countEntriesPartAPiS_iPiS_i, .-_Z40__device_stub__Z17countEntriesPartAPiS_iPiS_i
	.globl	_Z17countEntriesPartAPiS_i
	.type	_Z17countEntriesPartAPiS_i, @function
_Z17countEntriesPartAPiS_i:
.LFB4165:
	.cfi_startproc
	endbr64
	jmp	_Z40__device_stub__Z17countEntriesPartAPiS_iPiS_i
	.cfi_endproc
.LFE4165:
	.size	_Z17countEntriesPartAPiS_i, .-_Z17countEntriesPartAPiS_i
	.globl	_Z40__device_stub__Z17countEntriesPartBPiS_iPiS_i
	.type	_Z40__device_stub__Z17countEntriesPartBPiS_iPiS_i, @function
_Z40__device_stub__Z17countEntriesPartBPiS_iPiS_i:
.LFB4166:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L11
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z17countEntriesPartBPiS_i(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	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 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L11:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4166:
	.size	_Z40__device_stub__Z17countEntriesPartBPiS_iPiS_i, .-_Z40__device_stub__Z17countEntriesPartBPiS_iPiS_i
	.globl	_Z17countEntriesPartBPiS_i
	.type	_Z17countEntriesPartBPiS_i, @function
_Z17countEntriesPartBPiS_i:
.LFB4167:
	.cfi_startproc
	endbr64
	jmp	_Z40__device_stub__Z17countEntriesPartBPiS_iPiS_i
	.cfi_endproc
.LFE4167:
	.size	_Z17countEntriesPartBPiS_i, .-_Z17countEntriesPartBPiS_i
	.globl	_Z40__device_stub__Z17countEntriesPartCPiS_iPiS_i
	.type	_Z40__device_stub__Z17countEntriesPartCPiS_iPiS_i, @function
_Z40__device_stub__Z17countEntriesPartCPiS_iPiS_i:
.LFB4168:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L16
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z17countEntriesPartCPiS_i(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	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 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L16:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4168:
	.size	_Z40__device_stub__Z17countEntriesPartCPiS_iPiS_i, .-_Z40__device_stub__Z17countEntriesPartCPiS_iPiS_i
	.globl	_Z17countEntriesPartCPiS_i
	.type	_Z17countEntriesPartCPiS_i, @function
_Z17countEntriesPartCPiS_i:
.LFB4169:
	.cfi_startproc
	endbr64
	jmp	_Z40__device_stub__Z17countEntriesPartCPiS_iPiS_i
	.cfi_endproc
.LFE4169:
	.size	_Z17countEntriesPartCPiS_i, .-_Z17countEntriesPartCPiS_i
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z17countEntriesPartCPiS_i"
.LC1:
	.string	"_Z17countEntriesPartBPiS_i"
.LC2:
	.string	"_Z17countEntriesPartAPiS_i"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4171:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z17countEntriesPartCPiS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC1(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z17countEntriesPartBPiS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC2(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z17countEntriesPartAPiS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4171:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZNSt6vectorIiSaIiEED2Ev,"axG",@progbits,_ZNSt6vectorIiSaIiEED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIiSaIiEED2Ev
	.type	_ZNSt6vectorIiSaIiEED2Ev, @function
_ZNSt6vectorIiSaIiEED2Ev:
.LFB4497:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L23
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L23:
	ret
	.cfi_endproc
.LFE4497:
	.size	_ZNSt6vectorIiSaIiEED2Ev, .-_ZNSt6vectorIiSaIiEED2Ev
	.weak	_ZNSt6vectorIiSaIiEED1Ev
	.set	_ZNSt6vectorIiSaIiEED1Ev,_ZNSt6vectorIiSaIiEED2Ev
	.section	.rodata._ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_.str1.1,"aMS",@progbits,1
.LC3:
	.string	"vector::_M_realloc_insert"
	.section	.text._ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_,"axG",@progbits,_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_,comdat
	.align 2
	.weak	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
	.type	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_, @function
_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_:
.LFB4702:
	.cfi_startproc
	endbr64
	movabsq	$2305843009213693951, %rcx
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	8(%rdi), %rax
	movq	(%rdi), %r14
	movq	%rax, %rbx
	movq	%rax, (%rsp)
	subq	%r14, %rbx
	sarq	$2, %rbx
	cmpq	%rcx, %rbx
	jne	.L26
	leaq	.LC3(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L26:
	cmpq	%r14, (%rsp)
	movl	$1, %eax
	movq	%rsi, %r15
	movq	%rdi, %r13
	cmovne	%rbx, %rax
	movq	%rsi, %rbp
	addq	%rax, %rbx
	setc	%al
	subq	%r14, %r15
	movzbl	%al, %eax
	testq	%rax, %rax
	jne	.L36
	xorl	%r12d, %r12d
	testq	%rbx, %rbx
	je	.L31
	movabsq	$2305843009213693951, %rax
	cmpq	%rax, %rbx
	cmova	%rax, %rbx
	jmp	.L30
.L36:
	movq	%rcx, %rbx
.L30:
	leaq	0(,%rbx,4), %rdi
	movq	%rdx, 8(%rsp)
	call	_Znwm@PLT
	movq	8(%rsp), %rdx
	movq	%rax, %r12
.L31:
	movl	(%rdx), %eax
	movl	%eax, (%r12,%r15)
	testq	%r15, %r15
	jle	.L32
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r12, %rdi
	call	memmove@PLT
.L32:
	movq	(%rsp), %rax
	leaq	4(%r12,%r15), %rdx
	subq	%rbp, %rax
	testq	%rax, %rax
	jle	.L33
	movq	%rdx, %rdi
	movq	%rbp, %rsi
	movq	%rax, %rcx
	rep movsb
.L33:
	leaq	(%rdx,%rax), %rbp
	testq	%r14, %r14
	je	.L34
	movq	16(%r13), %rsi
	movq	%r14, %rdi
	subq	%r14, %rsi
	call	_ZdlPvm@PLT
.L34:
	leaq	(%r12,%rbx,4), %rax
	movq	%r12, 0(%r13)
	movq	%rbp, 8(%r13)
	movq	%rax, 16(%r13)
	addq	$24, %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
.LFE4702:
	.size	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_, .-_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
	.section	.rodata.str1.1
.LC4:
	.string	"inp.txt"
.LC5:
	.string	"Error opening file"
.LC6:
	.string	"q2a.txt"
.LC7:
	.string	", "
.LC8:
	.string	"q2b.txt"
.LC9:
	.string	"q2c.txt"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4129:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4129
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$1160, %rsp
	.cfi_def_cfa_offset 1216
	movq	%fs:40, %rax
	movq	%rax, 1144(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movq	%rax, 72(%rsp)
	movq	%rax, 80(%rsp)
	movq	%rax, 88(%rsp)
	leaq	608(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
.LEHB0:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE0:
	movq	8(%rsp), %rdi
	movl	$8, %edx
	leaq	.LC4(%rip), %rsi
.LEHB1:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	leaq	728(%rsp), %rdi
	leaq	1134(%rsp), %rbx
	call	_ZNKSt12__basic_fileIcE7is_openEv@PLT
	testb	%al, %al
	je	.L77
.L44:
	cmpl	$0, 896(%rsp)
	jne	.L78
	movq	8(%rsp), %rdi
	movl	$44, %ecx
	movl	$256, %edx
	movq	%rbx, %rsi
	call	_ZNSi7getlineEPclc@PLT
	movq	%rbx, %rdi
	call	atoi@PLT
	movq	80(%rsp), %rsi
	movl	%eax, 60(%rsp)
	cmpq	88(%rsp), %rsi
	je	.L46
	movl	%eax, (%rsi)
	addq	$4, %rsi
	movq	%rsi, 80(%rsp)
	jmp	.L44
.L46:
	leaq	60(%rsp), %rdx
	leaq	72(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
	jmp	.L44
.L78:
	movq	8(%rsp), %rdi
	movq	80(%rsp), %r13
	subl	72(%rsp), %r13d
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	jmp	.L49
.L77:
	leaq	.LC5(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
.L49:
	movl	$4, %esi
	movl	$10, %edi
	movslq	%r13d, %r13
	call	calloc@PLT
	movl	$4, %esi
	movl	$10, %edi
	movq	%rax, %r12
	call	calloc@PLT
	movl	$4, %esi
	movl	$10, %edi
	movq	%rax, %rbp
	call	calloc@PLT
	leaq	16(%rsp), %rdi
	movq	%r13, %rsi
	movq	%rax, %rbx
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movl	$40, %esi
	call	cudaMalloc@PLT
	leaq	32(%rsp), %rdi
	movl	$40, %esi
	call	cudaMalloc@PLT
	leaq	40(%rsp), %rdi
	movl	$40, %esi
	call	cudaMalloc@PLT
	movq	72(%rsp), %r14
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%r13, %rdx
	movq	%r14, %rsi
	call	cudaMemcpy@PLT
	movq	80(%rsp), %r13
	movl	$4194305, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movabsq	$4294967297, %rax
	salq	$10, %rdx
	movl	$1, %ecx
	movl	$1, 68(%rsp)
	subq	%r14, %r13
	movq	%rax, 52(%rsp)
	movl	56(%rsp), %esi
	sarq	$2, %r13
	movq	%rdx, 60(%rsp)
	movq	%r13, %r14
	shrq	$10, %r14
	incl	%r14d
	movl	%r14d, 48(%rsp)
	movq	48(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L50
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdi
	movl	%r13d, %edx
	call	_Z40__device_stub__Z17countEntriesPartAPiS_iPiS_i
.L50:
	movl	%r14d, 48(%rsp)
	movl	$4194305, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movabsq	$4294967297, %rax
	salq	$10, %rdx
	movl	$1, %ecx
	movl	$1, 68(%rsp)
	movq	%rax, 52(%rsp)
	movq	48(%rsp), %rdi
	movl	56(%rsp), %esi
	movq	%rdx, 60(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L51
	movq	32(%rsp), %rsi
	movq	16(%rsp), %rdi
	movl	%r13d, %edx
	call	_Z40__device_stub__Z17countEntriesPartBPiS_iPiS_i
.L51:
	xorl	%r9d, %r9d
	movl	$1, %ecx
	movabsq	$4294967301, %rdx
	movabsq	$4294967297, %rdi
	movl	$128, %r8d
	movl	$1, %esi
	movq	%rdx, 60(%rsp)
	movl	$1, 68(%rsp)
	movq	%rdi, 48(%rsp)
	movl	$1, 56(%rsp)
	call	__cudaPushCallConfiguration@PLT
	movq	24(%rsp), %rdi
	testl	%eax, %eax
	jne	.L52
	movq	40(%rsp), %rsi
	movl	$16, %edx
	call	_Z40__device_stub__Z17countEntriesPartCPiS_iPiS_i
.L52:
	movq	24(%rsp), %rsi
	movl	$2, %ecx
	movl	$40, %edx
	movq	%r12, %rdi
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movl	$40, %edx
	movq	%rbp, %rdi
	call	cudaMemcpy@PLT
	movq	40(%rsp), %rsi
	movl	$2, %ecx
	movl	$40, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	leaq	96(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE1:
	movq	(%rsp), %rdi
	movl	$16, %edx
	leaq	.LC6(%rip), %rsi
.LEHB2:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	leaq	208(%rsp), %r14
	movq	%r14, %rdi
	call	_ZNKSt12__basic_fileIcE7is_openEv@PLT
	testb	%al, %al
	je	.L53
	xorl	%r13d, %r13d
	leaq	.LC7(%rip), %r15
.L54:
	movl	(%r12,%r13,4), %esi
	movq	(%rsp), %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movq	%r15, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
	incq	%r13
	cmpq	$10, %r13
	jne	.L54
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	jmp	.L55
.L53:
	leaq	.LC5(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
.L55:
	movq	(%rsp), %rdi
	movl	$16, %edx
	leaq	.LC8(%rip), %rsi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movq	%r14, %rdi
	call	_ZNKSt12__basic_fileIcE7is_openEv@PLT
	testb	%al, %al
	je	.L56
	xorl	%r13d, %r13d
	leaq	.LC7(%rip), %r15
.L57:
	movl	0(%rbp,%r13,4), %esi
	movq	(%rsp), %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movq	%r15, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
	incq	%r13
	cmpq	$10, %r13
	jne	.L57
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	jmp	.L58
.L56:
	leaq	.LC5(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
.L58:
	movq	(%rsp), %rdi
	movl	$16, %edx
	leaq	.LC9(%rip), %rsi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movq	%r14, %rdi
	call	_ZNKSt12__basic_fileIcE7is_openEv@PLT
	testb	%al, %al
	je	.L59
	xorl	%r13d, %r13d
	leaq	.LC7(%rip), %r14
.L60:
	movl	(%rbx,%r13,4), %esi
	movq	(%rsp), %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movq	%r14, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
	incq	%r13
	cmpq	$10, %r13
	jne	.L60
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	jmp	.L61
.L59:
	leaq	.LC5(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
.L61:
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
.LEHE2:
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	72(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	movq	1144(%rsp), %rax
	subq	%fs:40, %rax
	je	.L66
	jmp	.L75
.L69:
	endbr64
	movq	%rax, %rbx
.L62:
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L63
.L68:
	endbr64
	movq	%rax, %rbx
.L63:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L64
.L67:
	endbr64
	movq	%rax, %rbx
.L64:
	leaq	72(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	movq	1144(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L75
	movq	%rbx, %rdi
.LEHB3:
	call	_Unwind_Resume@PLT
.LEHE3:
.L75:
	call	__stack_chk_fail@PLT
.L66:
	addq	$1160, %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
.LFE4129:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4129:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4129-.LLSDACSB4129
.LLSDACSB4129:
	.uleb128 .LEHB0-.LFB4129
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L67-.LFB4129
	.uleb128 0
	.uleb128 .LEHB1-.LFB4129
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L68-.LFB4129
	.uleb128 0
	.uleb128 .LEHB2-.LFB4129
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L69-.LFB4129
	.uleb128 0
	.uleb128 .LEHB3-.LFB4129
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
.LLSDACSE4129:
	.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
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <iostream>
#include <vector>
#include <string>
#include <fstream>

using namespace std;

#define BLOCK_SIZE 1024

__global__ void countEntriesPartA(int *A, int *B, int size)
{
	int i = blockIdx.x * blockDim.x + threadIdx.x;

	if (i < size)
	{
		int range = A[i] / 100;
		atomicAdd(&B[range], 1);
	}

	__syncthreads();
}

__global__ void countEntriesPartB(int *A, int *B2, int size)
{
	__shared__ int localB[10];
	int tid = threadIdx.x;
	int i = blockIdx.x * blockDim.x + threadIdx.x;

	if (tid == 0)
	{
		for (int j = 0; j < 10; j++)
			localB[j] = 0;
	}

	if (i < size)
	{
		int range = A[i] / 100;
		atomicAdd(&localB[range], 1);
	}

	__syncthreads();

	if (tid == 0)
	{
		for (int j = 0; j < 10; ++j)
		{
			atomicAdd(&B2[j], localB[j]);
			//B2[j] += localB[j];
		}
	}

	__syncthreads();
}

__global__ void countEntriesPartC(int *B, int *C, int size)
{
	extern __shared__ int smem[];
	int tid = threadIdx.x;

	if (tid < 10)
	{
		smem[2 * tid] = B[2 * tid];
		smem[2 * tid + 1] = B[2 * tid + 1];
	}

	else
	{
		smem[2 * tid] = 0;
		smem[2 * tid + 1] = 0;
	}

	int offset = 1;
	for (int d = size >> 1; d > 0; d >>= 1)
	{
		__syncthreads();

		if (tid < d)
		{
			int ai = offset * (2 * tid + 1) - 1;
			int bi = offset * (2 * tid + 2) - 1;
			smem[bi] += smem[ai];
		}
		offset *= 2;
	}

	if (tid == 0)
	{
		smem[size - 1] = 0;
	}

	for (int d = 1; d < size; d *= 2)
	{
		offset >>= 1;
		__syncthreads();
		if (tid < d)
		{
			int ai = offset * (2 * tid + 1) - 1;
			int bi = offset * (2 * tid + 2) - 1;
			int temp = smem[ai];
			smem[ai] = smem[bi];
			smem[bi] += temp;
		}
	}

	__syncthreads();

	C[2 * tid] = smem[2 * tid + 1];
	C[2 * tid + 1] = smem[2 * tid + 2];
	if ((2 * tid + 1) == 9)
	{
		C[2 * tid + 1] = smem[2 * tid + 1] + B[9];
	}
}

int main()
{
	vector<int> data;
	int *A, *B, *C;
	int *B2;
	int *d_A, *d_B, *d_B2, *d_C;
	int size;
	int Bsize = 10 * sizeof(int);

	ifstream infile;
	infile.open("inp.txt");

	// Read file input and push to vector
	if (infile.is_open())
	{
		while (infile.good())
		{
			char cNum[10];
			infile.getline(cNum, 256, ',');
			int num = atoi(cNum);
			data.push_back(num);
		}
		size = data.size() * sizeof(int);
		infile.close();
	}
	else
	{
		cout << "Error opening file";
	}

	// Alloc space for host copies
	A = (int *)malloc(size);
	B = (int *)calloc(10, sizeof(int));
	B2 = (int *)calloc(10, sizeof(int));
	C = (int *)calloc(10, sizeof(int));

	// Alloc space for device copies
	hipMalloc((void **)&d_A, size);
	hipMalloc((void **)&d_B, Bsize);
	hipMalloc((void **)&d_B2, Bsize);
	hipMalloc((void **)&d_C, Bsize);

	// Copy inputs to device
	hipMemcpy(d_A, data.data(), size, hipMemcpyHostToDevice);

	countEntriesPartA<<<data.size() / BLOCK_SIZE + 1, BLOCK_SIZE>>>(d_A, d_B, data.size());
	countEntriesPartB<<<data.size() / BLOCK_SIZE + 1, BLOCK_SIZE>>>(d_A, d_B2, data.size());
	countEntriesPartC<<<1, 5, 2 * 16 * sizeof(int)>>>(d_B, d_C, 16);
	// Copy result back to host
	hipMemcpy(B, d_B, Bsize, hipMemcpyDeviceToHost);
	hipMemcpy(B2, d_B2, Bsize, hipMemcpyDeviceToHost);
	hipMemcpy(C, d_C, Bsize, hipMemcpyDeviceToHost);

	// for (int i = 0; i < 10; ++i)
	// {
	// 	cout << B[i] << ' ';
	// }
	// cout << '\n';

	// for (int i = 0; i < 10; ++i)
	// {
	// 	cout << B2[i] << ' ';
	// }
	// cout << '\n';

	// for (int i = 0; i < 10; ++i)
	// {
	// 	cout << C[i] << ' ';
	// }
	// cout << '\n';

	ofstream outfile;
	outfile.open("q2a.txt");

	if (outfile.is_open())
	{

		for (int i = 0; i < 10; i++)
		{
			outfile << 	B[i] << ", ";
		}

		outfile.close();
	}
	else
	{
		cout << "Error opening file";
	}

	outfile.open("q2b.txt");

	if (outfile.is_open())
	{

		for (int i = 0; i < 10; i++)
		{
			outfile << 	B2[i] << ", ";
		}

		outfile.close();
	}
	else
	{
		cout << "Error opening file";
	}


	outfile.open("q2c.txt");

	if (outfile.is_open())
	{

		for (int i = 0; i < 10; i++)
		{
			outfile << 	C[i] << ", ";
		}

		outfile.close();
	}
	else
	{
		cout << "Error opening file";
	}

	// Cleanup
	free(A);
	free(B);
	free(B2);
	free(C);
	hipFree(d_A);
	hipFree(d_B);
	hipFree(d_B2);
	hipFree(d_C);

	return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z32__device_stub__countEntriesPartAPiS_i # -- Begin function _Z32__device_stub__countEntriesPartAPiS_i
	.type	_Z32__device_stub__countEntriesPartAPiS_i,@function
_Z32__device_stub__countEntriesPartAPiS_i: # @_Z32__device_stub__countEntriesPartAPiS_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	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z17countEntriesPartAPiS_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z32__device_stub__countEntriesPartAPiS_i, .Lfunc_end0-_Z32__device_stub__countEntriesPartAPiS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z32__device_stub__countEntriesPartBPiS_i # -- Begin function _Z32__device_stub__countEntriesPartBPiS_i
	.type	_Z32__device_stub__countEntriesPartBPiS_i,@function
_Z32__device_stub__countEntriesPartBPiS_i: # @_Z32__device_stub__countEntriesPartBPiS_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	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z17countEntriesPartBPiS_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z32__device_stub__countEntriesPartBPiS_i, .Lfunc_end1-_Z32__device_stub__countEntriesPartBPiS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z32__device_stub__countEntriesPartCPiS_i # -- Begin function _Z32__device_stub__countEntriesPartCPiS_i
	.type	_Z32__device_stub__countEntriesPartCPiS_i,@function
_Z32__device_stub__countEntriesPartCPiS_i: # @_Z32__device_stub__countEntriesPartCPiS_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	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z17countEntriesPartCPiS_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z32__device_stub__countEntriesPartCPiS_i, .Lfunc_end2-_Z32__device_stub__countEntriesPartCPiS_i
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$1096, %rsp                     # imm = 0x448
	.cfi_def_cfa_offset 1152
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	xorps	%xmm0, %xmm0
	movaps	%xmm0, (%rsp)
	movq	$0, 16(%rsp)
	leaq	576(%rsp), %rbx
	movq	%rbx, %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev
.Ltmp0:
	movl	$.L.str, %esi
	movq	%rbx, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp1:
# %bb.1:
	leaq	696(%rsp), %rdi
	callq	_ZNKSt12__basic_fileIcE7is_openEv
	testb	%al, %al
	je	.LBB3_11
# %bb.2:                                # %.preheader89
	movq	576(%rsp), %rax
	movq	-24(%rax), %rax
	cmpl	$0, 608(%rsp,%rax)
	jne	.LBB3_9
# %bb.3:                                # %.lr.ph
	leaq	576(%rsp), %rbx
	leaq	64(%rsp), %r14
	movq	%rsp, %r15
	leaq	60(%rsp), %r12
.LBB3_4:                                # =>This Inner Loop Header: Depth=1
.Ltmp4:
	movl	$256, %edx                      # imm = 0x100
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$44, %ecx
	callq	_ZNSi7getlineEPclc
.Ltmp5:
# %bb.5:                                #   in Loop: Header=BB3_4 Depth=1
	movq	%r14, %rdi
	callq	atoi
	movl	%eax, 60(%rsp)
	movq	8(%rsp), %rsi
	cmpq	16(%rsp), %rsi
	je	.LBB3_7
# %bb.6:                                #   in Loop: Header=BB3_4 Depth=1
	movl	%eax, (%rsi)
	addq	$4, %rsi
	movq	%rsi, 8(%rsp)
	jmp	.LBB3_8
.LBB3_7:                                #   in Loop: Header=BB3_4 Depth=1
.Ltmp7:
	movq	%r15, %rdi
	movq	%r12, %rdx
	callq	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
.Ltmp8:
.LBB3_8:                                # %_ZNSt6vectorIiSaIiEE9push_backERKi.exit
                                        #   in Loop: Header=BB3_4 Depth=1
	movq	576(%rsp), %rax
	movq	-24(%rax), %rax
	cmpl	$0, 608(%rsp,%rax)
	je	.LBB3_4
.LBB3_9:                                # %._crit_edge
	movq	8(%rsp), %rbx
	subq	(%rsp), %rbx
.Ltmp10:
	leaq	576(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp11:
# %bb.10:
	andq	$-4, %rbx
	jmp	.LBB3_13
.LBB3_11:
.Ltmp2:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$18, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp3:
# %bb.12:
	xorl	%ebx, %ebx
.LBB3_13:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movslq	%ebx, %r12
	movl	$10, %edi
	movl	$4, %esi
	callq	calloc
	movq	%rax, %rbx
	movl	$10, %edi
	movl	$4, %esi
	callq	calloc
	movq	%rax, %r14
	movl	$10, %edi
	movl	$4, %esi
	callq	calloc
	movq	%rax, %r15
.Ltmp12:
	leaq	32(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
.Ltmp13:
# %bb.14:
.Ltmp14:
	leaq	24(%rsp), %rdi
	movl	$40, %esi
	callq	hipMalloc
.Ltmp15:
# %bb.15:
.Ltmp16:
	leaq	48(%rsp), %rdi
	movl	$40, %esi
	callq	hipMalloc
.Ltmp17:
# %bb.16:
.Ltmp18:
	leaq	40(%rsp), %rdi
	movl	$40, %esi
	callq	hipMalloc
.Ltmp19:
# %bb.17:
	movq	32(%rsp), %rdi
	movq	(%rsp), %rsi
.Ltmp20:
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp21:
# %bb.18:
	movq	8(%rsp), %rdi
	subq	(%rsp), %rdi
	shrq	$12, %rdi
	incl	%edi
	btsq	$32, %rdi
.Ltmp22:
	movabsq	$4294968320, %rdx               # imm = 0x100000400
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp23:
# %bb.19:
	testl	%eax, %eax
	jne	.LBB3_21
# %bb.20:
	movq	32(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	8(%rsp), %rdx
	subq	(%rsp), %rdx
	shrq	$2, %rdx
.Ltmp24:
                                        # kill: def $edx killed $edx killed $rdx
	callq	_Z32__device_stub__countEntriesPartAPiS_i
.Ltmp25:
.LBB3_21:
	movq	8(%rsp), %rdi
	subq	(%rsp), %rdi
	movabsq	$4294967296, %rax               # imm = 0x100000000
	shrq	$12, %rdi
	incl	%edi
	orq	%rax, %rdi
.Ltmp26:
	movabsq	$4294968320, %rdx               # imm = 0x100000400
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp27:
# %bb.22:
	testl	%eax, %eax
	jne	.LBB3_24
# %bb.23:
	movq	32(%rsp), %rdi
	movq	48(%rsp), %rsi
	movq	8(%rsp), %rdx
	subq	(%rsp), %rdx
	shrq	$2, %rdx
.Ltmp28:
                                        # kill: def $edx killed $edx killed $rdx
	callq	_Z32__device_stub__countEntriesPartBPiS_i
.Ltmp29:
.LBB3_24:
.Ltmp30:
	movabsq	$4294967297, %rdi               # imm = 0x100000001
	movabsq	$4294967301, %rdx               # imm = 0x100000005
	movl	$128, %r8d
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp31:
# %bb.25:
	testl	%eax, %eax
	jne	.LBB3_27
# %bb.26:
	movq	24(%rsp), %rdi
	movq	40(%rsp), %rsi
.Ltmp32:
	movl	$16, %edx
	callq	_Z32__device_stub__countEntriesPartCPiS_i
.Ltmp33:
.LBB3_27:
	movq	24(%rsp), %rsi
.Ltmp34:
	movl	$40, %edx
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp35:
# %bb.28:
	movq	48(%rsp), %rsi
.Ltmp36:
	movl	$40, %edx
	movq	%r14, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp37:
# %bb.29:
	movq	40(%rsp), %rsi
.Ltmp38:
	movl	$40, %edx
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp39:
# %bb.30:
.Ltmp41:
	leaq	64(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp42:
# %bb.31:
.Ltmp44:
	leaq	64(%rsp), %rdi
	movl	$.L.str.2, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp45:
# %bb.32:
	leaq	176(%rsp), %r12
	movq	%r12, %rdi
	callq	_ZNKSt12__basic_fileIcE7is_openEv
	testb	%al, %al
	je	.LBB3_38
# %bb.33:                               # %.preheader88.preheader
	xorl	%ebp, %ebp
	leaq	64(%rsp), %r13
.LBB3_34:                               # %.preheader88
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rbx,%rbp,4), %esi
.Ltmp48:
	movq	%r13, %rdi
	callq	_ZNSolsEi
.Ltmp49:
# %bb.35:                               #   in Loop: Header=BB3_34 Depth=1
.Ltmp50:
	movl	$.L.str.3, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp51:
# %bb.36:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit59
                                        #   in Loop: Header=BB3_34 Depth=1
	incq	%rbp
	cmpq	$10, %rbp
	jne	.LBB3_34
# %bb.37:
.Ltmp53:
	leaq	64(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp54:
	jmp	.LBB3_39
.LBB3_38:
.Ltmp46:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$18, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp47:
.LBB3_39:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit61
.Ltmp55:
	leaq	64(%rsp), %rdi
	movl	$.L.str.4, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp56:
# %bb.40:
	movq	%r12, %rdi
	callq	_ZNKSt12__basic_fileIcE7is_openEv
	testb	%al, %al
	je	.LBB3_46
# %bb.41:                               # %.preheader87.preheader
	xorl	%ebp, %ebp
	leaq	64(%rsp), %r13
.LBB3_42:                               # %.preheader87
                                        # =>This Inner Loop Header: Depth=1
	movl	(%r14,%rbp,4), %esi
.Ltmp59:
	movq	%r13, %rdi
	callq	_ZNSolsEi
.Ltmp60:
# %bb.43:                               #   in Loop: Header=BB3_42 Depth=1
.Ltmp61:
	movl	$.L.str.3, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp62:
# %bb.44:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit63
                                        #   in Loop: Header=BB3_42 Depth=1
	incq	%rbp
	cmpq	$10, %rbp
	jne	.LBB3_42
# %bb.45:
.Ltmp64:
	leaq	64(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp65:
	jmp	.LBB3_47
.LBB3_46:
.Ltmp57:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$18, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp58:
.LBB3_47:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit65
.Ltmp66:
	leaq	64(%rsp), %rdi
	movl	$.L.str.5, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp67:
# %bb.48:
	movq	%r12, %rdi
	callq	_ZNKSt12__basic_fileIcE7is_openEv
	testb	%al, %al
	je	.LBB3_54
# %bb.49:                               # %.preheader.preheader
	xorl	%r13d, %r13d
	leaq	64(%rsp), %r12
.LBB3_50:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	movl	(%r15,%r13,4), %esi
.Ltmp70:
	movq	%r12, %rdi
	callq	_ZNSolsEi
.Ltmp71:
# %bb.51:                               #   in Loop: Header=BB3_50 Depth=1
.Ltmp72:
	movl	$.L.str.3, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp73:
# %bb.52:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit67
                                        #   in Loop: Header=BB3_50 Depth=1
	incq	%r13
	cmpq	$10, %r13
	jne	.LBB3_50
# %bb.53:
.Ltmp75:
	leaq	64(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp76:
	jmp	.LBB3_55
.LBB3_54:
.Ltmp68:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$18, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp69:
.LBB3_55:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit69
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	movq	32(%rsp), %rdi
.Ltmp77:
	callq	hipFree
.Ltmp78:
# %bb.56:
	movq	24(%rsp), %rdi
.Ltmp79:
	callq	hipFree
.Ltmp80:
# %bb.57:
	movq	48(%rsp), %rdi
.Ltmp81:
	callq	hipFree
.Ltmp82:
# %bb.58:
	movq	40(%rsp), %rdi
.Ltmp83:
	callq	hipFree
.Ltmp84:
# %bb.59:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	72(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 64(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	312(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	leaq	576(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB3_61
# %bb.60:
	callq	_ZdlPv
.LBB3_61:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit
	xorl	%eax, %eax
	addq	$1096, %rsp                     # imm = 0x448
	.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
.LBB3_62:
	.cfi_def_cfa_offset 1152
.Ltmp43:
	jmp	.LBB3_67
.LBB3_63:
.Ltmp9:
	jmp	.LBB3_67
.LBB3_64:
.Ltmp6:
	jmp	.LBB3_67
.LBB3_65:
.Ltmp85:
	jmp	.LBB3_71
.LBB3_66:
.Ltmp40:
.LBB3_67:
	movq	%rax, %rbx
	jmp	.LBB3_72
.LBB3_68:
.Ltmp74:
	jmp	.LBB3_71
.LBB3_69:
.Ltmp63:
	jmp	.LBB3_71
.LBB3_70:
.Ltmp52:
.LBB3_71:
	movq	%rax, %rbx
	leaq	64(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
.LBB3_72:
	leaq	576(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB3_74
# %bb.73:
	callq	_ZdlPv
.LBB3_74:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit71
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table3:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp40-.Lfunc_begin0          #     jumps to .Ltmp40
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp4-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp5-.Ltmp4                  #   Call between .Ltmp4 and .Ltmp5
	.uleb128 .Ltmp6-.Lfunc_begin0           #     jumps to .Ltmp6
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp7-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp8-.Ltmp7                  #   Call between .Ltmp7 and .Ltmp8
	.uleb128 .Ltmp9-.Lfunc_begin0           #     jumps to .Ltmp9
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp10-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp39-.Ltmp10                #   Call between .Ltmp10 and .Ltmp39
	.uleb128 .Ltmp40-.Lfunc_begin0          #     jumps to .Ltmp40
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp41-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp42-.Ltmp41                #   Call between .Ltmp41 and .Ltmp42
	.uleb128 .Ltmp43-.Lfunc_begin0          #     jumps to .Ltmp43
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp44-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp45-.Ltmp44                #   Call between .Ltmp44 and .Ltmp45
	.uleb128 .Ltmp85-.Lfunc_begin0          #     jumps to .Ltmp85
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp48-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp51-.Ltmp48                #   Call between .Ltmp48 and .Ltmp51
	.uleb128 .Ltmp52-.Lfunc_begin0          #     jumps to .Ltmp52
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp53-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp56-.Ltmp53                #   Call between .Ltmp53 and .Ltmp56
	.uleb128 .Ltmp85-.Lfunc_begin0          #     jumps to .Ltmp85
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp59-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp62-.Ltmp59                #   Call between .Ltmp59 and .Ltmp62
	.uleb128 .Ltmp63-.Lfunc_begin0          #     jumps to .Ltmp63
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp64-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp67-.Ltmp64                #   Call between .Ltmp64 and .Ltmp67
	.uleb128 .Ltmp85-.Lfunc_begin0          #     jumps to .Ltmp85
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp70-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp73-.Ltmp70                #   Call between .Ltmp70 and .Ltmp73
	.uleb128 .Ltmp74-.Lfunc_begin0          #     jumps to .Ltmp74
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp75-.Lfunc_begin0          # >> Call Site 13 <<
	.uleb128 .Ltmp84-.Ltmp75                #   Call between .Ltmp75 and .Ltmp84
	.uleb128 .Ltmp85-.Lfunc_begin0          #     jumps to .Ltmp85
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp84-.Lfunc_begin0          # >> Call Site 14 <<
	.uleb128 .Lfunc_end3-.Ltmp84            #   Call between .Ltmp84 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_,"axG",@progbits,_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_,comdat
	.weak	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_ # -- Begin function _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
	.p2align	1, 0x90
	.type	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_,@function
_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_: # @_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, (%rsp)                    # 8-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movl	$1, %esi
	movl	$.L.str.6, %edx
	callq	_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc
	movq	(%rbx), %r13
	movq	8(%rbx), %r15
	movq	%r12, 8(%rsp)                   # 8-byte Spill
	subq	%r13, %r12
	movq	%r12, %r14
	sarq	$2, %r14
	testq	%rax, %rax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	je	.LBB4_1
# %bb.2:
	movq	%rbx, %rdi
	movq	%rax, %rsi
	xorl	%edx, %edx
	callq	_ZNSt15__new_allocatorIiE8allocateEmPKv
	movq	%rax, %rbp
	jmp	.LBB4_3
.LBB4_1:
	xorl	%ebp, %ebp
.LBB4_3:                                # %_ZNSt12_Vector_baseIiSaIiEE11_M_allocateEm.exit
	movq	(%rsp), %rax                    # 8-byte Reload
	movl	(%rax), %eax
	movl	%eax, (%rbp,%r14,4)
	testq	%r12, %r12
	jle	.LBB4_5
# %bb.4:
	movq	%rbp, %rdi
	movq	%r13, %rsi
	movq	%r12, %rdx
	callq	memmove@PLT
.LBB4_5:                                # %_ZNSt6vectorIiSaIiEE11_S_relocateEPiS2_S2_RS0_.exit
	addq	%rbp, %r12
	addq	$4, %r12
	movq	8(%rsp), %rsi                   # 8-byte Reload
	subq	%rsi, %r15
	testq	%r15, %r15
	jle	.LBB4_7
# %bb.6:
	movq	%r12, %rdi
	movq	%r15, %rdx
	callq	memmove@PLT
.LBB4_7:                                # %_ZNSt6vectorIiSaIiEE11_S_relocateEPiS2_S2_RS0_.exit16
	testq	%r13, %r13
	je	.LBB4_9
# %bb.8:
	movq	%r13, %rdi
	callq	_ZdlPv
.LBB4_9:                                # %_ZNSt12_Vector_baseIiSaIiEE13_M_deallocateEPim.exit
	addq	%r15, %r12
	movq	%rbp, (%rbx)
	movq	%r12, 8(%rbx)
	movq	16(%rsp), %rax                  # 8-byte Reload
	leaq	(,%rax,4), %rax
	addq	%rbp, %rax
	movq	%rax, 16(%rbx)
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_, .Lfunc_end4-_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc,"axG",@progbits,_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc,comdat
	.weak	_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc # -- Begin function _ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc
	.p2align	1, 0x90
	.type	_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc,@function
_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc: # @_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc
	.cfi_startproc
# %bb.0:
	movabsq	$2305843009213693951, %rcx      # imm = 0x1FFFFFFFFFFFFFFF
	movq	8(%rdi), %r8
	subq	(%rdi), %r8
	sarq	$2, %r8
	movq	%rcx, %rax
	subq	%r8, %rax
	cmpq	%rsi, %rax
	jb	.LBB5_2
# %bb.1:
	cmpq	%rsi, %r8
	cmovaq	%r8, %rsi
	leaq	(%rsi,%r8), %rax
	cmpq	%rcx, %rax
	cmovaeq	%rcx, %rax
	addq	%r8, %rsi
	cmovbq	%rcx, %rax
	retq
.LBB5_2:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rdx, %rdi
	callq	_ZSt20__throw_length_errorPKc
.Lfunc_end5:
	.size	_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc, .Lfunc_end5-_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt15__new_allocatorIiE8allocateEmPKv,"axG",@progbits,_ZNSt15__new_allocatorIiE8allocateEmPKv,comdat
	.weak	_ZNSt15__new_allocatorIiE8allocateEmPKv # -- Begin function _ZNSt15__new_allocatorIiE8allocateEmPKv
	.p2align	1, 0x90
	.type	_ZNSt15__new_allocatorIiE8allocateEmPKv,@function
_ZNSt15__new_allocatorIiE8allocateEmPKv: # @_ZNSt15__new_allocatorIiE8allocateEmPKv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rsi, %rax
	shrq	$61, %rax
	jne	.LBB6_1
# %bb.3:
	shlq	$2, %rsi
	movq	%rsi, %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Znwm                           # TAILCALL
.LBB6_1:
	.cfi_def_cfa_offset 16
	shrq	$62, %rsi
	je	.LBB6_2
# %bb.4:
	callq	_ZSt28__throw_bad_array_new_lengthv
.LBB6_2:
	callq	_ZSt17__throw_bad_allocv
.Lfunc_end6:
	.size	_ZNSt15__new_allocatorIiE8allocateEmPKv, .Lfunc_end6-_ZNSt15__new_allocatorIiE8allocateEmPKv
	.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:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17countEntriesPartAPiS_i, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17countEntriesPartBPiS_i, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17countEntriesPartCPiS_i, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__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	.LBB8_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
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z17countEntriesPartAPiS_i,@object # @_Z17countEntriesPartAPiS_i
	.section	.rodata,"a",@progbits
	.globl	_Z17countEntriesPartAPiS_i
	.p2align	3, 0x0
_Z17countEntriesPartAPiS_i:
	.quad	_Z32__device_stub__countEntriesPartAPiS_i
	.size	_Z17countEntriesPartAPiS_i, 8

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

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"inp.txt"
	.size	.L.str, 8

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Error opening file"
	.size	.L.str.1, 19

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"q2a.txt"
	.size	.L.str.2, 8

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

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"q2b.txt"
	.size	.L.str.4, 8

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"q2c.txt"
	.size	.L.str.5, 8

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"vector::_M_realloc_insert"
	.size	.L.str.6, 26

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z17countEntriesPartAPiS_i"
	.size	.L__unnamed_1, 27

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z17countEntriesPartBPiS_i"
	.size	.L__unnamed_2, 27

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z17countEntriesPartCPiS_i"
	.size	.L__unnamed_3, 27

	.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 _Z32__device_stub__countEntriesPartAPiS_i
	.addrsig_sym _Z32__device_stub__countEntriesPartBPiS_i
	.addrsig_sym _Z32__device_stub__countEntriesPartCPiS_i
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z17countEntriesPartAPiS_i
	.addrsig_sym _Z17countEntriesPartBPiS_i
	.addrsig_sym _Z17countEntriesPartCPiS_i
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z17countEntriesPartAPiS_i ; -- Begin function _Z17countEntriesPartAPiS_i
	.globl	_Z17countEntriesPartAPiS_i
	.p2align	8
	.type	_Z17countEntriesPartAPiS_i,@function
_Z17countEntriesPartAPiS_i:             ; @_Z17countEntriesPartAPiS_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b32 s3, s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	v_mov_b32_e32 v2, 1
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	global_load_b32 v0, v[0:1], off
	s_waitcnt vmcnt(0)
	v_mul_hi_i32 v0, 0x51eb851f, v0
	v_lshrrev_b32_e32 v1, 31, v0
	v_ashrrev_i32_e32 v0, 5, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v0, v0, v1
	v_ashrrev_i32_e32 v1, 31, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	v_add_co_u32 v0, vcc_lo, s6, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	global_atomic_add_u32 v[0:1], v2, off
.LBB0_2:
	s_or_b32 exec_lo, exec_lo, s2
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17countEntriesPartAPiS_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.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 3
		.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	_Z17countEntriesPartAPiS_i, .Lfunc_end0-_Z17countEntriesPartAPiS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 212
; NumSgprs: 18
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 3
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z17countEntriesPartBPiS_i ; -- Begin function _Z17countEntriesPartBPiS_i
	.globl	_Z17countEntriesPartBPiS_i
	.p2align	8
	.type	_Z17countEntriesPartBPiS_i,@function
_Z17countEntriesPartBPiS_i:             ; @_Z17countEntriesPartBPiS_i
; %bb.0:
	v_cmp_eq_u32_e32 vcc_lo, 0, v0
	s_mov_b32 s3, 0
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB1_3
; %bb.1:                                ; %.preheader18.preheader
	v_mov_b32_e32 v1, 0
.LBB1_2:                                ; %.preheader18
                                        ; =>This Inner Loop Header: Depth=1
	v_mov_b32_e32 v2, s3
	s_add_i32 s3, s3, 4
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s3, 40
	ds_store_b32 v2, v1
	s_cbranch_scc1 .LBB1_2
.LBB1_3:                                ; %Flow37
	s_or_b32 exec_lo, exec_lo, s2
	s_clause 0x2
	s_load_b32 s2, s[0:1], 0x24
	s_load_b32 s3, s[0:1], 0x10
	s_load_b128 s[4:7], s[0:1], 0x0
	s_mov_b32 s1, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s0, 0xffff, s2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s0, v[0:1]
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB1_5
; %bb.4:
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	v_add_co_u32 v0, s0, s4, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v1, s0, s5, v1, s0
	global_load_b32 v0, v[0:1], off
	s_waitcnt vmcnt(0)
	v_mul_hi_i32 v0, 0x51eb851f, v0
	v_lshrrev_b32_e32 v1, 31, v0
	v_ashrrev_i32_e32 v0, 5, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_add_lshl_u32 v0, v0, v1, 2
	v_mov_b32_e32 v1, 1
	ds_add_u32 v0, v1
.LBB1_5:
	s_or_b32 exec_lo, exec_lo, s1
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_and_saveexec_b32 s0, vcc_lo
	s_cbranch_execz .LBB1_10
; %bb.6:                                ; %.preheader.preheader
	v_mov_b32_e32 v0, 0
	s_mov_b32 s1, 0
.LBB1_7:                                ; %.preheader
                                        ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s3, exec_lo
	s_mov_b32 s2, exec_lo
	v_mbcnt_lo_u32_b32 v1, s3, 0
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v1
	s_cbranch_execz .LBB1_9
; %bb.8:                                ;   in Loop: Header=BB1_7 Depth=1
	v_mov_b32_e32 v1, s1
	s_bcnt1_i32_b32 s3, s3
	ds_load_b32 v1, v1
	s_waitcnt lgkmcnt(0)
	v_mul_lo_u32 v1, v1, s3
	global_atomic_add_u32 v0, v1, s[6:7]
.LBB1_9:                                ;   in Loop: Header=BB1_7 Depth=1
	s_or_b32 exec_lo, exec_lo, s2
	s_add_i32 s1, s1, 4
	s_add_u32 s6, s6, 4
	s_addc_u32 s7, s7, 0
	s_cmp_lg_u32 s1, 40
	s_cbranch_scc1 .LBB1_7
.LBB1_10:                               ; %Flow35
	s_or_b32 exec_lo, exec_lo, s0
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17countEntriesPartBPiS_i
		.amdhsa_group_segment_fixed_size 40
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.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 3
		.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_end1:
	.size	_Z17countEntriesPartBPiS_i, .Lfunc_end1-_Z17countEntriesPartBPiS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 360
; NumSgprs: 18
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 40 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 3
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z17countEntriesPartCPiS_i ; -- Begin function _Z17countEntriesPartCPiS_i
	.globl	_Z17countEntriesPartCPiS_i
	.p2align	8
	.type	_Z17countEntriesPartCPiS_i,@function
_Z17countEntriesPartCPiS_i:             ; @_Z17countEntriesPartCPiS_i
; %bb.0:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_lshlrev_b32_e32 v1, 1, v0
	s_mov_b32 s2, exec_lo
                                        ; implicit-def: $sgpr3
                                        ; implicit-def: $vgpr5
	s_delay_alu instid0(VALU_DEP_1)
	v_or_b32_e32 v3, 1, v1
	v_cmpx_lt_u32_e32 9, v0
	s_xor_b32 s2, exec_lo, s2
	s_cbranch_execz .LBB2_2
; %bb.1:
	v_lshl_add_u32 v2, v1, 2, 0
	v_mov_b32_e32 v4, 0
	v_or_b32_e32 v5, 1, v1
	s_mov_b32 s3, 0
	ds_store_b32 v2, v4
.LBB2_2:                                ; %Flow77
	s_or_saveexec_b32 s2, s2
	v_mov_b32_e32 v2, s3
	v_lshlrev_b32_e32 v4, 2, v1
	s_xor_b32 exec_lo, exec_lo, s2
	s_cbranch_execz .LBB2_4
; %bb.3:
	s_waitcnt lgkmcnt(0)
	global_load_b64 v[1:2], v4, s[4:5]
	v_dual_mov_b32 v5, v3 :: v_dual_add_nc_u32 v6, 0, v4
	s_waitcnt vmcnt(0)
	ds_store_b32 v6, v1
.LBB2_4:
	s_or_b32 exec_lo, exec_lo, s2
	s_load_b32 s0, s[0:1], 0x10
	v_lshl_add_u32 v1, v5, 2, 0
	s_mov_b32 s1, 1
	ds_store_b32 v1, v2
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s2, s0, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lt_i32 s2, 1
	s_cbranch_scc1 .LBB2_9
.LBB2_5:                                ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s3, exec_lo
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_cmpx_gt_i32_e64 s2, v0
	s_cbranch_execz .LBB2_7
; %bb.6:                                ;   in Loop: Header=BB2_5 Depth=1
	v_mul_lo_u32 v1, s1, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b32_e32 v1, 2, v1
	v_add3_u32 v1, v1, 0, -4
	s_delay_alu instid0(VALU_DEP_1)
	v_lshl_add_u32 v2, s1, 2, v1
	ds_load_b32 v1, v1
	ds_load_b32 v5, v2
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v1, v5, v1
	ds_store_b32 v2, v1
.LBB2_7:                                ;   in Loop: Header=BB2_5 Depth=1
	s_or_b32 exec_lo, exec_lo, s3
	s_lshl_b32 s1, s1, 1
	s_lshr_b32 s3, s2, 1
	s_cmp_lt_u32 s2, 2
	s_cbranch_scc1 .LBB2_9
; %bb.8:                                ;   in Loop: Header=BB2_5 Depth=1
	s_mov_b32 s2, s3
	s_branch .LBB2_5
.LBB2_9:                                ; %Flow76
	s_mov_b32 s2, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB2_11
; %bb.10:
	s_lshl_b32 s3, s0, 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s3, s3, 0
	s_add_i32 s3, s3, -4
	s_delay_alu instid0(SALU_CYCLE_1)
	v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v2, s3
	ds_store_b32 v2, v1
.LBB2_11:
	s_or_b32 exec_lo, exec_lo, s2
	s_cmp_lt_i32 s0, 2
	s_mov_b32 s2, 1
	s_cbranch_scc1 .LBB2_15
.LBB2_12:                               ; %.lr.ph59
                                        ; =>This Inner Loop Header: Depth=1
	s_lshr_b32 s1, s1, 1
	s_mov_b32 s3, exec_lo
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_cmpx_gt_u32_e64 s2, v0
	s_cbranch_execz .LBB2_14
; %bb.13:                               ;   in Loop: Header=BB2_12 Depth=1
	v_mul_lo_u32 v1, s1, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b32_e32 v1, 2, v1
	v_add3_u32 v1, v1, 0, -4
	s_delay_alu instid0(VALU_DEP_1)
	v_lshl_add_u32 v2, s1, 2, v1
	ds_load_b32 v5, v1
	ds_load_b32 v6, v2
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v5, v6, v5
	ds_store_b32 v1, v6
	ds_store_b32 v2, v5
.LBB2_14:                               ;   in Loop: Header=BB2_12 Depth=1
	s_or_b32 exec_lo, exec_lo, s3
	s_lshl_b32 s2, s2, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_ge_i32 s2, s0
	s_cbranch_scc0 .LBB2_12
.LBB2_15:                               ; %._crit_edge60
	v_add_nc_u32_e32 v0, 0, v4
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_mov_b32 s0, exec_lo
	ds_load_2addr_b32 v[0:1], v0 offset0:1 offset1:2
	s_waitcnt lgkmcnt(0)
	global_store_b64 v4, v[0:1], s[6:7]
	v_cmpx_eq_u32_e32 9, v3
	s_cbranch_execz .LBB2_17
; %bb.16:
	v_mov_b32_e32 v1, 0
	global_load_b32 v3, v1, s[4:5] offset:36
	v_add_co_u32 v1, s0, s6, v4
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v2, null, s7, 0, s0
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v3, v0
	global_store_b32 v[1:2], v0, off offset:4
.LBB2_17:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17countEntriesPartCPiS_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 20
		.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 7
		.amdhsa_next_free_sgpr 8
		.amdhsa_reserve_vcc 0
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z17countEntriesPartCPiS_i, .Lfunc_end2-_Z17countEntriesPartCPiS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 604
; NumSgprs: 8
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 8
; NumVGPRsForWavesPerEU: 7
; 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
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17countEntriesPartAPiS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z17countEntriesPartAPiS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     3
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 40
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17countEntriesPartBPiS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z17countEntriesPartBPiS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     3
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 20
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17countEntriesPartCPiS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     8
    .sgpr_spill_count: 0
    .symbol:         _Z17countEntriesPartCPiS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
