/**
 * @file microbenchmarking_transfers.cu
 * @detail This file describes the implementation of the functions involved in the
 * PCIe bandwidth and latency.
 * @author Antonio Jose Lazaro Munoz.
 * @date 20/02/2016
 */

#include <stdio.h>

void swap(float & v1, float & v2){
    float tmp = v1;
    v1 = v2;
    v2 = tmp;
}


int partition(float *array, int left, int right){
    int part = right;
    swap(array[part],array[(right+left) / 2]);
    
    --right;
 
    while(true){
        while(array[left] < array[part]){
            ++left;
        }
        while(right >= left && array[part] <= array[right]){
            --right;
        }
        if(right < left) break;
 
        swap(array[left],array[right]);
        ++left;
        --right;
    }
 
    swap(array[part],array[left]);
 
    return left;
}

void qs(float * array, const int left, const int right){
    if(left < right){
        const int part = partition(array, left, right);
        qs(array, part + 1,right);
        qs(array, left,part - 1);
    }
}


/**
 * @brief Quicksort
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details Quicksort
 * 
 * @param array elements array
 * @param size array size
 */
void serialQuickSort(float *array, const int size){
    qs(array, 0,size-1);
}

/**
 * @brief Calculate times median
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the median from a set of times.
 * 
 * @param h_times times array.
 * @param N array size.
 * 
 * @return time median.
 */
float getMedianTime(float *h_times, int N)
{
	float median = 0;

	float * h_sorted_times = (float *)malloc(N * sizeof(float));
	
	for(int n = 0; n < N; n++)
		h_sorted_times[n] = h_times[n];
		
	//Sort execution times
	serialQuickSort(h_sorted_times, N);
	
	//Calculate median
	if(N%2 == 0)
	{
		
		median = (h_sorted_times[N/2] + h_sorted_times[(N/2)+1])/2;
		
	}
	else
	{
		int p = N/2;
		
		median = h_sorted_times[p];
		
	}
	
	free(h_sorted_times);
	
	return median;
	
}

/**
 * @brief Calculate PCIe HTD latency.
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the latency of the PCIe for HTD memory transfers.
 * 
 * @param d_data device data.
 * @param h_data host data.
 * @param nreps iterations.
 * @return HTD PCIe latency (ms).
 */
float getLoHTD(char *d_data, char *h_data, int nreps)
{

	cudaEvent_t start_event, stop_event;
	cudaEventCreate(&start_event);
	cudaEventCreate(&stop_event);

	float LoHTD = 0.0;
	
	
	float *h_times = (float *)malloc(nreps * sizeof(float));
	
	memset(h_times, 0, nreps *  sizeof(float));
	

	for(int k = 0; k < nreps; k++)
	{
		cudaEventRecord(start_event, 0);
		
				//we only transfer 1 byte.
				cudaMemcpy(d_data, h_data, sizeof(char), cudaMemcpyHostToDevice);
		
		cudaEventRecord(stop_event, 0);
		cudaEventSynchronize(stop_event);
		cudaEventElapsedTime(&LoHTD, start_event, stop_event);
		
		h_times[k] = LoHTD;
	}
	
	LoHTD = getMedianTime(h_times, nreps);
	
	free(h_times);
	cudaEventDestroy(start_event);
	cudaEventDestroy(stop_event);
	
	return LoHTD;
}

/**
 * @brief Calculate PCIe DTH latency
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the latency of the PCIe for DTH memory transfers.
 * 
 * @param d_data Device data.
 * @param h_data Host data.
 * @param nreps iterations
 * @return DTH PCIe latency (ms).
 */
float getLoDTH(char *d_data, char *h_data, int nreps)
{

	cudaEvent_t start_event, stop_event;
	cudaEventCreate(&start_event);
	cudaEventCreate(&stop_event);

	float LoDTH = 0.0;
	
	
	float *h_times = (float *)malloc(nreps * sizeof(float));
	
	memset(h_times, 0, nreps *  sizeof(float));
	
	for(int k = 0; k < nreps; k++)
	{
		cudaEventRecord(start_event, 0);
		
				//we only transfer 1 byte.
				cudaMemcpy(h_data, d_data, sizeof(char), cudaMemcpyDeviceToHost);
		
		cudaEventRecord(stop_event, 0);
		cudaEventSynchronize(stop_event);
		cudaEventElapsedTime(&LoDTH, start_event, stop_event);
		
		h_times[k] = LoDTH;
	}
	
	LoDTH = getMedianTime(h_times, nreps);
	
	free(h_times);
	cudaEventDestroy(start_event);
	cudaEventDestroy(stop_event);
	
	return LoDTH;
}

/**
 * @brief DTH PCIe bandwidth (ms/byte).
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the bandwidth of the PCIe for DTH memory transfers.
 * 
 * @param d_data Device data.
 * @param h_data Host data.
 * @param LoDTH DTH PCIe latency.
 * @param nreps Iterations.
 * @return DTH PCIe bandwidth (ms/byte).
 */
float getGDTH(char *d_data, char *h_data, float LoDTH, int nreps)
{
	float time = 0;
	float GDTH = 0.0;
	float timeSumGDTH = 0.0;
	
	cudaEvent_t start_event, stop_event;
	cudaEventCreate(&start_event);
	cudaEventCreate(&stop_event);

	int n = 0;
	int total_bytes = 0;

	//From 16 MB to 512 MB
	for(int size = 16; size <= 512; size=size*2)
	{
		
		cudaEventRecord(start_event, 0);
		
			cudaMemcpy(h_data, d_data, size * 1024 * 1024* sizeof(char), cudaMemcpyDeviceToHost);
	
		cudaEventRecord(stop_event, 0);
		cudaEventSynchronize(stop_event);
		cudaEventElapsedTime(&time, start_event, stop_event);
		
		timeSumGDTH += time;
		total_bytes += size * 1024 * 1024;
		
		n++;
	}
	
	GDTH = (timeSumGDTH - n*LoDTH)/total_bytes;
	cudaEventDestroy(start_event);
	cudaEventDestroy(stop_event);
	
	return GDTH;
	
	
}

/**
 * @brief HTD PCIe bandwidth (ms/byte).
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the bandwidth of the PCIe for HTD memory transfers.
 * 
 * @param d_data Device data.
 * @param h_data Host data.
 * @param LoHTD HTD PCIe latency.
 * @param nreps Iterations.
 * @return HTD PCIe bandwidth (ms/byte).
 */
float getGHTD(char *d_data, char *h_data, float LoHTD, int nreps)
{
	float time = 0;
	float GHTD = 0.0;
	float timeSumGHTD = 0.0;
	
	cudaEvent_t start_event, stop_event;
	cudaEventCreate(&start_event);
	cudaEventCreate(&stop_event);
	
	
	int n = 0;
	int total_bytes = 0;

	//From 16 MB to 512 MB
	for(int size = 16; size <= 512; size=size*2)
	{
		
		cudaEventRecord(start_event, 0);
		
			cudaMemcpy(d_data, h_data, size * 1024 * 1024* sizeof(char), cudaMemcpyHostToDevice);
	
		cudaEventRecord(stop_event, 0);
		cudaEventSynchronize(stop_event);
		cudaEventElapsedTime(&time, start_event, stop_event);
		
		timeSumGHTD += time;
		total_bytes += size * 1024 * 1024;
		
		n++;
	}
	
	GHTD = (timeSumGHTD - n*LoHTD)/total_bytes;
	cudaEventDestroy(start_event);
	cudaEventDestroy(stop_event);
	
	
	return GHTD;
	
	
}

/**
 * @brief Overlap DTH PCIe bandwidth.
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the bandwidth of the PCIe for HTD memory transfers, when a DTH memory transfer
 * is concurrently executed.
 * 
 * @param d_data Device data.
 * @param h_data Host data.
 * @param LoDTH DTH PCIe latency.
 * @param nreps Iterations.
 * @return Overlap DTH PCIe bandwidth (byte/ms).
 */
float getOverlappedGDTH(char *d_data, char *h_data, float LoDTH, int nreps)
{
	float time = 0;
	float GDTH = 0.0;
	float timeSumGDTH = 0.0;
	
	cudaStream_t *stream_benchmark = (cudaStream_t *)malloc(2 * sizeof(cudaStream_t));
	
	for(int i = 0; i < 2; i++)
		cudaStreamCreate(&(stream_benchmark[i]));

	cudaEvent_t start_event, stop_event;
	cudaEventCreate(&start_event);
	cudaEventCreate(&stop_event);
		
	int n = 0;
	int total_bytes = 0;

	//From 16 MB to 512 MB
	for(int size = 16; size <= 512; size=size*2)
	{
		
		cudaEventRecord(start_event, stream_benchmark[0]);
		
		//DTH
		cudaMemcpyAsync(h_data, 
						d_data, 
						size * 1024 * 1024* sizeof(char), 
						cudaMemcpyDeviceToHost, stream_benchmark[0]);
	
		cudaEventRecord(stop_event, stream_benchmark[0]);
		
		
		//HTD
		cudaMemcpyAsync(d_data + (size * 1024 * 1024), 
						h_data + (size * 1024 * 1024), 
						size * 1024 * 1024* sizeof(char), 
						cudaMemcpyHostToDevice, stream_benchmark[1]);
		
		cudaDeviceSynchronize();
		cudaEventElapsedTime(&time, start_event, stop_event);
		
		timeSumGDTH += time;
		total_bytes += size * 1024 * 1024;
		
		n++;
	}
	
	GDTH = (timeSumGDTH - n*LoDTH)/total_bytes;
	
	for(int i = 0; i < 2; i++)
		cudaStreamDestroy(stream_benchmark[i]);
	free(stream_benchmark);
	
	cudaEventDestroy(start_event);
	cudaEventDestroy(stop_event);

	return GDTH;
	
	
}

/**
 * @brief Overlap HTD PCIe bandwidth.
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the bandwidth of the PCIe for DTH memory transfers, when a HTD memory transfer
 * is concurrently executed.
 * 
 * @param d_data Device data.
 * @param h_data Host data.
 * @param LoHTD HTD PCIe latency.
 * @param nreps Iterations.
 * @return Overlap HTD PCIe bandwidth (byte/ms).
 */
float getOverlappedGHTD(char *d_data, char *h_data, float LoHTD, int nreps)
{
	float time = 0;
	float GHTD = 0.0;
	float timeSumGHTD = 0.0;
	
	cudaStream_t *stream_benchmark = (cudaStream_t *)malloc(2 * sizeof(cudaStream_t));
	
	for(int i = 0; i < 2; i++)
		cudaStreamCreate(&(stream_benchmark[i]));
	
	cudaEvent_t start_event, stop_event;
	cudaEventCreate(&start_event);
	cudaEventCreate(&stop_event);

	int n = 0;
	int total_bytes = 0;

	//From 16 MB to 512 MB
	for(int size = 16; size <= 512; size=size*2)
	{
		
		cudaEventRecord(start_event, stream_benchmark[0]);
		
		cudaMemcpyAsync(d_data, 
						h_data, 
						size * 1024 * 1024* sizeof(char), 
						cudaMemcpyHostToDevice, stream_benchmark[0]);
	
		cudaEventRecord(stop_event, stream_benchmark[0]);
		
		
		
		cudaMemcpyAsync(h_data + (size * 1024 * 1024), 
						d_data + (size * 1024 * 1024), 
						size * 1024 * 1024* sizeof(char), 
						cudaMemcpyDeviceToHost, stream_benchmark[1]);
		
		cudaDeviceSynchronize();
		cudaEventElapsedTime(&time, start_event, stop_event);
		
		timeSumGHTD += time;
		total_bytes += size * 1024 * 1024;
		
		n++;
	}
	
	GHTD = (timeSumGHTD - n*LoHTD)/total_bytes;
	
	for(int i = 0; i < 2; i++)
		cudaStreamDestroy(stream_benchmark[i]);
	free(stream_benchmark);
	
	cudaEventDestroy(start_event);
	cudaEventDestroy(stop_event);

	return GHTD;
	
	
}

/**
 * @brief PCIe microbenchmarking.
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function calculates the values of PCIe latency and bandwidth 
 * for HTD and DTH memory transfers.
 * 
 * @param gpu GPU id.
 * @param LoHTD PCIe HTD latency (pointer).
 * @param LoDTH PCIe DTH latency (pointer).
 * @param GHTD HTD PCIe bandwidth (pointer).
 * @param overlappedGHTD Overlap HTD PCIe bandwidth (pointer).
 * @param GDTH DTH PCIe bandwidth (pointer).
 * @param overlappedGDTH Overlap DTH PCIe bandwidth (pointer).
 * @param nIter Iterations.
 */
void microbenchmarkingPCI(int gpu, float *LoHTD, float *LoDTH, float *GHTD, float *overlappedGHTD, 
					   float *GDTH, float *overlappedGDTH, int nIter)
{
	
	cudaDeviceProp props;
	cudaGetDeviceProperties(&props, gpu);
	cudaSetDevice(gpu);

	int tam = 1024*1024*1024;	// 1GB
	char *h_data_benchmark; cudaMallocHost((void**)&h_data_benchmark, tam * sizeof(char));
	memset(h_data_benchmark, 0, tam * sizeof(char));
		
	char *d_data_benchmark; cudaMalloc((void **)&d_data_benchmark, tam * sizeof(char));
	cudaMemset(d_data_benchmark, 0, tam * sizeof(char));
	
	*LoHTD = getLoHTD(d_data_benchmark, h_data_benchmark, nIter);
	*GHTD = getGHTD(d_data_benchmark, h_data_benchmark, *LoHTD, nIter);
		
	if(props.asyncEngineCount == 2)
		*overlappedGHTD = getOverlappedGHTD(d_data_benchmark, h_data_benchmark, *LoHTD, nIter);
			
	*LoDTH = getLoDTH(d_data_benchmark, h_data_benchmark, nIter);
	*GDTH = getGDTH(d_data_benchmark, h_data_benchmark, *LoDTH, nIter);
		
	if(props.asyncEngineCount == 2)
		*overlappedGDTH = getOverlappedGDTH(d_data_benchmark, h_data_benchmark, *LoDTH, nIter);
			
	 

	cudaFreeHost(h_data_benchmark);
	cudaFree(d_data_benchmark);
}
	.file	"tmpxft_0020c0ad_00000000-6_microbenchmarking_transfers.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2041:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2041:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z4swapRfS_
	.type	_Z4swapRfS_, @function
_Z4swapRfS_:
.LFB2027:
	.cfi_startproc
	endbr64
	movss	(%rdi), %xmm0
	movss	(%rsi), %xmm1
	movss	%xmm1, (%rdi)
	movss	%xmm0, (%rsi)
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z4swapRfS_, .-_Z4swapRfS_
	.globl	_Z9partitionPfii
	.type	_Z9partitionPfii, @function
_Z9partitionPfii:
.LFB2028:
	.cfi_startproc
	endbr64
	leal	(%rdx,%rsi), %eax
	movl	%edx, %ecx
	movl	$2, %r8d
	cltd
	idivl	%r8d
	movslq	%ecx, %rdx
	leaq	(%rdi,%rdx,4), %r8
	leal	-1(%rcx), %edx
	movss	(%r8), %xmm0
	cltq
	leaq	(%rdi,%rax,4), %rax
	movss	(%rax), %xmm1
	movss	%xmm1, (%r8)
	movss	%xmm0, (%rax)
	movslq	%esi, %rax
	leaq	(%rdi,%rax,4), %rax
.L9:
	movss	(%rax), %xmm1
	movss	(%r8), %xmm0
	incl	%esi
	comiss	%xmm1, %xmm0
	jbe	.L11
.L5:
	addq	$4, %rax
	jmp	.L9
.L11:
	movslq	%edx, %rcx
	leal	-1(%rsi), %r9d
	leaq	(%rdi,%rcx,4), %rcx
.L7:
	cmpl	%edx, %r9d
	jg	.L6
	movss	(%rcx), %xmm2
	movq	%rcx, %r10
	decl	%edx
	subq	$4, %rcx
	comiss	%xmm0, %xmm2
	jnb	.L7
	movss	%xmm2, (%rax)
	movss	%xmm1, (%r10)
	jmp	.L5
.L6:
	movss	%xmm1, (%r8)
	movss	%xmm0, (%rax)
	movl	%r9d, %eax
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z9partitionPfii, .-_Z9partitionPfii
	.globl	_Z2qsPfii
	.type	_Z2qsPfii, @function
_Z2qsPfii:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
.L14:
	cmpl	%edx, %r12d
	jge	.L12
	movl	%r12d, %esi
	movq	%rbp, %rdi
	movl	%edx, 12(%rsp)
	call	_Z9partitionPfii
	movl	12(%rsp), %edx
	movl	%eax, %ebx
	leal	1(%rax), %esi
	call	_Z2qsPfii
	leal	-1(%rbx), %edx
	jmp	.L14
.L12:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z2qsPfii, .-_Z2qsPfii
	.globl	_Z15serialQuickSortPfi
	.type	_Z15serialQuickSortPfi, @function
_Z15serialQuickSortPfi:
.LFB2030:
	.cfi_startproc
	endbr64
	leal	-1(%rsi), %edx
	xorl	%esi, %esi
	jmp	_Z2qsPfii
	.cfi_endproc
.LFE2030:
	.size	_Z15serialQuickSortPfi, .-_Z15serialQuickSortPfi
	.globl	_Z13getMedianTimePfi
	.type	_Z13getMedianTimePfi, @function
_Z13getMedianTimePfi:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rbp
	movslq	%esi, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	salq	$2, %rdi
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	call	malloc@PLT
	movq	%rax, %r11
	xorl	%eax, %eax
.L18:
	cmpl	%eax, %ebx
	jle	.L23
	movss	0(%rbp,%rax,4), %xmm0
	movss	%xmm0, (%r11,%rax,4)
	incq	%rax
	jmp	.L18
.L23:
	movl	%ebx, %esi
	movq	%r11, %rdi
	call	_Z15serialQuickSortPfi
	movl	%ebx, %eax
	movl	$2, %ecx
	cltd
	idivl	%ecx
	cltq
	salq	$2, %rax
	andb	$1, %bl
	leaq	(%r11,%rax), %rdx
	jne	.L20
	movss	4(%r11,%rax), %xmm0
	addss	(%rdx), %xmm0
	mulss	.LC0(%rip), %xmm0
	jmp	.L21
.L20:
	movss	(%rdx), %xmm0
.L21:
	movq	%r11, %rdi
	movss	%xmm0, 12(%rsp)
	call	free@PLT
	movss	12(%rsp), %xmm0
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z13getMedianTimePfi, .-_Z13getMedianTimePfi
	.globl	_Z8getLoHTDPcS_i
	.type	_Z8getLoHTDPcS_i, @function
_Z8getLoHTDPcS_i:
.LFB2032:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movslq	%edx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rbp
	salq	$2, %r12
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rdi
	leaq	20(%rsp), %r15
	call	cudaEventCreate@PLT
	leaq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	%r12, %rdi
	movl	$0x00000000, 20(%rsp)
	call	malloc@PLT
	movq	%r12, %rcx
	movq	%r12, %rdx
	xorl	%esi, %esi
	movq	%rax, %rdi
	movq	%rax, %rbx
	xorl	%r12d, %r12d
	call	__memset_chk@PLT
.L25:
	movq	24(%rsp), %rax
	movq	%rax, 8(%rsp)
	cmpl	%r12d, %ebp
	jle	.L29
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$1, %ecx
	movq	%r14, %rsi
	movq	%r13, %rdi
	movl	$1, %edx
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movq	%r15, %rdi
	call	cudaEventElapsedTime@PLT
	movss	20(%rsp), %xmm0
	movss	%xmm0, (%rbx,%r12,4)
	incq	%r12
	jmp	.L25
.L29:
	movl	%ebp, %esi
	movq	%rbx, %rdi
	call	_Z13getMedianTimePfi
	movq	%rbx, %rdi
	movss	%xmm0, 20(%rsp)
	call	free@PLT
	movq	8(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	32(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movss	20(%rsp), %xmm0
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z8getLoHTDPcS_i, .-_Z8getLoHTDPcS_i
	.globl	_Z8getLoDTHPcS_i
	.type	_Z8getLoDTHPcS_i, @function
_Z8getLoDTHPcS_i:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movslq	%edx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rbp
	salq	$2, %r12
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rdi
	leaq	20(%rsp), %r15
	call	cudaEventCreate@PLT
	leaq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	%r12, %rdi
	movl	$0x00000000, 20(%rsp)
	call	malloc@PLT
	movq	%r12, %rcx
	movq	%r12, %rdx
	xorl	%esi, %esi
	movq	%rax, %rdi
	movq	%rax, %rbx
	xorl	%r12d, %r12d
	call	__memset_chk@PLT
.L31:
	movq	24(%rsp), %rax
	movq	%rax, 8(%rsp)
	cmpl	%r12d, %ebp
	jle	.L35
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$2, %ecx
	movq	%r13, %rsi
	movq	%r14, %rdi
	movl	$1, %edx
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movq	%r15, %rdi
	call	cudaEventElapsedTime@PLT
	movss	20(%rsp), %xmm0
	movss	%xmm0, (%rbx,%r12,4)
	incq	%r12
	jmp	.L31
.L35:
	movl	%ebp, %esi
	movq	%rbx, %rdi
	call	_Z13getMedianTimePfi
	movq	%rbx, %rdi
	movss	%xmm0, 20(%rsp)
	call	free@PLT
	movq	8(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	32(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movss	20(%rsp), %xmm0
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2033:
	.size	_Z8getLoDTHPcS_i, .-_Z8getLoDTHPcS_i
	.globl	_Z7getGDTHPcS_fi
	.type	_Z7getGDTHPcS_fi, @function
_Z7getGDTHPcS_fi:
.LFB2034:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r15d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	$16, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%rsi, (%rsp)
	leaq	24(%rsp), %rdi
	leaq	20(%rsp), %r14
	movss	%xmm0, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movl	$0x00000000, 20(%rsp)
	call	cudaEventCreate@PLT
	leaq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	xorps	%xmm0, %xmm0
.L37:
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	movl	%ebx, %r13d
	movss	%xmm0, 12(%rsp)
	sall	$20, %r13d
	incl	%ebp
	addl	%ebx, %ebx
	call	cudaEventRecord@PLT
	movq	(%rsp), %rdi
	movslq	%r13d, %rdx
	movq	%r12, %rsi
	movl	$2, %ecx
	addl	%r13d, %r15d
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movq	%r14, %rdi
	call	cudaEventElapsedTime@PLT
	movss	12(%rsp), %xmm0
	addss	20(%rsp), %xmm0
	cmpl	$6, %ebp
	jne	.L37
	movss	8(%rsp), %xmm1
	mulss	.LC2(%rip), %xmm1
	movq	24(%rsp), %rdi
	subss	%xmm1, %xmm0
	cvtsi2ssl	%r15d, %xmm1
	divss	%xmm1, %xmm0
	movss	%xmm0, (%rsp)
	call	cudaEventDestroy@PLT
	movq	32(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movss	(%rsp), %xmm0
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L38
	call	__stack_chk_fail@PLT
.L38:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2034:
	.size	_Z7getGDTHPcS_fi, .-_Z7getGDTHPcS_fi
	.globl	_Z7getGHTDPcS_fi
	.type	_Z7getGHTDPcS_fi, @function
_Z7getGHTDPcS_fi:
.LFB2035:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r15d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	$16, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%rdi, (%rsp)
	leaq	24(%rsp), %rdi
	leaq	20(%rsp), %r14
	movss	%xmm0, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movl	$0x00000000, 20(%rsp)
	call	cudaEventCreate@PLT
	leaq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	xorps	%xmm0, %xmm0
.L42:
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	movl	%ebx, %r13d
	movss	%xmm0, 12(%rsp)
	sall	$20, %r13d
	incl	%ebp
	addl	%ebx, %ebx
	call	cudaEventRecord@PLT
	movq	(%rsp), %rdi
	movslq	%r13d, %rdx
	movq	%r12, %rsi
	movl	$1, %ecx
	addl	%r13d, %r15d
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movq	%r14, %rdi
	call	cudaEventElapsedTime@PLT
	movss	12(%rsp), %xmm0
	addss	20(%rsp), %xmm0
	cmpl	$6, %ebp
	jne	.L42
	movss	8(%rsp), %xmm1
	mulss	.LC2(%rip), %xmm1
	movq	24(%rsp), %rdi
	subss	%xmm1, %xmm0
	cvtsi2ssl	%r15d, %xmm1
	divss	%xmm1, %xmm0
	movss	%xmm0, (%rsp)
	call	cudaEventDestroy@PLT
	movq	32(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movss	(%rsp), %xmm0
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L43
	call	__stack_chk_fail@PLT
.L43:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2035:
	.size	_Z7getGHTDPcS_fi, .-_Z7getGHTDPcS_fi
	.globl	_Z17getOverlappedGDTHPcS_fi
	.type	_Z17getOverlappedGDTHPcS_fi, @function
_Z17getOverlappedGDTHPcS_fi:
.LFB2036:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r15d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	xorl	%r14d, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	$16, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdi, %rbp
	movl	$16, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movss	%xmm0, 24(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movl	$0x00000000, 36(%rsp)
	call	malloc@PLT
	movq	%rax, %rbx
	movq	%rax, %rdi
	call	cudaStreamCreate@PLT
	leaq	8(%rbx), %rdi
	call	cudaStreamCreate@PLT
	leaq	40(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	48(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	36(%rsp), %rax
	xorps	%xmm0, %xmm0
	movq	%rax, 8(%rsp)
.L47:
	movq	(%rbx), %rsi
	movq	40(%rsp), %rdi
	movss	%xmm0, 28(%rsp)
	incl	%r14d
	call	cudaEventRecord@PLT
	movl	%r13d, %eax
	movq	(%rbx), %r8
	movl	$2, %ecx
	sall	$20, %eax
	movq	%rbp, %rsi
	movq	%r12, %rdi
	addl	%r13d, %r13d
	movslq	%eax, %rdx
	movl	%eax, 4(%rsp)
	movq	%rdx, 16(%rsp)
	call	cudaMemcpyAsync@PLT
	movq	(%rbx), %rsi
	movq	48(%rsp), %rdi
	call	cudaEventRecord@PLT
	movq	16(%rsp), %rdx
	movq	8(%rbx), %r8
	movl	$1, %ecx
	leaq	(%r12,%rdx), %rsi
	leaq	0(%rbp,%rdx), %rdi
	call	cudaMemcpyAsync@PLT
	call	cudaDeviceSynchronize@PLT
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movl	4(%rsp), %eax
	movss	28(%rsp), %xmm0
	addss	36(%rsp), %xmm0
	addl	%eax, %r15d
	cmpl	$6, %r14d
	jne	.L47
	movss	24(%rsp), %xmm1
	mulss	.LC2(%rip), %xmm1
	movq	(%rbx), %rdi
	subss	%xmm1, %xmm0
	cvtsi2ssl	%r15d, %xmm1
	divss	%xmm1, %xmm0
	movss	%xmm0, 4(%rsp)
	call	cudaStreamDestroy@PLT
	movq	8(%rbx), %rdi
	call	cudaStreamDestroy@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	40(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	48(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movss	4(%rsp), %xmm0
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L48
	call	__stack_chk_fail@PLT
.L48:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2036:
	.size	_Z17getOverlappedGDTHPcS_fi, .-_Z17getOverlappedGDTHPcS_fi
	.globl	_Z17getOverlappedGHTDPcS_fi
	.type	_Z17getOverlappedGHTDPcS_fi, @function
_Z17getOverlappedGHTDPcS_fi:
.LFB2037:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r15d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	xorl	%r14d, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	$16, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	movl	$16, %edi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movss	%xmm0, 24(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movl	$0x00000000, 36(%rsp)
	call	malloc@PLT
	movq	%rax, %rbx
	movq	%rax, %rdi
	call	cudaStreamCreate@PLT
	leaq	8(%rbx), %rdi
	call	cudaStreamCreate@PLT
	leaq	40(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	48(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	36(%rsp), %rax
	xorps	%xmm0, %xmm0
	movq	%rax, 8(%rsp)
.L52:
	movq	(%rbx), %rsi
	movq	40(%rsp), %rdi
	movss	%xmm0, 28(%rsp)
	incl	%r14d
	call	cudaEventRecord@PLT
	movl	%r13d, %eax
	movq	(%rbx), %r8
	movl	$1, %ecx
	sall	$20, %eax
	movq	%rbp, %rsi
	movq	%r12, %rdi
	addl	%r13d, %r13d
	movslq	%eax, %rdx
	movl	%eax, 4(%rsp)
	movq	%rdx, 16(%rsp)
	call	cudaMemcpyAsync@PLT
	movq	(%rbx), %rsi
	movq	48(%rsp), %rdi
	call	cudaEventRecord@PLT
	movq	16(%rsp), %rdx
	movq	8(%rbx), %r8
	movl	$2, %ecx
	leaq	(%r12,%rdx), %rsi
	leaq	0(%rbp,%rdx), %rdi
	call	cudaMemcpyAsync@PLT
	call	cudaDeviceSynchronize@PLT
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movl	4(%rsp), %eax
	movss	28(%rsp), %xmm0
	addss	36(%rsp), %xmm0
	addl	%eax, %r15d
	cmpl	$6, %r14d
	jne	.L52
	movss	24(%rsp), %xmm1
	mulss	.LC2(%rip), %xmm1
	movq	(%rbx), %rdi
	subss	%xmm1, %xmm0
	cvtsi2ssl	%r15d, %xmm1
	divss	%xmm1, %xmm0
	movss	%xmm0, 4(%rsp)
	call	cudaStreamDestroy@PLT
	movq	8(%rbx), %rdi
	call	cudaStreamDestroy@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	40(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	48(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movss	4(%rsp), %xmm0
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L53
	call	__stack_chk_fail@PLT
.L53:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2037:
	.size	_Z17getOverlappedGHTDPcS_fi, .-_Z17getOverlappedGHTDPcS_fi
	.globl	_Z20microbenchmarkingPCIiPfS_S_S_S_S_i
	.type	_Z20microbenchmarkingPCIiPfS_S_S_S_S_i, @function
_Z20microbenchmarkingPCIiPfS_S_S_S_S_i:
.LFB2038:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rcx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r8, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r9, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdx, %rbx
	subq	$1080, %rsp
	.cfi_def_cfa_offset 1136
	movl	%edi, 12(%rsp)
	movl	12(%rsp), %esi
	leaq	32(%rsp), %rdi
	movq	1136(%rsp), %r13
	movq	%fs:40, %rax
	movq	%rax, 1064(%rsp)
	xorl	%eax, %eax
	call	cudaGetDeviceProperties_v2@PLT
	movl	12(%rsp), %edi
	call	cudaSetDevice@PLT
	leaq	16(%rsp), %rdi
	movl	$1073741824, %esi
	call	cudaMallocHost@PLT
	movq	16(%rsp), %rdi
	xorl	%eax, %eax
	movl	$268435456, %ecx
	movl	$1073741824, %esi
	rep stosl
	leaq	24(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	movl	$1073741824, %edx
	call	cudaMemset@PLT
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdi
	movl	1144(%rsp), %edx
	call	_Z8getLoHTDPcS_i
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdi
	movl	1144(%rsp), %edx
	movss	%xmm0, 0(%rbp)
	call	_Z7getGHTDPcS_fi
	cmpl	$2, 632(%rsp)
	movss	%xmm0, (%r15)
	jne	.L57
	movl	1144(%rsp), %edx
	movss	0(%rbp), %xmm0
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdi
	call	_Z17getOverlappedGHTDPcS_fi
	movss	%xmm0, (%r14)
.L57:
	movl	1144(%rsp), %edx
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdi
	call	_Z8getLoDTHPcS_i
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdi
	movl	1144(%rsp), %edx
	movss	%xmm0, (%rbx)
	call	_Z7getGDTHPcS_fi
	cmpl	$2, 632(%rsp)
	movss	%xmm0, (%r12)
	jne	.L58
	movl	1144(%rsp), %edx
	movss	(%rbx), %xmm0
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdi
	call	_Z17getOverlappedGDTHPcS_fi
	movss	%xmm0, 0(%r13)
.L58:
	movq	16(%rsp), %rdi
	call	cudaFreeHost@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	1064(%rsp), %rax
	subq	%fs:40, %rax
	je	.L59
	call	__stack_chk_fail@PLT
.L59:
	addq	$1080, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2038:
	.size	_Z20microbenchmarkingPCIiPfS_S_S_S_S_i, .-_Z20microbenchmarkingPCIiPfS_S_S_S_S_i
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2064:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2064:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC0:
	.long	1056964608
	.align 4
.LC2:
	.long	1086324736
	.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:

/**
 * @file microbenchmarking_transfers.cu
 * @detail This file describes the implementation of the functions involved in the
 * PCIe bandwidth and latency.
 * @author Antonio Jose Lazaro Munoz.
 * @date 20/02/2016
 */


#include <hip/hip_runtime.h>
#include <stdio.h>

void swap(float & v1, float & v2){
    float tmp = v1;
    v1 = v2;
    v2 = tmp;
}


int partition(float *array, int left, int right){
    int part = right;
    swap(array[part],array[(right+left) / 2]);
    
    --right;
 
    while(true){
        while(array[left] < array[part]){
            ++left;
        }
        while(right >= left && array[part] <= array[right]){
            --right;
        }
        if(right < left) break;
 
        swap(array[left],array[right]);
        ++left;
        --right;
    }
 
    swap(array[part],array[left]);
 
    return left;
}

void qs(float * array, const int left, const int right){
    if(left < right){
        const int part = partition(array, left, right);
        qs(array, part + 1,right);
        qs(array, left,part - 1);
    }
}


/**
 * @brief Quicksort
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details Quicksort
 * 
 * @param array elements array
 * @param size array size
 */
void serialQuickSort(float *array, const int size){
    qs(array, 0,size-1);
}

/**
 * @brief Calculate times median
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the median from a set of times.
 * 
 * @param h_times times array.
 * @param N array size.
 * 
 * @return time median.
 */
float getMedianTime(float *h_times, int N)
{
	float median = 0;

	float * h_sorted_times = (float *)malloc(N * sizeof(float));
	
	for(int n = 0; n < N; n++)
		h_sorted_times[n] = h_times[n];
		
	//Sort execution times
	serialQuickSort(h_sorted_times, N);
	
	//Calculate median
	if(N%2 == 0)
	{
		
		median = (h_sorted_times[N/2] + h_sorted_times[(N/2)+1])/2;
		
	}
	else
	{
		int p = N/2;
		
		median = h_sorted_times[p];
		
	}
	
	free(h_sorted_times);
	
	return median;
	
}

/**
 * @brief Calculate PCIe HTD latency.
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the latency of the PCIe for HTD memory transfers.
 * 
 * @param d_data device data.
 * @param h_data host data.
 * @param nreps iterations.
 * @return HTD PCIe latency (ms).
 */
float getLoHTD(char *d_data, char *h_data, int nreps)
{

	hipEvent_t start_event, stop_event;
	hipEventCreate(&start_event);
	hipEventCreate(&stop_event);

	float LoHTD = 0.0;
	
	
	float *h_times = (float *)malloc(nreps * sizeof(float));
	
	memset(h_times, 0, nreps *  sizeof(float));
	

	for(int k = 0; k < nreps; k++)
	{
		hipEventRecord(start_event, 0);
		
				//we only transfer 1 byte.
				hipMemcpy(d_data, h_data, sizeof(char), hipMemcpyHostToDevice);
		
		hipEventRecord(stop_event, 0);
		hipEventSynchronize(stop_event);
		hipEventElapsedTime(&LoHTD, start_event, stop_event);
		
		h_times[k] = LoHTD;
	}
	
	LoHTD = getMedianTime(h_times, nreps);
	
	free(h_times);
	hipEventDestroy(start_event);
	hipEventDestroy(stop_event);
	
	return LoHTD;
}

/**
 * @brief Calculate PCIe DTH latency
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the latency of the PCIe for DTH memory transfers.
 * 
 * @param d_data Device data.
 * @param h_data Host data.
 * @param nreps iterations
 * @return DTH PCIe latency (ms).
 */
float getLoDTH(char *d_data, char *h_data, int nreps)
{

	hipEvent_t start_event, stop_event;
	hipEventCreate(&start_event);
	hipEventCreate(&stop_event);

	float LoDTH = 0.0;
	
	
	float *h_times = (float *)malloc(nreps * sizeof(float));
	
	memset(h_times, 0, nreps *  sizeof(float));
	
	for(int k = 0; k < nreps; k++)
	{
		hipEventRecord(start_event, 0);
		
				//we only transfer 1 byte.
				hipMemcpy(h_data, d_data, sizeof(char), hipMemcpyDeviceToHost);
		
		hipEventRecord(stop_event, 0);
		hipEventSynchronize(stop_event);
		hipEventElapsedTime(&LoDTH, start_event, stop_event);
		
		h_times[k] = LoDTH;
	}
	
	LoDTH = getMedianTime(h_times, nreps);
	
	free(h_times);
	hipEventDestroy(start_event);
	hipEventDestroy(stop_event);
	
	return LoDTH;
}

/**
 * @brief DTH PCIe bandwidth (ms/byte).
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the bandwidth of the PCIe for DTH memory transfers.
 * 
 * @param d_data Device data.
 * @param h_data Host data.
 * @param LoDTH DTH PCIe latency.
 * @param nreps Iterations.
 * @return DTH PCIe bandwidth (ms/byte).
 */
float getGDTH(char *d_data, char *h_data, float LoDTH, int nreps)
{
	float time = 0;
	float GDTH = 0.0;
	float timeSumGDTH = 0.0;
	
	hipEvent_t start_event, stop_event;
	hipEventCreate(&start_event);
	hipEventCreate(&stop_event);

	int n = 0;
	int total_bytes = 0;

	//From 16 MB to 512 MB
	for(int size = 16; size <= 512; size=size*2)
	{
		
		hipEventRecord(start_event, 0);
		
			hipMemcpy(h_data, d_data, size * 1024 * 1024* sizeof(char), hipMemcpyDeviceToHost);
	
		hipEventRecord(stop_event, 0);
		hipEventSynchronize(stop_event);
		hipEventElapsedTime(&time, start_event, stop_event);
		
		timeSumGDTH += time;
		total_bytes += size * 1024 * 1024;
		
		n++;
	}
	
	GDTH = (timeSumGDTH - n*LoDTH)/total_bytes;
	hipEventDestroy(start_event);
	hipEventDestroy(stop_event);
	
	return GDTH;
	
	
}

/**
 * @brief HTD PCIe bandwidth (ms/byte).
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the bandwidth of the PCIe for HTD memory transfers.
 * 
 * @param d_data Device data.
 * @param h_data Host data.
 * @param LoHTD HTD PCIe latency.
 * @param nreps Iterations.
 * @return HTD PCIe bandwidth (ms/byte).
 */
float getGHTD(char *d_data, char *h_data, float LoHTD, int nreps)
{
	float time = 0;
	float GHTD = 0.0;
	float timeSumGHTD = 0.0;
	
	hipEvent_t start_event, stop_event;
	hipEventCreate(&start_event);
	hipEventCreate(&stop_event);
	
	
	int n = 0;
	int total_bytes = 0;

	//From 16 MB to 512 MB
	for(int size = 16; size <= 512; size=size*2)
	{
		
		hipEventRecord(start_event, 0);
		
			hipMemcpy(d_data, h_data, size * 1024 * 1024* sizeof(char), hipMemcpyHostToDevice);
	
		hipEventRecord(stop_event, 0);
		hipEventSynchronize(stop_event);
		hipEventElapsedTime(&time, start_event, stop_event);
		
		timeSumGHTD += time;
		total_bytes += size * 1024 * 1024;
		
		n++;
	}
	
	GHTD = (timeSumGHTD - n*LoHTD)/total_bytes;
	hipEventDestroy(start_event);
	hipEventDestroy(stop_event);
	
	
	return GHTD;
	
	
}

/**
 * @brief Overlap DTH PCIe bandwidth.
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the bandwidth of the PCIe for HTD memory transfers, when a DTH memory transfer
 * is concurrently executed.
 * 
 * @param d_data Device data.
 * @param h_data Host data.
 * @param LoDTH DTH PCIe latency.
 * @param nreps Iterations.
 * @return Overlap DTH PCIe bandwidth (byte/ms).
 */
float getOverlappedGDTH(char *d_data, char *h_data, float LoDTH, int nreps)
{
	float time = 0;
	float GDTH = 0.0;
	float timeSumGDTH = 0.0;
	
	hipStream_t *stream_benchmark = (hipStream_t *)malloc(2 * sizeof(hipStream_t));
	
	for(int i = 0; i < 2; i++)
		hipStreamCreate(&(stream_benchmark[i]));

	hipEvent_t start_event, stop_event;
	hipEventCreate(&start_event);
	hipEventCreate(&stop_event);
		
	int n = 0;
	int total_bytes = 0;

	//From 16 MB to 512 MB
	for(int size = 16; size <= 512; size=size*2)
	{
		
		hipEventRecord(start_event, stream_benchmark[0]);
		
		//DTH
		hipMemcpyAsync(h_data, 
						d_data, 
						size * 1024 * 1024* sizeof(char), 
						hipMemcpyDeviceToHost, stream_benchmark[0]);
	
		hipEventRecord(stop_event, stream_benchmark[0]);
		
		
		//HTD
		hipMemcpyAsync(d_data + (size * 1024 * 1024), 
						h_data + (size * 1024 * 1024), 
						size * 1024 * 1024* sizeof(char), 
						hipMemcpyHostToDevice, stream_benchmark[1]);
		
		hipDeviceSynchronize();
		hipEventElapsedTime(&time, start_event, stop_event);
		
		timeSumGDTH += time;
		total_bytes += size * 1024 * 1024;
		
		n++;
	}
	
	GDTH = (timeSumGDTH - n*LoDTH)/total_bytes;
	
	for(int i = 0; i < 2; i++)
		hipStreamDestroy(stream_benchmark[i]);
	free(stream_benchmark);
	
	hipEventDestroy(start_event);
	hipEventDestroy(stop_event);

	return GDTH;
	
	
}

/**
 * @brief Overlap HTD PCIe bandwidth.
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function returns the bandwidth of the PCIe for DTH memory transfers, when a HTD memory transfer
 * is concurrently executed.
 * 
 * @param d_data Device data.
 * @param h_data Host data.
 * @param LoHTD HTD PCIe latency.
 * @param nreps Iterations.
 * @return Overlap HTD PCIe bandwidth (byte/ms).
 */
float getOverlappedGHTD(char *d_data, char *h_data, float LoHTD, int nreps)
{
	float time = 0;
	float GHTD = 0.0;
	float timeSumGHTD = 0.0;
	
	hipStream_t *stream_benchmark = (hipStream_t *)malloc(2 * sizeof(hipStream_t));
	
	for(int i = 0; i < 2; i++)
		hipStreamCreate(&(stream_benchmark[i]));
	
	hipEvent_t start_event, stop_event;
	hipEventCreate(&start_event);
	hipEventCreate(&stop_event);

	int n = 0;
	int total_bytes = 0;

	//From 16 MB to 512 MB
	for(int size = 16; size <= 512; size=size*2)
	{
		
		hipEventRecord(start_event, stream_benchmark[0]);
		
		hipMemcpyAsync(d_data, 
						h_data, 
						size * 1024 * 1024* sizeof(char), 
						hipMemcpyHostToDevice, stream_benchmark[0]);
	
		hipEventRecord(stop_event, stream_benchmark[0]);
		
		
		
		hipMemcpyAsync(h_data + (size * 1024 * 1024), 
						d_data + (size * 1024 * 1024), 
						size * 1024 * 1024* sizeof(char), 
						hipMemcpyDeviceToHost, stream_benchmark[1]);
		
		hipDeviceSynchronize();
		hipEventElapsedTime(&time, start_event, stop_event);
		
		timeSumGHTD += time;
		total_bytes += size * 1024 * 1024;
		
		n++;
	}
	
	GHTD = (timeSumGHTD - n*LoHTD)/total_bytes;
	
	for(int i = 0; i < 2; i++)
		hipStreamDestroy(stream_benchmark[i]);
	free(stream_benchmark);
	
	hipEventDestroy(start_event);
	hipEventDestroy(stop_event);

	return GHTD;
	
	
}

/**
 * @brief PCIe microbenchmarking.
 * @author Antonio Jose Lazaro Munoz
 * @date 17/02/2016
 * @details This function calculates the values of PCIe latency and bandwidth 
 * for HTD and DTH memory transfers.
 * 
 * @param gpu GPU id.
 * @param LoHTD PCIe HTD latency (pointer).
 * @param LoDTH PCIe DTH latency (pointer).
 * @param GHTD HTD PCIe bandwidth (pointer).
 * @param overlappedGHTD Overlap HTD PCIe bandwidth (pointer).
 * @param GDTH DTH PCIe bandwidth (pointer).
 * @param overlappedGDTH Overlap DTH PCIe bandwidth (pointer).
 * @param nIter Iterations.
 */
void microbenchmarkingPCI(int gpu, float *LoHTD, float *LoDTH, float *GHTD, float *overlappedGHTD, 
					   float *GDTH, float *overlappedGDTH, int nIter)
{
	
	hipDeviceProp_t props;
	hipGetDeviceProperties(&props, gpu);
	hipSetDevice(gpu);

	int tam = 1024*1024*1024;	// 1GB
	char *h_data_benchmark; hipHostMalloc((void**)&h_data_benchmark, tam * sizeof(char), hipHostMallocDefault);
	memset(h_data_benchmark, 0, tam * sizeof(char));
		
	char *d_data_benchmark; hipMalloc((void **)&d_data_benchmark, tam * sizeof(char));
	hipMemset(d_data_benchmark, 0, tam * sizeof(char));
	
	*LoHTD = getLoHTD(d_data_benchmark, h_data_benchmark, nIter);
	*GHTD = getGHTD(d_data_benchmark, h_data_benchmark, *LoHTD, nIter);
		
	if(props.asyncEngineCount == 2)
		*overlappedGHTD = getOverlappedGHTD(d_data_benchmark, h_data_benchmark, *LoHTD, nIter);
			
	*LoDTH = getLoDTH(d_data_benchmark, h_data_benchmark, nIter);
	*GDTH = getGDTH(d_data_benchmark, h_data_benchmark, *LoDTH, nIter);
		
	if(props.asyncEngineCount == 2)
		*overlappedGDTH = getOverlappedGDTH(d_data_benchmark, h_data_benchmark, *LoDTH, nIter);
			
	 

	hipHostFree(h_data_benchmark);
	hipFree(d_data_benchmark);
}
	.text
	.file	"microbenchmarking_transfers.hip"
	.globl	_Z4swapRfS_                     # -- Begin function _Z4swapRfS_
	.type	_Z4swapRfS_,@function
_Z4swapRfS_:                            # @_Z4swapRfS_
	.cfi_startproc
# %bb.0:
	movss	(%rdi), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movss	(%rsi), %xmm1                   # xmm1 = mem[0],zero,zero,zero
	movss	%xmm1, (%rdi)
	movss	%xmm0, (%rsi)
	retq
.Lfunc_end0:
	.size	_Z4swapRfS_, .Lfunc_end0-_Z4swapRfS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z9partitionPfii                # -- Begin function _Z9partitionPfii
	.type	_Z9partitionPfii,@function
_Z9partitionPfii:                       # @_Z9partitionPfii
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
                                        # kill: def $edx killed $edx def $rdx
	movl	%esi, %eax
	movabsq	$-4294967296, %rsi              # imm = 0xFFFFFFFF00000000
	movslq	%edx, %rcx
	leal	(%rcx,%rax), %r8d
	movl	%r8d, %r9d
	shrl	$31, %r9d
	addl	%r8d, %r9d
	sarl	%r9d
	movslq	%r9d, %r8
	movss	(%rdi,%rcx,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	(%rdi,%r8,4), %xmm1             # xmm1 = mem[0],zero,zero,zero
	movss	%xmm1, (%rdi,%rcx,4)
	movss	%xmm0, (%rdi,%r8,4)
	leaq	-4(%rdi), %r8
	movabsq	$4294967296, %r9                # imm = 0x100000000
.LBB1_1:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_2 Depth 2
                                        #     Child Loop BB1_4 Depth 2
	movss	(%rdi,%rcx,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movslq	%eax, %r11
	leaq	(%r8,%r11,4), %r10
	shlq	$32, %r11
	addq	%rsi, %r11
.LBB1_2:                                #   Parent Loop BB1_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	addq	%r9, %r11
	movss	4(%r10), %xmm1                  # xmm1 = mem[0],zero,zero,zero
	addq	$4, %r10
	incl	%eax
	ucomiss	%xmm1, %xmm0
	ja	.LBB1_2
# %bb.3:                                # %.preheader
                                        #   in Loop: Header=BB1_1 Depth=1
	movslq	%edx, %rdx
	sarq	$32, %r11
	movq	%rdx, %rbx
	shlq	$32, %rbx
.LBB1_4:                                #   Parent Loop BB1_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	%r11, %rdx
	jle	.LBB1_7
# %bb.5:                                #   in Loop: Header=BB1_4 Depth=2
	movss	(%r8,%rdx,4), %xmm2             # xmm2 = mem[0],zero,zero,zero
	decq	%rdx
	addq	%rsi, %rbx
	ucomiss	%xmm0, %xmm2
	jae	.LBB1_4
# %bb.6:                                #   in Loop: Header=BB1_1 Depth=1
	sarq	$30, %rbx
	movss	(%rdi,%rbx), %xmm0              # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%r10)
	movss	%xmm1, (%rdi,%rbx)
	jmp	.LBB1_1
.LBB1_7:                                # %.critedge
	movss	%xmm1, (%rdi,%rcx,4)
	movss	%xmm0, (%r10)
	decl	%eax
                                        # kill: def $eax killed $eax killed $rax
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z9partitionPfii, .Lfunc_end1-_Z9partitionPfii
	.cfi_endproc
                                        # -- End function
	.globl	_Z2qsPfii                       # -- Begin function _Z2qsPfii
	.type	_Z2qsPfii,@function
_Z2qsPfii:                              # @_Z2qsPfii
	.cfi_startproc
# %bb.0:
	cmpl	%edx, %esi
	jge	.LBB2_4
# %bb.1:                                # %tailrecurse.preheader
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebp
	movl	%esi, %ebx
	movq	%rdi, %r14
.LBB2_2:                                # %tailrecurse
                                        # =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	%ebx, %esi
	movl	%ebp, %edx
	callq	_Z9partitionPfii
	movl	%eax, %r15d
	leal	1(%r15), %esi
	movq	%r14, %rdi
	movl	%ebp, %edx
	callq	_Z2qsPfii
	decl	%r15d
	movl	%r15d, %ebp
	cmpl	%ebx, %r15d
	jg	.LBB2_2
# %bb.3:
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
.LBB2_4:                                # %tailrecurse._crit_edge
	retq
.Lfunc_end2:
	.size	_Z2qsPfii, .Lfunc_end2-_Z2qsPfii
	.cfi_endproc
                                        # -- End function
	.globl	_Z15serialQuickSortPfi          # -- Begin function _Z15serialQuickSortPfi
	.type	_Z15serialQuickSortPfi,@function
_Z15serialQuickSortPfi:                 # @_Z15serialQuickSortPfi
	.cfi_startproc
# %bb.0:
                                        # kill: def $esi killed $esi def $rsi
	leal	-1(%rsi), %edx
	xorl	%esi, %esi
	jmp	_Z2qsPfii                       # TAILCALL
.Lfunc_end3:
	.size	_Z15serialQuickSortPfi, .Lfunc_end3-_Z15serialQuickSortPfi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z13getMedianTimePfi
.LCPI4_0:
	.long	0x3f000000                      # float 0.5
	.text
	.globl	_Z13getMedianTimePfi
	.type	_Z13getMedianTimePfi,@function
_Z13getMedianTimePfi:                   # @_Z13getMedianTimePfi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	%esi, %r14d
	movq	%rdi, %r15
	movslq	%esi, %r12
	leaq	(,%r12,4), %rdi
	callq	malloc
	movq	%rax, %rbx
	testl	%r12d, %r12d
	jle	.LBB4_2
# %bb.1:                                # %.lr.ph.preheader
	movl	%r14d, %edx
	shlq	$2, %rdx
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	memcpy@PLT
.LBB4_2:                                # %._crit_edge
	leal	-1(%r14), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_Z2qsPfii
	testb	$1, %r14b
	jne	.LBB4_4
# %bb.3:
	sarl	%r14d
	movslq	%r14d, %rax
	movss	(%rbx,%rax,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	addss	4(%rbx,%rax,4), %xmm0
	mulss	.LCPI4_0(%rip), %xmm0
	jmp	.LBB4_5
.LBB4_4:
	movl	%r14d, %eax
	shrl	$31, %eax
	addl	%r14d, %eax
	sarl	%eax
	cltq
	movss	(%rbx,%rax,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
.LBB4_5:
	movss	%xmm0, 4(%rsp)                  # 4-byte Spill
	movq	%rbx, %rdi
	callq	free
	movss	4(%rsp), %xmm0                  # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z13getMedianTimePfi, .Lfunc_end4-_Z13getMedianTimePfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z8getLoHTDPcS_i                # -- Begin function _Z8getLoHTDPcS_i
	.type	_Z8getLoHTDPcS_i,@function
_Z8getLoHTDPcS_i:                       # @_Z8getLoHTDPcS_i
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebx
	movq	%rsi, %r14
	movq	%rdi, %r15
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
	leaq	8(%rsp), %rdi
	callq	hipEventCreate
	movl	$0, (%rsp)
	movl	%ebx, 4(%rsp)                   # 4-byte Spill
	movslq	%ebx, %rbx
	leaq	(,%rbx,4), %rsi
	movl	$1, %edi
	callq	calloc@PLT
	movq	%rax, %r12
	testl	%ebx, %ebx
	jle	.LBB5_3
# %bb.1:                                # %.lr.ph.preheader
	movl	4(%rsp), %ebp                   # 4-byte Reload
	xorl	%ebx, %ebx
	movq	%rsp, %r13
.LBB5_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	$1, %edx
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movq	%r13, %rdi
	callq	hipEventElapsedTime
	movss	(%rsp), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%r12,%rbx,4)
	incq	%rbx
	cmpq	%rbx, %rbp
	jne	.LBB5_2
.LBB5_3:                                # %._crit_edge
	movq	%r12, %rdi
	movl	4(%rsp), %esi                   # 4-byte Reload
	callq	_Z13getMedianTimePfi
	movss	%xmm0, (%rsp)
	movq	%r12, %rdi
	callq	free
	movq	16(%rsp), %rdi
	callq	hipEventDestroy
	movq	8(%rsp), %rdi
	callq	hipEventDestroy
	movss	(%rsp), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z8getLoHTDPcS_i, .Lfunc_end5-_Z8getLoHTDPcS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z8getLoDTHPcS_i                # -- Begin function _Z8getLoDTHPcS_i
	.type	_Z8getLoDTHPcS_i,@function
_Z8getLoDTHPcS_i:                       # @_Z8getLoDTHPcS_i
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebx
	movq	%rsi, %r14
	movq	%rdi, %r15
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
	leaq	8(%rsp), %rdi
	callq	hipEventCreate
	movl	$0, (%rsp)
	movl	%ebx, 4(%rsp)                   # 4-byte Spill
	movslq	%ebx, %rbx
	leaq	(,%rbx,4), %rsi
	movl	$1, %edi
	callq	calloc@PLT
	movq	%rax, %r12
	testl	%ebx, %ebx
	jle	.LBB6_3
# %bb.1:                                # %.lr.ph.preheader
	movl	4(%rsp), %ebp                   # 4-byte Reload
	xorl	%ebx, %ebx
	movq	%rsp, %r13
.LBB6_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	$1, %edx
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movq	%r13, %rdi
	callq	hipEventElapsedTime
	movss	(%rsp), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%r12,%rbx,4)
	incq	%rbx
	cmpq	%rbx, %rbp
	jne	.LBB6_2
.LBB6_3:                                # %._crit_edge
	movq	%r12, %rdi
	movl	4(%rsp), %esi                   # 4-byte Reload
	callq	_Z13getMedianTimePfi
	movss	%xmm0, (%rsp)
	movq	%r12, %rdi
	callq	free
	movq	16(%rsp), %rdi
	callq	hipEventDestroy
	movq	8(%rsp), %rdi
	callq	hipEventDestroy
	movss	(%rsp), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_Z8getLoDTHPcS_i, .Lfunc_end6-_Z8getLoDTHPcS_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z7getGDTHPcS_fi
.LCPI7_0:
	.long	0xc0c00000                      # float -6
.LCPI7_1:
	.long	0x4e7c0000                      # float 1.05696461E+9
	.text
	.globl	_Z7getGDTHPcS_fi
	.type	_Z7getGDTHPcS_fi,@function
_Z7getGDTHPcS_fi:                       # @_Z7getGDTHPcS_fi
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movss	%xmm0, 24(%rsp)                 # 4-byte Spill
	movq	%rsi, %rbx
	movq	%rdi, %r14
	leaq	28(%rsp), %r15
	movl	$0, (%r15)
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
	leaq	8(%rsp), %rdi
	callq	hipEventCreate
	xorps	%xmm1, %xmm1
	movl	$16, %ebp
	movl	$6, %r12d
.LBB7_1:                                # =>This Inner Loop Header: Depth=1
	movss	%xmm1, 4(%rsp)                  # 4-byte Spill
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	%ebp, %edx
	shll	$20, %edx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movq	%r15, %rdi
	callq	hipEventElapsedTime
	movss	4(%rsp), %xmm1                  # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	addss	28(%rsp), %xmm1
	addl	%ebp, %ebp
	decl	%r12d
	jne	.LBB7_1
# %bb.2:
	movss	24(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	mulss	.LCPI7_0(%rip), %xmm0
	addss	%xmm0, %xmm1
	divss	.LCPI7_1(%rip), %xmm1
	movss	%xmm1, 4(%rsp)                  # 4-byte Spill
	movq	16(%rsp), %rdi
	callq	hipEventDestroy
	movq	8(%rsp), %rdi
	callq	hipEventDestroy
	movss	4(%rsp), %xmm0                  # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	addq	$32, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end7:
	.size	_Z7getGDTHPcS_fi, .Lfunc_end7-_Z7getGDTHPcS_fi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z7getGHTDPcS_fi
.LCPI8_0:
	.long	0xc0c00000                      # float -6
.LCPI8_1:
	.long	0x4e7c0000                      # float 1.05696461E+9
	.text
	.globl	_Z7getGHTDPcS_fi
	.type	_Z7getGHTDPcS_fi,@function
_Z7getGHTDPcS_fi:                       # @_Z7getGHTDPcS_fi
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movss	%xmm0, 24(%rsp)                 # 4-byte Spill
	movq	%rsi, %rbx
	movq	%rdi, %r14
	leaq	28(%rsp), %r15
	movl	$0, (%r15)
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
	leaq	8(%rsp), %rdi
	callq	hipEventCreate
	xorps	%xmm1, %xmm1
	movl	$16, %ebp
	movl	$6, %r12d
.LBB8_1:                                # =>This Inner Loop Header: Depth=1
	movss	%xmm1, 4(%rsp)                  # 4-byte Spill
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	%ebp, %edx
	shll	$20, %edx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movq	%r15, %rdi
	callq	hipEventElapsedTime
	movss	4(%rsp), %xmm1                  # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	addss	28(%rsp), %xmm1
	addl	%ebp, %ebp
	decl	%r12d
	jne	.LBB8_1
# %bb.2:
	movss	24(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	mulss	.LCPI8_0(%rip), %xmm0
	addss	%xmm0, %xmm1
	divss	.LCPI8_1(%rip), %xmm1
	movss	%xmm1, 4(%rsp)                  # 4-byte Spill
	movq	16(%rsp), %rdi
	callq	hipEventDestroy
	movq	8(%rsp), %rdi
	callq	hipEventDestroy
	movss	4(%rsp), %xmm0                  # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	addq	$32, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_Z7getGHTDPcS_fi, .Lfunc_end8-_Z7getGHTDPcS_fi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z17getOverlappedGDTHPcS_fi
.LCPI9_0:
	.long	0xc0c00000                      # float -6
.LCPI9_1:
	.long	0x4e7c0000                      # float 1.05696461E+9
	.text
	.globl	_Z17getOverlappedGDTHPcS_fi
	.type	_Z17getOverlappedGDTHPcS_fi,@function
_Z17getOverlappedGDTHPcS_fi:            # @_Z17getOverlappedGDTHPcS_fi
	.cfi_startproc
# %bb.0:                                # %.critedge
	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	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movss	%xmm0, 36(%rsp)                 # 4-byte Spill
	movq	%rsi, %r14
	movq	%rdi, %r15
	leaq	12(%rsp), %rax
	movl	$0, (%rax)
	movl	$16, %edi
	callq	malloc
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	hipStreamCreate
	movq	%rbx, %rdi
	addq	$8, %rdi
	callq	hipStreamCreate
	leaq	24(%rsp), %rdi
	callq	hipEventCreate
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
	xorps	%xmm0, %xmm0
	movss	%xmm0, 8(%rsp)                  # 4-byte Spill
	movl	$16, %ebp
	movl	$6, %r12d
.LBB9_1:                                # =>This Inner Loop Header: Depth=1
	movq	24(%rsp), %rdi
	movq	(%rbx), %rsi
	callq	hipEventRecord
	movl	%ebp, %r13d
	shll	$20, %r13d
	movq	(%rbx), %r8
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r13, %rdx
	movl	$2, %ecx
	callq	hipMemcpyAsync
	movq	16(%rsp), %rdi
	movq	(%rbx), %rsi
	callq	hipEventRecord
	leaq	(%r15,%r13), %rdi
	leaq	(%r14,%r13), %rsi
	movq	8(%rbx), %r8
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpyAsync
	callq	hipDeviceSynchronize
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
	leaq	12(%rsp), %rdi
	callq	hipEventElapsedTime
	movss	8(%rsp), %xmm0                  # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	addss	12(%rsp), %xmm0
	movss	%xmm0, 8(%rsp)                  # 4-byte Spill
	addl	%ebp, %ebp
	decl	%r12d
	jne	.LBB9_1
# %bb.2:                                # %.preheader
	movq	(%rbx), %rdi
	callq	hipStreamDestroy
	movq	8(%rbx), %rdi
	callq	hipStreamDestroy
	movss	36(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	mulss	.LCPI9_0(%rip), %xmm0
	movss	8(%rsp), %xmm1                  # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	addss	%xmm0, %xmm1
	divss	.LCPI9_1(%rip), %xmm1
	movss	%xmm1, 8(%rsp)                  # 4-byte Spill
	movq	%rbx, %rdi
	callq	free
	movq	24(%rsp), %rdi
	callq	hipEventDestroy
	movq	16(%rsp), %rdi
	callq	hipEventDestroy
	movss	8(%rsp), %xmm0                  # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end9:
	.size	_Z17getOverlappedGDTHPcS_fi, .Lfunc_end9-_Z17getOverlappedGDTHPcS_fi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z17getOverlappedGHTDPcS_fi
.LCPI10_0:
	.long	0xc0c00000                      # float -6
.LCPI10_1:
	.long	0x4e7c0000                      # float 1.05696461E+9
	.text
	.globl	_Z17getOverlappedGHTDPcS_fi
	.type	_Z17getOverlappedGHTDPcS_fi,@function
_Z17getOverlappedGHTDPcS_fi:            # @_Z17getOverlappedGHTDPcS_fi
	.cfi_startproc
# %bb.0:                                # %.critedge
	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	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movss	%xmm0, 36(%rsp)                 # 4-byte Spill
	movq	%rsi, %r14
	movq	%rdi, %r15
	leaq	12(%rsp), %rax
	movl	$0, (%rax)
	movl	$16, %edi
	callq	malloc
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	hipStreamCreate
	movq	%rbx, %rdi
	addq	$8, %rdi
	callq	hipStreamCreate
	leaq	24(%rsp), %rdi
	callq	hipEventCreate
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
	xorps	%xmm0, %xmm0
	movss	%xmm0, 8(%rsp)                  # 4-byte Spill
	movl	$16, %ebp
	movl	$6, %r12d
.LBB10_1:                               # =>This Inner Loop Header: Depth=1
	movq	24(%rsp), %rdi
	movq	(%rbx), %rsi
	callq	hipEventRecord
	movl	%ebp, %r13d
	shll	$20, %r13d
	movq	(%rbx), %r8
	movq	%r15, %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpyAsync
	movq	16(%rsp), %rdi
	movq	(%rbx), %rsi
	callq	hipEventRecord
	leaq	(%r14,%r13), %rdi
	leaq	(%r15,%r13), %rsi
	movq	8(%rbx), %r8
	movq	%r13, %rdx
	movl	$2, %ecx
	callq	hipMemcpyAsync
	callq	hipDeviceSynchronize
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
	leaq	12(%rsp), %rdi
	callq	hipEventElapsedTime
	movss	8(%rsp), %xmm0                  # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	addss	12(%rsp), %xmm0
	movss	%xmm0, 8(%rsp)                  # 4-byte Spill
	addl	%ebp, %ebp
	decl	%r12d
	jne	.LBB10_1
# %bb.2:                                # %.preheader
	movq	(%rbx), %rdi
	callq	hipStreamDestroy
	movq	8(%rbx), %rdi
	callq	hipStreamDestroy
	movss	36(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	mulss	.LCPI10_0(%rip), %xmm0
	movss	8(%rsp), %xmm1                  # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	addss	%xmm0, %xmm1
	divss	.LCPI10_1(%rip), %xmm1
	movss	%xmm1, 8(%rsp)                  # 4-byte Spill
	movq	%rbx, %rdi
	callq	free
	movq	24(%rsp), %rdi
	callq	hipEventDestroy
	movq	16(%rsp), %rdi
	callq	hipEventDestroy
	movss	8(%rsp), %xmm0                  # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end10:
	.size	_Z17getOverlappedGHTDPcS_fi, .Lfunc_end10-_Z17getOverlappedGHTDPcS_fi
	.cfi_endproc
                                        # -- End function
	.globl	_Z20microbenchmarkingPCIiPfS_S_S_S_S_i # -- Begin function _Z20microbenchmarkingPCIiPfS_S_S_S_S_i
	.type	_Z20microbenchmarkingPCIiPfS_S_S_S_S_i,@function
_Z20microbenchmarkingPCIiPfS_S_S_S_S_i: # @_Z20microbenchmarkingPCIiPfS_S_S_S_S_i
	.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	$1512, %rsp                     # imm = 0x5E8
	.cfi_def_cfa_offset 1568
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, 32(%rsp)                   # 8-byte Spill
	movq	%r8, 24(%rsp)                   # 8-byte Spill
	movq	%rcx, %r13
	movq	%rdx, %rbx
	movq	%rsi, %r12
	movl	%edi, %r15d
	movl	1576(%rsp), %ebp
	leaq	40(%rsp), %rdi
	movl	%r15d, %esi
	callq	hipGetDevicePropertiesR0600
	movl	%r15d, %edi
	callq	hipSetDevice
	leaq	16(%rsp), %r15
	movl	$1073741824, %esi               # imm = 0x40000000
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	hipHostMalloc
	movq	(%r15), %rdi
	movl	$1073741824, %edx               # imm = 0x40000000
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	8(%rsp), %r14
	movl	$1073741824, %esi               # imm = 0x40000000
	movq	%r14, %rdi
	callq	hipMalloc
	movq	(%r14), %rdi
	movl	$1073741824, %edx               # imm = 0x40000000
	xorl	%esi, %esi
	callq	hipMemset
	movq	(%r14), %rdi
	movq	(%r15), %rsi
	movl	%ebp, %edx
	callq	_Z8getLoHTDPcS_i
	movss	%xmm0, (%r12)
	movq	(%r14), %rdi
	movq	(%r15), %rsi
	callq	_Z7getGHTDPcS_fi
	movss	%xmm0, (%r13)
	leaq	40(%rsp), %rax
	cmpl	$2, 600(%rax)
	jne	.LBB11_2
# %bb.1:
	movq	8(%rsp), %rdi
	movq	16(%rsp), %rsi
	movss	(%r12), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	callq	_Z17getOverlappedGHTDPcS_fi
	movq	24(%rsp), %rax                  # 8-byte Reload
	movss	%xmm0, (%rax)
.LBB11_2:
	movq	8(%rsp), %rdi
	movq	16(%rsp), %rsi
	movl	1576(%rsp), %edx
	callq	_Z8getLoDTHPcS_i
	movss	%xmm0, (%rbx)
	movq	8(%rsp), %rdi
	movq	16(%rsp), %rsi
	callq	_Z7getGDTHPcS_fi
	movq	32(%rsp), %rax                  # 8-byte Reload
	movss	%xmm0, (%rax)
	cmpl	$2, 640(%rsp)
	jne	.LBB11_4
# %bb.3:
	movq	1568(%rsp), %r14
	movq	8(%rsp), %rdi
	movq	16(%rsp), %rsi
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	callq	_Z17getOverlappedGDTHPcS_fi
	movss	%xmm0, (%r14)
.LBB11_4:
	movq	16(%rsp), %rdi
	callq	hipHostFree
	movq	8(%rsp), %rdi
	callq	hipFree
	addq	$1512, %rsp                     # imm = 0x5E8
	.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_end11:
	.size	_Z20microbenchmarkingPCIiPfS_S_S_S_S_i, .Lfunc_end11-_Z20microbenchmarkingPCIiPfS_S_S_S_S_i
	.cfi_endproc
                                        # -- End function
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_

	.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_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
