#include <cstdio>
#include <math.h> 
#include <ctime>
#include <iostream>
using namespace std;

int performanceMeasure1();
int performanceMeasure2();
int performanceMeasure3();
int performanceMeasure4();
int performanceMeasure5();
int countSortSerial1();
int countSortSerial2();
int countSortSerial3();
int countSortSerial4();
int countSortSerial5();

//calculate the countArray or histogram of number of times a key appears
__global__ void histogram(int * c, int * a, int K, int n)
{
//for inputArray of size n
	int entry =  (blockIdx.x + blockIdx.y * gridDim.x ) * (blockDim.x * blockDim.y) + (threadIdx.y * blockDim.x) + threadIdx.x;
	c[entry] = 0;
//if out of range then return
	if (entry < 0 || entry >= n) return;
//Get the value at the index
	int value = a[entry];
//update the counterArray at the value index by 1
	int *valueCount = &c[value];
	atomicAdd(valueCount, 1);
}

//calculate the prefix sum using a naive stride method
__global__ void naivePrefixSum(int *b, int *c, int k)
{

	int entry = threadIdx.x;
	if (entry < 0 || entry >= k) return;
	b[entry] = c[entry];
	//printf("c %d\n", b[entry]);	
	__syncthreads();
	//naive parallel stride prefix sum
	for(int i = 1; i < k; i *= 2)
	{
		if(entry > i-1) 
		{
			b[entry] = b[entry] + b[entry - i];
		}
		__syncthreads();
	}
	//printf("\nb %d", b[entry]); 
}

//from the prefix sum, place the numbers in the correct postion in the array
__global__ void copyToArray(int * c, int * a, int * b, int Kp, int n)
{
	extern __shared__ int temp[];
	int entry = (blockIdx.x + blockIdx.y * gridDim.x ) * (blockDim.x * blockDim.y) + (threadIdx.y * blockDim.x) + threadIdx.x;
	if (entry < 0 || entry >= n) return; 
   //get value at the inputArray at an index
	int value = a[entry];
   //get the index for the value 
	int index = atomicAdd(&c[value], -1);
	b[index-1] = value;
}


int main() {


//Start Debug Test
	printf("\nDebug Start\n");
///Test n elements with certain number of keys
	const int n = 1024;
	const int keys = 257;
//Setup Array on host and device
	int i_h[n] = {0};
	printf("\nInput:\n ");
	//An input array i_h (input array on host) with n elements with in the range of 0 to 256 and is a power of 2.
	for(int i = 0; i < n; i++){
		i_h[i] = pow(2,(std::rand() % 9));
		printf("%d ", i_h[i]);
	}
	int o_h[keys] = {0};
	int c_h[keys] = {0};
	int *i_d, *o_d, *c_d;
	//setup array on gpu
	cudaMalloc((void **)&i_d, sizeof(int)*n);
	cudaMalloc((void **)&o_d, sizeof(int)*n);
	cudaMalloc((void **)&c_d, sizeof(int)*keys);
	//copy values from input,etc..
	cudaMemcpy(i_d, i_h, sizeof(int)*n, cudaMemcpyHostToDevice);
	cudaMemcpy(o_d, o_d, sizeof(int)*n, cudaMemcpyHostToDevice);
	cudaMemcpy(c_d, c_h, sizeof(int)*keys, cudaMemcpyHostToDevice);

//CountSortFunction
//Get histogram
	histogram <<<6, n>>>(c_d,i_d,keys,n);
	cudaMemcpy(c_h, c_d, sizeof(int)*keys, cudaMemcpyDeviceToHost);
//Calculate Prefix sum
	naivePrefixSum<<<1,n>>>(c_d,c_d,keys);
//Fill in array
	copyToArray<<<6,n>>>(c_d,i_d,o_d,keys,n);
//Get answer
	cudaMemcpy(o_h, o_d, sizeof(int)*n, cudaMemcpyDeviceToHost);
//print answer
	printf("\nOutput:\n ");
	for (int i = 0; i < n; ++i) printf("%d ", o_h[i]);
//free memory
		cudaFree(i_d);
	cudaFree(o_d);
	cudaFree(c_d);
	
//Finish Debug Test
	printf("\nFinish debug\n");

//Performance test
	printf("Parallel function doesn't work on 2^21 and larger\n");
	printf("tried using clock but doesn't seem to work on serial function\n");
	printf("Debug test works");
	countSortSerial1();
	countSortSerial2();
	countSortSerial3();
	countSortSerial4();
	countSortSerial5();
	performanceMeasure1();
//performanceMeasure2();
//performanceMeasure3();
//performanceMeasure4();
//performanceMeasure5();
	
	return 0;
}

///////////////////////////////////////////////////////////Performance Function/////////////////////////////////////////////////////////////////
int countSortSerial1()
{   
	std::clock_t start;
	double duration;
	start = std::clock();
	const int elements = 1048576;
	const int keys = 257;

	int inputArray[elements] = {0};
	int output[elements] = {0};
	for(int i = 0; i < elements; i++)
		inputArray[i] = pow(2,(std::rand() % 9));

	int count[elements + 1] = {0};
	
    //Initalize the count array and count the number of keys
	for(int i = 0; inputArray[i]; ++i)
		++count[inputArray[i]];
	
    //calculate the starting index for each key
	int total = 0;
	int oldCount;
	for (int i = 0; i <= keys; ++i)
	{
		oldCount = count[i];
		count[i] = total;
		total += oldCount;
	}
	
    // Build the output character array
	for (int i = 0; inputArray[i]; ++i)
	{
		output[count[inputArray[i]]-1] = inputArray[i];
		--count[inputArray[i]];
	}
	
	cout << "serial counting 2^20 : " << duration << endl;
}

int countSortSerial2()
{   
	std::clock_t start;
	double duration;
	start = std::clock();
	const int elements = 1048576*2;
	const int keys = 257;

	int inputArray[elements] = {0};
	int output[elements] = {0};
	for(int i = 0; i < elements; i++)
		inputArray[i] = pow(2,(std::rand() % 9));

	int count[elements + 1] = {0};
	
    //Initalize the count array and count the number of keys
	for(int i = 0; inputArray[i]; ++i)
		++count[inputArray[i]];
	
    //calculate the starting index for each key
	int total = 0;
	int oldCount;
	for (int i = 0; i <= keys; ++i)
	{
		oldCount = count[i];
		count[i] = total;
		total += oldCount;
	}
	
    // Build the output character array
	for (int i = 0; inputArray[i]; ++i)
	{
		output[count[inputArray[i]]-1] = inputArray[i];
		--count[inputArray[i]];
	}
	
	cout << "serial counting 2^21 : " << duration << endl;
}

int countSortSerial3()
{   
	std::clock_t start;
	double duration;
	start = std::clock();
	const int elements = 1048576*2;
	const int keys = 257;

	int inputArray[elements] = {0};
	int output[elements] = {0};
	for(int i = 0; i < elements; i++)
		inputArray[i] = pow(2,(std::rand() % 9));

	int count[elements + 1] = {0};
	
    //Initalize the count array and count the number of keys
	for(int i = 0; inputArray[i]; ++i)
		++count[inputArray[i]];
	
    //calculate the starting index for each key
	int total = 0;
	int oldCount;
	for (int i = 0; i <= keys; ++i)
	{
		oldCount = count[i];
		count[i] = total;
		total += oldCount;
	}
	
    // Build the output character array
	for (int i = 0; inputArray[i]; ++i)
	{
		output[count[inputArray[i]]-1] = inputArray[i];
		--count[inputArray[i]];
	}
	
	cout << "serial counting 2^22 : " << duration << endl;
}

int countSortSerial4()
{   
	std::clock_t start;
	double duration;
	start = std::clock();
	const int elements = 1048576*2;
	const int keys = 257;

	int inputArray[elements] = {0};
	int output[elements] = {0};
	for(int i = 0; i < elements; i++)
		inputArray[i] = pow(2,(std::rand() % 9));

	int count[elements + 1] = {0};
	
    //Initalize the count array and count the number of keys
	for(int i = 0; inputArray[i]; ++i)
		++count[inputArray[i]];
	
    //calculate the starting index for each key
	int total = 0;
	int oldCount;
	for (int i = 0; i <= keys; ++i)
	{
		oldCount = count[i];
		count[i] = total;
		total += oldCount;
	}
	
    // Build the output character array
	for (int i = 0; inputArray[i]; ++i)
	{
		output[count[inputArray[i]]-1] = inputArray[i];
		--count[inputArray[i]];
	}
	
	cout << "serial counting 2^23 : " << duration << endl;
}

int countSortSerial5()
{   
	std::clock_t start;
	double duration;
	start = std::clock();
	const int elements = 1048576*2;
	const int keys = 257;

	int inputArray[elements] = {0};
	int output[elements] = {0};
	for(int i = 0; i < elements; i++)
		inputArray[i] = pow(2,(std::rand() % 9));

	int count[elements + 1] = {0};
	
    //Initalize the count array and count the number of keys
	for(int i = 0; inputArray[i]; ++i)
		++count[inputArray[i]];
	
    //calculate the starting index for each key
	int total = 0;
	int oldCount;
	for (int i = 0; i <= keys; ++i)
	{
		oldCount = count[i];
		count[i] = total;
		total += oldCount;
	}
	
    // Build the output character array
	for (int i = 0; inputArray[i]; ++i)
	{
		output[count[inputArray[i]]-1] = inputArray[i];
		--count[inputArray[i]];
	}
	
	cout << "serial counting 2^24 : " << duration << endl;
}
//Same function, but had trouble initalizing array from function parameter.
//so made copies of different performanceMeasure function 1 to 5 with different number of elements 2^20 to 2^24
int performanceMeasure1()
{
	std::clock_t start;
	double duration;
	start = std::clock();
//number of elements and number of keys
	const int elements = 1048576;
	const int keys = 257;
//setup device and host array variables
	int i_h[elements] = {0};
	for(int i = 0; i < elements; i++)
		i_h[i] = pow(2,(std::rand() % 9));
	int o_h[keys] = {0};
	int c_h[keys] = {0};
	int *i_d, *o_d, *c_d;
	//setup array on gpu
	cudaMalloc((void **)&i_d, sizeof(int)*elements);
	cudaMalloc((void **)&o_d, sizeof(int)*elements);
	cudaMalloc((void **)&c_d, sizeof(int)*keys);
	//copy values from input,etc..
	cudaMemcpy(i_d, i_h, sizeof(int)*elements, cudaMemcpyHostToDevice);
	cudaMemcpy(o_d, o_d, sizeof(int)*elements, cudaMemcpyHostToDevice);
	cudaMemcpy(c_d, c_h, sizeof(int)*keys, cudaMemcpyHostToDevice);
//countsort
	//Get histogram
	histogram <<<6, elements>>>(c_d,i_d,keys,elements);
	cudaMemcpy(c_h, c_d, sizeof(int)*keys, cudaMemcpyDeviceToHost);
	//Calculate Prefix sum
	naivePrefixSum<<<1,elements>>>(c_d,c_d,keys);
	//Fill in array
	copyToArray<<<6,elements>>>(c_d,i_d,o_d,keys,elements);
	//Get answer
	cudaMemcpy(o_h, o_d, sizeof(int)*elements, cudaMemcpyDeviceToHost);
	//free memory
	cudaFree(i_d);
	cudaFree(o_d);
	cudaFree(c_d);
	duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;
	cout << "parallel counting 2^20 : " << duration << endl;
	return 0;
}


int performanceMeasure2()
{
	std::clock_t start;
	double duration;
	start = std::clock();
//number of elements and number of keys
	const int elements = 2097152;
	const int keys = 257;
//setup device and host array variables
	int i_h[elements] = {0};
	for(int i = 0; i < elements; i++)
		i_h[i] = pow(2,(std::rand() % 9));
	int o_h[keys] = {0};
	int c_h[keys] = {0};
	int *i_d, *o_d, *c_d;
	//setup array on gpu
	cudaMalloc((void **)&i_d, sizeof(int)*elements);
	cudaMalloc((void **)&o_d, sizeof(int)*elements);
	cudaMalloc((void **)&c_d, sizeof(int)*keys);
	//copy values from input,etc..
	cudaMemcpy(i_d, i_h, sizeof(int)*elements, cudaMemcpyHostToDevice);
	cudaMemcpy(o_d, o_d, sizeof(int)*elements, cudaMemcpyHostToDevice);
	cudaMemcpy(c_d, c_h, sizeof(int)*keys, cudaMemcpyHostToDevice);
//countsort
	//Get histogram
	histogram <<<6, elements>>>(c_d,i_d,keys,elements);
	cudaMemcpy(c_h, c_d, sizeof(int)*keys, cudaMemcpyDeviceToHost);
	//Calculate Prefix sum
	naivePrefixSum<<<1,elements>>>(c_d,c_d,keys);
	//Fill in array
	copyToArray<<<6,elements>>>(c_d,i_d,o_d,keys,elements);
	//Get answer
	cudaMemcpy(o_h, o_d, sizeof(int)*elements, cudaMemcpyDeviceToHost);
	//free memory
	cudaFree(i_d);
	cudaFree(o_d);
	cudaFree(c_d);
	cout << "parallel counting 2^21 : " << duration << endl;
	return 0;
}


int performanceMeasure3()
{
	std::clock_t start;
	double duration;
	start = std::clock();
//number of elements and number of keys
	const int elements = 4194304;
	const int keys = 257;
//setup device and host array variables
	int i_h[elements] = {0};
	for(int i = 0; i < elements; i++)
		i_h[i] = pow(2,(std::rand() % 9));
	int o_h[keys] = {0};
	int c_h[keys] = {0};
	int *i_d, *o_d, *c_d;
	//setup array on gpu
	cudaMalloc((void **)&i_d, sizeof(int)*elements);
	cudaMalloc((void **)&o_d, sizeof(int)*elements);
	cudaMalloc((void **)&c_d, sizeof(int)*keys);
	//copy values from input,etc..
	cudaMemcpy(i_d, i_h, sizeof(int)*elements, cudaMemcpyHostToDevice);
	cudaMemcpy(o_d, o_d, sizeof(int)*elements, cudaMemcpyHostToDevice);
	cudaMemcpy(c_d, c_h, sizeof(int)*keys, cudaMemcpyHostToDevice);
//countsort
	//Get histogram
	histogram <<<6, elements>>>(c_d,i_d,keys,elements);
	cudaMemcpy(c_h, c_d, sizeof(int)*keys, cudaMemcpyDeviceToHost);
	//Calculate Prefix sum
	naivePrefixSum<<<1,elements>>>(c_d,c_d,keys);
	//Fill in array
	copyToArray<<<6,elements>>>(c_d,i_d,o_d,keys,elements);
	//Get answer
	cudaMemcpy(o_h, o_d, sizeof(int)*elements, cudaMemcpyDeviceToHost);
	//free memory
	cudaFree(i_d);
	cudaFree(o_d);
	cudaFree(c_d);
	cout << "parallel counting 2^22 : " << duration << endl;
	return 0;
}


int performanceMeasure4()
{
	std::clock_t start;
	double duration;
	start = std::clock();
//number of elements and number of keys
	const int elements = 8388608;
	const int keys = 257;
//setup device and host array variables
	int i_h[elements] = {0};
	for(int i = 0; i < elements; i++)
		i_h[i] = pow(2,(std::rand() % 9));
	int o_h[keys] = {0};
	int c_h[keys] = {0};
	int *i_d, *o_d, *c_d;
	//setup array on gpu
	cudaMalloc((void **)&i_d, sizeof(int)*elements);
	cudaMalloc((void **)&o_d, sizeof(int)*elements);
	cudaMalloc((void **)&c_d, sizeof(int)*keys);
	//copy values from input,etc..
	cudaMemcpy(i_d, i_h, sizeof(int)*elements, cudaMemcpyHostToDevice);
	cudaMemcpy(o_d, o_d, sizeof(int)*elements, cudaMemcpyHostToDevice);
	cudaMemcpy(c_d, c_h, sizeof(int)*keys, cudaMemcpyHostToDevice);
//countsort
	//Get histogram
	histogram <<<6, elements>>>(c_d,i_d,keys,elements);
	cudaMemcpy(c_h, c_d, sizeof(int)*keys, cudaMemcpyDeviceToHost);
	//Calculate Prefix sum
	naivePrefixSum<<<1,elements>>>(c_d,c_d,keys);
	//Fill in array
	copyToArray<<<6,elements>>>(c_d,i_d,o_d,keys,elements);
	//Get answer
	cudaMemcpy(o_h, o_d, sizeof(int)*elements, cudaMemcpyDeviceToHost);
	//free memory
	cudaFree(i_d);
	cudaFree(o_d);
	cudaFree(c_d);
	cout << "parallel counting 2^23 : " << duration << endl;
	return 0;
}


int performanceMeasure5()
{
	std::clock_t start;
	double duration;
	start = std::clock();
//number of elements and number of keys
	const int elements = 16777216;
	const int keys = 257;
//setup device and host array variables
	int i_h[elements] = {0};
	for(int i = 0; i < elements; i++)
		i_h[i] = pow(2,(std::rand() % 9));
	int o_h[keys] = {0};
	int c_h[keys] = {0};
	int *i_d, *o_d, *c_d;
	//setup array on gpu
	cudaMalloc((void **)&i_d, sizeof(int)*elements);
	cudaMalloc((void **)&o_d, sizeof(int)*elements);
	cudaMalloc((void **)&c_d, sizeof(int)*keys);
	//copy values from input,etc..
	cudaMemcpy(i_d, i_h, sizeof(int)*elements, cudaMemcpyHostToDevice);
	cudaMemcpy(o_d, o_d, sizeof(int)*elements, cudaMemcpyHostToDevice);
	cudaMemcpy(c_d, c_h, sizeof(int)*keys, cudaMemcpyHostToDevice);
//countsort
	//Get histogram
	histogram <<<6, elements>>>(c_d,i_d,keys,elements);
	cudaMemcpy(c_h, c_d, sizeof(int)*keys, cudaMemcpyDeviceToHost);
	//Calculate Prefix sum
	naivePrefixSum<<<1,elements>>>(c_d,c_d,keys);
	//Fill in array
	copyToArray<<<6,elements>>>(c_d,i_d,o_d,keys,elements);
	//Get answer
	cudaMemcpy(o_h, o_d, sizeof(int)*elements, cudaMemcpyDeviceToHost);
	//free memory
	cudaFree(i_d);
	cudaFree(o_d);
	cudaFree(c_d);
	cout << "parallel counting 2^24 : " << duration << endl;
	return 0;
}

	.file	"tmpxft_002292c9_00000000-6_counting_sort.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3648:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3648:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB4308:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE4308:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.globl	_Z32__device_stub__Z9histogramPiS_iiPiS_ii
	.type	_Z32__device_stub__Z9histogramPiS_iiPiS_ii, @function
_Z32__device_stub__Z9histogramPiS_iiPiS_ii:
.LFB3670:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L3
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z9histogramPiS_ii(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L3:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3670:
	.size	_Z32__device_stub__Z9histogramPiS_iiPiS_ii, .-_Z32__device_stub__Z9histogramPiS_iiPiS_ii
	.globl	_Z9histogramPiS_ii
	.type	_Z9histogramPiS_ii, @function
_Z9histogramPiS_ii:
.LFB3671:
	.cfi_startproc
	endbr64
	jmp	_Z32__device_stub__Z9histogramPiS_iiPiS_ii
	.cfi_endproc
.LFE3671:
	.size	_Z9histogramPiS_ii, .-_Z9histogramPiS_ii
	.globl	_Z37__device_stub__Z14naivePrefixSumPiS_iPiS_i
	.type	_Z37__device_stub__Z14naivePrefixSumPiS_iPiS_i, @function
_Z37__device_stub__Z14naivePrefixSumPiS_iPiS_i:
.LFB3672:
	.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	.L9
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z14naivePrefixSumPiS_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
.L9:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3672:
	.size	_Z37__device_stub__Z14naivePrefixSumPiS_iPiS_i, .-_Z37__device_stub__Z14naivePrefixSumPiS_iPiS_i
	.globl	_Z14naivePrefixSumPiS_i
	.type	_Z14naivePrefixSumPiS_i, @function
_Z14naivePrefixSumPiS_i:
.LFB3673:
	.cfi_startproc
	endbr64
	jmp	_Z37__device_stub__Z14naivePrefixSumPiS_iPiS_i
	.cfi_endproc
.LFE3673:
	.size	_Z14naivePrefixSumPiS_i, .-_Z14naivePrefixSumPiS_i
	.globl	_Z37__device_stub__Z11copyToArrayPiS_S_iiPiS_S_ii
	.type	_Z37__device_stub__Z11copyToArrayPiS_S_iiPiS_S_ii, @function
_Z37__device_stub__Z11copyToArrayPiS_S_iiPiS_S_ii:
.LFB3674:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L14
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z11copyToArrayPiS_S_ii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L14:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3674:
	.size	_Z37__device_stub__Z11copyToArrayPiS_S_iiPiS_S_ii, .-_Z37__device_stub__Z11copyToArrayPiS_S_iiPiS_S_ii
	.globl	_Z11copyToArrayPiS_S_ii
	.type	_Z11copyToArrayPiS_S_ii, @function
_Z11copyToArrayPiS_S_ii:
.LFB3675:
	.cfi_startproc
	endbr64
	jmp	_Z37__device_stub__Z11copyToArrayPiS_S_iiPiS_S_ii
	.cfi_endproc
.LFE3675:
	.size	_Z11copyToArrayPiS_S_ii, .-_Z11copyToArrayPiS_S_ii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z11copyToArrayPiS_S_ii"
.LC1:
	.string	"_Z14naivePrefixSumPiS_i"
.LC2:
	.string	"_Z9histogramPiS_ii"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3677:
	.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	_Z11copyToArrayPiS_S_ii(%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	_Z14naivePrefixSumPiS_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	_Z9histogramPiS_ii(%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
.LFE3677:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_,"axG",@progbits,_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_,comdat
	.weak	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	.type	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_, @function
_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_:
.LFB3977:
	.cfi_startproc
	endbr64
	cvtsi2sdl	%edi, %xmm0
	cvtsi2sdl	%esi, %xmm1
	jmp	pow@PLT
	.cfi_endproc
.LFE3977:
	.size	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_, .-_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	.section	.rodata.str1.1
.LC3:
	.string	"serial counting 2^20 : "
	.text
	.globl	_Z16countSortSerial1v
	.type	_Z16countSortSerial1v, @function
_Z16countSortSerial1v:
.LFB3636:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$9, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	$1048576, %ebx
	pushq	%rax
	.cfi_def_cfa_offset 32
	call	clock@PLT
.L23:
	call	rand@PLT
	movl	$2, %edi
	cltd
	idivl	%ebp
	movl	%edx, %esi
	call	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	decl	%ebx
	jne	.L23
	leaq	.LC3(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	xorps	%xmm0, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	.cfi_endproc
.LFE3636:
	.size	_Z16countSortSerial1v, .-_Z16countSortSerial1v
	.section	.rodata.str1.1
.LC5:
	.string	"serial counting 2^21 : "
	.text
	.globl	_Z16countSortSerial2v
	.type	_Z16countSortSerial2v, @function
_Z16countSortSerial2v:
.LFB3637:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$9, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	$2097152, %ebx
	pushq	%rax
	.cfi_def_cfa_offset 32
	call	clock@PLT
.L27:
	call	rand@PLT
	movl	$2, %edi
	cltd
	idivl	%ebp
	movl	%edx, %esi
	call	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	decl	%ebx
	jne	.L27
	leaq	.LC5(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	xorps	%xmm0, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	.cfi_endproc
.LFE3637:
	.size	_Z16countSortSerial2v, .-_Z16countSortSerial2v
	.section	.rodata.str1.1
.LC6:
	.string	"serial counting 2^22 : "
	.text
	.globl	_Z16countSortSerial3v
	.type	_Z16countSortSerial3v, @function
_Z16countSortSerial3v:
.LFB3638:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$9, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	$2097152, %ebx
	pushq	%rax
	.cfi_def_cfa_offset 32
	call	clock@PLT
.L31:
	call	rand@PLT
	movl	$2, %edi
	cltd
	idivl	%ebp
	movl	%edx, %esi
	call	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	decl	%ebx
	jne	.L31
	leaq	.LC6(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	xorps	%xmm0, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	.cfi_endproc
.LFE3638:
	.size	_Z16countSortSerial3v, .-_Z16countSortSerial3v
	.section	.rodata.str1.1
.LC7:
	.string	"serial counting 2^23 : "
	.text
	.globl	_Z16countSortSerial4v
	.type	_Z16countSortSerial4v, @function
_Z16countSortSerial4v:
.LFB3639:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$9, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	$2097152, %ebx
	pushq	%rax
	.cfi_def_cfa_offset 32
	call	clock@PLT
.L35:
	call	rand@PLT
	movl	$2, %edi
	cltd
	idivl	%ebp
	movl	%edx, %esi
	call	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	decl	%ebx
	jne	.L35
	leaq	.LC7(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	xorps	%xmm0, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	.cfi_endproc
.LFE3639:
	.size	_Z16countSortSerial4v, .-_Z16countSortSerial4v
	.section	.rodata.str1.1
.LC8:
	.string	"serial counting 2^24 : "
	.text
	.globl	_Z16countSortSerial5v
	.type	_Z16countSortSerial5v, @function
_Z16countSortSerial5v:
.LFB3640:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$9, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	$2097152, %ebx
	pushq	%rax
	.cfi_def_cfa_offset 32
	call	clock@PLT
.L39:
	call	rand@PLT
	movl	$2, %edi
	cltd
	idivl	%ebp
	movl	%edx, %esi
	call	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	decl	%ebx
	jne	.L39
	leaq	.LC8(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	xorps	%xmm0, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	.cfi_endproc
.LFE3640:
	.size	_Z16countSortSerial5v, .-_Z16countSortSerial5v
	.section	.rodata.str1.1
.LC10:
	.string	"parallel counting 2^20 : "
	.text
	.globl	_Z19performanceMeasure1v
	.type	_Z19performanceMeasure1v, @function
_Z19performanceMeasure1v:
.LFB3641:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-4194304(%rsp), %r11
	.cfi_def_cfa 11, 4194344
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2136, %rsp
	.cfi_def_cfa_offset 4196480
	xorl	%ebx, %ebx
	movl	$9, %r13d
	movq	%fs:40, %rax
	movq	%rax, 4196424(%rsp)
	xorl	%eax, %eax
	leaq	2120(%rsp), %r12
	call	clock@PLT
	leaq	2120(%rsp), %rdi
	movl	$1048576, %ecx
	movq	%rax, %rbp
	xorl	%eax, %eax
	rep stosl
.L43:
	call	rand@PLT
	movl	$2, %edi
	cltd
	idivl	%r13d
	movl	%edx, %esi
	call	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	cvttsd2sil	%xmm0, %eax
	movl	%eax, (%r12,%rbx,4)
	incq	%rbx
	cmpq	$1048576, %rbx
	jne	.L43
	xorl	%eax, %eax
	leaq	64(%rsp), %rdi
	movl	$257, %ecx
	movl	$4194304, %esi
	rep stosl
	leaq	1092(%rsp), %rdi
	movl	$257, %ecx
	leaq	1092(%rsp), %rbx
	rep stosl
	leaq	16(%rsp), %rdi
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movl	$4194304, %esi
	call	cudaMalloc@PLT
	leaq	32(%rsp), %rdi
	movl	$1028, %esi
	call	cudaMalloc@PLT
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%r12, %rsi
	movl	$4194304, %edx
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movl	$4194304, %edx
	movq	%rdi, %rsi
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$1028, %edx
	call	cudaMemcpy@PLT
	movl	$4097, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$2147483651, %edi
	salq	$20, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	addq	%rdi, %rdi
	movq	%rdx, 52(%rsp)
	movl	$1, 60(%rsp)
	movq	%rdi, 40(%rsp)
	movl	$1, 48(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L44
	movq	16(%rsp), %rsi
	movq	32(%rsp), %rdi
	movl	$1048576, %ecx
	movl	$257, %edx
	call	_Z32__device_stub__Z9histogramPiS_iiPiS_ii
.L44:
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movl	$1028, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	movl	$4097, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$20, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%rdx, 52(%rsp)
	movl	$1, 60(%rsp)
	movq	%rdi, 40(%rsp)
	movl	$1, 48(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L45
	movq	32(%rsp), %rdi
	movl	$257, %edx
	movq	%rdi, %rsi
	call	_Z37__device_stub__Z14naivePrefixSumPiS_iPiS_i
.L45:
	movl	$4097, %edx
	movl	$2147483651, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$20, %rdx
	addq	%rdi, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movq	%rdx, 52(%rsp)
	movl	$1, 60(%rsp)
	movq	%rdi, 40(%rsp)
	movl	$1, 48(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L46
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	$257, %ecx
	movl	$1048576, %r8d
	movq	32(%rsp), %rdi
	call	_Z37__device_stub__Z11copyToArrayPiS_S_iiPiS_S_ii
.L46:
	movq	24(%rsp), %rsi
	movl	$2, %ecx
	movl	$4194304, %edx
	leaq	64(%rsp), %rdi
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	call	clock@PLT
	leaq	.LC10(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	subq	%rbp, %rax
	cvtsi2sdq	%rax, %xmm0
	divsd	.LC9(%rip), %xmm0
	movsd	%xmm0, 8(%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	8(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	4196424(%rsp), %rax
	subq	%fs:40, %rax
	je	.L47
	call	__stack_chk_fail@PLT
.L47:
	addq	$4196440, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3641:
	.size	_Z19performanceMeasure1v, .-_Z19performanceMeasure1v
	.section	.rodata.str1.1
.LC11:
	.string	"\nDebug Start\n"
.LC12:
	.string	"\nInput:\n "
.LC13:
	.string	"%d "
.LC14:
	.string	"\nOutput:\n "
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3635:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4128
	orq	$0, (%rsp)
	subq	$2112, %rsp
	.cfi_def_cfa_offset 6240
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	xorl	%ebx, %ebx
	leaq	.LC13(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 6200(%rsp)
	xorl	%eax, %eax
	leaq	2104(%rsp), %r12
	call	__printf_chk@PLT
	xorl	%eax, %eax
	leaq	2104(%rsp), %rdi
	movl	$1024, %ecx
	rep stosl
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
.L51:
	call	rand@PLT
	movl	$9, %ecx
	movl	$2, %edi
	cltd
	idivl	%ecx
	movl	%edx, %esi
	call	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	movq	%rbp, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	cvttsd2sil	%xmm0, %edx
	movl	%edx, (%r12,%rbx,4)
	incq	%rbx
	call	__printf_chk@PLT
	cmpq	$1024, %rbx
	jne	.L51
	xorl	%eax, %eax
	leaq	48(%rsp), %rdi
	movl	$257, %ecx
	movl	$4096, %esi
	rep stosl
	leaq	1076(%rsp), %rdi
	movl	$257, %ecx
	leaq	48(%rsp), %rbx
	rep stosl
	movq	%rsp, %rdi
	call	cudaMalloc@PLT
	leaq	8(%rsp), %rdi
	movl	$4096, %esi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movl	$1028, %esi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdi
	movq	%r12, %rsi
	movl	$1, %ecx
	movl	$4096, %edx
	leaq	1076(%rsp), %r12
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movl	$4096, %edx
	movq	%rdi, %rsi
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%r12, %rsi
	movl	$1028, %edx
	call	cudaMemcpy@PLT
	movl	$4194305, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$2147483651, %edi
	salq	$10, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	addq	%rdi, %rdi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L52
	movq	(%rsp), %rsi
	movq	16(%rsp), %rdi
	movl	$1024, %ecx
	movl	$257, %edx
	call	_Z32__device_stub__Z9histogramPiS_iiPiS_ii
.L52:
	movq	16(%rsp), %rsi
	movl	$2, %ecx
	movl	$1028, %edx
	movq	%r12, %rdi
	call	cudaMemcpy@PLT
	movl	$4194305, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$10, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L53
	movq	16(%rsp), %rdi
	movl	$257, %edx
	movq	%rdi, %rsi
	call	_Z37__device_stub__Z14naivePrefixSumPiS_iPiS_i
.L53:
	movl	$4194305, %edx
	movl	$2147483651, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$10, %rdx
	addq	%rdi, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L54
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movl	$257, %ecx
	movl	$1024, %r8d
	movq	16(%rsp), %rdi
	call	_Z37__device_stub__Z11copyToArrayPiS_S_iiPiS_S_ii
.L54:
	movq	8(%rsp), %rsi
	movq	%rbx, %rdi
	movl	$2, %ecx
	movl	$4096, %edx
	call	cudaMemcpy@PLT
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L55:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__printf_chk@PLT
	jmp	.L55
	.cfi_endproc
.LFE3635:
	.size	main, .-main
	.section	.rodata.str1.1
.LC15:
	.string	"parallel counting 2^21 : "
	.text
	.globl	_Z19performanceMeasure2v
	.type	_Z19performanceMeasure2v, @function
_Z19performanceMeasure2v:
.LFB3642:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-8388608(%rsp), %r11
	.cfi_def_cfa 11, 8388640
.LPSRL1:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL1
	.cfi_def_cfa_register 7
	subq	$2112, %rsp
	.cfi_def_cfa_offset 8390752
	xorl	%ebx, %ebx
	movl	$9, %r12d
	movq	%fs:40, %rax
	movq	%rax, 8390712(%rsp)
	xorl	%eax, %eax
	leaq	2104(%rsp), %rbp
	call	clock@PLT
	leaq	2104(%rsp), %rdi
	movl	$2097152, %ecx
	xorl	%eax, %eax
	rep stosl
.L60:
	call	rand@PLT
	movl	$2, %edi
	cltd
	idivl	%r12d
	movl	%edx, %esi
	call	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	cvttsd2sil	%xmm0, %eax
	movl	%eax, 0(%rbp,%rbx,4)
	incq	%rbx
	cmpq	$2097152, %rbx
	jne	.L60
	xorl	%eax, %eax
	leaq	48(%rsp), %rdi
	movl	$257, %ecx
	movl	$8388608, %esi
	rep stosl
	leaq	1076(%rsp), %rdi
	movl	$257, %ecx
	leaq	1076(%rsp), %rbx
	rep stosl
	movq	%rsp, %rdi
	call	cudaMalloc@PLT
	leaq	8(%rsp), %rdi
	movl	$8388608, %esi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movl	$1028, %esi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$8388608, %edx
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movl	$8388608, %edx
	movq	%rdi, %rsi
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$1028, %edx
	call	cudaMemcpy@PLT
	movl	$2049, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$2147483651, %edi
	salq	$21, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	addq	%rdi, %rdi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L61
	movq	(%rsp), %rsi
	movq	16(%rsp), %rdi
	movl	$2097152, %ecx
	movl	$257, %edx
	call	_Z32__device_stub__Z9histogramPiS_iiPiS_ii
.L61:
	movq	16(%rsp), %rsi
	movl	$2, %ecx
	movl	$1028, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	movl	$2049, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$21, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L62
	movq	16(%rsp), %rdi
	movl	$257, %edx
	movq	%rdi, %rsi
	call	_Z37__device_stub__Z14naivePrefixSumPiS_iPiS_i
.L62:
	movl	$2049, %edx
	movl	$2147483651, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$21, %rdx
	addq	%rdi, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L63
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movl	$257, %ecx
	movl	$2097152, %r8d
	movq	16(%rsp), %rdi
	call	_Z37__device_stub__Z11copyToArrayPiS_S_iiPiS_S_ii
.L63:
	movq	8(%rsp), %rsi
	movl	$2, %ecx
	movl	$8388608, %edx
	leaq	48(%rsp), %rdi
	call	cudaMemcpy@PLT
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	leaq	.LC15(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	xorps	%xmm0, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	8390712(%rsp), %rax
	subq	%fs:40, %rax
	je	.L64
	call	__stack_chk_fail@PLT
.L64:
	addq	$8390720, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3642:
	.size	_Z19performanceMeasure2v, .-_Z19performanceMeasure2v
	.section	.rodata.str1.1
.LC16:
	.string	"parallel counting 2^22 : "
	.text
	.globl	_Z19performanceMeasure3v
	.type	_Z19performanceMeasure3v, @function
_Z19performanceMeasure3v:
.LFB3643:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-16777216(%rsp), %r11
	.cfi_def_cfa 11, 16777248
.LPSRL2:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL2
	.cfi_def_cfa_register 7
	subq	$2112, %rsp
	.cfi_def_cfa_offset 16779360
	xorl	%ebx, %ebx
	movl	$9, %r12d
	movq	%fs:40, %rax
	movq	%rax, 16779320(%rsp)
	xorl	%eax, %eax
	leaq	2104(%rsp), %rbp
	call	clock@PLT
	leaq	2104(%rsp), %rdi
	movl	$4194304, %ecx
	xorl	%eax, %eax
	rep stosl
.L68:
	call	rand@PLT
	movl	$2, %edi
	cltd
	idivl	%r12d
	movl	%edx, %esi
	call	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	cvttsd2sil	%xmm0, %eax
	movl	%eax, 0(%rbp,%rbx,4)
	incq	%rbx
	cmpq	$4194304, %rbx
	jne	.L68
	xorl	%eax, %eax
	leaq	48(%rsp), %rdi
	movl	$257, %ecx
	movl	$16777216, %esi
	rep stosl
	leaq	1076(%rsp), %rdi
	movl	$257, %ecx
	leaq	1076(%rsp), %rbx
	rep stosl
	movq	%rsp, %rdi
	call	cudaMalloc@PLT
	leaq	8(%rsp), %rdi
	movl	$16777216, %esi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movl	$1028, %esi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$16777216, %edx
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movl	$16777216, %edx
	movq	%rdi, %rsi
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$1028, %edx
	call	cudaMemcpy@PLT
	movl	$1025, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$2147483651, %edi
	salq	$22, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	addq	%rdi, %rdi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L69
	movq	(%rsp), %rsi
	movq	16(%rsp), %rdi
	movl	$4194304, %ecx
	movl	$257, %edx
	call	_Z32__device_stub__Z9histogramPiS_iiPiS_ii
.L69:
	movq	16(%rsp), %rsi
	movl	$2, %ecx
	movl	$1028, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	movl	$1025, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$22, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L70
	movq	16(%rsp), %rdi
	movl	$257, %edx
	movq	%rdi, %rsi
	call	_Z37__device_stub__Z14naivePrefixSumPiS_iPiS_i
.L70:
	movl	$1025, %edx
	movl	$2147483651, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$22, %rdx
	addq	%rdi, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L71
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movl	$257, %ecx
	movl	$4194304, %r8d
	movq	16(%rsp), %rdi
	call	_Z37__device_stub__Z11copyToArrayPiS_S_iiPiS_S_ii
.L71:
	movq	8(%rsp), %rsi
	movl	$2, %ecx
	movl	$16777216, %edx
	leaq	48(%rsp), %rdi
	call	cudaMemcpy@PLT
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	leaq	.LC16(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	xorps	%xmm0, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	16779320(%rsp), %rax
	subq	%fs:40, %rax
	je	.L72
	call	__stack_chk_fail@PLT
.L72:
	addq	$16779328, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3643:
	.size	_Z19performanceMeasure3v, .-_Z19performanceMeasure3v
	.section	.rodata.str1.1
.LC17:
	.string	"parallel counting 2^23 : "
	.text
	.globl	_Z19performanceMeasure4v
	.type	_Z19performanceMeasure4v, @function
_Z19performanceMeasure4v:
.LFB3644:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-33554432(%rsp), %r11
	.cfi_def_cfa 11, 33554464
.LPSRL3:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL3
	.cfi_def_cfa_register 7
	subq	$2112, %rsp
	.cfi_def_cfa_offset 33556576
	xorl	%ebx, %ebx
	movl	$9, %r12d
	movq	%fs:40, %rax
	movq	%rax, 33556536(%rsp)
	xorl	%eax, %eax
	leaq	2104(%rsp), %rbp
	call	clock@PLT
	leaq	2104(%rsp), %rdi
	movl	$8388608, %ecx
	xorl	%eax, %eax
	rep stosl
.L76:
	call	rand@PLT
	movl	$2, %edi
	cltd
	idivl	%r12d
	movl	%edx, %esi
	call	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	cvttsd2sil	%xmm0, %eax
	movl	%eax, 0(%rbp,%rbx,4)
	incq	%rbx
	cmpq	$8388608, %rbx
	jne	.L76
	xorl	%eax, %eax
	leaq	48(%rsp), %rdi
	movl	$257, %ecx
	movl	$33554432, %esi
	rep stosl
	leaq	1076(%rsp), %rdi
	movl	$257, %ecx
	leaq	1076(%rsp), %rbx
	rep stosl
	movq	%rsp, %rdi
	call	cudaMalloc@PLT
	leaq	8(%rsp), %rdi
	movl	$33554432, %esi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movl	$1028, %esi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$33554432, %edx
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movl	$33554432, %edx
	movq	%rdi, %rsi
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$1028, %edx
	call	cudaMemcpy@PLT
	movl	$513, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$2147483651, %edi
	salq	$23, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	addq	%rdi, %rdi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L77
	movq	(%rsp), %rsi
	movq	16(%rsp), %rdi
	movl	$8388608, %ecx
	movl	$257, %edx
	call	_Z32__device_stub__Z9histogramPiS_iiPiS_ii
.L77:
	movq	16(%rsp), %rsi
	movl	$2, %ecx
	movl	$1028, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	movl	$513, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$23, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L78
	movq	16(%rsp), %rdi
	movl	$257, %edx
	movq	%rdi, %rsi
	call	_Z37__device_stub__Z14naivePrefixSumPiS_iPiS_i
.L78:
	movl	$513, %edx
	movl	$2147483651, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$23, %rdx
	addq	%rdi, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L79
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movl	$257, %ecx
	movl	$8388608, %r8d
	movq	16(%rsp), %rdi
	call	_Z37__device_stub__Z11copyToArrayPiS_S_iiPiS_S_ii
.L79:
	movq	8(%rsp), %rsi
	movl	$2, %ecx
	movl	$33554432, %edx
	leaq	48(%rsp), %rdi
	call	cudaMemcpy@PLT
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	leaq	.LC17(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	xorps	%xmm0, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	33556536(%rsp), %rax
	subq	%fs:40, %rax
	je	.L80
	call	__stack_chk_fail@PLT
.L80:
	addq	$33556544, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3644:
	.size	_Z19performanceMeasure4v, .-_Z19performanceMeasure4v
	.section	.rodata.str1.1
.LC18:
	.string	"parallel counting 2^24 : "
	.text
	.globl	_Z19performanceMeasure5v
	.type	_Z19performanceMeasure5v, @function
_Z19performanceMeasure5v:
.LFB3645:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-67108864(%rsp), %r11
	.cfi_def_cfa 11, 67108896
.LPSRL4:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL4
	.cfi_def_cfa_register 7
	subq	$2112, %rsp
	.cfi_def_cfa_offset 67111008
	xorl	%ebx, %ebx
	movl	$9, %r12d
	movq	%fs:40, %rax
	movq	%rax, 67110968(%rsp)
	xorl	%eax, %eax
	leaq	2104(%rsp), %rbp
	call	clock@PLT
	leaq	2104(%rsp), %rdi
	movl	$16777216, %ecx
	xorl	%eax, %eax
	rep stosl
.L84:
	call	rand@PLT
	movl	$2, %edi
	cltd
	idivl	%r12d
	movl	%edx, %esi
	call	_ZSt3powIiiEN9__gnu_cxx11__promote_2IDTplcvNS1_IT_XsrSt12__is_integerIS2_E7__valueEE6__typeELi0EcvNS1_IT0_XsrS3_IS7_E7__valueEE6__typeELi0EEXsrS3_ISB_E7__valueEE6__typeES2_S7_
	cvttsd2sil	%xmm0, %eax
	movl	%eax, 0(%rbp,%rbx,4)
	incq	%rbx
	cmpq	$16777216, %rbx
	jne	.L84
	xorl	%eax, %eax
	leaq	48(%rsp), %rdi
	movl	$257, %ecx
	movl	$67108864, %esi
	rep stosl
	leaq	1076(%rsp), %rdi
	movl	$257, %ecx
	leaq	1076(%rsp), %rbx
	rep stosl
	movq	%rsp, %rdi
	call	cudaMalloc@PLT
	leaq	8(%rsp), %rdi
	movl	$67108864, %esi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movl	$1028, %esi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$67108864, %edx
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movl	$67108864, %edx
	movq	%rdi, %rsi
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$1028, %edx
	call	cudaMemcpy@PLT
	movl	$257, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$2147483651, %edi
	salq	$24, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	addq	%rdi, %rdi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L85
	movq	(%rsp), %rsi
	movq	16(%rsp), %rdi
	movl	$16777216, %ecx
	movl	$257, %edx
	call	_Z32__device_stub__Z9histogramPiS_iiPiS_ii
.L85:
	movq	16(%rsp), %rsi
	movl	$2, %ecx
	movl	$1028, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	movl	$257, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$24, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L86
	movq	16(%rsp), %rdi
	movl	$257, %edx
	movq	%rdi, %rsi
	call	_Z37__device_stub__Z14naivePrefixSumPiS_iPiS_i
.L86:
	movl	$257, %edx
	movl	$2147483651, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$24, %rdx
	addq	%rdi, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movq	%rdx, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L87
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movl	$257, %ecx
	movl	$16777216, %r8d
	movq	16(%rsp), %rdi
	call	_Z37__device_stub__Z11copyToArrayPiS_S_iiPiS_S_ii
.L87:
	movq	8(%rsp), %rsi
	movl	$2, %ecx
	movl	$67108864, %edx
	leaq	48(%rsp), %rdi
	call	cudaMemcpy@PLT
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	leaq	.LC18(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	xorps	%xmm0, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	67110968(%rsp), %rax
	subq	%fs:40, %rax
	je	.L88
	call	__stack_chk_fail@PLT
.L88:
	addq	$67110976, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3645:
	.size	_Z19performanceMeasure5v, .-_Z19performanceMeasure5v
	.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.cst8,"aM",@progbits,8
	.align 8
.LC9:
	.long	0
	.long	1093567616
	.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 <cstdio>
#include <math.h> 
#include <ctime>
#include <iostream>
using namespace std;

int performanceMeasure1();
int performanceMeasure2();
int performanceMeasure3();
int performanceMeasure4();
int performanceMeasure5();
int countSortSerial1();
int countSortSerial2();
int countSortSerial3();
int countSortSerial4();
int countSortSerial5();

//calculate the countArray or histogram of number of times a key appears
__global__ void histogram(int * c, int * a, int K, int n)
{
//for inputArray of size n
	int entry =  (blockIdx.x + blockIdx.y * gridDim.x ) * (blockDim.x * blockDim.y) + (threadIdx.y * blockDim.x) + threadIdx.x;
	c[entry] = 0;
//if out of range then return
	if (entry < 0 || entry >= n) return;
//Get the value at the index
	int value = a[entry];
//update the counterArray at the value index by 1
	int *valueCount = &c[value];
	atomicAdd(valueCount, 1);
}

//calculate the prefix sum using a naive stride method
__global__ void naivePrefixSum(int *b, int *c, int k)
{

	int entry = threadIdx.x;
	if (entry < 0 || entry >= k) return;
	b[entry] = c[entry];
	//printf("c %d\n", b[entry]);	
	__syncthreads();
	//naive parallel stride prefix sum
	for(int i = 1; i < k; i *= 2)
	{
		if(entry > i-1) 
		{
			b[entry] = b[entry] + b[entry - i];
		}
		__syncthreads();
	}
	//printf("\nb %d", b[entry]); 
}

//from the prefix sum, place the numbers in the correct postion in the array
__global__ void copyToArray(int * c, int * a, int * b, int Kp, int n)
{
	extern __shared__ int temp[];
	int entry = (blockIdx.x + blockIdx.y * gridDim.x ) * (blockDim.x * blockDim.y) + (threadIdx.y * blockDim.x) + threadIdx.x;
	if (entry < 0 || entry >= n) return; 
   //get value at the inputArray at an index
	int value = a[entry];
   //get the index for the value 
	int index = atomicAdd(&c[value], -1);
	b[index-1] = value;
}


int main() {


//Start Debug Test
	printf("\nDebug Start\n");
///Test n elements with certain number of keys
	const int n = 1024;
	const int keys = 257;
//Setup Array on host and device
	int i_h[n] = {0};
	printf("\nInput:\n ");
	//An input array i_h (input array on host) with n elements with in the range of 0 to 256 and is a power of 2.
	for(int i = 0; i < n; i++){
		i_h[i] = pow(2,(std::rand() % 9));
		printf("%d ", i_h[i]);
	}
	int o_h[keys] = {0};
	int c_h[keys] = {0};
	int *i_d, *o_d, *c_d;
	//setup array on gpu
	hipMalloc((void **)&i_d, sizeof(int)*n);
	hipMalloc((void **)&o_d, sizeof(int)*n);
	hipMalloc((void **)&c_d, sizeof(int)*keys);
	//copy values from input,etc..
	hipMemcpy(i_d, i_h, sizeof(int)*n, hipMemcpyHostToDevice);
	hipMemcpy(o_d, o_d, sizeof(int)*n, hipMemcpyHostToDevice);
	hipMemcpy(c_d, c_h, sizeof(int)*keys, hipMemcpyHostToDevice);

//CountSortFunction
//Get histogram
	histogram <<<6, n>>>(c_d,i_d,keys,n);
	hipMemcpy(c_h, c_d, sizeof(int)*keys, hipMemcpyDeviceToHost);
//Calculate Prefix sum
	naivePrefixSum<<<1,n>>>(c_d,c_d,keys);
//Fill in array
	copyToArray<<<6,n>>>(c_d,i_d,o_d,keys,n);
//Get answer
	hipMemcpy(o_h, o_d, sizeof(int)*n, hipMemcpyDeviceToHost);
//print answer
	printf("\nOutput:\n ");
	for (int i = 0; i < n; ++i) printf("%d ", o_h[i]);
//free memory
		hipFree(i_d);
	hipFree(o_d);
	hipFree(c_d);
	
//Finish Debug Test
	printf("\nFinish debug\n");

//Performance test
	printf("Parallel function doesn't work on 2^21 and larger\n");
	printf("tried using clock but doesn't seem to work on serial function\n");
	printf("Debug test works");
	countSortSerial1();
	countSortSerial2();
	countSortSerial3();
	countSortSerial4();
	countSortSerial5();
	performanceMeasure1();
//performanceMeasure2();
//performanceMeasure3();
//performanceMeasure4();
//performanceMeasure5();
	
	return 0;
}

///////////////////////////////////////////////////////////Performance Function/////////////////////////////////////////////////////////////////
int countSortSerial1()
{   
	std::clock_t start;
	double duration;
	start = std::clock();
	const int elements = 1048576;
	const int keys = 257;

	int inputArray[elements] = {0};
	int output[elements] = {0};
	for(int i = 0; i < elements; i++)
		inputArray[i] = pow(2,(std::rand() % 9));

	int count[elements + 1] = {0};
	
    //Initalize the count array and count the number of keys
	for(int i = 0; inputArray[i]; ++i)
		++count[inputArray[i]];
	
    //calculate the starting index for each key
	int total = 0;
	int oldCount;
	for (int i = 0; i <= keys; ++i)
	{
		oldCount = count[i];
		count[i] = total;
		total += oldCount;
	}
	
    // Build the output character array
	for (int i = 0; inputArray[i]; ++i)
	{
		output[count[inputArray[i]]-1] = inputArray[i];
		--count[inputArray[i]];
	}
	
	cout << "serial counting 2^20 : " << duration << endl;
}

int countSortSerial2()
{   
	std::clock_t start;
	double duration;
	start = std::clock();
	const int elements = 1048576*2;
	const int keys = 257;

	int inputArray[elements] = {0};
	int output[elements] = {0};
	for(int i = 0; i < elements; i++)
		inputArray[i] = pow(2,(std::rand() % 9));

	int count[elements + 1] = {0};
	
    //Initalize the count array and count the number of keys
	for(int i = 0; inputArray[i]; ++i)
		++count[inputArray[i]];
	
    //calculate the starting index for each key
	int total = 0;
	int oldCount;
	for (int i = 0; i <= keys; ++i)
	{
		oldCount = count[i];
		count[i] = total;
		total += oldCount;
	}
	
    // Build the output character array
	for (int i = 0; inputArray[i]; ++i)
	{
		output[count[inputArray[i]]-1] = inputArray[i];
		--count[inputArray[i]];
	}
	
	cout << "serial counting 2^21 : " << duration << endl;
}

int countSortSerial3()
{   
	std::clock_t start;
	double duration;
	start = std::clock();
	const int elements = 1048576*2;
	const int keys = 257;

	int inputArray[elements] = {0};
	int output[elements] = {0};
	for(int i = 0; i < elements; i++)
		inputArray[i] = pow(2,(std::rand() % 9));

	int count[elements + 1] = {0};
	
    //Initalize the count array and count the number of keys
	for(int i = 0; inputArray[i]; ++i)
		++count[inputArray[i]];
	
    //calculate the starting index for each key
	int total = 0;
	int oldCount;
	for (int i = 0; i <= keys; ++i)
	{
		oldCount = count[i];
		count[i] = total;
		total += oldCount;
	}
	
    // Build the output character array
	for (int i = 0; inputArray[i]; ++i)
	{
		output[count[inputArray[i]]-1] = inputArray[i];
		--count[inputArray[i]];
	}
	
	cout << "serial counting 2^22 : " << duration << endl;
}

int countSortSerial4()
{   
	std::clock_t start;
	double duration;
	start = std::clock();
	const int elements = 1048576*2;
	const int keys = 257;

	int inputArray[elements] = {0};
	int output[elements] = {0};
	for(int i = 0; i < elements; i++)
		inputArray[i] = pow(2,(std::rand() % 9));

	int count[elements + 1] = {0};
	
    //Initalize the count array and count the number of keys
	for(int i = 0; inputArray[i]; ++i)
		++count[inputArray[i]];
	
    //calculate the starting index for each key
	int total = 0;
	int oldCount;
	for (int i = 0; i <= keys; ++i)
	{
		oldCount = count[i];
		count[i] = total;
		total += oldCount;
	}
	
    // Build the output character array
	for (int i = 0; inputArray[i]; ++i)
	{
		output[count[inputArray[i]]-1] = inputArray[i];
		--count[inputArray[i]];
	}
	
	cout << "serial counting 2^23 : " << duration << endl;
}

int countSortSerial5()
{   
	std::clock_t start;
	double duration;
	start = std::clock();
	const int elements = 1048576*2;
	const int keys = 257;

	int inputArray[elements] = {0};
	int output[elements] = {0};
	for(int i = 0; i < elements; i++)
		inputArray[i] = pow(2,(std::rand() % 9));

	int count[elements + 1] = {0};
	
    //Initalize the count array and count the number of keys
	for(int i = 0; inputArray[i]; ++i)
		++count[inputArray[i]];
	
    //calculate the starting index for each key
	int total = 0;
	int oldCount;
	for (int i = 0; i <= keys; ++i)
	{
		oldCount = count[i];
		count[i] = total;
		total += oldCount;
	}
	
    // Build the output character array
	for (int i = 0; inputArray[i]; ++i)
	{
		output[count[inputArray[i]]-1] = inputArray[i];
		--count[inputArray[i]];
	}
	
	cout << "serial counting 2^24 : " << duration << endl;
}
//Same function, but had trouble initalizing array from function parameter.
//so made copies of different performanceMeasure function 1 to 5 with different number of elements 2^20 to 2^24
int performanceMeasure1()
{
	std::clock_t start;
	double duration;
	start = std::clock();
//number of elements and number of keys
	const int elements = 1048576;
	const int keys = 257;
//setup device and host array variables
	int i_h[elements] = {0};
	for(int i = 0; i < elements; i++)
		i_h[i] = pow(2,(std::rand() % 9));
	int o_h[keys] = {0};
	int c_h[keys] = {0};
	int *i_d, *o_d, *c_d;
	//setup array on gpu
	hipMalloc((void **)&i_d, sizeof(int)*elements);
	hipMalloc((void **)&o_d, sizeof(int)*elements);
	hipMalloc((void **)&c_d, sizeof(int)*keys);
	//copy values from input,etc..
	hipMemcpy(i_d, i_h, sizeof(int)*elements, hipMemcpyHostToDevice);
	hipMemcpy(o_d, o_d, sizeof(int)*elements, hipMemcpyHostToDevice);
	hipMemcpy(c_d, c_h, sizeof(int)*keys, hipMemcpyHostToDevice);
//countsort
	//Get histogram
	histogram <<<6, elements>>>(c_d,i_d,keys,elements);
	hipMemcpy(c_h, c_d, sizeof(int)*keys, hipMemcpyDeviceToHost);
	//Calculate Prefix sum
	naivePrefixSum<<<1,elements>>>(c_d,c_d,keys);
	//Fill in array
	copyToArray<<<6,elements>>>(c_d,i_d,o_d,keys,elements);
	//Get answer
	hipMemcpy(o_h, o_d, sizeof(int)*elements, hipMemcpyDeviceToHost);
	//free memory
	hipFree(i_d);
	hipFree(o_d);
	hipFree(c_d);
	duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;
	cout << "parallel counting 2^20 : " << duration << endl;
	return 0;
}


int performanceMeasure2()
{
	std::clock_t start;
	double duration;
	start = std::clock();
//number of elements and number of keys
	const int elements = 2097152;
	const int keys = 257;
//setup device and host array variables
	int i_h[elements] = {0};
	for(int i = 0; i < elements; i++)
		i_h[i] = pow(2,(std::rand() % 9));
	int o_h[keys] = {0};
	int c_h[keys] = {0};
	int *i_d, *o_d, *c_d;
	//setup array on gpu
	hipMalloc((void **)&i_d, sizeof(int)*elements);
	hipMalloc((void **)&o_d, sizeof(int)*elements);
	hipMalloc((void **)&c_d, sizeof(int)*keys);
	//copy values from input,etc..
	hipMemcpy(i_d, i_h, sizeof(int)*elements, hipMemcpyHostToDevice);
	hipMemcpy(o_d, o_d, sizeof(int)*elements, hipMemcpyHostToDevice);
	hipMemcpy(c_d, c_h, sizeof(int)*keys, hipMemcpyHostToDevice);
//countsort
	//Get histogram
	histogram <<<6, elements>>>(c_d,i_d,keys,elements);
	hipMemcpy(c_h, c_d, sizeof(int)*keys, hipMemcpyDeviceToHost);
	//Calculate Prefix sum
	naivePrefixSum<<<1,elements>>>(c_d,c_d,keys);
	//Fill in array
	copyToArray<<<6,elements>>>(c_d,i_d,o_d,keys,elements);
	//Get answer
	hipMemcpy(o_h, o_d, sizeof(int)*elements, hipMemcpyDeviceToHost);
	//free memory
	hipFree(i_d);
	hipFree(o_d);
	hipFree(c_d);
	cout << "parallel counting 2^21 : " << duration << endl;
	return 0;
}


int performanceMeasure3()
{
	std::clock_t start;
	double duration;
	start = std::clock();
//number of elements and number of keys
	const int elements = 4194304;
	const int keys = 257;
//setup device and host array variables
	int i_h[elements] = {0};
	for(int i = 0; i < elements; i++)
		i_h[i] = pow(2,(std::rand() % 9));
	int o_h[keys] = {0};
	int c_h[keys] = {0};
	int *i_d, *o_d, *c_d;
	//setup array on gpu
	hipMalloc((void **)&i_d, sizeof(int)*elements);
	hipMalloc((void **)&o_d, sizeof(int)*elements);
	hipMalloc((void **)&c_d, sizeof(int)*keys);
	//copy values from input,etc..
	hipMemcpy(i_d, i_h, sizeof(int)*elements, hipMemcpyHostToDevice);
	hipMemcpy(o_d, o_d, sizeof(int)*elements, hipMemcpyHostToDevice);
	hipMemcpy(c_d, c_h, sizeof(int)*keys, hipMemcpyHostToDevice);
//countsort
	//Get histogram
	histogram <<<6, elements>>>(c_d,i_d,keys,elements);
	hipMemcpy(c_h, c_d, sizeof(int)*keys, hipMemcpyDeviceToHost);
	//Calculate Prefix sum
	naivePrefixSum<<<1,elements>>>(c_d,c_d,keys);
	//Fill in array
	copyToArray<<<6,elements>>>(c_d,i_d,o_d,keys,elements);
	//Get answer
	hipMemcpy(o_h, o_d, sizeof(int)*elements, hipMemcpyDeviceToHost);
	//free memory
	hipFree(i_d);
	hipFree(o_d);
	hipFree(c_d);
	cout << "parallel counting 2^22 : " << duration << endl;
	return 0;
}


int performanceMeasure4()
{
	std::clock_t start;
	double duration;
	start = std::clock();
//number of elements and number of keys
	const int elements = 8388608;
	const int keys = 257;
//setup device and host array variables
	int i_h[elements] = {0};
	for(int i = 0; i < elements; i++)
		i_h[i] = pow(2,(std::rand() % 9));
	int o_h[keys] = {0};
	int c_h[keys] = {0};
	int *i_d, *o_d, *c_d;
	//setup array on gpu
	hipMalloc((void **)&i_d, sizeof(int)*elements);
	hipMalloc((void **)&o_d, sizeof(int)*elements);
	hipMalloc((void **)&c_d, sizeof(int)*keys);
	//copy values from input,etc..
	hipMemcpy(i_d, i_h, sizeof(int)*elements, hipMemcpyHostToDevice);
	hipMemcpy(o_d, o_d, sizeof(int)*elements, hipMemcpyHostToDevice);
	hipMemcpy(c_d, c_h, sizeof(int)*keys, hipMemcpyHostToDevice);
//countsort
	//Get histogram
	histogram <<<6, elements>>>(c_d,i_d,keys,elements);
	hipMemcpy(c_h, c_d, sizeof(int)*keys, hipMemcpyDeviceToHost);
	//Calculate Prefix sum
	naivePrefixSum<<<1,elements>>>(c_d,c_d,keys);
	//Fill in array
	copyToArray<<<6,elements>>>(c_d,i_d,o_d,keys,elements);
	//Get answer
	hipMemcpy(o_h, o_d, sizeof(int)*elements, hipMemcpyDeviceToHost);
	//free memory
	hipFree(i_d);
	hipFree(o_d);
	hipFree(c_d);
	cout << "parallel counting 2^23 : " << duration << endl;
	return 0;
}


int performanceMeasure5()
{
	std::clock_t start;
	double duration;
	start = std::clock();
//number of elements and number of keys
	const int elements = 16777216;
	const int keys = 257;
//setup device and host array variables
	int i_h[elements] = {0};
	for(int i = 0; i < elements; i++)
		i_h[i] = pow(2,(std::rand() % 9));
	int o_h[keys] = {0};
	int c_h[keys] = {0};
	int *i_d, *o_d, *c_d;
	//setup array on gpu
	hipMalloc((void **)&i_d, sizeof(int)*elements);
	hipMalloc((void **)&o_d, sizeof(int)*elements);
	hipMalloc((void **)&c_d, sizeof(int)*keys);
	//copy values from input,etc..
	hipMemcpy(i_d, i_h, sizeof(int)*elements, hipMemcpyHostToDevice);
	hipMemcpy(o_d, o_d, sizeof(int)*elements, hipMemcpyHostToDevice);
	hipMemcpy(c_d, c_h, sizeof(int)*keys, hipMemcpyHostToDevice);
//countsort
	//Get histogram
	histogram <<<6, elements>>>(c_d,i_d,keys,elements);
	hipMemcpy(c_h, c_d, sizeof(int)*keys, hipMemcpyDeviceToHost);
	//Calculate Prefix sum
	naivePrefixSum<<<1,elements>>>(c_d,c_d,keys);
	//Fill in array
	copyToArray<<<6,elements>>>(c_d,i_d,o_d,keys,elements);
	//Get answer
	hipMemcpy(o_h, o_d, sizeof(int)*elements, hipMemcpyDeviceToHost);
	//free memory
	hipFree(i_d);
	hipFree(o_d);
	hipFree(c_d);
	cout << "parallel counting 2^24 : " << duration << endl;
	return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z24__device_stub__histogramPiS_ii # -- Begin function _Z24__device_stub__histogramPiS_ii
	.type	_Z24__device_stub__histogramPiS_ii,@function
_Z24__device_stub__histogramPiS_ii:     # @_Z24__device_stub__histogramPiS_ii
	.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), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z9histogramPiS_ii, %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	_Z24__device_stub__histogramPiS_ii, .Lfunc_end0-_Z24__device_stub__histogramPiS_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z29__device_stub__naivePrefixSumPiS_i # -- Begin function _Z29__device_stub__naivePrefixSumPiS_i
	.type	_Z29__device_stub__naivePrefixSumPiS_i,@function
_Z29__device_stub__naivePrefixSumPiS_i: # @_Z29__device_stub__naivePrefixSumPiS_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	$_Z14naivePrefixSumPiS_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	_Z29__device_stub__naivePrefixSumPiS_i, .Lfunc_end1-_Z29__device_stub__naivePrefixSumPiS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z26__device_stub__copyToArrayPiS_S_ii # -- Begin function _Z26__device_stub__copyToArrayPiS_S_ii
	.type	_Z26__device_stub__copyToArrayPiS_S_ii,@function
_Z26__device_stub__copyToArrayPiS_S_ii: # @_Z26__device_stub__copyToArrayPiS_S_ii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	movq	%rsp, %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z11copyToArrayPiS_S_ii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z26__device_stub__copyToArrayPiS_S_ii, .Lfunc_end2-_Z26__device_stub__copyToArrayPiS_S_ii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI3_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.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	$6208, %rsp                     # imm = 0x1840
	.cfi_def_cfa_offset 6256
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	$.Lstr, %edi
	callq	puts@PLT
	leaq	2112(%rsp), %rdi
	movl	$4096, %edx                     # imm = 0x1000
	xorl	%esi, %esi
	callq	memset@PLT
	movl	$.L.str.1, %edi
	xorl	%eax, %eax
	callq	printf
	xorl	%ebx, %ebx
.LBB3_1:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	movslq	%eax, %rdi
	imulq	$954437177, %rdi, %rax          # imm = 0x38E38E39
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$33, %rax
	addl	%ecx, %eax
	leal	(%rax,%rax,8), %eax
	subl	%eax, %edi
	movsd	.LCPI3_0(%rip), %xmm0           # xmm0 = mem[0],zero
                                        # kill: def $edi killed $edi killed $rdi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %esi
	movl	%esi, 2112(%rsp,%rbx,4)
	movl	$.L.str.2, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%rbx
	cmpq	$1024, %rbx                     # imm = 0x400
	jne	.LBB3_1
# %bb.2:
	movabsq	$4294968320, %rbx               # imm = 0x100000400
	leaq	32(%rsp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	1072(%rsp), %r14
	movl	$1028, %edx                     # imm = 0x404
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	24(%rsp), %r15
	movl	$4096, %esi                     # imm = 0x1000
	movq	%r15, %rdi
	callq	hipMalloc
	leaq	16(%rsp), %r12
	movl	$4096, %esi                     # imm = 0x1000
	movq	%r12, %rdi
	callq	hipMalloc
	leaq	8(%rsp), %r13
	movl	$1028, %esi                     # imm = 0x404
	movq	%r13, %rdi
	callq	hipMalloc
	movq	(%r15), %rdi
	leaq	2112(%rsp), %rsi
	movl	$4096, %edx                     # imm = 0x1000
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r12), %rdi
	movl	$4096, %edx                     # imm = 0x1000
	movq	%rdi, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r13), %rdi
	movl	$1028, %edx                     # imm = 0x404
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	-1018(%rbx), %r14
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_4
# %bb.3:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movl	$257, %edx                      # imm = 0x101
	movl	$1024, %ecx                     # imm = 0x400
	callq	_Z24__device_stub__histogramPiS_ii
.LBB3_4:
	movq	8(%rsp), %rsi
	leaq	1072(%rsp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	movl	$2, %ecx
	callq	hipMemcpy
	leaq	-1023(%rbx), %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_6
# %bb.5:
	movq	8(%rsp), %rdi
	movq	%rdi, %rsi
	movl	$257, %edx                      # imm = 0x101
	callq	_Z29__device_stub__naivePrefixSumPiS_i
.LBB3_6:
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_8
# %bb.7:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
	movl	$257, %ecx                      # imm = 0x101
	movl	$1024, %r8d                     # imm = 0x400
	callq	_Z26__device_stub__copyToArrayPiS_S_ii
.LBB3_8:
	movq	16(%rsp), %rsi
	leaq	32(%rsp), %rdi
	movl	$4096, %edx                     # imm = 0x1000
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	callq	printf
	xorl	%ebx, %ebx
.LBB3_9:                                # =>This Inner Loop Header: Depth=1
	movl	32(%rsp,%rbx,4), %esi
	movl	$.L.str.2, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%rbx
	cmpq	$1024, %rbx                     # imm = 0x400
	jne	.LBB3_9
# %bb.10:
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	movl	$.L.str.7, %edi
	xorl	%eax, %eax
	callq	printf
	callq	_Z16countSortSerial1v
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z16countSortSerial1v
.LCPI4_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z16countSortSerial1v
	.type	_Z16countSortSerial1v,@function
_Z16countSortSerial1v:                  # @_Z16countSortSerial1v
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$8388624, %rsp                  # imm = 0x800010
	.cfi_def_cfa_offset 8388640
	.cfi_offset %rbx, -16
	callq	clock
	movq	%rsp, %rdi
	xorl	%ebx, %ebx
	movl	$4194304, %edx                  # imm = 0x400000
	xorl	%esi, %esi
	callq	memset@PLT
.LBB4_1:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	movslq	%eax, %rdi
	imulq	$954437177, %rdi, %rax          # imm = 0x38E38E39
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$33, %rax
	addl	%ecx, %eax
	leal	(%rax,%rax,8), %eax
	subl	%eax, %edi
	movsd	.LCPI4_0(%rip), %xmm0           # xmm0 = mem[0],zero
                                        # kill: def $edi killed $edi killed $rdi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %eax
	movl	%eax, (%rsp,%rbx,4)
	incq	%rbx
	cmpq	$1048576, %rbx                  # imm = 0x100000
	jne	.LBB4_1
# %bb.2:
	leaq	4194304(%rsp), %rdi
	xorl	%ebx, %ebx
	movl	$4194308, %edx                  # imm = 0x400004
	xorl	%esi, %esi
	callq	memset@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.LBB4_5
# %bb.3:                                # %.lr.ph.preheader
	leaq	4(%rsp), %rcx
	movl	%eax, %edx
.LBB4_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movslq	%edx, %rdx
	incl	4194304(%rsp,%rdx,4)
	movl	(%rcx), %edx
	addq	$4, %rcx
	testl	%edx, %edx
	jne	.LBB4_4
.LBB4_5:                                # %.preheader25.preheader
	xorl	%ecx, %ecx
.LBB4_6:                                # %.preheader25
                                        # =>This Inner Loop Header: Depth=1
	movl	4194304(%rsp,%rcx,4), %edx
	addl	%ebx, %edx
	movl	%ebx, 4194304(%rsp,%rcx,4)
	incq	%rcx
	movl	%edx, %ebx
	cmpq	$258, %rcx                      # imm = 0x102
	jne	.LBB4_6
# %bb.7:                                # %.preheader
	testl	%eax, %eax
	je	.LBB4_10
# %bb.8:                                # %.lr.ph33.preheader
	leaq	4(%rsp), %rcx
.LBB4_9:                                # %.lr.ph33
                                        # =>This Inner Loop Header: Depth=1
	cltq
	decl	4194304(%rsp,%rax,4)
	movl	(%rcx), %eax
	addq	$4, %rcx
	testl	%eax, %eax
	jne	.LBB4_9
.LBB4_10:                               # %._crit_edge
	movl	$_ZSt4cout, %edi
	movl	$.L.str.8, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZNSolsEd
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Lfunc_end4:
	.size	_Z16countSortSerial1v, .Lfunc_end4-_Z16countSortSerial1v
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z16countSortSerial2v
.LCPI5_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z16countSortSerial2v
	.type	_Z16countSortSerial2v,@function
_Z16countSortSerial2v:                  # @_Z16countSortSerial2v
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$16777232, %rsp                 # imm = 0x1000010
	.cfi_def_cfa_offset 16777248
	.cfi_offset %rbx, -16
	callq	clock
	movq	%rsp, %rdi
	xorl	%ebx, %ebx
	movl	$8388608, %edx                  # imm = 0x800000
	xorl	%esi, %esi
	callq	memset@PLT
.LBB5_1:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	movslq	%eax, %rdi
	imulq	$954437177, %rdi, %rax          # imm = 0x38E38E39
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$33, %rax
	addl	%ecx, %eax
	leal	(%rax,%rax,8), %eax
	subl	%eax, %edi
	movsd	.LCPI5_0(%rip), %xmm0           # xmm0 = mem[0],zero
                                        # kill: def $edi killed $edi killed $rdi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %eax
	movl	%eax, (%rsp,%rbx,4)
	incq	%rbx
	cmpq	$2097152, %rbx                  # imm = 0x200000
	jne	.LBB5_1
# %bb.2:
	leaq	8388608(%rsp), %rdi
	xorl	%ebx, %ebx
	movl	$8388612, %edx                  # imm = 0x800004
	xorl	%esi, %esi
	callq	memset@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.LBB5_5
# %bb.3:                                # %.lr.ph.preheader
	leaq	4(%rsp), %rcx
	movl	%eax, %edx
.LBB5_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movslq	%edx, %rdx
	incl	8388608(%rsp,%rdx,4)
	movl	(%rcx), %edx
	addq	$4, %rcx
	testl	%edx, %edx
	jne	.LBB5_4
.LBB5_5:                                # %.preheader25.preheader
	xorl	%ecx, %ecx
.LBB5_6:                                # %.preheader25
                                        # =>This Inner Loop Header: Depth=1
	movl	8388608(%rsp,%rcx,4), %edx
	addl	%ebx, %edx
	movl	%ebx, 8388608(%rsp,%rcx,4)
	incq	%rcx
	movl	%edx, %ebx
	cmpq	$258, %rcx                      # imm = 0x102
	jne	.LBB5_6
# %bb.7:                                # %.preheader
	testl	%eax, %eax
	je	.LBB5_10
# %bb.8:                                # %.lr.ph33.preheader
	leaq	4(%rsp), %rcx
.LBB5_9:                                # %.lr.ph33
                                        # =>This Inner Loop Header: Depth=1
	cltq
	decl	8388608(%rsp,%rax,4)
	movl	(%rcx), %eax
	addq	$4, %rcx
	testl	%eax, %eax
	jne	.LBB5_9
.LBB5_10:                               # %._crit_edge
	movl	$_ZSt4cout, %edi
	movl	$.L.str.9, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZNSolsEd
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Lfunc_end5:
	.size	_Z16countSortSerial2v, .Lfunc_end5-_Z16countSortSerial2v
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z16countSortSerial3v
.LCPI6_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z16countSortSerial3v
	.type	_Z16countSortSerial3v,@function
_Z16countSortSerial3v:                  # @_Z16countSortSerial3v
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$16777232, %rsp                 # imm = 0x1000010
	.cfi_def_cfa_offset 16777248
	.cfi_offset %rbx, -16
	callq	clock
	movq	%rsp, %rdi
	xorl	%ebx, %ebx
	movl	$8388608, %edx                  # imm = 0x800000
	xorl	%esi, %esi
	callq	memset@PLT
.LBB6_1:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	movslq	%eax, %rdi
	imulq	$954437177, %rdi, %rax          # imm = 0x38E38E39
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$33, %rax
	addl	%ecx, %eax
	leal	(%rax,%rax,8), %eax
	subl	%eax, %edi
	movsd	.LCPI6_0(%rip), %xmm0           # xmm0 = mem[0],zero
                                        # kill: def $edi killed $edi killed $rdi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %eax
	movl	%eax, (%rsp,%rbx,4)
	incq	%rbx
	cmpq	$2097152, %rbx                  # imm = 0x200000
	jne	.LBB6_1
# %bb.2:
	leaq	8388608(%rsp), %rdi
	xorl	%ebx, %ebx
	movl	$8388612, %edx                  # imm = 0x800004
	xorl	%esi, %esi
	callq	memset@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.LBB6_5
# %bb.3:                                # %.lr.ph.preheader
	leaq	4(%rsp), %rcx
	movl	%eax, %edx
.LBB6_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movslq	%edx, %rdx
	incl	8388608(%rsp,%rdx,4)
	movl	(%rcx), %edx
	addq	$4, %rcx
	testl	%edx, %edx
	jne	.LBB6_4
.LBB6_5:                                # %.preheader25.preheader
	xorl	%ecx, %ecx
.LBB6_6:                                # %.preheader25
                                        # =>This Inner Loop Header: Depth=1
	movl	8388608(%rsp,%rcx,4), %edx
	addl	%ebx, %edx
	movl	%ebx, 8388608(%rsp,%rcx,4)
	incq	%rcx
	movl	%edx, %ebx
	cmpq	$258, %rcx                      # imm = 0x102
	jne	.LBB6_6
# %bb.7:                                # %.preheader
	testl	%eax, %eax
	je	.LBB6_10
# %bb.8:                                # %.lr.ph33.preheader
	leaq	4(%rsp), %rcx
.LBB6_9:                                # %.lr.ph33
                                        # =>This Inner Loop Header: Depth=1
	cltq
	decl	8388608(%rsp,%rax,4)
	movl	(%rcx), %eax
	addq	$4, %rcx
	testl	%eax, %eax
	jne	.LBB6_9
.LBB6_10:                               # %._crit_edge
	movl	$_ZSt4cout, %edi
	movl	$.L.str.10, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZNSolsEd
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Lfunc_end6:
	.size	_Z16countSortSerial3v, .Lfunc_end6-_Z16countSortSerial3v
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z16countSortSerial4v
.LCPI7_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z16countSortSerial4v
	.type	_Z16countSortSerial4v,@function
_Z16countSortSerial4v:                  # @_Z16countSortSerial4v
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$16777232, %rsp                 # imm = 0x1000010
	.cfi_def_cfa_offset 16777248
	.cfi_offset %rbx, -16
	callq	clock
	movq	%rsp, %rdi
	xorl	%ebx, %ebx
	movl	$8388608, %edx                  # imm = 0x800000
	xorl	%esi, %esi
	callq	memset@PLT
.LBB7_1:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	movslq	%eax, %rdi
	imulq	$954437177, %rdi, %rax          # imm = 0x38E38E39
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$33, %rax
	addl	%ecx, %eax
	leal	(%rax,%rax,8), %eax
	subl	%eax, %edi
	movsd	.LCPI7_0(%rip), %xmm0           # xmm0 = mem[0],zero
                                        # kill: def $edi killed $edi killed $rdi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %eax
	movl	%eax, (%rsp,%rbx,4)
	incq	%rbx
	cmpq	$2097152, %rbx                  # imm = 0x200000
	jne	.LBB7_1
# %bb.2:
	leaq	8388608(%rsp), %rdi
	xorl	%ebx, %ebx
	movl	$8388612, %edx                  # imm = 0x800004
	xorl	%esi, %esi
	callq	memset@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.LBB7_5
# %bb.3:                                # %.lr.ph.preheader
	leaq	4(%rsp), %rcx
	movl	%eax, %edx
.LBB7_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movslq	%edx, %rdx
	incl	8388608(%rsp,%rdx,4)
	movl	(%rcx), %edx
	addq	$4, %rcx
	testl	%edx, %edx
	jne	.LBB7_4
.LBB7_5:                                # %.preheader25.preheader
	xorl	%ecx, %ecx
.LBB7_6:                                # %.preheader25
                                        # =>This Inner Loop Header: Depth=1
	movl	8388608(%rsp,%rcx,4), %edx
	addl	%ebx, %edx
	movl	%ebx, 8388608(%rsp,%rcx,4)
	incq	%rcx
	movl	%edx, %ebx
	cmpq	$258, %rcx                      # imm = 0x102
	jne	.LBB7_6
# %bb.7:                                # %.preheader
	testl	%eax, %eax
	je	.LBB7_10
# %bb.8:                                # %.lr.ph33.preheader
	leaq	4(%rsp), %rcx
.LBB7_9:                                # %.lr.ph33
                                        # =>This Inner Loop Header: Depth=1
	cltq
	decl	8388608(%rsp,%rax,4)
	movl	(%rcx), %eax
	addq	$4, %rcx
	testl	%eax, %eax
	jne	.LBB7_9
.LBB7_10:                               # %._crit_edge
	movl	$_ZSt4cout, %edi
	movl	$.L.str.11, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZNSolsEd
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Lfunc_end7:
	.size	_Z16countSortSerial4v, .Lfunc_end7-_Z16countSortSerial4v
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z16countSortSerial5v
.LCPI8_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z16countSortSerial5v
	.type	_Z16countSortSerial5v,@function
_Z16countSortSerial5v:                  # @_Z16countSortSerial5v
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$16777232, %rsp                 # imm = 0x1000010
	.cfi_def_cfa_offset 16777248
	.cfi_offset %rbx, -16
	callq	clock
	movq	%rsp, %rdi
	xorl	%ebx, %ebx
	movl	$8388608, %edx                  # imm = 0x800000
	xorl	%esi, %esi
	callq	memset@PLT
.LBB8_1:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	movslq	%eax, %rdi
	imulq	$954437177, %rdi, %rax          # imm = 0x38E38E39
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$33, %rax
	addl	%ecx, %eax
	leal	(%rax,%rax,8), %eax
	subl	%eax, %edi
	movsd	.LCPI8_0(%rip), %xmm0           # xmm0 = mem[0],zero
                                        # kill: def $edi killed $edi killed $rdi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %eax
	movl	%eax, (%rsp,%rbx,4)
	incq	%rbx
	cmpq	$2097152, %rbx                  # imm = 0x200000
	jne	.LBB8_1
# %bb.2:
	leaq	8388608(%rsp), %rdi
	xorl	%ebx, %ebx
	movl	$8388612, %edx                  # imm = 0x800004
	xorl	%esi, %esi
	callq	memset@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.LBB8_5
# %bb.3:                                # %.lr.ph.preheader
	leaq	4(%rsp), %rcx
	movl	%eax, %edx
.LBB8_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movslq	%edx, %rdx
	incl	8388608(%rsp,%rdx,4)
	movl	(%rcx), %edx
	addq	$4, %rcx
	testl	%edx, %edx
	jne	.LBB8_4
.LBB8_5:                                # %.preheader25.preheader
	xorl	%ecx, %ecx
.LBB8_6:                                # %.preheader25
                                        # =>This Inner Loop Header: Depth=1
	movl	8388608(%rsp,%rcx,4), %edx
	addl	%ebx, %edx
	movl	%ebx, 8388608(%rsp,%rcx,4)
	incq	%rcx
	movl	%edx, %ebx
	cmpq	$258, %rcx                      # imm = 0x102
	jne	.LBB8_6
# %bb.7:                                # %.preheader
	testl	%eax, %eax
	je	.LBB8_10
# %bb.8:                                # %.lr.ph33.preheader
	leaq	4(%rsp), %rcx
.LBB8_9:                                # %.lr.ph33
                                        # =>This Inner Loop Header: Depth=1
	cltq
	decl	8388608(%rsp,%rax,4)
	movl	(%rcx), %eax
	addq	$4, %rcx
	testl	%eax, %eax
	jne	.LBB8_9
.LBB8_10:                               # %._crit_edge
	movl	$_ZSt4cout, %edi
	movl	$.L.str.12, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZNSolsEd
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Lfunc_end8:
	.size	_Z16countSortSerial5v, .Lfunc_end8-_Z16countSortSerial5v
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z19performanceMeasure1v
.LCPI9_0:
	.quad	0x3ff0000000000000              # double 1
.LCPI9_1:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	_Z19performanceMeasure1v
	.type	_Z19performanceMeasure1v,@function
_Z19performanceMeasure1v:               # @_Z19performanceMeasure1v
	.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	$4196424, %rsp                  # imm = 0x400848
	.cfi_def_cfa_offset 4196480
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	callq	clock
	movq	%rax, %rbx
	leaq	2112(%rsp), %rdi
	xorl	%r14d, %r14d
	movl	$4194304, %edx                  # imm = 0x400000
	xorl	%esi, %esi
	callq	memset@PLT
.LBB9_1:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	movslq	%eax, %rdi
	imulq	$954437177, %rdi, %rax          # imm = 0x38E38E39
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$33, %rax
	addl	%ecx, %eax
	leal	(%rax,%rax,8), %eax
	subl	%eax, %edi
	movsd	.LCPI9_0(%rip), %xmm0           # xmm0 = mem[0],zero
                                        # kill: def $edi killed $edi killed $rdi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %eax
	movl	%eax, 2112(%rsp,%r14,4)
	incq	%r14
	cmpq	$1048576, %r14                  # imm = 0x100000
	jne	.LBB9_1
# %bb.2:
	movabsq	$4296015872, %r14               # imm = 0x100100000
	leaq	1072(%rsp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	32(%rsp), %r15
	movl	$1028, %edx                     # imm = 0x404
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	16(%rsp), %r12
	movl	$4194304, %esi                  # imm = 0x400000
	movq	%r12, %rdi
	callq	hipMalloc
	leaq	8(%rsp), %r13
	movl	$4194304, %esi                  # imm = 0x400000
	movq	%r13, %rdi
	callq	hipMalloc
	movq	%rsp, %rbp
	movl	$1028, %esi                     # imm = 0x404
	movq	%rbp, %rdi
	callq	hipMalloc
	movq	(%r12), %rdi
	leaq	2112(%rsp), %rsi
	movl	$4194304, %edx                  # imm = 0x400000
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r13), %rdi
	movl	$4194304, %edx                  # imm = 0x400000
	movq	%rdi, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%rbp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	movq	%r15, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	-1048570(%r14), %r15
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_4
# %bb.3:
	movq	(%rsp), %rdi
	movq	16(%rsp), %rsi
	movl	$257, %edx                      # imm = 0x101
	movl	$1048576, %ecx                  # imm = 0x100000
	callq	_Z24__device_stub__histogramPiS_ii
.LBB9_4:
	movq	(%rsp), %rsi
	leaq	32(%rsp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	movl	$2, %ecx
	callq	hipMemcpy
	leaq	-1048575(%r14), %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_6
# %bb.5:
	movq	(%rsp), %rdi
	movq	%rdi, %rsi
	movl	$257, %edx                      # imm = 0x101
	callq	_Z29__device_stub__naivePrefixSumPiS_i
.LBB9_6:
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_8
# %bb.7:
	movq	(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movl	$257, %ecx                      # imm = 0x101
	movl	$1048576, %r8d                  # imm = 0x100000
	callq	_Z26__device_stub__copyToArrayPiS_S_ii
.LBB9_8:
	movq	8(%rsp), %rsi
	leaq	1072(%rsp), %rdi
	movl	$4194304, %edx                  # imm = 0x400000
	movl	$2, %ecx
	callq	hipMemcpy
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	(%rsp), %rdi
	callq	hipFree
	callq	clock
	subq	%rbx, %rax
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI9_1(%rip), %xmm0
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	movl	$_ZSt4cout, %edi
	movl	$.L.str.13, %esi
	movl	$25, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movsd	24(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	xorl	%eax, %eax
	addq	$4196424, %rsp                  # imm = 0x400848
	.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_end9:
	.size	_Z19performanceMeasure1v, .Lfunc_end9-_Z19performanceMeasure1v
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z19performanceMeasure2v
.LCPI10_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z19performanceMeasure2v
	.type	_Z19performanceMeasure2v,@function
_Z19performanceMeasure2v:               # @_Z19performanceMeasure2v
	.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	$8390720, %rsp                  # imm = 0x800840
	.cfi_def_cfa_offset 8390768
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	callq	clock
	leaq	2112(%rsp), %rdi
	xorl	%ebx, %ebx
	movl	$8388608, %edx                  # imm = 0x800000
	xorl	%esi, %esi
	callq	memset@PLT
.LBB10_1:                               # =>This Inner Loop Header: Depth=1
	callq	rand
	movslq	%eax, %rdi
	imulq	$954437177, %rdi, %rax          # imm = 0x38E38E39
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$33, %rax
	addl	%ecx, %eax
	leal	(%rax,%rax,8), %eax
	subl	%eax, %edi
	movsd	.LCPI10_0(%rip), %xmm0          # xmm0 = mem[0],zero
                                        # kill: def $edi killed $edi killed $rdi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %eax
	movl	%eax, 2112(%rsp,%rbx,4)
	incq	%rbx
	cmpq	$2097152, %rbx                  # imm = 0x200000
	jne	.LBB10_1
# %bb.2:
	movabsq	$4297064448, %rbx               # imm = 0x100200000
	leaq	1072(%rsp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	32(%rsp), %r14
	movl	$1028, %edx                     # imm = 0x404
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	24(%rsp), %r15
	movl	$8388608, %esi                  # imm = 0x800000
	movq	%r15, %rdi
	callq	hipMalloc
	leaq	16(%rsp), %r12
	movl	$8388608, %esi                  # imm = 0x800000
	movq	%r12, %rdi
	callq	hipMalloc
	leaq	8(%rsp), %r13
	movl	$1028, %esi                     # imm = 0x404
	movq	%r13, %rdi
	callq	hipMalloc
	movq	(%r15), %rdi
	leaq	2112(%rsp), %rsi
	movl	$8388608, %edx                  # imm = 0x800000
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r12), %rdi
	movl	$8388608, %edx                  # imm = 0x800000
	movq	%rdi, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r13), %rdi
	movl	$1028, %edx                     # imm = 0x404
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	-2097146(%rbx), %r14
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB10_4
# %bb.3:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movl	$257, %edx                      # imm = 0x101
	movl	$2097152, %ecx                  # imm = 0x200000
	callq	_Z24__device_stub__histogramPiS_ii
.LBB10_4:
	movq	8(%rsp), %rsi
	leaq	32(%rsp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	movl	$2, %ecx
	callq	hipMemcpy
	leaq	-2097151(%rbx), %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB10_6
# %bb.5:
	movq	8(%rsp), %rdi
	movq	%rdi, %rsi
	movl	$257, %edx                      # imm = 0x101
	callq	_Z29__device_stub__naivePrefixSumPiS_i
.LBB10_6:
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB10_8
# %bb.7:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
	movl	$257, %ecx                      # imm = 0x101
	movl	$2097152, %r8d                  # imm = 0x200000
	callq	_Z26__device_stub__copyToArrayPiS_S_ii
.LBB10_8:
	movq	16(%rsp), %rsi
	leaq	1072(%rsp), %rdi
	movl	$8388608, %edx                  # imm = 0x800000
	movl	$2, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movl	$_ZSt4cout, %edi
	movl	$.L.str.14, %esi
	movl	$25, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	xorl	%eax, %eax
	addq	$8390720, %rsp                  # imm = 0x800840
	.cfi_def_cfa_offset 48
	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_end10:
	.size	_Z19performanceMeasure2v, .Lfunc_end10-_Z19performanceMeasure2v
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z19performanceMeasure3v
.LCPI11_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z19performanceMeasure3v
	.type	_Z19performanceMeasure3v,@function
_Z19performanceMeasure3v:               # @_Z19performanceMeasure3v
	.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	$16779328, %rsp                 # imm = 0x1000840
	.cfi_def_cfa_offset 16779376
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	callq	clock
	leaq	2112(%rsp), %rdi
	xorl	%ebx, %ebx
	movl	$16777216, %edx                 # imm = 0x1000000
	xorl	%esi, %esi
	callq	memset@PLT
.LBB11_1:                               # =>This Inner Loop Header: Depth=1
	callq	rand
	movslq	%eax, %rdi
	imulq	$954437177, %rdi, %rax          # imm = 0x38E38E39
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$33, %rax
	addl	%ecx, %eax
	leal	(%rax,%rax,8), %eax
	subl	%eax, %edi
	movsd	.LCPI11_0(%rip), %xmm0          # xmm0 = mem[0],zero
                                        # kill: def $edi killed $edi killed $rdi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %eax
	movl	%eax, 2112(%rsp,%rbx,4)
	incq	%rbx
	cmpq	$4194304, %rbx                  # imm = 0x400000
	jne	.LBB11_1
# %bb.2:
	movabsq	$4299161600, %rbx               # imm = 0x100400000
	leaq	1072(%rsp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	32(%rsp), %r14
	movl	$1028, %edx                     # imm = 0x404
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	24(%rsp), %r15
	movl	$16777216, %esi                 # imm = 0x1000000
	movq	%r15, %rdi
	callq	hipMalloc
	leaq	16(%rsp), %r12
	movl	$16777216, %esi                 # imm = 0x1000000
	movq	%r12, %rdi
	callq	hipMalloc
	leaq	8(%rsp), %r13
	movl	$1028, %esi                     # imm = 0x404
	movq	%r13, %rdi
	callq	hipMalloc
	movq	(%r15), %rdi
	leaq	2112(%rsp), %rsi
	movl	$16777216, %edx                 # imm = 0x1000000
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r12), %rdi
	movl	$16777216, %edx                 # imm = 0x1000000
	movq	%rdi, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r13), %rdi
	movl	$1028, %edx                     # imm = 0x404
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	-4194298(%rbx), %r14
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB11_4
# %bb.3:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movl	$257, %edx                      # imm = 0x101
	movl	$4194304, %ecx                  # imm = 0x400000
	callq	_Z24__device_stub__histogramPiS_ii
.LBB11_4:
	movq	8(%rsp), %rsi
	leaq	32(%rsp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	movl	$2, %ecx
	callq	hipMemcpy
	leaq	-4194303(%rbx), %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB11_6
# %bb.5:
	movq	8(%rsp), %rdi
	movq	%rdi, %rsi
	movl	$257, %edx                      # imm = 0x101
	callq	_Z29__device_stub__naivePrefixSumPiS_i
.LBB11_6:
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB11_8
# %bb.7:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
	movl	$257, %ecx                      # imm = 0x101
	movl	$4194304, %r8d                  # imm = 0x400000
	callq	_Z26__device_stub__copyToArrayPiS_S_ii
.LBB11_8:
	movq	16(%rsp), %rsi
	leaq	1072(%rsp), %rdi
	movl	$16777216, %edx                 # imm = 0x1000000
	movl	$2, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movl	$_ZSt4cout, %edi
	movl	$.L.str.15, %esi
	movl	$25, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	xorl	%eax, %eax
	addq	$16779328, %rsp                 # imm = 0x1000840
	.cfi_def_cfa_offset 48
	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_end11:
	.size	_Z19performanceMeasure3v, .Lfunc_end11-_Z19performanceMeasure3v
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z19performanceMeasure4v
.LCPI12_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z19performanceMeasure4v
	.type	_Z19performanceMeasure4v,@function
_Z19performanceMeasure4v:               # @_Z19performanceMeasure4v
	.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	$33556544, %rsp                 # imm = 0x2000840
	.cfi_def_cfa_offset 33556592
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	callq	clock
	leaq	2112(%rsp), %rdi
	xorl	%ebx, %ebx
	movl	$33554432, %edx                 # imm = 0x2000000
	xorl	%esi, %esi
	callq	memset@PLT
.LBB12_1:                               # =>This Inner Loop Header: Depth=1
	callq	rand
	movslq	%eax, %rdi
	imulq	$954437177, %rdi, %rax          # imm = 0x38E38E39
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$33, %rax
	addl	%ecx, %eax
	leal	(%rax,%rax,8), %eax
	subl	%eax, %edi
	movsd	.LCPI12_0(%rip), %xmm0          # xmm0 = mem[0],zero
                                        # kill: def $edi killed $edi killed $rdi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %eax
	movl	%eax, 2112(%rsp,%rbx,4)
	incq	%rbx
	cmpq	$8388608, %rbx                  # imm = 0x800000
	jne	.LBB12_1
# %bb.2:
	movabsq	$4303355904, %rbx               # imm = 0x100800000
	leaq	1072(%rsp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	32(%rsp), %r14
	movl	$1028, %edx                     # imm = 0x404
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	24(%rsp), %r15
	movl	$33554432, %esi                 # imm = 0x2000000
	movq	%r15, %rdi
	callq	hipMalloc
	leaq	16(%rsp), %r12
	movl	$33554432, %esi                 # imm = 0x2000000
	movq	%r12, %rdi
	callq	hipMalloc
	leaq	8(%rsp), %r13
	movl	$1028, %esi                     # imm = 0x404
	movq	%r13, %rdi
	callq	hipMalloc
	movq	(%r15), %rdi
	leaq	2112(%rsp), %rsi
	movl	$33554432, %edx                 # imm = 0x2000000
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r12), %rdi
	movl	$33554432, %edx                 # imm = 0x2000000
	movq	%rdi, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r13), %rdi
	movl	$1028, %edx                     # imm = 0x404
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	-8388602(%rbx), %r14
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB12_4
# %bb.3:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movl	$257, %edx                      # imm = 0x101
	movl	$8388608, %ecx                  # imm = 0x800000
	callq	_Z24__device_stub__histogramPiS_ii
.LBB12_4:
	movq	8(%rsp), %rsi
	leaq	32(%rsp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	movl	$2, %ecx
	callq	hipMemcpy
	leaq	-8388607(%rbx), %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB12_6
# %bb.5:
	movq	8(%rsp), %rdi
	movq	%rdi, %rsi
	movl	$257, %edx                      # imm = 0x101
	callq	_Z29__device_stub__naivePrefixSumPiS_i
.LBB12_6:
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB12_8
# %bb.7:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
	movl	$257, %ecx                      # imm = 0x101
	movl	$8388608, %r8d                  # imm = 0x800000
	callq	_Z26__device_stub__copyToArrayPiS_S_ii
.LBB12_8:
	movq	16(%rsp), %rsi
	leaq	1072(%rsp), %rdi
	movl	$33554432, %edx                 # imm = 0x2000000
	movl	$2, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movl	$_ZSt4cout, %edi
	movl	$.L.str.16, %esi
	movl	$25, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	xorl	%eax, %eax
	addq	$33556544, %rsp                 # imm = 0x2000840
	.cfi_def_cfa_offset 48
	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_end12:
	.size	_Z19performanceMeasure4v, .Lfunc_end12-_Z19performanceMeasure4v
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z19performanceMeasure5v
.LCPI13_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z19performanceMeasure5v
	.type	_Z19performanceMeasure5v,@function
_Z19performanceMeasure5v:               # @_Z19performanceMeasure5v
	.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	$67110976, %rsp                 # imm = 0x4000840
	.cfi_def_cfa_offset 67111024
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	callq	clock
	leaq	2112(%rsp), %rdi
	xorl	%ebx, %ebx
	movl	$67108864, %edx                 # imm = 0x4000000
	xorl	%esi, %esi
	callq	memset@PLT
.LBB13_1:                               # =>This Inner Loop Header: Depth=1
	callq	rand
	movslq	%eax, %rdi
	imulq	$954437177, %rdi, %rax          # imm = 0x38E38E39
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$33, %rax
	addl	%ecx, %eax
	leal	(%rax,%rax,8), %eax
	subl	%eax, %edi
	movsd	.LCPI13_0(%rip), %xmm0          # xmm0 = mem[0],zero
                                        # kill: def $edi killed $edi killed $rdi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %eax
	movl	%eax, 2112(%rsp,%rbx,4)
	incq	%rbx
	cmpq	$16777216, %rbx                 # imm = 0x1000000
	jne	.LBB13_1
# %bb.2:
	movabsq	$4311744512, %rbx               # imm = 0x101000000
	leaq	1072(%rsp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	32(%rsp), %r14
	movl	$1028, %edx                     # imm = 0x404
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	24(%rsp), %r15
	movl	$67108864, %esi                 # imm = 0x4000000
	movq	%r15, %rdi
	callq	hipMalloc
	leaq	16(%rsp), %r12
	movl	$67108864, %esi                 # imm = 0x4000000
	movq	%r12, %rdi
	callq	hipMalloc
	leaq	8(%rsp), %r13
	movl	$1028, %esi                     # imm = 0x404
	movq	%r13, %rdi
	callq	hipMalloc
	movq	(%r15), %rdi
	leaq	2112(%rsp), %rsi
	movl	$67108864, %edx                 # imm = 0x4000000
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r12), %rdi
	movl	$67108864, %edx                 # imm = 0x4000000
	movq	%rdi, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r13), %rdi
	movl	$1028, %edx                     # imm = 0x404
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	-16777210(%rbx), %r14
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB13_4
# %bb.3:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movl	$257, %edx                      # imm = 0x101
	movl	$16777216, %ecx                 # imm = 0x1000000
	callq	_Z24__device_stub__histogramPiS_ii
.LBB13_4:
	movq	8(%rsp), %rsi
	leaq	32(%rsp), %rdi
	movl	$1028, %edx                     # imm = 0x404
	movl	$2, %ecx
	callq	hipMemcpy
	leaq	-16777215(%rbx), %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB13_6
# %bb.5:
	movq	8(%rsp), %rdi
	movq	%rdi, %rsi
	movl	$257, %edx                      # imm = 0x101
	callq	_Z29__device_stub__naivePrefixSumPiS_i
.LBB13_6:
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB13_8
# %bb.7:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
	movl	$257, %ecx                      # imm = 0x101
	movl	$16777216, %r8d                 # imm = 0x1000000
	callq	_Z26__device_stub__copyToArrayPiS_S_ii
.LBB13_8:
	movq	16(%rsp), %rsi
	leaq	1072(%rsp), %rdi
	movl	$67108864, %edx                 # imm = 0x4000000
	movl	$2, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movl	$_ZSt4cout, %edi
	movl	$.L.str.17, %esi
	movl	$25, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	xorl	%eax, %eax
	addq	$67110976, %rsp                 # imm = 0x4000840
	.cfi_def_cfa_offset 48
	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_end13:
	.size	_Z19performanceMeasure5v, .Lfunc_end13-_Z19performanceMeasure5v
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB14_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB14_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9histogramPiS_ii, %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	$_Z14naivePrefixSumPiS_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	$_Z11copyToArrayPiS_S_ii, %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_end14:
	.size	__hip_module_ctor, .Lfunc_end14-__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	.LBB15_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
.LBB15_2:
	retq
.Lfunc_end15:
	.size	__hip_module_dtor, .Lfunc_end15-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z9histogramPiS_ii,@object      # @_Z9histogramPiS_ii
	.section	.rodata,"a",@progbits
	.globl	_Z9histogramPiS_ii
	.p2align	3, 0x0
_Z9histogramPiS_ii:
	.quad	_Z24__device_stub__histogramPiS_ii
	.size	_Z9histogramPiS_ii, 8

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

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

	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"\nInput:\n "
	.size	.L.str.1, 10

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"\nOutput:\n "
	.size	.L.str.3, 11

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Debug test works"
	.size	.L.str.7, 17

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"serial counting 2^20 : "
	.size	.L.str.8, 24

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"serial counting 2^21 : "
	.size	.L.str.9, 24

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"serial counting 2^22 : "
	.size	.L.str.10, 24

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"serial counting 2^23 : "
	.size	.L.str.11, 24

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"serial counting 2^24 : "
	.size	.L.str.12, 24

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"parallel counting 2^20 : "
	.size	.L.str.13, 26

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"parallel counting 2^21 : "
	.size	.L.str.14, 26

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"parallel counting 2^22 : "
	.size	.L.str.15, 26

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"parallel counting 2^23 : "
	.size	.L.str.16, 26

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"parallel counting 2^24 : "
	.size	.L.str.17, 26

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z9histogramPiS_ii"
	.size	.L__unnamed_1, 19

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z14naivePrefixSumPiS_i"
	.size	.L__unnamed_2, 24

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z11copyToArrayPiS_S_ii"
	.size	.L__unnamed_3, 24

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

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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"\nDebug Start"
	.size	.Lstr, 13

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"\nFinish debug"
	.size	.Lstr.1, 14

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"Parallel function doesn't work on 2^21 and larger"
	.size	.Lstr.2, 50

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"tried using clock but doesn't seem to work on serial function"
	.size	.Lstr.3, 62

	.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 _Z24__device_stub__histogramPiS_ii
	.addrsig_sym _Z29__device_stub__naivePrefixSumPiS_i
	.addrsig_sym _Z26__device_stub__copyToArrayPiS_S_ii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z9histogramPiS_ii
	.addrsig_sym _Z14naivePrefixSumPiS_i
	.addrsig_sym _Z11copyToArrayPiS_S_ii
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9histogramPiS_ii      ; -- Begin function _Z9histogramPiS_ii
	.globl	_Z9histogramPiS_ii
	.p2align	8
	.type	_Z9histogramPiS_ii,@function
_Z9histogramPiS_ii:                     ; @_Z9histogramPiS_ii
; %bb.0:
	s_clause 0x1
	s_load_b64 s[2:3], s[0:1], 0x14
	s_load_b32 s8, s[0:1], 0x24
	v_bfe_u32 v1, v0, 10, 10
	v_and_b32_e32 v0, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s3, s3, s15
	s_lshr_b32 s4, s8, 16
	s_add_i32 s3, s3, s14
	s_delay_alu instid0(SALU_CYCLE_1)
	v_mad_u64_u32 v[2:3], null, s3, s4, v[1:2]
	s_load_b128 s[4:7], s[0:1], 0x0
	s_and_b32 s0, s8, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[3:4], null, v2, s0, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_ashrrev_i32_e32 v4, 31, v3
	v_cmp_lt_i32_e32 vcc_lo, -1, v3
	v_cmp_gt_i32_e64 s0, s2, v3
	v_lshlrev_b64 v[0:1], 2, v[3:4]
	v_mov_b32_e32 v4, 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	s_and_b32 s0, vcc_lo, s0
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, s1, s4, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v3, s1, s5, v1, s1
	global_store_b32 v[2:3], v4, off
	s_and_saveexec_b32 s1, s0
	s_cbranch_execz .LBB0_2
; %bb.1:
	v_add_co_u32 v0, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	v_mov_b32_e32 v2, 1
	global_load_b32 v0, v[0:1], off
	s_waitcnt vmcnt(0)
	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, s4, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	global_atomic_add_u32 v[0:1], v2, off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9histogramPiS_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 5
		.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	_Z9histogramPiS_ii, .Lfunc_end0-_Z9histogramPiS_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 252
; NumSgprs: 18
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 5
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z14naivePrefixSumPiS_i ; -- Begin function _Z14naivePrefixSumPiS_i
	.globl	_Z14naivePrefixSumPiS_i
	.p2align	8
	.type	_Z14naivePrefixSumPiS_i,@function
_Z14naivePrefixSumPiS_i:                ; @_Z14naivePrefixSumPiS_i
; %bb.0:
	s_load_b32 s4, s[0:1], 0x10
	s_mov_b32 s2, exec_lo
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_i32_e64 s4, v0
	s_cbranch_execz .LBB1_6
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_lshlrev_b32_e32 v1, 2, v0
	s_cmp_lt_u32 s4, 2
	s_waitcnt lgkmcnt(0)
	global_load_b32 v2, v1, s[2:3]
	s_waitcnt vmcnt(0)
	global_store_b32 v1, v2, s[0:1]
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB1_6
; %bb.2:                                ; %.lr.ph.preheader
	v_add_co_u32 v1, s2, s0, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v2, null, s1, 0, s2
	s_mov_b32 s2, 1
.LBB1_3:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s3, exec_lo
	v_cmpx_le_u32_e64 s2, v0
	s_cbranch_execz .LBB1_5
; %bb.4:                                ;   in Loop: Header=BB1_3 Depth=1
	v_subrev_nc_u32_e32 v3, s2, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v4, 31, v3
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, s0, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v4, vcc_lo
	s_clause 0x1
	global_load_b32 v5, v[1:2], off
	global_load_b32 v3, v[3:4], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v3, v3, v5
	global_store_b32 v[1:2], v3, off
.LBB1_5:                                ;   in Loop: Header=BB1_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s3
	s_lshl_b32 s2, s2, 1
	s_waitcnt_vscnt null, 0x0
	s_cmp_lt_i32 s2, s4
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB1_3
.LBB1_6:                                ; %.loopexit
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14naivePrefixSumPiS_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 6
		.amdhsa_next_free_sgpr 5
		.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	_Z14naivePrefixSumPiS_i, .Lfunc_end1-_Z14naivePrefixSumPiS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 236
; NumSgprs: 7
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 7
; NumVGPRsForWavesPerEU: 6
; 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	_Z11copyToArrayPiS_S_ii ; -- Begin function _Z11copyToArrayPiS_S_ii
	.globl	_Z11copyToArrayPiS_S_ii
	.p2align	8
	.type	_Z11copyToArrayPiS_S_ii,@function
_Z11copyToArrayPiS_S_ii:                ; @_Z11copyToArrayPiS_S_ii
; %bb.0:
	s_clause 0x1
	s_load_b64 s[2:3], s[0:1], 0x1c
	s_load_b32 s4, s[0:1], 0x2c
	v_bfe_u32 v1, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s3, s3, s15
	s_lshr_b32 s5, s4, 16
	s_add_i32 s3, s3, s14
	s_delay_alu instid0(SALU_CYCLE_1)
	v_mad_u64_u32 v[2:3], null, s3, s5, v[1:2]
	v_and_b32_e32 v3, 0x3ff, v0
	s_and_b32 s3, s4, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[0:1], null, v2, s3, v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_lt_i32_e32 vcc_lo, -1, v0
	v_cmp_gt_i32_e64 s2, s2, v0
	s_and_b32 s2, vcc_lo, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB2_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_mov_b32_e32 v1, 0
	v_mov_b32_e32 v3, -1
	s_load_b64 s[0:1], s[0:1], 0x10
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s6, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	global_load_b32 v0, v[0:1], off
	s_waitcnt vmcnt(0)
	v_ashrrev_i32_e32 v1, 31, v0
	v_lshlrev_b64 v[1:2], 2, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v1, vcc_lo, s4, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s5, v2, vcc_lo
	global_atomic_add_u32 v1, v[1:2], v3, off glc
	s_waitcnt vmcnt(0)
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	v_add_co_u32 v1, vcc_lo, s0, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
	global_store_b32 v[1:2], v0, off offset:-4
.LBB2_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11copyToArrayPiS_S_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 5
		.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_end2:
	.size	_Z11copyToArrayPiS_S_ii, .Lfunc_end2-_Z11copyToArrayPiS_S_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 276
; NumSgprs: 18
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 5
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

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

	.end_amdgpu_metadata
