/*
  What: Simplex in CUDA
  AUTHOR: kishaloy.halder@gmail.com

  What: Solves LP Problem with Simplex:
    { maximize cx : Ax <= b, x >= 0 }.
  Input: { m, n, Mat[m x n] }, where:
    b = mat[1..m,0] .. column 0 is b >= 0, so x=0 is a basic feasible solution.
    c = mat[0,1..n] .. row 0 is z to maximize, note c is negated in input.
    A = mat[1..m,1..n] .. constraints.
    x = [x1..xm] are the named variables in the problem.
    Slack variables are in columns [m+1..m+n]

  USAGE:
    1. Read the problem data from a file:
      $ cat problem.txt
            m n
            0  -c1 -c2 sign1
            b1 a11 a12 sign2
            b2 a21 a11 sign3
      $ nvcc simplex.cu
      $ ./a.out <datafile> <i/n> <max_iteration>
*/

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include <sys/time.h>

#define NUMBER_OF_ELEMENTS_PER_THREAD 10
#define M 5000
#define N 5000

#define THREADS_PER_BLOCK 512

static const double epsilon   = 0.00001;

int equal(double a, double b) { return fabs(a-b) < epsilon; }
__device__ int equalsTo(double a, double b)
{
	double epsilon = 0.00001;
	return fabs(a-b) < epsilon;
}

typedef struct {
	double * table;
	int numberOfRows;
	int numberOfColumns;
	int numberOfColumnsInOriginalMatrix;
	int firstPivotRow; 
	int pitch;
} Tableau;

typedef struct {
	double value;
	int index;
} Element;

typedef struct {
  int m, n; // m=rows, n=columns, mat[m x n]
  double mat[M][N];
} Tab;

Tab * demoTab;

void nl(int k){ int j; for(j=0;j<k;j++) putchar('-'); putchar('\n'); }

/* // Size of tableau [4 rows x 5 columns ]
	// Max: z = 0.5*x + 3*y + z + 4*w,
	//    x + y + z + w <= 40 .. b1
	//  -2x - y + z + w <= 10 .. b2
	//        y     - w <= 10 .. b3
	Example input file for read_tableau:
     4 5							
      0   -0.5  -3 -1  -4 
     40    1     1  1   1 -1 
     10   -2    -1  1   1 -1
     10    0     1  0  -1 -1 
*/

void updateHostTable(double * table, int pitch, int numberOfRows, int numberOfColumns){
	for(int i=0;i<numberOfRows;i++)
	{
		cudaMemcpy(demoTab->mat[i], (double *)((char *)table + i*pitch), numberOfColumns*sizeof(double), cudaMemcpyDeviceToHost);
	}
	return;
}

void writetofile(FILE * fp,double * tempArray, int numberOfColumns, int direction){
	int i=0;
	double b=tempArray[0];
	for(i=1;i<numberOfColumns;i++)
	{
		if(i==1){
			fprintf(fp, "%lfx%d ",tempArray[i],i);
		}
		else if(tempArray[i]>=0){
		fprintf(fp, "+ %lfx%d ",fabs(tempArray[i]),i);
		}
		else if(tempArray[i]<0){
		fprintf(fp, "- %lfx%d ",fabs(tempArray[i]),i);
		}
	}
	if(direction==1)
		fprintf(fp, " >= %lf", b);
	else if(direction==-1)
		fprintf(fp, " <= %lf", b);
	else	
		fprintf(fp, " = %lf", b);
	fprintf(fp,";\n");
}

void print_tableau(Tab *tab, const char* mes, int verbosityLevel) {
	if(!verbosityLevel)
		return;
	static int counter=0;
	int i, j;
	printf("\n%d. Tableau %s:\n", ++counter, mes);
	nl(70);

	printf("%-6s%5s", "col:", "b[i]");
	for(j=1;j<tab->n; j++) { printf("    x%d,", j); } printf("\n");

	for(i=0;i<tab->m; i++) {
		if (i==0) printf("max:"); else
		printf("b%d: ", i);
		for(j=0;j<tab->n; j++) {
			if (equal((int)tab->mat[i][j], tab->mat[i][j]))
				printf(" %6d", (int)tab->mat[i][j]);
			else
				printf(" %6.2lf", tab->mat[i][j]);
		}
		printf("\n");
	}
	nl(70);
}

void negateRow(double * array, int size)
{
		for(int i=0;i<size;i++)
		{
			array[i] *= -1;
		}
	return;
}

void printRow(double * array, int size)
{
		for(int i=0;i<size;i++)
		{
			printf("%lf ", array[i]);
		}
	printf("\n");
	return;
}

void read_tableau(Tableau *tab, const char * filename, int verbosityLevel) {
	int err, i, j;
	FILE * fp;

	fp  = fopen(filename, "r" );
	if( !fp ) {
		printf("Cannot read %s\n", filename); exit(1);
	}
	  //memset(tab, 0, sizeof(*tab));
	
	err = fscanf(fp, "%d %d", &tab->numberOfRows, &tab->numberOfColumns);
	if (err == 0 || err == EOF) {
		printf("Cannot read m or n\n"); exit(1);
	}
	
	int numberOfColumnsInOriginalMatrix = tab->numberOfColumns;
	tab->numberOfColumnsInOriginalMatrix = tab->numberOfColumns;
	//all the variables are unrestricted..so each xi has to replaced with xi1-xi2
	int numberOfColumnsInExtendedMatrix = (tab->numberOfColumns)*2 - 1;
	//adding slack variables
	tab->numberOfColumns = numberOfColumnsInExtendedMatrix + tab->numberOfRows;
	
	if(verbosityLevel)
	{
		demoTab->m = tab->numberOfRows;
		demoTab->n = tab->numberOfColumns;
	}
	
	//allocating memory in device for the table
	size_t pitch;	
	cudaMallocPitch((void**)&tab->table, &pitch, tab->numberOfColumns * sizeof(double), tab->numberOfRows);
	tab->pitch = pitch;
	
	double tempArray[tab->numberOfColumns];
	
	int directionOfInequality =0;
	int slackVariableIndex = -1;
	
	double temp;
	int tempArrayCounter;
	
	int tabOldNumberOfColumns=numberOfColumnsInOriginalMatrix + tab->numberOfRows -1;
	FILE * opFile=fopen("printEquations.txt","w");
	
	memset(tempArray, 0, sizeof(double)*(tab->numberOfColumns));
	for(i=0;i<tab->numberOfRows; i++) {
		tempArrayCounter = 0;
		if(i==0)
		{
			tempArray[tab->numberOfColumns-1] = 1;
		}
		else
		{
			tempArray[tab->numberOfColumns-1] = 0;
		}
		for(j=0;j<tabOldNumberOfColumns; j++) {
			if(j<numberOfColumnsInOriginalMatrix){
				if(j==0)
				{
					err = fscanf(fp, "%lf", &tempArray[tempArrayCounter]);
					tempArrayCounter++;
					if (err == 0 || err == EOF) {
						printf("Cannot read A[%d][%d]\n", i, j);
						exit(1);
					}
				}
				else
				{
					err = fscanf(fp, "%lf", &temp);
					if (err == 0 || err == EOF) {
						printf("Cannot read A[%d][%d]\n", i, j);
						exit(1);
					}
					//replacing a.xi with a.xi1 - a.xi2
					tempArray[tempArrayCounter] = temp;
					tempArrayCounter++;
					tempArray[tempArrayCounter] = temp*(-1);
					tempArrayCounter++;
				}
			}
			else if(i>=1)
			{
				//slack variables
				tempArray[tempArrayCounter] = (i==(j-numberOfColumnsInOriginalMatrix+1));
				if(tempArray[tempArrayCounter]==1)
					slackVariableIndex = tempArrayCounter;
				tempArrayCounter++;
			}
		}
		
		
		if(i>=1)	//because not needed for 0th row
		{
			//check direction of inequality
			// -1 denotes <=
			// 0 denotes =
			// 1 denotes >=
			directionOfInequality = 0;
			err = fscanf(fp, "%d", &directionOfInequality);
			if (err == 0 || err == EOF || (directionOfInequality*directionOfInequality > 1)) {
				printf("Cannot read A[%d][%d]\n", i, numberOfColumnsInOriginalMatrix);
				exit(1);
			}
			
			writetofile(opFile,tempArray,numberOfColumnsInExtendedMatrix, directionOfInequality);
			/*if(tempArray[0]<0)
			{
				negateRow(tempArray, tab->numberOfColumns);
				if(directionOfInequality==-1)
				{
					tempArray[slackVariableIndex] = 1;
				}
			}
			else if(directionOfInequality==0)
			{
				tempArray[slackVariableIndex] = 0;
			}*/
			if(directionOfInequality == 1)
			{
				tempArray[slackVariableIndex] = -1;
				if(tempArray[0]<=0)
				{
					negateRow(tempArray, tab->numberOfColumns);
				}
				else
				{
					if(tab->firstPivotRow==-1)
					{
						tab->firstPivotRow = i;
					}
				}
			}
		}

		cudaMemcpy((double *)((char *)tab->table + i *pitch), tempArray, ((tab->numberOfColumns) * (sizeof(double))), cudaMemcpyHostToDevice );	
	}
	printf("Read tableau [%d rows x %d columns] from file '%s'.\n", tab->numberOfRows, numberOfColumnsInOriginalMatrix, filename);
	
	if(verbosityLevel)
	{
		updateHostTable(tab->table,tab->pitch, tab->numberOfRows, tab->numberOfColumns);
	}
	
	fclose(fp);
}

__global__ void divideByPivotKernel(double * table, int pitch, int rowIndex, int columnIndex, double pivot, int numberOfColumns)
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;
	
	if(index>=numberOfColumns)
		return;

	double * row = (double*)((char*)table +  rowIndex* pitch);
	row[index] /= pivot;
	return;
}

__global__ void computeNewValuesForRowsKernel(double * table, int pitch, int pivotRowIndex, int pivotColumnIndex, int numberOfColumns, int numberOfElements)
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;
	
	int associatedRow = index/numberOfColumns;
	int associatedColumn = index%numberOfColumns;
	
	//not for elements in pivotColumn
	if(pivotRowIndex==associatedRow || index>=numberOfElements || associatedColumn==pivotColumnIndex)
		return;
		
	double * row = (double*)((char*)table +  associatedRow* pitch);
	double * pivotRow = (double*)((char*)table +  pivotRowIndex* pitch);
	
	double multiplier = row[pivotColumnIndex];
	row[associatedColumn] = row[associatedColumn]*pivotRow[pivotColumnIndex] - multiplier * pivotRow[associatedColumn];
	
	return;
}

__global__ void computeNewValuesForRowsInPivotColumn(double * table, int pitch, int pivotColumn, int pivotRow, int numberOfRows)
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;
	
	if(index>=numberOfRows || index==pivotRow)
		return;
	
	double * row = (double*)((char*)table +  index* pitch);
	row[pivotColumn] = 0.;
	/*double *pivotRowArray = (double*)((char*)table +  pivotRow* pitch);
	double multiplier = row[pivotColumn];
	row[pivotColumn] -= multiplier * pivotRowArray[pivotColumn];*/
	return;
}

void pivot_on(Tableau *tab, int row, int col) {
	double pivot;

  	cudaMemcpy(&pivot, (double*)((char*)tab->table + row*(tab->pitch)) + col, sizeof(double),cudaMemcpyDeviceToHost);
	int numberOfElements = tab->numberOfColumns * tab->numberOfRows;
  	assert(pivot>0);
  
  	//launch kernel function to do the division
  	divideByPivotKernel<<< (tab->numberOfColumns + (THREADS_PER_BLOCK-1)) / THREADS_PER_BLOCK, THREADS_PER_BLOCK >>>( tab->table, tab->pitch, row, col, pivot, tab->numberOfColumns );
  
  	//launch kernel to compute the new rows
  	computeNewValuesForRowsKernel<<< (numberOfElements + (THREADS_PER_BLOCK-1)) / THREADS_PER_BLOCK, THREADS_PER_BLOCK >>>( tab->table, tab->pitch, row, col, tab->numberOfColumns, numberOfElements );

	//launch kernel to compute the pivot column
	computeNewValuesForRowsInPivotColumn<<<(tab->numberOfRows + (THREADS_PER_BLOCK-1))/THREADS_PER_BLOCK, THREADS_PER_BLOCK>>>(tab->table, tab->pitch, col, row, tab->numberOfRows);
}

__global__ void findPivotIndex(double * array, Element * elements, int size, int numberOfThreadsRequired, int maxNumberOfElementsPerThread, int maxOrMin, int offset)
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;
	
	if(index>=numberOfThreadsRequired)
		return;
	
	int start = index * maxNumberOfElementsPerThread;
	int end = (start + maxNumberOfElementsPerThread )>=size?(size-1):(start+maxNumberOfElementsPerThread -1);
	
	double solution = array[start];
	int indexToSolution = start;
	
	for(int i=start+1;i<=end;i++)
	{
		if(maxOrMin==0)	//need to find max
		{
			if(array[i]>solution && !equalsTo( array[i],solution))
			{
				solution = array[i];
				indexToSolution = i;
			}
		}
		else
		{
			if(array[i]<solution && !equalsTo( array[i],solution))
			{
				solution = array[i];
				indexToSolution = i;
			}
		}
	}
	
	elements[index].value = solution;
	elements[index].index = indexToSolution+offset;
	
	return;
}

// Find pivot_col = most negative column in mat[0][1..n]
int find_pivot_column(Tableau *tab, int verbosityLevel) {
  	int j, pivot_col;
	int offset = 0;		
	int maxOrMin = 1;	//denotes whether we need to find max element or min element for pivoting. max = 0. min = 1.
	int length = tab->numberOfColumns;
	double * pivotRow = tab->table;
	
	if(tab->firstPivotRow!=-1)
	{
		pivotRow = (double *)((char *)tab->table + (tab->firstPivotRow)*(tab->pitch));
		pivotRow++;		//eliminating the 0th element from the find max operation
		tab->firstPivotRow = -1;
		maxOrMin = 0;
		offset = 1;		//because we don't need to compare the objective value
		length -= 1;
	}
	
	
	int numberOfElementsToCompareInCPU = length/NUMBER_OF_ELEMENTS_PER_THREAD +
	(length%NUMBER_OF_ELEMENTS_PER_THREAD>0?1:0);
	Element elements[numberOfElementsToCompareInCPU];
	Element *elementsInDevice;
	int size = sizeof(Element)*numberOfElementsToCompareInCPU;
	
	cudaMalloc( (void **) &elementsInDevice, size);
	
	
	//launch kernel
	findPivotIndex<<< (tab->numberOfColumns + (THREADS_PER_BLOCK-1)) / THREADS_PER_BLOCK, THREADS_PER_BLOCK >>>
	( pivotRow, elementsInDevice, length, numberOfElementsToCompareInCPU, NUMBER_OF_ELEMENTS_PER_THREAD, maxOrMin, offset);
	cudaMemcpy(elements, elementsInDevice, size, cudaMemcpyDeviceToHost);
  	
	//double lowest = tab->mat[0][pivot_col];
	pivot_col = elements[0].index;
	double solution = elements[0].value;
	
  	for(j=1; j<numberOfElementsToCompareInCPU; j++) {
  		if(maxOrMin==0)		//need to find max
		{
			if (elements[j].value > solution) {
      			solution = elements[j].value;
      			pivot_col = elements[j].index;
			}
		}
		else
		{
			if (elements[j].value < solution) {
      			solution = elements[j].value;
      			pivot_col = elements[j].index;
			}
		}
  	}
	if(verbosityLevel)
		printf("Most negative column in row[0] is col %d = %g.\n", pivot_col, solution);
  	if( (solution >= 0 && maxOrMin ==1) || (maxOrMin==1 && equal(solution, 0.))) {
    		return -1; // All positive columns in row[0], this is optimal.
  	}
	
	cudaFree(elementsInDevice);
  	return pivot_col;
}

__global__ void find_pivot_kernel( )
{
	return;
}

__global__ void computeRatioKernel(double * table, int pitch, int pivotColumn, double * ratioArray, int numOfRows )
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;
	
	if(index==0 || index>=numOfRows)
		return;
	
	double* row = (double*)((char*)table + index * pitch);
	ratioArray[index] = -1;
	if(row[pivotColumn]>0 && !equalsTo(row[pivotColumn],0.))
		ratioArray[index] = row[0]/row[pivotColumn];
	return;
}


// Find the pivot_row, with smallest positive ratio = col[0] / col[pivot]
int find_pivot_row(Tableau *tab, int pivot_col, int verbosityLevel) {
	int i, pivot_row = 0;
	double min_ratio = -1;
  
	double * ratioArrayInDevice;
	double * ratioArrayInHost;
	int size = (tab->numberOfRows)*sizeof(double);
  
	cudaMalloc( (void **) &ratioArrayInDevice, size);
	ratioArrayInHost = (double *)malloc(size);
  
	if(verbosityLevel)
		printf("Ratios A[row_i,0]/A[row_i,%d] = [",pivot_col);
  
	//launch kernel to compute the ratios
	computeRatioKernel<<< (tab->numberOfRows + (THREADS_PER_BLOCK-1)) / THREADS_PER_BLOCK, THREADS_PER_BLOCK >>>( tab->table, tab->pitch, pivot_col, ratioArrayInDevice, tab->numberOfRows );
  
	cudaMemcpy( ratioArrayInHost, ratioArrayInDevice, size, cudaMemcpyDeviceToHost );
  
	for(i=1;i<tab->numberOfRows;i++){
		double ratio = ratioArrayInHost[i];
		if(verbosityLevel)
			printf("%3.2lf, ", ratio);
		if ( (ratio >= 0  && ratio < min_ratio ) || min_ratio < 0 || (equal(ratio, 0.) && ratio<min_ratio)) {
			min_ratio = ratio;
			if(equal(ratio, 0.))
				min_ratio = 0.0;
			pivot_row = i;
		}
	}  
	if(verbosityLevel)
		printf("].\n");
  
	cudaFree(ratioArrayInDevice);
	free(ratioArrayInHost);
  
	if (min_ratio == -1)
		return -1; // Unbounded.
	if(verbosityLevel)
		printf("Found pivot A[%d,%d], min positive ratio=%g in row=%d.\n", pivot_row, pivot_col, min_ratio, pivot_row);
	
	return pivot_row;
}

// Given a column of identity matrix, find the row containing 1.
// return -1, if the column as not from an identity matrix.
 
__global__ void findBasisVariableKernel(double * deviceTable, int pitch, Element * indicesToBasisVariableArray, int numberOfRows, int numberOfColumns)
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;

	if(index>=numberOfColumns || index ==0)
		return;
	int xi = -1;
	double value;
	int flag = 0;
	
	for(int i=0;i<numberOfRows;i++)
	{
		double * row_i = (double *) ((char *) deviceTable + i*pitch);
		if (row_i[index]>0 && !equalsTo(row_i[index],0.) ) {
      			if (xi == -1)
        		{
					xi=i;   // found first +ve, save this row number.
					value = row_i[index];
				}
      			else
        		{
					flag = 1; // found second '1', not an identity matrix.
					break;
				}

    	} 
		else if (!equalsTo( row_i[index],0) ) {
			flag = 1;
      			break; // not an identity matrix column.
    		}
	}	
	
	if(flag==1)
		indicesToBasisVariableArray[index].index = -1;
	else
	{
		indicesToBasisVariableArray[index].index = xi;
		indicesToBasisVariableArray[index].value = value;
	}
	return;
}

void print_optimal_vector(Tableau *tab, char *message) {
	int j, xi;
	printf("%s at ", message);
	
	Element * indicesToBasisVariablesInDevice;
	Element * indicesToBasisVariablesInHost;
	
	double basisVariable;
	
	int size = sizeof(Element)*(tab->numberOfColumns);

	cudaMalloc( (void **) &indicesToBasisVariablesInDevice, size);
	indicesToBasisVariablesInHost = (Element *)malloc(size);

	//launch kernel to compute basis variable for each column
	findBasisVariableKernel<<<(tab->numberOfColumns + (THREADS_PER_BLOCK-1)) / THREADS_PER_BLOCK, 
	THREADS_PER_BLOCK >>>(tab->table, tab->pitch, indicesToBasisVariablesInDevice, tab->numberOfRows, tab->numberOfColumns);

	cudaMemcpy(indicesToBasisVariablesInHost, indicesToBasisVariablesInDevice, size, cudaMemcpyDeviceToHost);
	
	int flag = 0;
	double variableValue = 0;
	double transformedVariableValue = 0;
	
  	for(j=1;j<tab->numberOfColumns;j++) { // for each column.
		
		xi = indicesToBasisVariablesInHost[j].index;
    	if (xi != -1)
		{
			cudaMemcpy(&basisVariable, (double *)((char *)tab->table + xi * tab->pitch), sizeof(double),cudaMemcpyDeviceToHost);
			//printf("x%d=%3.2lf, ", j, basisVariable/indicesToBasisVariablesInHost[j].value );
			transformedVariableValue = (basisVariable/indicesToBasisVariablesInHost[j].value );
		}
    	else
		{
			transformedVariableValue = 0;
			//printf("x%d=0, ", j);
		}
		variableValue += flag==0?transformedVariableValue:(-1*transformedVariableValue);
		flag ^= 1;
		if(!flag)
		{
			if(((j+1)/2)<tab->numberOfColumnsInOriginalMatrix)
				printf("x%d=%3.2lf, ", (j+1)/2,variableValue);
			variableValue = 0;
		}
  	}
  	printf("\n");
	cudaFree(indicesToBasisVariablesInDevice);
	free(indicesToBasisVariablesInHost);
} 

void simplex(Tableau *tab, int maxIteration, int verbosityLevel) {
	int loop=0;
	double optimalValue;
	double pValue;

	while( ++loop ) {
		int pivot_col, pivot_row = -1;

		pivot_col = find_pivot_column(tab, verbosityLevel);
		if( pivot_col < 0 ) {
			cudaMemcpy(&optimalValue, tab->table, sizeof(double), cudaMemcpyDeviceToHost);
			cudaMemcpy(&pValue, tab->table + (tab->numberOfColumns) - 1, sizeof(double), cudaMemcpyDeviceToHost);
			printf("Found optimal value=A[0,0]=%3.2lf (no negatives in row 0).\n", optimalValue/pValue);
			print_optimal_vector(tab, "Optimal vector");
			break;
		}
		if(verbosityLevel)
			printf("Entering variable x%d to be made basic, so pivot_col=%d.\n", pivot_col, pivot_col);

		pivot_row = find_pivot_row(tab, pivot_col, verbosityLevel);
		
		if (pivot_row < 0) {
			//if(verbosityLevel)
				printf("unbounded (no pivot_row).\n");
			break;
		}
		if(verbosityLevel)
			printf("Leaving variable x%d, so pivot_row=%d\n", pivot_row, pivot_row);

		pivot_on(tab, pivot_row, pivot_col);
		if(verbosityLevel)
		{
			updateHostTable(tab->table,tab->pitch, tab->numberOfRows, tab->numberOfColumns);
			print_tableau(demoTab,"After pivoting", verbosityLevel);
			print_optimal_vector(tab, "Basic feasible solution");
		}

		if(loop > maxIteration) {
			printf("Too many iterations > %d.\n", loop);
			break;
		}
	}
	printf("number of iterations: %d\n", loop);
	cudaFree(tab->table);
}

int main(int argc, char *argv[]){
	Tableau * tab;
	tab = (Tableau *) malloc(sizeof(Tableau));
	tab->firstPivotRow = -1;
	
	int verbosityLevel = 0;
	int maxIteration = 0;
	
	struct timeval  tv1, tv2;

	
	/* here, do your time-consuming job */
	
	if (argc > 3) { // usage: cmd datafile i/n max_iteration_number
		if(strcasecmp(argv[2],"i")==0)
		{
			verbosityLevel = 1;
			demoTab = (Tab *) malloc(sizeof(Tab));	//allocate memory in RAM for display purpose
		}
		maxIteration = atoi(argv[3]);
		
		read_tableau(tab, argv[1], verbosityLevel);
	}
	else
	{
		printf("usage: cmd <datafile> <i/n> <max)iteration_number> \n");
		free(tab);
		exit(1);
	}
	
	print_tableau(demoTab,"Initial", verbosityLevel);
	gettimeofday(&tv1, NULL);
	/* stuff to do! */
	simplex(tab, maxIteration, verbosityLevel);
	gettimeofday(&tv2, NULL);

	printf ("Total time = %f seconds\n",
         (double) (tv2.tv_usec - tv1.tv_usec) / 1000000 +
         (double) (tv2.tv_sec - tv1.tv_sec));
	
	
	free(tab);
	if(verbosityLevel)
		free(demoTab);
	return 0;
} 


	.file	"tmpxft_002f862a_00000000-6_simplex.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2044:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2044:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z5equaldd
	.type	_Z5equaldd, @function
_Z5equaldd:
.LFB2027:
	.cfi_startproc
	endbr64
	subsd	%xmm1, %xmm0
	movsd	.LC1(%rip), %xmm1
	andps	.LC0(%rip), %xmm0
	xorl	%eax, %eax
	comisd	%xmm0, %xmm1
	seta	%al
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z5equaldd, .-_Z5equaldd
	.globl	_Z8equalsTodd
	.type	_Z8equalsTodd, @function
_Z8equalsTodd:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE2028:
	.size	_Z8equalsTodd, .-_Z8equalsTodd
	.globl	_Z2nli
	.type	_Z2nli, @function
_Z2nli:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%edi, %ebx
	pushq	%rdx
	.cfi_def_cfa_offset 32
.L6:
	cmpl	%ebx, %ebp
	jge	.L10
	movl	$45, %edi
	incl	%ebp
	call	putchar@PLT
	jmp	.L6
.L10:
	popq	%rax
	.cfi_def_cfa_offset 24
	movl	$10, %edi
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	putchar@PLT
	.cfi_endproc
.LFE2029:
	.size	_Z2nli, .-_Z2nli
	.globl	_Z15updateHostTablePdiii
	.type	_Z15updateHostTablePdiii, @function
_Z15updateHostTablePdiii:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movslq	%esi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movl	%edx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movslq	%ecx, %rbx
	salq	$3, %rbx
.L12:
	cmpl	%r12d, %r13d
	jle	.L15
	imulq	$40000, %r12, %rax
	movq	%rbp, %rsi
	movl	$2, %ecx
	incq	%r12
	movq	demoTab(%rip), %rdx
	addq	%r14, %rbp
	leaq	8(%rdx,%rax), %rdi
	movq	%rbx, %rdx
	call	cudaMemcpy@PLT
	jmp	.L12
.L15:
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z15updateHostTablePdiii, .-_Z15updateHostTablePdiii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%lfx%d "
.LC4:
	.string	"+ %lfx%d "
.LC5:
	.string	"- %lfx%d "
.LC6:
	.string	" >= %lf"
.LC7:
	.string	" <= %lf"
.LC8:
	.string	" = %lf"
.LC9:
	.string	";\n"
	.text
	.globl	_Z11writetofileP8_IO_FILEPdii
	.type	_Z11writetofileP8_IO_FILEPdii, @function
_Z11writetofileP8_IO_FILEPdii:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC4(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC5(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%edx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%ecx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	$1, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movsd	(%rsi), %xmm2
	movq	%rdi, (%rsp)
	movsd	%xmm2, 8(%rsp)
.L17:
	movl	%ebx, %ecx
	cmpl	%ebx, %r13d
	jle	.L33
	cmpq	$1, %rbx
	jne	.L18
	movsd	8(%rbp), %xmm0
	movl	$1, %ecx
	leaq	.LC2(%rip), %rdx
	jmp	.L31
.L18:
	movsd	0(%rbp,%rbx,8), %xmm0
	xorps	%xmm1, %xmm1
	comisd	%xmm1, %xmm0
	jb	.L29
	andps	.LC0(%rip), %xmm0
	movq	%r15, %rdx
	jmp	.L31
.L29:
	comisd	%xmm0, %xmm1
	jbe	.L19
	andps	.LC0(%rip), %xmm0
	movq	%r14, %rdx
.L31:
	movq	(%rsp), %rdi
	movl	$2, %esi
	movb	$1, %al
	call	__fprintf_chk@PLT
.L19:
	incq	%rbx
	jmp	.L17
.L33:
	movsd	8(%rsp), %xmm0
	leaq	.LC6(%rip), %rdx
	cmpl	$1, %r12d
	je	.L32
	incl	%r12d
	leaq	.LC7(%rip), %rdx
	je	.L32
	leaq	.LC8(%rip), %rdx
.L32:
	movq	(%rsp), %rdi
	movl	$2, %esi
	movb	$1, %al
	call	__fprintf_chk@PLT
	movq	(%rsp), %rdi
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	leaq	.LC9(%rip), %rdx
	popq	%rbp
	.cfi_def_cfa_offset 40
	movl	$2, %esi
	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
	jmp	__fprintf_chk@PLT
	.cfi_endproc
.LFE2031:
	.size	_Z11writetofileP8_IO_FILEPdii, .-_Z11writetofileP8_IO_FILEPdii
	.section	.rodata.str1.1
.LC10:
	.string	"\n%d. Tableau %s:\n"
.LC11:
	.string	"b[i]"
.LC12:
	.string	"col:"
.LC13:
	.string	"%-6s%5s"
.LC14:
	.string	"    x%d,"
.LC15:
	.string	"\n"
.LC16:
	.string	"max:"
.LC17:
	.string	"b%d: "
.LC18:
	.string	" %6d"
.LC19:
	.string	" %6.2lf"
	.text
	.globl	_Z13print_tableauP3TabPKci
	.type	_Z13print_tableauP3TabPKci, @function
_Z13print_tableauP3TabPKci:
.LFB2032:
	.cfi_startproc
	endbr64
	testl	%edx, %edx
	je	.L34
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	_ZZ13print_tableauP3TabPKciE7counter(%rip), %eax
	movq	%rsi, %rcx
	leaq	.LC10(%rip), %rsi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leal	1(%rax), %edx
	xorl	%eax, %eax
	leaq	.LC14(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rdi, %rbp
	movl	$2, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movl	$1, %ebx
	movl	%edx, _ZZ13print_tableauP3TabPKciE7counter(%rip)
	call	__printf_chk@PLT
	movl	$70, %edi
	call	_Z2nli
	leaq	.LC11(%rip), %rcx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC12(%rip), %rdx
	leaq	.LC13(%rip), %rsi
	call	__printf_chk@PLT
.L36:
	cmpl	4(%rbp), %ebx
	jge	.L52
	movl	%ebx, %edx
	movq	%r12, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	incl	%ebx
	jmp	.L36
.L52:
	leaq	.LC15(%rip), %r13
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	movq	%r13, %rsi
	call	__printf_chk@PLT
.L38:
	cmpl	%ebx, 0(%rbp)
	jle	.L53
	testq	%rbx, %rbx
	jne	.L39
	leaq	.LC16(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L40
.L39:
	movl	%ebx, %edx
	leaq	.LC17(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L40:
	imulq	$40000, %rbx, %r12
	xorl	%r14d, %r14d
	addq	%rbp, %r12
.L41:
	cmpl	%r14d, 4(%rbp)
	jle	.L54
	movsd	8(%r12,%r14,8), %xmm1
	movsd	.LC1(%rip), %xmm2
	cvttsd2sil	%xmm1, %edx
	cvtsi2sdl	%edx, %xmm0
	subsd	%xmm1, %xmm0
	andps	.LC0(%rip), %xmm0
	comisd	%xmm0, %xmm2
	jbe	.L48
	leaq	.LC18(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L44
.L48:
	movaps	%xmm1, %xmm0
	leaq	.LC19(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
.L44:
	incq	%r14
	jmp	.L41
.L54:
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%rbx
	call	__printf_chk@PLT
	jmp	.L38
.L53:
	popq	%rbx
	.cfi_restore 3
	.cfi_def_cfa_offset 40
	movl	$70, %edi
	popq	%rbp
	.cfi_restore 6
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_restore 12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_restore 13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_restore 14
	.cfi_def_cfa_offset 8
	jmp	_Z2nli
.L34:
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z13print_tableauP3TabPKci, .-_Z13print_tableauP3TabPKci
	.globl	_Z9negateRowPdi
	.type	_Z9negateRowPdi, @function
_Z9negateRowPdi:
.LFB2033:
	.cfi_startproc
	endbr64
	movq	.LC20(%rip), %xmm1
	xorl	%eax, %eax
.L56:
	cmpl	%eax, %esi
	jle	.L58
	movsd	(%rdi,%rax,8), %xmm0
	xorps	%xmm1, %xmm0
	movsd	%xmm0, (%rdi,%rax,8)
	incq	%rax
	jmp	.L56
.L58:
	ret
	.cfi_endproc
.LFE2033:
	.size	_Z9negateRowPdi, .-_Z9negateRowPdi
	.section	.rodata.str1.1
.LC21:
	.string	"%lf "
	.text
	.globl	_Z8printRowPdi
	.type	_Z8printRowPdi, @function
_Z8printRowPdi:
.LFB2034:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC21(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
	pushq	%rcx
	.cfi_def_cfa_offset 48
.L60:
	cmpl	%ebx, %ebp
	jle	.L63
	movsd	(%r12,%rbx,8), %xmm0
	movq	%r13, %rsi
	movl	$2, %edi
	movb	$1, %al
	incq	%rbx
	call	__printf_chk@PLT
	jmp	.L60
.L63:
	popq	%rdx
	.cfi_def_cfa_offset 40
	leaq	.LC15(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 32
	movl	$2, %edi
	popq	%rbp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2034:
	.size	_Z8printRowPdi, .-_Z8printRowPdi
	.section	.rodata.str1.1
.LC23:
	.string	"r"
.LC24:
	.string	"Cannot read %s\n"
.LC25:
	.string	"%d %d"
.LC26:
	.string	"Cannot read m or n\n"
.LC27:
	.string	"w"
.LC28:
	.string	"printEquations.txt"
.LC29:
	.string	"%lf"
.LC30:
	.string	"Cannot read A[%d][%d]\n"
.LC31:
	.string	"%d"
.LC33:
	.string	"Read tableau [%d rows x %d columns] from file '%s'.\n"
	.text
	.globl	_Z12read_tableauP7TableauPKci
	.type	_Z12read_tableauP7TableauPKci, @function
_Z12read_tableauP7TableauPKci:
.LFB2035:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	.cfi_offset 15, -24
	movq	%rdi, %r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$104, %rsp
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%rsi, -104(%rbp)
	movq	-104(%rbp), %rdi
	leaq	.LC23(%rip), %rsi
	movl	%edx, -108(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	fopen@PLT
	movq	%rax, -88(%rbp)
	testq	%rax, %rax
	jne	.L65
	movq	-104(%rbp), %rdx
	leaq	.LC24(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	jmp	.L107
.L65:
	movq	-88(%rbp), %rdi
	leaq	12(%r15), %rcx
	leaq	8(%r15), %rdx
	xorl	%eax, %eax
	leaq	.LC25(%rip), %rsi
	call	__isoc23_fscanf@PLT
	incl	%eax
	cmpl	$1, %eax
	ja	.L66
	leaq	.LC26(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L107:
	movl	$1, %edi
	call	exit@PLT
.L66:
	movl	12(%r15), %r13d
	movslq	8(%r15), %rcx
	cmpl	$0, -108(%rbp)
	leal	-1(%r13,%r13), %eax
	movl	%r13d, 16(%r15)
	leal	(%rcx,%rax), %edx
	movl	%eax, -112(%rbp)
	movl	%edx, 12(%r15)
	je	.L67
	movq	demoTab(%rip), %rax
	movl	%ecx, (%rax)
	movl	%edx, 4(%rax)
.L67:
	movslq	%edx, %rdx
	leaq	-72(%rbp), %rsi
	movq	%r15, %rdi
	salq	$3, %rdx
	call	cudaMallocPitch@PLT
	movslq	12(%r15), %r12
	movq	-72(%rbp), %rax
	movq	%rsp, %rcx
	salq	$3, %r12
	movl	%eax, 24(%r15)
	leaq	15(%r12), %rdx
	movq	%rdx, %rax
	andq	$-4096, %rdx
	andq	$-16, %rax
	subq	%rdx, %rcx
.L68:
	cmpq	%rcx, %rsp
	je	.L69
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L68
.L69:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L70
	orq	$0, -8(%rsp,%rax)
.L70:
	movl	8(%r15), %eax
	xorl	%edx, %edx
	leaq	.LC27(%rip), %rsi
	movq	%rsp, %rbx
	leaq	.LC28(%rip), %rdi
	movl	%edx, -76(%rbp)
	addl	%r13d, %eax
	decl	%eax
	movl	%eax, -116(%rbp)
	call	fopen@PLT
	movslq	12(%r15), %rdx
	movq	%r12, %rcx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	movq	%rax, -128(%rbp)
	xorl	%r12d, %r12d
	salq	$3, %rdx
	call	__memset_chk@PLT
	movl	$-1, -96(%rbp)
.L71:
	movl	8(%r15), %edx
	movl	%r12d, -120(%rbp)
	movl	%r12d, -92(%rbp)
	cmpl	%r12d, %edx
	jle	.L109
	movl	12(%r15), %eax
	testq	%r12, %r12
	leal	-1(%rax), %eax
	cltq
	jne	.L72
	movq	.LC22(%rip), %rdi
	movq	%rdi, (%rbx,%rax,8)
.L74:
	xorl	%ecx, %ecx
	xorl	%r14d, %r14d
	jmp	.L73
.L72:
	movq	$0x000000000, (%rbx,%rax,8)
	jmp	.L74
.L78:
	movsd	-64(%rbp), %xmm0
	movslq	%ecx, %rax
	movsd	%xmm0, (%rbx,%rax,8)
	leal	1(%rcx), %eax
	xorps	.LC20(%rip), %xmm0
	addl	$2, %ecx
	cltq
	movsd	%xmm0, (%rbx,%rax,8)
.L77:
	incl	%r14d
.L73:
	movl	-116(%rbp), %eax
	cmpl	%eax, %r14d
	jge	.L110
	cmpl	%r13d, %r14d
	jge	.L75
	testl	%r14d, %r14d
	jne	.L76
	movslq	%ecx, %rax
	movq	-88(%rbp), %rdi
	leaq	.LC29(%rip), %rsi
	movl	%ecx, -132(%rbp)
	leaq	(%rbx,%rax,8), %rdx
	xorl	%eax, %eax
	call	__isoc23_fscanf@PLT
	movl	-132(%rbp), %ecx
	incl	%eax
	incl	%ecx
	cmpl	$1, %eax
	ja	.L77
	xorl	%ecx, %ecx
	jmp	.L108
.L76:
	movq	-88(%rbp), %rdi
	xorl	%eax, %eax
	leaq	-64(%rbp), %rdx
	movl	%ecx, -132(%rbp)
	leaq	.LC29(%rip), %rsi
	call	__isoc23_fscanf@PLT
	movl	-132(%rbp), %ecx
	incl	%eax
	cmpl	$1, %eax
	ja	.L78
	movl	%r14d, %ecx
	jmp	.L108
.L75:
	testq	%r12, %r12
	je	.L77
	movl	%r14d, %eax
	movl	-120(%rbp), %edi
	xorps	%xmm0, %xmm0
	subl	%r13d, %eax
	incl	%eax
	cmpl	%edi, %eax
	jne	.L79
	movl	%ecx, -96(%rbp)
	movsd	.LC22(%rip), %xmm0
.L79:
	movslq	%ecx, %rax
	incl	%ecx
	movsd	%xmm0, (%rbx,%rax,8)
	jmp	.L77
.L110:
	testq	%r12, %r12
	je	.L82
	xorl	%eax, %eax
	movq	-88(%rbp), %rdi
	leaq	-76(%rbp), %rdx
	leaq	.LC31(%rip), %rsi
	movl	%eax, -76(%rbp)
	xorl	%eax, %eax
	call	__isoc23_fscanf@PLT
	incl	%eax
	cmpl	$1, %eax
	jbe	.L83
	movl	-76(%rbp), %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	decl	%eax
	jle	.L84
.L83:
	movl	%r13d, %ecx
.L108:
	movl	-92(%rbp), %edx
	leaq	.LC30(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L107
.L84:
	movl	-112(%rbp), %edx
	movq	-128(%rbp), %rdi
	movq	%rbx, %rsi
	call	_Z11writetofileP8_IO_FILEPdii
	cmpl	$1, -76(%rbp)
	jne	.L82
	movslq	-96(%rbp), %rax
	movq	.LC32(%rip), %rdi
	xorps	%xmm0, %xmm0
	movl	12(%r15), %esi
	movq	%rdi, (%rbx,%rax,8)
	comisd	(%rbx), %xmm0
	jb	.L105
	movq	%rbx, %rdi
	call	_Z9negateRowPdi
	jmp	.L82
.L105:
	cmpl	$-1, 20(%r15)
	jne	.L82
	movl	-92(%rbp), %eax
	movl	%eax, 20(%r15)
.L82:
	movslq	12(%r15), %rdx
	movq	-72(%rbp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	imulq	%r12, %rdi
	salq	$3, %rdx
	addq	(%r15), %rdi
	incq	%r12
	call	cudaMemcpy@PLT
	jmp	.L71
.L109:
	movq	-104(%rbp), %r8
	xorl	%eax, %eax
	movl	%r13d, %ecx
	leaq	.LC33(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	cmpl	$0, -108(%rbp)
	je	.L89
	movl	12(%r15), %ecx
	movl	8(%r15), %edx
	movl	24(%r15), %esi
	movq	(%r15), %rdi
	call	_Z15updateHostTablePdiii
.L89:
	movq	-88(%rbp), %rdi
	call	fclose@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L90
	call	__stack_chk_fail@PLT
.L90:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2035:
	.size	_Z12read_tableauP7TableauPKci, .-_Z12read_tableauP7TableauPKci
	.globl	_Z44__device_stub__Z19divideByPivotKernelPdiiidiPdiiidi
	.type	_Z44__device_stub__Z19divideByPivotKernelPdiiidiPdiiidi, @function
_Z44__device_stub__Z19divideByPivotKernelPdiiidiPdiiidi:
.LFB2066:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 12(%rsp)
	leaq	48(%rsp), %rcx
	movl	%r8d, 8(%rsp)
	movsd	%xmm0, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 128(%rsp)
	movq	%rsp, %rax
	movq	%rax, 136(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L111
	pushq	48(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z19divideByPivotKernelPdiiidi(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 192
	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 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L111:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L113
	call	__stack_chk_fail@PLT
.L113:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2066:
	.size	_Z44__device_stub__Z19divideByPivotKernelPdiiidiPdiiidi, .-_Z44__device_stub__Z19divideByPivotKernelPdiiidiPdiiidi
	.globl	_Z19divideByPivotKernelPdiiidi
	.type	_Z19divideByPivotKernelPdiiidi, @function
_Z19divideByPivotKernelPdiiidi:
.LFB2067:
	.cfi_startproc
	endbr64
	jmp	_Z44__device_stub__Z19divideByPivotKernelPdiiidiPdiiidi
	.cfi_endproc
.LFE2067:
	.size	_Z19divideByPivotKernelPdiiidi, .-_Z19divideByPivotKernelPdiiidi
	.globl	_Z54__device_stub__Z29computeNewValuesForRowsKernelPdiiiiiPdiiiii
	.type	_Z54__device_stub__Z29computeNewValuesForRowsKernelPdiiiiiPdiiiii, @function
_Z54__device_stub__Z29computeNewValuesForRowsKernelPdiiiiiPdiiiii:
.LFB2068:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 12(%rsp)
	leaq	48(%rsp), %rcx
	movl	%r8d, 8(%rsp)
	movl	%r9d, 4(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L116
	pushq	48(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z29computeNewValuesForRowsKernelPdiiiii(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 192
	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 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L116:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L118
	call	__stack_chk_fail@PLT
.L118:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2068:
	.size	_Z54__device_stub__Z29computeNewValuesForRowsKernelPdiiiiiPdiiiii, .-_Z54__device_stub__Z29computeNewValuesForRowsKernelPdiiiiiPdiiiii
	.globl	_Z29computeNewValuesForRowsKernelPdiiiii
	.type	_Z29computeNewValuesForRowsKernelPdiiiii, @function
_Z29computeNewValuesForRowsKernelPdiiiii:
.LFB2069:
	.cfi_startproc
	endbr64
	jmp	_Z54__device_stub__Z29computeNewValuesForRowsKernelPdiiiiiPdiiiii
	.cfi_endproc
.LFE2069:
	.size	_Z29computeNewValuesForRowsKernelPdiiiii, .-_Z29computeNewValuesForRowsKernelPdiiiii
	.globl	_Z60__device_stub__Z36computeNewValuesForRowsInPivotColumnPdiiiiPdiiii
	.type	_Z60__device_stub__Z36computeNewValuesForRowsInPivotColumnPdiiiiPdiiii, @function
_Z60__device_stub__Z36computeNewValuesForRowsInPivotColumnPdiiiiPdiiii:
.LFB2070:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 12(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L121
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z36computeNewValuesForRowsInPivotColumnPdiiii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L121:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L123
	call	__stack_chk_fail@PLT
.L123:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2070:
	.size	_Z60__device_stub__Z36computeNewValuesForRowsInPivotColumnPdiiiiPdiiii, .-_Z60__device_stub__Z36computeNewValuesForRowsInPivotColumnPdiiiiPdiiii
	.globl	_Z36computeNewValuesForRowsInPivotColumnPdiiii
	.type	_Z36computeNewValuesForRowsInPivotColumnPdiiii, @function
_Z36computeNewValuesForRowsInPivotColumnPdiiii:
.LFB2071:
	.cfi_startproc
	endbr64
	jmp	_Z60__device_stub__Z36computeNewValuesForRowsInPivotColumnPdiiiiPdiiii
	.cfi_endproc
.LFE2071:
	.size	_Z36computeNewValuesForRowsInPivotColumnPdiiii, .-_Z36computeNewValuesForRowsInPivotColumnPdiiii
	.globl	_Z8pivot_onP7Tableauii
	.type	_Z8pivot_onP7Tableauii, @function
_Z8pivot_onP7Tableauii:
.LFB2036:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movslq	%edx, %rdx
	movl	$2, %ecx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	movl	%esi, %eax
	imull	24(%rdi), %eax
	cltq
	leaq	(%rax,%rdx,8), %rsi
	movl	$8, %edx
	addq	(%rdi), %rsi
	leaq	8(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	12(%rbx), %eax
	movl	8(%rbx), %r13d
	xorl	%r9d, %r9d
	movl	$512, %esi
	movl	$8388609, %ecx
	xorl	%r8d, %r8d
	movl	$1, 36(%rsp)
	imull	%eax, %r13d
	addl	$511, %eax
	salq	$9, %rcx
	cltd
	movq	%rcx, 28(%rsp)
	idivl	%esi
	movq	%rcx, %rdx
	movl	$1, %ecx
	movl	%eax, 16(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 20(%rsp)
	movq	16(%rsp), %rdi
	movl	24(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L127
	movl	24(%rbx), %esi
	movl	12(%rbx), %r8d
	movl	%ebp, %ecx
	movl	%r12d, %edx
	movsd	8(%rsp), %xmm0
	movq	(%rbx), %rdi
	call	_Z44__device_stub__Z19divideByPivotKernelPdiiidiPdiiidi
.L127:
	movl	$512, %esi
	movl	$8388609, %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	leal	511(%r13), %eax
	salq	$9, %rcx
	movl	$1, 36(%rsp)
	cltd
	movq	%rcx, 28(%rsp)
	idivl	%esi
	movq	%rcx, %rdx
	movl	$1, %ecx
	movl	%eax, 16(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 20(%rsp)
	movq	16(%rsp), %rdi
	movl	24(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L128
	movl	24(%rbx), %esi
	movl	12(%rbx), %r8d
	movl	%r13d, %r9d
	movl	%ebp, %ecx
	movq	(%rbx), %rdi
	movl	%r12d, %edx
	call	_Z54__device_stub__Z29computeNewValuesForRowsKernelPdiiiiiPdiiiii
.L128:
	movl	8(%rbx), %eax
	movl	$512, %esi
	movl	$8388609, %ecx
	xorl	%r9d, %r9d
	salq	$9, %rcx
	xorl	%r8d, %r8d
	movl	$1, 36(%rsp)
	addl	$511, %eax
	movq	%rcx, 28(%rsp)
	cltd
	idivl	%esi
	movq	%rcx, %rdx
	movl	$1, %ecx
	movl	%eax, 16(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 20(%rsp)
	movq	16(%rsp), %rdi
	movl	24(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L126
	movl	24(%rbx), %esi
	movl	8(%rbx), %r8d
	movl	%r12d, %ecx
	movl	%ebp, %edx
	movq	(%rbx), %rdi
	call	_Z60__device_stub__Z36computeNewValuesForRowsInPivotColumnPdiiiiPdiiii
.L126:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L130
	call	__stack_chk_fail@PLT
.L130:
	addq	$56, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2036:
	.size	_Z8pivot_onP7Tableauii, .-_Z8pivot_onP7Tableauii
	.globl	_Z48__device_stub__Z14findPivotIndexPdP7ElementiiiiiPdP7Elementiiiii
	.type	_Z48__device_stub__Z14findPivotIndexPdP7ElementiiiiiPdP7Elementiiiii, @function
_Z48__device_stub__Z14findPivotIndexPdP7ElementiiiiiPdP7Elementiiiii:
.LFB2072:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, 4(%rsp)
	movl	%r9d, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movq	%rsp, %rax
	movq	%rax, 136(%rsp)
	leaq	176(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L132
	pushq	40(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z14findPivotIndexPdP7Elementiiiii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 192
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L132:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L134
	call	__stack_chk_fail@PLT
.L134:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2072:
	.size	_Z48__device_stub__Z14findPivotIndexPdP7ElementiiiiiPdP7Elementiiiii, .-_Z48__device_stub__Z14findPivotIndexPdP7ElementiiiiiPdP7Elementiiiii
	.globl	_Z14findPivotIndexPdP7Elementiiiii
	.type	_Z14findPivotIndexPdP7Elementiiiii, @function
_Z14findPivotIndexPdP7Elementiiiii:
.LFB2073:
	.cfi_startproc
	endbr64
	jmp	_Z48__device_stub__Z14findPivotIndexPdP7ElementiiiiiPdP7Elementiiiii
	.cfi_endproc
.LFE2073:
	.size	_Z14findPivotIndexPdP7Elementiiiii, .-_Z14findPivotIndexPdP7Elementiiiii
	.section	.rodata.str1.1
.LC34:
	.string	"Most negative column in row[0] is col %d = %g.\n"
	.text
	.globl	_Z17find_pivot_columnP7Tableaui
	.type	_Z17find_pivot_columnP7Tableaui, @function
_Z17find_pivot_columnP7Tableaui:
.LFB2037:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rcx
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	movl	%esi, %r14d
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$104, %rsp
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movl	12(%rdi), %r13d
	movq	(%rdi), %r10
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movl	20(%rdi), %eax
	cmpl	$-1, %eax
	je	.L155
	imull	24(%rdi), %eax
	decl	%r13d
	xorl	%r12d, %r12d
	movl	$1, %r11d
	movl	$-1, 20(%rdi)
	cltq
	leaq	8(%r10,%rax), %r10
	jmp	.L138
.L155:
	movl	$1, %r12d
	xorl	%r11d, %r11d
.L138:
	movl	%r13d, %eax
	movl	$10, %esi
	xorl	%ebx, %ebx
	cltd
	idivl	%esi
	testl	%edx, %edx
	movq	%rsp, %rdx
	setg	%bl
	addl	%eax, %ebx
	movslq	%ebx, %rax
	salq	$4, %rax
	movq	%rax, %rsi
	andq	$-4096, %rsi
	subq	%rsi, %rdx
.L139:
	cmpq	%rdx, %rsp
	je	.L140
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L139
.L140:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L141
	orq	$0, -8(%rsp,%rax)
.L141:
	leaq	7(%rsp), %rax
	leaq	-88(%rbp), %rdi
	movq	%r10, -128(%rbp)
	movq	%rax, %r15
	andq	$-8, %rax
	movl	%r11d, -116(%rbp)
	movq	%rax, -112(%rbp)
	movl	%ebx, %eax
	shrq	$3, %r15
	sall	$4, %eax
	movq	%rcx, -136(%rbp)
	cltq
	movq	%rax, %rsi
	movq	%rax, -104(%rbp)
	call	cudaMalloc@PLT
	movl	$8388609, %esi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	-136(%rbp), %rcx
	salq	$9, %rsi
	movl	$1, -60(%rbp)
	movq	%rsi, -68(%rbp)
	movl	12(%rcx), %eax
	movl	$512, %ecx
	addl	$511, %eax
	cltd
	idivl	%ecx
	movq	%rsi, %rdx
	movl	$1, %ecx
	movl	%eax, -80(%rbp)
	movabsq	$4294967297, %rax
	movq	%rax, -76(%rbp)
	movq	-80(%rbp), %rdi
	movl	-72(%rbp), %esi
	call	__cudaPushCallConfiguration@PLT
	movl	-116(%rbp), %r11d
	movq	-128(%rbp), %r10
	testl	%eax, %eax
	jne	.L142
	pushq	%rax
	movq	-88(%rbp), %rsi
	movl	%ebx, %ecx
	movl	%r13d, %edx
	pushq	%r11
	movl	%r12d, %r9d
	movl	$10, %r8d
	movq	%r10, %rdi
	call	_Z48__device_stub__Z14findPivotIndexPdP7ElementiiiiiPdP7Elementiiiii
	popq	%rdx
	popq	%rcx
.L142:
	movq	-104(%rbp), %rdx
	movq	-88(%rbp), %rsi
	movl	$2, %ecx
	movq	-112(%rbp), %rdi
	call	cudaMemcpy@PLT
	movq	-112(%rbp), %rax
	movl	$1, %edx
	movl	8(,%r15,8), %r13d
	movsd	0(,%r15,8), %xmm0
	addq	$24, %rax
.L143:
	cmpl	%ebx, %edx
	jge	.L172
	movsd	-8(%rax), %xmm1
	testl	%r12d, %r12d
	jne	.L144
	comisd	%xmm0, %xmm1
	jmp	.L171
.L144:
	comisd	%xmm1, %xmm0
.L171:
	jbe	.L145
	movl	(%rax), %r13d
	movaps	%xmm1, %xmm0
.L145:
	incl	%edx
	addq	$16, %rax
	jmp	.L143
.L172:
	testl	%r14d, %r14d
	je	.L149
	movl	%r13d, %edx
	movl	$2, %edi
	movb	$1, %al
	movsd	%xmm0, -104(%rbp)
	leaq	.LC34(%rip), %rsi
	call	__printf_chk@PLT
	movsd	-104(%rbp), %xmm0
.L149:
	xorps	%xmm1, %xmm1
	comisd	%xmm1, %xmm0
	jb	.L167
	decl	%r12d
	jne	.L153
	jmp	.L157
.L167:
	decl	%r12d
	jne	.L153
	andps	.LC0(%rip), %xmm0
	movsd	.LC1(%rip), %xmm1
	comisd	%xmm0, %xmm1
	ja	.L157
.L153:
	movq	-88(%rbp), %rdi
	call	cudaFree@PLT
	jmp	.L137
.L157:
	orl	$-1, %r13d
.L137:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L154
	call	__stack_chk_fail@PLT
.L154:
	leaq	-40(%rbp), %rsp
	movl	%r13d, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2037:
	.size	_Z17find_pivot_columnP7Tableaui, .-_Z17find_pivot_columnP7Tableaui
	.globl	_Z36__device_stub__Z17find_pivot_kernelvv
	.type	_Z36__device_stub__Z17find_pivot_kernelvv, @function
_Z36__device_stub__Z17find_pivot_kernelvv:
.LFB2074:
	.cfi_startproc
	endbr64
	subq	$88, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	movabsq	$4294967297, %rax
	leaq	8(%rsp), %rcx
	movq	%rsp, %rdx
	leaq	28(%rsp), %rsi
	leaq	16(%rsp), %rdi
	movl	$1, 24(%rsp)
	movl	$1, 36(%rsp)
	movq	%rax, 16(%rsp)
	movq	%rax, 28(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L173
	pushq	8(%rsp)
	.cfi_def_cfa_offset 104
	leaq	_Z17find_pivot_kernelv(%rip), %rdi
	pushq	8(%rsp)
	.cfi_def_cfa_offset 112
	movq	44(%rsp), %rcx
	movl	52(%rsp), %r8d
	movq	32(%rsp), %rsi
	movl	40(%rsp), %edx
	leaq	80(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 104
	popq	%rdx
	.cfi_def_cfa_offset 96
.L173:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L175
	call	__stack_chk_fail@PLT
.L175:
	addq	$88, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2074:
	.size	_Z36__device_stub__Z17find_pivot_kernelvv, .-_Z36__device_stub__Z17find_pivot_kernelvv
	.globl	_Z17find_pivot_kernelv
	.type	_Z17find_pivot_kernelv, @function
_Z17find_pivot_kernelv:
.LFB2075:
	.cfi_startproc
	endbr64
	jmp	_Z36__device_stub__Z17find_pivot_kernelvv
	.cfi_endproc
.LFE2075:
	.size	_Z17find_pivot_kernelv, .-_Z17find_pivot_kernelv
	.globl	_Z43__device_stub__Z18computeRatioKernelPdiiS_iPdiiS_i
	.type	_Z43__device_stub__Z18computeRatioKernelPdiiS_iPdiiS_i, @function
_Z43__device_stub__Z18computeRatioKernelPdiiS_iPdiiS_i:
.LFB2076:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	32(%rsp), %rdx
	movq	%rcx, 8(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, 4(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	20(%rsp), %rax
	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, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L178
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z18computeRatioKernelPdiiS_i(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L178:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L180
	call	__stack_chk_fail@PLT
.L180:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2076:
	.size	_Z43__device_stub__Z18computeRatioKernelPdiiS_iPdiiS_i, .-_Z43__device_stub__Z18computeRatioKernelPdiiS_iPdiiS_i
	.globl	_Z18computeRatioKernelPdiiS_i
	.type	_Z18computeRatioKernelPdiiS_i, @function
_Z18computeRatioKernelPdiiS_i:
.LFB2077:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z18computeRatioKernelPdiiS_iPdiiS_i
	.cfi_endproc
.LFE2077:
	.size	_Z18computeRatioKernelPdiiS_i, .-_Z18computeRatioKernelPdiiS_i
	.section	.rodata.str1.1
.LC35:
	.string	"Ratios A[row_i,0]/A[row_i,%d] = ["
.LC36:
	.string	"%3.2lf, "
.LC37:
	.string	"].\n"
.LC38:
	.string	"Found pivot A[%d,%d], min positive ratio=%g in row=%d.\n"
	.text
	.globl	_Z14find_pivot_rowP7Tableauii
	.type	_Z14find_pivot_rowP7Tableauii, @function
_Z14find_pivot_rowP7Tableauii:
.LFB2038:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	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
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movl	%esi, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	movl	8(%rdi), %eax
	leaq	40(%rsp), %rdi
	leal	0(,%rax,8), %r14d
	movslq	%r14d, %r14
	movq	%r14, %rsi
	call	cudaMalloc@PLT
	movq	%r14, %rdi
	call	malloc@PLT
	movq	%rax, %r13
	testl	%ebp, %ebp
	je	.L184
	movl	12(%rsp), %edx
	leaq	.LC35(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L184:
	movl	8(%rbx), %eax
	movl	$512, %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	addl	$511, %eax
	cltd
	idivl	%ecx
	movl	$8388609, %edx
	movl	$1, %ecx
	salq	$9, %rdx
	movl	%eax, 48(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 52(%rsp)
	movq	48(%rsp), %rdi
	movl	56(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L185
	movl	24(%rbx), %esi
	movl	8(%rbx), %r8d
	movq	40(%rsp), %rcx
	movl	12(%rsp), %edx
	movq	(%rbx), %rdi
	call	_Z43__device_stub__Z18computeRatioKernelPdiiS_iPdiiS_i
.L185:
	movq	40(%rsp), %rsi
	movq	%r14, %rdx
	movl	$2, %ecx
	movq	%r13, %rdi
	movl	$1, %r15d
	xorl	%r14d, %r14d
	call	cudaMemcpy@PLT
	movsd	.LC32(%rip), %xmm1
	movq	.LC0(%rip), %xmm2
.L186:
	movl	%r15d, %r12d
	cmpl	%r15d, 8(%rbx)
	jle	.L218
	movsd	0(%r13,%r15,8), %xmm0
	testl	%ebp, %ebp
	je	.L187
	leaq	.LC36(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movsd	%xmm1, 24(%rsp)
	movsd	%xmm0, 16(%rsp)
	call	__printf_chk@PLT
	movq	.LC0(%rip), %xmm2
	movsd	24(%rsp), %xmm1
	movsd	16(%rsp), %xmm0
.L187:
	xorps	%xmm3, %xmm3
	comisd	%xmm3, %xmm0
	movsd	.LC1(%rip), %xmm3
	jb	.L188
	comisd	%xmm0, %xmm1
	ja	.L190
.L188:
	xorps	%xmm4, %xmm4
	comisd	%xmm1, %xmm4
	ja	.L190
	movaps	%xmm0, %xmm4
	andps	%xmm2, %xmm4
	comisd	%xmm4, %xmm3
	jbe	.L216
	comisd	%xmm0, %xmm1
	ja	.L201
	jmp	.L216
.L190:
	movaps	%xmm0, %xmm1
	andps	%xmm2, %xmm1
	cmpltsd	%xmm3, %xmm1
	andnps	%xmm0, %xmm1
	jmp	.L191
.L216:
	movl	%r14d, %r12d
	jmp	.L191
.L201:
	xorps	%xmm1, %xmm1
.L191:
	incq	%r15
	movl	%r12d, %r14d
	jmp	.L186
.L218:
	testl	%ebp, %ebp
	je	.L194
	leaq	.LC37(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	movsd	%xmm1, 16(%rsp)
	call	__printf_chk@PLT
	movsd	16(%rsp), %xmm1
.L194:
	movq	40(%rsp), %rdi
	movsd	%xmm1, 16(%rsp)
	call	cudaFree@PLT
	movq	%r13, %rdi
	call	free@PLT
	movsd	16(%rsp), %xmm1
	ucomisd	.LC32(%rip), %xmm1
	jp	.L206
	je	.L203
.L206:
	testl	%ebp, %ebp
	je	.L183
	movl	12(%rsp), %ecx
	movl	%r14d, %r8d
	movaps	%xmm1, %xmm0
	movl	%r14d, %edx
	leaq	.LC38(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
	jmp	.L183
.L203:
	orl	$-1, %r14d
.L183:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L199
	call	__stack_chk_fail@PLT
.L199:
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	movl	%r14d, %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
.LFE2038:
	.size	_Z14find_pivot_rowP7Tableauii, .-_Z14find_pivot_rowP7Tableauii
	.globl	_Z55__device_stub__Z23findBasisVariableKernelPdiP7ElementiiPdiP7Elementii
	.type	_Z55__device_stub__Z23findBasisVariableKernelPdiP7ElementiiPdiP7Elementii, @function
_Z55__device_stub__Z23findBasisVariableKernelPdiP7ElementiiPdiP7Elementii:
.LFB2078:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 16(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, 4(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L219
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z23findBasisVariableKernelPdiP7Elementii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L219:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L221
	call	__stack_chk_fail@PLT
.L221:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2078:
	.size	_Z55__device_stub__Z23findBasisVariableKernelPdiP7ElementiiPdiP7Elementii, .-_Z55__device_stub__Z23findBasisVariableKernelPdiP7ElementiiPdiP7Elementii
	.globl	_Z23findBasisVariableKernelPdiP7Elementii
	.type	_Z23findBasisVariableKernelPdiP7Elementii, @function
_Z23findBasisVariableKernelPdiP7Elementii:
.LFB2079:
	.cfi_startproc
	endbr64
	jmp	_Z55__device_stub__Z23findBasisVariableKernelPdiP7ElementiiPdiP7Elementii
	.cfi_endproc
.LFE2079:
	.size	_Z23findBasisVariableKernelPdiP7Elementii, .-_Z23findBasisVariableKernelPdiP7Elementii
	.section	.rodata.str1.1
.LC39:
	.string	"%s at "
.LC40:
	.string	"x%d=%3.2lf, "
	.text
	.globl	_Z20print_optimal_vectorP7TableauPc
	.type	_Z20print_optimal_vectorP7TableauPc, @function
_Z20print_optimal_vectorP7TableauPc:
.LFB2039:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %rdx
	leaq	.LC39(%rip), %rsi
	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
	movq	%rdi, %rbx
	movl	$2, %edi
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	12(%rbx), %r12d
	leaq	16(%rsp), %rdi
	sall	$4, %r12d
	movslq	%r12d, %r12
	movq	%r12, %rsi
	call	cudaMalloc@PLT
	movq	%r12, %rdi
	call	malloc@PLT
	movl	$512, %esi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rax, %rbp
	movl	12(%rbx), %eax
	movl	$8388609, %ecx
	movl	$1, 48(%rsp)
	salq	$9, %rcx
	addl	$511, %eax
	movq	%rcx, 40(%rsp)
	cltd
	idivl	%esi
	movq	%rcx, %rdx
	movl	$1, %ecx
	movl	%eax, 28(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	28(%rsp), %rdi
	movl	36(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L225
	movl	8(%rbx), %ecx
	movl	24(%rbx), %esi
	movl	12(%rbx), %r8d
	movq	16(%rsp), %rdx
	movq	(%rbx), %rdi
	call	_Z55__device_stub__Z23findBasisVariableKernelPdiP7ElementiiPdiP7Elementii
.L225:
	movq	16(%rsp), %rsi
	movq	%r12, %rdx
	movl	$2, %ecx
	movq	%rbp, %rdi
	leaq	16(%rbp), %r14
	xorl	%r13d, %r13d
	movl	$1, %r12d
	call	cudaMemcpy@PLT
	xorps	%xmm1, %xmm1
.L226:
	cmpl	%r12d, 12(%rbx)
	jle	.L241
	movl	8(%r14), %esi
	xorps	%xmm0, %xmm0
	cmpl	$-1, %esi
	je	.L227
	imull	24(%rbx), %esi
	leaq	40(%rsp), %rdi
	movl	$2, %ecx
	movl	$8, %edx
	movsd	%xmm1, 8(%rsp)
	movslq	%esi, %rsi
	addq	(%rbx), %rsi
	call	cudaMemcpy@PLT
	movsd	8(%rsp), %xmm1
	movsd	40(%rsp), %xmm0
	divsd	(%r14), %xmm0
.L227:
	testl	%r13d, %r13d
	je	.L228
	xorps	.LC20(%rip), %xmm0
.L228:
	movl	%r13d, %r15d
	incl	%r12d
	addsd	%xmm0, %xmm1
	xorl	$1, %r15d
	decl	%r13d
	jne	.L229
	movl	%r12d, %edx
	sarl	%edx
	cmpl	16(%rbx), %edx
	jl	.L230
.L231:
	xorps	%xmm1, %xmm1
	jmp	.L229
.L230:
	movaps	%xmm1, %xmm0
	leaq	.LC40(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
	jmp	.L231
.L229:
	addq	$16, %r14
	movl	%r15d, %r13d
	jmp	.L226
.L241:
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC15(%rip), %rsi
	call	__printf_chk@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L233
	call	__stack_chk_fail@PLT
.L233:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	movq	%rbp, %rdi
	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
	jmp	free@PLT
	.cfi_endproc
.LFE2039:
	.size	_Z20print_optimal_vectorP7TableauPc, .-_Z20print_optimal_vectorP7TableauPc
	.section	.rodata.str1.1
.LC41:
	.string	"Found optimal value=A[0,0]=%3.2lf (no negatives in row 0).\n"
.LC42:
	.string	"Optimal vector"
.LC43:
	.string	"Entering variable x%d to be made basic, so pivot_col=%d.\n"
.LC44:
	.string	"unbounded (no pivot_row).\n"
.LC45:
	.string	"Leaving variable x%d, so pivot_row=%d\n"
.LC46:
	.string	"After pivoting"
.LC47:
	.string	"Basic feasible solution"
.LC48:
	.string	"Too many iterations > %d.\n"
.LC49:
	.string	"number of iterations: %d\n"
	.text
	.globl	_Z7simplexP7Tableauii
	.type	_Z7simplexP7Tableauii, @function
_Z7simplexP7Tableauii:
.LFB2040:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%esi, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
.L243:
	movl	%ebp, %esi
	movq	%rbx, %rdi
	incl	%r13d
	call	_Z17find_pivot_columnP7Tableaui
	movl	%eax, %r12d
	testl	%eax, %eax
	jns	.L262
	movq	(%rbx), %rsi
	leaq	8(%rsp), %rdi
	movl	$2, %ecx
	movl	$8, %edx
	call	cudaMemcpy@PLT
	movslq	12(%rbx), %rdx
	movq	(%rbx), %rax
	leaq	16(%rsp), %rdi
	movl	$2, %ecx
	leaq	-8(%rax,%rdx,8), %rsi
	movl	$8, %edx
	call	cudaMemcpy@PLT
	leaq	.LC41(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movsd	8(%rsp), %xmm0
	divsd	16(%rsp), %xmm0
	call	__printf_chk@PLT
	leaq	.LC42(%rip), %rsi
	movq	%rbx, %rdi
	call	_Z20print_optimal_vectorP7TableauPc
	jmp	.L244
.L262:
	testl	%ebp, %ebp
	je	.L245
	movl	%r12d, %ecx
	movl	%r12d, %edx
	leaq	.LC43(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
.L245:
	movl	%ebp, %edx
	movl	%r12d, %esi
	movq	%rbx, %rdi
	call	_Z14find_pivot_rowP7Tableauii
	movl	%eax, %r15d
	testl	%eax, %eax
	jns	.L246
	leaq	.LC44(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L244
.L246:
	testl	%ebp, %ebp
	je	.L247
	movl	%eax, %ecx
	movl	%eax, %edx
	leaq	.LC45(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L247:
	movl	%r12d, %edx
	movl	%r15d, %esi
	movq	%rbx, %rdi
	call	_Z8pivot_onP7Tableauii
	testl	%ebp, %ebp
	je	.L248
	movl	12(%rbx), %ecx
	movl	8(%rbx), %edx
	movl	24(%rbx), %esi
	movq	(%rbx), %rdi
	call	_Z15updateHostTablePdiii
	movq	demoTab(%rip), %rdi
	leaq	.LC46(%rip), %rsi
	movl	%ebp, %edx
	call	_Z13print_tableauP3TabPKci
	leaq	.LC47(%rip), %rsi
	movq	%rbx, %rdi
	call	_Z20print_optimal_vectorP7TableauPc
.L248:
	cmpl	%r14d, %r13d
	jle	.L243
	movl	%r13d, %edx
	leaq	.LC48(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L244:
	movl	$2, %edi
	xorl	%eax, %eax
	movl	%r13d, %edx
	leaq	.LC49(%rip), %rsi
	call	__printf_chk@PLT
	movq	(%rbx), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L251
	call	__stack_chk_fail@PLT
.L251:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2040:
	.size	_Z7simplexP7Tableauii, .-_Z7simplexP7Tableauii
	.section	.rodata.str1.1
.LC50:
	.string	"i"
.LC51:
	.string	"Initial"
.LC53:
	.string	"Total time = %f seconds\n"
.LC54:
	.string	"usage: cmd <datafile> <i/n> <max)iteration_number> \n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2041:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%edi, %ebp
	movl	$32, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movl	$-1, 20(%rax)
	movq	%rax, %rbx
	cmpl	$3, %ebp
	jle	.L265
	movq	16(%r12), %rdi
	leaq	.LC50(%rip), %rsi
	xorl	%ebp, %ebp
	call	strcasecmp@PLT
	testl	%eax, %eax
	jne	.L266
	movl	$200000008, %edi
	movl	$1, %ebp
	call	malloc@PLT
	movq	%rax, demoTab(%rip)
.L266:
	movq	24(%r12), %rdi
	call	atoi@PLT
	movq	8(%r12), %rsi
	movl	%ebp, %edx
	movq	%rbx, %rdi
	movl	%eax, %r13d
	call	_Z12read_tableauP7TableauPKci
	movq	demoTab(%rip), %rdi
	movl	%ebp, %edx
	leaq	.LC51(%rip), %rsi
	call	_Z13print_tableauP3TabPKci
	xorl	%esi, %esi
	leaq	8(%rsp), %rdi
	call	gettimeofday@PLT
	movl	%ebp, %edx
	movl	%r13d, %esi
	movq	%rbx, %rdi
	call	_Z7simplexP7Tableauii
	xorl	%esi, %esi
	leaq	24(%rsp), %rdi
	call	gettimeofday@PLT
	movq	32(%rsp), %rax
	subq	16(%rsp), %rax
	movl	$2, %edi
	cvtsi2sdq	%rax, %xmm0
	movq	24(%rsp), %rax
	subq	8(%rsp), %rax
	divsd	.LC52(%rip), %xmm0
	cvtsi2sdq	%rax, %xmm1
	leaq	.LC53(%rip), %rsi
	movb	$1, %al
	addsd	%xmm1, %xmm0
	call	__printf_chk@PLT
	movq	%rbx, %rdi
	call	free@PLT
	testl	%ebp, %ebp
	je	.L268
	movq	demoTab(%rip), %rdi
	call	free@PLT
	jmp	.L268
.L265:
	leaq	.LC54(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movl	$1, %edi
	call	exit@PLT
.L268:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L269
	call	__stack_chk_fail@PLT
.L269:
	addq	$56, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2041:
	.size	main, .-main
	.section	.rodata.str1.1
.LC55:
	.string	"_Z23findBasisVariableKernelPdiP7Elementii"
.LC56:
	.string	"_Z18computeRatioKernelPdiiS_i"
.LC57:
	.string	"_Z17find_pivot_kernelv"
.LC58:
	.string	"_Z14findPivotIndexPdP7Elementiiiii"
.LC59:
	.string	"_Z36computeNewValuesForRowsInPivotColumnPdiiii"
.LC60:
	.string	"_Z29computeNewValuesForRowsKernelPdiiiii"
.LC61:
	.string	"_Z19divideByPivotKernelPdiiidi"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2081:
	.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	.LC55(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z23findBasisVariableKernelPdiP7Elementii(%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	.LC56(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z18computeRatioKernelPdiiS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC57(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z17find_pivot_kernelv(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC58(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z14findPivotIndexPdP7Elementiiiii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC59(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z36computeNewValuesForRowsInPivotColumnPdiiii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC60(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z29computeNewValuesForRowsKernelPdiiiii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC61(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z19divideByPivotKernelPdiiidi(%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
.LFE2081:
	.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
	.local	_ZZ13print_tableauP3TabPKciE7counter
	.comm	_ZZ13print_tableauP3TabPKciE7counter,4,4
	.globl	demoTab
	.bss
	.align 8
	.type	demoTab, @object
	.size	demoTab, 8
demoTab:
	.zero	8
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	-1998362383
	.long	1055193269
	.section	.rodata.cst16
	.align 16
.LC20:
	.long	0
	.long	-2147483648
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC22:
	.long	0
	.long	1072693248
	.align 8
.LC32:
	.long	0
	.long	-1074790400
	.align 8
.LC52:
	.long	0
	.long	1093567616
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

/*
  What: Simplex in CUDA
  AUTHOR: kishaloy.halder@gmail.com

  What: Solves LP Problem with Simplex:
    { maximize cx : Ax <= b, x >= 0 }.
  Input: { m, n, Mat[m x n] }, where:
    b = mat[1..m,0] .. column 0 is b >= 0, so x=0 is a basic feasible solution.
    c = mat[0,1..n] .. row 0 is z to maximize, note c is negated in input.
    A = mat[1..m,1..n] .. constraints.
    x = [x1..xm] are the named variables in the problem.
    Slack variables are in columns [m+1..m+n]

  USAGE:
    1. Read the problem data from a file:
      $ cat problem.txt
            m n
            0  -c1 -c2 sign1
            b1 a11 a12 sign2
            b2 a21 a11 sign3
      $ nvcc simplex.cu
      $ ./a.out <datafile> <i/n> <max_iteration>
*/


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include <sys/time.h>

#define NUMBER_OF_ELEMENTS_PER_THREAD 10
#define M 5000
#define N 5000

#define THREADS_PER_BLOCK 512

static const double epsilon   = 0.00001;

int equal(double a, double b) { return fabs(a-b) < epsilon; }
__device__ int equalsTo(double a, double b)
{
	double epsilon = 0.00001;
	return fabs(a-b) < epsilon;
}

typedef struct {
	double * table;
	int numberOfRows;
	int numberOfColumns;
	int numberOfColumnsInOriginalMatrix;
	int firstPivotRow; 
	int pitch;
} Tableau;

typedef struct {
	double value;
	int index;
} Element;

typedef struct {
  int m, n; // m=rows, n=columns, mat[m x n]
  double mat[M][N];
} Tab;

Tab * demoTab;

void nl(int k){ int j; for(j=0;j<k;j++) putchar('-'); putchar('\n'); }

/* // Size of tableau [4 rows x 5 columns ]
	// Max: z = 0.5*x + 3*y + z + 4*w,
	//    x + y + z + w <= 40 .. b1
	//  -2x - y + z + w <= 10 .. b2
	//        y     - w <= 10 .. b3
	Example input file for read_tableau:
     4 5							
      0   -0.5  -3 -1  -4 
     40    1     1  1   1 -1 
     10   -2    -1  1   1 -1
     10    0     1  0  -1 -1 
*/

void updateHostTable(double * table, int pitch, int numberOfRows, int numberOfColumns){
	for(int i=0;i<numberOfRows;i++)
	{
		hipMemcpy(demoTab->mat[i], (double *)((char *)table + i*pitch), numberOfColumns*sizeof(double), hipMemcpyDeviceToHost);
	}
	return;
}

void writetofile(FILE * fp,double * tempArray, int numberOfColumns, int direction){
	int i=0;
	double b=tempArray[0];
	for(i=1;i<numberOfColumns;i++)
	{
		if(i==1){
			fprintf(fp, "%lfx%d ",tempArray[i],i);
		}
		else if(tempArray[i]>=0){
		fprintf(fp, "+ %lfx%d ",fabs(tempArray[i]),i);
		}
		else if(tempArray[i]<0){
		fprintf(fp, "- %lfx%d ",fabs(tempArray[i]),i);
		}
	}
	if(direction==1)
		fprintf(fp, " >= %lf", b);
	else if(direction==-1)
		fprintf(fp, " <= %lf", b);
	else	
		fprintf(fp, " = %lf", b);
	fprintf(fp,";\n");
}

void print_tableau(Tab *tab, const char* mes, int verbosityLevel) {
	if(!verbosityLevel)
		return;
	static int counter=0;
	int i, j;
	printf("\n%d. Tableau %s:\n", ++counter, mes);
	nl(70);

	printf("%-6s%5s", "col:", "b[i]");
	for(j=1;j<tab->n; j++) { printf("    x%d,", j); } printf("\n");

	for(i=0;i<tab->m; i++) {
		if (i==0) printf("max:"); else
		printf("b%d: ", i);
		for(j=0;j<tab->n; j++) {
			if (equal((int)tab->mat[i][j], tab->mat[i][j]))
				printf(" %6d", (int)tab->mat[i][j]);
			else
				printf(" %6.2lf", tab->mat[i][j]);
		}
		printf("\n");
	}
	nl(70);
}

void negateRow(double * array, int size)
{
		for(int i=0;i<size;i++)
		{
			array[i] *= -1;
		}
	return;
}

void printRow(double * array, int size)
{
		for(int i=0;i<size;i++)
		{
			printf("%lf ", array[i]);
		}
	printf("\n");
	return;
}

void read_tableau(Tableau *tab, const char * filename, int verbosityLevel) {
	int err, i, j;
	FILE * fp;

	fp  = fopen(filename, "r" );
	if( !fp ) {
		printf("Cannot read %s\n", filename); exit(1);
	}
	  //memset(tab, 0, sizeof(*tab));
	
	err = fscanf(fp, "%d %d", &tab->numberOfRows, &tab->numberOfColumns);
	if (err == 0 || err == EOF) {
		printf("Cannot read m or n\n"); exit(1);
	}
	
	int numberOfColumnsInOriginalMatrix = tab->numberOfColumns;
	tab->numberOfColumnsInOriginalMatrix = tab->numberOfColumns;
	//all the variables are unrestricted..so each xi has to replaced with xi1-xi2
	int numberOfColumnsInExtendedMatrix = (tab->numberOfColumns)*2 - 1;
	//adding slack variables
	tab->numberOfColumns = numberOfColumnsInExtendedMatrix + tab->numberOfRows;
	
	if(verbosityLevel)
	{
		demoTab->m = tab->numberOfRows;
		demoTab->n = tab->numberOfColumns;
	}
	
	//allocating memory in device for the table
	size_t pitch;	
	hipMallocPitch((void**)&tab->table, &pitch, tab->numberOfColumns * sizeof(double), tab->numberOfRows);
	tab->pitch = pitch;
	
	double tempArray[tab->numberOfColumns];
	
	int directionOfInequality =0;
	int slackVariableIndex = -1;
	
	double temp;
	int tempArrayCounter;
	
	int tabOldNumberOfColumns=numberOfColumnsInOriginalMatrix + tab->numberOfRows -1;
	FILE * opFile=fopen("printEquations.txt","w");
	
	memset(tempArray, 0, sizeof(double)*(tab->numberOfColumns));
	for(i=0;i<tab->numberOfRows; i++) {
		tempArrayCounter = 0;
		if(i==0)
		{
			tempArray[tab->numberOfColumns-1] = 1;
		}
		else
		{
			tempArray[tab->numberOfColumns-1] = 0;
		}
		for(j=0;j<tabOldNumberOfColumns; j++) {
			if(j<numberOfColumnsInOriginalMatrix){
				if(j==0)
				{
					err = fscanf(fp, "%lf", &tempArray[tempArrayCounter]);
					tempArrayCounter++;
					if (err == 0 || err == EOF) {
						printf("Cannot read A[%d][%d]\n", i, j);
						exit(1);
					}
				}
				else
				{
					err = fscanf(fp, "%lf", &temp);
					if (err == 0 || err == EOF) {
						printf("Cannot read A[%d][%d]\n", i, j);
						exit(1);
					}
					//replacing a.xi with a.xi1 - a.xi2
					tempArray[tempArrayCounter] = temp;
					tempArrayCounter++;
					tempArray[tempArrayCounter] = temp*(-1);
					tempArrayCounter++;
				}
			}
			else if(i>=1)
			{
				//slack variables
				tempArray[tempArrayCounter] = (i==(j-numberOfColumnsInOriginalMatrix+1));
				if(tempArray[tempArrayCounter]==1)
					slackVariableIndex = tempArrayCounter;
				tempArrayCounter++;
			}
		}
		
		
		if(i>=1)	//because not needed for 0th row
		{
			//check direction of inequality
			// -1 denotes <=
			// 0 denotes =
			// 1 denotes >=
			directionOfInequality = 0;
			err = fscanf(fp, "%d", &directionOfInequality);
			if (err == 0 || err == EOF || (directionOfInequality*directionOfInequality > 1)) {
				printf("Cannot read A[%d][%d]\n", i, numberOfColumnsInOriginalMatrix);
				exit(1);
			}
			
			writetofile(opFile,tempArray,numberOfColumnsInExtendedMatrix, directionOfInequality);
			/*if(tempArray[0]<0)
			{
				negateRow(tempArray, tab->numberOfColumns);
				if(directionOfInequality==-1)
				{
					tempArray[slackVariableIndex] = 1;
				}
			}
			else if(directionOfInequality==0)
			{
				tempArray[slackVariableIndex] = 0;
			}*/
			if(directionOfInequality == 1)
			{
				tempArray[slackVariableIndex] = -1;
				if(tempArray[0]<=0)
				{
					negateRow(tempArray, tab->numberOfColumns);
				}
				else
				{
					if(tab->firstPivotRow==-1)
					{
						tab->firstPivotRow = i;
					}
				}
			}
		}

		hipMemcpy((double *)((char *)tab->table + i *pitch), tempArray, ((tab->numberOfColumns) * (sizeof(double))), hipMemcpyHostToDevice );	
	}
	printf("Read tableau [%d rows x %d columns] from file '%s'.\n", tab->numberOfRows, numberOfColumnsInOriginalMatrix, filename);
	
	if(verbosityLevel)
	{
		updateHostTable(tab->table,tab->pitch, tab->numberOfRows, tab->numberOfColumns);
	}
	
	fclose(fp);
}

__global__ void divideByPivotKernel(double * table, int pitch, int rowIndex, int columnIndex, double pivot, int numberOfColumns)
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;
	
	if(index>=numberOfColumns)
		return;

	double * row = (double*)((char*)table +  rowIndex* pitch);
	row[index] /= pivot;
	return;
}

__global__ void computeNewValuesForRowsKernel(double * table, int pitch, int pivotRowIndex, int pivotColumnIndex, int numberOfColumns, int numberOfElements)
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;
	
	int associatedRow = index/numberOfColumns;
	int associatedColumn = index%numberOfColumns;
	
	//not for elements in pivotColumn
	if(pivotRowIndex==associatedRow || index>=numberOfElements || associatedColumn==pivotColumnIndex)
		return;
		
	double * row = (double*)((char*)table +  associatedRow* pitch);
	double * pivotRow = (double*)((char*)table +  pivotRowIndex* pitch);
	
	double multiplier = row[pivotColumnIndex];
	row[associatedColumn] = row[associatedColumn]*pivotRow[pivotColumnIndex] - multiplier * pivotRow[associatedColumn];
	
	return;
}

__global__ void computeNewValuesForRowsInPivotColumn(double * table, int pitch, int pivotColumn, int pivotRow, int numberOfRows)
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;
	
	if(index>=numberOfRows || index==pivotRow)
		return;
	
	double * row = (double*)((char*)table +  index* pitch);
	row[pivotColumn] = 0.;
	/*double *pivotRowArray = (double*)((char*)table +  pivotRow* pitch);
	double multiplier = row[pivotColumn];
	row[pivotColumn] -= multiplier * pivotRowArray[pivotColumn];*/
	return;
}

void pivot_on(Tableau *tab, int row, int col) {
	double pivot;

  	hipMemcpy(&pivot, (double*)((char*)tab->table + row*(tab->pitch)) + col, sizeof(double),hipMemcpyDeviceToHost);
	int numberOfElements = tab->numberOfColumns * tab->numberOfRows;
  	assert(pivot>0);
  
  	//launch kernel function to do the division
  	divideByPivotKernel<<< (tab->numberOfColumns + (THREADS_PER_BLOCK-1)) / THREADS_PER_BLOCK, THREADS_PER_BLOCK >>>( tab->table, tab->pitch, row, col, pivot, tab->numberOfColumns );
  
  	//launch kernel to compute the new rows
  	computeNewValuesForRowsKernel<<< (numberOfElements + (THREADS_PER_BLOCK-1)) / THREADS_PER_BLOCK, THREADS_PER_BLOCK >>>( tab->table, tab->pitch, row, col, tab->numberOfColumns, numberOfElements );

	//launch kernel to compute the pivot column
	computeNewValuesForRowsInPivotColumn<<<(tab->numberOfRows + (THREADS_PER_BLOCK-1))/THREADS_PER_BLOCK, THREADS_PER_BLOCK>>>(tab->table, tab->pitch, col, row, tab->numberOfRows);
}

__global__ void findPivotIndex(double * array, Element * elements, int size, int numberOfThreadsRequired, int maxNumberOfElementsPerThread, int maxOrMin, int offset)
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;
	
	if(index>=numberOfThreadsRequired)
		return;
	
	int start = index * maxNumberOfElementsPerThread;
	int end = (start + maxNumberOfElementsPerThread )>=size?(size-1):(start+maxNumberOfElementsPerThread -1);
	
	double solution = array[start];
	int indexToSolution = start;
	
	for(int i=start+1;i<=end;i++)
	{
		if(maxOrMin==0)	//need to find max
		{
			if(array[i]>solution && !equalsTo( array[i],solution))
			{
				solution = array[i];
				indexToSolution = i;
			}
		}
		else
		{
			if(array[i]<solution && !equalsTo( array[i],solution))
			{
				solution = array[i];
				indexToSolution = i;
			}
		}
	}
	
	elements[index].value = solution;
	elements[index].index = indexToSolution+offset;
	
	return;
}

// Find pivot_col = most negative column in mat[0][1..n]
int find_pivot_column(Tableau *tab, int verbosityLevel) {
  	int j, pivot_col;
	int offset = 0;		
	int maxOrMin = 1;	//denotes whether we need to find max element or min element for pivoting. max = 0. min = 1.
	int length = tab->numberOfColumns;
	double * pivotRow = tab->table;
	
	if(tab->firstPivotRow!=-1)
	{
		pivotRow = (double *)((char *)tab->table + (tab->firstPivotRow)*(tab->pitch));
		pivotRow++;		//eliminating the 0th element from the find max operation
		tab->firstPivotRow = -1;
		maxOrMin = 0;
		offset = 1;		//because we don't need to compare the objective value
		length -= 1;
	}
	
	
	int numberOfElementsToCompareInCPU = length/NUMBER_OF_ELEMENTS_PER_THREAD +
	(length%NUMBER_OF_ELEMENTS_PER_THREAD>0?1:0);
	Element elements[numberOfElementsToCompareInCPU];
	Element *elementsInDevice;
	int size = sizeof(Element)*numberOfElementsToCompareInCPU;
	
	hipMalloc( (void **) &elementsInDevice, size);
	
	
	//launch kernel
	findPivotIndex<<< (tab->numberOfColumns + (THREADS_PER_BLOCK-1)) / THREADS_PER_BLOCK, THREADS_PER_BLOCK >>>
	( pivotRow, elementsInDevice, length, numberOfElementsToCompareInCPU, NUMBER_OF_ELEMENTS_PER_THREAD, maxOrMin, offset);
	hipMemcpy(elements, elementsInDevice, size, hipMemcpyDeviceToHost);
  	
	//double lowest = tab->mat[0][pivot_col];
	pivot_col = elements[0].index;
	double solution = elements[0].value;
	
  	for(j=1; j<numberOfElementsToCompareInCPU; j++) {
  		if(maxOrMin==0)		//need to find max
		{
			if (elements[j].value > solution) {
      			solution = elements[j].value;
      			pivot_col = elements[j].index;
			}
		}
		else
		{
			if (elements[j].value < solution) {
      			solution = elements[j].value;
      			pivot_col = elements[j].index;
			}
		}
  	}
	if(verbosityLevel)
		printf("Most negative column in row[0] is col %d = %g.\n", pivot_col, solution);
  	if( (solution >= 0 && maxOrMin ==1) || (maxOrMin==1 && equal(solution, 0.))) {
    		return -1; // All positive columns in row[0], this is optimal.
  	}
	
	hipFree(elementsInDevice);
  	return pivot_col;
}

__global__ void find_pivot_kernel( )
{
	return;
}

__global__ void computeRatioKernel(double * table, int pitch, int pivotColumn, double * ratioArray, int numOfRows )
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;
	
	if(index==0 || index>=numOfRows)
		return;
	
	double* row = (double*)((char*)table + index * pitch);
	ratioArray[index] = -1;
	if(row[pivotColumn]>0 && !equalsTo(row[pivotColumn],0.))
		ratioArray[index] = row[0]/row[pivotColumn];
	return;
}


// Find the pivot_row, with smallest positive ratio = col[0] / col[pivot]
int find_pivot_row(Tableau *tab, int pivot_col, int verbosityLevel) {
	int i, pivot_row = 0;
	double min_ratio = -1;
  
	double * ratioArrayInDevice;
	double * ratioArrayInHost;
	int size = (tab->numberOfRows)*sizeof(double);
  
	hipMalloc( (void **) &ratioArrayInDevice, size);
	ratioArrayInHost = (double *)malloc(size);
  
	if(verbosityLevel)
		printf("Ratios A[row_i,0]/A[row_i,%d] = [",pivot_col);
  
	//launch kernel to compute the ratios
	computeRatioKernel<<< (tab->numberOfRows + (THREADS_PER_BLOCK-1)) / THREADS_PER_BLOCK, THREADS_PER_BLOCK >>>( tab->table, tab->pitch, pivot_col, ratioArrayInDevice, tab->numberOfRows );
  
	hipMemcpy( ratioArrayInHost, ratioArrayInDevice, size, hipMemcpyDeviceToHost );
  
	for(i=1;i<tab->numberOfRows;i++){
		double ratio = ratioArrayInHost[i];
		if(verbosityLevel)
			printf("%3.2lf, ", ratio);
		if ( (ratio >= 0  && ratio < min_ratio ) || min_ratio < 0 || (equal(ratio, 0.) && ratio<min_ratio)) {
			min_ratio = ratio;
			if(equal(ratio, 0.))
				min_ratio = 0.0;
			pivot_row = i;
		}
	}  
	if(verbosityLevel)
		printf("].\n");
  
	hipFree(ratioArrayInDevice);
	free(ratioArrayInHost);
  
	if (min_ratio == -1)
		return -1; // Unbounded.
	if(verbosityLevel)
		printf("Found pivot A[%d,%d], min positive ratio=%g in row=%d.\n", pivot_row, pivot_col, min_ratio, pivot_row);
	
	return pivot_row;
}

// Given a column of identity matrix, find the row containing 1.
// return -1, if the column as not from an identity matrix.
 
__global__ void findBasisVariableKernel(double * deviceTable, int pitch, Element * indicesToBasisVariableArray, int numberOfRows, int numberOfColumns)
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;

	if(index>=numberOfColumns || index ==0)
		return;
	int xi = -1;
	double value;
	int flag = 0;
	
	for(int i=0;i<numberOfRows;i++)
	{
		double * row_i = (double *) ((char *) deviceTable + i*pitch);
		if (row_i[index]>0 && !equalsTo(row_i[index],0.) ) {
      			if (xi == -1)
        		{
					xi=i;   // found first +ve, save this row number.
					value = row_i[index];
				}
      			else
        		{
					flag = 1; // found second '1', not an identity matrix.
					break;
				}

    	} 
		else if (!equalsTo( row_i[index],0) ) {
			flag = 1;
      			break; // not an identity matrix column.
    		}
	}	
	
	if(flag==1)
		indicesToBasisVariableArray[index].index = -1;
	else
	{
		indicesToBasisVariableArray[index].index = xi;
		indicesToBasisVariableArray[index].value = value;
	}
	return;
}

void print_optimal_vector(Tableau *tab, char *message) {
	int j, xi;
	printf("%s at ", message);
	
	Element * indicesToBasisVariablesInDevice;
	Element * indicesToBasisVariablesInHost;
	
	double basisVariable;
	
	int size = sizeof(Element)*(tab->numberOfColumns);

	hipMalloc( (void **) &indicesToBasisVariablesInDevice, size);
	indicesToBasisVariablesInHost = (Element *)malloc(size);

	//launch kernel to compute basis variable for each column
	findBasisVariableKernel<<<(tab->numberOfColumns + (THREADS_PER_BLOCK-1)) / THREADS_PER_BLOCK, 
	THREADS_PER_BLOCK >>>(tab->table, tab->pitch, indicesToBasisVariablesInDevice, tab->numberOfRows, tab->numberOfColumns);

	hipMemcpy(indicesToBasisVariablesInHost, indicesToBasisVariablesInDevice, size, hipMemcpyDeviceToHost);
	
	int flag = 0;
	double variableValue = 0;
	double transformedVariableValue = 0;
	
  	for(j=1;j<tab->numberOfColumns;j++) { // for each column.
		
		xi = indicesToBasisVariablesInHost[j].index;
    	if (xi != -1)
		{
			hipMemcpy(&basisVariable, (double *)((char *)tab->table + xi * tab->pitch), sizeof(double),hipMemcpyDeviceToHost);
			//printf("x%d=%3.2lf, ", j, basisVariable/indicesToBasisVariablesInHost[j].value );
			transformedVariableValue = (basisVariable/indicesToBasisVariablesInHost[j].value );
		}
    	else
		{
			transformedVariableValue = 0;
			//printf("x%d=0, ", j);
		}
		variableValue += flag==0?transformedVariableValue:(-1*transformedVariableValue);
		flag ^= 1;
		if(!flag)
		{
			if(((j+1)/2)<tab->numberOfColumnsInOriginalMatrix)
				printf("x%d=%3.2lf, ", (j+1)/2,variableValue);
			variableValue = 0;
		}
  	}
  	printf("\n");
	hipFree(indicesToBasisVariablesInDevice);
	free(indicesToBasisVariablesInHost);
} 

void simplex(Tableau *tab, int maxIteration, int verbosityLevel) {
	int loop=0;
	double optimalValue;
	double pValue;

	while( ++loop ) {
		int pivot_col, pivot_row = -1;

		pivot_col = find_pivot_column(tab, verbosityLevel);
		if( pivot_col < 0 ) {
			hipMemcpy(&optimalValue, tab->table, sizeof(double), hipMemcpyDeviceToHost);
			hipMemcpy(&pValue, tab->table + (tab->numberOfColumns) - 1, sizeof(double), hipMemcpyDeviceToHost);
			printf("Found optimal value=A[0,0]=%3.2lf (no negatives in row 0).\n", optimalValue/pValue);
			print_optimal_vector(tab, "Optimal vector");
			break;
		}
		if(verbosityLevel)
			printf("Entering variable x%d to be made basic, so pivot_col=%d.\n", pivot_col, pivot_col);

		pivot_row = find_pivot_row(tab, pivot_col, verbosityLevel);
		
		if (pivot_row < 0) {
			//if(verbosityLevel)
				printf("unbounded (no pivot_row).\n");
			break;
		}
		if(verbosityLevel)
			printf("Leaving variable x%d, so pivot_row=%d\n", pivot_row, pivot_row);

		pivot_on(tab, pivot_row, pivot_col);
		if(verbosityLevel)
		{
			updateHostTable(tab->table,tab->pitch, tab->numberOfRows, tab->numberOfColumns);
			print_tableau(demoTab,"After pivoting", verbosityLevel);
			print_optimal_vector(tab, "Basic feasible solution");
		}

		if(loop > maxIteration) {
			printf("Too many iterations > %d.\n", loop);
			break;
		}
	}
	printf("number of iterations: %d\n", loop);
	hipFree(tab->table);
}

int main(int argc, char *argv[]){
	Tableau * tab;
	tab = (Tableau *) malloc(sizeof(Tableau));
	tab->firstPivotRow = -1;
	
	int verbosityLevel = 0;
	int maxIteration = 0;
	
	struct timeval  tv1, tv2;

	
	/* here, do your time-consuming job */
	
	if (argc > 3) { // usage: cmd datafile i/n max_iteration_number
		if(strcasecmp(argv[2],"i")==0)
		{
			verbosityLevel = 1;
			demoTab = (Tab *) malloc(sizeof(Tab));	//allocate memory in RAM for display purpose
		}
		maxIteration = atoi(argv[3]);
		
		read_tableau(tab, argv[1], verbosityLevel);
	}
	else
	{
		printf("usage: cmd <datafile> <i/n> <max)iteration_number> \n");
		free(tab);
		exit(1);
	}
	
	print_tableau(demoTab,"Initial", verbosityLevel);
	gettimeofday(&tv1, NULL);
	/* stuff to do! */
	simplex(tab, maxIteration, verbosityLevel);
	gettimeofday(&tv2, NULL);

	printf ("Total time = %f seconds\n",
         (double) (tv2.tv_usec - tv1.tv_usec) / 1000000 +
         (double) (tv2.tv_sec - tv1.tv_sec));
	
	
	free(tab);
	if(verbosityLevel)
		free(demoTab);
	return 0;
} 


	.text
	.file	"simplex.hip"
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z5equaldd
.LCPI0_0:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI0_1:
	.quad	0x3ee4f8b588e368f1              # double 1.0000000000000001E-5
	.text
	.globl	_Z5equaldd
	.type	_Z5equaldd,@function
_Z5equaldd:                             # @_Z5equaldd
	.cfi_startproc
# %bb.0:
	subsd	%xmm1, %xmm0
	andpd	.LCPI0_0(%rip), %xmm0
	movsd	.LCPI0_1(%rip), %xmm1           # xmm1 = mem[0],zero
	xorl	%eax, %eax
	ucomisd	%xmm0, %xmm1
	seta	%al
	retq
.Lfunc_end0:
	.size	_Z5equaldd, .Lfunc_end0-_Z5equaldd
	.cfi_endproc
                                        # -- End function
	.globl	_Z2nli                          # -- Begin function _Z2nli
	.type	_Z2nli,@function
_Z2nli:                                 # @_Z2nli
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jle	.LBB1_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	%edi, %ebx
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$45, %edi
	callq	putchar
	decl	%ebx
	jne	.LBB1_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
.LBB1_4:                                # %._crit_edge
	movl	$10, %edi
	jmp	putchar                         # TAILCALL
.Lfunc_end1:
	.size	_Z2nli, .Lfunc_end1-_Z2nli
	.cfi_endproc
                                        # -- End function
	.globl	_Z15updateHostTablePdiii        # -- Begin function _Z15updateHostTablePdiii
	.type	_Z15updateHostTablePdiii,@function
_Z15updateHostTablePdiii:               # @_Z15updateHostTablePdiii
	.cfi_startproc
# %bb.0:
	testl	%edx, %edx
	jle	.LBB2_4
# %bb.1:                                # %.lr.ph
	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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movslq	%ecx, %r14
	shlq	$3, %r14
	movslq	%esi, %r15
	movl	%edx, %eax
	imulq	$40000, %rax, %r12              # imm = 0x9C40
	xorl	%r13d, %r13d
.LBB2_2:                                # =>This Inner Loop Header: Depth=1
	movq	demoTab(%rip), %rax
	leaq	(%rax,%r13), %rdi
	addq	$8, %rdi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	addq	%r15, %rbx
	addq	$40000, %r13                    # imm = 0x9C40
	cmpq	%r13, %r12
	jne	.LBB2_2
# %bb.3:
	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
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
.LBB2_4:                                # %._crit_edge
	retq
.Lfunc_end2:
	.size	_Z15updateHostTablePdiii, .Lfunc_end2-_Z15updateHostTablePdiii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z11writetofileP8_IO_FILEPdii
.LCPI3_0:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.text
	.globl	_Z11writetofileP8_IO_FILEPdii
	.type	_Z11writetofileP8_IO_FILEPdii,@function
_Z11writetofileP8_IO_FILEPdii:          # @_Z11writetofileP8_IO_FILEPdii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%ecx, %ebp
	movq	%rdi, %rbx
	movsd	(%rsi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	cmpl	$2, %edx
	jl	.LBB3_11
# %bb.1:                                # %.lr.ph
	movq	%rsi, %r14
	movl	%edx, %r12d
	movl	$1, %r15d
	xorpd	%xmm1, %xmm1
.LBB3_2:                                # =>This Inner Loop Header: Depth=1
	cmpq	$1, %r15
	jne	.LBB3_4
# %bb.3:                                #   in Loop: Header=BB3_2 Depth=1
	movsd	8(%r14), %xmm0                  # xmm0 = mem[0],zero
	movl	$.L.str, %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	jmp	.LBB3_9
.LBB3_4:                                #   in Loop: Header=BB3_2 Depth=1
	movsd	(%r14,%r15,8), %xmm0            # xmm0 = mem[0],zero
	ucomisd	%xmm1, %xmm0
	jae	.LBB3_5
# %bb.6:                                #   in Loop: Header=BB3_2 Depth=1
	ucomisd	%xmm0, %xmm1
	jbe	.LBB3_10
# %bb.7:                                #   in Loop: Header=BB3_2 Depth=1
	andpd	.LCPI3_0(%rip), %xmm0
	movl	$.L.str.2, %esi
	jmp	.LBB3_8
.LBB3_5:                                #   in Loop: Header=BB3_2 Depth=1
	andpd	.LCPI3_0(%rip), %xmm0
	movl	$.L.str.1, %esi
.LBB3_8:                                #   in Loop: Header=BB3_2 Depth=1
	movq	%rbx, %rdi
	movl	%r15d, %edx
.LBB3_9:                                #   in Loop: Header=BB3_2 Depth=1
	movb	$1, %al
	callq	fprintf
	xorpd	%xmm1, %xmm1
.LBB3_10:                               #   in Loop: Header=BB3_2 Depth=1
	incq	%r15
	cmpq	%r15, %r12
	jne	.LBB3_2
.LBB3_11:                               # %._crit_edge
	cmpl	$-1, %ebp
	movl	$.L.str.4, %eax
	movl	$.L.str.5, %ecx
	cmoveq	%rax, %rcx
	cmpl	$1, %ebp
	movl	$.L.str.3, %esi
	cmovneq	%rcx, %rsi
	movq	%rbx, %rdi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	fprintf
	movl	$.L.str.6, %edi
	movl	$2, %esi
	movl	$1, %edx
	movq	%rbx, %rcx
	addq	$16, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	fwrite@PLT                      # TAILCALL
.Lfunc_end3:
	.size	_Z11writetofileP8_IO_FILEPdii, .Lfunc_end3-_Z11writetofileP8_IO_FILEPdii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z13print_tableauP3TabPKci
.LCPI4_0:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI4_1:
	.quad	0x3ee4f8b588e368f1              # double 1.0000000000000001E-5
	.text
	.globl	_Z13print_tableauP3TabPKci
	.type	_Z13print_tableauP3TabPKci,@function
_Z13print_tableauP3TabPKci:             # @_Z13print_tableauP3TabPKci
	.cfi_startproc
# %bb.0:
	testl	%edx, %edx
	je	.LBB4_17
# %bb.1:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rax
	movq	%rdi, %rbx
	movl	_ZZ13print_tableauP3TabPKciE7counter(%rip), %esi
	incl	%esi
	movl	%esi, _ZZ13print_tableauP3TabPKciE7counter(%rip)
	movl	$.L.str.7, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	printf
	movl	$70, %edi
	callq	_Z2nli
	movl	$.L.str.8, %edi
	movl	$.L.str.9, %esi
	movl	$.L.str.10, %edx
	xorl	%eax, %eax
	callq	printf
	cmpl	$2, 4(%rbx)
	jl	.LBB4_4
# %bb.2:                                # %.lr.ph.preheader
	movl	$1, %ebp
.LBB4_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$.L.str.11, %edi
	movl	%ebp, %esi
	xorl	%eax, %eax
	callq	printf
	incl	%ebp
	cmpl	4(%rbx), %ebp
	jl	.LBB4_3
.LBB4_4:                                # %._crit_edge
	movl	$10, %edi
	callq	putchar
	cmpl	$0, (%rbx)
	jle	.LBB4_16
# %bb.5:                                # %.lr.ph35.preheader
	leaq	8(%rbx), %r15
	xorl	%r14d, %r14d
.LBB4_6:                                # %.lr.ph35
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_11 Depth 2
	testq	%r14, %r14
	je	.LBB4_7
# %bb.8:                                #   in Loop: Header=BB4_6 Depth=1
	movl	$.L.str.14, %edi
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	printf
	jmp	.LBB4_9
.LBB4_7:                                #   in Loop: Header=BB4_6 Depth=1
	movl	$.L.str.13, %edi
	xorl	%eax, %eax
	callq	printf
.LBB4_9:                                #   in Loop: Header=BB4_6 Depth=1
	cmpl	$0, 4(%rbx)
	jle	.LBB4_15
# %bb.10:                               # %.lr.ph31.preheader
                                        #   in Loop: Header=BB4_6 Depth=1
	xorl	%r12d, %r12d
.LBB4_11:                               # %.lr.ph31
                                        #   Parent Loop BB4_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%r15,%r12,8), %xmm0            # xmm0 = mem[0],zero
	cvttpd2dq	%xmm0, %xmm1
	cvtdq2pd	%xmm1, %xmm1
	subsd	%xmm0, %xmm1
	andpd	.LCPI4_0(%rip), %xmm1
	movsd	.LCPI4_1(%rip), %xmm2           # xmm2 = mem[0],zero
	ucomisd	%xmm1, %xmm2
	ja	.LBB4_12
# %bb.13:                               #   in Loop: Header=BB4_11 Depth=2
	movl	$.L.str.16, %edi
	movb	$1, %al
	callq	printf
	jmp	.LBB4_14
.LBB4_12:                               #   in Loop: Header=BB4_11 Depth=2
	cvttsd2si	%xmm0, %esi
	movl	$.L.str.15, %edi
	xorl	%eax, %eax
	callq	printf
.LBB4_14:                               #   in Loop: Header=BB4_11 Depth=2
	incq	%r12
	movslq	4(%rbx), %rax
	cmpq	%rax, %r12
	jl	.LBB4_11
.LBB4_15:                               # %._crit_edge32
                                        #   in Loop: Header=BB4_6 Depth=1
	movl	$10, %edi
	callq	putchar
	incq	%r14
	movslq	(%rbx), %rax
	addq	$40000, %r15                    # imm = 0x9C40
	cmpq	%rax, %r14
	jl	.LBB4_6
.LBB4_16:                               # %._crit_edge36
	movl	$70, %edi
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	_Z2nli                          # TAILCALL
.LBB4_17:
	.cfi_restore %rbx
	.cfi_restore %rbp
	.cfi_restore %r12
	.cfi_restore %r14
	.cfi_restore %r15
	retq
.Lfunc_end4:
	.size	_Z13print_tableauP3TabPKci, .Lfunc_end4-_Z13print_tableauP3TabPKci
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z9negateRowPdi
.LCPI5_0:
	.quad	0x8000000000000000              # double -0
	.quad	0x8000000000000000              # double -0
	.text
	.globl	_Z9negateRowPdi
	.type	_Z9negateRowPdi,@function
_Z9negateRowPdi:                        # @_Z9negateRowPdi
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB5_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%esi, %eax
	xorl	%ecx, %ecx
	movaps	.LCPI5_0(%rip), %xmm0           # xmm0 = [-0.0E+0,-0.0E+0]
.LBB5_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%rdi,%rcx,8), %xmm1            # xmm1 = mem[0],zero
	xorps	%xmm0, %xmm1
	movlps	%xmm1, (%rdi,%rcx,8)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB5_2
.LBB5_3:                                # %._crit_edge
	retq
.Lfunc_end5:
	.size	_Z9negateRowPdi, .Lfunc_end5-_Z9negateRowPdi
	.cfi_endproc
                                        # -- End function
	.globl	_Z8printRowPdi                  # -- Begin function _Z8printRowPdi
	.type	_Z8printRowPdi,@function
_Z8printRowPdi:                         # @_Z8printRowPdi
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB6_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movl	%esi, %r14d
	xorl	%r15d, %r15d
.LBB6_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%rbx,%r15,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str.17, %edi
	movb	$1, %al
	callq	printf
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB6_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB6_4:                                # %._crit_edge
	movl	$10, %edi
	jmp	putchar                         # TAILCALL
.Lfunc_end6:
	.size	_Z8printRowPdi, .Lfunc_end6-_Z8printRowPdi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z12read_tableauP7TableauPKci
.LCPI7_0:
	.quad	0x3ff0000000000000              # double 1
.LCPI7_2:
	.quad	0x0000000000000000              # double 0
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI7_1:
	.quad	0x8000000000000000              # double -0
	.quad	0x8000000000000000              # double -0
	.text
	.globl	_Z12read_tableauP7TableauPKci
	.type	_Z12read_tableauP7TableauPKci,@function
_Z12read_tableauP7TableauPKci:          # @_Z12read_tableauP7TableauPKci
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, %r13
	movq	%rdi, %r15
	movl	$.L.str.18, %esi
	movq	%r13, %rdi
	callq	fopen
	testq	%rax, %rax
	je	.LBB7_41
# %bb.1:
	movq	%rax, %rbx
	leaq	8(%r15), %rdx
	leaq	12(%r15), %rcx
	movl	$.L.str.20, %esi
	movq	%rax, %rdi
	movq	%rcx, -88(%rbp)                 # 8-byte Spill
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	incl	%eax
	cmpl	$1, %eax
	jbe	.LBB7_42
# %bb.2:
	movl	8(%r15), %eax
	movl	12(%r15), %edx
	movl	%edx, 16(%r15)
	movslq	%eax, %rcx
	movq	%rdx, -64(%rbp)                 # 8-byte Spill
	leal	(%rcx,%rdx,2), %edx
	decl	%edx
	movl	%edx, 12(%r15)
	movl	%r14d, -68(%rbp)                # 4-byte Spill
	testl	%r14d, %r14d
	je	.LBB7_4
# %bb.3:
	movq	demoTab(%rip), %rsi
	movl	%eax, (%rsi)
	movl	%edx, 4(%rsi)
.LBB7_4:
	movslq	%edx, %rdx
	shlq	$3, %rdx
	leaq	-144(%rbp), %r14
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	hipMallocPitch
	movq	%rsp, -104(%rbp)                # 8-byte Spill
	movl	(%r14), %eax
	movl	%eax, 24(%r15)
	movl	12(%r15), %eax
	movq	%rsp, %r12
	leaq	15(,%rax,8), %rax
	andq	$-16, %rax
	subq	%rax, %r12
	movq	%r12, %rsp
	movl	$0, -44(%rbp)
	movl	8(%r15), %r14d
	movl	$.L.str.22, %edi
	movl	$.L.str.23, %esi
	callq	fopen
	movq	%rax, -112(%rbp)                # 8-byte Spill
	movslq	12(%r15), %rdx
	shlq	$3, %rdx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	movl	8(%r15), %esi
	testl	%esi, %esi
	jle	.LBB7_33
# %bb.5:                                # %.lr.ph124
	movq	%r13, -96(%rbp)                 # 8-byte Spill
	movq	%rbx, -56(%rbp)                 # 8-byte Spill
	movq	-64(%rbp), %rax                 # 8-byte Reload
	leal	-1(,%rax,2), %ecx
	movl	%ecx, -72(%rbp)                 # 4-byte Spill
	leal	(%rax,%r14), %ecx
	decl	%ecx
	movl	%ecx, -76(%rbp)                 # 4-byte Spill
	movl	$1, %ecx
	subl	%eax, %ecx
	movq	%rcx, -128(%rbp)                # 8-byte Spill
	movl	%ecx, %ebx
	subl	%r14d, %ebx
	movl	$-1, -48(%rbp)                  # 4-byte Folded Spill
	xorl	%r13d, %r13d
	movq	%r15, -120(%rbp)                # 8-byte Spill
.LBB7_6:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB7_10 Depth 2
                                        #     Child Loop BB7_30 Depth 2
	movsd	.LCPI7_0(%rip), %xmm0           # xmm0 = mem[0],zero
	testq	%r13, %r13
	je	.LBB7_8
# %bb.7:                                #   in Loop: Header=BB7_6 Depth=1
	xorpd	%xmm0, %xmm0
.LBB7_8:                                #   in Loop: Header=BB7_6 Depth=1
	movq	-88(%rbp), %rax                 # 8-byte Reload
	movslq	(%rax), %rax
	movsd	%xmm0, -8(%r12,%rax,8)
	cmpl	$0, -76(%rbp)                   # 4-byte Folded Reload
	jle	.LBB7_21
# %bb.9:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB7_6 Depth=1
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
.LBB7_10:                               # %.lr.ph
                                        #   Parent Loop BB7_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpl	-64(%rbp), %r14d                # 4-byte Folded Reload
	jge	.LBB7_14
# %bb.11:                               #   in Loop: Header=BB7_10 Depth=2
	testl	%r14d, %r14d
	je	.LBB7_18
# %bb.12:                               #   in Loop: Header=BB7_10 Depth=2
	movl	$.L.str.24, %esi
	movq	-56(%rbp), %rdi                 # 8-byte Reload
	leaq	-136(%rbp), %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	incl	%eax
	cmpl	$1, %eax
	jbe	.LBB7_36
# %bb.13:                               #   in Loop: Header=BB7_10 Depth=2
	movsd	-136(%rbp), %xmm0               # xmm0 = mem[0],zero
	movslq	%r15d, %rax
	movsd	%xmm0, (%r12,%rax,8)
	xorpd	.LCPI7_1(%rip), %xmm0
	movlpd	%xmm0, 8(%r12,%rax,8)
	addl	$2, %r15d
	jmp	.LBB7_20
.LBB7_14:                               #   in Loop: Header=BB7_10 Depth=2
	testq	%r13, %r13
	je	.LBB7_20
# %bb.15:                               #   in Loop: Header=BB7_10 Depth=2
	movq	-128(%rbp), %rax                # 8-byte Reload
	addl	%r14d, %eax
	movsd	.LCPI7_0(%rip), %xmm0           # xmm0 = mem[0],zero
	cmpq	%rax, %r13
	je	.LBB7_17
# %bb.16:                               #   in Loop: Header=BB7_10 Depth=2
	xorpd	%xmm0, %xmm0
.LBB7_17:                               #   in Loop: Header=BB7_10 Depth=2
	movl	-48(%rbp), %eax                 # 4-byte Reload
	cmovel	%r15d, %eax
	movl	%eax, -48(%rbp)                 # 4-byte Spill
	movslq	%r15d, %rax
	movsd	%xmm0, (%r12,%rax,8)
	incl	%eax
	movl	%eax, %r15d
	jmp	.LBB7_20
.LBB7_18:                               #   in Loop: Header=BB7_10 Depth=2
	movslq	%r15d, %rax
	leaq	(%r12,%rax,8), %rdx
	movl	$.L.str.24, %esi
	movq	-56(%rbp), %rdi                 # 8-byte Reload
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	incl	%eax
	cmpl	$1, %eax
	jbe	.LBB7_37
# %bb.19:                               #   in Loop: Header=BB7_10 Depth=2
	incl	%r15d
.LBB7_20:                               #   in Loop: Header=BB7_10 Depth=2
	incl	%r14d
	movl	%ebx, %eax
	addl	%r14d, %eax
	jne	.LBB7_10
.LBB7_21:                               # %._crit_edge
                                        #   in Loop: Header=BB7_6 Depth=1
	testq	%r13, %r13
	movq	-120(%rbp), %r15                # 8-byte Reload
	je	.LBB7_31
# %bb.22:                               #   in Loop: Header=BB7_6 Depth=1
	movl	$0, -44(%rbp)
	movl	$.L.str.26, %esi
	movq	-56(%rbp), %rdi                 # 8-byte Reload
	leaq	-44(%rbp), %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	incl	%eax
	cmpl	$2, %eax
	jb	.LBB7_38
# %bb.23:                               #   in Loop: Header=BB7_6 Depth=1
	movl	-44(%rbp), %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	$2, %eax
	jae	.LBB7_38
# %bb.24:                               #   in Loop: Header=BB7_6 Depth=1
	movq	-112(%rbp), %rdi                # 8-byte Reload
	movq	%r12, %rsi
	movl	-72(%rbp), %edx                 # 4-byte Reload
	callq	_Z11writetofileP8_IO_FILEPdii
	cmpl	$1, -44(%rbp)
	jne	.LBB7_31
# %bb.25:                               #   in Loop: Header=BB7_6 Depth=1
	movslq	-48(%rbp), %rax                 # 4-byte Folded Reload
	movabsq	$-4616189618054758400, %rcx     # imm = 0xBFF0000000000000
	movq	%rcx, (%r12,%rax,8)
	xorpd	%xmm0, %xmm0
	ucomisd	(%r12), %xmm0
	jae	.LBB7_28
# %bb.26:                               #   in Loop: Header=BB7_6 Depth=1
	cmpl	$-1, 20(%r15)
	jne	.LBB7_31
# %bb.27:                               #   in Loop: Header=BB7_6 Depth=1
	movl	%r13d, 20(%r15)
	jmp	.LBB7_31
.LBB7_28:                               #   in Loop: Header=BB7_6 Depth=1
	movq	-88(%rbp), %rax                 # 8-byte Reload
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	.LBB7_31
# %bb.29:                               # %.lr.ph.preheader.i
                                        #   in Loop: Header=BB7_6 Depth=1
	xorl	%ecx, %ecx
.LBB7_30:                               # %.lr.ph.i
                                        #   Parent Loop BB7_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%r12,%rcx,8), %xmm0            # xmm0 = mem[0],zero
	xorpd	.LCPI7_1(%rip), %xmm0
	movlpd	%xmm0, (%r12,%rcx,8)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB7_30
.LBB7_31:                               # %_Z9negateRowPdi.exit
                                        #   in Loop: Header=BB7_6 Depth=1
	movq	-144(%rbp), %rdi
	imulq	%r13, %rdi
	addq	(%r15), %rdi
	movslq	12(%r15), %rdx
	shlq	$3, %rdx
	movq	%r12, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	incq	%r13
	movslq	8(%r15), %rsi
	cmpq	%rsi, %r13
	jl	.LBB7_6
# %bb.32:
	movq	-56(%rbp), %rbx                 # 8-byte Reload
	movq	-96(%rbp), %r13                 # 8-byte Reload
.LBB7_33:                               # %._crit_edge125
	movl	$.L.str.27, %edi
                                        # kill: def $esi killed $esi killed $rsi
	movq	-64(%rbp), %rdx                 # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	movq	%r13, %rcx
	xorl	%eax, %eax
	callq	printf
	cmpl	$0, -68(%rbp)                   # 4-byte Folded Reload
	je	.LBB7_35
# %bb.34:
	movq	(%r15), %rdi
	movl	24(%r15), %esi
	movl	8(%r15), %edx
	movl	12(%r15), %ecx
	callq	_Z15updateHostTablePdiii
.LBB7_35:
	movq	%rbx, %rdi
	callq	fclose
	movq	-104(%rbp), %rsp                # 8-byte Reload
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.LBB7_36:
	.cfi_def_cfa %rbp, 16
	movl	$.L.str.25, %edi
	movl	%r13d, %esi
	movl	%r14d, %edx
	jmp	.LBB7_39
.LBB7_37:
	movl	$.L.str.25, %edi
	movl	%r13d, %esi
	xorl	%edx, %edx
	jmp	.LBB7_39
.LBB7_38:
	movl	$.L.str.25, %edi
	movl	%r13d, %esi
	movq	-64(%rbp), %rdx                 # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
.LBB7_39:
	xorl	%eax, %eax
	callq	printf
.LBB7_40:
	movl	$1, %edi
	callq	exit
.LBB7_41:
	movl	$.L.str.19, %edi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	printf
	jmp	.LBB7_40
.LBB7_42:
	movl	$.Lstr, %edi
	callq	puts@PLT
	jmp	.LBB7_40
.Lfunc_end7:
	.size	_Z12read_tableauP7TableauPKci, .Lfunc_end7-_Z12read_tableauP7TableauPKci
	.cfi_endproc
                                        # -- End function
	.globl	_Z34__device_stub__divideByPivotKernelPdiiidi # -- Begin function _Z34__device_stub__divideByPivotKernelPdiiidi
	.type	_Z34__device_stub__divideByPivotKernelPdiiidi,@function
_Z34__device_stub__divideByPivotKernelPdiiidi: # @_Z34__device_stub__divideByPivotKernelPdiiidi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	12(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	8(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	32(%rsp), %rcx
	movsd	%xmm0, (%rcx)
	movq	%rsp, %r9
	movl	%r8d, (%r9)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r9, 40(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z19divideByPivotKernelPdiiidi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_Z34__device_stub__divideByPivotKernelPdiiidi, .Lfunc_end8-_Z34__device_stub__divideByPivotKernelPdiiidi
	.cfi_endproc
                                        # -- End function
	.globl	_Z44__device_stub__computeNewValuesForRowsKernelPdiiiii # -- Begin function _Z44__device_stub__computeNewValuesForRowsKernelPdiiiii
	.type	_Z44__device_stub__computeNewValuesForRowsKernelPdiiiii,@function
_Z44__device_stub__computeNewValuesForRowsKernelPdiiiii: # @_Z44__device_stub__computeNewValuesForRowsKernelPdiiiii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	20(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	16(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	12(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	8(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	4(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	80(%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	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%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	$_Z29computeNewValuesForRowsKernelPdiiiii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end9:
	.size	_Z44__device_stub__computeNewValuesForRowsKernelPdiiiii, .Lfunc_end9-_Z44__device_stub__computeNewValuesForRowsKernelPdiiiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z51__device_stub__computeNewValuesForRowsInPivotColumnPdiiii # -- Begin function _Z51__device_stub__computeNewValuesForRowsInPivotColumnPdiiii
	.type	_Z51__device_stub__computeNewValuesForRowsInPivotColumnPdiiii,@function
_Z51__device_stub__computeNewValuesForRowsInPivotColumnPdiiii: # @_Z51__device_stub__computeNewValuesForRowsInPivotColumnPdiiii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	20(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	16(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	12(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	8(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%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	$_Z36computeNewValuesForRowsInPivotColumnPdiiii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end10:
	.size	_Z51__device_stub__computeNewValuesForRowsInPivotColumnPdiiii, .Lfunc_end10-_Z51__device_stub__computeNewValuesForRowsInPivotColumnPdiiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z8pivot_onP7Tableauii          # -- Begin function _Z8pivot_onP7Tableauii
	.type	_Z8pivot_onP7Tableauii,@function
_Z8pivot_onP7Tableauii:                 # @_Z8pivot_onP7Tableauii
	.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
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebp
	movl	%esi, %ebx
	movq	%rdi, %r14
	movabsq	$4294967296, %r13               # imm = 0x100000000
	movslq	24(%rdi), %rax
	movslq	%esi, %rcx
	imulq	%rax, %rcx
	addq	(%rdi), %rcx
	movslq	%edx, %rax
	leaq	(%rcx,%rax,8), %rsi
	movq	%rsp, %rdi
	movl	$8, %edx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	12(%r14), %edi
	movl	8(%r14), %r15d
	imull	%edi, %r15d
	leal	511(%rdi), %eax
	addl	$1022, %edi                     # imm = 0x3FE
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$9, %edi
	btsq	$32, %rdi
	leaq	512(%r13), %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB11_2
# %bb.1:
	movq	(%r14), %rdi
	movl	24(%r14), %esi
	movsd	(%rsp), %xmm0                   # xmm0 = mem[0],zero
	movl	12(%r14), %r8d
	movl	%ebx, %edx
	movl	%ebp, %ecx
	callq	_Z34__device_stub__divideByPivotKernelPdiiidi
.LBB11_2:
	leal	511(%r15), %eax
	leal	1022(%r15), %edi
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$9, %edi
	orq	%r13, %rdi
	leaq	512(%r13), %r12
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB11_4
# %bb.3:
	movq	(%r14), %rdi
	movl	24(%r14), %esi
	movl	12(%r14), %r8d
	movl	%ebx, %edx
	movl	%ebp, %ecx
	movl	%r15d, %r9d
	callq	_Z44__device_stub__computeNewValuesForRowsKernelPdiiiii
.LBB11_4:
	movl	8(%r14), %edi
	leal	511(%rdi), %eax
	addl	$1022, %edi                     # imm = 0x3FE
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$9, %edi
	orq	%r13, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB11_6
# %bb.5:
	movq	(%r14), %rdi
	movl	24(%r14), %esi
	movl	8(%r14), %r8d
	movl	%ebp, %edx
	movl	%ebx, %ecx
	callq	_Z51__device_stub__computeNewValuesForRowsInPivotColumnPdiiii
.LBB11_6:
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end11:
	.size	_Z8pivot_onP7Tableauii, .Lfunc_end11-_Z8pivot_onP7Tableauii
	.cfi_endproc
                                        # -- End function
	.globl	_Z29__device_stub__findPivotIndexPdP7Elementiiiii # -- Begin function _Z29__device_stub__findPivotIndexPdP7Elementiiiii
	.type	_Z29__device_stub__findPivotIndexPdP7Elementiiiii,@function
_Z29__device_stub__findPivotIndexPdP7Elementiiiii: # @_Z29__device_stub__findPivotIndexPdP7Elementiiiii
	.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	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	movq	%rsp, %r8
	movl	%r9d, (%r8)
	leaq	80(%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	192(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z14findPivotIndexPdP7Elementiiiii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end12:
	.size	_Z29__device_stub__findPivotIndexPdP7Elementiiiii, .Lfunc_end12-_Z29__device_stub__findPivotIndexPdP7Elementiiiii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z17find_pivot_columnP7Tableaui
.LCPI13_0:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI13_1:
	.quad	0x3ee4f8b588e368f1              # double 1.0000000000000001E-5
	.text
	.globl	_Z17find_pivot_columnP7Tableaui
	.type	_Z17find_pivot_columnP7Tableaui,@function
_Z17find_pivot_columnP7Tableaui:        # @_Z17find_pivot_columnP7Tableaui
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, -96(%rbp)                 # 4-byte Spill
	movq	%rdi, %r13
	movl	12(%rdi), %edx
	movq	(%rdi), %rcx
	movslq	20(%rdi), %r12
	cmpq	$-1, %r12
	je	.LBB13_1
# %bb.2:
	movslq	24(%r13), %rax
	imulq	%r12, %rax
	addq	%rax, %rcx
	addq	$8, %rcx
	movq	%rcx, -80(%rbp)                 # 8-byte Spill
	movl	$-1, 20(%r13)
	decl	%edx
	movl	$1, %eax
	movq	%rax, -72(%rbp)                 # 8-byte Spill
	movl	$0, -44(%rbp)                   # 4-byte Folded Spill
	jmp	.LBB13_3
.LBB13_1:
	movq	%rcx, -80(%rbp)                 # 8-byte Spill
	xorl	%eax, %eax
	movq	%rax, -72(%rbp)                 # 8-byte Spill
	movl	$1, -44(%rbp)                   # 4-byte Folded Spill
.LBB13_3:
	movl	%edx, -60(%rbp)                 # 4-byte Spill
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rcx         # imm = 0x66666667
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$34, %rcx
	addl	%edx, %ecx
	leal	(%rcx,%rcx), %edx
	leal	(%rdx,%rdx,4), %edx
	subl	%edx, %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	setg	%bl
	addl	%ecx, %ebx
	movq	%rbx, %rax
	shlq	$4, %rax
	movq	%rsp, %r14
	subq	%rax, %r14
	movq	%r14, %rsp
	movl	%ebx, %eax
	shll	$4, %eax
	movslq	%eax, %r15
	leaq	-56(%rbp), %rdi
	movq	%r15, %rsi
	callq	hipMalloc
	movl	12(%r13), %edi
	leal	511(%rdi), %eax
	addl	$1022, %edi                     # imm = 0x3FE
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$9, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$512, %rdx                      # imm = 0x200
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB13_5
# %bb.4:
	movq	-56(%rbp), %rsi
	subq	$8, %rsp
	movq	-80(%rbp), %rdi                 # 8-byte Reload
	movl	-60(%rbp), %edx                 # 4-byte Reload
	movl	%ebx, %ecx
	movl	$10, %r8d
	movl	-44(%rbp), %r9d                 # 4-byte Reload
	pushq	-72(%rbp)                       # 8-byte Folded Reload
	callq	_Z29__device_stub__findPivotIndexPdP7Elementiiiii
	addq	$16, %rsp
.LBB13_5:
	movq	-56(%rbp), %rsi
	movq	%r14, %rdi
	movq	%r15, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	8(%r14), %r15d
	movsd	(%r14), %xmm0                   # xmm0 = mem[0],zero
	cmpl	$2, %ebx
	jl	.LBB13_12
# %bb.6:                                # %.lr.ph.preheader
	addq	$24, %r14
	leaq	-1(%rbx), %rax
.LBB13_7:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	-8(%r14), %xmm1                 # xmm1 = mem[0],zero
	cmpl	$-1, %r12d
	je	.LBB13_9
# %bb.8:                                #   in Loop: Header=BB13_7 Depth=1
	ucomisd	%xmm0, %xmm1
	jbe	.LBB13_11
.LBB13_10:                              # %.sink.split
                                        #   in Loop: Header=BB13_7 Depth=1
	movl	(%r14), %r15d
	movapd	%xmm1, %xmm0
.LBB13_11:                              #   in Loop: Header=BB13_7 Depth=1
	addq	$16, %r14
	decq	%rax
	jne	.LBB13_7
	jmp	.LBB13_12
.LBB13_9:                               #   in Loop: Header=BB13_7 Depth=1
	ucomisd	%xmm1, %xmm0
	ja	.LBB13_10
	jmp	.LBB13_11
.LBB13_12:                              # %._crit_edge
	cmpl	$0, -96(%rbp)                   # 4-byte Folded Reload
	je	.LBB13_14
# %bb.13:
	movl	$.L.str.28, %edi
	movl	%r15d, %esi
	movb	$1, %al
	movapd	%xmm0, -96(%rbp)                # 16-byte Spill
	callq	printf
	movapd	-96(%rbp), %xmm0                # 16-byte Reload
.LBB13_14:
	movl	$-1, %eax
	cmpl	$-1, %r12d
	jne	.LBB13_16
# %bb.15:
	xorpd	%xmm1, %xmm1
	ucomisd	%xmm1, %xmm0
	jae	.LBB13_19
.LBB13_16:
	cmpl	$-1, %r12d
	jne	.LBB13_18
# %bb.17:
	andpd	.LCPI13_0(%rip), %xmm0
	movsd	.LCPI13_1(%rip), %xmm1          # xmm1 = mem[0],zero
	ucomisd	%xmm0, %xmm1
	ja	.LBB13_19
.LBB13_18:
	movq	-56(%rbp), %rdi
	callq	hipFree
	movl	%r15d, %eax
.LBB13_19:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.Lfunc_end13:
	.size	_Z17find_pivot_columnP7Tableaui, .Lfunc_end13-_Z17find_pivot_columnP7Tableaui
	.cfi_endproc
                                        # -- End function
	.globl	_Z32__device_stub__find_pivot_kernelv # -- Begin function _Z32__device_stub__find_pivot_kernelv
	.type	_Z32__device_stub__find_pivot_kernelv,@function
_Z32__device_stub__find_pivot_kernelv:  # @_Z32__device_stub__find_pivot_kernelv
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rbx
	leaq	24(%rsp), %r14
	leaq	16(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	movq	%r12, %rcx
	callq	__hipPopCallConfiguration
	movq	(%rbx), %rsi
	movl	8(%rbx), %edx
	movq	(%r14), %rcx
	movl	8(%r14), %r8d
	movq	%rsp, %r9
	movl	$_Z17find_pivot_kernelv, %edi
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	pushq	(%r15)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$72, %rsp
	.cfi_adjust_cfa_offset -72
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end14:
	.size	_Z32__device_stub__find_pivot_kernelv, .Lfunc_end14-_Z32__device_stub__find_pivot_kernelv
	.cfi_endproc
                                        # -- End function
	.globl	_Z33__device_stub__computeRatioKernelPdiiS_i # -- Begin function _Z33__device_stub__computeRatioKernelPdiiS_i
	.type	_Z33__device_stub__computeRatioKernelPdiiS_i,@function
_Z33__device_stub__computeRatioKernelPdiiS_i: # @_Z33__device_stub__computeRatioKernelPdiiS_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	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	12(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	8(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z18computeRatioKernelPdiiS_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end15:
	.size	_Z33__device_stub__computeRatioKernelPdiiS_i, .Lfunc_end15-_Z33__device_stub__computeRatioKernelPdiiS_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z14find_pivot_rowP7Tableauii
.LCPI16_0:
	.quad	0xbff0000000000000              # double -1
.LCPI16_2:
	.quad	0x3ee4f8b588e368f1              # double 1.0000000000000001E-5
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI16_1:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.text
	.globl	_Z14find_pivot_rowP7Tableauii
	.type	_Z14find_pivot_rowP7Tableauii,@function
_Z14find_pivot_rowP7Tableauii:          # @_Z14find_pivot_rowP7Tableauii
	.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	$56, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebp
	movl	%esi, %ebx
	movq	%rdi, %r15
	movl	8(%rdi), %eax
	shll	$3, %eax
	movslq	%eax, %r13
	leaq	8(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, %r14
	testl	%ebp, %ebp
	je	.LBB16_2
# %bb.1:
	movl	$.L.str.29, %edi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	printf
.LBB16_2:
	movl	8(%r15), %edi
	leal	511(%rdi), %eax
	addl	$1022, %edi                     # imm = 0x3FE
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$9, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$512, %rdx                      # imm = 0x200
	xorl	%r12d, %r12d
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB16_4
# %bb.3:
	movq	(%r15), %rdi
	movl	24(%r15), %esi
	movq	8(%rsp), %rcx
	movl	8(%r15), %r8d
	movl	%ebx, %edx
	callq	_Z33__device_stub__computeRatioKernelPdiiS_i
.LBB16_4:
	movq	8(%rsp), %rsi
	movq	%r14, %rdi
	movq	%r13, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	cmpl	$2, 8(%r15)
	jl	.LBB16_5
# %bb.6:                                # %.lr.ph.preheader
	movsd	.LCPI16_0(%rip), %xmm1          # xmm1 = mem[0],zero
	xorl	%r12d, %r12d
	movl	$1, %r13d
	xorpd	%xmm2, %xmm2
	movapd	.LCPI16_1(%rip), %xmm3          # xmm3 = [NaN,NaN]
	movsd	.LCPI16_2(%rip), %xmm4          # xmm4 = mem[0],zero
.LBB16_7:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%r14,%r13,8), %xmm0            # xmm0 = mem[0],zero
	testl	%ebp, %ebp
	je	.LBB16_9
# %bb.8:                                #   in Loop: Header=BB16_7 Depth=1
	movl	$.L.str.30, %edi
	movb	$1, %al
	movapd	%xmm1, 16(%rsp)                 # 16-byte Spill
	movapd	%xmm0, 32(%rsp)                 # 16-byte Spill
	callq	printf
	movapd	32(%rsp), %xmm0                 # 16-byte Reload
	movsd	.LCPI16_2(%rip), %xmm4          # xmm4 = mem[0],zero
	movapd	.LCPI16_1(%rip), %xmm3          # xmm3 = [NaN,NaN]
	xorpd	%xmm2, %xmm2
	movapd	16(%rsp), %xmm1                 # 16-byte Reload
.LBB16_9:                               #   in Loop: Header=BB16_7 Depth=1
	ucomisd	%xmm2, %xmm0
	jae	.LBB16_10
# %bb.12:                               #   in Loop: Header=BB16_7 Depth=1
	ucomisd	%xmm1, %xmm2
	jbe	.LBB16_13
	jmp	.LBB16_15
.LBB16_10:                              #   in Loop: Header=BB16_7 Depth=1
	ucomisd	%xmm1, %xmm2
	ja	.LBB16_15
# %bb.11:                               #   in Loop: Header=BB16_7 Depth=1
	ucomisd	%xmm0, %xmm1
	ja	.LBB16_15
.LBB16_13:                              #   in Loop: Header=BB16_7 Depth=1
	movapd	%xmm0, %xmm5
	andpd	%xmm3, %xmm5
	ucomisd	%xmm5, %xmm4
	jbe	.LBB16_16
# %bb.14:                               #   in Loop: Header=BB16_7 Depth=1
	ucomisd	%xmm0, %xmm1
	jbe	.LBB16_16
.LBB16_15:                              #   in Loop: Header=BB16_7 Depth=1
	movapd	%xmm0, %xmm1
	andpd	%xmm3, %xmm1
	cmpnltsd	%xmm4, %xmm1
	andpd	%xmm0, %xmm1
	movl	%r13d, %r12d
.LBB16_16:                              #   in Loop: Header=BB16_7 Depth=1
	incq	%r13
	movslq	8(%r15), %rax
	cmpq	%rax, %r13
	jl	.LBB16_7
	jmp	.LBB16_17
.LBB16_5:
	movsd	.LCPI16_0(%rip), %xmm1          # xmm1 = mem[0],zero
.LBB16_17:                              # %._crit_edge
	movapd	%xmm1, 16(%rsp)                 # 16-byte Spill
	testl	%ebp, %ebp
	je	.LBB16_19
# %bb.18:
	movl	$.Lstr.1, %edi
	callq	puts@PLT
.LBB16_19:
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	%r14, %rdi
	callq	free
	movapd	16(%rsp), %xmm0                 # 16-byte Reload
	ucomisd	.LCPI16_0(%rip), %xmm0
	movl	$-1, %eax
	cmovnel	%r12d, %eax
	cmovpl	%r12d, %eax
	testl	%ebp, %ebp
	je	.LBB16_22
# %bb.20:
	ucomisd	.LCPI16_0(%rip), %xmm0
	jne	.LBB16_21
	jnp	.LBB16_22
.LBB16_21:
	movl	$.L.str.32, %edi
	movl	%r12d, %esi
	movl	%ebx, %edx
	movl	%r12d, %ecx
	movb	$1, %al
	callq	printf
	movl	%r12d, %eax
.LBB16_22:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end16:
	.size	_Z14find_pivot_rowP7Tableauii, .Lfunc_end16-_Z14find_pivot_rowP7Tableauii
	.cfi_endproc
                                        # -- End function
	.globl	_Z38__device_stub__findBasisVariableKernelPdiP7Elementii # -- Begin function _Z38__device_stub__findBasisVariableKernelPdiP7Elementii
	.type	_Z38__device_stub__findBasisVariableKernelPdiP7Elementii,@function
_Z38__device_stub__findBasisVariableKernelPdiP7Elementii: # @_Z38__device_stub__findBasisVariableKernelPdiP7Elementii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	12(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z23findBasisVariableKernelPdiP7Elementii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end17:
	.size	_Z38__device_stub__findBasisVariableKernelPdiP7Elementii, .Lfunc_end17-_Z38__device_stub__findBasisVariableKernelPdiP7Elementii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z20print_optimal_vectorP7TableauPc
.LCPI18_0:
	.quad	0x8000000000000000              # double -0
	.quad	0x8000000000000000              # double -0
	.text
	.globl	_Z20print_optimal_vectorP7TableauPc
	.type	_Z20print_optimal_vectorP7TableauPc,@function
_Z20print_optimal_vectorP7TableauPc:    # @_Z20print_optimal_vectorP7TableauPc
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdi, %rbx
	movl	$.L.str.33, %edi
	xorl	%eax, %eax
	callq	printf
	movl	12(%rbx), %eax
	shll	$4, %eax
	movslq	%eax, %r15
	movq	%rsp, %rdi
	movq	%r15, %rsi
	callq	hipMalloc
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, %r14
	movl	12(%rbx), %edi
	leal	511(%rdi), %eax
	addl	$1022, %edi                     # imm = 0x3FE
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$9, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$512, %rdx                      # imm = 0x200
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB18_2
# %bb.1:
	movq	(%rbx), %rdi
	movl	24(%rbx), %esi
	movq	(%rsp), %rdx
	movl	8(%rbx), %ecx
	movl	12(%rbx), %r8d
	callq	_Z38__device_stub__findBasisVariableKernelPdiP7Elementii
.LBB18_2:
	movq	(%rsp), %rsi
	movq	%r14, %rdi
	movq	%r15, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	cmpl	$2, 12(%rbx)
	jl	.LBB18_13
# %bb.3:                                # %.lr.ph
	movq	%r14, %r12
	addq	$24, %r12
	xorl	%ebp, %ebp
	xorpd	%xmm0, %xmm0
	movl	$1, %r13d
	leaq	16(%rsp), %r15
.LBB18_4:                               # =>This Inner Loop Header: Depth=1
	movslq	(%r12), %rax
	xorpd	%xmm1, %xmm1
	cmpq	$-1, %rax
	je	.LBB18_6
# %bb.5:                                #   in Loop: Header=BB18_4 Depth=1
	movslq	24(%rbx), %rsi
	imulq	%rax, %rsi
	addq	(%rbx), %rsi
	movl	$8, %edx
	movq	%r15, %rdi
	movl	$2, %ecx
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	callq	hipMemcpy
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	16(%rsp), %xmm1                 # xmm1 = mem[0],zero
	divsd	-8(%r12), %xmm1
.LBB18_6:                               #   in Loop: Header=BB18_4 Depth=1
	testl	%ebp, %ebp
	je	.LBB18_8
# %bb.7:                                #   in Loop: Header=BB18_4 Depth=1
	xorpd	.LCPI18_0(%rip), %xmm1
.LBB18_8:                               #   in Loop: Header=BB18_4 Depth=1
	addsd	%xmm1, %xmm0
	xorl	$1, %ebp
	je	.LBB18_10
# %bb.9:                                #   in Loop: Header=BB18_4 Depth=1
	movapd	%xmm0, %xmm1
	jmp	.LBB18_12
.LBB18_10:                              #   in Loop: Header=BB18_4 Depth=1
	leal	1(%r13), %esi
	shrl	%esi
	xorpd	%xmm1, %xmm1
	cmpl	16(%rbx), %esi
	jge	.LBB18_12
# %bb.11:                               #   in Loop: Header=BB18_4 Depth=1
	movl	$.L.str.34, %edi
	movb	$1, %al
	callq	printf
	xorpd	%xmm1, %xmm1
.LBB18_12:                              # %._crit_edge48
                                        #   in Loop: Header=BB18_4 Depth=1
	incq	%r13
	movslq	12(%rbx), %rax
	addq	$16, %r12
	movapd	%xmm1, %xmm0
	cmpq	%rax, %r13
	jl	.LBB18_4
.LBB18_13:                              # %._crit_edge
	movl	$10, %edi
	callq	putchar
	movq	(%rsp), %rdi
	callq	hipFree
	movq	%r14, %rdi
	callq	free
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end18:
	.size	_Z20print_optimal_vectorP7TableauPc, .Lfunc_end18-_Z20print_optimal_vectorP7TableauPc
	.cfi_endproc
                                        # -- End function
	.globl	_Z7simplexP7Tableauii           # -- Begin function _Z7simplexP7Tableauii
	.type	_Z7simplexP7Tableauii,@function
_Z7simplexP7Tableauii:                  # @_Z7simplexP7Tableauii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %r15d
	movl	%esi, %r12d
	xorl	%eax, %eax
	testl	%esi, %esi
	cmovlel	%eax, %r12d
	movq	%rdi, %rbx
	leal	1(%r12), %eax
	movl	%eax, 4(%rsp)                   # 4-byte Spill
	negl	%r12d
	movl	$1, %r14d
.LBB19_1:                               # =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_Z17find_pivot_columnP7Tableaui
	testl	%eax, %eax
	js	.LBB19_2
# %bb.3:                                #   in Loop: Header=BB19_1 Depth=1
	movl	%eax, %r13d
	testl	%r15d, %r15d
	je	.LBB19_4
# %bb.6:                                # %.thread
                                        #   in Loop: Header=BB19_1 Depth=1
	movl	$.L.str.37, %edi
	movl	%r13d, %esi
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	printf
	movq	%rbx, %rdi
	movl	%r13d, %esi
	movl	%r15d, %edx
	callq	_Z14find_pivot_rowP7Tableauii
	testl	%eax, %eax
	js	.LBB19_7
# %bb.8:                                #   in Loop: Header=BB19_1 Depth=1
	movl	%eax, %ebp
	movl	$.L.str.39, %edi
	movl	%eax, %esi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	printf
	movq	%rbx, %rdi
	movl	%ebp, %esi
	movl	%r13d, %edx
	callq	_Z8pivot_onP7Tableauii
	movq	(%rbx), %rdi
	movl	24(%rbx), %esi
	movl	8(%rbx), %edx
	movl	12(%rbx), %ecx
	callq	_Z15updateHostTablePdiii
	movq	demoTab(%rip), %rdi
	movl	$.L.str.40, %esi
	movl	%r15d, %edx
	callq	_Z13print_tableauP3TabPKci
	movl	$.L.str.41, %esi
	movq	%rbx, %rdi
	callq	_Z20print_optimal_vectorP7TableauPc
	jmp	.LBB19_9
.LBB19_4:                               #   in Loop: Header=BB19_1 Depth=1
	movq	%rbx, %rdi
	movl	%r13d, %esi
	xorl	%edx, %edx
	callq	_Z14find_pivot_rowP7Tableauii
	testl	%eax, %eax
	js	.LBB19_7
# %bb.5:                                # %.critedge
                                        #   in Loop: Header=BB19_1 Depth=1
	movq	%rbx, %rdi
	movl	%eax, %esi
	movl	%r13d, %edx
	callq	_Z8pivot_onP7Tableauii
.LBB19_9:                               #   in Loop: Header=BB19_1 Depth=1
	leal	(%r12,%r14), %eax
	incl	%eax
	movl	%r14d, %ecx
	incl	%ecx
	movl	%ecx, %r14d
	cmpl	$2, %eax
	jne	.LBB19_1
# %bb.10:
	movl	$.L.str.42, %edi
	movl	4(%rsp), %ebp                   # 4-byte Reload
	movl	%ebp, %esi
	xorl	%eax, %eax
	callq	printf
	movl	%ebp, %r14d
	jmp	.LBB19_11
.LBB19_2:
	movq	(%rbx), %rsi
	leaq	16(%rsp), %r15
	movl	$8, %edx
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	(%rbx), %rax
	movslq	12(%rbx), %rcx
	leaq	(%rax,%rcx,8), %rsi
	addq	$-8, %rsi
	leaq	8(%rsp), %r12
	movl	$8, %edx
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movsd	(%r15), %xmm0                   # xmm0 = mem[0],zero
	divsd	(%r12), %xmm0
	movl	$.L.str.35, %edi
	movb	$1, %al
	callq	printf
	movl	$.L.str.36, %esi
	movq	%rbx, %rdi
	callq	_Z20print_optimal_vectorP7TableauPc
	jmp	.LBB19_11
.LBB19_7:
	movl	$.Lstr.2, %edi
	callq	puts@PLT
.LBB19_11:
	movl	$.L.str.43, %edi
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	printf
	movq	(%rbx), %rdi
	callq	hipFree
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end19:
	.size	_Z7simplexP7Tableauii, .Lfunc_end19-_Z7simplexP7Tableauii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI20_0:
	.quad	0x412e848000000000              # double 1.0E+6
	.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	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r14
	movl	%edi, %ebp
	movl	$32, %edi
	callq	malloc
	movq	%rax, %rbx
	movl	$-1, 20(%rax)
	cmpl	$4, %ebp
	jl	.LBB20_6
# %bb.1:
	movq	16(%r14), %rdi
	movl	$.L.str.44, %esi
	callq	strcasecmp
	movl	%eax, %ebp
	xorl	%r15d, %r15d
	testl	%eax, %eax
	jne	.LBB20_3
# %bb.2:
	movl	$200000008, %edi                # imm = 0xBEBC208
	callq	malloc
	movq	%rax, demoTab(%rip)
	movl	$1, %r15d
.LBB20_3:
	movq	24(%r14), %rdi
	callq	atoi
	movl	%eax, %r12d
	movq	8(%r14), %rsi
	movq	%rbx, %rdi
	movl	%r15d, %edx
	callq	_Z12read_tableauP7TableauPKci
	movq	demoTab(%rip), %rdi
	movl	$.L.str.46, %esi
	movl	%r15d, %edx
	callq	_Z13print_tableauP3TabPKci
	leaq	16(%rsp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	%r15d, %edx
	callq	_Z7simplexP7Tableauii
	movq	%rsp, %r15
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%r15), %rax
	movq	8(%r15), %rcx
	subq	8(%r14), %rcx
	cvtsi2sd	%rcx, %xmm1
	divsd	.LCPI20_0(%rip), %xmm1
	subq	(%r14), %rax
	cvtsi2sd	%rax, %xmm0
	addsd	%xmm1, %xmm0
	movl	$.L.str.47, %edi
	movb	$1, %al
	callq	printf
	movq	%rbx, %rdi
	callq	free
	testl	%ebp, %ebp
	jne	.LBB20_5
# %bb.4:
	movq	demoTab(%rip), %rdi
	callq	free
.LBB20_5:
	xorl	%eax, %eax
	addq	$32, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB20_6:
	.cfi_def_cfa_offset 80
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	movq	%rbx, %rdi
	callq	free
	movl	$1, %edi
	callq	exit
.Lfunc_end20:
	.size	main, .Lfunc_end20-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	.LBB21_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB21_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z19divideByPivotKernelPdiiidi, %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	$_Z29computeNewValuesForRowsKernelPdiiiii, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z36computeNewValuesForRowsInPivotColumnPdiiii, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z14findPivotIndexPdP7Elementiiiii, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17find_pivot_kernelv, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z18computeRatioKernelPdiiS_i, %esi
	movl	$.L__unnamed_6, %edx
	movl	$.L__unnamed_6, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z23findBasisVariableKernelPdiP7Elementii, %esi
	movl	$.L__unnamed_7, %edx
	movl	$.L__unnamed_7, %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_end21:
	.size	__hip_module_ctor, .Lfunc_end21-__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	.LBB22_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
.LBB22_2:
	retq
.Lfunc_end22:
	.size	__hip_module_dtor, .Lfunc_end22-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	demoTab,@object                 # @demoTab
	.bss
	.globl	demoTab
	.p2align	3, 0x0
demoTab:
	.quad	0
	.size	demoTab, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%lfx%d "
	.size	.L.str, 8

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"+ %lfx%d "
	.size	.L.str.1, 10

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"- %lfx%d "
	.size	.L.str.2, 10

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	" >= %lf"
	.size	.L.str.3, 8

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	" <= %lf"
	.size	.L.str.4, 8

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	" = %lf"
	.size	.L.str.5, 7

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	";\n"
	.size	.L.str.6, 3

	.type	_ZZ13print_tableauP3TabPKciE7counter,@object # @_ZZ13print_tableauP3TabPKciE7counter
	.local	_ZZ13print_tableauP3TabPKciE7counter
	.comm	_ZZ13print_tableauP3TabPKciE7counter,4,4
	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"\n%d. Tableau %s:\n"
	.size	.L.str.7, 18

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"%-6s%5s"
	.size	.L.str.8, 8

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"col:"
	.size	.L.str.9, 5

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"b[i]"
	.size	.L.str.10, 5

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"    x%d,"
	.size	.L.str.11, 9

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"max:"
	.size	.L.str.13, 5

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"b%d: "
	.size	.L.str.14, 6

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	" %6d"
	.size	.L.str.15, 5

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	" %6.2lf"
	.size	.L.str.16, 8

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"%lf "
	.size	.L.str.17, 5

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

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"Cannot read %s\n"
	.size	.L.str.19, 16

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"%d %d"
	.size	.L.str.20, 6

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"printEquations.txt"
	.size	.L.str.22, 19

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"w"
	.size	.L.str.23, 2

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	"%lf"
	.size	.L.str.24, 4

	.type	.L.str.25,@object               # @.str.25
.L.str.25:
	.asciz	"Cannot read A[%d][%d]\n"
	.size	.L.str.25, 23

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

	.type	.L.str.27,@object               # @.str.27
.L.str.27:
	.asciz	"Read tableau [%d rows x %d columns] from file '%s'.\n"
	.size	.L.str.27, 53

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

	.type	_Z29computeNewValuesForRowsKernelPdiiiii,@object # @_Z29computeNewValuesForRowsKernelPdiiiii
	.globl	_Z29computeNewValuesForRowsKernelPdiiiii
	.p2align	3, 0x0
_Z29computeNewValuesForRowsKernelPdiiiii:
	.quad	_Z44__device_stub__computeNewValuesForRowsKernelPdiiiii
	.size	_Z29computeNewValuesForRowsKernelPdiiiii, 8

	.type	_Z36computeNewValuesForRowsInPivotColumnPdiiii,@object # @_Z36computeNewValuesForRowsInPivotColumnPdiiii
	.globl	_Z36computeNewValuesForRowsInPivotColumnPdiiii
	.p2align	3, 0x0
_Z36computeNewValuesForRowsInPivotColumnPdiiii:
	.quad	_Z51__device_stub__computeNewValuesForRowsInPivotColumnPdiiii
	.size	_Z36computeNewValuesForRowsInPivotColumnPdiiii, 8

	.type	_Z14findPivotIndexPdP7Elementiiiii,@object # @_Z14findPivotIndexPdP7Elementiiiii
	.globl	_Z14findPivotIndexPdP7Elementiiiii
	.p2align	3, 0x0
_Z14findPivotIndexPdP7Elementiiiii:
	.quad	_Z29__device_stub__findPivotIndexPdP7Elementiiiii
	.size	_Z14findPivotIndexPdP7Elementiiiii, 8

	.type	.L.str.28,@object               # @.str.28
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.28:
	.asciz	"Most negative column in row[0] is col %d = %g.\n"
	.size	.L.str.28, 48

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

	.type	_Z18computeRatioKernelPdiiS_i,@object # @_Z18computeRatioKernelPdiiS_i
	.globl	_Z18computeRatioKernelPdiiS_i
	.p2align	3, 0x0
_Z18computeRatioKernelPdiiS_i:
	.quad	_Z33__device_stub__computeRatioKernelPdiiS_i
	.size	_Z18computeRatioKernelPdiiS_i, 8

	.type	.L.str.29,@object               # @.str.29
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.29:
	.asciz	"Ratios A[row_i,0]/A[row_i,%d] = ["
	.size	.L.str.29, 34

	.type	.L.str.30,@object               # @.str.30
.L.str.30:
	.asciz	"%3.2lf, "
	.size	.L.str.30, 9

	.type	.L.str.32,@object               # @.str.32
.L.str.32:
	.asciz	"Found pivot A[%d,%d], min positive ratio=%g in row=%d.\n"
	.size	.L.str.32, 56

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

	.type	.L.str.33,@object               # @.str.33
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.33:
	.asciz	"%s at "
	.size	.L.str.33, 7

	.type	.L.str.34,@object               # @.str.34
.L.str.34:
	.asciz	"x%d=%3.2lf, "
	.size	.L.str.34, 13

	.type	.L.str.35,@object               # @.str.35
.L.str.35:
	.asciz	"Found optimal value=A[0,0]=%3.2lf (no negatives in row 0).\n"
	.size	.L.str.35, 60

	.type	.L.str.36,@object               # @.str.36
.L.str.36:
	.asciz	"Optimal vector"
	.size	.L.str.36, 15

	.type	.L.str.37,@object               # @.str.37
.L.str.37:
	.asciz	"Entering variable x%d to be made basic, so pivot_col=%d.\n"
	.size	.L.str.37, 58

	.type	.L.str.39,@object               # @.str.39
.L.str.39:
	.asciz	"Leaving variable x%d, so pivot_row=%d\n"
	.size	.L.str.39, 39

	.type	.L.str.40,@object               # @.str.40
.L.str.40:
	.asciz	"After pivoting"
	.size	.L.str.40, 15

	.type	.L.str.41,@object               # @.str.41
.L.str.41:
	.asciz	"Basic feasible solution"
	.size	.L.str.41, 24

	.type	.L.str.42,@object               # @.str.42
.L.str.42:
	.asciz	"Too many iterations > %d.\n"
	.size	.L.str.42, 27

	.type	.L.str.43,@object               # @.str.43
.L.str.43:
	.asciz	"number of iterations: %d\n"
	.size	.L.str.43, 26

	.type	.L.str.44,@object               # @.str.44
.L.str.44:
	.asciz	"i"
	.size	.L.str.44, 2

	.type	.L.str.46,@object               # @.str.46
.L.str.46:
	.asciz	"Initial"
	.size	.L.str.46, 8

	.type	.L.str.47,@object               # @.str.47
.L.str.47:
	.asciz	"Total time = %f seconds\n"
	.size	.L.str.47, 25

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z19divideByPivotKernelPdiiidi"
	.size	.L__unnamed_1, 31

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z29computeNewValuesForRowsKernelPdiiiii"
	.size	.L__unnamed_2, 41

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z36computeNewValuesForRowsInPivotColumnPdiiii"
	.size	.L__unnamed_3, 47

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z14findPivotIndexPdP7Elementiiiii"
	.size	.L__unnamed_4, 35

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"_Z17find_pivot_kernelv"
	.size	.L__unnamed_5, 23

	.type	.L__unnamed_6,@object           # @5
.L__unnamed_6:
	.asciz	"_Z18computeRatioKernelPdiiS_i"
	.size	.L__unnamed_6, 30

	.type	.L__unnamed_7,@object           # @6
.L__unnamed_7:
	.asciz	"_Z23findBasisVariableKernelPdiP7Elementii"
	.size	.L__unnamed_7, 42

	.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	"Cannot read m or n"
	.size	.Lstr, 19

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"]."
	.size	.Lstr.1, 3

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"unbounded (no pivot_row)."
	.size	.Lstr.2, 26

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"usage: cmd <datafile> <i/n> <max)iteration_number> "
	.size	.Lstr.3, 52

	.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 _Z34__device_stub__divideByPivotKernelPdiiidi
	.addrsig_sym _Z44__device_stub__computeNewValuesForRowsKernelPdiiiii
	.addrsig_sym _Z51__device_stub__computeNewValuesForRowsInPivotColumnPdiiii
	.addrsig_sym _Z29__device_stub__findPivotIndexPdP7Elementiiiii
	.addrsig_sym _Z32__device_stub__find_pivot_kernelv
	.addrsig_sym _Z33__device_stub__computeRatioKernelPdiiS_i
	.addrsig_sym _Z38__device_stub__findBasisVariableKernelPdiP7Elementii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z19divideByPivotKernelPdiiidi
	.addrsig_sym _Z29computeNewValuesForRowsKernelPdiiiii
	.addrsig_sym _Z36computeNewValuesForRowsInPivotColumnPdiiii
	.addrsig_sym _Z14findPivotIndexPdP7Elementiiiii
	.addrsig_sym _Z17find_pivot_kernelv
	.addrsig_sym _Z18computeRatioKernelPdiiS_i
	.addrsig_sym _Z23findBasisVariableKernelPdiP7Elementii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z19divideByPivotKernelPdiiidi ; -- Begin function _Z19divideByPivotKernelPdiiidi
	.globl	_Z19divideByPivotKernelPdiiidi
	.p2align	8
	.type	_Z19divideByPivotKernelPdiiidi,@function
_Z19divideByPivotKernelPdiiidi:         ; @_Z19divideByPivotKernelPdiiidi
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x34
	s_load_b32 s3, s[0:1], 0x20
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_load_b64 s[0:1], s[0:1], 0x18
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_lshlrev_b64 v[0:1], 3, v[1:2]
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s2, s7, s6
	s_ashr_i32 s3, s2, 31
	s_add_u32 s2, s4, s2
	s_addc_u32 s3, s5, s3
	v_add_co_u32 v0, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	global_load_b64 v[2:3], v[0:1], off
	s_waitcnt vmcnt(0)
	v_div_scale_f64 v[4:5], null, s[0:1], s[0:1], v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[6:7], v[4:5]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.0
	v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.0
	v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]
	v_div_scale_f64 v[8:9], vcc_lo, v[2:3], s[0:1], v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[10:11], v[8:9], v[6:7]
	v_fma_f64 v[4:5], -v[4:5], v[10:11], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[10:11]
	v_div_fixup_f64 v[2:3], v[4:5], s[0:1], v[2:3]
	global_store_b64 v[0:1], v[2:3], off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z19divideByPivotKernelPdiiidi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.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 12
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z19divideByPivotKernelPdiiidi, .Lfunc_end0-_Z19divideByPivotKernelPdiiidi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 260
; NumSgprs: 18
; NumVgprs: 12
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 12
; 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	_Z29computeNewValuesForRowsKernelPdiiiii ; -- Begin function _Z29computeNewValuesForRowsKernelPdiiiii
	.globl	_Z29computeNewValuesForRowsKernelPdiiiii
	.p2align	8
	.type	_Z29computeNewValuesForRowsKernelPdiiiii,@function
_Z29computeNewValuesForRowsKernelPdiiiii: ; @_Z29computeNewValuesForRowsKernelPdiiiii
; %bb.0:
	s_clause 0x2
	s_load_b128 s[4:7], s[0:1], 0x8
	s_load_b32 s3, s[0:1], 0x18
	s_load_b32 s2, s[0:1], 0x2c
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s8, s7, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	s_add_i32 s9, s7, s8
	s_and_b32 s2, s2, 0xffff
	s_xor_b32 s9, s9, s8
	v_cvt_f32_u32_e32 v1, s9
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	v_cvt_u32_f32_e32 v1, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[2:3], null, s15, s2, v[0:1]
	s_sub_i32 s2, 0, s9
	v_mul_lo_u32 v0, s2, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_ashrrev_i32_e32 v3, 31, v2
	v_cmp_gt_i32_e64 s3, s3, v2
	v_mul_hi_u32 v0, v1, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v4, v2, v3
	v_xor_b32_e32 v4, v4, v3
	v_xor_b32_e32 v3, s8, v3
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v0, v1, v0
	v_mul_hi_u32 v0, v4, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v1, v0, s9
	v_sub_nc_u32_e32 v1, v4, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v5, s9, v1
	v_cmp_le_u32_e32 vcc_lo, s9, v1
	v_dual_cndmask_b32 v1, v1, v5 :: v_dual_add_nc_u32 v4, 1, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v0, v0, v4, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s9, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v4, 1, v0
	v_cndmask_b32_e32 v0, v0, v4, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v0, v0, v3
	v_sub_nc_u32_e32 v1, v0, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v0, v1, s7
	v_cmp_ne_u32_e32 vcc_lo, s5, v1
	v_sub_nc_u32_e32 v0, v2, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_ne_u32_e64 s2, s6, v0
	s_and_b32 s2, vcc_lo, s2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, s2, s3
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_mul_lo_u32 v2, v1, s4
	v_ashrrev_i32_e32 v1, 31, v0
	s_mul_i32 s2, s5, s4
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_ashr_i32 s3, s2, 31
	v_lshlrev_b64 v[0:1], 3, v[0:1]
	s_delay_alu instid0(VALU_DEP_3)
	v_ashrrev_i32_e32 v3, 31, v2
	s_waitcnt lgkmcnt(0)
	s_add_u32 s2, s0, s2
	v_add_co_u32 v6, vcc_lo, s0, v2
	s_addc_u32 s3, s1, s3
	s_ashr_i32 s7, s6, 31
	v_add_co_ci_u32_e32 v7, vcc_lo, s1, v3, vcc_lo
	s_lshl_b64 s[0:1], s[6:7], 3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, v6, s0
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v7, vcc_lo
	v_add_co_u32 v4, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, s3, v1, vcc_lo
	s_clause 0x1
	global_load_b64 v[2:3], v[2:3], off
	global_load_b64 v[4:5], v[4:5], off
	v_add_co_u32 v0, vcc_lo, v6, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, v7, v1, vcc_lo
	s_add_u32 s0, s2, s0
	s_addc_u32 s1, s3, s1
	global_load_b64 v[6:7], v[0:1], off
	s_load_b64 s[0:1], s[0:1], 0x0
	s_waitcnt vmcnt(1)
	v_mul_f64 v[2:3], v[2:3], v[4:5]
	s_waitcnt vmcnt(0) lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_fma_f64 v[2:3], v[6:7], s[0:1], -v[2:3]
	global_store_b64 v[0:1], v[2:3], off
.LBB1_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z29computeNewValuesForRowsKernelPdiiiii
		.amdhsa_group_segment_fixed_size 0
		.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 8
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z29computeNewValuesForRowsKernelPdiiiii, .Lfunc_end1-_Z29computeNewValuesForRowsKernelPdiiiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 500
; NumSgprs: 18
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 8
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z36computeNewValuesForRowsInPivotColumnPdiiii ; -- Begin function _Z36computeNewValuesForRowsInPivotColumnPdiiii
	.globl	_Z36computeNewValuesForRowsInPivotColumnPdiiii
	.p2align	8
	.type	_Z36computeNewValuesForRowsInPivotColumnPdiiii,@function
_Z36computeNewValuesForRowsInPivotColumnPdiiii: ; @_Z36computeNewValuesForRowsInPivotColumnPdiiii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b128 s[4:7], s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	v_cmp_gt_i32_e32 vcc_lo, s7, v1
	v_cmp_ne_u32_e64 s2, s6, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB2_2
; %bb.1:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_mul_lo_u32 v1, v1, s4
	s_ashr_i32 s3, s5, 31
	s_mov_b32 s2, s5
	v_mov_b32_e32 v0, 0
	s_lshl_b64 s[2:3], s[2:3], 3
	s_delay_alu instid0(VALU_DEP_2)
	v_ashrrev_i32_e32 v3, 31, v1
	s_waitcnt lgkmcnt(0)
	s_add_u32 s0, s2, s0
	s_addc_u32 s1, s3, s1
	v_add_co_u32 v2, vcc_lo, s0, v1
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v3, vcc_lo
	v_mov_b32_e32 v1, v0
	global_store_b64 v[2:3], v[0:1], off
.LBB2_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z36computeNewValuesForRowsInPivotColumnPdiiii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 4
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z36computeNewValuesForRowsInPivotColumnPdiiii, .Lfunc_end2-_Z36computeNewValuesForRowsInPivotColumnPdiiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 160
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; 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	_Z14findPivotIndexPdP7Elementiiiii ; -- Begin function _Z14findPivotIndexPdP7Elementiiiii
	.globl	_Z14findPivotIndexPdP7Elementiiiii
	.p2align	8
	.type	_Z14findPivotIndexPdP7Elementiiiii,@function
_Z14findPivotIndexPdP7Elementiiiii:     ; @_Z14findPivotIndexPdP7Elementiiiii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x34
	s_load_b128 s[8:11], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[2:3], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s9, v2
	s_cbranch_execz .LBB3_15
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_mul_lo_u32 v4, v2, s10
	s_load_b32 s1, s[0:1], 0x20
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v5, 31, v4
	v_add_nc_u32_e32 v3, s10, v4
	v_lshlrev_b64 v[5:6], 3, v[4:5]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_min_i32_e32 v3, s8, v3
	s_mov_b32 s8, exec_lo
	v_add_nc_u32_e32 v3, -1, v3
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_u32 v0, vcc_lo, s4, v5
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v6, vcc_lo
	global_load_b64 v[0:1], v[0:1], off
	v_cmpx_lt_i32_e64 v4, v3
	s_cbranch_execz .LBB3_14
; %bb.2:                                ; %.lr.ph
	v_add_co_u32 v5, vcc_lo, v5, s4
	v_add_co_ci_u32_e32 v6, vcc_lo, s5, v6, vcc_lo
	v_mov_b32_e32 v11, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v5, vcc_lo, v5, 8
	v_add_co_ci_u32_e32 v6, vcc_lo, 0, v6, vcc_lo
	s_cmp_lg_u32 s11, 0
	s_mov_b32 s2, 0x88e368f1
	s_mov_b32 s3, 0x3ee4f8b5
	s_mov_b32 s4, 0
	s_cselect_b32 s5, -1, 0
.LBB3_3:                                ; =>This Inner Loop Header: Depth=1
	global_load_b64 v[7:8], v[5:6], off
	v_add_nc_u32_e32 v4, 1, v4
	s_and_b32 vcc_lo, exec_lo, s5
	s_cbranch_vccz .LBB3_7
; %bb.4:                                ;   in Loop: Header=BB3_3 Depth=1
	s_waitcnt vmcnt(1)
	v_mov_b32_e32 v10, v1
	v_dual_mov_b32 v12, v11 :: v_dual_mov_b32 v9, v0
	s_mov_b32 s0, exec_lo
	s_waitcnt vmcnt(0)
	v_cmpx_lt_f64_e32 v[7:8], v[0:1]
; %bb.5:                                ;   in Loop: Header=BB3_3 Depth=1
	v_add_f64 v[9:10], v[7:8], -v[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_nlt_f64_e64 vcc_lo, |v[9:10]|, s[2:3]
	v_dual_cndmask_b32 v10, v1, v8 :: v_dual_cndmask_b32 v9, v0, v7
	v_cndmask_b32_e32 v12, v11, v4, vcc_lo
; %bb.6:                                ; %Flow
                                        ;   in Loop: Header=BB3_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
	s_mov_b32 s0, 0
	s_branch .LBB3_8
.LBB3_7:                                ;   in Loop: Header=BB3_3 Depth=1
	s_mov_b32 s0, -1
                                        ; implicit-def: $vgpr12
                                        ; implicit-def: $vgpr9_vgpr10
.LBB3_8:                                ; %Flow88
                                        ;   in Loop: Header=BB3_3 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 vcc_lo, exec_lo, s0
	s_cbranch_vccnz .LBB3_12
; %bb.9:                                ;   in Loop: Header=BB3_3 Depth=1
	s_mov_b32 s0, exec_lo
	s_waitcnt vmcnt(0)
	v_cmpx_gt_f64_e32 v[7:8], v[0:1]
; %bb.10:                               ;   in Loop: Header=BB3_3 Depth=1
	v_add_f64 v[9:10], v[7:8], -v[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_nlt_f64_e64 vcc_lo, |v[9:10]|, s[2:3]
	v_dual_cndmask_b32 v1, v1, v8 :: v_dual_cndmask_b32 v0, v0, v7
	v_cndmask_b32_e32 v11, v11, v4, vcc_lo
; %bb.11:                               ; %Flow87
                                        ;   in Loop: Header=BB3_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_dual_mov_b32 v10, v1 :: v_dual_mov_b32 v9, v0
	v_mov_b32_e32 v12, v11
.LBB3_12:                               ;   in Loop: Header=BB3_3 Depth=1
	v_cmp_ge_i32_e32 vcc_lo, v4, v3
	v_add_co_u32 v5, s0, v5, 8
	s_waitcnt vmcnt(1)
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(SALU_CYCLE_1)
	v_dual_mov_b32 v11, v12 :: v_dual_mov_b32 v0, v9
	v_add_co_ci_u32_e64 v6, s0, 0, v6, s0
	v_mov_b32_e32 v1, v10
	s_or_b32 s4, vcc_lo, s4
	s_and_not1_b32 exec_lo, exec_lo, s4
	s_cbranch_execnz .LBB3_3
; %bb.13:                               ; %Flow89
	s_or_b32 exec_lo, exec_lo, s4
	v_mov_b32_e32 v0, v9
	v_dual_mov_b32 v4, v12 :: v_dual_mov_b32 v1, v10
.LBB3_14:                               ; %Flow90
	s_or_b32 exec_lo, exec_lo, s8
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 4, v[2:3]
	v_add_co_u32 v5, vcc_lo, s6, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v6, vcc_lo, s7, v3, vcc_lo
	v_add_nc_u32_e32 v2, s1, v4
	s_waitcnt vmcnt(0)
	global_store_b96 v[5:6], v[0:2], off
.LBB3_15:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14findPivotIndexPdP7Elementiiiii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.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 13
		.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_end3:
	.size	_Z14findPivotIndexPdP7Elementiiiii, .Lfunc_end3-_Z14findPivotIndexPdP7Elementiiiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 524
; NumSgprs: 18
; NumVgprs: 13
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 13
; 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	_Z17find_pivot_kernelv  ; -- Begin function _Z17find_pivot_kernelv
	.globl	_Z17find_pivot_kernelv
	.p2align	8
	.type	_Z17find_pivot_kernelv,@function
_Z17find_pivot_kernelv:                 ; @_Z17find_pivot_kernelv
; %bb.0:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17find_pivot_kernelv
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 0
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 0
		.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 1
		.amdhsa_next_free_sgpr 1
		.amdhsa_reserve_vcc 0
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end4:
	.size	_Z17find_pivot_kernelv, .Lfunc_end4-_Z17find_pivot_kernelv
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 4
; NumSgprs: 0
; NumVgprs: 0
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 1
; NumVGPRsForWavesPerEU: 1
; 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	_Z18computeRatioKernelPdiiS_i ; -- Begin function _Z18computeRatioKernelPdiiS_i
	.globl	_Z18computeRatioKernelPdiiS_i
	.p2align	8
	.type	_Z18computeRatioKernelPdiiS_i,@function
_Z18computeRatioKernelPdiiS_i:          ; @_Z18computeRatioKernelPdiiS_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x18
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	v_cmp_ne_u32_e32 vcc_lo, 0, v1
	v_cmp_gt_i32_e64 s2, s3, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB5_3
; %bb.1:
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	v_ashrrev_i32_e32 v2, 31, v1
	v_dual_mov_b32 v6, 0 :: v_dual_mov_b32 v7, 0xbff00000
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[2:3], 3, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_mul_lo_u32 v4, v1, s6
	v_add_co_u32 v0, vcc_lo, s0, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v3, vcc_lo
	s_ashr_i32 s1, s7, 31
	s_mov_b32 s0, s7
	s_lshl_b64 s[0:1], s[0:1], 3
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v2, 31, v4
	v_add_co_u32 v4, vcc_lo, s4, v4
	global_store_b64 v[0:1], v[6:7], off
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v2, vcc_lo
	v_add_co_u32 v2, vcc_lo, v4, s0
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v5, vcc_lo
	s_mov_b32 s0, 0x88e368f1
	s_mov_b32 s1, 0x3ee4f8b5
	global_load_b64 v[2:3], v[2:3], off
	s_waitcnt vmcnt(0)
	v_cmp_lt_f64_e32 vcc_lo, 0, v[2:3]
	v_cmp_nlt_f64_e64 s0, |v[2:3]|, s[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s0, vcc_lo, s0
	s_and_b32 exec_lo, exec_lo, s0
	s_cbranch_execz .LBB5_3
; %bb.2:
	global_load_b64 v[4:5], v[4:5], off
	s_waitcnt vmcnt(0)
	v_div_scale_f64 v[6:7], null, v[2:3], v[2:3], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[8:9], v[6:7]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]
	v_div_scale_f64 v[10:11], vcc_lo, v[4:5], v[2:3], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[12:13], v[10:11], v[8:9]
	v_fma_f64 v[6:7], -v[6:7], v[12:13], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[6:7], v[6:7], v[8:9], v[12:13]
	v_div_fixup_f64 v[2:3], v[6:7], v[2:3], v[4:5]
	global_store_b64 v[0:1], v[2:3], off
.LBB5_3:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z18computeRatioKernelPdiiS_i
		.amdhsa_group_segment_fixed_size 0
		.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 14
		.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_end5:
	.size	_Z18computeRatioKernelPdiiS_i, .Lfunc_end5-_Z18computeRatioKernelPdiiS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 392
; NumSgprs: 18
; NumVgprs: 14
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 14
; 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	_Z23findBasisVariableKernelPdiP7Elementii ; -- Begin function _Z23findBasisVariableKernelPdiP7Elementii
	.globl	_Z23findBasisVariableKernelPdiP7Elementii
	.p2align	8
	.type	_Z23findBasisVariableKernelPdiP7Elementii,@function
_Z23findBasisVariableKernelPdiP7Elementii: ; @_Z23findBasisVariableKernelPdiP7Elementii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b64 s[4:5], s[0:1], 0x18
	s_mov_b32 s3, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[3:4], null, s15, s2, v[0:1]
	v_cmp_gt_i32_e32 vcc_lo, s5, v3
	v_cmp_ne_u32_e64 s2, 0, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s5, s2
	s_cbranch_execz .LBB6_16
; %bb.1:                                ; %.preheader
	v_ashrrev_i32_e32 v4, 31, v3
	s_cmp_lt_i32 s4, 1
	s_cbranch_scc1 .LBB6_11
; %bb.2:                                ; %.lr.ph
	s_clause 0x1
	s_load_b32 s5, s[0:1], 0x8
	s_load_b64 s[8:9], s[0:1], 0x0
	v_lshlrev_b64 v[0:1], 3, v[3:4]
	v_mov_b32_e32 v10, 0
	v_mov_b32_e32 v2, -1
	s_mov_b32 s2, 0x88e368f1
	s_mov_b32 s3, 0x3ee4f8b5
	s_add_i32 s7, s4, -1
	s_mov_b32 s4, 0
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s6, s5, 31
	v_add_co_u32 v5, vcc_lo, s8, v0
	v_add_co_ci_u32_e32 v6, vcc_lo, s9, v1, vcc_lo
	s_mov_b32 s8, 0
.LBB6_3:                                ; =>This Inner Loop Header: Depth=1
	global_load_b64 v[7:8], v[5:6], off
                                        ; implicit-def: $vgpr9
	s_waitcnt vmcnt(0)
	v_cmp_nlt_f64_e32 vcc_lo, 0, v[7:8]
	v_cmp_lt_f64_e64 s9, |v[7:8]|, s[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s10, vcc_lo, s9
                                        ; implicit-def: $sgpr9
	s_and_saveexec_b32 s11, s10
	s_delay_alu instid0(SALU_CYCLE_1)
	s_xor_b32 s10, exec_lo, s11
; %bb.4:                                ;   in Loop: Header=BB6_3 Depth=1
	v_cmp_lt_f64_e64 vcc_lo, |v[7:8]|, s[2:3]
                                        ; implicit-def: $vgpr7_vgpr8
	v_cndmask_b32_e32 v9, 1, v10, vcc_lo
	s_delay_alu instid0(VALU_DEP_2)
	s_and_b32 s9, vcc_lo, exec_lo
                                        ; implicit-def: $vgpr10
; %bb.5:                                ; %Flow70
                                        ;   in Loop: Header=BB6_3 Depth=1
	s_and_not1_saveexec_b32 s10, s10
	s_cbranch_execz .LBB6_9
; %bb.6:                                ;   in Loop: Header=BB6_3 Depth=1
	v_mov_b32_e32 v9, 1
	s_mov_b32 s11, 0
	s_mov_b32 s12, exec_lo
	v_cmpx_eq_u32_e32 -1, v2
; %bb.7:                                ;   in Loop: Header=BB6_3 Depth=1
	v_dual_mov_b32 v2, s8 :: v_dual_mov_b32 v9, v10
	v_dual_mov_b32 v0, v7 :: v_dual_mov_b32 v1, v8
	s_mov_b32 s11, exec_lo
; %bb.8:                                ; %Flow69
                                        ;   in Loop: Header=BB6_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s12
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_and_not1_b32 s9, s9, exec_lo
	s_and_b32 s11, s11, exec_lo
	s_or_b32 s9, s9, s11
.LBB6_9:                                ;   in Loop: Header=BB6_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s10
	s_add_i32 s10, s8, 1
	s_cmp_eq_u32 s7, s8
	v_add_co_u32 v5, vcc_lo, v5, s5
	s_cselect_b32 s8, -1, 0
	s_xor_b32 s9, s9, -1
	v_add_co_ci_u32_e32 v6, vcc_lo, s6, v6, vcc_lo
	s_or_b32 s8, s9, s8
	v_mov_b32_e32 v10, v9
	s_and_b32 s8, exec_lo, s8
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s4, s8, s4
	s_mov_b32 s8, s10
	s_and_not1_b32 exec_lo, exec_lo, s4
	s_cbranch_execnz .LBB6_3
; %bb.10:                               ; %._crit_edge.loopexit
	s_or_b32 exec_lo, exec_lo, s4
	v_cmp_eq_u32_e64 s3, 1, v9
	s_branch .LBB6_12
.LBB6_11:
	v_mov_b32_e32 v2, -1
.LBB6_12:                               ; %._crit_edge
	s_load_b64 s[0:1], s[0:1], 0x10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_xor_b32 s2, s3, -1
	s_and_saveexec_b32 s3, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_xor_b32 s2, exec_lo, s3
	s_cbranch_execz .LBB6_14
; %bb.13:
	v_lshlrev_b64 v[3:4], 4, v[3:4]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, s0, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v4, vcc_lo
	global_store_b96 v[3:4], v[0:2], off
                                        ; implicit-def: $vgpr3_vgpr4
.LBB6_14:                               ; %Flow
	s_and_not1_saveexec_b32 s2, s2
	s_cbranch_execz .LBB6_16
; %bb.15:
	v_lshlrev_b64 v[0:1], 4, v[3:4]
	v_mov_b32_e32 v2, -1
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v2, off offset:8
.LBB6_16:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z23findBasisVariableKernelPdiP7Elementii
		.amdhsa_group_segment_fixed_size 0
		.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 11
		.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_end6:
	.size	_Z23findBasisVariableKernelPdiP7Elementii, .Lfunc_end6-_Z23findBasisVariableKernelPdiP7Elementii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 512
; NumSgprs: 18
; NumVgprs: 11
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 11
; 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
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           8
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z19divideByPivotKernelPdiiidi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z19divideByPivotKernelPdiiidi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     12
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .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: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z29computeNewValuesForRowsKernelPdiiiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z29computeNewValuesForRowsKernelPdiiiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z36computeNewValuesForRowsInPivotColumnPdiiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z36computeNewValuesForRowsInPivotColumnPdiiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z14findPivotIndexPdP7Elementiiiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z14findPivotIndexPdP7Elementiiiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     13
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:           []
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 4
    .kernarg_segment_size: 0
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17find_pivot_kernelv
    .private_segment_fixed_size: 0
    .sgpr_count:     0
    .sgpr_spill_count: 0
    .symbol:         _Z17find_pivot_kernelv.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     0
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .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: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z18computeRatioKernelPdiiS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z18computeRatioKernelPdiiS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     14
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z23findBasisVariableKernelPdiP7Elementii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z23findBasisVariableKernelPdiP7Elementii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     11
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
