#include "cuda.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#define SIZE 900
#define HIDDINLAYERS 2
#define POINTS 583
#define TEST 100
#define ATTRIBUTES 10
static void HandleError( cudaError_t err,
                         const char *file,
                         int line ) {
    if (err != cudaSuccess) {
        printf( "%s in %s at line %d\n", cudaGetErrorString( err ),
                file, line );
        exit( EXIT_FAILURE );
    }
}
#define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ ))

// various squashing functions 
__device__ __host__ float g(float value) {
	return 1.0/(1.0+exp(-value));
}
__device__ __host__ float gSquash(float value) {
	if (value<0.5) return 0.0;
	else return 1.0;
}
__device__ __host__ float gPrime(float value){
	float a = g(value);
	return a;
}

// used for testing before and after training
// preforms forward propagation 
__host__ void gLayer2(float *weights, float *values, float *outputs, float *in, float *bias, int weightsLen, int outputsLen){
	for (int i = 0; i < outputsLen; ++i)
	{
		in[i]=0;
		for (int j = 0; j < weightsLen; ++j)
		{
			in[i]+= values[j]*weights[j+SIZE*i];
		}
		in[i] += bias[i];
		outputs[i] =g(in[i]);
	}
}

// preforms back propagation on gpu
__global__ void gLayerBack(float *weights, float *delta, float *outputs, float *in, int inputLen, int outputsLen){
	float temp;
	int i = threadIdx.x + blockDim.x * blockIdx.x;
	while(i < outputsLen)
	{
		temp=0.0;
		for (int j = 0; j < inputLen; ++j)
		{
			temp+=delta[j]*weights[j+SIZE*i];
		}
		
		outputs[i] = gPrime(in[i])*temp;
		i += gridDim.x*blockDim.x;
	}
}

// preforms forward propagation on gpu
__global__ void gLayer(float *weights, float *values, float *outputs, float *in, float *bias, int weightsLen, int outputsLen){
	float temp;
	int i = threadIdx.x + blockDim.x * blockIdx.x;
	while(i < outputsLen) {
		temp=0;
		for (int j = 0; j < weightsLen; ++j)
		{
			temp+= values[j]*weights[j+SIZE*i];
		}
		in[i] = temp+bias[i];
		outputs[i] =g(in[i]);
		i += gridDim.x*blockDim.x;
	}
}

// updates weights once deltas have been calculated
__global__ void updateWeight(float *weights, float *values, float *delta, float learningRate, int inputLen, int outputLen){
	int i = threadIdx.x + blockDim.x * blockIdx.x;
	int j = threadIdx.y + blockDim.y * blockIdx.y;
	while(i < outputLen)
	{
		while (j < inputLen)
		{
			weights[j+SIZE*i]+= learningRate*values[i]*delta[j];
			j += gridDim.y*blockDim.y;
		}
		j = threadIdx.y + blockDim.y * blockIdx.y;
		i += gridDim.x*blockDim.x;
	}
}

// used for prepping for back propagation 
__global__ void deltaInit(float *delta, float *in, float *dataSet, float *values){
	delta[0] = gPrime(in[0])*(dataSet[ATTRIBUTES-1]-values[0]);
}

// used for prepping for forward propagation
__global__ void valueInit(float *values, float *dataSet, int i){
	values[i] = dataSet[i];
}

int main(int argc, char const *argv[])
{
	FILE *fp=NULL, *inFile=NULL;
	clock_t t;
	srand (time(NULL));
	float weights[(HIDDINLAYERS+1)][SIZE*SIZE]; // each node in a layer conects to all nodes in the previous layer
	float bias[(HIDDINLAYERS+1)][SIZE]; // all nodes other than the input layer
	float values[(HIDDINLAYERS+2)][SIZE]; // holds the results of the last input
	float in[(HIDDINLAYERS+1)][SIZE]; // values before squashing
	float dataSet[(POINTS+TEST)][ATTRIBUTES]; // holds datafile
	float learningRate = 0.3;
	float learningTime = 50;
	float *weights_d[(HIDDINLAYERS+1)], *bias_d[(HIDDINLAYERS+1)], *values_d[(HIDDINLAYERS+2)], *in_d[(HIDDINLAYERS+1)], *delta_d[(HIDDINLAYERS+1)], *dataSet_d[(POINTS+TEST)];

	// read in data
	inFile=fopen("data/breast-cancer-wisconsin.data","r");
	for (int i = 0; i < POINTS+TEST; ++i)
	{
		for (int j = 0; j < ATTRIBUTES; ++j)
		{
			// update indexes
			fscanf(inFile,"%f",&(dataSet[i][j]));
			if (j==ATTRIBUTES-1){
				if (dataSet[i][j]==4.0) dataSet[i][j]=1.0;
				else dataSet[i][j] = 0.0;
			} 
		}
	}
	fclose(inFile);


	// initialize weights
	for(int i=0; i<HIDDINLAYERS+1; i++) {
		for (int j = 0; j < SIZE; ++j)
		{
			for (int l = 0; l < SIZE; ++l)
			{
				weights[i][l+SIZE*j] = ((float) rand() / (RAND_MAX/2))-1;
			}
			bias[i][j] = ((float) rand() / (RAND_MAX/2))-1;
		}	
	}

	// check results pre training
	int outputLen=SIZE;
	int inputLen=SIZE;
	float correct = 0.0;
	for (int j=POINTS; j<TEST+POINTS; j++){
		for (int i=0; i<ATTRIBUTES-1; i++) {
			values[0][i] = dataSet[j][i];
		}
		for (int i = 0; i < HIDDINLAYERS+1; ++i)
		{
			outputLen=SIZE;
			inputLen=SIZE;
			if (i == HIDDINLAYERS) outputLen = 1; // result layer
			if (i == 0) inputLen = (ATTRIBUTES-1); // data set layer
			gLayer2(weights[i], values[i], values[i+1], in[i], bias[i], inputLen, outputLen);
		}
		if (dataSet[j][ATTRIBUTES-1]==gSquash(values[HIDDINLAYERS+1][0])) correct += 1;
	}
	correct = ((float) correct/TEST);
	printf("%f\n", correct);

	// allocate/mem copy space on device
	for (int i = 0; i < (HIDDINLAYERS+1); ++i)
	{
		HANDLE_ERROR(cudaMalloc((void **) &weights_d[i], sizeof(float)*SIZE*SIZE));
		HANDLE_ERROR(cudaMemcpy(weights_d[i], weights[i], sizeof(float)*SIZE*SIZE, cudaMemcpyHostToDevice));		
		HANDLE_ERROR(cudaMalloc((void **) &bias_d[i], sizeof(float)*SIZE));
		HANDLE_ERROR(cudaMemcpy(bias_d[i], bias[i], sizeof(float)*SIZE, cudaMemcpyHostToDevice));
		HANDLE_ERROR(cudaMalloc((void **) &in_d[i], sizeof(float)*SIZE));
		HANDLE_ERROR(cudaMalloc((void **) &delta_d[i], sizeof(float)*SIZE));
	
	}
	for (int i = 0; i < (HIDDINLAYERS+2); ++i)
	{
		HANDLE_ERROR(cudaMalloc((void **) &values_d[i], sizeof(float)*SIZE));
	}
	for (int i = 0; i < (POINTS+TEST); ++i)
	{
		HANDLE_ERROR(cudaMalloc((void **) &dataSet_d[i], sizeof(float)*ATTRIBUTES));
		HANDLE_ERROR(cudaMemcpy(dataSet_d[i], dataSet[i], sizeof(float)*ATTRIBUTES, cudaMemcpyHostToDevice));
	}

	// initialize kernel launches
	dim3 dimBlock1(32,1);
    dim3 dimGrid1(SIZE/32+1,1);
    dim3 dimBlock2(1,1);
    dim3 dimGrid2(1,1);
    dim3 dimBlock3(16,16);
    dim3 dimGrid3(SIZE/16+1,SIZE/16+1);

    // time training
    t = clock();
	for (int timeStep=0; timeStep<learningTime; timeStep++) {
		
		for (int point=0; point<POINTS; point++) {

			// get current data set
			for (int i=0; i<ATTRIBUTES-1; i++) {
				valueInit<<<dimGrid2,dimBlock2>>>(values_d[0], dataSet_d[point], i);
				HANDLE_ERROR(cudaGetLastError());
			}

			// forward prop
			for (int i = 0; i < HIDDINLAYERS+1; ++i)
			{
				outputLen=SIZE;
				inputLen=SIZE;
				if (i == HIDDINLAYERS) outputLen = 1; // result layer
				if (i == 0) inputLen = (ATTRIBUTES-1); // data set layer
				gLayer<<<dimGrid1,dimBlock1>>>(weights_d[i], values_d[i], values_d[i+1], in_d[i], bias_d[i], inputLen, outputLen);
				HANDLE_ERROR(cudaGetLastError());
			}

			// back prop 
			deltaInit<<<dimGrid2,dimBlock2>>>(delta_d[HIDDINLAYERS], in_d[HIDDINLAYERS], dataSet_d[point], values_d[HIDDINLAYERS+1]);
			HANDLE_ERROR(cudaGetLastError());

			// error in previous layers
			
			for (int i = HIDDINLAYERS-1; i > -1; i--)
			{
				outputLen=SIZE;
				inputLen=SIZE;
				if (i == HIDDINLAYERS-1) outputLen = (ATTRIBUTES-1); // data set layer
				if (i == 0) inputLen = 1; // result layer
				gLayerBack<<<dimGrid1,dimBlock1>>>(weights_d[i+1], delta_d[i+1], delta_d[i], in_d[i], inputLen, outputLen);
				HANDLE_ERROR(cudaGetLastError());
			}

			// update weights
			for (int i = 0; i < HIDDINLAYERS+1; ++i)
			{
				outputLen=SIZE; 
				inputLen=SIZE;
				if (i == HIDDINLAYERS) outputLen = 1; // result layer
				if (i == 0) inputLen = (ATTRIBUTES-1); // data set layer
				updateWeight<<<dimGrid3,dimBlock3>>>(weights_d[i], values_d[i], delta_d[i], learningRate, inputLen, outputLen);
				HANDLE_ERROR(cudaGetLastError());
			}
		}
	}
	t = clock() - t;
	// mem copy 
	for (int i = 0; i < (HIDDINLAYERS+1); ++i)
	{
		HANDLE_ERROR(cudaMemcpy(weights[i], weights_d[i], sizeof(float)*SIZE*SIZE, cudaMemcpyDeviceToHost));
		// HANDLE_ERROR(cudaMemcpy(weights[i], weights_d[i], sizeof(float)*SIZE*SIZE, cudaMemcpyDeviceToHost));
		HANDLE_ERROR(cudaMemcpy(bias[i], bias_d[i], sizeof(float)*SIZE, cudaMemcpyDeviceToHost));
	}

	// free pointers
	for (int i = 0; i < (HIDDINLAYERS+1); ++i)
	{
		HANDLE_ERROR(cudaFree(weights_d[i]));
		HANDLE_ERROR(cudaFree(bias_d[i]));
		HANDLE_ERROR(cudaFree(in_d[i]));
		HANDLE_ERROR(cudaFree(delta_d[i]));	
	}
	for (int i = 0; i < (HIDDINLAYERS+2); ++i)
	{
		HANDLE_ERROR(cudaFree(values_d[i]));
	}
	for (int i = 0; i < (POINTS+TEST); ++i)
	{
		HANDLE_ERROR(cudaFree(dataSet_d[i]));
	}
	
    

    // save runtime
	fp=fopen("data/parallel.dat", "a");
    fprintf (fp, "%d\t%f\n", SIZE,((float)t)/CLOCKS_PER_SEC);
    fclose(fp);

    // post training results
    correct = 0.0;
	for (int j=POINTS; j<TEST+POINTS; j++){
		for (int i=0; i<ATTRIBUTES-1; i++) {
			values[0][i] = dataSet[j][i];
		}
		for (int i = 0; i < HIDDINLAYERS+1; ++i)
		{
			outputLen=SIZE;
			inputLen=SIZE;
			if (i == HIDDINLAYERS) outputLen = 1; // result layer
			if (i == 0) inputLen = (ATTRIBUTES-1); // data set layer
			gLayer2(weights[i], values[i], values[i+1], in[i], bias[i], inputLen, outputLen);
		}
		if (dataSet[j][ATTRIBUTES-1]==gSquash(values[HIDDINLAYERS+1][0])) correct += 1;
	}
	correct = ((float) correct/TEST);
	printf("%f\n", correct);
	return 0;
}
	.file	"tmpxft_0037512b_00000000-6_parallel.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2035:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2035:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/Joel-Venzke/parallel_neural_network/master/src/parallel.cu"
.LC1:
	.string	"%s in %s at line %d\n"
	.text
	.type	_ZL11HandleError9cudaErrorPKci.constprop.0, @function
_ZL11HandleError9cudaErrorPKci.constprop.0:
.LFB2185:
	.cfi_startproc
	testl	%edi, %edi
	je	.L2
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	%esi, 12(%rsp)
	call	cudaGetErrorString@PLT
	movl	12(%rsp), %r8d
	movl	$2, %edi
	leaq	.LC0(%rip), %rcx
	movq	%rax, %rdx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2185:
	.size	_ZL11HandleError9cudaErrorPKci.constprop.0, .-_ZL11HandleError9cudaErrorPKci.constprop.0
	.globl	_Z1gf
	.type	_Z1gf, @function
_Z1gf:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	xorps	.LC2(%rip), %xmm0
	call	expf@PLT
	movsd	.LC3(%rip), %xmm1
	popq	%rdx
	.cfi_def_cfa_offset 8
	cvtss2sd	%xmm0, %xmm0
	addsd	%xmm1, %xmm0
	divsd	%xmm0, %xmm1
	cvtsd2ss	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z1gf, .-_Z1gf
	.globl	_Z7gSquashf
	.type	_Z7gSquashf, @function
_Z7gSquashf:
.LFB2029:
	.cfi_startproc
	endbr64
	movss	.LC6(%rip), %xmm1
	comiss	%xmm0, %xmm1
	jbe	.L15
	xorps	%xmm0, %xmm0
	ret
.L15:
	movss	.LC5(%rip), %xmm0
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z7gSquashf, .-_Z7gSquashf
	.globl	_Z6gPrimef
	.type	_Z6gPrimef, @function
_Z6gPrimef:
.LFB2030:
	.cfi_startproc
	endbr64
	jmp	_Z1gf
	.cfi_endproc
.LFE2030:
	.size	_Z6gPrimef, .-_Z6gPrimef
	.globl	_Z7gLayer2PfS_S_S_S_ii
	.type	_Z7gLayer2PfS_S_S_S_ii, @function
_Z7gLayer2PfS_S_S_S_ii:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%r9d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rcx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
.L18:
	cmpl	%ebx, 80(%rsp)
	jle	.L23
	imull	$900, %ebx, %eax
	xorps	%xmm0, %xmm0
	cltq
	leaq	(%r12,%rax,4), %rdx
	xorl	%eax, %eax
.L19:
	movss	%xmm0, 0(%rbp,%rbx,4)
	cmpl	%eax, %r13d
	jle	.L24
	movss	(%r14,%rax,4), %xmm1
	mulss	(%rdx,%rax,4), %xmm1
	incq	%rax
	addss	%xmm1, %xmm0
	jmp	.L19
.L24:
	addss	(%r8,%rbx,4), %xmm0
	movq	%r8, 8(%rsp)
	movss	%xmm0, 0(%rbp,%rbx,4)
	call	_Z1gf
	movq	8(%rsp), %r8
	movss	%xmm0, (%r15,%rbx,4)
	incq	%rbx
	jmp	.L18
.L23:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z7gLayer2PfS_S_S_S_ii, .-_Z7gLayer2PfS_S_S_S_ii
	.globl	_Z38__device_stub__Z10gLayerBackPfS_S_S_iiPfS_S_S_ii
	.type	_Z38__device_stub__Z10gLayerBackPfS_S_S_iiPfS_S_S_ii, @function
_Z38__device_stub__Z10gLayerBackPfS_S_S_iiPfS_S_S_ii:
.LFB2057:
	.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	.L25
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z10gLayerBackPfS_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
.L25:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2057:
	.size	_Z38__device_stub__Z10gLayerBackPfS_S_S_iiPfS_S_S_ii, .-_Z38__device_stub__Z10gLayerBackPfS_S_S_iiPfS_S_S_ii
	.globl	_Z10gLayerBackPfS_S_S_ii
	.type	_Z10gLayerBackPfS_S_S_ii, @function
_Z10gLayerBackPfS_S_S_ii:
.LFB2058:
	.cfi_startproc
	endbr64
	jmp	_Z38__device_stub__Z10gLayerBackPfS_S_S_iiPfS_S_S_ii
	.cfi_endproc
.LFE2058:
	.size	_Z10gLayerBackPfS_S_S_ii, .-_Z10gLayerBackPfS_S_S_ii
	.globl	_Z35__device_stub__Z6gLayerPfS_S_S_S_iiPfS_S_S_S_ii
	.type	_Z35__device_stub__Z6gLayerPfS_S_S_S_iiPfS_S_S_S_ii, @function
_Z35__device_stub__Z6gLayerPfS_S_S_S_iiPfS_S_S_S_ii:
.LFB2059:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	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
	movq	%r8, 8(%rsp)
	movl	%r9d, 4(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%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	8(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	192(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L30
	pushq	56(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z6gLayerPfS_S_S_S_ii(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 208
	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 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L30:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2059:
	.size	_Z35__device_stub__Z6gLayerPfS_S_S_S_iiPfS_S_S_S_ii, .-_Z35__device_stub__Z6gLayerPfS_S_S_S_iiPfS_S_S_S_ii
	.globl	_Z6gLayerPfS_S_S_S_ii
	.type	_Z6gLayerPfS_S_S_S_ii, @function
_Z6gLayerPfS_S_S_S_ii:
.LFB2060:
	.cfi_startproc
	endbr64
	jmp	_Z35__device_stub__Z6gLayerPfS_S_S_S_iiPfS_S_S_S_ii
	.cfi_endproc
.LFE2060:
	.size	_Z6gLayerPfS_S_S_S_ii, .-_Z6gLayerPfS_S_S_S_ii
	.globl	_Z39__device_stub__Z12updateWeightPfS_S_fiiPfS_S_fii
	.type	_Z39__device_stub__Z12updateWeightPfS_S_fiiPfS_S_fii, @function
_Z39__device_stub__Z12updateWeightPfS_S_fiiPfS_S_fii:
.LFB2061:
	.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
	movl	%ecx, 16(%rsp)
	leaq	64(%rsp), %rcx
	movl	%r8d, 12(%rsp)
	movss	%xmm0, 20(%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	20(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	12(%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	.L35
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z12updateWeightPfS_S_fii(%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
.L35:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2061:
	.size	_Z39__device_stub__Z12updateWeightPfS_S_fiiPfS_S_fii, .-_Z39__device_stub__Z12updateWeightPfS_S_fiiPfS_S_fii
	.globl	_Z12updateWeightPfS_S_fii
	.type	_Z12updateWeightPfS_S_fii, @function
_Z12updateWeightPfS_S_fii:
.LFB2062:
	.cfi_startproc
	endbr64
	jmp	_Z39__device_stub__Z12updateWeightPfS_S_fiiPfS_S_fii
	.cfi_endproc
.LFE2062:
	.size	_Z12updateWeightPfS_S_fii, .-_Z12updateWeightPfS_S_fii
	.globl	_Z34__device_stub__Z9deltaInitPfS_S_S_PfS_S_S_
	.type	_Z34__device_stub__Z9deltaInitPfS_S_S_PfS_S_S_, @function
_Z34__device_stub__Z9deltaInitPfS_S_S_PfS_S_S_:
.LFB2063:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%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	.L40
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z9deltaInitPfS_S_S_(%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
.L40:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L42
	call	__stack_chk_fail@PLT
.L42:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2063:
	.size	_Z34__device_stub__Z9deltaInitPfS_S_S_PfS_S_S_, .-_Z34__device_stub__Z9deltaInitPfS_S_S_PfS_S_S_
	.globl	_Z9deltaInitPfS_S_S_
	.type	_Z9deltaInitPfS_S_S_, @function
_Z9deltaInitPfS_S_S_:
.LFB2064:
	.cfi_startproc
	endbr64
	jmp	_Z34__device_stub__Z9deltaInitPfS_S_S_PfS_S_S_
	.cfi_endproc
.LFE2064:
	.size	_Z9deltaInitPfS_S_S_, .-_Z9deltaInitPfS_S_S_
	.globl	_Z31__device_stub__Z9valueInitPfS_iPfS_i
	.type	_Z31__device_stub__Z9valueInitPfS_iPfS_i, @function
_Z31__device_stub__Z9valueInitPfS_iPfS_i:
.LFB2065:
	.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	.L45
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z9valueInitPfS_i(%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
.L45:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L47
	call	__stack_chk_fail@PLT
.L47:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2065:
	.size	_Z31__device_stub__Z9valueInitPfS_iPfS_i, .-_Z31__device_stub__Z9valueInitPfS_iPfS_i
	.globl	_Z9valueInitPfS_i
	.type	_Z9valueInitPfS_i, @function
_Z9valueInitPfS_i:
.LFB2066:
	.cfi_startproc
	endbr64
	jmp	_Z31__device_stub__Z9valueInitPfS_iPfS_i
	.cfi_endproc
.LFE2066:
	.size	_Z9valueInitPfS_i, .-_Z9valueInitPfS_i
	.section	.rodata.str1.1
.LC7:
	.string	"r"
.LC8:
	.string	"data/breast-cancer-wisconsin.data"
.LC9:
	.string	"%f"
.LC13:
	.string	"%f\n"
.LC15:
	.string	"a"
.LC16:
	.string	"data/parallel.dat"
.LC18:
	.string	"%d\t%f\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2032:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-9785344(%rsp), %r11
	.cfi_def_cfa 11, 9785400
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3720, %rsp
	.cfi_def_cfa_offset 9789120
	xorl	%edi, %edi
	xorl	%r12d, %r12d
	leaq	.LC9(%rip), %r15
	movq	%fs:40, %rax
	movq	%rax, 9789048(%rsp)
	xorl	%eax, %eax
	leaq	41728(%rsp), %rbx
	call	time@PLT
	movq	%rbx, %rbp
	movl	%eax, %edi
	call	srand@PLT
	leaq	.LC8(%rip), %rdi
	leaq	.LC7(%rip), %rsi
	call	fopen@PLT
	movq	%rax, %rdi
.L51:
	movq	%rbp, %r14
	xorl	%r13d, %r13d
.L55:
	xorl	%eax, %eax
	movq	%r14, %rdx
	movq	%r15, %rsi
	movq	%rdi, (%rsp)
	call	__isoc23_fscanf@PLT
	cmpl	$9, %r13d
	movq	(%rsp), %rdi
	jne	.L52
	movss	36(%rbp), %xmm0
	ucomiss	.LC10(%rip), %xmm0
	jp	.L53
	jne	.L53
	movl	$0x3f800000, 36(%rbp)
	jmp	.L52
.L53:
	movl	$0x00000000, 36(%rbp)
.L52:
	incl	%r13d
	addq	$4, %r14
	cmpl	$10, %r13d
	jne	.L55
	addq	$10, %r12
	addq	$40, %rbp
	cmpq	$6830, %r12
	jne	.L51
	call	fclose@PLT
	leaq	5728(%rsp), %rax
	xorl	%ebp, %ebp
	movq	%rax, (%rsp)
	movq	%rax, %r14
.L57:
	leaq	69048(%rsp), %rax
	movq	%r14, %r13
	xorl	%r12d, %r12d
	movq	%rax, 8(%rsp)
	leaq	0(%rbp,%rax), %r15
.L61:
	xorl	%edx, %edx
.L58:
	movq	%rdx, 16(%rsp)
	call	rand@PLT
	movq	16(%rsp), %rdx
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC11(%rip), %xmm0
	subss	.LC5(%rip), %xmm0
	movss	%xmm0, (%r15,%rdx,4)
	incq	%rdx
	cmpq	$900, %rdx
	jne	.L58
	call	rand@PLT
	addl	$900, %r12d
	addq	$4, %r13
	addq	$3600, %r15
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC11(%rip), %xmm0
	subss	.LC5(%rip), %xmm0
	movss	%xmm0, -4(%r13)
	cmpl	$810000, %r12d
	jne	.L61
	addq	$3240000, %rbp
	addq	$3600, %r14
	cmpq	$9720000, %rbp
	jne	.L57
	leaq	27320(%rbx), %rax
	leaq	65048(%rsp), %rbp
	xorps	%xmm0, %xmm0
	movq	%rax, 40(%rsp)
	movq	%rbp, %r12
.L60:
	movl	$9, %ecx
	movq	%r12, %rsi
	movq	(%rsp), %r8
	xorl	%r14d, %r14d
	leaq	27328(%rsp), %rax
	movq	8(%rsp), %r15
	movq	%rax, 16(%rsp)
	movq	%rax, %rdi
	leaq	16528(%rsp), %rax
	rep movsl
	movq	%rax, 32(%rsp)
	movq	16(%rsp), %rsi
	movq	%rax, %r13
.L63:
	cmpl	$2, %r14d
	je	.L101
	cmpl	$1, %r14d
	movl	$900, %edx
	sbbl	%r9d, %r9d
	andl	$-891, %r9d
	addl	$900, %r9d
	jmp	.L62
.L101:
	movl	$1, %edx
	movl	$900, %r9d
.L62:
	leaq	3600(%rsi), %rax
	movq	%r13, %rcx
	movq	%r15, %rdi
	incl	%r14d
	movq	%rax, 24(%rsp)
	addq	$3240000, %r15
	addq	$3600, %r13
	movss	%xmm0, 56(%rsp)
	pushq	%rax
	.cfi_def_cfa_offset 9789128
	pushq	%rdx
	.cfi_def_cfa_offset 9789136
	movq	40(%rsp), %rdx
	movq	%r8, 64(%rsp)
	call	_Z7gLayer2PfS_S_S_S_ii
	movq	64(%rsp), %r8
	popq	%rax
	.cfi_def_cfa_offset 9789128
	popq	%rdx
	.cfi_def_cfa_offset 9789120
	movss	56(%rsp), %xmm0
	addq	$3600, %r8
	cmpl	$3, %r14d
	je	.L134
	movq	24(%rsp), %rsi
	jmp	.L63
.L134:
	movss	38128(%rsp), %xmm1
	movss	.LC5(%rip), %xmm4
	movss	36(%r12), %xmm2
	cmpltss	.LC6(%rip), %xmm1
	andnps	%xmm4, %xmm1
	ucomiss	%xmm1, %xmm2
	jp	.L66
	jne	.L66
	addss	%xmm4, %xmm0
.L66:
	movq	40(%rsp), %rax
	addq	$40, %r12
	cmpq	%rax, %r12
	jne	.L60
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	xorl	%r12d, %r12d
	divss	.LC12(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	8(%rsp), %r13
	leaq	136(%rsp), %r14
.L69:
	leaq	(%r14,%r12), %rdi
	movl	$3240000, %esi
	call	cudaMalloc@PLT
	movl	$176, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movq	(%r12,%r14), %rdi
	movl	$1, %ecx
	movq	%r13, %rsi
	movl	$3240000, %edx
	addq	$3240000, %r13
	call	cudaMemcpy@PLT
	movl	$177, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	leaq	160(%rsp,%r12), %rdi
	movl	$3600, %esi
	call	cudaMalloc@PLT
	movl	$178, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	imulq	$450, %r12, %rsi
	movq	(%rsp), %rax
	movq	160(%rsp,%r12), %rdi
	movl	$1, %ecx
	movl	$3600, %edx
	addq	%rax, %rsi
	call	cudaMemcpy@PLT
	movl	$179, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	leaq	184(%rsp,%r12), %rdi
	movl	$3600, %esi
	call	cudaMalloc@PLT
	movl	$180, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	leaq	208(%rsp,%r12), %rdi
	movl	$3600, %esi
	addq	$8, %r12
	call	cudaMalloc@PLT
	movl	$181, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	cmpq	$24, %r12
	jne	.L69
	leaq	232(%rsp), %r13
	leaq	264(%rsp), %r12
.L70:
	movq	%r13, %rdi
	movl	$3600, %esi
	addq	$8, %r13
	call	cudaMalloc@PLT
	movl	$186, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	cmpq	%r12, %r13
	jne	.L70
	leaq	5728(%rsp), %r14
	movq	%r12, %r13
.L71:
	movq	%r13, %rdi
	movl	$40, %esi
	addq	$8, %r13
	call	cudaMalloc@PLT
	movl	$190, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movq	-8(%r13), %rdi
	movq	%rbx, %rsi
	movl	$1, %ecx
	movl	$40, %edx
	addq	$40, %rbx
	call	cudaMemcpy@PLT
	movl	$191, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	cmpq	%r14, %r13
	jne	.L71
	movl	$134217729, %eax
	movl	$1, 72(%rsp)
	salq	$5, %rax
	movl	$1, 84(%rsp)
	movq	%rax, 64(%rsp)
	subq	$3, %rax
	movq	%rax, 76(%rsp)
	subq	$28, %rax
	movq	%rax, 88(%rsp)
	movq	%rax, 100(%rsp)
	movabsq	$68719476752, %rax
	movq	%rax, 112(%rsp)
	movabsq	$244813135929, %rax
	movl	$1, 96(%rsp)
	movl	$1, 108(%rsp)
	movl	$1, 120(%rsp)
	movq	%rax, 124(%rsp)
	movl	$1, 132(%rsp)
	call	clock@PLT
	xorl	%r11d, %r11d
	movq	%rax, 48(%rsp)
	movl	%r11d, 24(%rsp)
.L72:
	cmpl	$50, 24(%rsp)
	je	.L86
	leaq	4664(%r12), %rax
	movq	%r12, %rbx
	movq	%rax, 56(%rsp)
.L87:
	xorl	%r13d, %r13d
.L74:
	movl	96(%rsp), %ecx
	movq	88(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	100(%rsp), %rdi
	movl	108(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L73
	movq	(%rbx), %rsi
	movq	232(%rsp), %rdi
	movl	%r13d, %edx
	call	_Z31__device_stub__Z9valueInitPfS_iPfS_i
.L73:
	call	cudaGetLastError@PLT
	incl	%r13d
	movl	$211, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	cmpl	$9, %r13d
	jne	.L74
	xorl	%r13d, %r13d
.L77:
	cmpq	$2, %r13
	je	.L105
	cmpq	$1, %r13
	movl	$900, %r15d
	sbbl	%r14d, %r14d
	andl	$-891, %r14d
	addl	$900, %r14d
	jmp	.L75
.L105:
	movl	$1, %r15d
	movl	$900, %r14d
.L75:
	movl	72(%rsp), %ecx
	movq	64(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	76(%rsp), %rdi
	movl	84(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L76
	movq	184(%rsp,%r13,8), %rcx
	movq	240(%rsp,%r13,8), %rdx
	movl	%r14d, %r9d
	movq	232(%rsp,%r13,8), %rsi
	movq	136(%rsp,%r13,8), %rdi
	pushq	%r8
	.cfi_def_cfa_offset 9789128
	pushq	%r15
	.cfi_def_cfa_offset 9789136
	movq	176(%rsp,%r13,8), %r8
	call	_Z35__device_stub__Z6gLayerPfS_S_S_S_iiPfS_S_S_S_ii
	popq	%r9
	.cfi_def_cfa_offset 9789128
	popq	%r10
	.cfi_def_cfa_offset 9789120
.L76:
	call	cudaGetLastError@PLT
	incq	%r13
	movl	$222, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	cmpq	$3, %r13
	jne	.L77
	movl	96(%rsp), %ecx
	movq	88(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	100(%rsp), %rdi
	movl	108(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L78
	movq	256(%rsp), %rcx
	movq	(%rbx), %rdx
	movq	200(%rsp), %rsi
	movq	224(%rsp), %rdi
	call	_Z34__device_stub__Z9deltaInitPfS_S_S_PfS_S_S_
.L78:
	call	cudaGetLastError@PLT
	movl	$227, %esi
	movl	$1, %r15d
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
.L81:
	cmpl	$1, %r15d
	movl	$900, %eax
	movl	$9, %r14d
	movl	$1, %r13d
	movl	72(%rsp), %ecx
	movl	84(%rsp), %esi
	cmovne	%eax, %r14d
	cmove	%eax, %r13d
	movq	64(%rsp), %rdx
	movq	76(%rsp), %rdi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L80
	movq	184(%rsp,%r15,8), %rcx
	movl	%r14d, %r9d
	movl	%r13d, %r8d
	movq	208(%rsp,%r15,8), %rdx
	movq	216(%rsp,%r15,8), %rsi
	movq	144(%rsp,%r15,8), %rdi
	call	_Z38__device_stub__Z10gLayerBackPfS_S_S_iiPfS_S_S_ii
.L80:
	call	cudaGetLastError@PLT
	movl	$238, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	subq	$1, %r15
	jnb	.L81
	xorl	%r13d, %r13d
.L84:
	cmpq	$2, %r13
	je	.L108
	cmpq	$1, %r13
	movl	$900, %r15d
	sbbl	%r14d, %r14d
	andl	$-891, %r14d
	addl	$900, %r14d
	jmp	.L82
.L108:
	movl	$1, %r15d
	movl	$900, %r14d
.L82:
	movl	120(%rsp), %ecx
	movq	112(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	124(%rsp), %rdi
	movl	132(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L83
	movq	208(%rsp,%r13,8), %rdx
	movl	%r15d, %r8d
	movl	%r14d, %ecx
	movq	232(%rsp,%r13,8), %rsi
	movq	136(%rsp,%r13,8), %rdi
	movss	.LC14(%rip), %xmm0
	call	_Z39__device_stub__Z12updateWeightPfS_S_fiiPfS_S_fii
.L83:
	call	cudaGetLastError@PLT
	incq	%r13
	movl	$249, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	cmpq	$3, %r13
	jne	.L84
	movq	56(%rsp), %rax
	addq	$8, %rbx
	cmpq	%rax, %rbx
	jne	.L87
	incl	24(%rsp)
	jmp	.L72
.L86:
	call	clock@PLT
	movq	48(%rsp), %rbx
	xorl	%r13d, %r13d
	movq	8(%rsp), %r15
	leaq	136(%rsp), %r14
	subq	%rbx, %rax
	movq	%rax, %rbx
.L88:
	movq	0(%r13,%r14), %rsi
	movl	$2, %ecx
	movl	$3240000, %edx
	movq	%r15, %rdi
	leaq	160(%rsp), %r12
	addq	$3240000, %r15
	call	cudaMemcpy@PLT
	movl	$257, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	imulq	$450, %r13, %rdi
	movq	(%rsp), %rax
	movq	160(%rsp,%r13), %rsi
	movl	$2, %ecx
	movl	$3600, %edx
	addq	$8, %r13
	addq	%rax, %rdi
	call	cudaMemcpy@PLT
	movl	$259, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	cmpq	$24, %r13
	jne	.L88
	xorl	%r13d, %r13d
.L89:
	movq	(%r14,%r13), %rdi
	call	cudaFree@PLT
	movl	$265, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movq	(%r12,%r13), %rdi
	call	cudaFree@PLT
	movl	$266, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movq	184(%rsp,%r13), %rdi
	call	cudaFree@PLT
	movl	$267, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	movq	208(%rsp,%r13), %rdi
	addq	$8, %r13
	call	cudaFree@PLT
	movl	$268, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	cmpq	$24, %r13
	jne	.L89
	xorl	%r12d, %r12d
.L90:
	movq	232(%rsp,%r12,8), %rdi
	incq	%r12
	call	cudaFree@PLT
	movl	$272, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	cmpq	$4, %r12
	jne	.L90
	xorl	%r12d, %r12d
.L91:
	movq	264(%rsp,%r12,8), %rdi
	incq	%r12
	call	cudaFree@PLT
	movl	$276, %esi
	movl	%eax, %edi
	call	_ZL11HandleError9cudaErrorPKci.constprop.0
	cmpq	$683, %r12
	jne	.L91
	leaq	.LC15(%rip), %rsi
	leaq	.LC16(%rip), %rdi
	call	fopen@PLT
	movl	$900, %ecx
	movl	$2, %esi
	leaq	.LC18(%rip), %rdx
	movq	%rax, %rdi
	cvtsi2ssq	%rbx, %xmm0
	movq	%rax, %r12
	movb	$1, %al
	divss	.LC17(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__fprintf_chk@PLT
	movq	%r12, %rdi
	call	fclose@PLT
	xorps	%xmm0, %xmm0
.L92:
	movl	$9, %ecx
	movq	%rbp, %rsi
	movq	(%rsp), %r15
	xorl	%r12d, %r12d
	leaq	27328(%rsp), %rax
	movq	32(%rsp), %r14
	movq	8(%rsp), %r13
	movq	%rax, %rdi
	rep movsl
	movq	16(%rsp), %rsi
.L94:
	cmpl	$2, %r12d
	je	.L110
	cmpl	$1, %r12d
	movl	$900, %eax
	sbbl	%r9d, %r9d
	andl	$-891, %r9d
	addl	$900, %r9d
	jmp	.L93
.L110:
	movl	$1, %eax
	movl	$900, %r9d
.L93:
	movss	%xmm0, 24(%rsp)
	movq	%r14, %rcx
	movq	%r15, %r8
	movq	%r13, %rdi
	pushq	%rdx
	.cfi_def_cfa_offset 9789128
	leaq	3600(%rsi), %rbx
	incl	%r12d
	addq	$3240000, %r13
	pushq	%rax
	.cfi_def_cfa_offset 9789136
	movq	%rbx, %rdx
	addq	$3600, %r14
	addq	$3600, %r15
	call	_Z7gLayer2PfS_S_S_S_ii
	cmpl	$3, %r12d
	popq	%rcx
	.cfi_def_cfa_offset 9789128
	popq	%rsi
	.cfi_def_cfa_offset 9789120
	movss	24(%rsp), %xmm0
	je	.L135
	movq	%rbx, %rsi
	jmp	.L94
.L135:
	movss	.LC6(%rip), %xmm3
	movss	36(%rbp), %xmm2
	xorps	%xmm1, %xmm1
	comiss	38128(%rsp), %xmm3
	ja	.L95
	movss	.LC5(%rip), %xmm1
.L95:
	ucomiss	%xmm1, %xmm2
	jp	.L97
	jne	.L97
	addss	.LC5(%rip), %xmm0
.L97:
	movq	40(%rsp), %rax
	addq	$40, %rbp
	cmpq	%rax, %rbp
	jne	.L92
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	divss	.LC12(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	9789048(%rsp), %rax
	subq	%fs:40, %rax
	je	.L100
	call	__stack_chk_fail@PLT
.L100:
	addq	$9789064, %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
.LFE2032:
	.size	main, .-main
	.section	.rodata.str1.1
.LC19:
	.string	"_Z9valueInitPfS_i"
.LC20:
	.string	"_Z9deltaInitPfS_S_S_"
.LC21:
	.string	"_Z12updateWeightPfS_S_fii"
.LC22:
	.string	"_Z6gLayerPfS_S_S_S_ii"
.LC23:
	.string	"_Z10gLayerBackPfS_S_S_ii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2068:
	.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	.LC19(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z9valueInitPfS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC20(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z9deltaInitPfS_S_S_(%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	.LC21(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z12updateWeightPfS_S_fii(%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	.LC22(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z6gLayerPfS_S_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	.LC23(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z10gLayerBackPfS_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
	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
.LFE2068:
	.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.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.long	-2147483648
	.long	0
	.long	0
	.long	0
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC3:
	.long	0
	.long	1072693248
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC5:
	.long	1065353216
	.align 4
.LC6:
	.long	1056964608
	.align 4
.LC10:
	.long	1082130432
	.align 4
.LC11:
	.long	813694976
	.align 4
.LC12:
	.long	1120403456
	.align 4
.LC14:
	.long	1050253722
	.align 4
.LC17:
	.long	1232348160
	.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 <time.h>
#include <math.h>
#define SIZE 900
#define HIDDINLAYERS 2
#define POINTS 583
#define TEST 100
#define ATTRIBUTES 10
static void HandleError( hipError_t err,
                         const char *file,
                         int line ) {
    if (err != hipSuccess) {
        printf( "%s in %s at line %d\n", hipGetErrorString( err ),
                file, line );
        exit( EXIT_FAILURE );
    }
}
#define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ ))

// various squashing functions 
__device__ __host__ float g(float value) {
	return 1.0/(1.0+exp(-value));
}
__device__ __host__ float gSquash(float value) {
	if (value<0.5) return 0.0;
	else return 1.0;
}
__device__ __host__ float gPrime(float value){
	float a = g(value);
	return a;
}

// used for testing before and after training
// preforms forward propagation 
__host__ void gLayer2(float *weights, float *values, float *outputs, float *in, float *bias, int weightsLen, int outputsLen){
	for (int i = 0; i < outputsLen; ++i)
	{
		in[i]=0;
		for (int j = 0; j < weightsLen; ++j)
		{
			in[i]+= values[j]*weights[j+SIZE*i];
		}
		in[i] += bias[i];
		outputs[i] =g(in[i]);
	}
}

// preforms back propagation on gpu
__global__ void gLayerBack(float *weights, float *delta, float *outputs, float *in, int inputLen, int outputsLen){
	float temp;
	int i = threadIdx.x + blockDim.x * blockIdx.x;
	while(i < outputsLen)
	{
		temp=0.0;
		for (int j = 0; j < inputLen; ++j)
		{
			temp+=delta[j]*weights[j+SIZE*i];
		}
		
		outputs[i] = gPrime(in[i])*temp;
		i += gridDim.x*blockDim.x;
	}
}

// preforms forward propagation on gpu
__global__ void gLayer(float *weights, float *values, float *outputs, float *in, float *bias, int weightsLen, int outputsLen){
	float temp;
	int i = threadIdx.x + blockDim.x * blockIdx.x;
	while(i < outputsLen) {
		temp=0;
		for (int j = 0; j < weightsLen; ++j)
		{
			temp+= values[j]*weights[j+SIZE*i];
		}
		in[i] = temp+bias[i];
		outputs[i] =g(in[i]);
		i += gridDim.x*blockDim.x;
	}
}

// updates weights once deltas have been calculated
__global__ void updateWeight(float *weights, float *values, float *delta, float learningRate, int inputLen, int outputLen){
	int i = threadIdx.x + blockDim.x * blockIdx.x;
	int j = threadIdx.y + blockDim.y * blockIdx.y;
	while(i < outputLen)
	{
		while (j < inputLen)
		{
			weights[j+SIZE*i]+= learningRate*values[i]*delta[j];
			j += gridDim.y*blockDim.y;
		}
		j = threadIdx.y + blockDim.y * blockIdx.y;
		i += gridDim.x*blockDim.x;
	}
}

// used for prepping for back propagation 
__global__ void deltaInit(float *delta, float *in, float *dataSet, float *values){
	delta[0] = gPrime(in[0])*(dataSet[ATTRIBUTES-1]-values[0]);
}

// used for prepping for forward propagation
__global__ void valueInit(float *values, float *dataSet, int i){
	values[i] = dataSet[i];
}

int main(int argc, char const *argv[])
{
	FILE *fp=NULL, *inFile=NULL;
	clock_t t;
	srand (time(NULL));
	float weights[(HIDDINLAYERS+1)][SIZE*SIZE]; // each node in a layer conects to all nodes in the previous layer
	float bias[(HIDDINLAYERS+1)][SIZE]; // all nodes other than the input layer
	float values[(HIDDINLAYERS+2)][SIZE]; // holds the results of the last input
	float in[(HIDDINLAYERS+1)][SIZE]; // values before squashing
	float dataSet[(POINTS+TEST)][ATTRIBUTES]; // holds datafile
	float learningRate = 0.3;
	float learningTime = 50;
	float *weights_d[(HIDDINLAYERS+1)], *bias_d[(HIDDINLAYERS+1)], *values_d[(HIDDINLAYERS+2)], *in_d[(HIDDINLAYERS+1)], *delta_d[(HIDDINLAYERS+1)], *dataSet_d[(POINTS+TEST)];

	// read in data
	inFile=fopen("data/breast-cancer-wisconsin.data","r");
	for (int i = 0; i < POINTS+TEST; ++i)
	{
		for (int j = 0; j < ATTRIBUTES; ++j)
		{
			// update indexes
			fscanf(inFile,"%f",&(dataSet[i][j]));
			if (j==ATTRIBUTES-1){
				if (dataSet[i][j]==4.0) dataSet[i][j]=1.0;
				else dataSet[i][j] = 0.0;
			} 
		}
	}
	fclose(inFile);


	// initialize weights
	for(int i=0; i<HIDDINLAYERS+1; i++) {
		for (int j = 0; j < SIZE; ++j)
		{
			for (int l = 0; l < SIZE; ++l)
			{
				weights[i][l+SIZE*j] = ((float) rand() / (RAND_MAX/2))-1;
			}
			bias[i][j] = ((float) rand() / (RAND_MAX/2))-1;
		}	
	}

	// check results pre training
	int outputLen=SIZE;
	int inputLen=SIZE;
	float correct = 0.0;
	for (int j=POINTS; j<TEST+POINTS; j++){
		for (int i=0; i<ATTRIBUTES-1; i++) {
			values[0][i] = dataSet[j][i];
		}
		for (int i = 0; i < HIDDINLAYERS+1; ++i)
		{
			outputLen=SIZE;
			inputLen=SIZE;
			if (i == HIDDINLAYERS) outputLen = 1; // result layer
			if (i == 0) inputLen = (ATTRIBUTES-1); // data set layer
			gLayer2(weights[i], values[i], values[i+1], in[i], bias[i], inputLen, outputLen);
		}
		if (dataSet[j][ATTRIBUTES-1]==gSquash(values[HIDDINLAYERS+1][0])) correct += 1;
	}
	correct = ((float) correct/TEST);
	printf("%f\n", correct);

	// allocate/mem copy space on device
	for (int i = 0; i < (HIDDINLAYERS+1); ++i)
	{
		HANDLE_ERROR(hipMalloc((void **) &weights_d[i], sizeof(float)*SIZE*SIZE));
		HANDLE_ERROR(hipMemcpy(weights_d[i], weights[i], sizeof(float)*SIZE*SIZE, hipMemcpyHostToDevice));		
		HANDLE_ERROR(hipMalloc((void **) &bias_d[i], sizeof(float)*SIZE));
		HANDLE_ERROR(hipMemcpy(bias_d[i], bias[i], sizeof(float)*SIZE, hipMemcpyHostToDevice));
		HANDLE_ERROR(hipMalloc((void **) &in_d[i], sizeof(float)*SIZE));
		HANDLE_ERROR(hipMalloc((void **) &delta_d[i], sizeof(float)*SIZE));
	
	}
	for (int i = 0; i < (HIDDINLAYERS+2); ++i)
	{
		HANDLE_ERROR(hipMalloc((void **) &values_d[i], sizeof(float)*SIZE));
	}
	for (int i = 0; i < (POINTS+TEST); ++i)
	{
		HANDLE_ERROR(hipMalloc((void **) &dataSet_d[i], sizeof(float)*ATTRIBUTES));
		HANDLE_ERROR(hipMemcpy(dataSet_d[i], dataSet[i], sizeof(float)*ATTRIBUTES, hipMemcpyHostToDevice));
	}

	// initialize kernel launches
	dim3 dimBlock1(32,1);
    dim3 dimGrid1(SIZE/32+1,1);
    dim3 dimBlock2(1,1);
    dim3 dimGrid2(1,1);
    dim3 dimBlock3(16,16);
    dim3 dimGrid3(SIZE/16+1,SIZE/16+1);

    // time training
    t = clock();
	for (int timeStep=0; timeStep<learningTime; timeStep++) {
		
		for (int point=0; point<POINTS; point++) {

			// get current data set
			for (int i=0; i<ATTRIBUTES-1; i++) {
				valueInit<<<dimGrid2,dimBlock2>>>(values_d[0], dataSet_d[point], i);
				HANDLE_ERROR(hipGetLastError());
			}

			// forward prop
			for (int i = 0; i < HIDDINLAYERS+1; ++i)
			{
				outputLen=SIZE;
				inputLen=SIZE;
				if (i == HIDDINLAYERS) outputLen = 1; // result layer
				if (i == 0) inputLen = (ATTRIBUTES-1); // data set layer
				gLayer<<<dimGrid1,dimBlock1>>>(weights_d[i], values_d[i], values_d[i+1], in_d[i], bias_d[i], inputLen, outputLen);
				HANDLE_ERROR(hipGetLastError());
			}

			// back prop 
			deltaInit<<<dimGrid2,dimBlock2>>>(delta_d[HIDDINLAYERS], in_d[HIDDINLAYERS], dataSet_d[point], values_d[HIDDINLAYERS+1]);
			HANDLE_ERROR(hipGetLastError());

			// error in previous layers
			
			for (int i = HIDDINLAYERS-1; i > -1; i--)
			{
				outputLen=SIZE;
				inputLen=SIZE;
				if (i == HIDDINLAYERS-1) outputLen = (ATTRIBUTES-1); // data set layer
				if (i == 0) inputLen = 1; // result layer
				gLayerBack<<<dimGrid1,dimBlock1>>>(weights_d[i+1], delta_d[i+1], delta_d[i], in_d[i], inputLen, outputLen);
				HANDLE_ERROR(hipGetLastError());
			}

			// update weights
			for (int i = 0; i < HIDDINLAYERS+1; ++i)
			{
				outputLen=SIZE; 
				inputLen=SIZE;
				if (i == HIDDINLAYERS) outputLen = 1; // result layer
				if (i == 0) inputLen = (ATTRIBUTES-1); // data set layer
				updateWeight<<<dimGrid3,dimBlock3>>>(weights_d[i], values_d[i], delta_d[i], learningRate, inputLen, outputLen);
				HANDLE_ERROR(hipGetLastError());
			}
		}
	}
	t = clock() - t;
	// mem copy 
	for (int i = 0; i < (HIDDINLAYERS+1); ++i)
	{
		HANDLE_ERROR(hipMemcpy(weights[i], weights_d[i], sizeof(float)*SIZE*SIZE, hipMemcpyDeviceToHost));
		// HANDLE_ERROR(cudaMemcpy(weights[i], weights_d[i], sizeof(float)*SIZE*SIZE, cudaMemcpyDeviceToHost));
		HANDLE_ERROR(hipMemcpy(bias[i], bias_d[i], sizeof(float)*SIZE, hipMemcpyDeviceToHost));
	}

	// free pointers
	for (int i = 0; i < (HIDDINLAYERS+1); ++i)
	{
		HANDLE_ERROR(hipFree(weights_d[i]));
		HANDLE_ERROR(hipFree(bias_d[i]));
		HANDLE_ERROR(hipFree(in_d[i]));
		HANDLE_ERROR(hipFree(delta_d[i]));	
	}
	for (int i = 0; i < (HIDDINLAYERS+2); ++i)
	{
		HANDLE_ERROR(hipFree(values_d[i]));
	}
	for (int i = 0; i < (POINTS+TEST); ++i)
	{
		HANDLE_ERROR(hipFree(dataSet_d[i]));
	}
	
    

    // save runtime
	fp=fopen("data/parallel.dat", "a");
    fprintf (fp, "%d\t%f\n", SIZE,((float)t)/CLOCKS_PER_SEC);
    fclose(fp);

    // post training results
    correct = 0.0;
	for (int j=POINTS; j<TEST+POINTS; j++){
		for (int i=0; i<ATTRIBUTES-1; i++) {
			values[0][i] = dataSet[j][i];
		}
		for (int i = 0; i < HIDDINLAYERS+1; ++i)
		{
			outputLen=SIZE;
			inputLen=SIZE;
			if (i == HIDDINLAYERS) outputLen = 1; // result layer
			if (i == 0) inputLen = (ATTRIBUTES-1); // data set layer
			gLayer2(weights[i], values[i], values[i+1], in[i], bias[i], inputLen, outputLen);
		}
		if (dataSet[j][ATTRIBUTES-1]==gSquash(values[HIDDINLAYERS+1][0])) correct += 1;
	}
	correct = ((float) correct/TEST);
	printf("%f\n", correct);
	return 0;
}
	.text
	.file	"parallel.hip"
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z1gf
.LCPI0_0:
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI0_1:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z1gf
	.type	_Z1gf,@function
_Z1gf:                                  # @_Z1gf
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	xorps	.LCPI0_0(%rip), %xmm0
	callq	expf
	cvtss2sd	%xmm0, %xmm0
	movsd	.LCPI0_1(%rip), %xmm1           # xmm1 = mem[0],zero
	addsd	%xmm1, %xmm0
	divsd	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtsd2ss	%xmm1, %xmm0
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z1gf, .Lfunc_end0-_Z1gf
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z7gSquashf
.LCPI1_0:
	.long	0x3f000000                      # float 0.5
.LCPI1_1:
	.long	0x3f800000                      # float 1
	.text
	.globl	_Z7gSquashf
	.type	_Z7gSquashf,@function
_Z7gSquashf:                            # @_Z7gSquashf
	.cfi_startproc
# %bb.0:
	cmpltss	.LCPI1_0(%rip), %xmm0
	movss	.LCPI1_1(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	andnps	%xmm1, %xmm0
	retq
.Lfunc_end1:
	.size	_Z7gSquashf, .Lfunc_end1-_Z7gSquashf
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z6gPrimef
.LCPI2_0:
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI2_1:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z6gPrimef
	.type	_Z6gPrimef,@function
_Z6gPrimef:                             # @_Z6gPrimef
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	xorps	.LCPI2_0(%rip), %xmm0
	callq	expf
	cvtss2sd	%xmm0, %xmm0
	movsd	.LCPI2_1(%rip), %xmm1           # xmm1 = mem[0],zero
	addsd	%xmm1, %xmm0
	divsd	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtsd2ss	%xmm1, %xmm0
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z6gPrimef, .Lfunc_end2-_Z6gPrimef
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z7gLayer2PfS_S_S_S_ii
.LCPI3_0:
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI3_1:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z7gLayer2PfS_S_S_S_ii
	.type	_Z7gLayer2PfS_S_S_S_ii,@function
_Z7gLayer2PfS_S_S_S_ii:                 # @_Z7gLayer2PfS_S_S_S_ii
	.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	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%r9d, 12(%rsp)                  # 4-byte Spill
	movq	%r8, 32(%rsp)                   # 8-byte Spill
	movq	%rdx, 24(%rsp)                  # 8-byte Spill
	movq	%rdi, 16(%rsp)                  # 8-byte Spill
	movl	96(%rsp), %eax
	testl	%eax, %eax
	jle	.LBB3_5
# %bb.1:                                # %.lr.ph26
	movq	%rcx, %r15
	movq	%rsi, %r13
	movl	%eax, %ebp
	movl	12(%rsp), %r14d                 # 4-byte Reload
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
.LBB3_2:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_7 Depth 2
	movl	$0, (%r15,%rbx,4)
	cmpl	$0, 12(%rsp)                    # 4-byte Folded Reload
	jle	.LBB3_3
# %bb.6:                                # %.lr.ph
                                        #   in Loop: Header=BB3_2 Depth=1
	movl	%r12d, %eax
	andl	$1073741823, %eax               # imm = 0x3FFFFFFF
	shlq	$4, %rax
	addq	16(%rsp), %rax                  # 8-byte Folded Reload
	xorps	%xmm0, %xmm0
	xorl	%ecx, %ecx
.LBB3_7:                                #   Parent Loop BB3_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%r13,%rcx,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	(%rax,%rcx,4), %xmm1
	addss	%xmm1, %xmm0
	movss	%xmm0, (%r15,%rbx,4)
	incq	%rcx
	cmpq	%rcx, %r14
	jne	.LBB3_7
	jmp	.LBB3_4
.LBB3_3:                                #   in Loop: Header=BB3_2 Depth=1
	xorps	%xmm0, %xmm0
.LBB3_4:                                # %._crit_edge
                                        #   in Loop: Header=BB3_2 Depth=1
	movq	32(%rsp), %rax                  # 8-byte Reload
	addss	(%rax,%rbx,4), %xmm0
	movss	%xmm0, (%r15,%rbx,4)
	xorps	.LCPI3_0(%rip), %xmm0
	callq	expf
	cvtss2sd	%xmm0, %xmm0
	movsd	.LCPI3_1(%rip), %xmm1           # xmm1 = mem[0],zero
	addsd	%xmm1, %xmm0
	divsd	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtsd2ss	%xmm1, %xmm0
	movq	24(%rsp), %rax                  # 8-byte Reload
	movss	%xmm0, (%rax,%rbx,4)
	incq	%rbx
	addl	$225, %r12d
	cmpq	%rbp, %rbx
	jne	.LBB3_2
.LBB3_5:                                # %._crit_edge27
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z7gLayer2PfS_S_S_S_ii, .Lfunc_end3-_Z7gLayer2PfS_S_S_S_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__gLayerBackPfS_S_S_ii # -- Begin function _Z25__device_stub__gLayerBackPfS_S_S_ii
	.type	_Z25__device_stub__gLayerBackPfS_S_S_ii,@function
_Z25__device_stub__gLayerBackPfS_S_S_ii: # @_Z25__device_stub__gLayerBackPfS_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	$_Z10gLayerBackPfS_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_end4:
	.size	_Z25__device_stub__gLayerBackPfS_S_S_ii, .Lfunc_end4-_Z25__device_stub__gLayerBackPfS_S_S_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z21__device_stub__gLayerPfS_S_S_S_ii # -- Begin function _Z21__device_stub__gLayerPfS_S_S_S_ii
	.type	_Z21__device_stub__gLayerPfS_S_S_S_ii,@function
_Z21__device_stub__gLayerPfS_S_S_S_ii:  # @_Z21__device_stub__gLayerPfS_S_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	$160, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	4(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	208(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z6gLayerPfS_S_S_S_ii, %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_end5:
	.size	_Z21__device_stub__gLayerPfS_S_S_S_ii, .Lfunc_end5-_Z21__device_stub__gLayerPfS_S_S_S_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z27__device_stub__updateWeightPfS_S_fii # -- Begin function _Z27__device_stub__updateWeightPfS_S_fii
	.type	_Z27__device_stub__updateWeightPfS_S_fii,@function
_Z27__device_stub__updateWeightPfS_S_fii: # @_Z27__device_stub__updateWeightPfS_S_fii
	.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	20(%rsp), %rdx
	movss	%xmm0, (%rdx)
	leaq	16(%rsp), %r9
	movl	%ecx, (%r9)
	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	%r9, 32(%rbx)
	movq	%rcx, 40(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z12updateWeightPfS_S_fii, %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_end6:
	.size	_Z27__device_stub__updateWeightPfS_S_fii, .Lfunc_end6-_Z27__device_stub__updateWeightPfS_S_fii
	.cfi_endproc
                                        # -- End function
	.globl	_Z24__device_stub__deltaInitPfS_S_S_ # -- Begin function _Z24__device_stub__deltaInitPfS_S_S_
	.type	_Z24__device_stub__deltaInitPfS_S_S_,@function
_Z24__device_stub__deltaInitPfS_S_S_:   # @_Z24__device_stub__deltaInitPfS_S_S_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	16(%rsp), %rdx
	movq	%rcx, (%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	8(%rsp), %r12
	movq	%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	$_Z9deltaInitPfS_S_S_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end7:
	.size	_Z24__device_stub__deltaInitPfS_S_S_, .Lfunc_end7-_Z24__device_stub__deltaInitPfS_S_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z24__device_stub__valueInitPfS_i # -- Begin function _Z24__device_stub__valueInitPfS_i
	.type	_Z24__device_stub__valueInitPfS_i,@function
_Z24__device_stub__valueInitPfS_i:      # @_Z24__device_stub__valueInitPfS_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %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	$_Z9valueInitPfS_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_Z24__device_stub__valueInitPfS_i, .Lfunc_end8-_Z24__device_stub__valueInitPfS_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI9_0:
	.long	0x40800000                      # float 4
.LCPI9_1:
	.long	0x3f800000                      # float 1
.LCPI9_2:
	.long	0x30800000                      # float 9.31322574E-10
.LCPI9_3:
	.long	0xbf800000                      # float -1
.LCPI9_4:
	.long	0x3f000000                      # float 0.5
.LCPI9_5:
	.long	0x42c80000                      # float 100
.LCPI9_6:
	.long	0x3e99999a                      # float 0.300000012
.LCPI9_7:
	.long	0x49742400                      # float 1.0E+6
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$9789000, %rsp                  # imm = 0x955E48
	.cfi_def_cfa_offset 9789056
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	movl	$.L.str, %edi
	movl	$.L.str.1, %esi
	callq	fopen
	movq	%rax, %rbx
	leaq	30864(%rsp), %r14
	xorl	%r15d, %r15d
.LBB9_1:                                # %.preheader263
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_2 Depth 2
	xorl	%r12d, %r12d
.LBB9_2:                                #   Parent Loop BB9_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leaq	(%r14,%r12), %rdx
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	addq	$4, %r12
	cmpq	$40, %r12
	jne	.LBB9_2
# %bb.3:                                #   in Loop: Header=BB9_1 Depth=1
	movss	-4(%r14,%r12), %xmm0            # xmm0 = mem[0],zero,zero,zero
	cmpeqss	.LCPI9_0(%rip), %xmm0
	movss	.LCPI9_1(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	andps	%xmm1, %xmm0
	movss	%xmm0, -4(%r14,%r12)
	incq	%r15
	addq	$40, %r14
	cmpq	$683, %r15                      # imm = 0x2AB
	jne	.LBB9_1
# %bb.4:
	movq	%rbx, %rdi
	callq	fclose
	leaq	68992(%rsp), %r13
	xorl	%r14d, %r14d
	movl	$3600, %r15d                    # imm = 0xE10
.LBB9_5:                                # %.preheader262
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_6 Depth 2
                                        #       Child Loop BB9_7 Depth 3
	imulq	$3600, %r14, %rax               # imm = 0xE10
	leaq	(%rsp,%rax), %r12
	addq	$20064, %r12                    # imm = 0x4E60
	movq	%r13, 8(%rsp)                   # 8-byte Spill
	xorl	%ebp, %ebp
.LBB9_6:                                # %.preheader261
                                        #   Parent Loop BB9_5 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB9_7 Depth 3
	xorl	%ebx, %ebx
.LBB9_7:                                #   Parent Loop BB9_5 Depth=1
                                        #     Parent Loop BB9_6 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	.LCPI9_2(%rip), %xmm0
	addss	.LCPI9_3(%rip), %xmm0
	movss	%xmm0, (%r13,%rbx,4)
	incq	%rbx
	cmpq	$900, %rbx                      # imm = 0x384
	jne	.LBB9_7
# %bb.8:                                #   in Loop: Header=BB9_6 Depth=2
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	.LCPI9_2(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm1, %xmm0
	movss	.LCPI9_3(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	addss	%xmm1, %xmm0
	movss	%xmm0, (%r12,%rbp,4)
	incq	%rbp
	addq	%r15, %r13
	cmpq	$900, %rbp                      # imm = 0x384
	jne	.LBB9_6
# %bb.9:                                #   in Loop: Header=BB9_5 Depth=1
	incq	%r14
	movq	8(%rsp), %r13                   # 8-byte Reload
	addq	$3240000, %r13                  # imm = 0x317040
	cmpq	$3, %r14
	jne	.LBB9_5
# %bb.10:                               # %.preheader260
	xorps	%xmm1, %xmm1
	movl	$583, %ecx                      # imm = 0x247
	xorl	%r15d, %r15d
	movl	$1, %ebp
	movl	$9, %r13d
	movl	$3600, %r12d                    # imm = 0xE10
.LBB9_11:                               # %.preheader259
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_12 Depth 2
	movaps	%xmm1, 16(%rsp)                 # 16-byte Spill
	movq	%rcx, 8(%rsp)                   # 8-byte Spill
	leaq	(%r15,%r15,4), %rax
	leaq	54184(%rsp), %rdx
	movl	32(%rdx,%rax,8), %ecx
	movl	%ecx, 5696(%rsp)
	movups	(%rdx,%rax,8), %xmm0
	movups	16(%rdx,%rax,8), %xmm1
	movaps	%xmm1, 5680(%rsp)
	movaps	%xmm0, 5664(%rsp)
	leaq	68992(%rsp), %rbx
	xorl	%r14d, %r14d
.LBB9_12:                               # %.preheader258
                                        #   Parent Loop BB9_11 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	$7200, %r14                     # imm = 0x1C20
	movl	$900, %eax                      # imm = 0x384
	cmovel	%ebp, %eax
	testq	%r14, %r14
	movl	$900, %r9d                      # imm = 0x384
	cmovel	%r13d, %r9d
	leaq	5664(%rsp,%r14), %rsi
	leaq	(%rsi,%r12), %rdx
	leaq	58192(%rsp,%r14), %rcx
	leaq	(%rsp,%r14), %r8
	addq	$20064, %r8                     # imm = 0x4E60
	movl	%eax, (%rsp)
	movq	%rbx, %rdi
	callq	_Z7gLayer2PfS_S_S_S_ii
	addq	%r12, %r14
	addq	$3240000, %rbx                  # imm = 0x317040
	cmpq	$10800, %r14                    # imm = 0x2A30
	jne	.LBB9_12
# %bb.13:                               #   in Loop: Header=BB9_11 Depth=1
	movq	8(%rsp), %rcx                   # 8-byte Reload
	leaq	(%rcx,%rcx,4), %rax
	movss	16464(%rsp), %xmm0              # xmm0 = mem[0],zero,zero,zero
	cmpltss	.LCPI9_4(%rip), %xmm0
	movss	.LCPI9_1(%rip), %xmm2           # xmm2 = mem[0],zero,zero,zero
	andnps	%xmm2, %xmm0
	movaps	16(%rsp), %xmm3                 # 16-byte Reload
	movaps	%xmm3, %xmm1
	cmpeqss	30900(%rsp,%rax,8), %xmm0
	addss	%xmm2, %xmm1
	andps	%xmm0, %xmm1
	andnps	%xmm3, %xmm0
	orps	%xmm1, %xmm0
	incq	%rcx
	incq	%r15
	movaps	%xmm0, %xmm1
	cmpq	$100, %r15
	jne	.LBB9_11
# %bb.14:
	divss	.LCPI9_5(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.3, %edi
	movb	$1, %al
	callq	printf
	leaq	20064(%rsp), %rbx
	leaq	68992(%rsp), %r14
	xorl	%r12d, %r12d
.LBB9_15:                               # =>This Inner Loop Header: Depth=1
	leaq	(%rsp,%r12), %r15
	addq	$64, %r15
	movl	$3240000, %esi                  # imm = 0x317040
	movq	%r15, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$176, %esi
	callq	_ZL11HandleError10hipError_tPKci
	movq	(%r15), %rdi
	movl	$3240000, %edx                  # imm = 0x317040
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$177, %esi
	callq	_ZL11HandleError10hipError_tPKci
	leaq	(%rsp,%r12), %r15
	addq	$160, %r15
	movl	$3600, %esi                     # imm = 0xE10
	movq	%r15, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$178, %esi
	callq	_ZL11HandleError10hipError_tPKci
	movq	(%r15), %rdi
	movl	$3600, %edx                     # imm = 0xE10
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$179, %esi
	callq	_ZL11HandleError10hipError_tPKci
	leaq	(%rsp,%r12), %rdi
	addq	$128, %rdi
	movl	$3600, %esi                     # imm = 0xE10
	callq	hipMalloc
	movl	%eax, %edi
	movl	$180, %esi
	callq	_ZL11HandleError10hipError_tPKci
	leaq	(%rsp,%r12), %rdi
	addq	$32, %rdi
	movl	$3600, %esi                     # imm = 0xE10
	callq	hipMalloc
	movl	%eax, %edi
	movl	$181, %esi
	callq	_ZL11HandleError10hipError_tPKci
	addq	$8, %r12
	addq	$3600, %rbx                     # imm = 0xE10
	addq	$3240000, %r14                  # imm = 0x317040
	cmpq	$24, %r12
	jne	.LBB9_15
# %bb.16:                               # %.preheader257.preheader
	xorl	%ebx, %ebx
.LBB9_17:                               # %.preheader257
                                        # =>This Inner Loop Header: Depth=1
	leaq	(%rsp,%rbx), %rdi
	addq	$96, %rdi
	movl	$3600, %esi                     # imm = 0xE10
	callq	hipMalloc
	movl	%eax, %edi
	movl	$186, %esi
	callq	_ZL11HandleError10hipError_tPKci
	addq	$8, %rbx
	cmpq	$32, %rbx
	jne	.LBB9_17
# %bb.18:                               # %.preheader256.preheader
	leaq	192(%rsp), %rbx
	xorl	%r14d, %r14d
.LBB9_19:                               # %.preheader256
                                        # =>This Inner Loop Header: Depth=1
	movl	$40, %esi
	movq	%rbx, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$190, %esi
	callq	_ZL11HandleError10hipError_tPKci
	movq	(%rbx), %rdi
	leaq	(%rsp,%r14), %rsi
	addq	$30864, %rsi                    # imm = 0x7890
	movl	$40, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$191, %esi
	callq	_ZL11HandleError10hipError_tPKci
	addq	$40, %r14
	addq	$8, %rbx
	cmpq	$27320, %r14                    # imm = 0x6AB8
	jne	.LBB9_19
# %bb.20:
	movabsq	$4294967297, %r14               # imm = 0x100000001
	xorl	%ebx, %ebx
	callq	clock
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	$1, %ebp
	leaq	28(%r14), %r15
	leaq	31(%r14), %r12
.LBB9_21:                               # %.preheader255
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_22 Depth 2
                                        #       Child Loop BB9_23 Depth 3
                                        #       Child Loop BB9_27 Depth 3
                                        #       Child Loop BB9_48 Depth 3
                                        #       Child Loop BB9_52 Depth 3
	movq	%rbx, 8(%rsp)                   # 8-byte Spill
	xorl	%r13d, %r13d
.LBB9_22:                               # %.preheader254
                                        #   Parent Loop BB9_21 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB9_23 Depth 3
                                        #       Child Loop BB9_27 Depth 3
                                        #       Child Loop BB9_48 Depth 3
                                        #       Child Loop BB9_52 Depth 3
	xorl	%ebx, %ebx
.LBB9_23:                               #   Parent Loop BB9_21 Depth=1
                                        #     Parent Loop BB9_22 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_25
# %bb.24:                               #   in Loop: Header=BB9_23 Depth=3
	movq	96(%rsp), %rdi
	movq	192(%rsp,%r13,8), %rsi
	movl	%ebx, %edx
	callq	_Z24__device_stub__valueInitPfS_i
.LBB9_25:                               #   in Loop: Header=BB9_23 Depth=3
	callq	hipGetLastError
	movl	%eax, %edi
	movl	$211, %esi
	callq	_ZL11HandleError10hipError_tPKci
	incl	%ebx
	cmpl	$9, %ebx
	jne	.LBB9_23
# %bb.26:                               # %.preheader253.preheader
                                        #   in Loop: Header=BB9_22 Depth=2
	xorl	%ebx, %ebx
.LBB9_27:                               # %.preheader253
                                        #   Parent Loop BB9_21 Depth=1
                                        #     Parent Loop BB9_22 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	je	.LBB9_43
# %bb.28:                               # %.preheader253._crit_edge
                                        #   in Loop: Header=BB9_27 Depth=3
	incq	%rbx
	jmp	.LBB9_44
.LBB9_43:                               #   in Loop: Header=BB9_27 Depth=3
	testq	%rbx, %rbx
	movl	$900, %r9d                      # imm = 0x384
	movl	$9, %eax
	cmovel	%eax, %r9d
	cmpq	$2, %rbx
	movl	$900, %eax                      # imm = 0x384
	cmovel	%ebp, %eax
	movq	64(%rsp,%rbx,8), %rdi
	leaq	1(%rbx), %rbp
	movq	96(%rsp,%rbx,8), %rsi
	movq	104(%rsp,%rbx,8), %rdx
	movq	128(%rsp,%rbx,8), %rcx
	movq	160(%rsp,%rbx,8), %r8
	movl	%eax, (%rsp)
	callq	_Z21__device_stub__gLayerPfS_S_S_S_ii
	movq	%rbp, %rbx
	movl	$1, %ebp
.LBB9_44:                               #   in Loop: Header=BB9_27 Depth=3
	callq	hipGetLastError
	movl	%eax, %edi
	movl	$222, %esi
	callq	_ZL11HandleError10hipError_tPKci
	cmpq	$3, %rbx
	jne	.LBB9_27
# %bb.45:                               #   in Loop: Header=BB9_22 Depth=2
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_47
# %bb.46:                               #   in Loop: Header=BB9_22 Depth=2
	movq	48(%rsp), %rdi
	movq	144(%rsp), %rsi
	movq	192(%rsp,%r13,8), %rdx
	movq	120(%rsp), %rcx
	callq	_Z24__device_stub__deltaInitPfS_S_S_
.LBB9_47:                               #   in Loop: Header=BB9_22 Depth=2
	callq	hipGetLastError
	movl	%eax, %edi
	movl	$227, %esi
	callq	_ZL11HandleError10hipError_tPKci
	xorl	%ebx, %ebx
.LBB9_48:                               #   Parent Loop BB9_21 Depth=1
                                        #     Parent Loop BB9_22 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_50
# %bb.49:                               #   in Loop: Header=BB9_48 Depth=3
	cmpq	$-8, %rbx
	movl	$900, %r8d                      # imm = 0x384
	cmovel	%ebp, %r8d
	testq	%rbx, %rbx
	movl	$900, %r9d                      # imm = 0x384
	movl	$9, %eax
	cmovel	%eax, %r9d
	movq	80(%rsp,%rbx), %rdi
	movq	40(%rsp,%rbx), %rdx
	movq	48(%rsp,%rbx), %rsi
	movq	136(%rsp,%rbx), %rcx
	callq	_Z25__device_stub__gLayerBackPfS_S_S_ii
.LBB9_50:                               #   in Loop: Header=BB9_48 Depth=3
	callq	hipGetLastError
	movl	%eax, %edi
	movl	$238, %esi
	callq	_ZL11HandleError10hipError_tPKci
	addq	$-8, %rbx
	cmpq	$-16, %rbx
	jne	.LBB9_48
# %bb.51:                               # %.preheader252.preheader
                                        #   in Loop: Header=BB9_22 Depth=2
	xorl	%ebx, %ebx
.LBB9_52:                               # %.preheader252
                                        #   Parent Loop BB9_21 Depth=1
                                        #     Parent Loop BB9_22 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movabsq	$244813135929, %rdi             # imm = 0x3900000039
	movl	$1, %esi
	movabsq	$68719476752, %rdx              # imm = 0x1000000010
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_54
# %bb.53:                               #   in Loop: Header=BB9_52 Depth=3
	testq	%rbx, %rbx
	movl	$900, %ecx                      # imm = 0x384
	movl	$9, %eax
	cmovel	%eax, %ecx
	cmpq	$16, %rbx
	movl	$900, %r8d                      # imm = 0x384
	cmovel	%ebp, %r8d
	movq	64(%rsp,%rbx), %rdi
	movq	96(%rsp,%rbx), %rsi
	movq	32(%rsp,%rbx), %rdx
	movss	.LCPI9_6(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	callq	_Z27__device_stub__updateWeightPfS_S_fii
.LBB9_54:                               #   in Loop: Header=BB9_52 Depth=3
	callq	hipGetLastError
	movl	%eax, %edi
	movl	$249, %esi
	callq	_ZL11HandleError10hipError_tPKci
	addq	$8, %rbx
	cmpq	$24, %rbx
	jne	.LBB9_52
# %bb.55:                               #   in Loop: Header=BB9_22 Depth=2
	incq	%r13
	cmpq	$583, %r13                      # imm = 0x247
	jne	.LBB9_22
# %bb.29:                               #   in Loop: Header=BB9_21 Depth=1
	movq	8(%rsp), %rbx                   # 8-byte Reload
	incl	%ebx
	cmpl	$50, %ebx
	jne	.LBB9_21
# %bb.30:
	leaq	20064(%rsp), %r15
	leaq	68992(%rsp), %r12
	xorl	%ebx, %ebx
	callq	clock
	movq	%rax, %r14
.LBB9_31:                               # =>This Inner Loop Header: Depth=1
	movq	64(%rsp,%rbx,8), %rsi
	movl	$3240000, %edx                  # imm = 0x317040
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$257, %esi                      # imm = 0x101
	callq	_ZL11HandleError10hipError_tPKci
	movq	160(%rsp,%rbx,8), %rsi
	movl	$3600, %edx                     # imm = 0xE10
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$259, %esi                      # imm = 0x103
	callq	_ZL11HandleError10hipError_tPKci
	incq	%rbx
	addq	$3600, %r15                     # imm = 0xE10
	addq	$3240000, %r12                  # imm = 0x317040
	cmpq	$3, %rbx
	jne	.LBB9_31
# %bb.32:                               # %.preheader251.preheader
	xorl	%ebx, %ebx
.LBB9_33:                               # %.preheader251
                                        # =>This Inner Loop Header: Depth=1
	movq	64(%rsp,%rbx,8), %rdi
	callq	hipFree
	movl	%eax, %edi
	movl	$265, %esi                      # imm = 0x109
	callq	_ZL11HandleError10hipError_tPKci
	movq	160(%rsp,%rbx,8), %rdi
	callq	hipFree
	movl	%eax, %edi
	movl	$266, %esi                      # imm = 0x10A
	callq	_ZL11HandleError10hipError_tPKci
	movq	128(%rsp,%rbx,8), %rdi
	callq	hipFree
	movl	%eax, %edi
	movl	$267, %esi                      # imm = 0x10B
	callq	_ZL11HandleError10hipError_tPKci
	movq	32(%rsp,%rbx,8), %rdi
	callq	hipFree
	movl	%eax, %edi
	movl	$268, %esi                      # imm = 0x10C
	callq	_ZL11HandleError10hipError_tPKci
	incq	%rbx
	cmpq	$3, %rbx
	jne	.LBB9_33
# %bb.34:                               # %.preheader250.preheader
	xorl	%ebx, %ebx
.LBB9_35:                               # %.preheader250
                                        # =>This Inner Loop Header: Depth=1
	movq	96(%rsp,%rbx,8), %rdi
	callq	hipFree
	movl	%eax, %edi
	movl	$272, %esi                      # imm = 0x110
	callq	_ZL11HandleError10hipError_tPKci
	incq	%rbx
	cmpq	$4, %rbx
	jne	.LBB9_35
# %bb.36:                               # %.preheader249.preheader
	xorl	%ebx, %ebx
.LBB9_37:                               # %.preheader249
                                        # =>This Inner Loop Header: Depth=1
	movq	192(%rsp,%rbx,8), %rdi
	callq	hipFree
	movl	%eax, %edi
	movl	$276, %esi                      # imm = 0x114
	callq	_ZL11HandleError10hipError_tPKci
	incq	%rbx
	cmpq	$683, %rbx                      # imm = 0x2AB
	jne	.LBB9_37
# %bb.38:
	subq	16(%rsp), %r14                  # 8-byte Folded Reload
	movl	$.L.str.5, %edi
	movl	$.L.str.6, %esi
	callq	fopen
	cvtsi2ss	%r14, %xmm0
	movq	%rax, %rbx
	divss	.LCPI9_7(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.7, %esi
	movq	%rax, %rdi
	movl	$900, %edx                      # imm = 0x384
	movb	$1, %al
	callq	fprintf
	movq	%rbx, %rdi
	callq	fclose
	xorps	%xmm1, %xmm1
	movl	$583, %ecx                      # imm = 0x247
	xorl	%r15d, %r15d
	movl	$1, %ebp
	movl	$9, %r13d
	movl	$3600, %r12d                    # imm = 0xE10
.LBB9_39:                               # %.preheader248
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_40 Depth 2
	movaps	%xmm1, 16(%rsp)                 # 16-byte Spill
	movq	%rcx, 8(%rsp)                   # 8-byte Spill
	leaq	(%r15,%r15,4), %rax
	leaq	54184(%rsp), %rdx
	movl	32(%rdx,%rax,8), %ecx
	movl	%ecx, 5696(%rsp)
	movups	(%rdx,%rax,8), %xmm0
	movups	16(%rdx,%rax,8), %xmm1
	movaps	%xmm1, 5680(%rsp)
	movaps	%xmm0, 5664(%rsp)
	leaq	68992(%rsp), %rbx
	xorl	%r14d, %r14d
.LBB9_40:                               # %.preheader
                                        #   Parent Loop BB9_39 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	$7200, %r14                     # imm = 0x1C20
	movl	$900, %eax                      # imm = 0x384
	cmovel	%ebp, %eax
	testq	%r14, %r14
	movl	$900, %r9d                      # imm = 0x384
	cmovel	%r13d, %r9d
	leaq	5664(%rsp,%r14), %rsi
	leaq	(%rsi,%r12), %rdx
	leaq	58192(%rsp,%r14), %rcx
	leaq	(%rsp,%r14), %r8
	addq	$20064, %r8                     # imm = 0x4E60
	movl	%eax, (%rsp)
	movq	%rbx, %rdi
	callq	_Z7gLayer2PfS_S_S_S_ii
	addq	%r12, %r14
	addq	$3240000, %rbx                  # imm = 0x317040
	cmpq	$10800, %r14                    # imm = 0x2A30
	jne	.LBB9_40
# %bb.41:                               #   in Loop: Header=BB9_39 Depth=1
	movq	8(%rsp), %rcx                   # 8-byte Reload
	leaq	(%rcx,%rcx,4), %rax
	movss	16464(%rsp), %xmm0              # xmm0 = mem[0],zero,zero,zero
	cmpltss	.LCPI9_4(%rip), %xmm0
	movss	.LCPI9_1(%rip), %xmm2           # xmm2 = mem[0],zero,zero,zero
	andnps	%xmm2, %xmm0
	movaps	16(%rsp), %xmm3                 # 16-byte Reload
	movaps	%xmm3, %xmm1
	cmpeqss	30900(%rsp,%rax,8), %xmm0
	addss	%xmm2, %xmm1
	andps	%xmm0, %xmm1
	andnps	%xmm3, %xmm0
	orps	%xmm1, %xmm0
	incq	%rcx
	incq	%r15
	movaps	%xmm0, %xmm1
	cmpq	$100, %r15
	jne	.LBB9_39
# %bb.42:
	divss	.LCPI9_5(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.3, %edi
	movb	$1, %al
	callq	printf
	xorl	%eax, %eax
	addq	$9789000, %rsp                  # imm = 0x955E48
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end9:
	.size	main, .Lfunc_end9-main
	.cfi_endproc
                                        # -- End function
	.type	_ZL11HandleError10hipError_tPKci,@function # -- Begin function _ZL11HandleError10hipError_tPKci
_ZL11HandleError10hipError_tPKci:       # @_ZL11HandleError10hipError_tPKci
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jne	.LBB10_2
# %bb.1:
	retq
.LBB10_2:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	%esi, %ebx
	callq	hipGetErrorString
	movl	$.L.str.8, %edi
	movl	$.L.str.4, %edx
	movq	%rax, %rsi
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end10:
	.size	_ZL11HandleError10hipError_tPKci, .Lfunc_end10-_ZL11HandleError10hipError_tPKci
	.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	.LBB11_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB11_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10gLayerBackPfS_S_S_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	$_Z6gLayerPfS_S_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	$_Z12updateWeightPfS_S_fii, %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	$_Z9deltaInitPfS_S_S_, %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	$_Z9valueInitPfS_i, %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_end11:
	.size	__hip_module_ctor, .Lfunc_end11-__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	.LBB12_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
.LBB12_2:
	retq
.Lfunc_end12:
	.size	__hip_module_dtor, .Lfunc_end12-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z10gLayerBackPfS_S_S_ii,@object # @_Z10gLayerBackPfS_S_S_ii
	.section	.rodata,"a",@progbits
	.globl	_Z10gLayerBackPfS_S_S_ii
	.p2align	3, 0x0
_Z10gLayerBackPfS_S_S_ii:
	.quad	_Z25__device_stub__gLayerBackPfS_S_S_ii
	.size	_Z10gLayerBackPfS_S_S_ii, 8

	.type	_Z6gLayerPfS_S_S_S_ii,@object   # @_Z6gLayerPfS_S_S_S_ii
	.globl	_Z6gLayerPfS_S_S_S_ii
	.p2align	3, 0x0
_Z6gLayerPfS_S_S_S_ii:
	.quad	_Z21__device_stub__gLayerPfS_S_S_S_ii
	.size	_Z6gLayerPfS_S_S_S_ii, 8

	.type	_Z12updateWeightPfS_S_fii,@object # @_Z12updateWeightPfS_S_fii
	.globl	_Z12updateWeightPfS_S_fii
	.p2align	3, 0x0
_Z12updateWeightPfS_S_fii:
	.quad	_Z27__device_stub__updateWeightPfS_S_fii
	.size	_Z12updateWeightPfS_S_fii, 8

	.type	_Z9deltaInitPfS_S_S_,@object    # @_Z9deltaInitPfS_S_S_
	.globl	_Z9deltaInitPfS_S_S_
	.p2align	3, 0x0
_Z9deltaInitPfS_S_S_:
	.quad	_Z24__device_stub__deltaInitPfS_S_S_
	.size	_Z9deltaInitPfS_S_S_, 8

	.type	_Z9valueInitPfS_i,@object       # @_Z9valueInitPfS_i
	.globl	_Z9valueInitPfS_i
	.p2align	3, 0x0
_Z9valueInitPfS_i:
	.quad	_Z24__device_stub__valueInitPfS_i
	.size	_Z9valueInitPfS_i, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"data/breast-cancer-wisconsin.data"
	.size	.L.str, 34

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

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"%f\n"
	.size	.L.str.3, 4

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/Joel-Venzke/parallel_neural_network/master/src/parallel.hip"
	.size	.L.str.4, 122

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"data/parallel.dat"
	.size	.L.str.5, 18

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

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"%d\t%f\n"
	.size	.L.str.7, 7

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"%s in %s at line %d\n"
	.size	.L.str.8, 21

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z10gLayerBackPfS_S_S_ii"
	.size	.L__unnamed_1, 25

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

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z12updateWeightPfS_S_fii"
	.size	.L__unnamed_3, 26

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z9deltaInitPfS_S_S_"
	.size	.L__unnamed_4, 21

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"_Z9valueInitPfS_i"
	.size	.L__unnamed_5, 18

	.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 _Z25__device_stub__gLayerBackPfS_S_S_ii
	.addrsig_sym _Z21__device_stub__gLayerPfS_S_S_S_ii
	.addrsig_sym _Z27__device_stub__updateWeightPfS_S_fii
	.addrsig_sym _Z24__device_stub__deltaInitPfS_S_S_
	.addrsig_sym _Z24__device_stub__valueInitPfS_i
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z10gLayerBackPfS_S_S_ii
	.addrsig_sym _Z6gLayerPfS_S_S_S_ii
	.addrsig_sym _Z12updateWeightPfS_S_fii
	.addrsig_sym _Z9deltaInitPfS_S_S_
	.addrsig_sym _Z9valueInitPfS_i
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z10gLayerBackPfS_S_S_ii ; -- Begin function _Z10gLayerBackPfS_S_S_ii
	.globl	_Z10gLayerBackPfS_S_S_ii
	.p2align	8
	.type	_Z10gLayerBackPfS_S_S_ii,@function
_Z10gLayerBackPfS_S_S_ii:               ; @_Z10gLayerBackPfS_S_S_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s6, s[0:1], 0x34
	s_load_b64 s[2:3], s[0:1], 0x20
	s_add_u32 s4, s0, 40
	s_addc_u32 s5, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s13, s6, 0xffff
	s_mov_b32 s6, exec_lo
	v_mad_u64_u32 v[1:2], null, s15, s13, v[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB0_6
; %bb.1:                                ; %.preheader.lr.ph
	s_load_b32 s14, s[4:5], 0x0
	s_load_b256 s[4:11], s[0:1], 0x0
	v_mul_lo_u32 v3, 0x384, v1
	v_mov_b32_e32 v0, 0
	s_cmp_gt_i32 s2, 0
	s_cselect_b32 s12, -1, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s13, s14, s13
	s_mov_b32 s14, 0
	s_mul_i32 s15, s13, 0x384
.LBB0_2:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_4 Depth 2
	v_mov_b32_e32 v6, 0
	s_and_not1_b32 vcc_lo, exec_lo, s12
	s_cbranch_vccnz .LBB0_5
; %bb.3:                                ; %.lr.ph
                                        ;   in Loop: Header=BB0_2 Depth=1
	v_ashrrev_i32_e32 v4, 31, v3
	v_mov_b32_e32 v6, 0
	s_mov_b64 s[0:1], s[6:7]
	s_mov_b32 s16, s2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 2, v[3:4]
	v_add_co_u32 v4, vcc_lo, s4, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v5, vcc_lo
.LBB0_4:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	global_load_b32 v2, v0, s[0:1]
	global_load_b32 v7, v[4:5], off
	v_add_co_u32 v4, vcc_lo, v4, 4
	s_add_i32 s16, s16, -1
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v5, vcc_lo
	s_add_u32 s0, s0, 4
	s_addc_u32 s1, s1, 0
	s_cmp_eq_u32 s16, 0
	s_waitcnt vmcnt(0)
	v_fmac_f32_e32 v6, v2, v7
	s_cbranch_scc0 .LBB0_4
.LBB0_5:                                ; %Flow50
                                        ;   in Loop: Header=BB0_2 Depth=1
	v_ashrrev_i32_e32 v2, 31, v1
	v_add_nc_u32_e32 v3, s15, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	v_add_nc_u32_e32 v1, s13, v1
	v_add_co_u32 v7, vcc_lo, s10, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v8, vcc_lo, s11, v5, vcc_lo
	v_add_co_u32 v4, s0, s8, v4
	v_add_co_ci_u32_e64 v5, s0, s9, v5, s0
	global_load_b32 v2, v[7:8], off
	s_waitcnt vmcnt(0)
	v_mul_f32_e32 v7, 0xbfb8aa3b, v2
	v_cmp_nlt_f32_e32 vcc_lo, 0x42ce8ed0, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f32 v8, 0xbfb8aa3b, v2, -v7
	v_rndne_f32_e32 v9, v7
	v_dual_fmac_f32 v8, 0xb2a5705f, v2 :: v_dual_sub_f32 v7, v7, v9
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f32_e32 v7, v7, v8
	v_cvt_i32_f32_e32 v8, v9
	v_exp_f32_e32 v7, v7
	s_waitcnt_depctr 0xfff
	v_ldexp_f32 v7, v7, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v7, 0, v7, vcc_lo
	v_cmp_ngt_f32_e32 vcc_lo, 0xc2b17218, v2
	v_cndmask_b32_e32 v2, 0x7f800000, v7, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f64_f32_e32 v[7:8], v2
	v_add_f64 v[7:8], v[7:8], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f64 v[9:10], null, v[7:8], v[7:8], 1.0
	v_div_scale_f64 v[15:16], vcc_lo, 1.0, v[7:8], 1.0
	v_rcp_f64_e32 v[11:12], v[9:10]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[13:14], -v[9:10], v[11:12], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[11:12], v[11:12], v[13:14], v[11:12]
	v_fma_f64 v[13:14], -v[9:10], v[11:12], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[11:12], v[11:12], v[13:14], v[11:12]
	v_mul_f64 v[13:14], v[15:16], v[11:12]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[9:10], -v[9:10], v[13:14], v[15:16]
	v_div_fmas_f64 v[9:10], v[9:10], v[11:12], v[13:14]
	v_cmp_le_i32_e32 vcc_lo, s3, v1
	s_or_b32 s14, vcc_lo, s14
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f64 v[7:8], v[9:10], v[7:8], 1.0
	v_cvt_f32_f64_e32 v2, v[7:8]
	s_delay_alu instid0(VALU_DEP_1)
	v_mul_f32_e32 v2, v6, v2
	global_store_b32 v[4:5], v2, off
	s_and_not1_b32 exec_lo, exec_lo, s14
	s_cbranch_execnz .LBB0_2
.LBB0_6:                                ; %._crit_edge26
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10gLayerBackPfS_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 17
		.amdhsa_next_free_sgpr 17
		.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	_Z10gLayerBackPfS_S_S_ii, .Lfunc_end0-_Z10gLayerBackPfS_S_S_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 580
; NumSgprs: 19
; NumVgprs: 17
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 19
; NumVGPRsForWavesPerEU: 17
; 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	_Z6gLayerPfS_S_S_S_ii   ; -- Begin function _Z6gLayerPfS_S_S_S_ii
	.globl	_Z6gLayerPfS_S_S_S_ii
	.p2align	8
	.type	_Z6gLayerPfS_S_S_S_ii,@function
_Z6gLayerPfS_S_S_S_ii:                  ; @_Z6gLayerPfS_S_S_S_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s6, s[0:1], 0x3c
	s_load_b64 s[2:3], s[0:1], 0x28
	s_add_u32 s4, s0, 48
	s_addc_u32 s5, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s16, s6, 0xffff
	s_mov_b32 s6, exec_lo
	v_mad_u64_u32 v[1:2], null, s15, s16, v[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB1_6
; %bb.1:                                ; %.preheader.lr.ph
	s_load_b32 s15, s[4:5], 0x0
	s_clause 0x1
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b64 s[12:13], s[0:1], 0x20
	v_mul_lo_u32 v3, 0x384, v1
	v_mov_b32_e32 v0, 0
	s_cmp_gt_i32 s2, 0
	s_cselect_b32 s14, -1, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s15, s15, s16
	s_mov_b32 s16, 0
	s_mul_i32 s17, s15, 0x384
.LBB1_2:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB1_4 Depth 2
	v_mov_b32_e32 v6, 0
	s_and_not1_b32 vcc_lo, exec_lo, s14
	s_cbranch_vccnz .LBB1_5
; %bb.3:                                ; %.lr.ph
                                        ;   in Loop: Header=BB1_2 Depth=1
	v_ashrrev_i32_e32 v4, 31, v3
	v_mov_b32_e32 v6, 0
	s_mov_b64 s[0:1], s[6:7]
	s_mov_b32 s18, s2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 2, v[3:4]
	v_add_co_u32 v4, vcc_lo, s4, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v5, vcc_lo
.LBB1_4:                                ;   Parent Loop BB1_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	global_load_b32 v2, v0, s[0:1]
	global_load_b32 v7, v[4:5], off
	v_add_co_u32 v4, vcc_lo, v4, 4
	s_add_i32 s18, s18, -1
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v5, vcc_lo
	s_add_u32 s0, s0, 4
	s_addc_u32 s1, s1, 0
	s_cmp_eq_u32 s18, 0
	s_waitcnt vmcnt(0)
	v_fmac_f32_e32 v6, v2, v7
	s_cbranch_scc0 .LBB1_4
.LBB1_5:                                ; %Flow58
                                        ;   in Loop: Header=BB1_2 Depth=1
	v_ashrrev_i32_e32 v2, 31, v1
	v_add_nc_u32_e32 v3, s17, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	v_add_nc_u32_e32 v1, s15, v1
	v_add_co_u32 v7, vcc_lo, s12, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v8, vcc_lo, s13, v5, vcc_lo
	global_load_b32 v2, v[7:8], off
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v2, v6, v2
	v_mul_f32_e32 v6, 0xbfb8aa3b, v2
	v_cmp_nlt_f32_e32 vcc_lo, 0x42ce8ed0, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f32 v7, 0xbfb8aa3b, v2, -v6
	v_rndne_f32_e32 v8, v6
	v_dual_fmac_f32 v7, 0xb2a5705f, v2 :: v_dual_sub_f32 v6, v6, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f32_e32 v6, v6, v7
	v_cvt_i32_f32_e32 v7, v8
	v_exp_f32_e32 v6, v6
	s_waitcnt_depctr 0xfff
	v_ldexp_f32 v6, v6, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v6, 0, v6, vcc_lo
	v_cmp_ngt_f32_e32 vcc_lo, 0xc2b17218, v2
	v_cndmask_b32_e32 v6, 0x7f800000, v6, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f64_f32_e32 v[6:7], v6
	v_add_f64 v[6:7], v[6:7], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_scale_f64 v[8:9], null, v[6:7], v[6:7], 1.0
	v_rcp_f64_e32 v[10:11], v[8:9]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[12:13], -v[8:9], v[10:11], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], v[10:11], v[12:13], v[10:11]
	v_fma_f64 v[12:13], -v[8:9], v[10:11], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], v[10:11], v[12:13], v[10:11]
	v_div_scale_f64 v[12:13], vcc_lo, 1.0, v[6:7], 1.0
	v_mul_f64 v[14:15], v[12:13], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[8:9], -v[8:9], v[14:15], v[12:13]
	v_div_fmas_f64 v[8:9], v[8:9], v[10:11], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f64 v[6:7], v[8:9], v[6:7], 1.0
	v_cvt_f32_f64_e32 v8, v[6:7]
	v_add_co_u32 v6, vcc_lo, s10, v4
	v_add_co_ci_u32_e32 v7, vcc_lo, s11, v5, vcc_lo
	v_cmp_le_i32_e32 vcc_lo, s3, v1
	v_add_co_u32 v4, s0, s8, v4
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v5, s0, s9, v5, s0
	s_or_b32 s16, vcc_lo, s16
	global_store_b32 v[6:7], v2, off
	global_store_b32 v[4:5], v8, off
	s_and_not1_b32 exec_lo, exec_lo, s16
	s_cbranch_execnz .LBB1_2
.LBB1_6:                                ; %._crit_edge31
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6gLayerPfS_S_S_S_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 304
		.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 16
		.amdhsa_next_free_sgpr 19
		.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	_Z6gLayerPfS_S_S_S_ii, .Lfunc_end1-_Z6gLayerPfS_S_S_S_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 612
; NumSgprs: 21
; NumVgprs: 16
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 21
; NumVGPRsForWavesPerEU: 16
; 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	_Z12updateWeightPfS_S_fii ; -- Begin function _Z12updateWeightPfS_S_fii
	.globl	_Z12updateWeightPfS_S_fii
	.p2align	8
	.type	_Z12updateWeightPfS_S_fii,@function
_Z12updateWeightPfS_S_fii:              ; @_Z12updateWeightPfS_S_fii
; %bb.0:
	s_clause 0x1
	s_load_b32 s12, s[0:1], 0x34
	s_load_b128 s[4:7], s[0:1], 0x18
	v_and_b32_e32 v3, 0x3ff, v0
	s_add_u32 s2, s0, 40
	s_addc_u32 s3, s1, 0
	s_mov_b32 s8, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s7, s12, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s14, s7, v[3:4]
	v_cmpx_gt_i32_e64 s6, v1
	s_cbranch_execz .LBB2_6
; %bb.1:                                ; %.preheader.lr.ph
	s_load_b64 s[16:17], s[2:3], 0x0
	s_clause 0x1
	s_load_b128 s[8:11], s[0:1], 0x0
	s_load_b64 s[2:3], s[0:1], 0x10
	v_bfe_u32 v0, v0, 10, 10
	s_lshr_b32 s0, s12, 16
	s_mov_b32 s13, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[3:4], null, s15, s0, v[0:1]
	v_mul_lo_u32 v0, 0x384, v1
	v_cmp_gt_i32_e32 vcc_lo, s5, v3
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s1, s16, s7
	s_mul_i32 s7, s17, s0
	s_mul_i32 s12, s1, 0x384
.LBB2_2:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB2_4 Depth 2
	s_and_saveexec_b32 s14, vcc_lo
	s_cbranch_execz .LBB2_5
; %bb.3:                                ; %.lr.ph
                                        ;   in Loop: Header=BB2_2 Depth=1
	v_ashrrev_i32_e32 v2, 31, v1
	v_mov_b32_e32 v6, v3
	s_mov_b32 s15, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	v_add_co_u32 v4, s0, s10, v4
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v5, s0, s11, v5, s0
.LBB2_4:                                ;   Parent Loop BB2_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	v_add_nc_u32_e32 v8, v0, v6
	v_ashrrev_i32_e32 v7, 31, v6
	global_load_b32 v2, v[4:5], off
	v_ashrrev_i32_e32 v9, 31, v8
	v_lshlrev_b64 v[10:11], 2, v[6:7]
	v_add_nc_u32_e32 v6, s7, v6
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[7:8], 2, v[8:9]
	v_add_co_u32 v9, s0, s2, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e64 v10, s0, s3, v11, s0
	v_add_co_u32 v7, s0, s8, v7
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v8, s0, s9, v8, s0
	v_cmp_le_i32_e64 s0, s5, v6
	global_load_b32 v9, v[9:10], off
	global_load_b32 v10, v[7:8], off
	s_or_b32 s15, s0, s15
	s_waitcnt vmcnt(2)
	v_mul_f32_e32 v2, s4, v2
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_fmac_f32_e32 v10, v2, v9
	global_store_b32 v[7:8], v10, off
	s_and_not1_b32 exec_lo, exec_lo, s15
	s_cbranch_execnz .LBB2_4
.LBB2_5:                                ; %Flow45
                                        ;   in Loop: Header=BB2_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s14
	v_add_nc_u32_e32 v1, s1, v1
	v_add_nc_u32_e32 v0, s12, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_le_i32_e64 s0, s6, v1
	s_or_b32 s13, s0, s13
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s13
	s_cbranch_execnz .LBB2_2
.LBB2_6:                                ; %._crit_edge25
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z12updateWeightPfS_S_fii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 12
		.amdhsa_next_free_sgpr 18
		.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	_Z12updateWeightPfS_S_fii, .Lfunc_end2-_Z12updateWeightPfS_S_fii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 420
; NumSgprs: 20
; NumVgprs: 12
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 20
; NumVGPRsForWavesPerEU: 12
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z9deltaInitPfS_S_S_    ; -- Begin function _Z9deltaInitPfS_S_S_
	.globl	_Z9deltaInitPfS_S_S_
	.p2align	8
	.type	_Z9deltaInitPfS_S_S_,@function
_Z9deltaInitPfS_S_S_:                   ; @_Z9deltaInitPfS_S_S_
; %bb.0:
	s_load_b256 s[0:7], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_load_b32 s2, s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	v_mul_f32_e64 v0, 0xbfb8aa3b, s2
	v_cmp_nlt_f32_e64 vcc_lo, 0x42ce8ed0, s2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f32 v1, 0xbfb8aa3b, s2, -v0
	v_rndne_f32_e32 v2, v0
	v_dual_fmamk_f32 v1, s2, 0xb2a5705f, v1 :: v_dual_sub_f32 v0, v0, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f32_e32 v0, v0, v1
	v_cvt_i32_f32_e32 v1, v2
	v_exp_f32_e32 v0, v0
	s_waitcnt_depctr 0xfff
	v_ldexp_f32 v0, v0, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v0, 0, v0, vcc_lo
	v_cmp_ngt_f32_e64 vcc_lo, 0xc2b17218, s2
	s_load_b32 s2, s[4:5], 0x24
	s_load_b32 s3, s[6:7], 0x0
	v_cndmask_b32_e32 v0, 0x7f800000, v0, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f64_f32_e32 v[0:1], v0
	v_add_f64 v[0:1], v[0:1], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_scale_f64 v[2:3], null, v[0:1], v[0:1], 1.0
	v_rcp_f64_e32 v[4:5], v[2:3]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]
	v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]
	v_div_scale_f64 v[6:7], vcc_lo, 1.0, v[0:1], 1.0
	v_mul_f64 v[8:9], v[6:7], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]
	v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0
	v_mov_b32_e32 v2, 0
	v_cvt_f32_f64_e32 v0, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_sub_f32_e64 v1, s2, s3
	s_delay_alu instid0(VALU_DEP_1)
	v_mul_f32_e32 v0, v1, v0
	global_store_b32 v2, v0, s[0:1]
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9deltaInitPfS_S_S_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 32
		.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 10
		.amdhsa_next_free_sgpr 8
		.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	_Z9deltaInitPfS_S_S_, .Lfunc_end3-_Z9deltaInitPfS_S_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 324
; NumSgprs: 10
; NumVgprs: 10
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 1
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 10
; NumVGPRsForWavesPerEU: 10
; 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	_Z9valueInitPfS_i       ; -- Begin function _Z9valueInitPfS_i
	.globl	_Z9valueInitPfS_i
	.p2align	8
	.type	_Z9valueInitPfS_i,@function
_Z9valueInitPfS_i:                      ; @_Z9valueInitPfS_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x10
	s_load_b128 s[0:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s5, s4, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[4:5], s[4:5], 2
	s_add_u32 s2, s2, s4
	s_addc_u32 s3, s3, s5
	s_add_u32 s0, s0, s4
	s_load_b32 s2, s[2:3], 0x0
	v_mov_b32_e32 v0, 0
	s_addc_u32 s1, s1, s5
	s_waitcnt lgkmcnt(0)
	v_mov_b32_e32 v1, s2
	global_store_b32 v0, v1, s[0:1]
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9valueInitPfS_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 20
		.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 2
		.amdhsa_next_free_sgpr 6
		.amdhsa_reserve_vcc 0
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end4:
	.size	_Z9valueInitPfS_i, .Lfunc_end4-_Z9valueInitPfS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 92
; NumSgprs: 6
; NumVgprs: 2
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 6
; NumVGPRsForWavesPerEU: 2
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .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:           _Z10gLayerBackPfS_S_S_ii
    .private_segment_fixed_size: 0
    .sgpr_count:     19
    .sgpr_spill_count: 0
    .symbol:         _Z10gLayerBackPfS_S_S_ii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     17
    .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
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         52
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         60
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         62
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         64
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         66
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         68
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         70
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         112
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 304
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z6gLayerPfS_S_S_S_ii
    .private_segment_fixed_size: 0
    .sgpr_count:     21
    .sgpr_spill_count: 0
    .symbol:         _Z6gLayerPfS_S_S_S_ii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     16
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z12updateWeightPfS_S_fii
    .private_segment_fixed_size: 0
    .sgpr_count:     20
    .sgpr_spill_count: 0
    .symbol:         _Z12updateWeightPfS_S_fii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     12
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .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
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 32
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9deltaInitPfS_S_S_
    .private_segment_fixed_size: 0
    .sgpr_count:     10
    .sgpr_spill_count: 0
    .symbol:         _Z9deltaInitPfS_S_S_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     10
    .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
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 20
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9valueInitPfS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     6
    .sgpr_spill_count: 0
    .symbol:         _Z9valueInitPfS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     2
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
