#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>     
#include <sys/types.h>  
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>    
#include <errno.h>
#include <assert.h>

#define numThreads 1024

#define MAX_CHAR_PER_LINE 128

#define NONE 0
#define FIRST 1
#define LAST 2
#define BOTH 3 

double* file_read(char *filename,int  *numCoords,int  *numObjs) 
{
  double *objects;
  int     i, j, len;
    //ssize_t numBytesRead;
  int done=0; 
  FILE *infile;
  char *line, *ret;
  int   lineLen;

	//don't skip lines or attributes for this project
  int lines_to_skip=0; 
  int attr_to_skip=0;

  if ((infile = fopen(filename, "r")) == NULL) {
    fprintf(stderr, "Error: no such file (%s)\n", filename);
    return NULL;
  }

    /* first find the number of objects */
  lineLen = MAX_CHAR_PER_LINE;
  line = (char*) malloc(lineLen);
  assert(line != NULL);

  (*numCoords) = 0;

  while (fgets(line, lineLen, infile) != NULL) {
            /* check each line to find the max line length */
    while (strlen(line) == lineLen-1) {
                /* this line read is not complete */
      len = strlen(line);
      fseek(infile, -len, SEEK_CUR);

                /* increase lineLen */
      lineLen += MAX_CHAR_PER_LINE;
      line = (char*) realloc(line, lineLen);
      assert(line != NULL);

      ret = fgets(line, lineLen, infile);
      assert(ret != NULL);
    }

    if (strtok(line, " \t\n") != 0)
      (*numCoords)++;
  }

  (*numCoords)-=lines_to_skip;

  if((*numCoords)<=0)
  {
    fprintf(stderr, "Error: No objects found\n");
    return NULL;
  }

  rewind(infile);

	/*find the number of attributes*/  
  (*numObjs)=0;

  fgets(line, lineLen, infile);

  char * pch;
  pch=strtok(line, ",;");

  while (pch != NULL )
  {

    pch = strtok (NULL, ",;");
    (*numObjs)++;
  }

  if(attr_to_skip!=NONE)
  {
    (*numObjs)--;
    if(attr_to_skip==BOTH)
      (*numObjs)--;
  }

  rewind(infile);


    /* allocate space for objects and read all objects */
  len = (*numCoords) * (*numObjs);
  objects    = (double*)malloc( len * sizeof(double));
  assert(objects != NULL);



    /* read all objects */

  for(i=0;i<lines_to_skip;i++)
   fgets(line, lineLen, infile);

 i=0;
 j=0;

 while (fgets(line, lineLen, infile) != NULL) 
 {
   pch=strtok(line, ",;");
   while (pch != NULL && j<(*numObjs))
   {
    if(attr_to_skip%2==1 && j==0 && done==0)
    {
      done=1;
      pch = strtok (NULL, ",;");
      continue;                      
    }
    objects[i*(*numObjs)+j]=atof(pch);
    pch = strtok (NULL, ",;");
    j++;
  }
  i++;
  j=0;
  done=0;
}

assert(i == *numCoords);

fclose(infile);
free(line);


return objects;
}

__global__ void medval(double *M_d,double *w_d,int rows, int cols)
{
	int row = blockIdx.x*blockDim.x + threadIdx.x;
	double sum = 0.0;
	if (row < rows){
		for (int i=0;i<cols;i++){
			sum += M_d[row*cols + i];
		}
		w_d[row] = sum/cols;
	}	 
} 

__global__ void MatrixVecMul(double* M_d, double* x_d, double* z_d, double* w_d, int rows, int cols){
	int row = blockIdx.x*blockDim.x + threadIdx.x;
	double sum = 0.0;
	if (row < rows){	
		for (int i=0;i<cols;i++){
			sum += (M_d[row*cols + i] - w_d[row])*x_d[i];
		}
		z_d[row] = sum;
	}
} 



__global__ void TMatrixVecMul(double *M_d, double* x_d, double* z_d, double* k_d, double* w_d, int rows, int cols, float* norm_d){
	int row = blockIdx.x*blockDim.x + threadIdx.x;
	double sum = 0.0;
	if (row < cols){	
		for (int i=0;i<rows;i++){
			sum += (M_d[i*cols + row] - w_d[i])*z_d[i];
		}
		k_d[row] = sum;
		atomicAdd(norm_d,k_d[row]*k_d[row]);
	}

}

__global__ void DivideNorm(double* k_d, float* norm, int cols){
	int index = blockIdx.x*blockDim.x + threadIdx.x;
	if (index < cols) k_d[index] = k_d[index]/sqrt(*norm);
}

__global__ void CalculateEps(double* k_d, double* x_d, double* e_d, float* eps, int cols){
	int index = blockIdx.x*blockDim.x + threadIdx.x;
	if (index < cols){
   e_d[index] = k_d[index] - x_d[index];
   atomicAdd(eps,e_d[index]*e_d[index]);
 }
}


int main(int argc, char **argv){
	cudaSetDevice(0);
	int rows,cols;
  double* M_h = file_read(argv[1],&rows,&cols);
  int size = rows*cols*sizeof(double);
  double* x_h = (double*)malloc(cols*sizeof(double));
  double* z_h = (double*)malloc(rows*sizeof(double));
  double* k_h = (double*)malloc(cols*sizeof(double));
  float* e = (float*)malloc(sizeof(float));
  float* norm_h = (float*)malloc(sizeof(float));

  float* norm_d;
  float* eps;
  double* e_d;
  double* M_d;
  double* x_d;
  double* k_d;
  double* z_d;
  double* w_d;



  for (int i=0;i<cols;i++) x_h[i] = 1;


  cudaMalloc((void**) &M_d, size);
  cudaMalloc((void**) &x_d, cols*sizeof(double));
  cudaMalloc((void**) &z_d, rows*sizeof(double));
  cudaMalloc((void**) &k_d, cols*sizeof(double));
  cudaMalloc((void**) &e_d, cols*sizeof(double));
  cudaMalloc((void**) &w_d, rows*sizeof(double));
  cudaMalloc((void**) &norm_d, sizeof(float));
  cudaMalloc((void**) &eps, sizeof(float));

  cudaMemcpy(M_d, M_h, size, cudaMemcpyHostToDevice);
  cudaMemcpy(x_d, x_h, cols*sizeof(double), cudaMemcpyHostToDevice);

  cudaEvent_t start, stop;
  cudaEventCreate(&start);
  cudaEventCreate(&stop);
  float elapsedTime;
  cudaEventRecord(start);
  medval<<<(rows - 1)/numThreads + 1,numThreads>>>(M_d,w_d,rows,cols);
  cudaEventRecord(stop);
  cudaEventSynchronize(stop);
  cudaEventElapsedTime(&elapsedTime, start, stop);
  for (int i=0;i<100;i++){
    *norm_h = 0;
    *e = 0;
    cudaMemcpy(norm_d, norm_h, sizeof(float), cudaMemcpyHostToDevice);
    cudaMemcpy(eps, e, sizeof(float), cudaMemcpyHostToDevice);
    if (i !=0){
     for (int k=0;k<cols;k++) x_h[k] = k_h[k];
       cudaMemcpy(x_d, x_h, cols*sizeof(double), cudaMemcpyHostToDevice);
   }
   cudaEventRecord(start);
   MatrixVecMul<<<(rows - 1)/numThreads + 1,numThreads>>>(M_d,x_d,z_d,w_d,rows,cols);

   TMatrixVecMul<<<(cols - 1)/numThreads + 1,numThreads>>>(M_d,x_d,z_d,k_d, w_d, rows,cols,norm_d);

   DivideNorm<<<(cols - 1)/numThreads + 1,numThreads>>>(k_d, norm_d, cols);

   CalculateEps<<<(cols - 1)/numThreads + 1,numThreads>>>(k_d, x_d, e_d, eps, cols);
   cudaEventRecord(stop);
   cudaEventSynchronize(stop);
   float milliseconds = 0;
   cudaEventElapsedTime(&milliseconds, start, stop);
   elapsedTime += milliseconds;

   cudaMemcpy(k_h,k_d,cols*sizeof(double),cudaMemcpyDeviceToHost);
   cudaMemcpy(e, eps, sizeof(float), cudaMemcpyDeviceToHost);

   if (sqrt(*e) < 0.000001) break;
 }
 printf("Elapsed Time: %f ms\n", elapsedTime);
 FILE *f = fopen("results_simple.csv", "w");

 for (int i=0;i<cols;i++) fprintf(f,"%.7f%s", k_h[i],(i<cols-1)?",":"");
  fprintf(f,"\n");
fclose(f);

cudaFree(M_d);
cudaFree(x_d);
cudaFree(z_d);
cudaFree(k_d);
cudaFree(w_d);
cudaFree(norm_d);
cudaFree(e_d);
cudaFree(eps);

free(M_h);
free(x_h);
free(z_h);
free(k_h);
free(norm_h);
free(e);
return 0;
}


	.file	"tmpxft_00216076_00000000-6_simple.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2048:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2048:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"r"
.LC1:
	.string	"Error: no such file (%s)\n"
.LC2:
	.string	" \t\n"
.LC3:
	.string	"Error: No objects found\n"
.LC4:
	.string	",;"
	.text
	.globl	_Z9file_readPcPiS0_
	.type	_Z9file_readPcPiS0_, @function
_Z9file_readPcPiS0_:
.LFB2044:
	.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
	movq	%rsi, %r13
	leaq	.LC0(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	call	fopen@PLT
	testq	%rax, %rax
	jne	.L3
	movq	stderr(%rip), %rdi
	movq	%rbp, %rcx
	movl	$2, %esi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdx
	call	__fprintf_chk@PLT
	jmp	.L4
.L3:
	movl	$128, %edi
	movq	%rax, %rbx
	movl	$128, %r14d
	movl	$128, %ebp
	call	malloc@PLT
	xorl	%edx, %edx
	movq	%rax, 8(%rsp)
	movl	%edx, 0(%r13)
.L5:
	movq	8(%rsp), %rdi
	movq	%rbx, %rcx
	movl	%ebp, %edx
	movq	%r14, %rsi
	call	__fgets_chk@PLT
	testq	%rax, %rax
	je	.L8
	movslq	%ebp, %r15
.L9:
	movq	8(%rsp), %rdi
	call	strlen@PLT
	leaq	128(%r15), %rcx
	leaq	-1(%r15), %rdx
	movq	%rcx, 16(%rsp)
	cmpq	%rdx, %rax
	jne	.L25
	negl	%eax
	movl	$1, %edx
	movq	%rbx, %rdi
	subl	$-128, %ebp
	movslq	%eax, %rsi
	call	fseek@PLT
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	realloc@PLT
	movq	16(%rsp), %rsi
	movq	%rbx, %rcx
	movl	%ebp, %edx
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	__fgets_chk@PLT
	movq	16(%rsp), %r15
	movq	%r15, %r14
	jmp	.L9
.L25:
	movq	8(%rsp), %rdi
	leaq	.LC2(%rip), %rsi
	call	strtok@PLT
	testq	%rax, %rax
	je	.L5
	incl	0(%r13)
	jmp	.L5
.L8:
	cmpl	$0, 0(%r13)
	jg	.L10
	movq	stderr(%rip), %rdi
	leaq	.LC3(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L4:
	xorl	%r13d, %r13d
	jmp	.L2
.L10:
	movq	%rbx, %rdi
	call	rewind@PLT
	xorl	%eax, %eax
	movq	8(%rsp), %rdi
	movq	%r14, %rsi
	movl	%eax, (%r12)
	movq	%rbx, %rcx
	movl	%ebp, %edx
	call	__fgets_chk@PLT
	movq	8(%rsp), %rdi
	leaq	.LC4(%rip), %rsi
	call	strtok@PLT
.L12:
	testq	%rax, %rax
	je	.L26
	leaq	.LC4(%rip), %rsi
	xorl	%edi, %edi
	call	strtok@PLT
	incl	(%r12)
	jmp	.L12
.L26:
	movq	%rbx, %rdi
	xorl	%r15d, %r15d
	call	rewind@PLT
	movl	0(%r13), %edi
	imull	(%r12), %edi
	movslq	%edi, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %r13
.L14:
	movq	8(%rsp), %rdi
	movq	%rbx, %rcx
	movl	%ebp, %edx
	movq	%r14, %rsi
	call	__fgets_chk@PLT
	testq	%rax, %rax
	je	.L27
	movq	8(%rsp), %rdi
	leaq	.LC4(%rip), %rsi
	call	strtok@PLT
	xorl	%ecx, %ecx
.L15:
	testq	%rax, %rax
	jne	.L16
.L18:
	incl	%r15d
	jmp	.L14
.L16:
	movl	(%r12), %edx
	cmpl	%ecx, %edx
	jle	.L18
	imull	%r15d, %edx
	movq	%rax, %rdi
	movl	%ecx, 28(%rsp)
	addl	%ecx, %edx
	movslq	%edx, %rdx
	leaq	0(%r13,%rdx,8), %rdx
	movq	%rdx, 16(%rsp)
	call	atof@PLT
	movq	16(%rsp), %rdx
	leaq	.LC4(%rip), %rsi
	xorl	%edi, %edi
	movsd	%xmm0, (%rdx)
	call	strtok@PLT
	movl	28(%rsp), %ecx
	incl	%ecx
	jmp	.L15
.L27:
	movq	%rbx, %rdi
	call	fclose@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
.L2:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	movq	%r13, %rax
	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
.LFE2044:
	.size	_Z9file_readPcPiS0_, .-_Z9file_readPcPiS0_
	.globl	_Z29__device_stub__Z6medvalPdS_iiPdS_ii
	.type	_Z29__device_stub__Z6medvalPdS_iiPdS_ii, @function
_Z29__device_stub__Z6medvalPdS_iiPdS_ii:
.LFB2070:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L28
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z6medvalPdS_ii(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L28:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2070:
	.size	_Z29__device_stub__Z6medvalPdS_iiPdS_ii, .-_Z29__device_stub__Z6medvalPdS_iiPdS_ii
	.globl	_Z6medvalPdS_ii
	.type	_Z6medvalPdS_ii, @function
_Z6medvalPdS_ii:
.LFB2071:
	.cfi_startproc
	endbr64
	jmp	_Z29__device_stub__Z6medvalPdS_iiPdS_ii
	.cfi_endproc
.LFE2071:
	.size	_Z6medvalPdS_ii, .-_Z6medvalPdS_ii
	.globl	_Z40__device_stub__Z12MatrixVecMulPdS_S_S_iiPdS_S_S_ii
	.type	_Z40__device_stub__Z12MatrixVecMulPdS_S_S_iiPdS_S_S_ii, @function
_Z40__device_stub__Z12MatrixVecMulPdS_S_S_iiPdS_S_S_ii:
.LFB2072:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	56(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	64(%rsp), %rcx
	movl	%r8d, 12(%rsp)
	movl	%r9d, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L33
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z12MatrixVecMulPdS_S_S_ii(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 208
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L33:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2072:
	.size	_Z40__device_stub__Z12MatrixVecMulPdS_S_S_iiPdS_S_S_ii, .-_Z40__device_stub__Z12MatrixVecMulPdS_S_S_iiPdS_S_S_ii
	.globl	_Z12MatrixVecMulPdS_S_S_ii
	.type	_Z12MatrixVecMulPdS_S_S_ii, @function
_Z12MatrixVecMulPdS_S_S_ii:
.LFB2073:
	.cfi_startproc
	endbr64
	jmp	_Z40__device_stub__Z12MatrixVecMulPdS_S_S_iiPdS_S_S_ii
	.cfi_endproc
.LFE2073:
	.size	_Z12MatrixVecMulPdS_S_S_ii, .-_Z12MatrixVecMulPdS_S_S_ii
	.globl	_Z45__device_stub__Z13TMatrixVecMulPdS_S_S_S_iiPfPdS_S_S_S_iiPf
	.type	_Z45__device_stub__Z13TMatrixVecMulPdS_S_S_S_iiPfPdS_S_S_S_iiPf, @function
_Z45__device_stub__Z13TMatrixVecMulPdS_S_S_S_iiPfPdS_S_S_S_iiPf:
.LFB2074:
	.cfi_startproc
	endbr64
	subq	$216, %rsp
	.cfi_def_cfa_offset 224
	movq	232(%rsp), %rax
	movq	%rdi, 56(%rsp)
	leaq	88(%rsp), %rdi
	movq	%rsi, 48(%rsp)
	leaq	100(%rsp), %rsi
	movq	%rdx, 40(%rsp)
	leaq	72(%rsp), %rdx
	movq	%rcx, 32(%rsp)
	leaq	80(%rsp), %rcx
	movq	%r8, 24(%rsp)
	movl	%r9d, 20(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 200(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rax
	movl	$1, 96(%rsp)
	movq	%rax, 136(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	224(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 192(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 88(%rsp)
	movq	%rax, 100(%rsp)
	movl	$1, 108(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L38
	pushq	80(%rsp)
	.cfi_def_cfa_offset 232
	leaq	_Z13TMatrixVecMulPdS_S_S_S_iiPf(%rip), %rdi
	pushq	80(%rsp)
	.cfi_def_cfa_offset 240
	movq	116(%rsp), %rcx
	movl	124(%rsp), %r8d
	movq	104(%rsp), %rsi
	movl	112(%rsp), %edx
	leaq	152(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 232
	popq	%rdx
	.cfi_def_cfa_offset 224
.L38:
	movq	200(%rsp), %rax
	subq	%fs:40, %rax
	je	.L40
	call	__stack_chk_fail@PLT
.L40:
	addq	$216, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2074:
	.size	_Z45__device_stub__Z13TMatrixVecMulPdS_S_S_S_iiPfPdS_S_S_S_iiPf, .-_Z45__device_stub__Z13TMatrixVecMulPdS_S_S_S_iiPfPdS_S_S_S_iiPf
	.globl	_Z13TMatrixVecMulPdS_S_S_S_iiPf
	.type	_Z13TMatrixVecMulPdS_S_S_S_iiPf, @function
_Z13TMatrixVecMulPdS_S_S_S_iiPf:
.LFB2075:
	.cfi_startproc
	endbr64
	jmp	_Z45__device_stub__Z13TMatrixVecMulPdS_S_S_S_iiPfPdS_S_S_S_iiPf
	.cfi_endproc
.LFE2075:
	.size	_Z13TMatrixVecMulPdS_S_S_S_iiPf, .-_Z13TMatrixVecMulPdS_S_S_S_iiPf
	.globl	_Z33__device_stub__Z10DivideNormPdPfiPdPfi
	.type	_Z33__device_stub__Z10DivideNormPdPfiPdPfi, @function
_Z33__device_stub__Z10DivideNormPdPfiPdPfi:
.LFB2076:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L43
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z10DivideNormPdPfi(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L43:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L45
	call	__stack_chk_fail@PLT
.L45:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2076:
	.size	_Z33__device_stub__Z10DivideNormPdPfiPdPfi, .-_Z33__device_stub__Z10DivideNormPdPfiPdPfi
	.globl	_Z10DivideNormPdPfi
	.type	_Z10DivideNormPdPfi, @function
_Z10DivideNormPdPfi:
.LFB2077:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z10DivideNormPdPfiPdPfi
	.cfi_endproc
.LFE2077:
	.size	_Z10DivideNormPdPfi, .-_Z10DivideNormPdPfi
	.globl	_Z39__device_stub__Z12CalculateEpsPdS_S_PfiPdS_S_Pfi
	.type	_Z39__device_stub__Z12CalculateEpsPdS_S_PfiPdS_S_Pfi, @function
_Z39__device_stub__Z12CalculateEpsPdS_S_PfiPdS_S_Pfi:
.LFB2078:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	56(%rsp), %rcx
	movl	%r8d, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L48
	pushq	56(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z12CalculateEpsPdS_S_Pfi(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 192
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L48:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L50
	call	__stack_chk_fail@PLT
.L50:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2078:
	.size	_Z39__device_stub__Z12CalculateEpsPdS_S_PfiPdS_S_Pfi, .-_Z39__device_stub__Z12CalculateEpsPdS_S_PfiPdS_S_Pfi
	.globl	_Z12CalculateEpsPdS_S_Pfi
	.type	_Z12CalculateEpsPdS_S_Pfi, @function
_Z12CalculateEpsPdS_S_Pfi:
.LFB2079:
	.cfi_startproc
	endbr64
	jmp	_Z39__device_stub__Z12CalculateEpsPdS_S_PfiPdS_S_Pfi
	.cfi_endproc
.LFE2079:
	.size	_Z12CalculateEpsPdS_S_Pfi, .-_Z12CalculateEpsPdS_S_Pfi
	.section	.rodata.str1.1
.LC5:
	.string	","
.LC6:
	.string	""
.LC10:
	.string	"Elapsed Time: %f ms\n"
.LC11:
	.string	"w"
.LC12:
	.string	"results_simple.csv"
.LC13:
	.string	"%.7f%s"
.LC14:
	.string	"\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2045:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%edi, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$200, %rsp
	.cfi_def_cfa_offset 256
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	call	cudaSetDevice@PLT
	movq	8(%rbx), %rdi
	leaq	72(%rsp), %rdx
	leaq	68(%rsp), %rsi
	call	_Z9file_readPcPiS0_
	movslq	68(%rsp), %r14
	movq	%rax, 48(%rsp)
	movslq	72(%rsp), %rax
	movl	%r14d, %ebp
	movq	%r14, %r13
	salq	$3, %r14
	imull	%eax, %ebp
	movq	%rax, %rbx
	salq	$3, %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rdi
	movq	%rax, 16(%rsp)
	sall	$3, %ebp
	call	malloc@PLT
	movl	$4, %edi
	movq	%rax, %r12
	call	malloc@PLT
	movl	$4, %edi
	movq	%rax, 24(%rsp)
	call	malloc@PLT
	movsd	.LC7(%rip), %xmm0
	movq	%rax, 32(%rsp)
	xorl	%eax, %eax
.L54:
	cmpl	%eax, %ebx
	jle	.L75
	movq	16(%rsp), %rcx
	movsd	%xmm0, (%rcx,%rax,8)
	incq	%rax
	jmp	.L54
.L75:
	movslq	%ebp, %rbp
	leaq	104(%rsp), %rdi
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rsi
	leaq	112(%rsp), %rdi
	call	cudaMalloc@PLT
	leaq	128(%rsp), %rdi
	movq	%r14, %rsi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rsi
	leaq	120(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rsi
	leaq	96(%rsp), %rdi
	call	cudaMalloc@PLT
	leaq	136(%rsp), %rdi
	movq	%r14, %rsi
	call	cudaMalloc@PLT
	leaq	80(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	leaq	88(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movq	48(%rsp), %rsi
	movq	104(%rsp), %rdi
	movq	%rbp, %rdx
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	$1, %ecx
	movq	112(%rsp), %rdi
	call	cudaMemcpy@PLT
	leaq	144(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	152(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	144(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	leal	-1(%r13), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1024, %esi
	cltd
	movl	$4194305, %ecx
	movl	$1, 180(%rsp)
	idivl	%esi
	salq	$10, %rcx
	movq	%rcx, 172(%rsp)
	movq	%rcx, %rdx
	movl	$1, %ecx
	incl	%eax
	movl	%eax, 160(%rsp)
	movl	%eax, 56(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 164(%rsp)
	movq	160(%rsp), %rdi
	movl	168(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L56
	movq	136(%rsp), %rsi
	movq	104(%rsp), %rdi
	movl	%ebx, %ecx
	movl	%r13d, %edx
	call	_Z29__device_stub__Z6medvalPdS_iiPdS_ii
.L56:
	movq	152(%rsp), %rdi
	xorl	%esi, %esi
	movl	$4194305, %ebp
	movabsq	$4294967297, %r15
	salq	$10, %rbp
	call	cudaEventRecord@PLT
	movq	152(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	152(%rsp), %rdx
	leaq	76(%rsp), %rdi
	movq	144(%rsp), %rsi
	call	cudaEventElapsedTime@PLT
	leal	-1(%rbx), %eax
	movl	$1024, %ecx
	cltd
	movl	%eax, 60(%rsp)
	idivl	%ecx
	xorl	%ecx, %ecx
	movl	%ecx, 44(%rsp)
	leal	1(%rax), %r14d
.L65:
	movq	32(%rsp), %rax
	movq	32(%rsp), %rsi
	movl	$1, %ecx
	movl	$4, %edx
	movq	80(%rsp), %rdi
	movl	$0x00000000, (%rax)
	movq	24(%rsp), %rax
	movl	$0x00000000, (%rax)
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rsi
	movq	88(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	call	cudaMemcpy@PLT
	cmpl	$0, 44(%rsp)
	je	.L58
	xorl	%eax, %eax
.L57:
	cmpl	%eax, %ebx
	jle	.L76
	movsd	(%r12,%rax,8), %xmm0
	movq	16(%rsp), %rcx
	movsd	%xmm0, (%rcx,%rax,8)
	incq	%rax
	jmp	.L57
.L76:
	movq	8(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	$1, %ecx
	movq	112(%rsp), %rdi
	call	cudaMemcpy@PLT
.L58:
	movq	144(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	56(%rsp), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r15, 164(%rsp)
	movq	%rbp, %rdx
	movl	168(%rsp), %esi
	movl	$1, %ecx
	movl	%eax, 160(%rsp)
	movq	160(%rsp), %rdi
	movq	%rbp, 172(%rsp)
	movl	$1, 180(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L60
	movq	112(%rsp), %rsi
	movq	104(%rsp), %rdi
	movl	%ebx, %r9d
	movl	%r13d, %r8d
	movq	136(%rsp), %rcx
	movq	128(%rsp), %rdx
	call	_Z40__device_stub__Z12MatrixVecMulPdS_S_S_iiPdS_S_S_ii
.L60:
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rbp, %rdx
	movl	$1, %ecx
	movq	%r15, 164(%rsp)
	movl	168(%rsp), %esi
	movl	%r14d, 160(%rsp)
	movq	160(%rsp), %rdi
	movq	%rbp, 172(%rsp)
	movl	$1, 180(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L61
	pushq	80(%rsp)
	.cfi_def_cfa_offset 264
	movl	%r13d, %r9d
	pushq	%rbx
	.cfi_def_cfa_offset 272
	movq	152(%rsp), %r8
	movq	136(%rsp), %rcx
	movq	144(%rsp), %rdx
	movq	128(%rsp), %rsi
	movq	120(%rsp), %rdi
	call	_Z45__device_stub__Z13TMatrixVecMulPdS_S_S_S_iiPfPdS_S_S_S_iiPf
	popq	%rax
	.cfi_def_cfa_offset 264
	popq	%rdx
	.cfi_def_cfa_offset 256
.L61:
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rbp, %rdx
	movl	$1, %ecx
	movq	%r15, 164(%rsp)
	movl	168(%rsp), %esi
	movl	%r14d, 160(%rsp)
	movq	160(%rsp), %rdi
	movq	%rbp, 172(%rsp)
	movl	$1, 180(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L62
	movq	80(%rsp), %rsi
	movq	120(%rsp), %rdi
	movl	%ebx, %edx
	call	_Z33__device_stub__Z10DivideNormPdPfiPdPfi
.L62:
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rbp, %rdx
	movl	$1, %ecx
	movq	%r15, 164(%rsp)
	movl	168(%rsp), %esi
	movl	%r14d, 160(%rsp)
	movq	160(%rsp), %rdi
	movq	%rbp, 172(%rsp)
	movl	$1, 180(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L63
	movq	88(%rsp), %rcx
	movq	96(%rsp), %rdx
	movl	%ebx, %r8d
	movq	112(%rsp), %rsi
	movq	120(%rsp), %rdi
	call	_Z39__device_stub__Z12CalculateEpsPdS_S_PfiPdS_S_Pfi
.L63:
	movq	152(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	152(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	152(%rsp), %rdx
	movq	144(%rsp), %rsi
	leaq	172(%rsp), %rdi
	movl	$0x00000000, 172(%rsp)
	call	cudaEventElapsedTime@PLT
	movss	76(%rsp), %xmm0
	movq	8(%rsp), %rdx
	movq	%r12, %rdi
	addss	172(%rsp), %xmm0
	movq	120(%rsp), %rsi
	movl	$2, %ecx
	movss	%xmm0, 76(%rsp)
	call	cudaMemcpy@PLT
	movq	88(%rsp), %rsi
	movq	24(%rsp), %rdi
	movl	$2, %ecx
	movl	$4, %edx
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rax
	movss	(%rax), %xmm0
	call	sqrtf@PLT
	movsd	.LC9(%rip), %xmm1
	cvtss2sd	%xmm0, %xmm0
	comisd	%xmm0, %xmm1
	ja	.L66
	incl	44(%rsp)
	cmpl	$100, 44(%rsp)
	jne	.L65
.L66:
	movl	$2, %edi
	leaq	.LC10(%rip), %rsi
	movb	$1, %al
	xorl	%r14d, %r14d
	cvtss2sd	76(%rsp), %xmm0
	call	__printf_chk@PLT
	leaq	.LC11(%rip), %rsi
	leaq	.LC12(%rip), %rdi
	call	fopen@PLT
	leaq	.LC6(%rip), %r13
	movq	%rax, %rbp
.L67:
	cmpl	%r14d, %ebx
	jle	.L77
	cmpl	%r14d, 60(%rsp)
	movsd	(%r12,%r14,8), %xmm0
	movq	%rbp, %rdi
	movb	$1, %al
	leaq	.LC5(%rip), %rcx
	leaq	.LC13(%rip), %rdx
	movl	$2, %esi
	cmovle	%r13, %rcx
	incq	%r14
	call	__fprintf_chk@PLT
	jmp	.L67
.L77:
	leaq	.LC14(%rip), %rdx
	movl	$2, %esi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movq	%rbp, %rdi
	call	fclose@PLT
	movq	104(%rsp), %rdi
	call	cudaFree@PLT
	movq	112(%rsp), %rdi
	call	cudaFree@PLT
	movq	128(%rsp), %rdi
	call	cudaFree@PLT
	movq	120(%rsp), %rdi
	call	cudaFree@PLT
	movq	136(%rsp), %rdi
	call	cudaFree@PLT
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movq	96(%rsp), %rdi
	call	cudaFree@PLT
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	movq	48(%rsp), %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	32(%rsp), %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L70
	call	__stack_chk_fail@PLT
.L70:
	addq	$200, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2045:
	.size	main, .-main
	.section	.rodata.str1.1
.LC15:
	.string	"_Z12CalculateEpsPdS_S_Pfi"
.LC16:
	.string	"_Z10DivideNormPdPfi"
.LC17:
	.string	"_Z13TMatrixVecMulPdS_S_S_S_iiPf"
.LC18:
	.string	"_Z12MatrixVecMulPdS_S_S_ii"
.LC19:
	.string	"_Z6medvalPdS_ii"
	.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	.LC15(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z12CalculateEpsPdS_S_Pfi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC16(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z10DivideNormPdPfi(%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	.LC17(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13TMatrixVecMulPdS_S_S_S_iiPf(%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	.LC18(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z12MatrixVecMulPdS_S_S_ii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC19(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z6medvalPdS_ii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.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
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC7:
	.long	0
	.long	1072693248
	.align 8
.LC9:
	.long	-1598689907
	.long	1051772663
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>     
#include <sys/types.h>  
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>    
#include <errno.h>
#include <assert.h>

#define numThreads 1024

#define MAX_CHAR_PER_LINE 128

#define NONE 0
#define FIRST 1
#define LAST 2
#define BOTH 3 

double* file_read(char *filename,int  *numCoords,int  *numObjs) 
{
  double *objects;
  int     i, j, len;
    //ssize_t numBytesRead;
  int done=0; 
  FILE *infile;
  char *line, *ret;
  int   lineLen;

	//don't skip lines or attributes for this project
  int lines_to_skip=0; 
  int attr_to_skip=0;

  if ((infile = fopen(filename, "r")) == NULL) {
    fprintf(stderr, "Error: no such file (%s)\n", filename);
    return NULL;
  }

    /* first find the number of objects */
  lineLen = MAX_CHAR_PER_LINE;
  line = (char*) malloc(lineLen);
  assert(line != NULL);

  (*numCoords) = 0;

  while (fgets(line, lineLen, infile) != NULL) {
            /* check each line to find the max line length */
    while (strlen(line) == lineLen-1) {
                /* this line read is not complete */
      len = strlen(line);
      fseek(infile, -len, SEEK_CUR);

                /* increase lineLen */
      lineLen += MAX_CHAR_PER_LINE;
      line = (char*) realloc(line, lineLen);
      assert(line != NULL);

      ret = fgets(line, lineLen, infile);
      assert(ret != NULL);
    }

    if (strtok(line, " \t\n") != 0)
      (*numCoords)++;
  }

  (*numCoords)-=lines_to_skip;

  if((*numCoords)<=0)
  {
    fprintf(stderr, "Error: No objects found\n");
    return NULL;
  }

  rewind(infile);

	/*find the number of attributes*/  
  (*numObjs)=0;

  fgets(line, lineLen, infile);

  char * pch;
  pch=strtok(line, ",;");

  while (pch != NULL )
  {

    pch = strtok (NULL, ",;");
    (*numObjs)++;
  }

  if(attr_to_skip!=NONE)
  {
    (*numObjs)--;
    if(attr_to_skip==BOTH)
      (*numObjs)--;
  }

  rewind(infile);


    /* allocate space for objects and read all objects */
  len = (*numCoords) * (*numObjs);
  objects    = (double*)malloc( len * sizeof(double));
  assert(objects != NULL);



    /* read all objects */

  for(i=0;i<lines_to_skip;i++)
   fgets(line, lineLen, infile);

 i=0;
 j=0;

 while (fgets(line, lineLen, infile) != NULL) 
 {
   pch=strtok(line, ",;");
   while (pch != NULL && j<(*numObjs))
   {
    if(attr_to_skip%2==1 && j==0 && done==0)
    {
      done=1;
      pch = strtok (NULL, ",;");
      continue;                      
    }
    objects[i*(*numObjs)+j]=atof(pch);
    pch = strtok (NULL, ",;");
    j++;
  }
  i++;
  j=0;
  done=0;
}

assert(i == *numCoords);

fclose(infile);
free(line);


return objects;
}

__global__ void medval(double *M_d,double *w_d,int rows, int cols)
{
	int row = blockIdx.x*blockDim.x + threadIdx.x;
	double sum = 0.0;
	if (row < rows){
		for (int i=0;i<cols;i++){
			sum += M_d[row*cols + i];
		}
		w_d[row] = sum/cols;
	}	 
} 

__global__ void MatrixVecMul(double* M_d, double* x_d, double* z_d, double* w_d, int rows, int cols){
	int row = blockIdx.x*blockDim.x + threadIdx.x;
	double sum = 0.0;
	if (row < rows){	
		for (int i=0;i<cols;i++){
			sum += (M_d[row*cols + i] - w_d[row])*x_d[i];
		}
		z_d[row] = sum;
	}
} 



__global__ void TMatrixVecMul(double *M_d, double* x_d, double* z_d, double* k_d, double* w_d, int rows, int cols, float* norm_d){
	int row = blockIdx.x*blockDim.x + threadIdx.x;
	double sum = 0.0;
	if (row < cols){	
		for (int i=0;i<rows;i++){
			sum += (M_d[i*cols + row] - w_d[i])*z_d[i];
		}
		k_d[row] = sum;
		atomicAdd(norm_d,k_d[row]*k_d[row]);
	}

}

__global__ void DivideNorm(double* k_d, float* norm, int cols){
	int index = blockIdx.x*blockDim.x + threadIdx.x;
	if (index < cols) k_d[index] = k_d[index]/sqrt(*norm);
}

__global__ void CalculateEps(double* k_d, double* x_d, double* e_d, float* eps, int cols){
	int index = blockIdx.x*blockDim.x + threadIdx.x;
	if (index < cols){
   e_d[index] = k_d[index] - x_d[index];
   atomicAdd(eps,e_d[index]*e_d[index]);
 }
}


int main(int argc, char **argv){
	hipSetDevice(0);
	int rows,cols;
  double* M_h = file_read(argv[1],&rows,&cols);
  int size = rows*cols*sizeof(double);
  double* x_h = (double*)malloc(cols*sizeof(double));
  double* z_h = (double*)malloc(rows*sizeof(double));
  double* k_h = (double*)malloc(cols*sizeof(double));
  float* e = (float*)malloc(sizeof(float));
  float* norm_h = (float*)malloc(sizeof(float));

  float* norm_d;
  float* eps;
  double* e_d;
  double* M_d;
  double* x_d;
  double* k_d;
  double* z_d;
  double* w_d;



  for (int i=0;i<cols;i++) x_h[i] = 1;


  hipMalloc((void**) &M_d, size);
  hipMalloc((void**) &x_d, cols*sizeof(double));
  hipMalloc((void**) &z_d, rows*sizeof(double));
  hipMalloc((void**) &k_d, cols*sizeof(double));
  hipMalloc((void**) &e_d, cols*sizeof(double));
  hipMalloc((void**) &w_d, rows*sizeof(double));
  hipMalloc((void**) &norm_d, sizeof(float));
  hipMalloc((void**) &eps, sizeof(float));

  hipMemcpy(M_d, M_h, size, hipMemcpyHostToDevice);
  hipMemcpy(x_d, x_h, cols*sizeof(double), hipMemcpyHostToDevice);

  hipEvent_t start, stop;
  hipEventCreate(&start);
  hipEventCreate(&stop);
  float elapsedTime;
  hipEventRecord(start);
  medval<<<(rows - 1)/numThreads + 1,numThreads>>>(M_d,w_d,rows,cols);
  hipEventRecord(stop);
  hipEventSynchronize(stop);
  hipEventElapsedTime(&elapsedTime, start, stop);
  for (int i=0;i<100;i++){
    *norm_h = 0;
    *e = 0;
    hipMemcpy(norm_d, norm_h, sizeof(float), hipMemcpyHostToDevice);
    hipMemcpy(eps, e, sizeof(float), hipMemcpyHostToDevice);
    if (i !=0){
     for (int k=0;k<cols;k++) x_h[k] = k_h[k];
       hipMemcpy(x_d, x_h, cols*sizeof(double), hipMemcpyHostToDevice);
   }
   hipEventRecord(start);
   MatrixVecMul<<<(rows - 1)/numThreads + 1,numThreads>>>(M_d,x_d,z_d,w_d,rows,cols);

   TMatrixVecMul<<<(cols - 1)/numThreads + 1,numThreads>>>(M_d,x_d,z_d,k_d, w_d, rows,cols,norm_d);

   DivideNorm<<<(cols - 1)/numThreads + 1,numThreads>>>(k_d, norm_d, cols);

   CalculateEps<<<(cols - 1)/numThreads + 1,numThreads>>>(k_d, x_d, e_d, eps, cols);
   hipEventRecord(stop);
   hipEventSynchronize(stop);
   float milliseconds = 0;
   hipEventElapsedTime(&milliseconds, start, stop);
   elapsedTime += milliseconds;

   hipMemcpy(k_h,k_d,cols*sizeof(double),hipMemcpyDeviceToHost);
   hipMemcpy(e, eps, sizeof(float), hipMemcpyDeviceToHost);

   if (sqrt(*e) < 0.000001) break;
 }
 printf("Elapsed Time: %f ms\n", elapsedTime);
 FILE *f = fopen("results_simple.csv", "w");

 for (int i=0;i<cols;i++) fprintf(f,"%.7f%s", k_h[i],(i<cols-1)?",":"");
  fprintf(f,"\n");
fclose(f);

hipFree(M_d);
hipFree(x_d);
hipFree(z_d);
hipFree(k_d);
hipFree(w_d);
hipFree(norm_d);
hipFree(e_d);
hipFree(eps);

free(M_h);
free(x_h);
free(z_h);
free(k_h);
free(norm_h);
free(e);
return 0;
}


	.text
	.file	"simple.hip"
	.globl	_Z9file_readPcPiS0_             # -- Begin function _Z9file_readPcPiS0_
	.type	_Z9file_readPcPiS0_,@function
_Z9file_readPcPiS0_:                    # @_Z9file_readPcPiS0_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, %rbx
	movq	%rsi, %r13
	movq	%rdi, %r15
	movl	$.L.str, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB0_1
# %bb.2:
	movq	%rax, %r14
	movl	$128, %edi
	callq	malloc
	movq	%rax, %r15
	movl	$0, (%r13)
	movl	$128, %r12d
	movq	%rax, %rdi
	movl	$128, %esi
	movq	%r14, %rdx
	callq	fgets
	testq	%rax, %rax
	je	.LBB0_10
# %bb.3:                                # %.preheader.preheader
	movl	$128, %r12d
.LBB0_4:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_6 Depth 2
	movq	%r15, %rdi
	callq	strlen
	leal	-1(%r12), %ecx
	movslq	%ecx, %rcx
	cmpq	%rcx, %rax
	jne	.LBB0_7
# %bb.5:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB0_4 Depth=1
	movslq	%r12d, %rbp
	decq	%rbp
.LBB0_6:                                # %.lr.ph
                                        #   Parent Loop BB0_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	negl	%eax
	movslq	%eax, %rsi
	movq	%r14, %rdi
	movl	$1, %edx
	callq	fseek
	leaq	129(%rbp), %rsi
	movq	%r15, %rdi
	callq	realloc
	movq	%rax, %r15
	subl	$-128, %r12d
	movq	%rax, %rdi
	movl	%r12d, %esi
	movq	%r14, %rdx
	callq	fgets
	movq	%r15, %rdi
	callq	strlen
	subq	$-128, %rbp
	cmpq	%rax, %rbp
	je	.LBB0_6
.LBB0_7:                                # %._crit_edge
                                        #   in Loop: Header=BB0_4 Depth=1
	movl	$.L.str.2, %esi
	movq	%r15, %rdi
	callq	strtok
	testq	%rax, %rax
	je	.LBB0_9
# %bb.8:                                #   in Loop: Header=BB0_4 Depth=1
	incl	(%r13)
.LBB0_9:                                #   in Loop: Header=BB0_4 Depth=1
	movq	%r15, %rdi
	movl	%r12d, %esi
	movq	%r14, %rdx
	callq	fgets
	testq	%rax, %rax
	jne	.LBB0_4
.LBB0_10:                               # %._crit_edge92
	cmpl	$0, (%r13)
	jle	.LBB0_11
# %bb.12:
	movq	%r14, %rdi
	callq	rewind
	movl	$0, (%rbx)
	movq	%r15, %rdi
	movl	%r12d, %esi
	movq	%r14, %rdx
	callq	fgets
	movl	$.L.str.4, %esi
	movq	%r15, %rdi
	callq	strtok
.LBB0_14:                               # %.lr.ph97
                                        # =>This Inner Loop Header: Depth=1
	testq	%rax, %rax
	je	.LBB0_15
# %bb.13:                               # %.lr.ph97
                                        #   in Loop: Header=BB0_14 Depth=1
	movl	$.L.str.4, %esi
	xorl	%edi, %edi
	callq	strtok
	incl	(%rbx)
	jmp	.LBB0_14
.LBB0_15:                               # %._crit_edge98
	movq	%r14, %rdi
	callq	rewind
	movslq	(%r13), %rax
	movq	%rbx, 16(%rsp)                  # 8-byte Spill
	movslq	(%rbx), %rdi
	imulq	%rax, %rdi
	shlq	$3, %rdi
	callq	malloc
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movq	%r15, %rdi
	movl	%r12d, %esi
	movq	%r14, %rdx
	callq	fgets
	testq	%rax, %rax
	je	.LBB0_22
# %bb.16:                               # %.lr.ph108.preheader
	xorl	%ebp, %ebp
.LBB0_17:                               # %.lr.ph108
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_19 Depth 2
	movl	$.L.str.4, %esi
	movq	%r15, %rdi
	callq	strtok
	testq	%rax, %rax
	je	.LBB0_21
# %bb.18:                               # %.lr.ph103.preheader
                                        #   in Loop: Header=BB0_17 Depth=1
	xorl	%ebx, %ebx
.LBB0_19:                               # %.lr.ph103
                                        #   Parent Loop BB0_17 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	16(%rsp), %rcx                  # 8-byte Reload
	movl	(%rcx), %r13d
	cmpl	%r13d, %ebx
	jge	.LBB0_21
# %bb.20:                               #   in Loop: Header=BB0_19 Depth=2
	movq	%rax, %rdi
	callq	atof
	imull	%ebp, %r13d
	addl	%ebx, %r13d
	movslq	%r13d, %rax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	movsd	%xmm0, (%rcx,%rax,8)
	movl	$.L.str.4, %esi
	xorl	%edi, %edi
	callq	strtok
	incl	%ebx
	testq	%rax, %rax
	jne	.LBB0_19
.LBB0_21:                               # %.critedge
                                        #   in Loop: Header=BB0_17 Depth=1
	incl	%ebp
	movq	%r15, %rdi
	movl	%r12d, %esi
	movq	%r14, %rdx
	callq	fgets
	testq	%rax, %rax
	jne	.LBB0_17
.LBB0_22:                               # %._crit_edge109
	movq	%r14, %rdi
	callq	fclose
	movq	%r15, %rdi
	callq	free
.LBB0_23:
	movq	8(%rsp), %rax                   # 8-byte Reload
	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
.LBB0_1:
	.cfi_def_cfa_offset 80
	movq	stderr(%rip), %rdi
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movl	$.L.str.1, %esi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB0_23
.LBB0_11:
	movq	stderr(%rip), %rcx
	movl	$.L.str.3, %edi
	movl	$24, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	jmp	.LBB0_23
.Lfunc_end0:
	.size	_Z9file_readPcPiS0_, .Lfunc_end0-_Z9file_readPcPiS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z21__device_stub__medvalPdS_ii # -- Begin function _Z21__device_stub__medvalPdS_ii
	.type	_Z21__device_stub__medvalPdS_ii,@function
_Z21__device_stub__medvalPdS_ii:        # @_Z21__device_stub__medvalPdS_ii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z6medvalPdS_ii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z21__device_stub__medvalPdS_ii, .Lfunc_end1-_Z21__device_stub__medvalPdS_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z27__device_stub__MatrixVecMulPdS_S_S_ii # -- Begin function _Z27__device_stub__MatrixVecMulPdS_S_S_ii
	.type	_Z27__device_stub__MatrixVecMulPdS_S_S_ii,@function
_Z27__device_stub__MatrixVecMulPdS_S_S_ii: # @_Z27__device_stub__MatrixVecMulPdS_S_S_ii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$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	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	12(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	8(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z12MatrixVecMulPdS_S_S_ii, %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_end2:
	.size	_Z27__device_stub__MatrixVecMulPdS_S_S_ii, .Lfunc_end2-_Z27__device_stub__MatrixVecMulPdS_S_S_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z28__device_stub__TMatrixVecMulPdS_S_S_S_iiPf # -- Begin function _Z28__device_stub__TMatrixVecMulPdS_S_S_S_iiPf
	.type	_Z28__device_stub__TMatrixVecMulPdS_S_S_S_iiPf,@function
_Z28__device_stub__TMatrixVecMulPdS_S_S_S_iiPf: # @_Z28__device_stub__TMatrixVecMulPdS_S_S_S_iiPf
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$160, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	4(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	208(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	216(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z13TMatrixVecMulPdS_S_S_S_iiPf, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z28__device_stub__TMatrixVecMulPdS_S_S_S_iiPf, .Lfunc_end3-_Z28__device_stub__TMatrixVecMulPdS_S_S_S_iiPf
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__DivideNormPdPfi # -- Begin function _Z25__device_stub__DivideNormPdPfi
	.type	_Z25__device_stub__DivideNormPdPfi,@function
_Z25__device_stub__DivideNormPdPfi:     # @_Z25__device_stub__DivideNormPdPfi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z10DivideNormPdPfi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z25__device_stub__DivideNormPdPfi, .Lfunc_end4-_Z25__device_stub__DivideNormPdPfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z27__device_stub__CalculateEpsPdS_S_Pfi # -- Begin function _Z27__device_stub__CalculateEpsPdS_S_Pfi
	.type	_Z27__device_stub__CalculateEpsPdS_S_Pfi,@function
_Z27__device_stub__CalculateEpsPdS_S_Pfi: # @_Z27__device_stub__CalculateEpsPdS_S_Pfi
	.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	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	12(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z12CalculateEpsPdS_S_Pfi, %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_end5:
	.size	_Z27__device_stub__CalculateEpsPdS_S_Pfi, .Lfunc_end5-_Z27__device_stub__CalculateEpsPdS_S_Pfi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI6_0:
	.quad	0x3eb0c6f7a0b5ed8d              # double 9.9999999999999995E-7
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI6_1:
	.long	0x00000000                      # float 0
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	.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	%rsi, %rbx
	xorl	%edi, %edi
	callq	hipSetDevice
	movq	8(%rbx), %rdi
	leaq	180(%rsp), %rbx
	leaq	176(%rsp), %r14
	movq	%rbx, %rsi
	movq	%r14, %rdx
	callq	_Z9file_readPcPiS0_
	movq	%rax, 144(%rsp)                 # 8-byte Spill
	movslq	(%rbx), %rax
	movslq	(%r14), %r15
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	movl	%eax, %ebx
	imull	%r15d, %ebx
	shll	$3, %ebx
	leaq	(,%r15,8), %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, %r13
	movq	%r14, 104(%rsp)                 # 8-byte Spill
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	movl	$4, %edi
	callq	malloc
	movq	%rax, %r14
	movl	$4, %edi
	callq	malloc
	movq	%rax, 152(%rsp)                 # 8-byte Spill
	movl	%r15d, %ebp
	testq	%r15, %r15
	jle	.LBB6_3
# %bb.1:                                # %.lr.ph.preheader
	xorl	%eax, %eax
	movabsq	$4607182418800017408, %rcx      # imm = 0x3FF0000000000000
.LBB6_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%rcx, (%r13,%rax,8)
	incq	%rax
	cmpq	%rax, %rbp
	jne	.LBB6_2
.LBB6_3:                                # %._crit_edge
	movabsq	$4294968320, %r15               # imm = 0x100000400
	movslq	%ebx, %rsi
	movq	%rsi, 96(%rsp)                  # 8-byte Spill
	leaq	48(%rsp), %rdi
	callq	hipMalloc
	leaq	24(%rsp), %rdi
	movq	104(%rsp), %rbx                 # 8-byte Reload
	movq	%rbx, %rsi
	callq	hipMalloc
	movq	32(%rsp), %rax                  # 8-byte Reload
	leaq	(,%rax,8), %r12
	leaq	120(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	leaq	40(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	leaq	160(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	leaq	72(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	leaq	88(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	leaq	80(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	leaq	48(%rsp), %rax
	movq	(%rax), %rdi
	movq	144(%rsp), %rsi                 # 8-byte Reload
	movq	96(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	24(%rsp), %rax
	movq	(%rax), %rdi
	movq	%r13, 136(%rsp)                 # 8-byte Spill
	movq	%r13, %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	112(%rsp), %r12
	movq	%r12, %rdi
	callq	hipEventCreate
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
	movq	(%r12), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	32(%rsp), %rcx                  # 8-byte Reload
	leal	-1(%rcx), %eax
	addl	$1022, %ecx                     # imm = 0x3FE
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$10, %ecx
	incl	%ecx
	leaq	(%rcx,%r15), %rdi
	addq	$-1024, %rdi                    # imm = 0xFC00
	movq	%rdi, 96(%rsp)                  # 8-byte Spill
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_5
# %bb.4:
	movq	48(%rsp), %rdi
	movq	72(%rsp), %rsi
	movq	32(%rsp), %rdx                  # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	movl	%ebp, %ecx
	callq	_Z21__device_stub__medvalPdS_ii
.LBB6_5:
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	16(%rsp), %rdi
	callq	hipEventSynchronize
	movq	112(%rsp), %rsi
	movq	16(%rsp), %rdx
	leaq	12(%rsp), %rdi
	callq	hipEventElapsedTime
	leal	-1(%rbp), %ecx
	leal	1022(%rbp), %eax
	testl	%ecx, %ecx
	movl	%ecx, 132(%rsp)                 # 4-byte Spill
	cmovnsl	%ecx, %eax
	sarl	$10, %eax
	incl	%eax
	leaq	(%r15,%rax), %r12
	addq	$-1024, %r12                    # imm = 0xFC00
	leaq	(,%rbp,8), %rax
	movq	%rax, 168(%rsp)                 # 8-byte Spill
	movl	$99, %ebx
	movq	136(%rsp), %r13                 # 8-byte Reload
.LBB6_6:                                # =>This Inner Loop Header: Depth=1
	movq	152(%rsp), %rsi                 # 8-byte Reload
	xorl	%eax, %eax
	movl	%eax, (%rsi)
	movl	%eax, (%r14)
	movq	88(%rsp), %rdi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	80(%rsp), %rdi
	movl	$4, %edx
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	cmpl	$99, %ebx
	je	.LBB6_10
# %bb.7:                                # %.preheader
                                        #   in Loop: Header=BB6_6 Depth=1
	testl	%ebp, %ebp
	jle	.LBB6_9
# %bb.8:                                # %.lr.ph99.preheader
                                        #   in Loop: Header=BB6_6 Depth=1
	movq	%r13, %rdi
	movq	64(%rsp), %rsi                  # 8-byte Reload
	movq	168(%rsp), %rdx                 # 8-byte Reload
	callq	memcpy@PLT
.LBB6_9:                                # %._crit_edge100
                                        #   in Loop: Header=BB6_6 Depth=1
	movq	24(%rsp), %rdi
	movq	%r13, %rsi
	movq	104(%rsp), %rdx                 # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.LBB6_10:                               #   in Loop: Header=BB6_6 Depth=1
	movq	112(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	96(%rsp), %rdi                  # 8-byte Reload
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_12
# %bb.11:                               #   in Loop: Header=BB6_6 Depth=1
	movq	48(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	120(%rsp), %rdx
	movq	72(%rsp), %rcx
	movq	32(%rsp), %r8                   # 8-byte Reload
                                        # kill: def $r8d killed $r8d killed $r8
	movl	%ebp, %r9d
	callq	_Z27__device_stub__MatrixVecMulPdS_S_S_ii
.LBB6_12:                               #   in Loop: Header=BB6_6 Depth=1
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_14
# %bb.13:                               #   in Loop: Header=BB6_6 Depth=1
	movq	48(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	120(%rsp), %rdx
	movq	40(%rsp), %rcx
	movq	72(%rsp), %r8
	movq	32(%rsp), %r9                   # 8-byte Reload
                                        # kill: def $r9d killed $r9d killed $r9
	pushq	88(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	%rbp
	.cfi_adjust_cfa_offset 8
	callq	_Z28__device_stub__TMatrixVecMulPdS_S_S_S_iiPf
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB6_14:                               #   in Loop: Header=BB6_6 Depth=1
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_16
# %bb.15:                               #   in Loop: Header=BB6_6 Depth=1
	movq	40(%rsp), %rdi
	movq	88(%rsp), %rsi
	movl	%ebp, %edx
	callq	_Z25__device_stub__DivideNormPdPfi
.LBB6_16:                               #   in Loop: Header=BB6_6 Depth=1
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_18
# %bb.17:                               #   in Loop: Header=BB6_6 Depth=1
	movq	40(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	160(%rsp), %rdx
	movq	80(%rsp), %rcx
	movl	%ebp, %r8d
	callq	_Z27__device_stub__CalculateEpsPdS_S_Pfi
.LBB6_18:                               #   in Loop: Header=BB6_6 Depth=1
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	16(%rsp), %rdi
	callq	hipEventSynchronize
	movl	$0, 60(%rsp)
	movq	112(%rsp), %rsi
	movq	16(%rsp), %rdx
	leaq	60(%rsp), %rdi
	callq	hipEventElapsedTime
	movss	60(%rsp), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	addss	12(%rsp), %xmm0
	movss	%xmm0, 12(%rsp)
	movq	40(%rsp), %rsi
	movq	64(%rsp), %rdi                  # 8-byte Reload
	movq	104(%rsp), %rdx                 # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
	movq	80(%rsp), %rsi
	movl	$4, %edx
	movq	%r14, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movss	(%r14), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	ucomiss	.LCPI6_1(%rip), %xmm0
	jb	.LBB6_20
# %bb.19:                               #   in Loop: Header=BB6_6 Depth=1
	sqrtss	%xmm0, %xmm0
	jmp	.LBB6_21
.LBB6_20:                               # %call.sqrt
                                        #   in Loop: Header=BB6_6 Depth=1
	callq	sqrtf
.LBB6_21:                               # %.split
                                        #   in Loop: Header=BB6_6 Depth=1
	cvtss2sd	%xmm0, %xmm0
	subl	$1, %ebx
	setb	%al
	movsd	.LCPI6_0(%rip), %xmm1           # xmm1 = mem[0],zero
	ucomisd	%xmm0, %xmm1
	ja	.LBB6_23
# %bb.22:                               # %.split
                                        #   in Loop: Header=BB6_6 Depth=1
	testb	%al, %al
	je	.LBB6_6
.LBB6_23:
	xorps	%xmm0, %xmm0
	cvtss2sd	12(%rsp), %xmm0
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	movl	$.L.str.6, %edi
	movl	$.L.str.7, %esi
	callq	fopen
	movq	%rax, %rbx
	testl	%ebp, %ebp
	jle	.LBB6_26
# %bb.24:                               # %.lr.ph104
	movl	132(%rsp), %r15d                # 4-byte Reload
	xorl	%r12d, %r12d
	movl	$.L.str.9, %r13d
.LBB6_25:                               # =>This Inner Loop Header: Depth=1
	movq	64(%rsp), %rax                  # 8-byte Reload
	movsd	(%rax,%r12,8), %xmm0            # xmm0 = mem[0],zero
	cmpq	%r15, %r12
	movl	$.L.str.10, %edx
	cmovbq	%r13, %rdx
	movl	$.L.str.8, %esi
	movq	%rbx, %rdi
	movb	$1, %al
	callq	fprintf
	incq	%r12
	cmpq	%r12, %rbp
	jne	.LBB6_25
.LBB6_26:                               # %._crit_edge105
	movl	$10, %edi
	movq	%rbx, %rsi
	callq	fputc@PLT
	movq	%rbx, %rdi
	callq	fclose
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	120(%rsp), %rdi
	callq	hipFree
	movq	40(%rsp), %rdi
	callq	hipFree
	movq	72(%rsp), %rdi
	callq	hipFree
	movq	88(%rsp), %rdi
	callq	hipFree
	movq	160(%rsp), %rdi
	callq	hipFree
	movq	80(%rsp), %rdi
	callq	hipFree
	movq	144(%rsp), %rdi                 # 8-byte Reload
	callq	free
	movq	136(%rsp), %rdi                 # 8-byte Reload
	callq	free
	movq	64(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	152(%rsp), %rdi                 # 8-byte Reload
	callq	free
	movq	%r14, %rdi
	callq	free
	xorl	%eax, %eax
	addq	$184, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	main, .Lfunc_end6-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	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z6medvalPdS_ii, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z12MatrixVecMulPdS_S_S_ii, %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	$_Z13TMatrixVecMulPdS_S_S_S_iiPf, %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	$_Z10DivideNormPdPfi, %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	$_Z12CalculateEpsPdS_S_Pfi, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %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_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__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	.LBB8_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
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"r"
	.size	.L.str, 2

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Error: no such file (%s)\n"
	.size	.L.str.1, 26

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	" \t\n"
	.size	.L.str.2, 4

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Error: No objects found\n"
	.size	.L.str.3, 25

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	",;"
	.size	.L.str.4, 3

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

	.type	_Z12MatrixVecMulPdS_S_S_ii,@object # @_Z12MatrixVecMulPdS_S_S_ii
	.globl	_Z12MatrixVecMulPdS_S_S_ii
	.p2align	3, 0x0
_Z12MatrixVecMulPdS_S_S_ii:
	.quad	_Z27__device_stub__MatrixVecMulPdS_S_S_ii
	.size	_Z12MatrixVecMulPdS_S_S_ii, 8

	.type	_Z13TMatrixVecMulPdS_S_S_S_iiPf,@object # @_Z13TMatrixVecMulPdS_S_S_S_iiPf
	.globl	_Z13TMatrixVecMulPdS_S_S_S_iiPf
	.p2align	3, 0x0
_Z13TMatrixVecMulPdS_S_S_S_iiPf:
	.quad	_Z28__device_stub__TMatrixVecMulPdS_S_S_S_iiPf
	.size	_Z13TMatrixVecMulPdS_S_S_S_iiPf, 8

	.type	_Z10DivideNormPdPfi,@object     # @_Z10DivideNormPdPfi
	.globl	_Z10DivideNormPdPfi
	.p2align	3, 0x0
_Z10DivideNormPdPfi:
	.quad	_Z25__device_stub__DivideNormPdPfi
	.size	_Z10DivideNormPdPfi, 8

	.type	_Z12CalculateEpsPdS_S_Pfi,@object # @_Z12CalculateEpsPdS_S_Pfi
	.globl	_Z12CalculateEpsPdS_S_Pfi
	.p2align	3, 0x0
_Z12CalculateEpsPdS_S_Pfi:
	.quad	_Z27__device_stub__CalculateEpsPdS_S_Pfi
	.size	_Z12CalculateEpsPdS_S_Pfi, 8

	.type	.L.str.5,@object                # @.str.5
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.5:
	.asciz	"Elapsed Time: %f ms\n"
	.size	.L.str.5, 21

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"results_simple.csv"
	.size	.L.str.6, 19

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

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"%.7f%s"
	.size	.L.str.8, 7

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

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.zero	1
	.size	.L.str.10, 1

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z6medvalPdS_ii"
	.size	.L__unnamed_1, 16

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z12MatrixVecMulPdS_S_S_ii"
	.size	.L__unnamed_2, 27

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z13TMatrixVecMulPdS_S_S_S_iiPf"
	.size	.L__unnamed_3, 32

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z10DivideNormPdPfi"
	.size	.L__unnamed_4, 20

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"_Z12CalculateEpsPdS_S_Pfi"
	.size	.L__unnamed_5, 26

	.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

	.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 _Z21__device_stub__medvalPdS_ii
	.addrsig_sym _Z27__device_stub__MatrixVecMulPdS_S_S_ii
	.addrsig_sym _Z28__device_stub__TMatrixVecMulPdS_S_S_S_iiPf
	.addrsig_sym _Z25__device_stub__DivideNormPdPfi
	.addrsig_sym _Z27__device_stub__CalculateEpsPdS_S_Pfi
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z6medvalPdS_ii
	.addrsig_sym _Z12MatrixVecMulPdS_S_S_ii
	.addrsig_sym _Z13TMatrixVecMulPdS_S_S_S_iiPf
	.addrsig_sym _Z10DivideNormPdPfi
	.addrsig_sym _Z12CalculateEpsPdS_S_Pfi
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z6medvalPdS_ii         ; -- Begin function _Z6medvalPdS_ii
	.globl	_Z6medvalPdS_ii
	.p2align	8
	.type	_Z6medvalPdS_ii,@function
_Z6medvalPdS_ii:                        ; @_Z6medvalPdS_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b64 s[4:5], 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[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s4, v1
	s_cbranch_execz .LBB0_6
; %bb.1:                                ; %.preheader
	s_load_b128 s[0:3], s[0:1], 0x0
	s_cmp_lt_i32 s5, 1
	s_cbranch_scc1 .LBB0_4
; %bb.2:                                ; %.lr.ph
	v_mul_lo_u32 v2, v1, s5
	s_mov_b32 s4, s5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[4:5], 3, v[2:3]
	v_mov_b32_e32 v2, 0
	v_mov_b32_e32 v3, 0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v4, vcc_lo, s0, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s1, v5, vcc_lo
.LBB0_3:                                ; =>This Inner Loop Header: Depth=1
	global_load_b64 v[6:7], v[4:5], off
	v_add_co_u32 v4, vcc_lo, v4, 8
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v5, vcc_lo
	s_add_i32 s4, s4, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s4, 0
	s_waitcnt vmcnt(0)
	v_add_f64 v[2:3], v[2:3], v[6:7]
	s_cbranch_scc0 .LBB0_3
	s_branch .LBB0_5
.LBB0_4:
	v_mov_b32_e32 v2, 0
	v_mov_b32_e32 v3, 0
.LBB0_5:                                ; %Flow33
	v_cvt_f64_i32_e32 v[4:5], s5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_scale_f64 v[6:7], null, v[4:5], v[4:5], v[2:3]
	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
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	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[2:3], v[4:5], v[2:3]
	v_mul_f64 v[12:13], v[10:11], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[6:7], -v[6:7], v[12:13], v[10:11]
	v_div_fmas_f64 v[6:7], v[6:7], v[8:9], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_div_fixup_f64 v[3:4], v[6:7], v[4:5], v[2:3]
	v_ashrrev_i32_e32 v2, 31, v1
	v_lshlrev_b64 v[0:1], 3, v[1:2]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	global_store_b64 v[0:1], v[3:4], off
.LBB0_6:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6medvalPdS_ii
		.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 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_end0:
	.size	_Z6medvalPdS_ii, .Lfunc_end0-_Z6medvalPdS_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 356
; 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	_Z12MatrixVecMulPdS_S_S_ii ; -- Begin function _Z12MatrixVecMulPdS_S_S_ii
	.globl	_Z12MatrixVecMulPdS_S_S_ii
	.p2align	8
	.type	_Z12MatrixVecMulPdS_S_S_ii,@function
_Z12MatrixVecMulPdS_S_S_ii:             ; @_Z12MatrixVecMulPdS_S_S_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x34
	s_load_b64 s[8:9], 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 s8, v1
	s_cbranch_execz .LBB1_8
; %bb.1:                                ; %.preheader
	v_ashrrev_i32_e32 v2, 31, v1
	s_cmp_gt_i32 s9, 0
	s_mov_b32 s8, 0
	s_cbranch_scc1 .LBB1_3
; %bb.2:                                ; %.preheader.._crit_edge_crit_edge
	s_mov_b64 s[10:11], 0
	s_branch .LBB1_4
.LBB1_3:
	s_mov_b32 s8, -1
                                        ; implicit-def: $sgpr10_sgpr11
.LBB1_4:                                ; %Flow46
	s_load_b256 s[0:7], s[0:1], 0x0
	v_dual_mov_b32 v3, s10 :: v_dual_mov_b32 v4, s11
	s_and_not1_b32 vcc_lo, exec_lo, s8
	s_cbranch_vccnz .LBB1_7
; %bb.5:                                ; %.lr.ph
	v_lshlrev_b64 v[3:4], 3, v[1:2]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, s6, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s7, v4, vcc_lo
	global_load_b64 v[5:6], v[3:4], off
	v_mul_lo_u32 v3, v1, s9
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v4, 31, v3
	v_lshlrev_b64 v[7:8], 3, v[3:4]
	v_mov_b32_e32 v3, 0
	v_mov_b32_e32 v4, 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v7, vcc_lo, s0, v7
	v_add_co_ci_u32_e32 v8, vcc_lo, s1, v8, vcc_lo
.LBB1_6:                                ; =>This Inner Loop Header: Depth=1
	global_load_b64 v[9:10], v[7:8], off
	s_load_b64 s[0:1], s[2:3], 0x0
	v_add_co_u32 v7, vcc_lo, v7, 8
	s_add_i32 s9, s9, -1
	v_add_co_ci_u32_e32 v8, vcc_lo, 0, v8, vcc_lo
	s_add_u32 s2, s2, 8
	s_addc_u32 s3, s3, 0
	s_cmp_eq_u32 s9, 0
	s_waitcnt vmcnt(0)
	v_add_f64 v[9:10], v[9:10], -v[5:6]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_fma_f64 v[3:4], v[9:10], s[0:1], v[3:4]
	s_cbranch_scc0 .LBB1_6
.LBB1_7:                                ; %Flow47
	v_lshlrev_b64 v[0:1], 3, v[1:2]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s4, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	global_store_b64 v[0:1], v[3:4], off
.LBB1_8:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z12MatrixVecMulPdS_S_S_ii
		.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 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_end1:
	.size	_Z12MatrixVecMulPdS_S_S_ii, .Lfunc_end1-_Z12MatrixVecMulPdS_S_S_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 320
; 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
	.protected	_Z13TMatrixVecMulPdS_S_S_S_iiPf ; -- Begin function _Z13TMatrixVecMulPdS_S_S_S_iiPf
	.globl	_Z13TMatrixVecMulPdS_S_S_S_iiPf
	.p2align	8
	.type	_Z13TMatrixVecMulPdS_S_S_S_iiPf,@function
_Z13TMatrixVecMulPdS_S_S_S_iiPf:        ; @_Z13TMatrixVecMulPdS_S_S_S_iiPf
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x44
	s_load_b64 s[2:3], s[0:1], 0x28
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	s_mov_b32 s4, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB2_10
; %bb.1:                                ; %.preheader
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x10
	s_load_b64 s[8:9], s[0:1], 0x20
	s_cmp_lt_i32 s2, 1
	s_cbranch_scc1 .LBB2_4
; %bb.2:                                ; %.lr.ph.preheader
	s_load_b64 s[10:11], s[0:1], 0x0
	v_mov_b32_e32 v3, 0
	v_dual_mov_b32 v4, 0 :: v_dual_mov_b32 v5, v1
.LBB2_3:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_1)
	v_ashrrev_i32_e32 v6, 31, v5
	s_waitcnt lgkmcnt(0)
	s_load_b64 s[12:13], s[8:9], 0x0
	s_add_i32 s2, s2, -1
	s_add_u32 s8, s8, 8
	s_addc_u32 s9, s9, 0
	v_lshlrev_b64 v[6:7], 3, v[5:6]
	v_add_nc_u32_e32 v5, s3, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v6, vcc_lo, s10, v6
	v_add_co_ci_u32_e32 v7, vcc_lo, s11, v7, vcc_lo
	global_load_b64 v[6:7], v[6:7], off
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_f64 v[6:7], v[6:7], -s[12:13]
	s_load_b64 s[12:13], s[4:5], 0x0
	s_add_u32 s4, s4, 8
	s_addc_u32 s5, s5, 0
	s_cmp_eq_u32 s2, 0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_fma_f64 v[3:4], v[6:7], s[12:13], v[3:4]
	s_cbranch_scc0 .LBB2_3
	s_branch .LBB2_5
.LBB2_4:
	v_mov_b32_e32 v3, 0
	v_mov_b32_e32 v4, 0
.LBB2_5:                                ; %Flow58
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_mul_f64 v[5:6], v[3:4], v[3:4]
	v_ashrrev_i32_e32 v2, 31, v1
	s_mov_b32 s2, exec_lo
	v_lshlrev_b64 v[1:2], 3, v[1:2]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cvt_f32_f64_e32 v0, v[5:6]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v5, vcc_lo, s6, v1
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v6, vcc_lo, s7, v2, vcc_lo
	v_bfrev_b32_e32 v2, 1
	global_store_b64 v[5:6], v[3:4], off
.LBB2_6:                                ; %ComputeLoop
                                        ; =>This Inner Loop Header: Depth=1
	s_ctz_i32_b32 s3, s2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_readlane_b32 s4, v0, s3
	s_lshl_b32 s3, 1, s3
	s_and_not1_b32 s2, s2, s3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_cmp_lg_u32 s2, 0
	v_add_f32_e32 v2, s4, v2
	s_cbranch_scc1 .LBB2_6
; %bb.7:                                ; %ComputeEnd
	v_mbcnt_lo_u32_b32 v0, exec_lo, 0
	s_mov_b32 s2, 0
	s_mov_b32 s3, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v0
	s_xor_b32 s3, exec_lo, s3
	s_cbranch_execz .LBB2_10
; %bb.8:
	s_load_b64 s[0:1], s[0:1], 0x30
	v_mov_b32_e32 v3, 0
	s_waitcnt lgkmcnt(0)
	global_load_b32 v1, v3, s[0:1]
.LBB2_9:                                ; %atomicrmw.start
                                        ; =>This Inner Loop Header: Depth=1
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v0, v1, v2
	global_atomic_cmpswap_b32 v0, v3, v[0:1], s[0:1] glc
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, v0, v1
	v_mov_b32_e32 v1, v0
	s_or_b32 s2, vcc_lo, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s2
	s_cbranch_execnz .LBB2_9
.LBB2_10:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13TMatrixVecMulPdS_S_S_S_iiPf
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 312
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 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_end2:
	.size	_Z13TMatrixVecMulPdS_S_S_S_iiPf, .Lfunc_end2-_Z13TMatrixVecMulPdS_S_S_S_iiPf
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 460
; 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	_Z10DivideNormPdPfi     ; -- Begin function _Z10DivideNormPdPfi
	.globl	_Z10DivideNormPdPfi
	.p2align	8
	.type	_Z10DivideNormPdPfi,@function
_Z10DivideNormPdPfi:                    ; @_Z10DivideNormPdPfi
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b32 s3, 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[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB3_2
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 3, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_load_b32 s0, s[2:3], 0x0
	global_load_b64 v[2:3], v[0:1], off
	s_waitcnt lgkmcnt(0)
	v_mul_f32_e64 v4, 0x4f800000, s0
	v_cmp_gt_f32_e64 vcc_lo, 0xf800000, s0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v4, s0, v4, vcc_lo
	v_sqrt_f32_e32 v5, v4
	s_waitcnt_depctr 0xfff
	v_add_nc_u32_e32 v7, 1, v5
	v_add_nc_u32_e32 v6, -1, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v9, -v7, v5, v4
	v_fma_f32 v8, -v6, v5, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_ge_f32_e64 s0, 0, v8
	v_cndmask_b32_e64 v5, v5, v6, s0
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_lt_f32_e64 s0, 0, v9
	v_cndmask_b32_e64 v5, v5, v7, s0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v6, 0x37800000, v5
	v_cndmask_b32_e32 v5, v5, v6, vcc_lo
	v_cmp_class_f32_e64 vcc_lo, v4, 0x260
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v4, v5, v4, vcc_lo
	v_cvt_f64_f32_e32 v[4:5], v4
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_scale_f64 v[6:7], null, v[4:5], v[4:5], v[2:3]
	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
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	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[2:3], v[4:5], v[2:3]
	v_mul_f64 v[12:13], v[10:11], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[6:7], -v[6:7], v[12:13], v[10:11]
	v_div_fmas_f64 v[6:7], v[6:7], v[8:9], v[12:13]
	s_delay_alu instid0(VALU_DEP_1)
	v_div_fixup_f64 v[2:3], v[6:7], v[4:5], v[2:3]
	global_store_b64 v[0:1], v[2:3], off
.LBB3_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10DivideNormPdPfi
		.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 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_end3:
	.size	_Z10DivideNormPdPfi, .Lfunc_end3-_Z10DivideNormPdPfi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 404
; 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	_Z12CalculateEpsPdS_S_Pfi ; -- Begin function _Z12CalculateEpsPdS_S_Pfi
	.globl	_Z12CalculateEpsPdS_S_Pfi
	.p2align	8
	.type	_Z12CalculateEpsPdS_S_Pfi,@function
_Z12CalculateEpsPdS_S_Pfi:              ; @_Z12CalculateEpsPdS_S_Pfi
; %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 .LBB4_6
; %bb.1:
	s_load_b256 s[0:7], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_mov_b32 s8, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 3, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v3, vcc_lo, s0, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v2, vcc_lo
	v_add_co_u32 v5, vcc_lo, s2, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s3, v2, vcc_lo
	global_load_b64 v[3:4], v[3:4], off
	global_load_b64 v[5:6], v[5:6], off
	s_waitcnt vmcnt(0)
	v_add_f64 v[3:4], v[3:4], -v[5:6]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[5:6], v[3:4], v[3:4]
	v_cvt_f32_f64_e32 v0, v[5:6]
	v_add_co_u32 v5, vcc_lo, s4, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s5, v2, vcc_lo
	v_bfrev_b32_e32 v2, 1
	global_store_b64 v[5:6], v[3:4], off
.LBB4_2:                                ; %ComputeLoop
                                        ; =>This Inner Loop Header: Depth=1
	s_ctz_i32_b32 s0, s8
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_readlane_b32 s1, v0, s0
	s_lshl_b32 s0, 1, s0
	s_and_not1_b32 s8, s8, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_cmp_lg_u32 s8, 0
	v_add_f32_e32 v2, s1, v2
	s_cbranch_scc1 .LBB4_2
; %bb.3:                                ; %ComputeEnd
	v_mbcnt_lo_u32_b32 v0, exec_lo, 0
	s_mov_b32 s0, 0
	s_mov_b32 s1, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v0
	s_xor_b32 s1, exec_lo, s1
	s_cbranch_execz .LBB4_6
; %bb.4:
	v_mov_b32_e32 v3, 0
	global_load_b32 v1, v3, s[6:7]
.LBB4_5:                                ; %atomicrmw.start
                                        ; =>This Inner Loop Header: Depth=1
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v0, v1, v2
	global_atomic_cmpswap_b32 v0, v3, v[0:1], s[6:7] glc
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, v0, v1
	v_mov_b32_e32 v1, v0
	s_or_b32 s0, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s0
	s_cbranch_execnz .LBB4_5
.LBB4_6:                                ; %Flow30
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z12CalculateEpsPdS_S_Pfi
		.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 7
		.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_end4:
	.size	_Z12CalculateEpsPdS_S_Pfi, .Lfunc_end4-_Z12CalculateEpsPdS_S_Pfi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 328
; NumSgprs: 18
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 7
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

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

	.end_amdgpu_metadata
