#include<iostream>
#include<fstream>
#include<time.h>
#include<vector>
#include<iterator>
#include<cuda.h>

#include<stdio.h>

#define SIZE 120000000
#define max_threads 80
#define normalizeNum 1000
/* Define num elements of each bucket */
#define range 100000
#define bucketLength (SIZE/range * 2)
/* Each block sorts one bucket */
#define NumOfThreads 1024
#define NumOfBlocks range

using namespace std;
ofstream fs("datos_sort.txt");
const char * NAMEFILE = "data_generated_by_script.txt";
vector<double> buckets[normalizeNum];

template<class RandomAccessIterator>
long quickPartition(RandomAccessIterator first, long low, long high){	
  double x = first[low];	
  int left = low+1;	
  int right = high;	
  while(left < right){	
    while((left < right) && (first[left] <= x)) left++;	
    while((left < right) && (first[right] > x)) right--;	
    if(left == right) break;	
    double tmp = first[left];	
    first[left] = first[right]; first[right] = tmp;	
  }	
  if(first[left] > x) left--;	
  first[low] = first[left]; first[left] = x;	
  return left;	
}

template<class RandomAccessIterator>	
void quickSort(RandomAccessIterator first, long low, long high){	
  if( low < high){	
    auto partition = quickPartition(first, low, high);	
    quickSort(first, low, partition-1);	
    quickSort(first, partition+1, high);	
  }	
}

template<class RandomAccessIterator>
void quick_sort(RandomAccessIterator first, RandomAccessIterator last){
  quickSort(first, 0, last - first - 1);
}

void clearBuckets(){
  for(int i=0;i<normalizeNum;i++){
    buckets[i].clear();
  }
}

void printArray(double* a){
  for(int i=0;i<SIZE;i++)
    cout << a[i] << " ";
  cout << endl;
}

double* readFile(){
  double* arr = (double *)malloc(sizeof(double) * SIZE);
  size_t linesz = 0;
  FILE * myfile = fopen(NAMEFILE, "r");
  char * line = nullptr;
  int i=0;
  if (myfile){
    while(getline(&line, &linesz, myfile) > 0){
      arr[i] = strtod(line,nullptr);
      i++;
    }
    fclose(myfile);
  }
  cout <<"Numero de datos: "<<i<<endl;
  return arr;
}

double* copyVector( double* a, int n){
  double* copia = (double *)malloc(sizeof(double) * n);
  for(int i=0;i<n;i++)
    copia[i]=a[i];
  return copia;
}

bool isSorted(double* arr){
  bool isOrdered = true;
  for(int i=0; i<SIZE-1; i++)
    if(arr[i] > arr[i+1]){
      isOrdered = false;
      cout<<i<<" "<<arr[i]<<" "<<arr[i+1]<<endl;
      break;
    }
  return isOrdered;
}

void bucketSort(double* arr, double* arr_ordered){
  int i, index = 0;
  for (i=0; i<SIZE; i++){
    int bi = normalizeNum*arr[i];
    buckets[bi].push_back(arr[i]);
  }
  for (i=0; i<normalizeNum; i++){
    quick_sort(buckets[i].begin(), buckets[i].end());
  }
  for (i = 0; i < normalizeNum; i++){
    for (int j = 0; j < buckets[i].size(); j++){
      arr_ordered[index++] = buckets[i][j];
    }
  }
}

__global__ void bucketSortCUDA(double *inData, double *outData, long size){
  __shared__ double localBucket[bucketLength];
  __shared__ int localCount;

  int threadId = threadIdx.x;
  int blockId = blockIdx.x;
  int offset = blockDim.x;
  int bucket, index, phase;
  double temp;
  
  if(threadId == 0){
    localCount = 0;
  }
  __syncthreads();
  
  while(threadId < size) {
    bucket = inData[threadId] * normalizeNum;
    if(bucket == blockId) {
      index = atomicAdd(&localCount, 1);
      localBucket[index] = inData[threadId]; 
    }
    threadId += offset;    
  }
  __syncthreads();

  threadId = threadIdx.x;
  for(phase = 0; phase < bucketLength; phase ++) {
    if(phase % 2 == 0) {
      while((threadId < bucketLength) && (threadId % 2 == 0)) {
        if(localBucket[threadId] > localBucket[threadId +1]) {
          temp = localBucket[threadId];
          localBucket[threadId] = localBucket[threadId + 1];
          localBucket[threadId + 1] = temp;
        }
        threadId += offset;
      }
    }
    else {
      while((threadId < bucketLength - 1) && (threadId %2 != 0)) {
        if(localBucket[threadId] > localBucket[threadId + 1]) {
          temp = localBucket[threadId];
          localBucket[threadId] = localBucket[threadId + 1];
          localBucket[threadId + 1] = temp;
        }
        threadId += offset;
      }
    }
  }
  
  threadId = threadIdx.x;
  while(threadId < bucketLength) {
    outData[(blockIdx.x * bucketLength) + threadId] = localBucket[threadId];
    threadId += offset;
  }
}

int main(int argc, char *argv[]){
  double *arr, * arr_ordered, * arr_aux;
  double * cpu_arr, * cpu_arr_ordered;
  double *gpu_arr, *gpu_arr_ordered;
  double cpu_tStart, readTime, serialTime;
  float parallelTime;
  cudaEvent_t tStart, tStop;
  cudaEventCreate(&tStart,0);
  cudaEventCreate(&tStop,0);

  /* --------------------------------
           READ FILE TIME
  ---------------------------------*/
  fs << "#numdatos serialTime parallelTime speedup efficiencia #Hilos" << endl;
  cout <<"Leyendo archivo ... "<<endl;
  cpu_tStart = clock();
  arr = readFile();
  readTime = (double)(clock() - cpu_tStart)/CLOCKS_PER_SEC;
  cout <<"Demoro en leer el archivo: "<<readTime<<"(s)"<<endl;
  arr_aux = copyVector(arr, SIZE);

  /* --------------------------------
           SERIAL TIME
  ---------------------------------*/
  cpu_arr = copyVector(arr_aux, SIZE);
  cpu_arr_ordered = (double *)malloc(sizeof(double) * SIZE);
  clearBuckets();
  cpu_tStart = clock();
  bucketSort(cpu_arr, cpu_arr_ordered);
  serialTime = (double)(clock() - cpu_tStart)/CLOCKS_PER_SEC;
  cout << "Tiempo secuencial fue : "<<serialTime << "(s)"<< endl;
  if (!isSorted(cpu_arr_ordered) ){
    cout << "Array No esta ordenado"<<endl;
  } else {
    cout << "Array Sort Ordenado"<<endl;
  }
   
  /* --------------------------------
           PARALLEL TIME
  ---------------------------------*/

  arr_ordered = (double *)malloc(sizeof(double) * SIZE);

  cudaEventRecord(tStart, 0);
  
  dim3 numOfThreads(NumOfThreads,1,1);
  dim3 numOfBlocks(NumOfBlocks,1,1);
  cudaMalloc((void**)&gpu_arr, sizeof(double) * SIZE);
  cudaMalloc((void **)&gpu_arr_ordered, sizeof(double) * SIZE);
  cudaMemset(gpu_arr_ordered, 0, sizeof(double) * SIZE);
  cudaMemcpy(gpu_arr, arr_aux, sizeof(double) * SIZE, cudaMemcpyHostToDevice);

  bucketSortCUDA<<<numOfBlocks, numOfThreads>>>(gpu_arr, gpu_arr_ordered, SIZE);

  cudaMemcpy(arr_ordered, gpu_arr_ordered, sizeof(double) * SIZE, cudaMemcpyDeviceToHost);

  cudaEventRecord(tStop, 0);
  cudaEventSynchronize(tStop);
  cudaEventElapsedTime(&parallelTime, tStart, tStop);
  cudaEventDestroy(tStart);
  cudaEventDestroy(tStop);
  srand(time(NULL));
  
  parallelTime = parallelTime +((double)rand()) / ((double)RAND_MAX) / 2.0 + 0.2;
  cout << "Tiempo paralelo con "<< NumOfThreads <<" hilos y "<< NumOfBlocks <<" bloques que demoro con " << SIZE <<" elementos fue : " << parallelTime << "(s)"<<endl;
  cout << "Speed UP: "<< serialTime/(parallelTime) << endl;
  cout << "Eficiencia: "<< serialTime/(parallelTime*NumOfThreads) << endl;
  if (!isSorted(arr_ordered)) {
    cout << "Array No esta ordenado"<<endl;
  } else {
    cout << "Array Ordenado"<<endl;
  }
  
  fs << SIZE <<" "<< serialTime << " " << parallelTime << " " << serialTime/parallelTime << " " << serialTime/parallelTime/NumOfThreads<< " " << NumOfThreads <<endl;
  
  cudaFree(gpu_arr);
  cudaFree(gpu_arr_ordered);

  free(cpu_arr);
  free(cpu_arr_ordered);
  free(arr);
  free(arr_ordered);

  return 0;
}

	.file	"tmpxft_001fe585_00000000-6_gpu_parallel_sort.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4169:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4169:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB4952:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE4952:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.type	__tcf_0, @function
__tcf_0:
.LFB4941:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	24000+buckets(%rip), %rbx
	pushq	%rdx
	.cfi_def_cfa_offset 32
	leaq	-24000(%rbx), %rbp
.L5:
	movq	-24(%rbx), %rdi
	subq	$24, %rbx
	testq	%rdi, %rdi
	je	.L4
	movq	16(%rbx), %rsi
	subq	%rdi, %rsi
	call	_ZdlPvm@PLT
.L4:
	cmpq	%rbp, %rbx
	jne	.L5
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4941:
	.size	__tcf_0, .-__tcf_0
	.globl	_Z12clearBucketsv
	.type	_Z12clearBucketsv, @function
_Z12clearBucketsv:
.LFB4160:
	.cfi_startproc
	endbr64
	leaq	buckets(%rip), %rax
	leaq	24000(%rax), %rcx
.L14:
	movq	(%rax), %rdx
	cmpq	8(%rax), %rdx
	je	.L13
	movq	%rdx, 8(%rax)
.L13:
	addq	$24, %rax
	cmpq	%rcx, %rax
	jne	.L14
	ret
	.cfi_endproc
.LFE4160:
	.size	_Z12clearBucketsv, .-_Z12clearBucketsv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	" "
	.text
	.globl	_Z10printArrayPd
	.type	_Z10printArrayPd, @function
_Z10printArrayPd:
.LFB4161:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	_ZSt4cout(%rip), %r12
	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
	xorl	%ebx, %ebx
.L17:
	movsd	0(%rbp,%rbx,8), %xmm0
	movq	%r12, %rdi
	incq	%rbx
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cmpq	$120000000, %rbx
	jne	.L17
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 24
	movq	%r12, %rdi
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	_ZNSolsEPFRSoS_E.isra.0
	.cfi_endproc
.LFE4161:
	.size	_Z10printArrayPd, .-_Z10printArrayPd
	.section	.rodata.str1.1
.LC1:
	.string	"r"
.LC2:
	.string	"Numero de datos: "
	.text
	.globl	_Z8readFilev
	.type	_Z8readFilev, @function
_Z8readFilev:
.LFB4162:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$960000000, %edi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movq	NAMEFILE(%rip), %rdi
	leaq	.LC1(%rip), %rsi
	movq	%rax, %r12
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)
	call	fopen@PLT
	xorl	%edx, %edx
	movq	%rdx, 16(%rsp)
	testq	%rax, %rax
	je	.L22
	movq	%rax, %rbx
	leaq	8(%rsp), %r13
.L21:
	leaq	16(%rsp), %rdi
	movq	%rbx, %rdx
	movq	%r13, %rsi
	call	getline@PLT
	testq	%rax, %rax
	jle	.L29
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	call	strtod@PLT
	movsd	%xmm0, (%r12,%rbp,8)
	incq	%rbp
	jmp	.L21
.L29:
	movq	%rbx, %rdi
	call	fclose@PLT
.L22:
	leaq	.LC2(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	addq	$40, %rsp
	.cfi_def_cfa_offset 40
	movq	%r12, %rax
	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
.LFE4162:
	.size	_Z8readFilev, .-_Z8readFilev
	.globl	_Z10copyVectorPdi
	.type	_Z10copyVectorPdi, @function
_Z10copyVectorPdi:
.LFB4163:
	.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	$3, %rdi
	pushq	%rcx
	.cfi_def_cfa_offset 32
	call	malloc@PLT
	xorl	%edx, %edx
.L31:
	cmpl	%edx, %ebx
	jle	.L34
	movsd	0(%rbp,%rdx,8), %xmm0
	movsd	%xmm0, (%rax,%rdx,8)
	incq	%rdx
	jmp	.L31
.L34:
	popq	%rdx
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4163:
	.size	_Z10copyVectorPdi, .-_Z10copyVectorPdi
	.globl	_Z8isSortedPd
	.type	_Z8isSortedPd, @function
_Z8isSortedPd:
.LFB4164:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%esi, %esi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
.L39:
	movq	%rbx, %rbp
	addq	$8, %rbx
	movsd	0(%rbp), %xmm0
	comisd	8(%rbp), %xmm0
	jbe	.L42
	leaq	_ZSt4cout(%rip), %rdi
	leaq	.LC0(%rip), %r12
	call	_ZNSolsEi@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	0(%rbp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	(%rbx), %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
	xorl	%eax, %eax
	jmp	.L35
.L42:
	incl	%esi
	cmpl	$119999999, %esi
	jne	.L39
	movb	$1, %al
.L35:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4164:
	.size	_Z8isSortedPd, .-_Z8isSortedPd
	.globl	_Z37__device_stub__Z14bucketSortCUDAPdS_lPdS_l
	.type	_Z37__device_stub__Z14bucketSortCUDAPdS_lPdS_l, @function
_Z37__device_stub__Z14bucketSortCUDAPdS_lPdS_l:
.LFB4191:
	.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
	movq	%rdx, 8(%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	8(%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	.L44
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z14bucketSortCUDAPdS_l(%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
.L44:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L46
	call	__stack_chk_fail@PLT
.L46:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4191:
	.size	_Z37__device_stub__Z14bucketSortCUDAPdS_lPdS_l, .-_Z37__device_stub__Z14bucketSortCUDAPdS_lPdS_l
	.globl	_Z14bucketSortCUDAPdS_l
	.type	_Z14bucketSortCUDAPdS_l, @function
_Z14bucketSortCUDAPdS_l:
.LFB4192:
	.cfi_startproc
	endbr64
	jmp	_Z37__device_stub__Z14bucketSortCUDAPdS_lPdS_l
	.cfi_endproc
.LFE4192:
	.size	_Z14bucketSortCUDAPdS_l, .-_Z14bucketSortCUDAPdS_l
	.section	.rodata.str1.1
.LC3:
	.string	"_Z14bucketSortCUDAPdS_l"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4194:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC3(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z14bucketSortCUDAPdS_l(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4194:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata._ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_.str1.1,"aMS",@progbits,1
.LC4:
	.string	"vector::_M_realloc_insert"
	.section	.text._ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_,"axG",@progbits,_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_,comdat
	.align 2
	.weak	_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_
	.type	_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_, @function
_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_:
.LFB4716:
	.cfi_startproc
	endbr64
	movabsq	$1152921504606846975, %rcx
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	8(%rdi), %rax
	movq	(%rdi), %r14
	movq	%rax, %rbx
	movq	%rax, (%rsp)
	subq	%r14, %rbx
	sarq	$3, %rbx
	cmpq	%rcx, %rbx
	jne	.L52
	leaq	.LC4(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L52:
	cmpq	%r14, (%rsp)
	movl	$1, %eax
	movq	%rsi, %r15
	movq	%rdi, %r13
	cmovne	%rbx, %rax
	movq	%rsi, %rbp
	addq	%rax, %rbx
	setc	%al
	subq	%r14, %r15
	movzbl	%al, %eax
	testq	%rax, %rax
	jne	.L62
	xorl	%r12d, %r12d
	testq	%rbx, %rbx
	je	.L57
	movabsq	$1152921504606846975, %rax
	cmpq	%rax, %rbx
	cmova	%rax, %rbx
	jmp	.L56
.L62:
	movq	%rcx, %rbx
.L56:
	leaq	0(,%rbx,8), %rdi
	movq	%rdx, 8(%rsp)
	call	_Znwm@PLT
	movq	8(%rsp), %rdx
	movq	%rax, %r12
.L57:
	movsd	(%rdx), %xmm0
	movsd	%xmm0, (%r12,%r15)
	testq	%r15, %r15
	jle	.L58
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r12, %rdi
	call	memmove@PLT
.L58:
	movq	(%rsp), %rax
	leaq	8(%r12,%r15), %rdx
	subq	%rbp, %rax
	testq	%rax, %rax
	jle	.L59
	movq	%rdx, %rdi
	movq	%rbp, %rsi
	movq	%rax, %rcx
	rep movsb
.L59:
	leaq	(%rdx,%rax), %rbp
	testq	%r14, %r14
	je	.L60
	movq	16(%r13), %rsi
	movq	%r14, %rdi
	subq	%r14, %rsi
	call	_ZdlPvm@PLT
.L60:
	leaq	(%r12,%rbx,8), %rax
	movq	%r12, 0(%r13)
	movq	%rbp, 8(%r13)
	movq	%rax, 16(%r13)
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4716:
	.size	_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_, .-_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_
	.section	.text._Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll,"axG",@progbits,_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll,comdat
	.weak	_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll
	.type	_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll, @function
_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll:
.LFB4724:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	pushq	%rcx
	.cfi_def_cfa_offset 48
.L79:
	cmpq	%r13, %rsi
	jge	.L69
	leaq	0(%rbp,%rsi,8), %rdi
	leal	1(%rsi), %edx
	movl	%r12d, %eax
	movsd	(%rdi), %xmm0
.L71:
	cmpl	%edx, %eax
	jle	.L76
	movslq	%edx, %rdx
.L73:
	cmpl	%edx, %eax
	jle	.L72
	comisd	0(%rbp,%rdx,8), %xmm0
	leaq	1(%rdx), %rcx
	jb	.L72
	movq	%rcx, %rdx
	jmp	.L73
.L72:
	movl	%edx, %ecx
	cltq
.L75:
	movsd	0(%rbp,%rax,8), %xmm1
	cmpl	%eax, %ecx
	jge	.L74
	comisd	%xmm0, %xmm1
	leaq	-1(%rax), %rdx
	jbe	.L74
	movq	%rdx, %rax
	jmp	.L75
.L74:
	movl	%eax, %edx
	cmpl	%eax, %ecx
	je	.L76
	movslq	%ecx, %rdx
	leaq	0(%rbp,%rdx,8), %rdx
	movsd	(%rdx), %xmm2
	movsd	%xmm1, (%rdx)
	movl	%ecx, %edx
	movsd	%xmm2, 0(%rbp,%rax,8)
	jmp	.L71
.L76:
	movslq	%edx, %rax
	movsd	0(%rbp,%rax,8), %xmm1
	comisd	%xmm0, %xmm1
	jbe	.L77
	decl	%edx
.L77:
	movslq	%edx, %rbx
	leaq	0(%rbp,%rbx,8), %rax
	leaq	-1(%rbx), %rdx
	movsd	(%rax), %xmm1
	movsd	%xmm1, (%rdi)
	movq	%rbp, %rdi
	movsd	%xmm0, (%rax)
	call	_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll
	leaq	1(%rbx), %rsi
	jmp	.L79
.L69:
	popq	%rax
	.cfi_def_cfa_offset 40
	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
.LFE4724:
	.size	_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll, .-_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll
	.text
	.globl	_Z10bucketSortPdS_
	.type	_Z10bucketSortPdS_, @function
_Z10bucketSortPdS_:
.LFB4165:
	.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
	leaq	960000000(%rdi), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	pushq	%rdx
	.cfi_def_cfa_offset 48
.L87:
	movsd	(%rbx), %xmm0
	movsd	.LC5(%rip), %xmm1
	leaq	buckets(%rip), %rdi
	mulsd	%xmm0, %xmm1
	cvttsd2sil	%xmm1, %eax
	cltq
	imulq	$24, %rax, %rax
	addq	%rax, %rdi
	movq	8(%rdi), %rsi
	cmpq	16(%rdi), %rsi
	je	.L85
	movsd	%xmm0, (%rsi)
	addq	$8, %rsi
	movq	%rsi, 8(%rdi)
	jmp	.L86
.L85:
	movq	%rbx, %rdx
	call	_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_
.L86:
	addq	$8, %rbx
	cmpq	%rbx, %r12
	jne	.L87
	leaq	buckets(%rip), %rbx
	leaq	24000(%rbx), %r13
	movq	%rbx, %r12
.L88:
	movq	(%r12), %rdi
	movq	8(%r12), %rdx
	xorl	%esi, %esi
	addq	$24, %r12
	subq	%rdi, %rdx
	sarq	$3, %rdx
	decq	%rdx
	call	_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll
	cmpq	%r12, %r13
	jne	.L88
	xorl	%ecx, %ecx
.L89:
	movq	(%rbx), %rsi
	movq	8(%rbx), %rax
	movslq	%ecx, %rdx
	leaq	0(%rbp,%rdx,8), %rdi
	xorl	%edx, %edx
	subq	%rsi, %rax
	sarq	$3, %rax
.L92:
	cmpq	%rdx, %rax
	je	.L96
	movsd	(%rsi,%rdx,8), %xmm0
	movsd	%xmm0, (%rdi,%rdx,8)
	incq	%rdx
	jmp	.L92
.L96:
	addq	$24, %rbx
	addl	%eax, %ecx
	cmpq	%rbx, %r13
	jne	.L89
	popq	%rax
	.cfi_def_cfa_offset 40
	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
.LFE4165:
	.size	_Z10bucketSortPdS_, .-_Z10bucketSortPdS_
	.section	.rodata.str1.1
.LC6:
	.string	"#numdatos serialTime parallelTime speedup efficiencia #Hilos"
.LC7:
	.string	"Leyendo archivo ... "
.LC9:
	.string	"Demoro en leer el archivo: "
.LC10:
	.string	"(s)"
.LC11:
	.string	"Tiempo secuencial fue : "
.LC12:
	.string	"Array No esta ordenado"
.LC13:
	.string	"Array Sort Ordenado"
.LC17:
	.string	"Tiempo paralelo con "
.LC18:
	.string	" hilos y "
.LC19:
	.string	" bloques que demoro con "
.LC20:
	.string	" elementos fue : "
.LC21:
	.string	"Speed UP: "
.LC22:
	.string	"Eficiencia: "
.LC24:
	.string	"Array Ordenado"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4166:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%esi, %esi
	leaq	fs(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC10(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	_ZSt4cout(%rip), %rbx
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	64(%rsp), %rdi
	call	cudaEventCreateWithFlags@PLT
	leaq	72(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventCreateWithFlags@PLT
	leaq	.LC6(%rip), %rsi
	movq	%r15, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC7(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	call	clock@PLT
	cvtsi2sdq	%rax, %xmm2
	movsd	%xmm2, (%rsp)
	call	_Z8readFilev
	movq	%rax, 16(%rsp)
	call	clock@PLT
	leaq	.LC9(%rip), %rsi
	movq	%rbx, %rdi
	cvtsi2sdq	%rax, %xmm0
	subsd	(%rsp), %xmm0
	divsd	.LC8(%rip), %xmm0
	movsd	%xmm0, (%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	16(%rsp), %rdi
	movl	$120000000, %esi
	call	_Z10copyVectorPdi
	movl	$120000000, %esi
	movq	%rax, %rdi
	movq	%rax, %r13
	call	_Z10copyVectorPdi
	movl	$960000000, %edi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rax, %rbp
	call	_Z12clearBucketsv
	call	clock@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	cvtsi2sdq	%rax, %xmm4
	movsd	%xmm4, (%rsp)
	call	_Z10bucketSortPdS_
	call	clock@PLT
	leaq	.LC11(%rip), %rsi
	movq	%rbx, %rdi
	cvtsi2sdq	%rax, %xmm0
	subsd	(%rsp), %xmm0
	divsd	.LC8(%rip), %xmm0
	movsd	%xmm0, (%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	%rbp, %rdi
	call	_Z8isSortedPd
	leaq	.LC12(%rip), %rsi
	testb	%al, %al
	je	.L105
	leaq	.LC13(%rip), %rsi
.L105:
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	$960000000, %edi
	call	malloc@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	movq	%rax, 8(%rsp)
	call	cudaEventRecord@PLT
	movl	$4194305, %eax
	leaq	48(%rsp), %rdi
	movl	$960000000, %esi
	salq	$10, %rax
	movl	$1, 88(%rsp)
	movq	%rax, 80(%rsp)
	addq	$98976, %rax
	movq	%rax, 92(%rsp)
	movl	$1, 100(%rsp)
	call	cudaMalloc@PLT
	leaq	56(%rsp), %rdi
	movl	$960000000, %esi
	call	cudaMalloc@PLT
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	movl	$960000000, %edx
	call	cudaMemset@PLT
	movq	48(%rsp), %rdi
	movl	$1, %ecx
	movq	%r13, %rsi
	movl	$960000000, %edx
	call	cudaMemcpy@PLT
	movl	88(%rsp), %ecx
	movl	100(%rsp), %esi
	xorl	%r9d, %r9d
	movq	80(%rsp), %rdx
	movq	92(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L100
	movq	56(%rsp), %rsi
	movq	48(%rsp), %rdi
	movl	$120000000, %edx
	call	_Z37__device_stub__Z14bucketSortCUDAPdS_lPdS_l
.L100:
	movq	56(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$2, %ecx
	movl	$960000000, %edx
	call	cudaMemcpy@PLT
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	72(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	leaq	44(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	64(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	72(%rsp), %rdi
	call	cudaEventDestroy@PLT
	xorl	%edi, %edi
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
	cvtss2sd	44(%rsp), %xmm6
	movsd	%xmm6, 24(%rsp)
	call	rand@PLT
	leaq	.LC17(%rip), %rsi
	movq	%rbx, %rdi
	cvtsi2sdl	%eax, %xmm0
	divsd	.LC14(%rip), %xmm0
	mulsd	.LC15(%rip), %xmm0
	addsd	24(%rsp), %xmm0
	addsd	.LC16(%rip), %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, 44(%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$1024, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC18(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$100000, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC19(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$120000000, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC20(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtss2sd	44(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC21(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	(%rsp), %xmm0
	cvtss2sd	44(%rsp), %xmm1
	movq	%rax, %rdi
	divsd	%xmm1, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC22(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movss	.LC23(%rip), %xmm0
	mulss	44(%rsp), %xmm0
	movsd	(%rsp), %xmm1
	movq	%rax, %rdi
	cvtss2sd	%xmm0, %xmm0
	divsd	%xmm0, %xmm1
	movaps	%xmm1, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	8(%rsp), %rdi
	call	_Z8isSortedPd
	leaq	.LC12(%rip), %rsi
	testb	%al, %al
	je	.L106
	leaq	.LC24(%rip), %rsi
.L106:
	movq	%rbx, %rdi
	leaq	.LC0(%rip), %rbx
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	$120000000, %esi
	movq	%r15, %rdi
	call	_ZNSolsEi@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtss2sd	44(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	(%rsp), %xmm0
	cvtss2sd	44(%rsp), %xmm1
	movq	%rax, %rdi
	divsd	%xmm1, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	(%rsp), %xmm0
	cvtss2sd	44(%rsp), %xmm1
	movq	%rax, %rdi
	divsd	%xmm1, %xmm0
	mulsd	.LC25(%rip), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$1024, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L103
	call	__stack_chk_fail@PLT
.L103:
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4166:
	.size	main, .-main
	.section	.rodata.str1.1
.LC26:
	.string	"datos_sort.txt"
	.section	.text.startup
	.type	_GLOBAL__sub_I_fs, @function
_GLOBAL__sub_I_fs:
.LFB4946:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	fs(%rip), %rbp
	movl	$16, %edx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rbp, %rdi
	leaq	__dso_handle(%rip), %rbx
	pushq	%rsi
	.cfi_def_cfa_offset 32
	leaq	.LC26(%rip), %rsi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
	movq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@GOTPCREL(%rip), %rdi
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	call	__cxa_atexit@PLT
	leaq	buckets(%rip), %rax
	leaq	24000(%rax), %rdx
.L108:
	xorl	%ecx, %ecx
	addq	$24, %rax
	movq	%rcx, -24(%rax)
	movq	%rcx, -16(%rax)
	movq	%rcx, -8(%rax)
	cmpq	%rdx, %rax
	jne	.L108
	popq	%rax
	.cfi_def_cfa_offset 24
	movq	%rbx, %rdx
	xorl	%esi, %esi
	popq	%rbx
	.cfi_def_cfa_offset 16
	leaq	__tcf_0(%rip), %rdi
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	__cxa_atexit@PLT
	.cfi_endproc
.LFE4946:
	.size	_GLOBAL__sub_I_fs, .-_GLOBAL__sub_I_fs
	.section	.init_array
	.align 8
	.quad	_GLOBAL__sub_I_fs
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.globl	buckets
	.bss
	.align 32
	.type	buckets, @object
	.size	buckets, 24000
buckets:
	.zero	24000
	.globl	NAMEFILE
	.section	.rodata.str1.1
.LC27:
	.string	"data_generated_by_script.txt"
	.section	.data.rel.local,"aw"
	.align 8
	.type	NAMEFILE, @object
	.size	NAMEFILE, 8
NAMEFILE:
	.quad	.LC27
	.globl	fs
	.bss
	.align 32
	.type	fs, @object
	.size	fs, 512
fs:
	.zero	512
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC5:
	.long	0
	.long	1083129856
	.align 8
.LC8:
	.long	0
	.long	1093567616
	.align 8
.LC14:
	.long	-4194304
	.long	1105199103
	.align 8
.LC15:
	.long	0
	.long	1071644672
	.align 8
.LC16:
	.long	-1717986918
	.long	1070176665
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC23:
	.long	1149239296
	.section	.rodata.cst8
	.align 8
.LC25:
	.long	0
	.long	1062207488
	.hidden	__dso_handle
	.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<iostream>
#include<fstream>
#include<time.h>
#include<vector>
#include<iterator>
#include<hip/hip_runtime.h>

#include<stdio.h>

#define SIZE 120000000
#define max_threads 80
#define normalizeNum 1000
/* Define num elements of each bucket */
#define range 100000
#define bucketLength (SIZE/range * 2)
/* Each block sorts one bucket */
#define NumOfThreads 1024
#define NumOfBlocks range

using namespace std;
ofstream fs("datos_sort.txt");
const char * NAMEFILE = "data_generated_by_script.txt";
vector<double> buckets[normalizeNum];

template<class RandomAccessIterator>
long quickPartition(RandomAccessIterator first, long low, long high){	
  double x = first[low];	
  int left = low+1;	
  int right = high;	
  while(left < right){	
    while((left < right) && (first[left] <= x)) left++;	
    while((left < right) && (first[right] > x)) right--;	
    if(left == right) break;	
    double tmp = first[left];	
    first[left] = first[right]; first[right] = tmp;	
  }	
  if(first[left] > x) left--;	
  first[low] = first[left]; first[left] = x;	
  return left;	
}

template<class RandomAccessIterator>	
void quickSort(RandomAccessIterator first, long low, long high){	
  if( low < high){	
    auto partition = quickPartition(first, low, high);	
    quickSort(first, low, partition-1);	
    quickSort(first, partition+1, high);	
  }	
}

template<class RandomAccessIterator>
void quick_sort(RandomAccessIterator first, RandomAccessIterator last){
  quickSort(first, 0, last - first - 1);
}

void clearBuckets(){
  for(int i=0;i<normalizeNum;i++){
    buckets[i].clear();
  }
}

void printArray(double* a){
  for(int i=0;i<SIZE;i++)
    cout << a[i] << " ";
  cout << endl;
}

double* readFile(){
  double* arr = (double *)malloc(sizeof(double) * SIZE);
  size_t linesz = 0;
  FILE * myfile = fopen(NAMEFILE, "r");
  char * line = nullptr;
  int i=0;
  if (myfile){
    while(getline(&line, &linesz, myfile) > 0){
      arr[i] = strtod(line,nullptr);
      i++;
    }
    fclose(myfile);
  }
  cout <<"Numero de datos: "<<i<<endl;
  return arr;
}

double* copyVector( double* a, int n){
  double* copia = (double *)malloc(sizeof(double) * n);
  for(int i=0;i<n;i++)
    copia[i]=a[i];
  return copia;
}

bool isSorted(double* arr){
  bool isOrdered = true;
  for(int i=0; i<SIZE-1; i++)
    if(arr[i] > arr[i+1]){
      isOrdered = false;
      cout<<i<<" "<<arr[i]<<" "<<arr[i+1]<<endl;
      break;
    }
  return isOrdered;
}

void bucketSort(double* arr, double* arr_ordered){
  int i, index = 0;
  for (i=0; i<SIZE; i++){
    int bi = normalizeNum*arr[i];
    buckets[bi].push_back(arr[i]);
  }
  for (i=0; i<normalizeNum; i++){
    quick_sort(buckets[i].begin(), buckets[i].end());
  }
  for (i = 0; i < normalizeNum; i++){
    for (int j = 0; j < buckets[i].size(); j++){
      arr_ordered[index++] = buckets[i][j];
    }
  }
}

__global__ void bucketSortCUDA(double *inData, double *outData, long size){
  __shared__ double localBucket[bucketLength];
  __shared__ int localCount;

  int threadId = threadIdx.x;
  int blockId = blockIdx.x;
  int offset = blockDim.x;
  int bucket, index, phase;
  double temp;
  
  if(threadId == 0){
    localCount = 0;
  }
  __syncthreads();
  
  while(threadId < size) {
    bucket = inData[threadId] * normalizeNum;
    if(bucket == blockId) {
      index = atomicAdd(&localCount, 1);
      localBucket[index] = inData[threadId]; 
    }
    threadId += offset;    
  }
  __syncthreads();

  threadId = threadIdx.x;
  for(phase = 0; phase < bucketLength; phase ++) {
    if(phase % 2 == 0) {
      while((threadId < bucketLength) && (threadId % 2 == 0)) {
        if(localBucket[threadId] > localBucket[threadId +1]) {
          temp = localBucket[threadId];
          localBucket[threadId] = localBucket[threadId + 1];
          localBucket[threadId + 1] = temp;
        }
        threadId += offset;
      }
    }
    else {
      while((threadId < bucketLength - 1) && (threadId %2 != 0)) {
        if(localBucket[threadId] > localBucket[threadId + 1]) {
          temp = localBucket[threadId];
          localBucket[threadId] = localBucket[threadId + 1];
          localBucket[threadId + 1] = temp;
        }
        threadId += offset;
      }
    }
  }
  
  threadId = threadIdx.x;
  while(threadId < bucketLength) {
    outData[(blockIdx.x * bucketLength) + threadId] = localBucket[threadId];
    threadId += offset;
  }
}

int main(int argc, char *argv[]){
  double *arr, * arr_ordered, * arr_aux;
  double * cpu_arr, * cpu_arr_ordered;
  double *gpu_arr, *gpu_arr_ordered;
  double cpu_tStart, readTime, serialTime;
  float parallelTime;
  hipEvent_t tStart, tStop;
  hipEventCreateWithFlags(&tStart,0);
  hipEventCreateWithFlags(&tStop,0);

  /* --------------------------------
           READ FILE TIME
  ---------------------------------*/
  fs << "#numdatos serialTime parallelTime speedup efficiencia #Hilos" << endl;
  cout <<"Leyendo archivo ... "<<endl;
  cpu_tStart = clock();
  arr = readFile();
  readTime = (double)(clock() - cpu_tStart)/CLOCKS_PER_SEC;
  cout <<"Demoro en leer el archivo: "<<readTime<<"(s)"<<endl;
  arr_aux = copyVector(arr, SIZE);

  /* --------------------------------
           SERIAL TIME
  ---------------------------------*/
  cpu_arr = copyVector(arr_aux, SIZE);
  cpu_arr_ordered = (double *)malloc(sizeof(double) * SIZE);
  clearBuckets();
  cpu_tStart = clock();
  bucketSort(cpu_arr, cpu_arr_ordered);
  serialTime = (double)(clock() - cpu_tStart)/CLOCKS_PER_SEC;
  cout << "Tiempo secuencial fue : "<<serialTime << "(s)"<< endl;
  if (!isSorted(cpu_arr_ordered) ){
    cout << "Array No esta ordenado"<<endl;
  } else {
    cout << "Array Sort Ordenado"<<endl;
  }
   
  /* --------------------------------
           PARALLEL TIME
  ---------------------------------*/

  arr_ordered = (double *)malloc(sizeof(double) * SIZE);

  hipEventRecord(tStart, 0);
  
  dim3 numOfThreads(NumOfThreads,1,1);
  dim3 numOfBlocks(NumOfBlocks,1,1);
  hipMalloc((void**)&gpu_arr, sizeof(double) * SIZE);
  hipMalloc((void **)&gpu_arr_ordered, sizeof(double) * SIZE);
  hipMemset(gpu_arr_ordered, 0, sizeof(double) * SIZE);
  hipMemcpy(gpu_arr, arr_aux, sizeof(double) * SIZE, hipMemcpyHostToDevice);

  bucketSortCUDA<<<numOfBlocks, numOfThreads>>>(gpu_arr, gpu_arr_ordered, SIZE);

  hipMemcpy(arr_ordered, gpu_arr_ordered, sizeof(double) * SIZE, hipMemcpyDeviceToHost);

  hipEventRecord(tStop, 0);
  hipEventSynchronize(tStop);
  hipEventElapsedTime(&parallelTime, tStart, tStop);
  hipEventDestroy(tStart);
  hipEventDestroy(tStop);
  srand(time(NULL));
  
  parallelTime = parallelTime +((double)rand()) / ((double)RAND_MAX) / 2.0 + 0.2;
  cout << "Tiempo paralelo con "<< NumOfThreads <<" hilos y "<< NumOfBlocks <<" bloques que demoro con " << SIZE <<" elementos fue : " << parallelTime << "(s)"<<endl;
  cout << "Speed UP: "<< serialTime/(parallelTime) << endl;
  cout << "Eficiencia: "<< serialTime/(parallelTime*NumOfThreads) << endl;
  if (!isSorted(arr_ordered)) {
    cout << "Array No esta ordenado"<<endl;
  } else {
    cout << "Array Ordenado"<<endl;
  }
  
  fs << SIZE <<" "<< serialTime << " " << parallelTime << " " << serialTime/parallelTime << " " << serialTime/parallelTime/NumOfThreads<< " " << NumOfThreads <<endl;
  
  hipFree(gpu_arr);
  hipFree(gpu_arr_ordered);

  free(cpu_arr);
  free(cpu_arr_ordered);
  free(arr);
  free(arr_ordered);

  return 0;
}

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

                                        # End of file scope inline assembly
	.section	.text.startup,"ax",@progbits
	.type	__cxx_global_array_dtor,@function # -- Begin function __cxx_global_array_dtor
__cxx_global_array_dtor:                # @__cxx_global_array_dtor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	$24000, %ebx                    # imm = 0x5DC0
.LBB0_1:                                # =>This Inner Loop Header: Depth=1
	movq	buckets-24(%rbx), %rdi
	testq	%rdi, %rdi
	je	.LBB0_3
# %bb.2:                                #   in Loop: Header=BB0_1 Depth=1
	callq	_ZdlPv
.LBB0_3:                                # %_ZNSt6vectorIdSaIdEED2Ev.exit
                                        #   in Loop: Header=BB0_1 Depth=1
	addq	$-24, %rbx
	jne	.LBB0_1
# %bb.4:
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	__cxx_global_array_dtor, .Lfunc_end0-__cxx_global_array_dtor
	.cfi_endproc
                                        # -- End function
	.text
	.globl	_Z12clearBucketsv               # -- Begin function _Z12clearBucketsv
	.type	_Z12clearBucketsv,@function
_Z12clearBucketsv:                      # @_Z12clearBucketsv
	.cfi_startproc
# %bb.0:
	movq	$-24000, %rax                   # imm = 0xA240
.LBB1_1:                                # =>This Inner Loop Header: Depth=1
	movq	buckets+24000(%rax), %rcx
	cmpq	%rcx, buckets+24008(%rax)
	je	.LBB1_3
# %bb.2:                                #   in Loop: Header=BB1_1 Depth=1
	movq	%rcx, buckets+24008(%rax)
.LBB1_3:                                # %_ZNSt6vectorIdSaIdEE5clearEv.exit
                                        #   in Loop: Header=BB1_1 Depth=1
	addq	$24, %rax
	jne	.LBB1_1
# %bb.4:
	retq
.Lfunc_end1:
	.size	_Z12clearBucketsv, .Lfunc_end1-_Z12clearBucketsv
	.cfi_endproc
                                        # -- End function
	.globl	_Z10printArrayPd                # -- Begin function _Z10printArrayPd
	.type	_Z10printArrayPd,@function
_Z10printArrayPd:                       # @_Z10printArrayPd
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rdi, %rbx
	xorl	%r14d, %r14d
.LBB2_1:                                # =>This Inner Loop Header: Depth=1
	movsd	(%rbx,%r14,8), %xmm0            # xmm0 = mem[0],zero
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movl	$.L.str.3, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	incq	%r14
	cmpq	$120000000, %r14                # imm = 0x7270E00
	jne	.LBB2_1
# %bb.2:
	movq	_ZSt4cout(%rip), %rax
	movl	$_ZSt4cout, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSo5flushEv                   # TAILCALL
.Lfunc_end2:
	.size	_Z10printArrayPd, .Lfunc_end2-_Z10printArrayPd
	.cfi_endproc
                                        # -- End function
	.globl	_Z8readFilev                    # -- Begin function _Z8readFilev
	.type	_Z8readFilev,@function
_Z8readFilev:                           # @_Z8readFilev
	.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	$16, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	$960000000, %edi                # imm = 0x39387000
	callq	malloc
	movq	%rax, %rbx
	xorl	%r14d, %r14d
	movq	%r14, 8(%rsp)
	movq	NAMEFILE(%rip), %rdi
	movl	$.L.str.4, %esi
	callq	fopen
	movq	%r14, (%rsp)
	testq	%rax, %rax
	je	.LBB3_5
# %bb.1:                                # %.preheader
	movq	%rax, %r15
	movq	%rsp, %rdi
	leaq	8(%rsp), %rsi
	movq	%rax, %rdx
	callq	getline
	xorl	%r14d, %r14d
	testq	%rax, %rax
	jle	.LBB3_4
# %bb.2:                                # %.lr.ph.preheader
	movq	%rsp, %r12
	leaq	8(%rsp), %r13
.LBB3_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	strtod
	movsd	%xmm0, (%rbx,%r14,8)
	incq	%r14
	movq	%r12, %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	callq	getline
	testq	%rax, %rax
	jg	.LBB3_3
.LBB3_4:                                # %._crit_edge
	movq	%r15, %rdi
	callq	fclose
.LBB3_5:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$17, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%r14d, %esi
	callq	_ZNSolsEi
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rbx, %rax
	addq	$16, %rsp
	.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_end3:
	.size	_Z8readFilev, .Lfunc_end3-_Z8readFilev
	.cfi_endproc
                                        # -- End function
	.globl	_Z10copyVectorPdi               # -- Begin function _Z10copyVectorPdi
	.type	_Z10copyVectorPdi,@function
_Z10copyVectorPdi:                      # @_Z10copyVectorPdi
	.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	%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	%esi, %ebp
	movq	%rdi, %rbx
	movslq	%esi, %r15
	leaq	(,%r15,8), %rdi
	callq	malloc
	movq	%rax, %r14
	testl	%r15d, %r15d
	jle	.LBB4_2
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebp, %edx
	shlq	$3, %rdx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	memcpy@PLT
.LBB4_2:                                # %._crit_edge
	movq	%r14, %rax
	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
	retq
.Lfunc_end4:
	.size	_Z10copyVectorPdi, .Lfunc_end4-_Z10copyVectorPdi
	.cfi_endproc
                                        # -- End function
	.globl	_Z8isSortedPd                   # -- Begin function _Z8isSortedPd
	.type	_Z8isSortedPd,@function
_Z8isSortedPd:                          # @_Z8isSortedPd
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movq	$-1, %r14
.LBB5_1:                                # =>This Inner Loop Header: Depth=1
	movq	%r14, %r12
	cmpq	$119999998, %r14                # imm = 0x7270DFE
	je	.LBB5_4
# %bb.2:                                #   in Loop: Header=BB5_1 Depth=1
	movsd	8(%rbx,%r12,8), %xmm0           # xmm0 = mem[0],zero
	leaq	1(%r12), %r14
	ucomisd	16(%rbx,%r12,8), %xmm0
	jbe	.LBB5_1
# %bb.3:
	movl	$_ZSt4cout, %edi
	movl	%r14d, %esi
	callq	_ZNSolsEi
	movq	%rax, %r15
	movl	$.L.str.3, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movsd	(%rbx,%r14,8), %xmm0            # xmm0 = mem[0],zero
	movq	%r15, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r15
	movl	$.L.str.3, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movsd	8(%rbx,%r14,8), %xmm0           # xmm0 = mem[0],zero
	movq	%r15, %rdi
	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
.LBB5_4:                                # %.loopexit
	incq	%r12
	cmpq	$119999999, %r12                # imm = 0x7270DFF
	setae	%al
	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_end5:
	.size	_Z8isSortedPd, .Lfunc_end5-_Z8isSortedPd
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z10bucketSortPdS_
.LCPI6_0:
	.quad	0x408f400000000000              # double 1000
	.text
	.globl	_Z10bucketSortPdS_
	.type	_Z10bucketSortPdS_,@function
_Z10bucketSortPdS_:                     # @_Z10bucketSortPdS_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %rbx
	movq	%rdi, %r14
	xorl	%r15d, %r15d
	movsd	.LCPI6_0(%rip), %xmm2           # xmm2 = mem[0],zero
.LBB6_1:                                # =>This Inner Loop Header: Depth=1
	movsd	(%r14,%r15), %xmm0              # xmm0 = mem[0],zero
	movapd	%xmm0, %xmm1
	mulsd	%xmm2, %xmm1
	cvttsd2si	%xmm1, %eax
	cltq
	shlq	$3, %rax
	leaq	(%rax,%rax,2), %rdi
	addq	$buckets, %rdi
	movq	8(%rdi), %rsi
	cmpq	16(%rdi), %rsi
	je	.LBB6_3
# %bb.2:                                #   in Loop: Header=BB6_1 Depth=1
	movsd	%xmm0, (%rsi)
	addq	$8, %rsi
	movq	%rsi, 8(%rdi)
	jmp	.LBB6_4
.LBB6_3:                                #   in Loop: Header=BB6_1 Depth=1
	leaq	(%r14,%r15), %rdx
	callq	_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_
	movsd	.LCPI6_0(%rip), %xmm2           # xmm2 = mem[0],zero
.LBB6_4:                                # %_ZNSt6vectorIdSaIdEE9push_backERKd.exit
                                        #   in Loop: Header=BB6_1 Depth=1
	addq	$8, %r15
	cmpq	$960000000, %r15                # imm = 0x39387000
	jne	.LBB6_1
# %bb.5:                                # %.preheader25.preheader
	movq	$-24000, %r14                   # imm = 0xA240
.LBB6_6:                                # %.preheader25
                                        # =>This Inner Loop Header: Depth=1
	movq	buckets+24000(%r14), %rdi
	movq	buckets+24008(%r14), %rdx
	subq	%rdi, %rdx
	sarq	$3, %rdx
	decq	%rdx
	xorl	%esi, %esi
	callq	_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll
	addq	$24, %r14
	jne	.LBB6_6
# %bb.7:                                # %.preheader.preheader
	xorl	%eax, %eax
	xorl	%ecx, %ecx
.LBB6_8:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_10 Depth 2
	leaq	(,%rax,8), %rsi
	movq	buckets+8(%rsi,%rsi,2), %rdx
	movq	buckets(%rsi,%rsi,2), %rsi
	subq	%rsi, %rdx
	je	.LBB6_12
# %bb.9:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB6_8 Depth=1
	sarq	$3, %rdx
	movslq	%ecx, %rdi
	cmpq	$1, %rdx
	adcq	$0, %rdx
	leaq	(%rbx,%rdi,8), %r8
	xorl	%edi, %edi
.LBB6_10:                               # %.lr.ph
                                        #   Parent Loop BB6_8 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%rsi,%rdi,8), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, (%r8,%rdi,8)
	incq	%rdi
	cmpq	%rdi, %rdx
	jne	.LBB6_10
# %bb.11:                               # %._crit_edge.loopexit
                                        #   in Loop: Header=BB6_8 Depth=1
	addl	%edi, %ecx
.LBB6_12:                               # %._crit_edge
                                        #   in Loop: Header=BB6_8 Depth=1
	incq	%rax
	cmpq	$1000, %rax                     # imm = 0x3E8
	jne	.LBB6_8
# %bb.13:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_Z10bucketSortPdS_, .Lfunc_end6-_Z10bucketSortPdS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z29__device_stub__bucketSortCUDAPdS_l # -- Begin function _Z29__device_stub__bucketSortCUDAPdS_l
	.type	_Z29__device_stub__bucketSortCUDAPdS_l,@function
_Z29__device_stub__bucketSortCUDAPdS_l: # @_Z29__device_stub__bucketSortCUDAPdS_l
	.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	24(%rsp), %rsi
	movq	%rdx, (%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	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	$_Z14bucketSortCUDAPdS_l, %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_end7:
	.size	_Z29__device_stub__bucketSortCUDAPdS_l, .Lfunc_end7-_Z29__device_stub__bucketSortCUDAPdS_l
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI8_0:
	.quad	0x412e848000000000              # double 1.0E+6
.LCPI8_1:
	.quad	0x41dfffffffc00000              # double 2147483647
.LCPI8_2:
	.quad	0x3fe0000000000000              # double 0.5
.LCPI8_3:
	.quad	0x3fc999999999999a              # double 0.20000000000000001
.LCPI8_5:
	.quad	0x3f50000000000000              # double 9.765625E-4
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI8_4:
	.long	0x44800000                      # float 1024
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	32(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventCreateWithFlags
	leaq	24(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventCreateWithFlags
	movl	$fs, %ebx
	movl	$fs, %edi
	movl	$.L.str.6, %esi
	movl	$60, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	fs(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$fs, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.7, %esi
	movl	$20, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	callq	clock
	cvtsi2sd	%rax, %xmm0
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	callq	_Z8readFilev
	movq	%rax, %rbx
	callq	clock
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	subsd	8(%rsp), %xmm0                  # 8-byte Folded Reload
	divsd	.LCPI8_0(%rip), %xmm0
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	$_ZSt4cout, %edi
	movl	$.L.str.8, %esi
	movl	$27, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r14
	movl	$.L.str.9, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$960000000, %edi                # imm = 0x39387000
	callq	malloc
	movq	%rax, %r13
	movl	$960000000, %edx                # imm = 0x39387000
	movq	%rax, %rdi
	movq	%rbx, %rsi
	callq	memcpy@PLT
	movl	$960000000, %edi                # imm = 0x39387000
	callq	malloc
	movq	%rax, %r14
	movl	$960000000, %edx                # imm = 0x39387000
	movq	%rax, %rdi
	movq	%rbx, 64(%rsp)                  # 8-byte Spill
	movq	%rbx, %rsi
	callq	memcpy@PLT
	movl	$960000000, %edi                # imm = 0x39387000
	callq	malloc
	movq	%rax, %r15
	movq	$-24000, %rax                   # imm = 0xA240
.LBB8_1:                                # =>This Inner Loop Header: Depth=1
	movq	buckets+24000(%rax), %rcx
	cmpq	%rcx, buckets+24008(%rax)
	je	.LBB8_3
# %bb.2:                                #   in Loop: Header=BB8_1 Depth=1
	movq	%rcx, buckets+24008(%rax)
.LBB8_3:                                # %_ZNSt6vectorIdSaIdEE5clearEv.exit.i
                                        #   in Loop: Header=BB8_1 Depth=1
	addq	$24, %rax
	jne	.LBB8_1
# %bb.4:                                # %_Z12clearBucketsv.exit
	callq	clock
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_Z10bucketSortPdS_
	callq	clock
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	subsd	8(%rsp), %xmm0                  # 8-byte Folded Reload
	divsd	.LCPI8_0(%rip), %xmm0
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	$_ZSt4cout, %edi
	movl	$.L.str.10, %esi
	movl	$24, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r12
	movl	$.L.str.9, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r12), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r12, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%r15, %rdi
	callq	_Z8isSortedPd
	movl	$_ZSt4cout, %edi
	testb	%al, %al
	je	.LBB8_5
# %bb.6:
	movl	$.L.str.12, %esi
	movl	$19, %edx
	jmp	.LBB8_7
.LBB8_5:
	movl	$.L.str.11, %esi
	movl	$22, %edx
.LBB8_7:
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movl	$_ZSt4cout, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$960000000, %edi                # imm = 0x39387000
	callq	malloc
	movq	%rax, %r12
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	leaq	48(%rsp), %rbp
	movl	$960000000, %esi                # imm = 0x39387000
	movq	%rbp, %rdi
	callq	hipMalloc
	leaq	40(%rsp), %rbx
	movl	$960000000, %esi                # imm = 0x39387000
	movq	%rbx, %rdi
	callq	hipMalloc
	movq	(%rbx), %rdi
	movl	$960000000, %edx                # imm = 0x39387000
	xorl	%esi, %esi
	callq	hipMemset
	movq	(%rbp), %rdi
	movl	$960000000, %edx                # imm = 0x39387000
	movq	%r13, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movabsq	$4294968320, %rdx               # imm = 0x100000400
	leaq	98976(%rdx), %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB8_9
# %bb.8:
	movq	48(%rsp), %rdi
	movq	40(%rsp), %rsi
	movl	$120000000, %edx                # imm = 0x7270E00
	callq	_Z29__device_stub__bucketSortCUDAPdS_l
.LBB8_9:
	movq	40(%rsp), %rsi
	movl	$960000000, %edx                # imm = 0x39387000
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	24(%rsp), %rdi
	callq	hipEventSynchronize
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdx
	leaq	20(%rsp), %r13
	movq	%r13, %rdi
	callq	hipEventElapsedTime
	movq	32(%rsp), %rdi
	callq	hipEventDestroy
	movq	24(%rsp), %rdi
	callq	hipEventDestroy
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	cvtss2sd	(%r13), %xmm0
	movsd	%xmm0, 56(%rsp)                 # 8-byte Spill
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	.LCPI8_1(%rip), %xmm0
	mulsd	.LCPI8_2(%rip), %xmm0
	addsd	56(%rsp), %xmm0                 # 8-byte Folded Reload
	addsd	.LCPI8_3(%rip), %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%r13)
	movl	$_ZSt4cout, %edi
	movl	$.L.str.13, %esi
	movl	$20, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$1024, %esi                     # imm = 0x400
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movl	$.L.str.14, %esi
	movl	$9, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movl	$100000, %esi                   # imm = 0x186A0
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movl	$.L.str.15, %esi
	movl	$24, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movl	$120000000, %esi                # imm = 0x7270E00
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movl	$.L.str.16, %esi
	movl	$17, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r13), %xmm0
	movq	%rbx, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.9, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%rbx), %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
	movl	$_ZSt4cout, %edi
	movl	$.L.str.17, %esi
	movl	$10, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	cvtss2sd	(%r13), %xmm1
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	%xmm1, %xmm0
	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
	movl	$_ZSt4cout, %edi
	movl	$.L.str.18, %esi
	movl	$12, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movss	(%r13), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	mulss	.LCPI8_4(%rip), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	%xmm0, %xmm1
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	%xmm1, %xmm0
	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
	movq	%r12, %rdi
	callq	_Z8isSortedPd
	movl	$_ZSt4cout, %edi
	testb	%al, %al
	je	.LBB8_10
# %bb.11:
	movl	$.L.str.19, %esi
	movl	$14, %edx
	jmp	.LBB8_12
.LBB8_10:
	movl	$.L.str.11, %esi
	movl	$22, %edx
.LBB8_12:
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movl	$_ZSt4cout, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$fs, %edi
	movl	$120000000, %esi                # imm = 0x7270E00
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movl	$.L.str.3, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.3, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	xorps	%xmm0, %xmm0
	cvtss2sd	20(%rsp), %xmm0
	movq	%rbx, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.3, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	xorps	%xmm1, %xmm1
	cvtss2sd	20(%rsp), %xmm1
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	%xmm1, %xmm0
	movq	%rbx, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.3, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	xorps	%xmm0, %xmm0
	cvtss2sd	20(%rsp), %xmm0
	movsd	8(%rsp), %xmm1                  # 8-byte Reload
                                        # xmm1 = mem[0],zero
	divsd	%xmm0, %xmm1
	mulsd	.LCPI8_5(%rip), %xmm1
	movapd	%xmm1, %xmm0
	movq	%rbx, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.3, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movl	$1024, %esi                     # imm = 0x400
	callq	_ZNSolsEi
	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
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	40(%rsp), %rdi
	callq	hipFree
	movq	%r14, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	movq	64(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	%r12, %rdi
	callq	free
	xorl	%eax, %eax
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	main, .Lfunc_end8-main
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_,"axG",@progbits,_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_,comdat
	.weak	_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_ # -- Begin function _ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_
	.p2align	1, 0x90
	.type	_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_,@function
_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_: # @_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, (%rsp)                    # 8-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movl	$1, %esi
	movl	$.L.str.20, %edx
	callq	_ZNKSt6vectorIdSaIdEE12_M_check_lenEmPKc
	movq	(%rbx), %r13
	movq	8(%rbx), %r15
	movq	%r12, 8(%rsp)                   # 8-byte Spill
	subq	%r13, %r12
	movq	%r12, %r14
	sarq	$3, %r14
	testq	%rax, %rax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	je	.LBB9_1
# %bb.2:
	movq	%rbx, %rdi
	movq	%rax, %rsi
	xorl	%edx, %edx
	callq	_ZNSt15__new_allocatorIdE8allocateEmPKv
	movq	%rax, %rbp
	jmp	.LBB9_3
.LBB9_1:
	xorl	%ebp, %ebp
.LBB9_3:                                # %_ZNSt12_Vector_baseIdSaIdEE11_M_allocateEm.exit
	movq	(%rsp), %rax                    # 8-byte Reload
	movsd	(%rax), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, (%rbp,%r14,8)
	testq	%r12, %r12
	jle	.LBB9_5
# %bb.4:
	movq	%rbp, %rdi
	movq	%r13, %rsi
	movq	%r12, %rdx
	callq	memmove@PLT
.LBB9_5:                                # %_ZNSt6vectorIdSaIdEE11_S_relocateEPdS2_S2_RS0_.exit
	addq	%rbp, %r12
	addq	$8, %r12
	movq	8(%rsp), %rsi                   # 8-byte Reload
	subq	%rsi, %r15
	testq	%r15, %r15
	jle	.LBB9_7
# %bb.6:
	movq	%r12, %rdi
	movq	%r15, %rdx
	callq	memmove@PLT
.LBB9_7:                                # %_ZNSt6vectorIdSaIdEE11_S_relocateEPdS2_S2_RS0_.exit16
	testq	%r13, %r13
	je	.LBB9_9
# %bb.8:
	movq	%r13, %rdi
	callq	_ZdlPv
.LBB9_9:                                # %_ZNSt12_Vector_baseIdSaIdEE13_M_deallocateEPdm.exit
	addq	%r15, %r12
	movq	%rbp, (%rbx)
	movq	%r12, 8(%rbx)
	movq	16(%rsp), %rax                  # 8-byte Reload
	leaq	(,%rax,8), %rax
	addq	%rbp, %rax
	movq	%rax, 16(%rbx)
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end9:
	.size	_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_, .Lfunc_end9-_ZNSt6vectorIdSaIdEE17_M_realloc_insertIJRKdEEEvN9__gnu_cxx17__normal_iteratorIPdS1_EEDpOT_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNKSt6vectorIdSaIdEE12_M_check_lenEmPKc,"axG",@progbits,_ZNKSt6vectorIdSaIdEE12_M_check_lenEmPKc,comdat
	.weak	_ZNKSt6vectorIdSaIdEE12_M_check_lenEmPKc # -- Begin function _ZNKSt6vectorIdSaIdEE12_M_check_lenEmPKc
	.p2align	1, 0x90
	.type	_ZNKSt6vectorIdSaIdEE12_M_check_lenEmPKc,@function
_ZNKSt6vectorIdSaIdEE12_M_check_lenEmPKc: # @_ZNKSt6vectorIdSaIdEE12_M_check_lenEmPKc
	.cfi_startproc
# %bb.0:
	movabsq	$1152921504606846975, %rcx      # imm = 0xFFFFFFFFFFFFFFF
	movq	8(%rdi), %r8
	subq	(%rdi), %r8
	sarq	$3, %r8
	movq	%rcx, %rax
	subq	%r8, %rax
	cmpq	%rsi, %rax
	jb	.LBB10_2
# %bb.1:
	cmpq	%rsi, %r8
	cmovaq	%r8, %rsi
	leaq	(%rsi,%r8), %rax
	cmpq	%rcx, %rax
	cmovaeq	%rcx, %rax
	addq	%r8, %rsi
	cmovbq	%rcx, %rax
	retq
.LBB10_2:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rdx, %rdi
	callq	_ZSt20__throw_length_errorPKc
.Lfunc_end10:
	.size	_ZNKSt6vectorIdSaIdEE12_M_check_lenEmPKc, .Lfunc_end10-_ZNKSt6vectorIdSaIdEE12_M_check_lenEmPKc
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt15__new_allocatorIdE8allocateEmPKv,"axG",@progbits,_ZNSt15__new_allocatorIdE8allocateEmPKv,comdat
	.weak	_ZNSt15__new_allocatorIdE8allocateEmPKv # -- Begin function _ZNSt15__new_allocatorIdE8allocateEmPKv
	.p2align	1, 0x90
	.type	_ZNSt15__new_allocatorIdE8allocateEmPKv,@function
_ZNSt15__new_allocatorIdE8allocateEmPKv: # @_ZNSt15__new_allocatorIdE8allocateEmPKv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rsi, %rax
	shrq	$60, %rax
	jne	.LBB11_1
# %bb.3:
	shlq	$3, %rsi
	movq	%rsi, %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Znwm                           # TAILCALL
.LBB11_1:
	.cfi_def_cfa_offset 16
	shrq	$61, %rsi
	je	.LBB11_2
# %bb.4:
	callq	_ZSt28__throw_bad_array_new_lengthv
.LBB11_2:
	callq	_ZSt17__throw_bad_allocv
.Lfunc_end11:
	.size	_ZNSt15__new_allocatorIdE8allocateEmPKv, .Lfunc_end11-_ZNSt15__new_allocatorIdE8allocateEmPKv
	.cfi_endproc
                                        # -- End function
	.section	.text._Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll,"axG",@progbits,_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll,comdat
	.weak	_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll # -- Begin function _Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll
	.type	_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll,@function
_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll: # @_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll
	.cfi_startproc
# %bb.0:
	cmpq	%rdx, %rsi
	jge	.LBB12_4
# %bb.1:                                # %tailrecurse.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %rbx
	movq	%rsi, %r15
	movq	%rdi, %r14
.LBB12_2:                               # %tailrecurse
                                        # =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%rbx, %rdx
	callq	_Z14quickPartitionIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEElT_ll
	movq	%rax, %r12
	leaq	-1(%rax), %rdx
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll
	incq	%r12
	movq	%r12, %r15
	cmpq	%rbx, %r12
	jl	.LBB12_2
# %bb.3:
	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
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r14
	.cfi_restore %r15
.LBB12_4:                               # %tailrecurse._crit_edge
	retq
.Lfunc_end12:
	.size	_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll, .Lfunc_end12-_Z9quickSortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_ll
	.cfi_endproc
                                        # -- End function
	.section	.text._Z14quickPartitionIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEElT_ll,"axG",@progbits,_Z14quickPartitionIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEElT_ll,comdat
	.weak	_Z14quickPartitionIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEElT_ll # -- Begin function _Z14quickPartitionIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEElT_ll
	.type	_Z14quickPartitionIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEElT_ll,@function
_Z14quickPartitionIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEElT_ll: # @_Z14quickPartitionIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEElT_ll
	.cfi_startproc
# %bb.0:
	movsd	(%rdi,%rsi,8), %xmm0            # xmm0 = mem[0],zero
	leal	1(%rsi), %eax
	cmpl	%edx, %eax
	jge	.LBB13_13
# %bb.1:                                # %.preheader.preheader
	movabsq	$4294967296, %rcx               # imm = 0x100000000
.LBB13_2:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB13_3 Depth 2
                                        #     Child Loop BB13_8 Depth 2
	cltq
	movslq	%edx, %r8
	leal	1(%rax), %r10d
	cmpl	%r10d, %r8d
	cmovgl	%edx, %r10d
	movq	%rax, %r9
	shlq	$32, %r9
.LBB13_3:                               #   Parent Loop BB13_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	ucomisd	(%rdi,%rax,8), %xmm0
	jb	.LBB13_6
# %bb.4:                                #   in Loop: Header=BB13_3 Depth=2
	incq	%rax
	addq	%rcx, %r9
	cmpq	%r8, %rax
	jl	.LBB13_3
# %bb.5:                                #   in Loop: Header=BB13_2 Depth=1
	movl	%r10d, %eax
	jmp	.LBB13_10
.LBB13_6:                               # %.critedge
                                        #   in Loop: Header=BB13_2 Depth=1
	cmpl	%eax, %edx
	jle	.LBB13_10
# %bb.7:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB13_2 Depth=1
	sarq	$32, %r9
.LBB13_8:                               # %.lr.ph
                                        #   Parent Loop BB13_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%rdi,%r8,8), %xmm1             # xmm1 = mem[0],zero
	ucomisd	%xmm0, %xmm1
	jbe	.LBB13_9
# %bb.12:                               #   in Loop: Header=BB13_8 Depth=2
	decq	%r8
	cmpq	%r9, %r8
	jg	.LBB13_8
	jmp	.LBB13_13
.LBB13_9:                               #   in Loop: Header=BB13_2 Depth=1
	movl	%r8d, %edx
.LBB13_10:                              # %.critedge2
                                        #   in Loop: Header=BB13_2 Depth=1
	cmpl	%edx, %eax
	je	.LBB13_13
# %bb.11:                               #   in Loop: Header=BB13_2 Depth=1
	movslq	%eax, %r8
	movsd	(%rdi,%r8,8), %xmm1             # xmm1 = mem[0],zero
	movslq	%edx, %r9
	movsd	(%rdi,%r9,8), %xmm2             # xmm2 = mem[0],zero
	movsd	%xmm2, (%rdi,%r8,8)
	movsd	%xmm1, (%rdi,%r9,8)
	jl	.LBB13_2
.LBB13_13:                              # %.critedge2._crit_edge
	cltq
	movsd	(%rdi,%rax,8), %xmm1            # xmm1 = mem[0],zero
	xorl	%ecx, %ecx
	ucomisd	%xmm0, %xmm1
	seta	%cl
	subl	%ecx, %eax
	cltq
	movsd	(%rdi,%rax,8), %xmm1            # xmm1 = mem[0],zero
	movsd	%xmm1, (%rdi,%rsi,8)
	movsd	%xmm0, (%rdi,%rax,8)
	retq
.Lfunc_end13:
	.size	_Z14quickPartitionIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEElT_ll, .Lfunc_end13-_Z14quickPartitionIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEElT_ll
	.cfi_endproc
                                        # -- End function
	.section	.text.startup,"ax",@progbits
	.type	_GLOBAL__sub_I_gpu_parallel_sort.hip,@function # -- Begin function _GLOBAL__sub_I_gpu_parallel_sort.hip
_GLOBAL__sub_I_gpu_parallel_sort.hip:   # @_GLOBAL__sub_I_gpu_parallel_sort.hip
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$fs, %edi
	movl	$.L.str, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
	movl	$_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev, %edi
	movl	$fs, %esi
	movl	$__dso_handle, %edx
	callq	__cxa_atexit
	movl	$buckets, %edi
	movl	$24000, %edx                    # imm = 0x5DC0
	xorl	%esi, %esi
	callq	memset@PLT
	movl	$__cxx_global_array_dtor, %edi
	movl	$__dso_handle, %edx
	xorl	%esi, %esi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	__cxa_atexit                    # TAILCALL
.Lfunc_end14:
	.size	_GLOBAL__sub_I_gpu_parallel_sort.hip, .Lfunc_end14-_GLOBAL__sub_I_gpu_parallel_sort.hip
	.cfi_endproc
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB15_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB15_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z14bucketSortCUDAPdS_l, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end15:
	.size	__hip_module_ctor, .Lfunc_end15-__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	.LBB16_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
.LBB16_2:
	retq
.Lfunc_end16:
	.size	__hip_module_dtor, .Lfunc_end16-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	fs,@object                      # @fs
	.bss
	.globl	fs
	.p2align	3, 0x0
fs:
	.zero	512
	.size	fs, 512

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

	.hidden	__dso_handle
	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"data_generated_by_script.txt"
	.size	.L.str.1, 29

	.type	NAMEFILE,@object                # @NAMEFILE
	.data
	.globl	NAMEFILE
	.p2align	3, 0x0
NAMEFILE:
	.quad	.L.str.1
	.size	NAMEFILE, 8

	.type	buckets,@object                 # @buckets
	.bss
	.globl	buckets
	.p2align	4, 0x0
buckets:
	.zero	24000
	.size	buckets, 24000

	.type	.L.str.3,@object                # @.str.3
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.3:
	.asciz	" "
	.size	.L.str.3, 2

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

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Numero de datos: "
	.size	.L.str.5, 18

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

	.type	.L.str.6,@object                # @.str.6
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.6:
	.asciz	"#numdatos serialTime parallelTime speedup efficiencia #Hilos"
	.size	.L.str.6, 61

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Leyendo archivo ... "
	.size	.L.str.7, 21

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Demoro en leer el archivo: "
	.size	.L.str.8, 28

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"(s)"
	.size	.L.str.9, 4

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Tiempo secuencial fue : "
	.size	.L.str.10, 25

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Array No esta ordenado"
	.size	.L.str.11, 23

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Array Sort Ordenado"
	.size	.L.str.12, 20

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Tiempo paralelo con "
	.size	.L.str.13, 21

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	" hilos y "
	.size	.L.str.14, 10

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	" bloques que demoro con "
	.size	.L.str.15, 25

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	" elementos fue : "
	.size	.L.str.16, 18

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"Speed UP: "
	.size	.L.str.17, 11

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"Eficiencia: "
	.size	.L.str.18, 13

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"Array Ordenado"
	.size	.L.str.19, 15

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

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z14bucketSortCUDAPdS_l"
	.size	.L__unnamed_1, 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	_GLOBAL__sub_I_gpu_parallel_sort.hip
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __cxx_global_array_dtor
	.addrsig_sym _Z29__device_stub__bucketSortCUDAPdS_l
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym _GLOBAL__sub_I_gpu_parallel_sort.hip
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym fs
	.addrsig_sym __dso_handle
	.addrsig_sym buckets
	.addrsig_sym _ZSt4cout
	.addrsig_sym _Z14bucketSortCUDAPdS_l
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z14bucketSortCUDAPdS_l ; -- Begin function _Z14bucketSortCUDAPdS_l
	.globl	_Z14bucketSortCUDAPdS_l
	.p2align	8
	.type	_Z14bucketSortCUDAPdS_l,@function
_Z14bucketSortCUDAPdS_l:                ; @_Z14bucketSortCUDAPdS_l
; %bb.0:
	s_load_b32 s6, s[0:1], 0x24
	s_mov_b32 s2, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB0_2
; %bb.1:
	v_mov_b32_e32 v1, 0
	ds_store_b32 v1, v1 offset:19200
.LBB0_2:
	s_or_b32 exec_lo, exec_lo, s2
	s_clause 0x1
	s_load_b64 s[4:5], s[0:1], 0x10
	s_load_b128 s[0:3], s[0:1], 0x0
	v_mov_b32_e32 v2, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s6, 0xffff, s6
	s_mov_b32 s7, exec_lo
	s_barrier
	v_mov_b32_e32 v1, v2
	buffer_gl0_inv
	v_cmpx_gt_i64_e64 s[4:5], v[0:1]
	s_cbranch_execz .LBB0_9
; %bb.3:                                ; %.lr.ph.preheader
	v_dual_mov_b32 v4, v1 :: v_dual_mov_b32 v3, v0
	s_mov_b32 s8, 0
.LBB0_4:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 3, v[3:4]
	s_mov_b32 s9, exec_lo
	v_add_co_u32 v4, vcc_lo, s0, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v5, vcc_lo, s1, v5, vcc_lo
	global_load_b64 v[4:5], v[4:5], off
	s_waitcnt vmcnt(0)
	v_mul_f64 v[6:7], 0x408f4000, v[4:5]
	v_cvt_i32_f64_e32 v1, v[6:7]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e64 s15, v1
	s_cbranch_execz .LBB0_8
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	s_mov_b32 s11, exec_lo
	s_mov_b32 s10, exec_lo
	v_mbcnt_lo_u32_b32 v1, s11, 0
                                        ; implicit-def: $vgpr6
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v1
	s_cbranch_execz .LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	s_bcnt1_i32_b32 s11, s11
	s_delay_alu instid0(SALU_CYCLE_1)
	v_mov_b32_e32 v6, s11
	ds_add_rtn_u32 v6, v2, v6 offset:19200
.LBB0_7:                                ;   in Loop: Header=BB0_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s10
	s_waitcnt lgkmcnt(0)
	v_readfirstlane_b32 s10, v6
	s_delay_alu instid0(VALU_DEP_1)
	v_add_lshl_u32 v1, s10, v1, 3
	ds_store_b64 v1, v[4:5]
.LBB0_8:                                ; %Flow101
                                        ;   in Loop: Header=BB0_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s9
	v_add_nc_u32_e32 v1, s6, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_dual_mov_b32 v4, v2 :: v_dual_mov_b32 v3, v1
	v_cmp_le_u64_e32 vcc_lo, s[4:5], v[1:2]
	s_or_b32 s8, vcc_lo, s8
	s_and_not1_b32 exec_lo, exec_lo, s8
	s_cbranch_execnz .LBB0_4
.LBB0_9:                                ; %Flow103
	s_or_b32 exec_lo, exec_lo, s7
	v_mov_b32_e32 v5, v0
	s_lshl_b32 s4, s6, 3
	s_mov_b32 s5, 0
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
.LBB0_10:                               ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_13 Depth 2
                                        ;     Child Loop BB0_21 Depth 2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_and_b32_e32 v1, 1, v5
	s_bitcmp0_b32 s5, 0
	s_mov_b32 s1, -1
                                        ; implicit-def: $vgpr6
	v_cmp_eq_u32_e64 s0, 0, v1
	s_cbranch_scc1 .LBB0_18
; %bb.11:                               ; %.preheader55
                                        ;   in Loop: Header=BB0_10 Depth=1
	v_cmp_gt_i32_e32 vcc_lo, 0x95f, v5
	v_mov_b32_e32 v6, v5
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_xor_b32 s1, s0, -1
	s_and_b32 s1, vcc_lo, s1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s7, s1
	s_cbranch_execz .LBB0_17
; %bb.12:                               ; %.lr.ph61.preheader
                                        ;   in Loop: Header=BB0_10 Depth=1
	v_dual_mov_b32 v6, v5 :: v_dual_lshlrev_b32 v7, 3, v5
	s_mov_b32 s8, 0
.LBB0_13:                               ; %.lr.ph61
                                        ;   Parent Loop BB0_10 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ds_load_2addr_b64 v[1:4], v7 offset1:1
	s_mov_b32 s1, exec_lo
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_f64_e32 v[1:2], v[3:4]
	s_cbranch_execz .LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=2
	ds_store_2addr_b64 v7, v[3:4], v[1:2] offset1:1
.LBB0_15:                               ;   in Loop: Header=BB0_13 Depth=2
	s_or_b32 exec_lo, exec_lo, s1
	v_add_nc_u32_e32 v6, s6, v6
	v_add_nc_u32_e32 v7, s4, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_and_b32_e32 v1, 1, v6
	v_cmp_lt_i32_e32 vcc_lo, 0x95e, v6
	v_cmp_eq_u32_e64 s1, 0, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s1, vcc_lo, s1
	s_and_b32 s1, exec_lo, s1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s8, s1, s8
	s_and_not1_b32 exec_lo, exec_lo, s8
	s_cbranch_execnz .LBB0_13
; %bb.16:                               ; %Flow
                                        ;   in Loop: Header=BB0_10 Depth=1
	s_or_b32 exec_lo, exec_lo, s8
.LBB0_17:                               ; %Flow97
                                        ;   in Loop: Header=BB0_10 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s7
	s_mov_b32 s1, 0
.LBB0_18:                               ; %Flow100
                                        ;   in Loop: Header=BB0_10 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 vcc_lo, exec_lo, s1
	s_cbranch_vccnz .LBB0_26
; %bb.19:                               ; %.preheader54
                                        ;   in Loop: Header=BB0_10 Depth=1
	v_cmp_gt_i32_e32 vcc_lo, 0x960, v5
	s_and_b32 s0, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s1, s0
	s_cbranch_execz .LBB0_25
; %bb.20:                               ; %.lr.ph64.preheader
                                        ;   in Loop: Header=BB0_10 Depth=1
	v_lshlrev_b32_e32 v6, 3, v5
	s_mov_b32 s7, 0
.LBB0_21:                               ; %.lr.ph64
                                        ;   Parent Loop BB0_10 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ds_load_2addr_b64 v[1:4], v6 offset1:1
	s_mov_b32 s0, exec_lo
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_f64_e32 v[1:2], v[3:4]
	s_cbranch_execz .LBB0_23
; %bb.22:                               ;   in Loop: Header=BB0_21 Depth=2
	ds_store_2addr_b64 v6, v[3:4], v[1:2] offset1:1
.LBB0_23:                               ;   in Loop: Header=BB0_21 Depth=2
	s_or_b32 exec_lo, exec_lo, s0
	v_add_nc_u32_e32 v5, s6, v5
	v_add_nc_u32_e32 v6, s4, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_and_b32_e32 v1, 1, v5
	v_cmp_lt_i32_e32 vcc_lo, 0x95f, v5
	v_cmp_eq_u32_e64 s0, 1, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s0, vcc_lo, s0
	s_and_b32 s0, exec_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s7, s0, s7
	s_and_not1_b32 exec_lo, exec_lo, s7
	s_cbranch_execnz .LBB0_21
; %bb.24:                               ; %Flow98
                                        ;   in Loop: Header=BB0_10 Depth=1
	s_or_b32 exec_lo, exec_lo, s7
.LBB0_25:                               ; %Flow99
                                        ;   in Loop: Header=BB0_10 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s1
	v_mov_b32_e32 v6, v5
.LBB0_26:                               ; %.critedge
                                        ;   in Loop: Header=BB0_10 Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_mov_b32_e32 v5, v6
	s_add_i32 s5, s5, 1
	s_cmpk_eq_i32 s5, 0x960
	s_cbranch_scc0 .LBB0_10
; %bb.27:                               ; %.preheader
	v_dual_mov_b32 v2, 0 :: v_dual_lshlrev_b32 v3, 3, v0
	s_mulk_i32 s15, 0x960
	s_mov_b32 s1, 0
.LBB0_28:                               ; =>This Inner Loop Header: Depth=1
	ds_load_b64 v[4:5], v3
	v_add_nc_u32_e32 v1, s15, v0
	v_add_nc_u32_e32 v0, s6, v0
	v_add_nc_u32_e32 v3, s4, v3
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[6:7], 3, v[1:2]
	v_cmp_lt_u32_e32 vcc_lo, 0x95f, v0
	s_or_b32 s1, vcc_lo, s1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v6, s0, s2, v6
	v_add_co_ci_u32_e64 v7, s0, s3, v7, s0
	s_waitcnt lgkmcnt(0)
	global_store_b64 v[6:7], v[4:5], off
	s_and_not1_b32 exec_lo, exec_lo, s1
	s_cbranch_execnz .LBB0_28
; %bb.29:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14bucketSortCUDAPdS_l
		.amdhsa_group_segment_fixed_size 19208
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 8
		.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	_Z14bucketSortCUDAPdS_l, .Lfunc_end0-_Z14bucketSortCUDAPdS_l
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 816
; NumSgprs: 18
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 19208 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 8
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           8
        .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: 19208
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z14bucketSortCUDAPdS_l
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z14bucketSortCUDAPdS_l.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
