// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/poly.c
// Function: polyfitcls
Polynomptr polyfitcls(double** data, int datasize, int degree)
{
	/*!Last Changed 26.01.2005*/
	int i, j, *array;
	double random_value, o, y, eta, *deltaw, update;
	Polynomptr p = create_polynom();
	Polynodeptr node;
 for (i = 0; i <= degree; i++)
	 {
		 random_value = produce_random_value(-0.01, 0.01);
		 add_polynode_to_polynom(p, i, random_value);
	 }
	eta = get_parameter_f("learning_rate");
	deltaw = safecalloc((degree + 1), sizeof(double), "polyfitcls", 11);
	for (j = 0; j < get_parameter_i("perceptronrun"); j++)
	 {
			array = random_array(datasize);
			for (i = 0; i < datasize; i++)
			 {
				 o = polynom_value(p, data[array[i]][0]);
					y = sigmoid(o);
     node = p->start;
					while (node)
					 {
						 update = (eta * (data[array[i]][1] - y) * fpow(data[array[i]][0], node->power) + get_parameter_f("alpha") * deltaw[node->power]);
						 node->coefficient += update;
							deltaw[node->power] = update;
						 node = node->next;
					 }
			 }
			safe_free(array);
			eta *= get_parameter_f("etadecrease");
	 }
	safe_free(deltaw);
 return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
callq 0x82340
movq %rax, -0x58(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
jg 0x82d03
movsd 0x5fd83(%rip), %xmm0    # 0xe2a58
movsd 0x5f343(%rip), %xmm1    # 0xe2020
callq 0x545a0
movsd %xmm0, -0x28(%rbp)
movq -0x58(%rbp), %rdi
movl -0x14(%rbp), %esi
movsd -0x28(%rbp), %xmm0
callq 0x80e00
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x82cc5
leaq 0x5f905(%rip), %rdi     # 0xe260f
callq 0x79040
movsd %xmm0, -0x40(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
movl $0x8, %esi
leaq 0x64b55(%rip), %rdx     # 0xe787e
movl $0xb, %ecx
callq 0x52f40
movq %rax, -0x48(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x64(%rbp)
leaq 0x5f8d2(%rip), %rdi     # 0xe261d
callq 0x78f10
movl %eax, %ecx
movl -0x64(%rbp), %eax
cmpl %ecx, %eax
jge 0x82ec8
movl -0xc(%rbp), %edi
callq 0x54600
movq %rax, -0x20(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x82e9b
movq -0x58(%rbp), %rdi
movq -0x8(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x14(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax), %xmm0
callq 0x81500
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0x7aab0
movsd %xmm0, -0x38(%rbp)
movq -0x58(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x82e8b
movsd -0x40(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x14(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rax
movsd 0x8(%rax), %xmm1
subsd -0x38(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x14(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax), %xmm0
movq -0x60(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x52840
movsd %xmm0, -0x78(%rbp)
leaq 0x5f922(%rip), %rdi     # 0xe2745
callq 0x79040
movsd -0x78(%rbp), %xmm2
movaps %xmm0, %xmm1
movsd -0x70(%rbp), %xmm0
movq -0x48(%rbp), %rax
movq -0x60(%rbp), %rcx
movslq 0x8(%rcx), %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
movq -0x60(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movsd -0x50(%rbp), %xmm0
movq -0x48(%rbp), %rax
movq -0x60(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x82dbc
jmp 0x82e8d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x82d70
movq -0x20(%rbp), %rdi
callq 0x52e80
leaq 0x5f758(%rip), %rdi     # 0xe2603
callq 0x79040
mulsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x82d3e
movq -0x48(%rbp), %rdi
callq 0x52e80
movq -0x58(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nop