#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <math.h>
//Problem Size 2^25
#define N 33554432
#define THREADS_PER_BLOCK 128

//This kernel is responsible for the following tasks
//Compute distance between each data point and the cluster centroids
//Based on distance assign the point to the closest cluster
//Count the number of points in each cluster 
__global__ void KMeansClustering(double *centroids,double *data,double *clstr1,double *clstr2,double *clstr3,int n,int *noOfCPoints)
{
//Input data read from the file is of the format as shown below
//x-coordinate,y-coordinate,clusterid
//So each thread is supposed to work on these 3 data 
int tid = (blockIdx.x*blockDim.x +threadIdx.x)*3;
 
if(tid<3*n){
  
   //Index to store the data into one of the clusters
   //Since the cluster arrays are one dimensional, data points are stored as follows in memory
   //[x1,y2,x2,y2,x3,y3....xn,yn]
   //So each thread is responsible for one point (x,y)
   int index = (blockIdx.x*blockDim.x +threadIdx.x)*2;
   //Shared memory array to store the number of points in the clusters
   //All the points in one thread block will update in this shared memory
   //Since the atomic operations on the shared memory are faster than the global memory
   //Similar to Histogram
   //Privatization concept is used
   __shared__ int s_cluster[3];
   //Initialsed the number of points in each cluster to 0
   s_cluster[0] = 0;
   s_cluster[1] = 0;
   s_cluster[2] = 0;
   //Syncronisations so that all the threads in the block
   //dont overwrite each others changes
   __syncthreads();
  
   //Storing the data point in the register
   //so as to avoid multiple global memory access
   double data_x = data[tid];
   double data_y = data[tid+1];
 
   //A cluster pointer array, to point to start
   //of each cluster
   double *cluster[3];
   
   //Calculating distance of the data point from each of the cluster
   double d_1 = pow(data_x-centroids[0],2)+pow(data_y-centroids[1],2);
   double d_2 = pow(data_x-centroids[2],2)+pow(data_y-centroids[3],2);
   double d_3 = pow(data_x-centroids[4],2)+pow(data_y-centroids[5],2);
   
   //Initialising the cluster pointer array
   cluster[0] = clstr1;
   cluster[1] = clstr2;
   cluster[2] = clstr3;

   //Using the ternary operator to find the closest cluster
   //Nested If else blocks result in a lot of control divergence
   int clusterIndex = d_1 > d_2 ? d_2 > d_3 ? 2 : 1  : d_1 < d_3 ? 0: 2 ;    
   
   //based on the clusterindex obtained
   //assign the point the corresponding cluster 
   for(int i=0;i<3;i++){
      if(i!=clusterIndex){ 
        double * clusterPtr = cluster[i];
        clusterPtr[index]   = 0.0;
        clusterPtr[index+1] = 0.0;
      }else{
        double * clusterPtr = cluster[clusterIndex];
        clusterPtr[index] = data_x;
        clusterPtr[index+1] = data_y;
      }
   }
   
   //Increment the counter in the shared memory
   //corresponding to the cluster to which point is assigned
   atomicAdd(&s_cluster[clusterIndex],1);
   //Synchronisation is required so that all the threads 
   //in the block have finished incrementing the number of points
   //in the correct cluster
   //before updating the global memory with the final value of each block
   __syncthreads();
   
   //Update the global memory with the count of points in a particular cluster
   //which is done by 3 threads in each block since we have 3 clusters
   //one warp in each block will be in control divergence due to this
    if(threadIdx.x < 3){
      atomicAdd(&noOfCPoints[threadIdx.x],s_cluster[threadIdx.x]);     
    }
   }
}
 

//This kernel is responsible for in place
//reduction of all the clusters to perform sum of all
//points in a particular cluster
__global__ void sumCluster(double *cluster1,double *cluster2,double *cluster3,int n){
//Each thread works on a 2 dimensional point (x,y)
int tid = (blockIdx.x*blockDim.x +threadIdx.x)*2;

//Shared memory to store the partial sum of each of clusters
//Shared memory is faster than the main memory hence time will be lesser
//There are 3 clusters so 3 array in shared memory
__shared__ double shared_data_1[THREADS_PER_BLOCK*2];
__shared__ double shared_data_2[THREADS_PER_BLOCK*2];
__shared__ double shared_data_3[THREADS_PER_BLOCK*2];
 
if(tid < n){ 
//Initiliase the shared memory with the data
//from the global memory
shared_data_1[2*threadIdx.x] = cluster1[tid];
shared_data_1[2*threadIdx.x+1] = cluster1[tid+1];
 
shared_data_2[2*threadIdx.x] = cluster2[tid];
shared_data_2[2*threadIdx.x+1] = cluster2[tid+1];
 
shared_data_3[2*threadIdx.x] = cluster3[tid];
shared_data_3[2*threadIdx.x+1] = cluster3[tid+1];
__syncthreads();
}
 
  //Making use of sequential addressing
  //which gives coalsced memory access, eliminates bank conflict
  //and reduces control divergence
  //Since each thread processes a point (x,y)
  //stride is intialised to blockDim instead of blockDim/2 
  int stride = blockDim.x; 
  while((stride >= 2) && (threadIdx.x < stride/2)){
   
    shared_data_1[2*threadIdx.x] += shared_data_1[2*threadIdx.x+stride];
    //addition for y
    shared_data_1[2*threadIdx.x+1]+=shared_data_1[2*threadIdx.x+stride+1];   
    
    //addition for x
    shared_data_2[2*threadIdx.x]+=shared_data_2[2*threadIdx.x+stride];
    //addition for y
    shared_data_2[2*threadIdx.x+1]+=shared_data_2[2*threadIdx.x+stride+1];
 
    //addition for x
    shared_data_3[2*threadIdx.x]+=shared_data_3[2*threadIdx.x+stride];
    //addition for y
    shared_data_3[2*threadIdx.x+1]+=shared_data_3[2*threadIdx.x+stride+1];
    //synchronisation to ensure all the threads have finished
    //before going to the next stride value
    __syncthreads();
    //Using right shift operator instead of divide
    //since it is faster
    stride =  stride>>1;
  }
 
//One thread from each block write the partial sum into
//the global memory
//This kernel is called again and again until one block
//is required to do the sum
if(threadIdx.x == 0){
  cluster1[blockIdx.x*2] = shared_data_1[threadIdx.x];
  cluster1[blockIdx.x*2+1] = shared_data_1[threadIdx.x+1];
 
  cluster2[blockIdx.x*2] = shared_data_2[threadIdx.x];
  cluster2[blockIdx.x*2+1] = shared_data_2[threadIdx.x+1];
 
  cluster3[blockIdx.x*2] = shared_data_3[threadIdx.x];
  cluster3[blockIdx.x*2+1] = shared_data_3[threadIdx.x+1];

}
}

//Function to check if any cuda errors have occured
void checkCudaError(cudaError_t error,int lineNo){
      if (error !=cudaSuccess) {
        printf("%s in %s at line %d\n", cudaGetErrorString(error),__FILE__,lineNo);
        exit(EXIT_FAILURE);
     }
 
}
 
int main(int argc, char *argv[]) {
    //Select the first gpu device
    cudaSetDevice(0);
    //Read data from the file
    FILE *inFile = fopen("33554432_CLUSTER_DATA.csv", "r");
    if(inFile == NULL){
        printf("Unable to read the data from the file");
        exit(1);
    }
    
    //Host memory allocation for data 
    double *host_data = (double *)malloc(sizeof(double)*N*3);
    //CUDA memory allocation for data
    double *dev_data;
    cudaError_t error = cudaMalloc(&dev_data,N*3*sizeof(double));
    checkCudaError(error,__LINE__-1);
    //Initialise the host data from the valies in the file
    for(int i =0;i<N;i++){
        fscanf(inFile, "%lf,%lf,%lf\n", &host_data[i*3],&host_data[i*3+1],&host_data[i*3+2]);
    }
   
   //Host memory allocation for the clusters
   double *host_cluster_1 = (double *)calloc(N*2,sizeof(double));
   double *host_cluster_2 = (double *)calloc(N*2,sizeof(double));
   double *host_cluster_3 = (double *)calloc(N*2,sizeof(double));
   
   //CUDA memory allocation for the clusters
   double *dev_c_1;
   double *dev_c_2;
   double *dev_c_3;
   error = cudaMalloc((void**)&dev_c_1,N*2*sizeof(double));
   checkCudaError(error,__LINE__-1);
   error = cudaMalloc((void**)&dev_c_2,N*2*sizeof(double));
   checkCudaError(error,__LINE__-1);
   error = cudaMalloc((void**)&dev_c_3,N*2*sizeof(double));
   checkCudaError(error,__LINE__-1);
   
   //memory allocation to store the cluster centroids
   double* host_centroids = (double*)malloc(6*sizeof(double));
   double* dev_centroids;
   error = cudaMalloc((void**)&dev_centroids,6*sizeof(double));
   checkCudaError(error,__LINE__-1);  
   //Randomly initialising K centroids for the clusters
   srand(29);
 
   int index1 = (rand() % N )*3;
  
   host_centroids[0] = host_data[index1];
   host_centroids[1] = host_data[index1+1];
   int index2 = (rand() % N)*3;
  
   host_centroids[2] = host_data[index2];
   host_centroids[3] = host_data[index2+1];
   int index3 = (rand() % N)*3;
   
   host_centroids[4] = host_data[index3];
   host_centroids[5] = host_data[index3+1];
 
   printf("Initial Centroid Estimate\n");
   for(int i=0;i<=4;i+=2){
          printf("centroid[%d][0] = %lf centroid[%d][1] = %lf\n",i,host_centroids[i],i,host_centroids[i+1]);
   }
   
   error = cudaMemcpy(dev_data,host_data,N*3*sizeof(double),cudaMemcpyHostToDevice);
   checkCudaError(error,__LINE__-1);
   
   int *h_noOfCPoints = (int*)calloc(3,sizeof(int));
   int *c_noOfCPoints;
   error = cudaMalloc((void**)&c_noOfCPoints,3*sizeof(int));
   checkCudaError(error,__LINE__-1);
   error = cudaMemcpy(c_noOfCPoints,h_noOfCPoints,3*sizeof(int),cudaMemcpyHostToDevice);
   checkCudaError(error,__LINE__-1);
 
   cudaEvent_t start, stop;
   cudaEventCreate(&start);
   cudaEventCreate(&stop);
   cudaEventRecord(start);
   
   double previous_centroids[6];
  //To count the number of itaerations required to converge 
  int noOfIterations = 0;
   while(1){
   noOfIterations++;
   //Keep a copy of centroids of previous iterations
   //So as to compare later
   for(int i=0;i<6;i++){
       previous_centroids[i] = host_centroids[i] ;
   }
   //transfer the centroids to gpu
   error = cudaMemcpy(dev_centroids,host_centroids,6*sizeof(double),cudaMemcpyHostToDevice);
   checkCudaError(error,__LINE__-1);
   for(int i=0;i<3;i++){
       h_noOfCPoints[i] = 0 ;
   }
   //transfer the number of points in each cluster to gpu 
   error = cudaMemcpy(c_noOfCPoints,h_noOfCPoints,3*sizeof(int),cudaMemcpyHostToDevice);
   checkCudaError(error,__LINE__-1);
   
   //kernel computes distance and assign the data points to one of the clusters
   KMeansClustering<<<N/THREADS_PER_BLOCK,THREADS_PER_BLOCK>>>(dev_centroids,dev_data,dev_c_1,dev_c_2,dev_c_3,N,c_noOfCPoints);
   error = cudaGetLastError();
   checkCudaError(error,__LINE__-2);
   //get the number of points in each cluster to cpu
   error = cudaMemcpy(h_noOfCPoints,c_noOfCPoints,3*sizeof(int),cudaMemcpyDeviceToHost);
   checkCudaError(error,__LINE__-1);
   printf("\ncluster points %d %d %d\n",h_noOfCPoints[0],h_noOfCPoints[1],h_noOfCPoints[2]);  
   int blockSize = THREADS_PER_BLOCK;
   int temp = N;
   
   //repeatedly call the reduction kernel
   //so as to compute sum of all points in each cluster
   while(1){
   
      if(temp>blockSize){        
          sumCluster<<<temp/blockSize,blockSize>>>(dev_c_1,dev_c_2,dev_c_3,temp*2);
          error = cudaGetLastError();
          checkCudaError(error,__LINE__-2);
      }
      //If only 32 values are there only one block is enough of 32 threads required
      else if (temp >= 32){
          sumCluster<<<1,temp>>>(dev_c_1,dev_c_2,dev_c_3,temp*2);
          error = cudaGetLastError();
          //printf("%d,%d\n",temp,blockSize);
          checkCudaError(error,__LINE__-2);
          break;
      }
      else{//if less than 32 items to be added
           //add them serially
          error = cudaMemcpy(host_cluster_1,dev_c_1,temp*2*sizeof(double),cudaMemcpyDeviceToHost);
          checkCudaError(error,__LINE__-1);
          error = cudaMemcpy(host_cluster_2,dev_c_2,temp*2*sizeof(double),cudaMemcpyDeviceToHost);
          checkCudaError(error,__LINE__-1);
          error = cudaMemcpy(host_cluster_3,dev_c_3,temp*2*sizeof(double),cudaMemcpyDeviceToHost);
          checkCudaError(error,__LINE__-1);
          for(int i = 1 ; i < temp ; i++){
              host_cluster_1[0] += host_cluster_1[2*i];
              host_cluster_1[1] += host_cluster_1[2*i+1];
              host_cluster_2[0] += host_cluster_2[2*i];
              host_cluster_2[1] += host_cluster_2[2*i+1];
              host_cluster_3[0] += host_cluster_3[2*i];
              host_cluster_3[1] += host_cluster_3[2*i+1];       
          }
        break;    
      }
     if(temp > blockSize){
     temp = temp/blockSize;
     }      
   }
   //transfer the sum calculated to the host
   if(temp>=32){
       error = cudaMemcpy(host_cluster_1,dev_c_1,2*sizeof(double),cudaMemcpyDeviceToHost);
       checkCudaError(error,__LINE__-1);
       error = cudaMemcpy(host_cluster_2,dev_c_2,2*sizeof(double),cudaMemcpyDeviceToHost);
       checkCudaError(error,__LINE__-1);
       error = cudaMemcpy(host_cluster_3,dev_c_3,2*sizeof(double),cudaMemcpyDeviceToHost);
       checkCudaError(error,__LINE__-1);       
   }
     

   double sumXcluster1 = host_cluster_1[0];
   double sumYcluster1 = host_cluster_1[1];
 
   double sumXcluster2 = host_cluster_2[0];
   double sumYcluster2 = host_cluster_2[1];
 
   double sumXcluster3 = host_cluster_3[0];
   double sumYcluster3 = host_cluster_3[1];
    
   //compute the centroids by dividing the sum of points in each
   //cluster by the total no of points in each cluster
   host_centroids[0] = sumXcluster1/(double)h_noOfCPoints[0];
   host_centroids[1] = sumYcluster1/(double)h_noOfCPoints[0];
 
   host_centroids[2] = sumXcluster2/(double)h_noOfCPoints[1];
   host_centroids[3] = sumYcluster2/(double)h_noOfCPoints[1];
 
   host_centroids[4] = sumXcluster3/(double)h_noOfCPoints[2];
   host_centroids[5] = sumYcluster3/(double)h_noOfCPoints[2];
   
   for(int i=0;i<=4;i+=2){
      printf("centroid[%d][0] = %lf centroid[%d][1] = %lf\n",i,host_centroids[i],i,host_centroids[i+1]);
   }
   int count = 0;
   //if all the centroids are same as in previous iteration
   //algorithm has converged
   for(int i=0;i<6;i++){
      if(host_centroids[i] != previous_centroids[i]){
        break;
      }
      count++;
   }
   if(count == 6){
     break;
   }
 }
   cudaEventRecord(stop);
   cudaEventSynchronize(stop);
   float milliseconds = 0;
   cudaEventElapsedTime(&milliseconds, start, stop);
   for(int i=0;i<=4;i+=2){
      printf("centroid[%d][0] = %lf centroid[%d][1] = %lf\n",i,host_centroids[i],i,host_centroids[i+1]);
   }
   
   //Total no computations for one iteration
   //16 * N for kernel 1
   //2 * N for kernel 2
   double throughput = (24  *sizeof(double)* 2.0 * noOfIterations) *N/(1000*milliseconds);
   printf("\nThroughput is %lf MFLOPS",throughput);
   printf("\nTime is %f ms\n",milliseconds);

  return 0; 
}
 
 



	.file	"tmpxft_002ea8ec_00000000-6_parallelKmeansv3.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2031:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2031:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/bhshri/Parallel_Computing/master/parallelKmeansv3.cu"
.LC1:
	.string	"%s in %s at line %d\n"
	.text
	.globl	_Z14checkCudaError9cudaErrori
	.type	_Z14checkCudaError9cudaErrori, @function
_Z14checkCudaError9cudaErrori:
.LFB2027:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L2
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	%esi, 12(%rsp)
	call	cudaGetErrorString@PLT
	movl	12(%rsp), %r8d
	movl	$2, %edi
	leaq	.LC0(%rip), %rcx
	movq	%rax, %rdx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z14checkCudaError9cudaErrori, .-_Z14checkCudaError9cudaErrori
	.globl	_Z47__device_stub__Z16KMeansClusteringPdS_S_S_S_iPiPdS_S_S_S_iPi
	.type	_Z47__device_stub__Z16KMeansClusteringPdS_S_S_S_iPiPdS_S_S_S_iPi, @function
_Z47__device_stub__Z16KMeansClusteringPdS_S_S_S_iPiPdS_S_S_S_iPi:
.LFB2053:
	.cfi_startproc
	endbr64
	subq	$200, %rsp
	.cfi_def_cfa_offset 208
	movq	208(%rsp), %rax
	movq	%rdi, 56(%rsp)
	leaq	80(%rsp), %rdi
	movq	%rsi, 48(%rsp)
	leaq	92(%rsp), %rsi
	movq	%rdx, 40(%rsp)
	leaq	64(%rsp), %rdx
	movq	%rcx, 32(%rsp)
	leaq	72(%rsp), %rcx
	movq	%r8, 24(%rsp)
	movl	%r9d, 20(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rax
	movl	$1, 88(%rsp)
	movq	%rax, 128(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 176(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 80(%rsp)
	movq	%rax, 92(%rsp)
	movl	$1, 100(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L8
	pushq	72(%rsp)
	.cfi_def_cfa_offset 216
	leaq	_Z16KMeansClusteringPdS_S_S_S_iPi(%rip), %rdi
	pushq	72(%rsp)
	.cfi_def_cfa_offset 224
	movq	108(%rsp), %rcx
	movl	116(%rsp), %r8d
	movq	96(%rsp), %rsi
	movl	104(%rsp), %edx
	leaq	144(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 216
	popq	%rdx
	.cfi_def_cfa_offset 208
.L8:
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	addq	$200, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2053:
	.size	_Z47__device_stub__Z16KMeansClusteringPdS_S_S_S_iPiPdS_S_S_S_iPi, .-_Z47__device_stub__Z16KMeansClusteringPdS_S_S_S_iPiPdS_S_S_S_iPi
	.globl	_Z16KMeansClusteringPdS_S_S_S_iPi
	.type	_Z16KMeansClusteringPdS_S_S_S_iPi, @function
_Z16KMeansClusteringPdS_S_S_S_iPi:
.LFB2054:
	.cfi_startproc
	endbr64
	jmp	_Z47__device_stub__Z16KMeansClusteringPdS_S_S_S_iPiPdS_S_S_S_iPi
	.cfi_endproc
.LFE2054:
	.size	_Z16KMeansClusteringPdS_S_S_S_iPi, .-_Z16KMeansClusteringPdS_S_S_S_iPi
	.globl	_Z35__device_stub__Z10sumClusterPdS_S_iPdS_S_i
	.type	_Z35__device_stub__Z10sumClusterPdS_S_iPdS_S_i, @function
_Z35__device_stub__Z10sumClusterPdS_S_iPdS_S_i:
.LFB2055:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L13
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z10sumClusterPdS_S_i(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L13:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2055:
	.size	_Z35__device_stub__Z10sumClusterPdS_S_iPdS_S_i, .-_Z35__device_stub__Z10sumClusterPdS_S_iPdS_S_i
	.globl	_Z10sumClusterPdS_S_i
	.type	_Z10sumClusterPdS_S_i, @function
_Z10sumClusterPdS_S_i:
.LFB2056:
	.cfi_startproc
	endbr64
	jmp	_Z35__device_stub__Z10sumClusterPdS_S_iPdS_S_i
	.cfi_endproc
.LFE2056:
	.size	_Z10sumClusterPdS_S_i, .-_Z10sumClusterPdS_S_i
	.section	.rodata.str1.1
.LC2:
	.string	"r"
.LC3:
	.string	"33554432_CLUSTER_DATA.csv"
.LC4:
	.string	"Unable to read the data from the file"
.LC5:
	.string	"%lf,%lf,%lf\n"
.LC6:
	.string	"Initial Centroid Estimate\n"
.LC7:
	.string	"centroid[%d][0] = %lf centroid[%d][1] = %lf\n"
.LC8:
	.string	"\ncluster points %d %d %d\n"
.LC13:
	.string	"\nThroughput is %lf MFLOPS"
.LC14:
	.string	"\nTime is %f ms\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%edi, %edi
	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	$168, %rsp
	.cfi_def_cfa_offset 224
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	call	cudaSetDevice@PLT
	leaq	.LC2(%rip), %rsi
	leaq	.LC3(%rip), %rdi
	call	fopen@PLT
	testq	%rax, %rax
	jne	.L19
	movl	$2, %edi
	leaq	.LC4(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L19:
	movl	$805306368, %edi
	movq	%rax, %r12
	leaq	.LC5(%rip), %r14
	call	malloc@PLT
	leaq	16(%rsp), %rdi
	movl	$805306368, %esi
	movq	%rax, %rbp
	call	cudaMalloc@PLT
	movl	$194, %esi
	movq	%rbp, %rbx
	leaq	805306368(%rbp), %r13
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
.L20:
	leaq	8(%rbx), %rcx
	leaq	16(%rbx), %r8
	movq	%rbx, %rdx
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$24, %rbx
	call	__isoc23_fscanf@PLT
	cmpq	%rbx, %r13
	jne	.L20
	movl	$8, %esi
	movl	$67108864, %edi
	movl	$33554432, %r15d
	call	calloc@PLT
	movl	$8, %esi
	movl	$67108864, %edi
	movq	%rax, %r12
	call	calloc@PLT
	movl	$8, %esi
	movl	$67108864, %edi
	movq	%rax, %r13
	call	calloc@PLT
	leaq	24(%rsp), %rdi
	movl	$536870912, %esi
	movq	%rax, %r14
	call	cudaMalloc@PLT
	movl	$210, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	leaq	32(%rsp), %rdi
	movl	$536870912, %esi
	call	cudaMalloc@PLT
	movl	$212, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	leaq	40(%rsp), %rdi
	movl	$536870912, %esi
	call	cudaMalloc@PLT
	movl	$214, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	movl	$48, %edi
	call	malloc@PLT
	leaq	48(%rsp), %rdi
	movl	$48, %esi
	movq	%rax, %rbx
	call	cudaMalloc@PLT
	movl	$220, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	movl	$29, %edi
	call	srand@PLT
	call	rand@PLT
	cltd
	idivl	%r15d
	leal	(%rdx,%rdx,2), %edx
	movslq	%edx, %rdx
	movsd	0(%rbp,%rdx,8), %xmm0
	movsd	%xmm0, (%rbx)
	movsd	8(%rbp,%rdx,8), %xmm0
	movsd	%xmm0, 8(%rbx)
	call	rand@PLT
	cltd
	idivl	%r15d
	leal	(%rdx,%rdx,2), %edx
	movslq	%edx, %rdx
	movsd	0(%rbp,%rdx,8), %xmm0
	movsd	%xmm0, 16(%rbx)
	movsd	8(%rbp,%rdx,8), %xmm0
	movsd	%xmm0, 24(%rbx)
	call	rand@PLT
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	cltd
	idivl	%r15d
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	leal	(%rdx,%rdx,2), %edx
	movslq	%edx, %rdx
	movsd	0(%rbp,%rdx,8), %xmm0
	movsd	%xmm0, 32(%rbx)
	movsd	8(%rbp,%rdx,8), %xmm0
	movsd	%xmm0, 40(%rbx)
	call	__printf_chk@PLT
.L21:
	movsd	(%rbx,%r15,8), %xmm0
	movl	%r15d, %edx
	movl	%r15d, %ecx
	movb	$2, %al
	movsd	8(%rbx,%r15,8), %xmm1
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	addq	$2, %r15
	call	__printf_chk@PLT
	cmpq	$6, %r15
	jne	.L21
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movl	$805306368, %edx
	movq	%rbp, %rsi
	call	cudaMemcpy@PLT
	movl	$243, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	movl	$4, %esi
	movl	$3, %edi
	call	calloc@PLT
	leaq	56(%rsp), %rdi
	movl	$12, %esi
	movq	%rax, %rbp
	call	cudaMalloc@PLT
	movl	$248, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	movq	56(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$12, %edx
	call	cudaMemcpy@PLT
	movl	$250, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	leaq	64(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	72(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	xorl	%r8d, %r8d
	movl	%r8d, 4(%rsp)
.L40:
	leaq	104(%rsp), %rdi
	movl	$12, %ecx
	movq	%rbx, %rsi
	incl	4(%rsp)
	rep movsl
	movq	48(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$48, %edx
	call	cudaMemcpy@PLT
	movl	$269, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	xorl	%esi, %esi
	xorl	%edi, %edi
	movl	$1, %ecx
	movq	%rsi, 0(%rbp)
	movl	$12, %edx
	movq	%rbp, %rsi
	movl	%edi, 8(%rbp)
	movq	56(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	$275, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	movl	$33554433, %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$7, %rax
	movl	$16385, %edi
	movl	$1, %ecx
	movl	$1, %esi
	salq	$18, %rdi
	movq	%rax, %rdx
	movq	%rax, 92(%rsp)
	movl	$1, 100(%rsp)
	movq	%rdi, 80(%rsp)
	movl	$1, 88(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L22
	pushq	%rax
	.cfi_def_cfa_offset 232
	movl	$33554432, %r9d
	pushq	64(%rsp)
	.cfi_def_cfa_offset 240
	movq	56(%rsp), %r8
	movq	48(%rsp), %rcx
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movq	64(%rsp), %rdi
	call	_Z47__device_stub__Z16KMeansClusteringPdS_S_S_S_iPiPdS_S_S_S_iPi
	popq	%rdx
	.cfi_def_cfa_offset 232
	popq	%rcx
	.cfi_def_cfa_offset 224
.L22:
	call	cudaGetLastError@PLT
	movl	$279, %esi
	movl	$33554432, %r15d
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	movq	56(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbp, %rdi
	movl	$12, %edx
	call	cudaMemcpy@PLT
	movl	$283, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	movl	4(%rbp), %ecx
	movl	8(%rbp), %r8d
	xorl	%eax, %eax
	movl	0(%rbp), %edx
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	$3, 12(%rsp)
.L24:
	movl	$33554433, %eax
	movl	%r15d, 8(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$7, %rax
	sarl	$7, %r15d
	movl	$33554433, %edx
	movl	$1, %ecx
	movq	%rax, 92(%rsp)
	subq	$127, %rax
	salq	$7, %rdx
	movq	%rax, 84(%rsp)
	movl	88(%rsp), %esi
	movl	%r15d, 80(%rsp)
	movq	80(%rsp), %rdi
	movl	$1, 100(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L23
	movl	8(%rsp), %ecx
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdi
	addl	%ecx, %ecx
	call	_Z35__device_stub__Z10sumClusterPdS_S_iPdS_S_i
.L23:
	call	cudaGetLastError@PLT
	movl	$294, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	decl	12(%rsp)
	jne	.L24
	movq	24(%rsp), %rsi
	movl	$2, %ecx
	movl	$256, %edx
	movq	%r12, %rdi
	call	cudaMemcpy@PLT
	movl	$308, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movq	%r13, %rdi
	movl	$256, %edx
	call	cudaMemcpy@PLT
	movl	$310, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	movq	40(%rsp), %rsi
	movl	$2, %ecx
	movq	%r14, %rdi
	movl	$256, %edx
	call	cudaMemcpy@PLT
	movl	$312, %esi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrori
	movl	$16, %eax
.L25:
	movsd	(%r12), %xmm5
	movsd	0(%r13), %xmm3
	addsd	(%r12,%rax), %xmm5
	addsd	0(%r13,%rax), %xmm3
	movsd	(%r14), %xmm1
	addsd	(%r14,%rax), %xmm1
	movsd	8(%r12), %xmm4
	movsd	8(%r13), %xmm2
	movsd	8(%r14), %xmm0
	movsd	%xmm5, (%r12)
	addsd	8(%r12,%rax), %xmm4
	movsd	%xmm3, 0(%r13)
	addsd	8(%r13,%rax), %xmm2
	movsd	%xmm1, (%r14)
	addsd	8(%r14,%rax), %xmm0
	addq	$16, %rax
	movsd	%xmm4, 8(%r12)
	movsd	%xmm2, 8(%r13)
	movsd	%xmm0, 8(%r14)
	cmpq	$256, %rax
	jne	.L25
	cvtsi2sdl	0(%rbp), %xmm6
	xorl	%r15d, %r15d
	divsd	%xmm6, %xmm4
	divsd	%xmm6, %xmm5
	movsd	%xmm4, 8(%rbx)
	cvtsi2sdl	4(%rbp), %xmm4
	divsd	%xmm4, %xmm2
	movsd	%xmm5, (%rbx)
	divsd	%xmm4, %xmm3
	movsd	%xmm2, 24(%rbx)
	cvtsi2sdl	8(%rbp), %xmm2
	divsd	%xmm2, %xmm1
	movsd	%xmm3, 16(%rbx)
	divsd	%xmm2, %xmm0
	movsd	%xmm1, 32(%rbx)
	movsd	%xmm0, 40(%rbx)
.L26:
	movsd	(%rbx,%r15,8), %xmm0
	movl	%r15d, %edx
	movl	%r15d, %ecx
	movb	$2, %al
	movsd	8(%rbx,%r15,8), %xmm1
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	addq	$2, %r15
	call	__printf_chk@PLT
	cmpq	$6, %r15
	jne	.L26
	xorl	%eax, %eax
	leaq	104(%rsp), %rdx
.L29:
	movsd	(%rbx,%rax,8), %xmm0
	ucomisd	(%rdx,%rax,8), %xmm0
	jp	.L40
	jne	.L40
	incq	%rax
	cmpq	$6, %rax
	jne	.L29
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	xorl	%ebp, %ebp
	call	cudaEventRecord@PLT
	movq	72(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	leaq	92(%rsp), %rdi
	movl	$0x00000000, 92(%rsp)
	call	cudaEventElapsedTime@PLT
.L30:
	movsd	(%rbx,%rbp,8), %xmm0
	movsd	8(%rbx,%rbp,8), %xmm1
	movl	%ebp, %edx
	movl	%ebp, %ecx
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	movb	$2, %al
	addq	$2, %rbp
	call	__printf_chk@PLT
	cmpq	$6, %rbp
	jne	.L30
	cvtsi2sdl	4(%rsp), %xmm0
	mulsd	.LC10(%rip), %xmm0
	movl	$2, %edi
	movb	$1, %al
	mulsd	.LC11(%rip), %xmm0
	movss	.LC12(%rip), %xmm1
	leaq	.LC13(%rip), %rsi
	mulss	92(%rsp), %xmm1
	cvtss2sd	%xmm1, %xmm1
	divsd	%xmm1, %xmm0
	call	__printf_chk@PLT
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	92(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L31
	call	__stack_chk_fail@PLT
.L31:
	addq	$168, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	main, .-main
	.section	.rodata.str1.1
.LC15:
	.string	"_Z10sumClusterPdS_S_i"
.LC16:
	.string	"_Z16KMeansClusteringPdS_S_S_S_iPi"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2058:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC15(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z10sumClusterPdS_S_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC16(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z16KMeansClusteringPdS_S_S_S_iPi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2058:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC10:
	.long	0
	.long	1081606144
	.align 8
.LC11:
	.long	0
	.long	1098907648
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC12:
	.long	1148846080
	.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 <stdio.h>
#include <stdlib.h>
#include <hip/hip_runtime.h>
#include <math.h>
//Problem Size 2^25
#define N 33554432
#define THREADS_PER_BLOCK 128

//This kernel is responsible for the following tasks
//Compute distance between each data point and the cluster centroids
//Based on distance assign the point to the closest cluster
//Count the number of points in each cluster 
__global__ void KMeansClustering(double *centroids,double *data,double *clstr1,double *clstr2,double *clstr3,int n,int *noOfCPoints)
{
//Input data read from the file is of the format as shown below
//x-coordinate,y-coordinate,clusterid
//So each thread is supposed to work on these 3 data 
int tid = (blockIdx.x*blockDim.x +threadIdx.x)*3;
 
if(tid<3*n){
  
   //Index to store the data into one of the clusters
   //Since the cluster arrays are one dimensional, data points are stored as follows in memory
   //[x1,y2,x2,y2,x3,y3....xn,yn]
   //So each thread is responsible for one point (x,y)
   int index = (blockIdx.x*blockDim.x +threadIdx.x)*2;
   //Shared memory array to store the number of points in the clusters
   //All the points in one thread block will update in this shared memory
   //Since the atomic operations on the shared memory are faster than the global memory
   //Similar to Histogram
   //Privatization concept is used
   __shared__ int s_cluster[3];
   //Initialsed the number of points in each cluster to 0
   s_cluster[0] = 0;
   s_cluster[1] = 0;
   s_cluster[2] = 0;
   //Syncronisations so that all the threads in the block
   //dont overwrite each others changes
   __syncthreads();
  
   //Storing the data point in the register
   //so as to avoid multiple global memory access
   double data_x = data[tid];
   double data_y = data[tid+1];
 
   //A cluster pointer array, to point to start
   //of each cluster
   double *cluster[3];
   
   //Calculating distance of the data point from each of the cluster
   double d_1 = pow(data_x-centroids[0],2)+pow(data_y-centroids[1],2);
   double d_2 = pow(data_x-centroids[2],2)+pow(data_y-centroids[3],2);
   double d_3 = pow(data_x-centroids[4],2)+pow(data_y-centroids[5],2);
   
   //Initialising the cluster pointer array
   cluster[0] = clstr1;
   cluster[1] = clstr2;
   cluster[2] = clstr3;

   //Using the ternary operator to find the closest cluster
   //Nested If else blocks result in a lot of control divergence
   int clusterIndex = d_1 > d_2 ? d_2 > d_3 ? 2 : 1  : d_1 < d_3 ? 0: 2 ;    
   
   //based on the clusterindex obtained
   //assign the point the corresponding cluster 
   for(int i=0;i<3;i++){
      if(i!=clusterIndex){ 
        double * clusterPtr = cluster[i];
        clusterPtr[index]   = 0.0;
        clusterPtr[index+1] = 0.0;
      }else{
        double * clusterPtr = cluster[clusterIndex];
        clusterPtr[index] = data_x;
        clusterPtr[index+1] = data_y;
      }
   }
   
   //Increment the counter in the shared memory
   //corresponding to the cluster to which point is assigned
   atomicAdd(&s_cluster[clusterIndex],1);
   //Synchronisation is required so that all the threads 
   //in the block have finished incrementing the number of points
   //in the correct cluster
   //before updating the global memory with the final value of each block
   __syncthreads();
   
   //Update the global memory with the count of points in a particular cluster
   //which is done by 3 threads in each block since we have 3 clusters
   //one warp in each block will be in control divergence due to this
    if(threadIdx.x < 3){
      atomicAdd(&noOfCPoints[threadIdx.x],s_cluster[threadIdx.x]);     
    }
   }
}
 

//This kernel is responsible for in place
//reduction of all the clusters to perform sum of all
//points in a particular cluster
__global__ void sumCluster(double *cluster1,double *cluster2,double *cluster3,int n){
//Each thread works on a 2 dimensional point (x,y)
int tid = (blockIdx.x*blockDim.x +threadIdx.x)*2;

//Shared memory to store the partial sum of each of clusters
//Shared memory is faster than the main memory hence time will be lesser
//There are 3 clusters so 3 array in shared memory
__shared__ double shared_data_1[THREADS_PER_BLOCK*2];
__shared__ double shared_data_2[THREADS_PER_BLOCK*2];
__shared__ double shared_data_3[THREADS_PER_BLOCK*2];
 
if(tid < n){ 
//Initiliase the shared memory with the data
//from the global memory
shared_data_1[2*threadIdx.x] = cluster1[tid];
shared_data_1[2*threadIdx.x+1] = cluster1[tid+1];
 
shared_data_2[2*threadIdx.x] = cluster2[tid];
shared_data_2[2*threadIdx.x+1] = cluster2[tid+1];
 
shared_data_3[2*threadIdx.x] = cluster3[tid];
shared_data_3[2*threadIdx.x+1] = cluster3[tid+1];
__syncthreads();
}
 
  //Making use of sequential addressing
  //which gives coalsced memory access, eliminates bank conflict
  //and reduces control divergence
  //Since each thread processes a point (x,y)
  //stride is intialised to blockDim instead of blockDim/2 
  int stride = blockDim.x; 
  while((stride >= 2) && (threadIdx.x < stride/2)){
   
    shared_data_1[2*threadIdx.x] += shared_data_1[2*threadIdx.x+stride];
    //addition for y
    shared_data_1[2*threadIdx.x+1]+=shared_data_1[2*threadIdx.x+stride+1];   
    
    //addition for x
    shared_data_2[2*threadIdx.x]+=shared_data_2[2*threadIdx.x+stride];
    //addition for y
    shared_data_2[2*threadIdx.x+1]+=shared_data_2[2*threadIdx.x+stride+1];
 
    //addition for x
    shared_data_3[2*threadIdx.x]+=shared_data_3[2*threadIdx.x+stride];
    //addition for y
    shared_data_3[2*threadIdx.x+1]+=shared_data_3[2*threadIdx.x+stride+1];
    //synchronisation to ensure all the threads have finished
    //before going to the next stride value
    __syncthreads();
    //Using right shift operator instead of divide
    //since it is faster
    stride =  stride>>1;
  }
 
//One thread from each block write the partial sum into
//the global memory
//This kernel is called again and again until one block
//is required to do the sum
if(threadIdx.x == 0){
  cluster1[blockIdx.x*2] = shared_data_1[threadIdx.x];
  cluster1[blockIdx.x*2+1] = shared_data_1[threadIdx.x+1];
 
  cluster2[blockIdx.x*2] = shared_data_2[threadIdx.x];
  cluster2[blockIdx.x*2+1] = shared_data_2[threadIdx.x+1];
 
  cluster3[blockIdx.x*2] = shared_data_3[threadIdx.x];
  cluster3[blockIdx.x*2+1] = shared_data_3[threadIdx.x+1];

}
}

//Function to check if any cuda errors have occured
void checkCudaError(hipError_t error,int lineNo){
      if (error !=hipSuccess) {
        printf("%s in %s at line %d\n", hipGetErrorString(error),__FILE__,lineNo);
        exit(EXIT_FAILURE);
     }
 
}
 
int main(int argc, char *argv[]) {
    //Select the first gpu device
    hipSetDevice(0);
    //Read data from the file
    FILE *inFile = fopen("33554432_CLUSTER_DATA.csv", "r");
    if(inFile == NULL){
        printf("Unable to read the data from the file");
        exit(1);
    }
    
    //Host memory allocation for data 
    double *host_data = (double *)malloc(sizeof(double)*N*3);
    //CUDA memory allocation for data
    double *dev_data;
    hipError_t error = hipMalloc(&dev_data,N*3*sizeof(double));
    checkCudaError(error,__LINE__-1);
    //Initialise the host data from the valies in the file
    for(int i =0;i<N;i++){
        fscanf(inFile, "%lf,%lf,%lf\n", &host_data[i*3],&host_data[i*3+1],&host_data[i*3+2]);
    }
   
   //Host memory allocation for the clusters
   double *host_cluster_1 = (double *)calloc(N*2,sizeof(double));
   double *host_cluster_2 = (double *)calloc(N*2,sizeof(double));
   double *host_cluster_3 = (double *)calloc(N*2,sizeof(double));
   
   //CUDA memory allocation for the clusters
   double *dev_c_1;
   double *dev_c_2;
   double *dev_c_3;
   error = hipMalloc((void**)&dev_c_1,N*2*sizeof(double));
   checkCudaError(error,__LINE__-1);
   error = hipMalloc((void**)&dev_c_2,N*2*sizeof(double));
   checkCudaError(error,__LINE__-1);
   error = hipMalloc((void**)&dev_c_3,N*2*sizeof(double));
   checkCudaError(error,__LINE__-1);
   
   //memory allocation to store the cluster centroids
   double* host_centroids = (double*)malloc(6*sizeof(double));
   double* dev_centroids;
   error = hipMalloc((void**)&dev_centroids,6*sizeof(double));
   checkCudaError(error,__LINE__-1);  
   //Randomly initialising K centroids for the clusters
   srand(29);
 
   int index1 = (rand() % N )*3;
  
   host_centroids[0] = host_data[index1];
   host_centroids[1] = host_data[index1+1];
   int index2 = (rand() % N)*3;
  
   host_centroids[2] = host_data[index2];
   host_centroids[3] = host_data[index2+1];
   int index3 = (rand() % N)*3;
   
   host_centroids[4] = host_data[index3];
   host_centroids[5] = host_data[index3+1];
 
   printf("Initial Centroid Estimate\n");
   for(int i=0;i<=4;i+=2){
          printf("centroid[%d][0] = %lf centroid[%d][1] = %lf\n",i,host_centroids[i],i,host_centroids[i+1]);
   }
   
   error = hipMemcpy(dev_data,host_data,N*3*sizeof(double),hipMemcpyHostToDevice);
   checkCudaError(error,__LINE__-1);
   
   int *h_noOfCPoints = (int*)calloc(3,sizeof(int));
   int *c_noOfCPoints;
   error = hipMalloc((void**)&c_noOfCPoints,3*sizeof(int));
   checkCudaError(error,__LINE__-1);
   error = hipMemcpy(c_noOfCPoints,h_noOfCPoints,3*sizeof(int),hipMemcpyHostToDevice);
   checkCudaError(error,__LINE__-1);
 
   hipEvent_t start, stop;
   hipEventCreate(&start);
   hipEventCreate(&stop);
   hipEventRecord(start);
   
   double previous_centroids[6];
  //To count the number of itaerations required to converge 
  int noOfIterations = 0;
   while(1){
   noOfIterations++;
   //Keep a copy of centroids of previous iterations
   //So as to compare later
   for(int i=0;i<6;i++){
       previous_centroids[i] = host_centroids[i] ;
   }
   //transfer the centroids to gpu
   error = hipMemcpy(dev_centroids,host_centroids,6*sizeof(double),hipMemcpyHostToDevice);
   checkCudaError(error,__LINE__-1);
   for(int i=0;i<3;i++){
       h_noOfCPoints[i] = 0 ;
   }
   //transfer the number of points in each cluster to gpu 
   error = hipMemcpy(c_noOfCPoints,h_noOfCPoints,3*sizeof(int),hipMemcpyHostToDevice);
   checkCudaError(error,__LINE__-1);
   
   //kernel computes distance and assign the data points to one of the clusters
   KMeansClustering<<<N/THREADS_PER_BLOCK,THREADS_PER_BLOCK>>>(dev_centroids,dev_data,dev_c_1,dev_c_2,dev_c_3,N,c_noOfCPoints);
   error = hipGetLastError();
   checkCudaError(error,__LINE__-2);
   //get the number of points in each cluster to cpu
   error = hipMemcpy(h_noOfCPoints,c_noOfCPoints,3*sizeof(int),hipMemcpyDeviceToHost);
   checkCudaError(error,__LINE__-1);
   printf("\ncluster points %d %d %d\n",h_noOfCPoints[0],h_noOfCPoints[1],h_noOfCPoints[2]);  
   int blockSize = THREADS_PER_BLOCK;
   int temp = N;
   
   //repeatedly call the reduction kernel
   //so as to compute sum of all points in each cluster
   while(1){
   
      if(temp>blockSize){        
          sumCluster<<<temp/blockSize,blockSize>>>(dev_c_1,dev_c_2,dev_c_3,temp*2);
          error = hipGetLastError();
          checkCudaError(error,__LINE__-2);
      }
      //If only 32 values are there only one block is enough of 32 threads required
      else if (temp >= 32){
          sumCluster<<<1,temp>>>(dev_c_1,dev_c_2,dev_c_3,temp*2);
          error = hipGetLastError();
          //printf("%d,%d\n",temp,blockSize);
          checkCudaError(error,__LINE__-2);
          break;
      }
      else{//if less than 32 items to be added
           //add them serially
          error = hipMemcpy(host_cluster_1,dev_c_1,temp*2*sizeof(double),hipMemcpyDeviceToHost);
          checkCudaError(error,__LINE__-1);
          error = hipMemcpy(host_cluster_2,dev_c_2,temp*2*sizeof(double),hipMemcpyDeviceToHost);
          checkCudaError(error,__LINE__-1);
          error = hipMemcpy(host_cluster_3,dev_c_3,temp*2*sizeof(double),hipMemcpyDeviceToHost);
          checkCudaError(error,__LINE__-1);
          for(int i = 1 ; i < temp ; i++){
              host_cluster_1[0] += host_cluster_1[2*i];
              host_cluster_1[1] += host_cluster_1[2*i+1];
              host_cluster_2[0] += host_cluster_2[2*i];
              host_cluster_2[1] += host_cluster_2[2*i+1];
              host_cluster_3[0] += host_cluster_3[2*i];
              host_cluster_3[1] += host_cluster_3[2*i+1];       
          }
        break;    
      }
     if(temp > blockSize){
     temp = temp/blockSize;
     }      
   }
   //transfer the sum calculated to the host
   if(temp>=32){
       error = hipMemcpy(host_cluster_1,dev_c_1,2*sizeof(double),hipMemcpyDeviceToHost);
       checkCudaError(error,__LINE__-1);
       error = hipMemcpy(host_cluster_2,dev_c_2,2*sizeof(double),hipMemcpyDeviceToHost);
       checkCudaError(error,__LINE__-1);
       error = hipMemcpy(host_cluster_3,dev_c_3,2*sizeof(double),hipMemcpyDeviceToHost);
       checkCudaError(error,__LINE__-1);       
   }
     

   double sumXcluster1 = host_cluster_1[0];
   double sumYcluster1 = host_cluster_1[1];
 
   double sumXcluster2 = host_cluster_2[0];
   double sumYcluster2 = host_cluster_2[1];
 
   double sumXcluster3 = host_cluster_3[0];
   double sumYcluster3 = host_cluster_3[1];
    
   //compute the centroids by dividing the sum of points in each
   //cluster by the total no of points in each cluster
   host_centroids[0] = sumXcluster1/(double)h_noOfCPoints[0];
   host_centroids[1] = sumYcluster1/(double)h_noOfCPoints[0];
 
   host_centroids[2] = sumXcluster2/(double)h_noOfCPoints[1];
   host_centroids[3] = sumYcluster2/(double)h_noOfCPoints[1];
 
   host_centroids[4] = sumXcluster3/(double)h_noOfCPoints[2];
   host_centroids[5] = sumYcluster3/(double)h_noOfCPoints[2];
   
   for(int i=0;i<=4;i+=2){
      printf("centroid[%d][0] = %lf centroid[%d][1] = %lf\n",i,host_centroids[i],i,host_centroids[i+1]);
   }
   int count = 0;
   //if all the centroids are same as in previous iteration
   //algorithm has converged
   for(int i=0;i<6;i++){
      if(host_centroids[i] != previous_centroids[i]){
        break;
      }
      count++;
   }
   if(count == 6){
     break;
   }
 }
   hipEventRecord(stop);
   hipEventSynchronize(stop);
   float milliseconds = 0;
   hipEventElapsedTime(&milliseconds, start, stop);
   for(int i=0;i<=4;i+=2){
      printf("centroid[%d][0] = %lf centroid[%d][1] = %lf\n",i,host_centroids[i],i,host_centroids[i+1]);
   }
   
   //Total no computations for one iteration
   //16 * N for kernel 1
   //2 * N for kernel 2
   double throughput = (24  *sizeof(double)* 2.0 * noOfIterations) *N/(1000*milliseconds);
   printf("\nThroughput is %lf MFLOPS",throughput);
   printf("\nTime is %f ms\n",milliseconds);

  return 0; 
}
 
 



	.text
	.file	"parallelKmeansv3.hip"
	.globl	_Z31__device_stub__KMeansClusteringPdS_S_S_S_iPi # -- Begin function _Z31__device_stub__KMeansClusteringPdS_S_S_S_iPi
	.type	_Z31__device_stub__KMeansClusteringPdS_S_S_S_iPi,@function
_Z31__device_stub__KMeansClusteringPdS_S_S_S_iPi: # @_Z31__device_stub__KMeansClusteringPdS_S_S_S_iPi
	.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	$160, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	4(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	208(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z16KMeansClusteringPdS_S_S_S_iPi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z31__device_stub__KMeansClusteringPdS_S_S_S_iPi, .Lfunc_end0-_Z31__device_stub__KMeansClusteringPdS_S_S_S_iPi
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__sumClusterPdS_S_i # -- Begin function _Z25__device_stub__sumClusterPdS_S_i
	.type	_Z25__device_stub__sumClusterPdS_S_i,@function
_Z25__device_stub__sumClusterPdS_S_i:   # @_Z25__device_stub__sumClusterPdS_S_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	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	$_Z10sumClusterPdS_S_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z25__device_stub__sumClusterPdS_S_i, .Lfunc_end1-_Z25__device_stub__sumClusterPdS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z14checkCudaError10hipError_ti # -- Begin function _Z14checkCudaError10hipError_ti
	.type	_Z14checkCudaError10hipError_ti,@function
_Z14checkCudaError10hipError_ti:        # @_Z14checkCudaError10hipError_ti
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jne	.LBB2_2
# %bb.1:
	retq
.LBB2_2:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	%esi, %ebx
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movl	$.L.str.1, %edx
	movq	%rax, %rsi
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end2:
	.size	_Z14checkCudaError10hipError_ti, .Lfunc_end2-_Z14checkCudaError10hipError_ti
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI3_0:
	.quad	0x4078000000000000              # double 384
.LCPI3_1:
	.quad	0x4180000000000000              # double 33554432
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI3_2:
	.long	0x447a0000                      # float 1000
	.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	$168, %rsp
	.cfi_def_cfa_offset 224
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	xorl	%edi, %edi
	callq	hipSetDevice
	movl	$.L.str.2, %edi
	movl	$.L.str.3, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB3_23
# %bb.1:
	movq	%rax, %rbx
	movl	$805306368, %edi                # imm = 0x30000000
	callq	malloc
	movq	%rax, %rbp
	leaq	80(%rsp), %rdi
	movl	$805306368, %esi                # imm = 0x30000000
	callq	hipMalloc
	movl	%eax, %edi
	movl	$194, %esi
	callq	_Z14checkCudaError10hipError_ti
	movl	$33554432, %r15d                # imm = 0x2000000
	movq	%rbp, %r14
.LBB3_2:                                # =>This Inner Loop Header: Depth=1
	leaq	8(%r14), %rcx
	leaq	16(%r14), %r8
	movl	$.L.str.5, %esi
	movq	%rbx, %rdi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	addq	$24, %r14
	decq	%r15
	jne	.LBB3_2
# %bb.3:
	movl	$67108864, %edi                 # imm = 0x4000000
	movl	$8, %esi
	callq	calloc
	movq	%rax, %rbx
	movl	$67108864, %edi                 # imm = 0x4000000
	movl	$8, %esi
	callq	calloc
	movq	%rax, %r14
	movl	$67108864, %edi                 # imm = 0x4000000
	movl	$8, %esi
	callq	calloc
	movq	%rax, %r15
	leaq	56(%rsp), %rdi
	movl	$536870912, %esi                # imm = 0x20000000
	callq	hipMalloc
	movl	%eax, %edi
	movl	$210, %esi
	callq	_Z14checkCudaError10hipError_ti
	leaq	48(%rsp), %rdi
	movl	$536870912, %esi                # imm = 0x20000000
	callq	hipMalloc
	movl	%eax, %edi
	movl	$212, %esi
	callq	_Z14checkCudaError10hipError_ti
	leaq	40(%rsp), %rdi
	movl	$536870912, %esi                # imm = 0x20000000
	callq	hipMalloc
	movl	%eax, %edi
	movl	$214, %esi
	callq	_Z14checkCudaError10hipError_ti
	movl	$48, %edi
	callq	malloc
	movq	%rax, %r12
	leaq	72(%rsp), %rdi
	movl	$48, %esi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$220, %esi
	callq	_Z14checkCudaError10hipError_ti
	movl	$29, %edi
	callq	srand
	callq	rand
                                        # kill: def $eax killed $eax def $rax
	movl	$33554431, %r13d                # imm = 0x1FFFFFF
	leal	(%rax,%r13), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	movl	$-33554432, %edx                # imm = 0xFE000000
	andl	%edx, %ecx
	subl	%ecx, %eax
	leal	(%rax,%rax,2), %eax
	cltq
	movsd	(%rbp,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, (%r12)
	movsd	8(%rbp,%rax,8), %xmm0           # xmm0 = mem[0],zero
	movsd	%xmm0, 8(%r12)
	callq	rand
                                        # kill: def $eax killed $eax def $rax
	leal	(%rax,%r13), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	movl	$-33554432, %edx                # imm = 0xFE000000
	andl	%edx, %ecx
	subl	%ecx, %eax
	leal	(%rax,%rax,2), %eax
	cltq
	movsd	(%rbp,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, 16(%r12)
	movsd	8(%rbp,%rax,8), %xmm0           # xmm0 = mem[0],zero
	movsd	%xmm0, 24(%r12)
	callq	rand
                                        # kill: def $eax killed $eax def $rax
	addl	%eax, %r13d
	testl	%eax, %eax
	cmovnsl	%eax, %r13d
	movl	$-33554432, %ecx                # imm = 0xFE000000
	andl	%ecx, %r13d
	subl	%r13d, %eax
	leal	(%rax,%rax,2), %eax
	cltq
	movsd	(%rbp,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, 32(%r12)
	movsd	8(%rbp,%rax,8), %xmm0           # xmm0 = mem[0],zero
	movsd	%xmm0, 40(%r12)
	movl	$.Lstr, %edi
	callq	puts@PLT
	xorl	%r13d, %r13d
.LBB3_4:                                # =>This Inner Loop Header: Depth=1
	movsd	(%r12,%r13,8), %xmm0            # xmm0 = mem[0],zero
	movsd	8(%r12,%r13,8), %xmm1           # xmm1 = mem[0],zero
	movl	$.L.str.7, %edi
	movl	%r13d, %esi
	movl	%r13d, %edx
	movb	$2, %al
	callq	printf
	leaq	2(%r13), %rax
	cmpq	$3, %r13
	movq	%rax, %r13
	jb	.LBB3_4
# %bb.5:
	movq	80(%rsp), %rdi
	movl	$805306368, %edx                # imm = 0x30000000
	movq	%rbp, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$243, %esi
	callq	_Z14checkCudaError10hipError_ti
	movl	$3, %edi
	movl	$4, %esi
	callq	calloc
	movq	%rax, %r13
	leaq	32(%rsp), %rbp
	movl	$12, %esi
	movq	%rbp, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$248, %esi
	callq	_Z14checkCudaError10hipError_ti
	movq	(%rbp), %rdi
	movl	$12, %edx
	movq	%r13, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$250, %esi
	callq	_Z14checkCudaError10hipError_ti
	leaq	104(%rsp), %rbp
	movq	%rbp, %rdi
	callq	hipEventCreate
	leaq	24(%rsp), %rdi
	callq	hipEventCreate
	movq	(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movabsq	$4294967424, %rax               # imm = 0x100000080
	addq	$262016, %rax                   # imm = 0x3FF80
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	xorl	%ebp, %ebp
	movq	%r13, 96(%rsp)                  # 8-byte Spill
.LBB3_6:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_9 Depth 2
                                        #     Child Loop BB3_13 Depth 2
                                        #     Child Loop BB3_15 Depth 2
                                        #     Child Loop BB3_17 Depth 2
	movupd	(%r12), %xmm0
	movupd	16(%r12), %xmm1
	movupd	32(%r12), %xmm2
	movapd	%xmm2, 144(%rsp)
	movapd	%xmm1, 128(%rsp)
	movapd	%xmm0, 112(%rsp)
	movq	72(%rsp), %rdi
	movl	$48, %edx
	movq	%r12, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$269, %esi                      # imm = 0x10D
	callq	_Z14checkCudaError10hipError_ti
	movl	$0, 8(%r13)
	movq	$0, (%r13)
	movq	32(%rsp), %rdi
	movl	$12, %edx
	movq	%r13, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$275, %esi                      # imm = 0x113
	callq	_Z14checkCudaError10hipError_ti
	movq	88(%rsp), %rdi                  # 8-byte Reload
	movl	$1, %esi
	movabsq	$4294967424, %rdx               # imm = 0x100000080
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_8
# %bb.7:                                #   in Loop: Header=BB3_6 Depth=1
	movq	72(%rsp), %rdi
	movq	80(%rsp), %rsi
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rcx
	movq	40(%rsp), %r8
	movq	32(%rsp), %rax
	movq	%rax, (%rsp)
	movl	$33554432, %r9d                 # imm = 0x2000000
	callq	_Z31__device_stub__KMeansClusteringPdS_S_S_S_iPi
.LBB3_8:                                #   in Loop: Header=BB3_6 Depth=1
	incl	%ebp
	movl	%ebp, 68(%rsp)                  # 4-byte Spill
	callq	hipGetLastError
	movl	%eax, %edi
	movl	$279, %esi                      # imm = 0x117
	callq	_Z14checkCudaError10hipError_ti
	movq	32(%rsp), %rsi
	movl	$12, %edx
	movq	%r13, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$283, %esi                      # imm = 0x11B
	callq	_Z14checkCudaError10hipError_ti
	movl	(%r13), %esi
	movl	4(%r13), %edx
	movl	8(%r13), %ecx
	movl	$.L.str.8, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$33554432, %ebp                 # imm = 0x2000000
	movl	$33554432, %r13d                # imm = 0x2000000
.LBB3_9:                                #   Parent Loop BB3_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	shrl	$7, %r13d
	movabsq	$4294967424, %rdx               # imm = 0x100000080
	leaq	(%rdx,%r13), %rdi
	addq	$-128, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_11
# %bb.10:                               #   in Loop: Header=BB3_9 Depth=2
	movq	56(%rsp), %rdi
	movq	48(%rsp), %rsi
	movq	40(%rsp), %rdx
	leal	(,%rbp,2), %ecx
	callq	_Z25__device_stub__sumClusterPdS_S_i
.LBB3_11:                               #   in Loop: Header=BB3_9 Depth=2
	callq	hipGetLastError
	movl	%eax, %edi
	movl	$294, %esi                      # imm = 0x126
	callq	_Z14checkCudaError10hipError_ti
	cmpl	$16511, %ebp                    # imm = 0x407F
	movl	%r13d, %ebp
	ja	.LBB3_9
# %bb.12:                               # %.lr.ph
                                        #   in Loop: Header=BB3_6 Depth=1
	movq	56(%rsp), %rsi
	movl	$256, %edx                      # imm = 0x100
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$308, %esi                      # imm = 0x134
	callq	_Z14checkCudaError10hipError_ti
	movq	48(%rsp), %rsi
	movl	$256, %edx                      # imm = 0x100
	movq	%r14, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$310, %esi                      # imm = 0x136
	callq	_Z14checkCudaError10hipError_ti
	movq	40(%rsp), %rsi
	movl	$256, %edx                      # imm = 0x100
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$312, %esi                      # imm = 0x138
	callq	_Z14checkCudaError10hipError_ti
	movsd	(%rbx), %xmm5                   # xmm5 = mem[0],zero
	movsd	8(%rbx), %xmm4                  # xmm4 = mem[0],zero
	movsd	(%r14), %xmm3                   # xmm3 = mem[0],zero
	movsd	8(%r14), %xmm2                  # xmm2 = mem[0],zero
	movsd	(%r15), %xmm1                   # xmm1 = mem[0],zero
	movsd	8(%r15), %xmm0                  # xmm0 = mem[0],zero
	movl	$24, %eax
.LBB3_13:                               #   Parent Loop BB3_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	addsd	-8(%rbx,%rax), %xmm5
	addsd	(%rbx,%rax), %xmm4
	addsd	-8(%r14,%rax), %xmm3
	addsd	(%r14,%rax), %xmm2
	addsd	-8(%r15,%rax), %xmm1
	addsd	(%r15,%rax), %xmm0
	addq	$16, %rax
	cmpq	$264, %rax                      # imm = 0x108
	jne	.LBB3_13
# %bb.14:                               #   in Loop: Header=BB3_6 Depth=1
	movsd	%xmm5, (%rbx)
	movsd	%xmm4, 8(%rbx)
	movsd	%xmm3, (%r14)
	movsd	%xmm2, 8(%r14)
	movsd	%xmm1, (%r15)
	movsd	%xmm0, 8(%r15)
	movq	96(%rsp), %r13                  # 8-byte Reload
	cvtsi2sdl	(%r13), %xmm6
	divsd	%xmm6, %xmm5
	movsd	%xmm5, (%r12)
	divsd	%xmm6, %xmm4
	xorps	%xmm5, %xmm5
	cvtsi2sdl	4(%r13), %xmm5
	movsd	%xmm4, 8(%r12)
	divsd	%xmm5, %xmm3
	movsd	%xmm3, 16(%r12)
	divsd	%xmm5, %xmm2
	movsd	%xmm2, 24(%r12)
	xorps	%xmm2, %xmm2
	cvtsi2sdl	8(%r13), %xmm2
	divsd	%xmm2, %xmm1
	movsd	%xmm1, 32(%r12)
	divsd	%xmm2, %xmm0
	movsd	%xmm0, 40(%r12)
	xorl	%ebp, %ebp
.LBB3_15:                               #   Parent Loop BB3_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%r12,%rbp,8), %xmm0            # xmm0 = mem[0],zero
	movsd	8(%r12,%rbp,8), %xmm1           # xmm1 = mem[0],zero
	movl	$.L.str.7, %edi
	movl	%ebp, %esi
	movl	%ebp, %edx
	movb	$2, %al
	callq	printf
	leaq	2(%rbp), %rax
	cmpq	$3, %rbp
	movq	%rax, %rbp
	jb	.LBB3_15
# %bb.16:                               # %.preheader.preheader
                                        #   in Loop: Header=BB3_6 Depth=1
	xorl	%eax, %eax
	movl	68(%rsp), %ebp                  # 4-byte Reload
.LBB3_17:                               # %.preheader
                                        #   Parent Loop BB3_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%r12,%rax,8), %xmm0            # xmm0 = mem[0],zero
	ucomisd	112(%rsp,%rax,8), %xmm0
	jne	.LBB3_19
	jp	.LBB3_19
# %bb.18:                               #   in Loop: Header=BB3_17 Depth=2
	incq	%rax
	cmpq	$6, %rax
	jne	.LBB3_17
	jmp	.LBB3_20
.LBB3_19:                               #   in Loop: Header=BB3_6 Depth=1
	cmpq	$6, %rax
	jne	.LBB3_6
.LBB3_20:                               # %.thread
	movq	24(%rsp), %rdi
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	24(%rsp), %rdi
	callq	hipEventSynchronize
	leaq	20(%rsp), %rdi
	movl	$0, (%rdi)
	movq	104(%rsp), %rsi
	movq	24(%rsp), %rdx
	callq	hipEventElapsedTime
.LBB3_21:                               # =>This Inner Loop Header: Depth=1
	movsd	(%r12,%rbx,8), %xmm0            # xmm0 = mem[0],zero
	movsd	8(%r12,%rbx,8), %xmm1           # xmm1 = mem[0],zero
	movl	$.L.str.7, %edi
	movl	%ebx, %esi
	movl	%ebx, %edx
	movb	$2, %al
	callq	printf
	leaq	2(%rbx), %rax
	cmpq	$3, %rbx
	movq	%rax, %rbx
	jb	.LBB3_21
# %bb.22:
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ebp, %xmm0
	mulsd	.LCPI3_0(%rip), %xmm0
	mulsd	.LCPI3_1(%rip), %xmm0
	movss	20(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	mulss	.LCPI3_2(%rip), %xmm1
	cvtss2sd	%xmm1, %xmm1
	divsd	%xmm1, %xmm0
	movl	$.L.str.9, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	20(%rsp), %xmm0
	movl	$.L.str.10, %edi
	movb	$1, %al
	callq	printf
	xorl	%eax, %eax
	addq	$168, %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
.LBB3_23:
	.cfi_def_cfa_offset 224
	movl	$.L.str.4, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z16KMeansClusteringPdS_S_S_S_iPi, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10sumClusterPdS_S_i, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__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	.LBB5_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
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z16KMeansClusteringPdS_S_S_S_iPi,@object # @_Z16KMeansClusteringPdS_S_S_S_iPi
	.section	.rodata,"a",@progbits
	.globl	_Z16KMeansClusteringPdS_S_S_S_iPi
	.p2align	3, 0x0
_Z16KMeansClusteringPdS_S_S_S_iPi:
	.quad	_Z31__device_stub__KMeansClusteringPdS_S_S_S_iPi
	.size	_Z16KMeansClusteringPdS_S_S_S_iPi, 8

	.type	_Z10sumClusterPdS_S_i,@object   # @_Z10sumClusterPdS_S_i
	.globl	_Z10sumClusterPdS_S_i
	.p2align	3, 0x0
_Z10sumClusterPdS_S_i:
	.quad	_Z25__device_stub__sumClusterPdS_S_i
	.size	_Z10sumClusterPdS_S_i, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%s in %s at line %d\n"
	.size	.L.str, 21

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/bhshri/Parallel_Computing/master/parallelKmeansv3.hip"
	.size	.L.str.1, 116

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"33554432_CLUSTER_DATA.csv"
	.size	.L.str.2, 26

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

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Unable to read the data from the file"
	.size	.L.str.4, 38

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"%lf,%lf,%lf\n"
	.size	.L.str.5, 13

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"centroid[%d][0] = %lf centroid[%d][1] = %lf\n"
	.size	.L.str.7, 45

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"\ncluster points %d %d %d\n"
	.size	.L.str.8, 26

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"\nThroughput is %lf MFLOPS"
	.size	.L.str.9, 26

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"\nTime is %f ms\n"
	.size	.L.str.10, 16

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z16KMeansClusteringPdS_S_S_S_iPi"
	.size	.L__unnamed_1, 34

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z10sumClusterPdS_S_i"
	.size	.L__unnamed_2, 22

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

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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"Initial Centroid Estimate"
	.size	.Lstr, 26

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z16KMeansClusteringPdS_S_S_S_iPi ; -- Begin function _Z16KMeansClusteringPdS_S_S_S_iPi
	.globl	_Z16KMeansClusteringPdS_S_S_S_iPi
	.p2align	8
	.type	_Z16KMeansClusteringPdS_S_S_S_iPi,@function
_Z16KMeansClusteringPdS_S_S_S_iPi:      ; @_Z16KMeansClusteringPdS_S_S_S_iPi
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x44
	s_load_b32 s3, s[0:1], 0x28
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_mul_i32 s3, s3, 3
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshl_add_u32 v4, v1, 1, v1
	v_cmpx_gt_i32_e64 s3, v4
	s_cbranch_execz .LBB0_9
; %bb.1:
	s_clause 0x1
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b64 s[20:21], s[0:1], 0x20
	v_lshlrev_b32_e32 v9, 1, v1
	v_mov_b32_e32 v1, 0
	v_ashrrev_i32_e32 v5, 31, v4
	s_mov_b32 s50, 0x55555555
	s_mov_b32 s51, 0x3fe55555
	s_mov_b32 s56, 0x968915a9
	v_mov_b32_e32 v2, v1
	v_mov_b32_e32 v3, v1
	s_mov_b32 s58, 0x4222de17
	s_mov_b32 s57, 0x3fba6564
	s_mov_b32 s59, 0x3fbdee67
	s_mov_b32 s60, 0x3abe935a
	ds_store_b96 v1, v[1:3]
	v_lshlrev_b64 v[2:3], 3, v[4:5]
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_mov_b32 s74, 0xfefa39ef
	s_mov_b32 s61, 0x3fbe25e4
	v_add_co_u32 v2, vcc_lo, s6, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s7, v3, vcc_lo
	s_mov_b32 s75, 0x3fe62e42
	s_mov_b32 s62, 0x47e6c9c2
	s_mov_b32 s63, 0x3fc110ef
	global_load_b128 v[5:8], v[2:3], off
	s_clause 0x1
	s_load_b256 s[12:19], s[4:5], 0x0
	s_load_b128 s[4:7], s[4:5], 0x20
	s_mov_b32 s64, 0xcfa74449
	s_mov_b32 s76, 0x3b39803f
	s_mov_b32 s65, 0x3fc3b13b
	s_mov_b32 s77, 0x3c7abc9e
	s_mov_b32 s66, 0x71bf3c30
	s_mov_b32 s67, 0x3fc745d1
	s_mov_b32 s68, 0x1c7792ce
	s_mov_b32 s69, 0x3fcc71c7
	s_mov_b32 s70, 0x924920da
	s_mov_b32 s71, 0x3fd24924
	s_mov_b32 s72, 0x9999999c
	s_mov_b32 s73, 0x3fd99999
	s_mov_b32 s55, 0xbfe55555
	s_mov_b32 s54, s50
	s_mov_b32 s52, 0xd5df274d
	s_mov_b32 s53, 0x3c8543b0
	s_mov_b32 s28, 0x652b82fe
	s_mov_b32 s29, 0x3ff71547
	s_mov_b32 s23, 0xbfe62e42
	s_mov_b32 s22, s74
	s_mov_b32 s25, 0xbc7abc9e
	s_mov_b32 s24, s76
	s_mov_b32 s26, 0xfca7ab0c
	s_mov_b32 s30, 0x6a5dcb37
	s_mov_b32 s27, 0x3e928af3
	s_mov_b32 s31, 0x3e5ade15
	s_mov_b32 s34, 0x623fde64
	s_mov_b32 s35, 0x3ec71dee
	s_mov_b32 s36, 0x7c89e6b0
	s_mov_b32 s37, 0x3efa0199
	s_mov_b32 s38, 0x14761f6e
	s_mov_b32 s39, 0x3f2a01a0
	s_mov_b32 s40, 0x1852b7b0
	s_mov_b32 s41, 0x3f56c16c
	s_mov_b32 s42, 0x11122322
	s_mov_b32 s43, 0x3f811111
	s_mov_b32 s44, 0x555502a1
	s_mov_b32 s45, 0x3fa55555
	s_mov_b32 s46, 0x55555511
	s_mov_b32 s47, 0x3fc55555
	s_mov_b32 s48, 11
	s_mov_b32 s49, 0x3fe00000
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_f64 v[2:3], v[5:6], -s[12:13]
	s_mov_b64 s[12:13], 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_frexp_mant_f64_e64 v[10:11], |v[2:3]|
	v_cmp_gt_f64_e32 vcc_lo, s[50:51], v[10:11]
	v_cndmask_b32_e64 v4, 0, 1, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ldexp_f64 v[10:11], v[10:11], v4
	v_frexp_exp_i32_f64_e32 v4, v[2:3]
	v_add_f64 v[14:15], v[10:11], 1.0
	v_add_f64 v[12:13], v[10:11], -1.0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_subrev_co_ci_u32_e32 v4, vcc_lo, 0, v4, vcc_lo
	v_add_f64 v[16:17], v[14:15], -1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_f64 v[10:11], v[10:11], -v[16:17]
	v_rcp_f64_e32 v[16:17], v[14:15]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[18:19], -v[14:15], v[16:17], 1.0
	v_fma_f64 v[16:17], v[18:19], v[16:17], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], -v[14:15], v[16:17], 1.0
	v_fma_f64 v[16:17], v[18:19], v[16:17], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[18:19], v[12:13], v[16:17]
	v_mul_f64 v[20:21], v[14:15], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[14:15], v[18:19], v[14:15], -v[20:21]
	v_fma_f64 v[10:11], v[18:19], v[10:11], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[20:21], v[10:11]
	v_add_f64 v[22:23], v[12:13], -v[14:15]
	v_add_f64 v[20:21], v[14:15], -v[20:21]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[12:13], v[12:13], -v[22:23]
	v_add_f64 v[10:11], v[20:21], -v[10:11]
	v_cvt_f64_i32_e32 v[20:21], v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[12:13], v[12:13], -v[14:15]
	v_add_f64 v[10:11], v[10:11], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_f64 v[10:11], v[22:23], v[10:11]
	v_mul_f64 v[22:23], v[20:21], s[74:75]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f64 v[10:11], v[16:17], v[10:11]
	v_fma_f64 v[24:25], v[20:21], s[74:75], -v[22:23]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[12:13], v[18:19], v[10:11]
	v_fma_f64 v[20:21], v[20:21], s[76:77], v[24:25]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[14:15], v[12:13], -v[18:19]
	v_add_f64 v[24:25], v[22:23], v[20:21]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[10:11], v[10:11], -v[14:15]
	v_mul_f64 v[14:15], v[12:13], v[12:13]
	v_add_f64 v[22:23], v[24:25], -v[22:23]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f64 v[18:19], v[10:11], v[10:11]
	v_fma_f64 v[16:17], v[12:13], v[12:13], -v[14:15]
	v_ldexp_f64 v[26:27], v[10:11], 1
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_add_f64 v[20:21], v[20:21], -v[22:23]
	v_ldexp_f64 v[22:23], v[12:13], 1
	v_fma_f64 v[16:17], v[12:13], v[18:19], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[14:15], v[16:17]
	v_add_f64 v[14:15], v[18:19], -v[14:15]
	v_mul_f64 v[28:29], v[12:13], v[18:19]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[14:15], v[16:17], -v[14:15]
	v_fma_f64 v[16:17], v[18:19], s[58:59], s[56:57]
	v_fma_f64 v[30:31], v[18:19], v[12:13], -v[28:29]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[16:17], v[18:19], v[16:17], s[60:61]
	v_fma_f64 v[10:11], v[18:19], v[10:11], v[30:31]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[16:17], v[18:19], v[16:17], s[62:63]
	v_fma_f64 v[10:11], v[14:15], v[12:13], v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[16:17], v[18:19], v[16:17], s[64:65]
	v_add_f64 v[12:13], v[28:29], v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[16:17], v[18:19], v[16:17], s[66:67]
	v_add_f64 v[28:29], v[12:13], -v[28:29]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[16:17], v[18:19], v[16:17], s[68:69]
	v_add_f64 v[10:11], v[10:11], -v[28:29]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], v[18:19], v[16:17], s[70:71]
	v_fma_f64 v[16:17], v[18:19], v[16:17], s[72:73]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[28:29], v[18:19], v[16:17]
	v_fma_f64 v[18:19], v[18:19], v[16:17], -v[28:29]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[14:15], v[14:15], v[16:17], v[18:19]
	v_add_f64 v[16:17], v[28:29], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[16:17], -v[28:29]
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_add_f64 v[18:19], v[16:17], s[50:51]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[14:15], v[14:15], s[52:53]
	v_add_f64 v[28:29], v[18:19], s[54:55]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[16:17], -v[28:29]
	v_add_f64 v[14:15], v[14:15], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[18:19], v[14:15]
	v_add_f64 v[18:19], v[18:19], -v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[14:15], v[18:19]
	v_mul_f64 v[18:19], v[12:13], v[16:17]
	v_fma_f64 v[28:29], v[12:13], v[16:17], -v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[12:13], v[12:13], v[14:15], v[28:29]
	v_fma_f64 v[10:11], v[10:11], v[16:17], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[12:13], v[18:19], v[10:11]
	v_add_f64 v[14:15], v[12:13], -v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[10:11], v[10:11], -v[14:15]
	v_add_f64 v[14:15], v[22:23], v[12:13]
	v_add_f64 v[10:11], v[26:27], v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[14:15], -v[22:23]
	v_add_f64 v[12:13], v[12:13], -v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[10:11], v[10:11], v[12:13]
	v_add_f64 v[12:13], v[14:15], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[12:13], -v[14:15]
	v_add_f64 v[10:11], v[10:11], -v[14:15]
	v_add_f64 v[14:15], v[24:25], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[14:15], -v[24:25]
	v_add_f64 v[18:19], v[14:15], -v[16:17]
	v_add_f64 v[12:13], v[12:13], -v[16:17]
	v_add_f64 v[16:17], v[20:21], v[10:11]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[24:25], -v[18:19]
	v_add_f64 v[12:13], v[12:13], v[18:19]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[18:19], v[16:17], -v[20:21]
	v_add_f64 v[12:13], v[16:17], v[12:13]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[22:23], v[16:17], -v[18:19]
	v_add_f64 v[10:11], v[10:11], -v[18:19]
	v_add_f64 v[16:17], v[14:15], v[12:13]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[20:21], v[20:21], -v[22:23]
	v_add_f64 v[14:15], v[16:17], -v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[10:11], v[10:11], v[20:21]
	v_add_f64 v[12:13], v[12:13], -v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[10:11], v[10:11], v[12:13]
	v_add_f64 v[12:13], v[16:17], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[12:13], -v[16:17]
	v_add_f64 v[10:11], v[10:11], -v[14:15]
	v_add_f64 v[14:15], v[12:13], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[12:13], v[12:13], 2.0, -v[14:15]
	v_cmp_class_f64_e64 vcc_lo, v[14:15], 0x204
	v_fma_f64 v[10:11], v[10:11], 2.0, v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[12:13], v[14:15], v[10:11]
	v_add_f64 v[16:17], v[12:13], -v[14:15]
	v_dual_cndmask_b32 v13, v13, v15 :: v_dual_cndmask_b32 v12, v12, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_4)
	v_mul_f64 v[14:15], v[12:13], s[28:29]
	v_cmp_neq_f64_e64 vcc_lo, 0x7ff00000, |v[12:13]|
	v_cmp_ngt_f64_e64 s2, 0xc090cc00, v[12:13]
	v_add_f64 v[10:11], v[10:11], -v[16:17]
	v_rndne_f64_e32 v[14:15], v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_dual_cndmask_b32 v11, 0, v11 :: v_dual_cndmask_b32 v10, 0, v10
	v_cmp_nlt_f64_e32 vcc_lo, 0x40900000, v[12:13]
	v_fma_f64 v[16:17], v[14:15], s[22:23], v[12:13]
	v_cvt_i32_f64_e32 v4, v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], v[14:15], s[24:25], v[16:17]
	v_fma_f64 v[18:19], v[16:17], s[30:31], s[26:27]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[16:17], v[18:19], s[34:35]
	v_fma_f64 v[18:19], v[16:17], v[18:19], s[36:37]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[16:17], v[18:19], s[38:39]
	v_fma_f64 v[18:19], v[16:17], v[18:19], s[40:41]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[16:17], v[18:19], s[42:43]
	v_fma_f64 v[18:19], v[16:17], v[18:19], s[44:45]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[16:17], v[18:19], s[46:47]
	v_fma_f64 v[18:19], v[16:17], v[18:19], s[48:49]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[16:17], v[18:19], 1.0
	v_fma_f64 v[16:17], v[16:17], v[18:19], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ldexp_f64 v[14:15], v[16:17], v4
	v_cndmask_b32_e32 v4, 0x7ff00000, v15, vcc_lo
	s_and_b32 vcc_lo, s2, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v12, 0, v14, vcc_lo
	v_cndmask_b32_e64 v13, 0, v4, s2
	v_cmp_neq_f64_e64 s2, 0, v[2:3]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[10:11], v[12:13], v[10:11], v[12:13]
	v_cmp_class_f64_e64 vcc_lo, v[12:13], 0x204
	v_cndmask_b32_e32 v10, v10, v12, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v4, v11, v13, vcc_lo
	v_cmp_neq_f64_e64 vcc_lo, 0x7ff00000, |v[2:3]|
	v_and_b32_e32 v4, 0x7fffffff, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v4, 0x7ff00000, v4, vcc_lo
	s_and_b32 vcc_lo, s2, vcc_lo
	v_cndmask_b32_e32 v2, 0, v10, vcc_lo
	v_add_f64 v[10:11], v[7:8], -s[14:15]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v3, 0, v4, s2
	v_frexp_mant_f64_e64 v[12:13], |v[10:11]|
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_gt_f64_e32 vcc_lo, s[50:51], v[12:13]
	v_cndmask_b32_e64 v4, 0, 1, vcc_lo
	v_ldexp_f64 v[12:13], v[12:13], v4
	v_frexp_exp_i32_f64_e32 v4, v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[16:17], v[12:13], 1.0
	v_add_f64 v[14:15], v[12:13], -1.0
	v_subrev_co_ci_u32_e32 v4, vcc_lo, 0, v4, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[16:17], -1.0
	v_add_f64 v[12:13], v[12:13], -v[18:19]
	v_rcp_f64_e32 v[18:19], v[16:17]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[20:21], -v[16:17], v[18:19], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[20:21], v[18:19], v[18:19]
	v_fma_f64 v[20:21], -v[16:17], v[18:19], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[20:21], v[18:19], v[18:19]
	v_mul_f64 v[20:21], v[14:15], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[22:23], v[16:17], v[20:21]
	v_fma_f64 v[16:17], v[20:21], v[16:17], -v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[12:13], v[20:21], v[12:13], v[16:17]
	v_add_f64 v[16:17], v[22:23], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[24:25], v[14:15], -v[16:17]
	v_add_f64 v[22:23], v[16:17], -v[22:23]
	v_add_f64 v[14:15], v[14:15], -v[24:25]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[12:13], v[22:23], -v[12:13]
	v_cvt_f64_i32_e32 v[22:23], v4
	v_add_f64 v[14:15], v[14:15], -v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[12:13], v[12:13], v[14:15]
	v_add_f64 v[12:13], v[24:25], v[12:13]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f64 v[24:25], v[22:23], s[74:75]
	v_mul_f64 v[12:13], v[18:19], v[12:13]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[26:27], v[22:23], s[74:75], -v[24:25]
	v_add_f64 v[14:15], v[20:21], v[12:13]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[22:23], v[22:23], s[76:77], v[26:27]
	v_add_f64 v[16:17], v[14:15], -v[20:21]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[26:27], v[24:25], v[22:23]
	v_add_f64 v[12:13], v[12:13], -v[16:17]
	v_mul_f64 v[16:17], v[14:15], v[14:15]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f64 v[24:25], v[26:27], -v[24:25]
	v_add_f64 v[20:21], v[12:13], v[12:13]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_fma_f64 v[18:19], v[14:15], v[14:15], -v[16:17]
	v_ldexp_f64 v[28:29], v[12:13], 1
	v_add_f64 v[22:23], v[22:23], -v[24:25]
	v_ldexp_f64 v[24:25], v[14:15], 1
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[14:15], v[20:21], v[18:19]
	v_add_f64 v[20:21], v[16:17], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[16:17], v[20:21], -v[16:17]
	v_mul_f64 v[30:31], v[14:15], v[20:21]
	v_add_f64 v[16:17], v[18:19], -v[16:17]
	v_fma_f64 v[18:19], v[20:21], s[58:59], s[56:57]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[32:33], v[20:21], v[14:15], -v[30:31]
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[60:61]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[12:13], v[20:21], v[12:13], v[32:33]
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[62:63]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[12:13], v[16:17], v[14:15], v[12:13]
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[64:65]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[14:15], v[30:31], v[12:13]
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[66:67]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[30:31], v[14:15], -v[30:31]
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[68:69]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[12:13], v[12:13], -v[30:31]
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[70:71]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[72:73]
	v_mul_f64 v[30:31], v[20:21], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[20:21], v[18:19], -v[30:31]
	v_fma_f64 v[16:17], v[16:17], v[18:19], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[30:31], v[16:17]
	v_add_f64 v[20:21], v[18:19], -v[30:31]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[16:17], v[16:17], -v[20:21]
	v_add_f64 v[20:21], v[18:19], s[50:51]
	v_add_f64 v[16:17], v[16:17], s[52:53]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[30:31], v[20:21], s[54:55]
	v_add_f64 v[18:19], v[18:19], -v[30:31]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[16:17], v[18:19]
	v_add_f64 v[18:19], v[20:21], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[20:21], v[20:21], -v[18:19]
	v_add_f64 v[16:17], v[16:17], v[20:21]
	v_mul_f64 v[20:21], v[14:15], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[30:31], v[14:15], v[18:19], -v[20:21]
	v_fma_f64 v[14:15], v[14:15], v[16:17], v[30:31]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[12:13], v[12:13], v[18:19], v[14:15]
	v_add_f64 v[14:15], v[20:21], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[14:15], -v[20:21]
	v_add_f64 v[12:13], v[12:13], -v[16:17]
	v_add_f64 v[16:17], v[24:25], v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[12:13], v[28:29], v[12:13]
	v_add_f64 v[18:19], v[16:17], -v[24:25]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_add_f64 v[12:13], v[12:13], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[16:17], v[12:13]
	v_add_f64 v[16:17], v[14:15], -v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f64 v[12:13], v[12:13], -v[16:17]
	v_add_f64 v[16:17], v[26:27], v[14:15]
	v_add_f64 v[18:19], v[16:17], -v[26:27]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_add_f64 v[20:21], v[16:17], -v[18:19]
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_add_f64 v[18:19], v[22:23], v[12:13]
	v_add_f64 v[20:21], v[26:27], -v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f64 v[14:15], v[14:15], v[20:21]
	v_add_f64 v[20:21], v[18:19], -v[22:23]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[14:15], v[18:19], v[14:15]
	v_add_f64 v[24:25], v[18:19], -v[20:21]
	v_add_f64 v[12:13], v[12:13], -v[20:21]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f64 v[18:19], v[16:17], v[14:15]
	v_add_f64 v[22:23], v[22:23], -v[24:25]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[16:17], v[18:19], -v[16:17]
	v_add_f64 v[12:13], v[12:13], v[22:23]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[14:15], -v[16:17]
	v_add_f64 v[12:13], v[12:13], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[18:19], v[12:13]
	v_add_f64 v[16:17], v[14:15], -v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f64 v[12:13], v[12:13], -v[16:17]
	v_add_f64 v[16:17], v[14:15], v[14:15]
	v_fma_f64 v[14:15], v[14:15], 2.0, -v[16:17]
	v_cmp_class_f64_e64 vcc_lo, v[16:17], 0x204
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[12:13], v[12:13], 2.0, v[14:15]
	v_add_f64 v[14:15], v[16:17], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[14:15], -v[16:17]
	v_dual_cndmask_b32 v15, v15, v17 :: v_dual_cndmask_b32 v14, v14, v16
	v_mul_f64 v[16:17], v[14:15], s[28:29]
	v_cmp_neq_f64_e64 vcc_lo, 0x7ff00000, |v[14:15]|
	v_cmp_ngt_f64_e64 s2, 0xc090cc00, v[14:15]
	v_add_f64 v[12:13], v[12:13], -v[18:19]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_rndne_f64_e32 v[16:17], v[16:17]
	v_dual_cndmask_b32 v13, 0, v13 :: v_dual_cndmask_b32 v12, 0, v12
	v_cmp_nlt_f64_e32 vcc_lo, 0x40900000, v[14:15]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[18:19], v[16:17], s[22:23], v[14:15]
	v_cvt_i32_f64_e32 v4, v[16:17]
	v_fma_f64 v[18:19], v[16:17], s[24:25], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[18:19], s[30:31], s[26:27]
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[34:35]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[36:37]
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[38:39]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[40:41]
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[42:43]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[44:45]
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[46:47]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[48:49]
	v_fma_f64 v[20:21], v[18:19], v[20:21], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[18:19], v[20:21], 1.0
	v_ldexp_f64 v[16:17], v[18:19], v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v4, 0x7ff00000, v17, vcc_lo
	s_and_b32 vcc_lo, s2, vcc_lo
	v_cndmask_b32_e32 v14, 0, v16, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v15, 0, v4, s2
	v_cmp_neq_f64_e64 s2, 0, v[10:11]
	v_fma_f64 v[12:13], v[14:15], v[12:13], v[14:15]
	v_cmp_class_f64_e64 vcc_lo, v[14:15], 0x204
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v4, v13, v15, vcc_lo
	v_cndmask_b32_e32 v12, v12, v14, vcc_lo
	v_cmp_neq_f64_e64 vcc_lo, 0x7ff00000, |v[10:11]|
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_and_b32_e32 v4, 0x7fffffff, v4
	v_cndmask_b32_e32 v4, 0x7ff00000, v4, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	s_and_b32 vcc_lo, s2, vcc_lo
	v_cndmask_b32_e32 v10, 0, v12, vcc_lo
	v_cndmask_b32_e64 v11, 0, v4, s2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_f64 v[2:3], v[2:3], v[10:11]
	v_add_f64 v[10:11], v[5:6], -s[4:5]
	s_mov_b32 s4, s8
	s_mov_b32 s5, s9
	v_frexp_mant_f64_e64 v[12:13], |v[10:11]|
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_gt_f64_e32 vcc_lo, s[50:51], v[12:13]
	v_cndmask_b32_e64 v4, 0, 1, vcc_lo
	v_ldexp_f64 v[12:13], v[12:13], v4
	v_frexp_exp_i32_f64_e32 v4, v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[16:17], v[12:13], 1.0
	v_add_f64 v[14:15], v[12:13], -1.0
	v_subrev_co_ci_u32_e32 v4, vcc_lo, 0, v4, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[16:17], -1.0
	v_add_f64 v[12:13], v[12:13], -v[18:19]
	v_rcp_f64_e32 v[18:19], v[16:17]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[20:21], -v[16:17], v[18:19], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[20:21], v[18:19], v[18:19]
	v_fma_f64 v[20:21], -v[16:17], v[18:19], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[20:21], v[18:19], v[18:19]
	v_mul_f64 v[20:21], v[14:15], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[22:23], v[16:17], v[20:21]
	v_fma_f64 v[16:17], v[20:21], v[16:17], -v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[12:13], v[20:21], v[12:13], v[16:17]
	v_add_f64 v[16:17], v[22:23], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[24:25], v[14:15], -v[16:17]
	v_add_f64 v[22:23], v[16:17], -v[22:23]
	v_add_f64 v[14:15], v[14:15], -v[24:25]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[12:13], v[22:23], -v[12:13]
	v_cvt_f64_i32_e32 v[22:23], v4
	v_add_f64 v[14:15], v[14:15], -v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[12:13], v[12:13], v[14:15]
	v_add_f64 v[12:13], v[24:25], v[12:13]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f64 v[24:25], v[22:23], s[74:75]
	v_mul_f64 v[12:13], v[18:19], v[12:13]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[26:27], v[22:23], s[74:75], -v[24:25]
	v_add_f64 v[14:15], v[20:21], v[12:13]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[22:23], v[22:23], s[76:77], v[26:27]
	v_add_f64 v[16:17], v[14:15], -v[20:21]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[26:27], v[24:25], v[22:23]
	v_add_f64 v[12:13], v[12:13], -v[16:17]
	v_mul_f64 v[16:17], v[14:15], v[14:15]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f64 v[24:25], v[26:27], -v[24:25]
	v_add_f64 v[20:21], v[12:13], v[12:13]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_fma_f64 v[18:19], v[14:15], v[14:15], -v[16:17]
	v_ldexp_f64 v[28:29], v[12:13], 1
	v_add_f64 v[22:23], v[22:23], -v[24:25]
	v_ldexp_f64 v[24:25], v[14:15], 1
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[14:15], v[20:21], v[18:19]
	v_add_f64 v[20:21], v[16:17], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[16:17], v[20:21], -v[16:17]
	v_mul_f64 v[30:31], v[14:15], v[20:21]
	v_add_f64 v[16:17], v[18:19], -v[16:17]
	v_fma_f64 v[18:19], v[20:21], s[58:59], s[56:57]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[32:33], v[20:21], v[14:15], -v[30:31]
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[60:61]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[12:13], v[20:21], v[12:13], v[32:33]
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[62:63]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[12:13], v[16:17], v[14:15], v[12:13]
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[64:65]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[14:15], v[30:31], v[12:13]
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[66:67]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[30:31], v[14:15], -v[30:31]
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[68:69]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[12:13], v[12:13], -v[30:31]
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[70:71]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[20:21], v[18:19], s[72:73]
	v_mul_f64 v[30:31], v[20:21], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[20:21], v[18:19], -v[30:31]
	v_fma_f64 v[16:17], v[16:17], v[18:19], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[30:31], v[16:17]
	v_add_f64 v[20:21], v[18:19], -v[30:31]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[16:17], v[16:17], -v[20:21]
	v_add_f64 v[20:21], v[18:19], s[50:51]
	v_add_f64 v[16:17], v[16:17], s[52:53]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[30:31], v[20:21], s[54:55]
	v_add_f64 v[18:19], v[18:19], -v[30:31]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[16:17], v[18:19]
	v_add_f64 v[18:19], v[20:21], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[20:21], v[20:21], -v[18:19]
	v_add_f64 v[16:17], v[16:17], v[20:21]
	v_mul_f64 v[20:21], v[14:15], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[30:31], v[14:15], v[18:19], -v[20:21]
	v_fma_f64 v[14:15], v[14:15], v[16:17], v[30:31]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[12:13], v[12:13], v[18:19], v[14:15]
	v_add_f64 v[14:15], v[20:21], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[14:15], -v[20:21]
	v_add_f64 v[12:13], v[12:13], -v[16:17]
	v_add_f64 v[16:17], v[24:25], v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[12:13], v[28:29], v[12:13]
	v_add_f64 v[18:19], v[16:17], -v[24:25]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_add_f64 v[12:13], v[12:13], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[16:17], v[12:13]
	v_add_f64 v[16:17], v[14:15], -v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f64 v[12:13], v[12:13], -v[16:17]
	v_add_f64 v[16:17], v[26:27], v[14:15]
	v_add_f64 v[18:19], v[16:17], -v[26:27]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_add_f64 v[20:21], v[16:17], -v[18:19]
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_add_f64 v[18:19], v[22:23], v[12:13]
	v_add_f64 v[20:21], v[26:27], -v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f64 v[14:15], v[14:15], v[20:21]
	v_add_f64 v[20:21], v[18:19], -v[22:23]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[14:15], v[18:19], v[14:15]
	v_add_f64 v[24:25], v[18:19], -v[20:21]
	v_add_f64 v[12:13], v[12:13], -v[20:21]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f64 v[18:19], v[16:17], v[14:15]
	v_add_f64 v[22:23], v[22:23], -v[24:25]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[16:17], v[18:19], -v[16:17]
	v_add_f64 v[12:13], v[12:13], v[22:23]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[14:15], -v[16:17]
	v_add_f64 v[12:13], v[12:13], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[18:19], v[12:13]
	v_add_f64 v[16:17], v[14:15], -v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f64 v[12:13], v[12:13], -v[16:17]
	v_add_f64 v[16:17], v[14:15], v[14:15]
	v_fma_f64 v[14:15], v[14:15], 2.0, -v[16:17]
	v_cmp_class_f64_e64 vcc_lo, v[16:17], 0x204
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[12:13], v[12:13], 2.0, v[14:15]
	v_add_f64 v[14:15], v[16:17], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[14:15], -v[16:17]
	v_dual_cndmask_b32 v15, v15, v17 :: v_dual_cndmask_b32 v14, v14, v16
	v_mul_f64 v[16:17], v[14:15], s[28:29]
	v_cmp_neq_f64_e64 vcc_lo, 0x7ff00000, |v[14:15]|
	v_cmp_ngt_f64_e64 s2, 0xc090cc00, v[14:15]
	v_add_f64 v[12:13], v[12:13], -v[18:19]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_rndne_f64_e32 v[16:17], v[16:17]
	v_dual_cndmask_b32 v13, 0, v13 :: v_dual_cndmask_b32 v12, 0, v12
	v_cmp_nlt_f64_e32 vcc_lo, 0x40900000, v[14:15]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[18:19], v[16:17], s[22:23], v[14:15]
	v_cvt_i32_f64_e32 v4, v[16:17]
	v_fma_f64 v[18:19], v[16:17], s[24:25], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[18:19], s[30:31], s[26:27]
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[34:35]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[36:37]
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[38:39]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[40:41]
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[42:43]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[44:45]
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[46:47]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[18:19], v[20:21], s[48:49]
	v_fma_f64 v[20:21], v[18:19], v[20:21], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[18:19], v[20:21], 1.0
	v_ldexp_f64 v[16:17], v[18:19], v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v4, 0x7ff00000, v17, vcc_lo
	s_and_b32 vcc_lo, s2, vcc_lo
	v_cndmask_b32_e32 v14, 0, v16, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v15, 0, v4, s2
	v_cmp_neq_f64_e64 s2, 0, v[10:11]
	v_fma_f64 v[12:13], v[14:15], v[12:13], v[14:15]
	v_cmp_class_f64_e64 vcc_lo, v[14:15], 0x204
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v4, v13, v15, vcc_lo
	v_cndmask_b32_e32 v12, v12, v14, vcc_lo
	v_cmp_neq_f64_e64 vcc_lo, 0x7ff00000, |v[10:11]|
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_and_b32_e32 v4, 0x7fffffff, v4
	v_cndmask_b32_e32 v4, 0x7ff00000, v4, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	s_and_b32 vcc_lo, s2, vcc_lo
	v_cndmask_b32_e32 v10, 0, v12, vcc_lo
	v_add_f64 v[12:13], v[7:8], -s[6:7]
	v_cndmask_b32_e64 v11, 0, v4, s2
	s_mov_b32 s6, s10
	s_mov_b32 s7, s11
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_frexp_mant_f64_e64 v[14:15], |v[12:13]|
	v_cmp_gt_f64_e32 vcc_lo, s[50:51], v[14:15]
	v_cndmask_b32_e64 v4, 0, 1, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ldexp_f64 v[14:15], v[14:15], v4
	v_frexp_exp_i32_f64_e32 v4, v[12:13]
	v_add_f64 v[18:19], v[14:15], 1.0
	v_add_f64 v[16:17], v[14:15], -1.0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_subrev_co_ci_u32_e32 v4, vcc_lo, 0, v4, vcc_lo
	v_add_f64 v[20:21], v[18:19], -1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[14:15], -v[20:21]
	v_rcp_f64_e32 v[20:21], v[18:19]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[22:23], -v[18:19], v[20:21], 1.0
	v_fma_f64 v[20:21], v[22:23], v[20:21], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], -v[18:19], v[20:21], 1.0
	v_fma_f64 v[20:21], v[22:23], v[20:21], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[22:23], v[16:17], v[20:21]
	v_mul_f64 v[24:25], v[18:19], v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[22:23], v[18:19], -v[24:25]
	v_fma_f64 v[14:15], v[22:23], v[14:15], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[24:25], v[14:15]
	v_add_f64 v[26:27], v[16:17], -v[18:19]
	v_add_f64 v[24:25], v[18:19], -v[24:25]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[16:17], v[16:17], -v[26:27]
	v_add_f64 v[14:15], v[24:25], -v[14:15]
	v_cvt_f64_i32_e32 v[24:25], v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[16:17], -v[18:19]
	v_add_f64 v[14:15], v[14:15], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_f64 v[14:15], v[26:27], v[14:15]
	v_mul_f64 v[26:27], v[24:25], s[74:75]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f64 v[14:15], v[20:21], v[14:15]
	v_fma_f64 v[28:29], v[24:25], s[74:75], -v[26:27]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[16:17], v[22:23], v[14:15]
	v_fma_f64 v[24:25], v[24:25], s[76:77], v[28:29]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[18:19], v[16:17], -v[22:23]
	v_add_f64 v[28:29], v[26:27], v[24:25]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_mul_f64 v[18:19], v[16:17], v[16:17]
	v_add_f64 v[26:27], v[28:29], -v[26:27]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f64 v[22:23], v[14:15], v[14:15]
	v_fma_f64 v[20:21], v[16:17], v[16:17], -v[18:19]
	v_ldexp_f64 v[30:31], v[14:15], 1
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_add_f64 v[24:25], v[24:25], -v[26:27]
	v_ldexp_f64 v[26:27], v[16:17], 1
	v_fma_f64 v[20:21], v[16:17], v[22:23], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[22:23], v[18:19], v[20:21]
	v_add_f64 v[18:19], v[22:23], -v[18:19]
	v_mul_f64 v[32:33], v[16:17], v[22:23]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[18:19], v[20:21], -v[18:19]
	v_fma_f64 v[20:21], v[22:23], s[58:59], s[56:57]
	v_fma_f64 v[34:35], v[22:23], v[16:17], -v[32:33]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[60:61]
	v_fma_f64 v[14:15], v[22:23], v[14:15], v[34:35]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[62:63]
	v_fma_f64 v[14:15], v[18:19], v[16:17], v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[64:65]
	v_add_f64 v[16:17], v[32:33], v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[66:67]
	v_add_f64 v[32:33], v[16:17], -v[32:33]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[68:69]
	v_add_f64 v[14:15], v[14:15], -v[32:33]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[70:71]
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[72:73]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[32:33], v[22:23], v[20:21]
	v_fma_f64 v[22:23], v[22:23], v[20:21], -v[32:33]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[18:19], v[20:21], v[22:23]
	v_add_f64 v[20:21], v[32:33], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[22:23], v[20:21], -v[32:33]
	v_add_f64 v[18:19], v[18:19], -v[22:23]
	v_add_f64 v[22:23], v[20:21], s[50:51]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[18:19], v[18:19], s[52:53]
	v_add_f64 v[32:33], v[22:23], s[54:55]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[20:21], v[20:21], -v[32:33]
	v_add_f64 v[18:19], v[18:19], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[20:21], v[22:23], v[18:19]
	v_add_f64 v[22:23], v[22:23], -v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[18:19], v[22:23]
	v_mul_f64 v[22:23], v[16:17], v[20:21]
	v_fma_f64 v[32:33], v[16:17], v[20:21], -v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], v[16:17], v[18:19], v[32:33]
	v_fma_f64 v[14:15], v[14:15], v[20:21], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[22:23], v[14:15]
	v_add_f64 v[18:19], v[16:17], -v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_add_f64 v[18:19], v[26:27], v[16:17]
	v_add_f64 v[14:15], v[30:31], v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[20:21], v[18:19], -v[26:27]
	v_add_f64 v[16:17], v[16:17], -v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[14:15], v[16:17]
	v_add_f64 v[16:17], v[18:19], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[16:17], -v[18:19]
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_add_f64 v[18:19], v[28:29], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[20:21], v[18:19], -v[28:29]
	v_add_f64 v[22:23], v[18:19], -v[20:21]
	v_add_f64 v[16:17], v[16:17], -v[20:21]
	v_add_f64 v[20:21], v[24:25], v[14:15]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[22:23], v[28:29], -v[22:23]
	v_add_f64 v[16:17], v[16:17], v[22:23]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[22:23], v[20:21], -v[24:25]
	v_add_f64 v[16:17], v[20:21], v[16:17]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[26:27], v[20:21], -v[22:23]
	v_add_f64 v[14:15], v[14:15], -v[22:23]
	v_add_f64 v[20:21], v[18:19], v[16:17]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[24:25], v[24:25], -v[26:27]
	v_add_f64 v[18:19], v[20:21], -v[18:19]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[14:15], v[14:15], v[24:25]
	v_add_f64 v[16:17], v[16:17], -v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[14:15], v[16:17]
	v_add_f64 v[16:17], v[20:21], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[16:17], -v[20:21]
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_add_f64 v[18:19], v[16:17], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[16:17], v[16:17], 2.0, -v[18:19]
	v_cmp_class_f64_e64 vcc_lo, v[18:19], 0x204
	v_fma_f64 v[14:15], v[14:15], 2.0, v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[18:19], v[14:15]
	v_add_f64 v[20:21], v[16:17], -v[18:19]
	v_dual_cndmask_b32 v17, v17, v19 :: v_dual_cndmask_b32 v16, v16, v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_4)
	v_mul_f64 v[18:19], v[16:17], s[28:29]
	v_cmp_neq_f64_e64 vcc_lo, 0x7ff00000, |v[16:17]|
	v_cmp_ngt_f64_e64 s2, 0xc090cc00, v[16:17]
	v_add_f64 v[14:15], v[14:15], -v[20:21]
	v_rndne_f64_e32 v[18:19], v[18:19]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_dual_cndmask_b32 v15, 0, v15 :: v_dual_cndmask_b32 v14, 0, v14
	v_cmp_nlt_f64_e32 vcc_lo, 0x40900000, v[16:17]
	v_fma_f64 v[20:21], v[18:19], s[22:23], v[16:17]
	v_cvt_i32_f64_e32 v4, v[18:19]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[18:19], s[24:25], v[20:21]
	v_fma_f64 v[22:23], v[20:21], s[30:31], s[26:27]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[34:35]
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[36:37]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[38:39]
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[40:41]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[42:43]
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[44:45]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[46:47]
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[48:49]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[20:21], v[22:23], 1.0
	v_fma_f64 v[20:21], v[20:21], v[22:23], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ldexp_f64 v[18:19], v[20:21], v4
	v_cndmask_b32_e32 v4, 0x7ff00000, v19, vcc_lo
	s_and_b32 vcc_lo, s2, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v16, 0, v18, vcc_lo
	v_cndmask_b32_e64 v17, 0, v4, s2
	v_cmp_neq_f64_e64 s2, 0, v[12:13]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[14:15], v[16:17], v[14:15], v[16:17]
	v_cmp_class_f64_e64 vcc_lo, v[16:17], 0x204
	v_cndmask_b32_e32 v4, v15, v17, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v14, v14, v16, vcc_lo
	v_cmp_neq_f64_e64 vcc_lo, 0x7ff00000, |v[12:13]|
	v_and_b32_e32 v4, 0x7fffffff, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v4, 0x7ff00000, v4, vcc_lo
	s_and_b32 vcc_lo, s2, vcc_lo
	v_cndmask_b32_e32 v12, 0, v14, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v13, 0, v4, s2
	v_add_f64 v[10:11], v[10:11], v[12:13]
	v_add_f64 v[12:13], v[5:6], -s[16:17]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_nlt_f64_e32 vcc_lo, v[2:3], v[10:11]
	v_frexp_mant_f64_e64 v[14:15], |v[12:13]|
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_gt_f64_e64 s2, s[50:51], v[14:15]
	v_cndmask_b32_e64 v4, 0, 1, s2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ldexp_f64 v[14:15], v[14:15], v4
	v_frexp_exp_i32_f64_e32 v4, v[12:13]
	v_add_f64 v[18:19], v[14:15], 1.0
	v_add_f64 v[16:17], v[14:15], -1.0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_subrev_co_ci_u32_e64 v4, s2, 0, v4, s2
	v_add_f64 v[20:21], v[18:19], -1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[14:15], -v[20:21]
	v_rcp_f64_e32 v[20:21], v[18:19]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[22:23], -v[18:19], v[20:21], 1.0
	v_fma_f64 v[20:21], v[22:23], v[20:21], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], -v[18:19], v[20:21], 1.0
	v_fma_f64 v[20:21], v[22:23], v[20:21], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[22:23], v[16:17], v[20:21]
	v_mul_f64 v[24:25], v[18:19], v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[22:23], v[18:19], -v[24:25]
	v_fma_f64 v[14:15], v[22:23], v[14:15], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[24:25], v[14:15]
	v_add_f64 v[26:27], v[16:17], -v[18:19]
	v_add_f64 v[24:25], v[18:19], -v[24:25]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[16:17], v[16:17], -v[26:27]
	v_add_f64 v[14:15], v[24:25], -v[14:15]
	v_cvt_f64_i32_e32 v[24:25], v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[16:17], -v[18:19]
	v_add_f64 v[14:15], v[14:15], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_f64 v[14:15], v[26:27], v[14:15]
	v_mul_f64 v[26:27], v[24:25], s[74:75]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f64 v[14:15], v[20:21], v[14:15]
	v_fma_f64 v[28:29], v[24:25], s[74:75], -v[26:27]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[16:17], v[22:23], v[14:15]
	v_fma_f64 v[24:25], v[24:25], s[76:77], v[28:29]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[18:19], v[16:17], -v[22:23]
	v_add_f64 v[28:29], v[26:27], v[24:25]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_mul_f64 v[18:19], v[16:17], v[16:17]
	v_add_f64 v[26:27], v[28:29], -v[26:27]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f64 v[22:23], v[14:15], v[14:15]
	v_fma_f64 v[20:21], v[16:17], v[16:17], -v[18:19]
	v_ldexp_f64 v[30:31], v[14:15], 1
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_add_f64 v[24:25], v[24:25], -v[26:27]
	v_ldexp_f64 v[26:27], v[16:17], 1
	v_fma_f64 v[20:21], v[16:17], v[22:23], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[22:23], v[18:19], v[20:21]
	v_add_f64 v[18:19], v[22:23], -v[18:19]
	v_mul_f64 v[32:33], v[16:17], v[22:23]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[18:19], v[20:21], -v[18:19]
	v_fma_f64 v[20:21], v[22:23], s[58:59], s[56:57]
	v_fma_f64 v[34:35], v[22:23], v[16:17], -v[32:33]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[60:61]
	v_fma_f64 v[14:15], v[22:23], v[14:15], v[34:35]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[62:63]
	v_fma_f64 v[14:15], v[18:19], v[16:17], v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[64:65]
	v_add_f64 v[16:17], v[32:33], v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[66:67]
	v_add_f64 v[32:33], v[16:17], -v[32:33]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[68:69]
	v_add_f64 v[14:15], v[14:15], -v[32:33]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[70:71]
	v_fma_f64 v[20:21], v[22:23], v[20:21], s[72:73]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[32:33], v[22:23], v[20:21]
	v_fma_f64 v[22:23], v[22:23], v[20:21], -v[32:33]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[18:19], v[18:19], v[20:21], v[22:23]
	v_add_f64 v[20:21], v[32:33], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[22:23], v[20:21], -v[32:33]
	v_add_f64 v[18:19], v[18:19], -v[22:23]
	v_add_f64 v[22:23], v[20:21], s[50:51]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[18:19], v[18:19], s[52:53]
	v_add_f64 v[32:33], v[22:23], s[54:55]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[20:21], v[20:21], -v[32:33]
	v_add_f64 v[18:19], v[18:19], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[20:21], v[22:23], v[18:19]
	v_add_f64 v[22:23], v[22:23], -v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[18:19], v[22:23]
	v_mul_f64 v[22:23], v[16:17], v[20:21]
	v_fma_f64 v[32:33], v[16:17], v[20:21], -v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], v[16:17], v[18:19], v[32:33]
	v_fma_f64 v[14:15], v[14:15], v[20:21], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[22:23], v[14:15]
	v_add_f64 v[18:19], v[16:17], -v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_add_f64 v[18:19], v[26:27], v[16:17]
	v_add_f64 v[14:15], v[30:31], v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[20:21], v[18:19], -v[26:27]
	v_add_f64 v[16:17], v[16:17], -v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[14:15], v[16:17]
	v_add_f64 v[16:17], v[18:19], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[16:17], -v[18:19]
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_add_f64 v[18:19], v[28:29], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[20:21], v[18:19], -v[28:29]
	v_add_f64 v[22:23], v[18:19], -v[20:21]
	v_add_f64 v[16:17], v[16:17], -v[20:21]
	v_add_f64 v[20:21], v[24:25], v[14:15]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[22:23], v[28:29], -v[22:23]
	v_add_f64 v[16:17], v[16:17], v[22:23]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[22:23], v[20:21], -v[24:25]
	v_add_f64 v[16:17], v[20:21], v[16:17]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[26:27], v[20:21], -v[22:23]
	v_add_f64 v[14:15], v[14:15], -v[22:23]
	v_add_f64 v[20:21], v[18:19], v[16:17]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[24:25], v[24:25], -v[26:27]
	v_add_f64 v[18:19], v[20:21], -v[18:19]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[14:15], v[14:15], v[24:25]
	v_add_f64 v[16:17], v[16:17], -v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[14:15], v[14:15], v[16:17]
	v_add_f64 v[16:17], v[20:21], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[16:17], -v[20:21]
	v_add_f64 v[14:15], v[14:15], -v[18:19]
	v_add_f64 v[18:19], v[16:17], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[16:17], v[16:17], 2.0, -v[18:19]
	v_cmp_class_f64_e64 s2, v[18:19], 0x204
	v_fma_f64 v[14:15], v[14:15], 2.0, v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[18:19], v[14:15]
	v_add_f64 v[20:21], v[16:17], -v[18:19]
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v17, v17, v19, s2
	v_cndmask_b32_e64 v16, v16, v18, s2
	v_mul_f64 v[18:19], v[16:17], s[28:29]
	v_cmp_neq_f64_e64 s2, 0x7ff00000, |v[16:17]|
	v_cmp_ngt_f64_e64 s3, 0xc090cc00, v[16:17]
	v_add_f64 v[14:15], v[14:15], -v[20:21]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_rndne_f64_e32 v[18:19], v[18:19]
	v_cndmask_b32_e64 v15, 0, v15, s2
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_cndmask_b32_e64 v14, 0, v14, s2
	v_cmp_nlt_f64_e64 s2, 0x40900000, v[16:17]
	v_fma_f64 v[20:21], v[18:19], s[22:23], v[16:17]
	v_cvt_i32_f64_e32 v4, v[18:19]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[20:21], v[18:19], s[24:25], v[20:21]
	v_fma_f64 v[22:23], v[20:21], s[30:31], s[26:27]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[34:35]
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[36:37]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[38:39]
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[40:41]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[42:43]
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[44:45]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[46:47]
	v_fma_f64 v[22:23], v[20:21], v[22:23], s[48:49]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[20:21], v[22:23], 1.0
	v_fma_f64 v[20:21], v[20:21], v[22:23], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ldexp_f64 v[18:19], v[20:21], v4
	v_cndmask_b32_e64 v4, 0x7ff00000, v19, s2
	s_and_b32 s2, s3, s2
	s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1)
	v_cndmask_b32_e64 v16, 0, v18, s2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v17, 0, v4, s3
	v_cmp_neq_f64_e64 s3, 0, v[12:13]
	v_fma_f64 v[14:15], v[16:17], v[14:15], v[16:17]
	v_cmp_class_f64_e64 s2, v[16:17], 0x204
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v4, v15, v17, s2
	v_cndmask_b32_e64 v14, v14, v16, s2
	v_cmp_neq_f64_e64 s2, 0x7ff00000, |v[12:13]|
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_and_b32_e32 v4, 0x7fffffff, v4
	v_cndmask_b32_e64 v4, 0x7ff00000, v4, s2
	s_and_b32 s2, s3, s2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v12, 0, v14, s2
	v_add_f64 v[14:15], v[7:8], -s[18:19]
	v_cndmask_b32_e64 v13, 0, v4, s3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_frexp_mant_f64_e64 v[16:17], |v[14:15]|
	v_cmp_gt_f64_e64 s2, s[50:51], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v4, 0, 1, s2
	v_ldexp_f64 v[16:17], v[16:17], v4
	v_frexp_exp_i32_f64_e32 v4, v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[20:21], v[16:17], 1.0
	v_add_f64 v[18:19], v[16:17], -1.0
	v_subrev_co_ci_u32_e64 v4, s2, 0, v4, s2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[22:23], v[20:21], -1.0
	v_add_f64 v[16:17], v[16:17], -v[22:23]
	v_rcp_f64_e32 v[22:23], v[20:21]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[24:25], -v[20:21], v[22:23], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[24:25], v[22:23], v[22:23]
	v_fma_f64 v[24:25], -v[20:21], v[22:23], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[24:25], v[22:23], v[22:23]
	v_mul_f64 v[24:25], v[18:19], v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[26:27], v[20:21], v[24:25]
	v_fma_f64 v[20:21], v[24:25], v[20:21], -v[26:27]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], v[24:25], v[16:17], v[20:21]
	v_add_f64 v[20:21], v[26:27], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[28:29], v[18:19], -v[20:21]
	v_add_f64 v[26:27], v[20:21], -v[26:27]
	v_add_f64 v[18:19], v[18:19], -v[28:29]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[16:17], v[26:27], -v[16:17]
	v_cvt_f64_i32_e32 v[26:27], v4
	v_add_f64 v[18:19], v[18:19], -v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[16:17], v[18:19]
	v_add_f64 v[16:17], v[28:29], v[16:17]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f64 v[28:29], v[26:27], s[74:75]
	v_mul_f64 v[16:17], v[22:23], v[16:17]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[30:31], v[26:27], s[74:75], -v[28:29]
	v_add_f64 v[18:19], v[24:25], v[16:17]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[26:27], v[26:27], s[76:77], v[30:31]
	v_add_f64 v[20:21], v[18:19], -v[24:25]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[30:31], v[28:29], v[26:27]
	v_add_f64 v[16:17], v[16:17], -v[20:21]
	v_mul_f64 v[20:21], v[18:19], v[18:19]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f64 v[28:29], v[30:31], -v[28:29]
	v_add_f64 v[24:25], v[16:17], v[16:17]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_fma_f64 v[22:23], v[18:19], v[18:19], -v[20:21]
	v_ldexp_f64 v[32:33], v[16:17], 1
	v_add_f64 v[26:27], v[26:27], -v[28:29]
	v_ldexp_f64 v[28:29], v[18:19], 1
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[18:19], v[24:25], v[22:23]
	v_add_f64 v[24:25], v[20:21], v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[20:21], v[24:25], -v[20:21]
	v_mul_f64 v[34:35], v[18:19], v[24:25]
	v_add_f64 v[20:21], v[22:23], -v[20:21]
	v_fma_f64 v[22:23], v[24:25], s[58:59], s[56:57]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[36:37], v[24:25], v[18:19], -v[34:35]
	v_fma_f64 v[22:23], v[24:25], v[22:23], s[60:61]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[16:17], v[24:25], v[16:17], v[36:37]
	v_fma_f64 v[22:23], v[24:25], v[22:23], s[62:63]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[16:17], v[20:21], v[18:19], v[16:17]
	v_fma_f64 v[22:23], v[24:25], v[22:23], s[64:65]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[18:19], v[34:35], v[16:17]
	v_fma_f64 v[22:23], v[24:25], v[22:23], s[66:67]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[34:35], v[18:19], -v[34:35]
	v_fma_f64 v[22:23], v[24:25], v[22:23], s[68:69]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[16:17], v[16:17], -v[34:35]
	v_fma_f64 v[22:23], v[24:25], v[22:23], s[70:71]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[24:25], v[22:23], s[72:73]
	v_mul_f64 v[34:35], v[24:25], v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[24:25], v[24:25], v[22:23], -v[34:35]
	v_fma_f64 v[20:21], v[20:21], v[22:23], v[24:25]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[22:23], v[34:35], v[20:21]
	v_add_f64 v[24:25], v[22:23], -v[34:35]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[20:21], v[20:21], -v[24:25]
	v_add_f64 v[24:25], v[22:23], s[50:51]
	v_add_f64 v[20:21], v[20:21], s[52:53]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[34:35], v[24:25], s[54:55]
	v_add_f64 v[22:23], v[22:23], -v[34:35]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[20:21], v[20:21], v[22:23]
	v_add_f64 v[22:23], v[24:25], v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[24:25], v[24:25], -v[22:23]
	v_add_f64 v[20:21], v[20:21], v[24:25]
	v_mul_f64 v[24:25], v[18:19], v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[34:35], v[18:19], v[22:23], -v[24:25]
	v_fma_f64 v[18:19], v[18:19], v[20:21], v[34:35]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], v[16:17], v[22:23], v[18:19]
	v_add_f64 v[18:19], v[24:25], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[20:21], v[18:19], -v[24:25]
	v_add_f64 v[16:17], v[16:17], -v[20:21]
	v_add_f64 v[20:21], v[28:29], v[18:19]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[16:17], v[32:33], v[16:17]
	v_add_f64 v[22:23], v[20:21], -v[28:29]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[18:19], -v[22:23]
	v_add_f64 v[16:17], v[16:17], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[20:21], v[16:17]
	v_add_f64 v[20:21], v[18:19], -v[20:21]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[16:17], -v[20:21]
	v_add_f64 v[20:21], v[30:31], v[18:19]
	v_add_f64 v[22:23], v[20:21], -v[30:31]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_add_f64 v[24:25], v[20:21], -v[22:23]
	v_add_f64 v[18:19], v[18:19], -v[22:23]
	v_add_f64 v[22:23], v[26:27], v[16:17]
	v_add_f64 v[24:25], v[30:31], -v[24:25]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f64 v[18:19], v[18:19], v[24:25]
	v_add_f64 v[24:25], v[22:23], -v[26:27]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[18:19], v[22:23], v[18:19]
	v_add_f64 v[28:29], v[22:23], -v[24:25]
	v_add_f64 v[16:17], v[16:17], -v[24:25]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f64 v[22:23], v[20:21], v[18:19]
	v_add_f64 v[26:27], v[26:27], -v[28:29]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[20:21], v[22:23], -v[20:21]
	v_add_f64 v[16:17], v[16:17], v[26:27]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[18:19], -v[20:21]
	v_add_f64 v[16:17], v[16:17], v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[18:19], v[22:23], v[16:17]
	v_add_f64 v[20:21], v[18:19], -v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f64 v[16:17], v[16:17], -v[20:21]
	v_add_f64 v[20:21], v[18:19], v[18:19]
	v_fma_f64 v[18:19], v[18:19], 2.0, -v[20:21]
	v_cmp_class_f64_e64 s2, v[20:21], 0x204
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], v[16:17], 2.0, v[18:19]
	v_add_f64 v[18:19], v[20:21], v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_f64 v[22:23], v[18:19], -v[20:21]
	v_cndmask_b32_e64 v19, v19, v21, s2
	v_cndmask_b32_e64 v18, v18, v20, s2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_4)
	v_mul_f64 v[20:21], v[18:19], s[28:29]
	v_cmp_neq_f64_e64 s2, 0x7ff00000, |v[18:19]|
	v_cmp_ngt_f64_e64 s3, 0xc090cc00, v[18:19]
	v_add_f64 v[16:17], v[16:17], -v[22:23]
	v_rndne_f64_e32 v[20:21], v[20:21]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v17, 0, v17, s2
	v_cndmask_b32_e64 v16, 0, v16, s2
	v_cmp_nlt_f64_e64 s2, 0x40900000, v[18:19]
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[22:23], v[20:21], s[22:23], v[18:19]
	v_cvt_i32_f64_e32 v4, v[20:21]
	v_fma_f64 v[22:23], v[20:21], s[24:25], v[22:23]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[24:25], v[22:23], s[30:31], s[26:27]
	v_fma_f64 v[24:25], v[22:23], v[24:25], s[34:35]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[24:25], v[22:23], v[24:25], s[36:37]
	v_fma_f64 v[24:25], v[22:23], v[24:25], s[38:39]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[24:25], v[22:23], v[24:25], s[40:41]
	v_fma_f64 v[24:25], v[22:23], v[24:25], s[42:43]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[24:25], v[22:23], v[24:25], s[44:45]
	v_fma_f64 v[24:25], v[22:23], v[24:25], s[46:47]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[24:25], v[22:23], v[24:25], s[48:49]
	v_fma_f64 v[24:25], v[22:23], v[24:25], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[22:23], v[22:23], v[24:25], 1.0
	v_ldexp_f64 v[20:21], v[22:23], v4
	s_delay_alu instid0(VALU_DEP_1)
	v_cndmask_b32_e64 v4, 0x7ff00000, v21, s2
	s_and_b32 s2, s3, s2
	s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1)
	v_cndmask_b32_e64 v18, 0, v20, s2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v19, 0, v4, s3
	v_cmp_neq_f64_e64 s3, 0, v[14:15]
	v_fma_f64 v[16:17], v[18:19], v[16:17], v[18:19]
	v_cmp_class_f64_e64 s2, v[18:19], 0x204
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v4, v17, v19, s2
	v_cndmask_b32_e64 v16, v16, v18, s2
	v_cmp_neq_f64_e64 s2, 0x7ff00000, |v[14:15]|
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_and_b32_e32 v4, 0x7fffffff, v4
	v_cndmask_b32_e64 v4, 0x7ff00000, v4, s2
	s_and_b32 s2, s3, s2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v14, 0, v16, s2
	v_cndmask_b32_e64 v15, 0, v4, s3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[12:13], v[12:13], v[14:15]
	v_cmp_gt_f64_e64 s3, v[12:13], v[10:11]
	v_cmp_gt_f64_e64 s2, v[2:3], v[12:13]
	v_cndmask_b32_e64 v3, 0, 1, vcc_lo
	v_ashrrev_i32_e32 v10, 31, v9
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b32_e32 v3, 1, v3
	v_lshlrev_b64 v[9:10], 3, v[9:10]
	v_cndmask_b32_e64 v2, 1, 2, s3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v13, v3, v2, s2
	v_dual_mov_b32 v3, s10 :: v_dual_mov_b32 v2, s11
	v_cmp_eq_u32_e32 vcc_lo, 1, v13
	v_cmp_eq_u32_e64 s2, 2, v13
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_cndmask_b32_e32 v3, s8, v3, vcc_lo
	v_cndmask_b32_e32 v2, s9, v2, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v3, v3, s20, s2
	v_cndmask_b32_e64 v2, v2, s21, s2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v11, vcc_lo, v3, v9
	v_add_co_ci_u32_e32 v12, vcc_lo, v2, v10, vcc_lo
.LBB0_2:                                ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s2, exec_lo
	v_cmpx_ne_u32_e64 s12, v13
	s_xor_b32 s2, exec_lo, s2
	s_cbranch_execz .LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	s_cmp_eq_u32 s12, 1
	v_mov_b32_e32 v2, v1
	s_cselect_b32 s3, s6, s4
	s_cselect_b32 s8, s7, s5
	s_cmp_eq_u32 s12, 2
	v_mov_b32_e32 v3, v1
	s_cselect_b32 s3, s20, s3
	s_cselect_b32 s8, s21, s8
	v_add_co_u32 v14, vcc_lo, s3, v9
	v_add_co_ci_u32_e32 v15, vcc_lo, s8, v10, vcc_lo
	v_mov_b32_e32 v4, v1
	flat_store_b128 v[14:15], v[1:4]
.LBB0_4:                                ; %Flow75
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_and_not1_saveexec_b32 s2, s2
	s_cbranch_execz .LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	flat_store_b128 v[11:12], v[5:8]
.LBB0_6:                                ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s2
	s_add_u32 s12, s12, 1
	s_addc_u32 s13, s13, 0
	s_cmp_eq_u32 s12, 3
	s_cbranch_scc0 .LBB0_2
; %bb.7:
	v_dual_mov_b32 v2, 1 :: v_dual_lshlrev_b32 v1, 2, v13
	v_cmp_gt_u32_e32 vcc_lo, 3, v0
	ds_add_u32 v1, v2
	s_waitcnt lgkmcnt(0)
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_9
; %bb.8:
	v_lshlrev_b32_e32 v0, 2, v0
	s_load_b64 s[0:1], s[0:1], 0x30
	ds_load_b32 v1, v0
	s_waitcnt lgkmcnt(0)
	global_atomic_add_u32 v0, v1, s[0:1]
.LBB0_9:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z16KMeansClusteringPdS_S_S_S_iPi
		.amdhsa_group_segment_fixed_size 12
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 312
		.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 38
		.amdhsa_next_free_sgpr 78
		.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	_Z16KMeansClusteringPdS_S_S_S_iPi, .Lfunc_end0-_Z16KMeansClusteringPdS_S_S_S_iPi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 9916
; NumSgprs: 80
; NumVgprs: 38
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 12 bytes/workgroup (compile time only)
; SGPRBlocks: 9
; VGPRBlocks: 4
; NumSGPRsForWavesPerEU: 80
; NumVGPRsForWavesPerEU: 38
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z10sumClusterPdS_S_i   ; -- Begin function _Z10sumClusterPdS_S_i
	.globl	_Z10sumClusterPdS_S_i
	.p2align	8
	.type	_Z10sumClusterPdS_S_i,@function
_Z10sumClusterPdS_S_i:                  ; @_Z10sumClusterPdS_S_i
; %bb.0:
	s_clause 0x3
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x18
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	v_lshlrev_b32_e32 v3, 4, v0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s8, s15, s2
	v_add_lshl_u32 v1, s8, v0, 1
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s3, v1
	s_and_saveexec_b32 s3, vcc_lo
	s_cbranch_execz .LBB1_2
; %bb.1:
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 3, v[1:2]
	v_add_co_u32 v4, vcc_lo, s4, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v2, vcc_lo
	v_add_co_u32 v8, vcc_lo, s6, v1
	v_add_co_ci_u32_e32 v9, vcc_lo, s7, v2, vcc_lo
	v_add_co_u32 v1, vcc_lo, s0, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
	global_load_b128 v[4:7], v[4:5], off
	global_load_b128 v[8:11], v[8:9], off
	global_load_b128 v[12:15], v[1:2], off
	s_waitcnt vmcnt(2)
	ds_store_b128 v3, v[4:7]
	s_waitcnt vmcnt(1)
	ds_store_b128 v3, v[8:11] offset:2048
	s_waitcnt vmcnt(0)
	ds_store_b128 v3, v[12:15] offset:4096
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
.LBB1_2:
	s_or_b32 exec_lo, exec_lo, s3
	s_cmp_lt_u32 s2, 2
	s_cbranch_scc1 .LBB1_8
; %bb.3:                                ; %.lr.ph
	v_add_nc_u32_e32 v1, 0x800, v3
	v_add_nc_u32_e32 v2, 0x1000, v3
	s_mov_b32 s3, 0
                                        ; implicit-def: $sgpr8
.LBB1_4:                                ; =>This Inner Loop Header: Depth=1
	s_lshr_b32 s9, s2, 1
	s_or_b32 s8, s8, exec_lo
	s_mov_b32 s10, exec_lo
	v_cmpx_gt_u32_e64 s9, v0
	s_cbranch_execz .LBB1_6
; %bb.5:                                ;   in Loop: Header=BB1_4 Depth=1
	s_lshl_b32 s11, s2, 3
	ds_load_b128 v[4:7], v3
	v_add_nc_u32_e32 v8, s11, v3
	v_add_nc_u32_e32 v12, s11, v1
	v_add_nc_u32_e32 v24, s11, v2
	s_cmp_lt_u32 s2, 4
	ds_load_2addr_b64 v[8:11], v8 offset1:1
	ds_load_2addr_b64 v[12:15], v12 offset1:1
	ds_load_b128 v[16:19], v1
	ds_load_b128 v[20:23], v2
	ds_load_2addr_b64 v[24:27], v24 offset1:1
	s_cselect_b32 s2, -1, 0
	s_and_not1_b32 s8, s8, exec_lo
	s_and_b32 s2, s2, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s8, s8, s2
	s_waitcnt lgkmcnt(4)
	v_add_f64 v[4:5], v[8:9], v[4:5]
	v_add_f64 v[6:7], v[10:11], v[6:7]
	s_waitcnt lgkmcnt(2)
	v_add_f64 v[8:9], v[12:13], v[16:17]
	v_add_f64 v[10:11], v[14:15], v[18:19]
	s_waitcnt lgkmcnt(0)
	v_add_f64 v[12:13], v[24:25], v[20:21]
	v_add_f64 v[14:15], v[26:27], v[22:23]
	ds_store_b128 v3, v[4:7]
	ds_store_b128 v1, v[8:11]
	ds_store_b128 v2, v[12:15]
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
.LBB1_6:                                ; %Flow
                                        ;   in Loop: Header=BB1_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s10
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, exec_lo, s8
	s_or_b32 s3, s2, s3
	s_mov_b32 s2, s9
	s_and_not1_b32 exec_lo, exec_lo, s3
	s_cbranch_execnz .LBB1_4
; %bb.7:                                ; %Flow46
	s_or_b32 exec_lo, exec_lo, s3
.LBB1_8:                                ; %.critedge
	s_mov_b32 s3, 0
	s_mov_b32 s2, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB1_10
; %bb.9:
	v_mov_b32_e32 v12, 0
	s_lshl_b32 s2, s15, 1
	ds_load_b128 v[0:3], v12
	ds_load_b128 v[4:7], v12 offset:2048
	ds_load_b128 v[8:11], v12 offset:4096
	s_lshl_b64 s[2:3], s[2:3], 3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s4, s4, s2
	s_addc_u32 s5, s5, s3
	s_add_u32 s6, s6, s2
	s_addc_u32 s7, s7, s3
	s_add_u32 s0, s0, s2
	s_addc_u32 s1, s1, s3
	s_waitcnt lgkmcnt(2)
	global_store_b128 v12, v[0:3], s[4:5]
	s_waitcnt lgkmcnt(1)
	global_store_b128 v12, v[4:7], s[6:7]
	s_waitcnt lgkmcnt(0)
	global_store_b128 v12, v[8:11], s[0:1]
.LBB1_10:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10sumClusterPdS_S_i
		.amdhsa_group_segment_fixed_size 6144
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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 28
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z10sumClusterPdS_S_i, .Lfunc_end1-_Z10sumClusterPdS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 620
; NumSgprs: 18
; NumVgprs: 28
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 6144 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 3
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 28
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         48
        .size:           8
        .value_kind:     global_buffer
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         60
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         64
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         68
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         70
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         72
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         74
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         76
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         78
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         120
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 12
    .kernarg_segment_align: 8
    .kernarg_segment_size: 312
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z16KMeansClusteringPdS_S_S_S_iPi
    .private_segment_fixed_size: 0
    .sgpr_count:     80
    .sgpr_spill_count: 0
    .symbol:         _Z16KMeansClusteringPdS_S_S_S_iPi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     38
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 6144
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10sumClusterPdS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z10sumClusterPdS_S_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     28
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
