// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/mlp.c
// Function: testMlpnInput_cls
double testMlpnInput_cls(double *Test, matrix* testY, Mlpnetwork N, int* correctlyclassified, double* prob)
{
	/*!Last Changed 09.02.2004 Oya*/
	double sqrderror;
	matrix output_error;
	matrixptr testH;
	int li, output, classno;		
	output_error = matrix_alloc(1, N.P.classnum);
	*testY = matrix_alloc(1, N.P.classnum);
	testH = allocate_hiddens(N.P);
	/*calculate hidden layers*/
	for (li=0; li<N.P.layernum; li++)
	 {
 		if (li == 0)
  			calculate_hidden_values(Test, N.weights[0], &testH[0]);
	 	else
	  		calculate_hidden_values(testH[li-1].values[0], N.weights[li], &testH[li]);
	 }
	/*calculate outputs*/
	if (N.P.layernum == 0)
  	calculate_output_values_cls(Test, N.weights[N.P.layernum], testY);
	else
		 calculate_output_values_cls(testH[N.P.layernum-1].values[0], N.weights[N.P.layernum], testY);
	/*calculate error*/
	sqrderror = calculate_error_values_cls(Test[N.P.dimnum], *testY, &output_error);
	output = findMaxOutput(testY->values[0], N.P.classnum);
	classno = (int)Test[N.P.dimnum];
	*prob = testY->values[0][classno];
	matrix_free(output_error);
	free_hiddens(testH, N.P.layernum);	
	if (classno == output)
		 *correctlyclassified = 1;
	else
		 *correctlyclassified = 0;
	return sqrderror;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rcx, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x110(%rsp), %rbp
leaq 0x118(%rsp), %r14
movl (%r14), %r15d
movl $0x1, %edi
movl %r15d, %esi
callq 0x3d79d
movq %rax, 0x18(%rsp)
movq %rax, 0x38(%rsp)
movq %rdx, 0x10(%rsp)
movq %rdx, 0x40(%rsp)
movl $0x1, %edi
movl %r15d, 0x4(%rsp)
movl %r15d, %esi
callq 0x3d79d
movq %rax, (%rbx)
movq %rbx, 0x20(%rsp)
movq %rdx, 0x8(%rbx)
leaq 0x48(%rsp), %r13
movl $0x90, %edx
movq %r13, %rdi
movq %r14, %rsi
callq 0x4310
movslq 0x54(%r13), %rbx
testq %rbx, %rbx
jle 0x4649b
movq %rbx, %rdi
shlq $0x4, %rdi
leaq 0x63f44(%rip), %rsi     # 0xaa3a5
movl $0x4, %edx
callq 0x3a0e1
movq %rax, %r14
shlq $0x2, %rbx
xorl %r15d, %r15d
movl 0x90(%rsp,%r15), %esi
movl $0x1, %edi
callq 0x3d79d
movq %rax, (%r14,%r15,4)
movq %rdx, 0x8(%r14,%r15,4)
addq $0x4, %r15
cmpq %r15, %rbx
jne 0x46475
jmp 0x4649e
xorl %r14d, %r14d
movslq 0x5c(%rbp), %rbx
testq %rbx, %rbx
jle 0x464f5
leaq 0x110(%rsp), %rax
movq (%rax), %rbp
movq %rbx, %r13
shlq $0x4, %r13
xorl %r15d, %r15d
testq %r15, %r15
je 0x464d9
leaq (%r14,%r15), %rcx
movq -0x8(%r14,%r15), %rax
movq (%rax), %rdi
movq (%rbp,%r15), %rsi
movq 0x8(%rbp,%r15), %rdx
jmp 0x464e7
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
movq %r12, %rdi
movq %r14, %rcx
callq 0x44d21
addq $0x10, %r15
cmpq %r15, %r13
jne 0x464bc
testl %ebx, %ebx
je 0x46513
shlq $0x4, %rbx
movq -0x8(%r14,%rbx), %rax
movq (%rax), %rdi
leaq 0x110(%rsp), %r13
addq (%r13), %rbx
jmp 0x46522
leaq 0x110(%rsp), %r13
movq (%r13), %rbx
movq %r12, %rdi
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x20(%rsp), %rbp
movq %rbp, %rcx
callq 0x4521e
movslq 0xc(%r13), %r15
movsd (%r12,%r15,8), %xmm0
movq (%rbp), %rdi
movq 0x8(%rbp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x456cd
movsd %xmm0, 0x8(%rsp)
movq 0x8(%rbp), %rax
movq (%rax), %rdi
movl 0x4(%rsp), %esi
callq 0x38362
movl %eax, %ebx
cvttsd2si (%r12,%r15,8), %eax
movq 0x8(%rbp), %rcx
movq (%rcx), %rcx
movslq %eax, %r15
movsd (%rcx,%r15,8), %xmm0
movq 0x28(%rsp), %rax
movsd %xmm0, (%rax)
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3ed51
movl 0x5c(%r13), %esi
movq %r14, %rdi
callq 0x45692
xorl %eax, %eax
cmpl %r15d, %ebx
sete %al
movq 0x30(%rsp), %rcx
movl %eax, (%rcx)
movsd 0x8(%rsp), %xmm0
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq