// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/rbf.c
// Function: train_rbfnetwork_cls
Rbfnetworkptr train_rbfnetwork_cls(Instanceptr traindata, Instanceptr cvdata, Rbf_parameterptr params)
{
	/*!Last Changed 19.08.2007*/
	int i, j, *array, performance, bestperformance, datasize = data_size(traindata);
	double *p, *y;
	Instanceptr inst;
	Rbfnetworkptr bestnetwork, network;
 Rbfweights prevweights, delta;
	network = allocate_rbfnetwork(params);
	initialize_rbfnetwork(network, traindata, params);
	p = safemalloc((network->hidden + 1) * sizeof(double), "train_rbfnetwork_cls", 7);
	y = safemalloc(network->output * sizeof(double), "train_rbfnetwork_cls", 8);
	params->eta = params->initialeta;
 allocate_rbfweights(&prevweights, params);
 for (i = 0; i < params->epochs; i++)
	 {
		 array = random_array(datasize);
			for (j = 0; j < datasize; j++)
			 {
				 inst = data_x(traindata, array[j]);
				 rbf_forward_propagation(network, inst, p, y);
					delta = rbf_backward_propagation(network, inst, p, y, params);     
     update_rbfweights(network, delta, prevweights, params);
     copy_rbfweights(&prevweights, delta);
     free_rbfweights(delta);
			 }
			safe_free(array);
			performance = test_rbfnetwork_cls(network, cvdata);
		 if (i > 0)
			 {
			  if (performance > bestperformance)
					 {
				   params->bestepoch = i;
				   bestperformance = performance;
				   free_rbfnetwork(bestnetwork);
							bestnetwork = copy_of_rbfnetwork(network, params);
					 }
			 }
		 else
			 {
			  params->bestepoch = i;
			  bestperformance = performance;
					bestnetwork = copy_of_rbfnetwork(network, params);
			 }
		 params->eta *= params->etadecrease;
	 }
	safe_free(p);
	safe_free(y);
 free_rbfweights(prevweights);
 free_rbfnetwork(network);
	return bestnetwork;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x449f0
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9d1f0
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x9d260
movq -0x60(%rbp), %rax
movl (%rax), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
leaq 0x4e0a1(%rip), %rsi     # 0xebe59
movl $0x7, %edx
callq 0x52d70
movq %rax, -0x40(%rbp)
movq -0x60(%rbp), %rax
movslq 0x4(%rax), %rdi
shlq $0x3, %rdi
leaq 0x4e080(%rip), %rsi     # 0xebe59
movl $0x8, %edx
callq 0x52d70
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x28(%rax)
movq -0x18(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x9d120
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x9dfed
movl -0x34(%rbp), %edi
callq 0x54600
movq %rax, -0x28(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x9df54
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x46c40
movq %rax, -0x50(%rbp)
movq -0x60(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
callq 0x9d4f0
movq -0x60(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %r8
movq -0x18(%rbp), %r9
leaq -0xf0(%rbp), %rdi
callq 0x9d700
leaq -0xc0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
movl $0x30, %edx
callq 0x42b0
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
movups -0x90(%rbp), %xmm0
movups -0x80(%rbp), %xmm1
movups -0x70(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x50(%rax)
movups %xmm1, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movups -0xc0(%rbp), %xmm0
movups -0xb0(%rbp), %xmm1
movups -0xa0(%rbp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x9da50
movups -0xc0(%rbp), %xmm0
movups -0xb0(%rbp), %xmm1
movups -0xa0(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x90(%rbp), %rdi
callq 0x9d390
movups -0xc0(%rbp), %xmm0
movups -0xb0(%rbp), %xmm1
movups -0xa0(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x9d080
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x9de33
movq -0x28(%rbp), %rdi
callq 0x52e80
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x9dc80
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x9dfa7
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jle 0x9dfa5
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x58(%rbp), %rdi
callq 0x9d0d0
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9d3f0
movq %rax, -0x58(%rbp)
jmp 0x9dfc8
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9d3f0
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movsd 0x30(%rax), %xmm0
movq -0x18(%rbp), %rax
mulsd 0x28(%rax), %xmm0
movsd %xmm0, 0x28(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x9de10
movq -0x40(%rbp), %rdi
callq 0x52e80
movq -0x48(%rbp), %rdi
callq 0x52e80
movups -0x90(%rbp), %xmm0
movups -0x80(%rbp), %xmm1
movups -0x70(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x9d080
movq -0x60(%rbp), %rdi
callq 0x9d0d0
movq -0x58(%rbp), %rax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw (%rax,%rax)