// File: /workspace/github_c_makefile_star2_O2/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, 0xb8(%rsp)
movq %rdx, 0xc0(%rsp)
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x118(%rsp), %r13
movl (%r13), %ebp
pushq $0x1
popq %r14
movl %r14d, %edi
movl %ebp, %esi
callq 0x380d3
movq %rax, 0xb0(%rsp)
movq %rax, 0xc8(%rsp)
movq %rdx, 0xa8(%rsp)
movq %rdx, 0xd0(%rsp)
movl %r14d, %edi
movl %ebp, 0xa4(%rsp)
movl %ebp, %esi
callq 0x380d3
movq %rax, (%rbx)
movq %rbx, 0x98(%rsp)
movq %rdx, 0x8(%rbx)
pushq $0x12
popq %rcx
movq %rsp, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x3ee10
movq %rax, %r14
movslq 0x54(%r13), %rbp
movq -0x8(%r13), %r13
xorl %ebx, %ebx
testl %ebp, %ebp
movl $0x0, %r15d
cmovgl %ebp, %r15d
shlq $0x4, %r15
cmpq %rbx, %r15
je 0x3fb7a
testq %rbx, %rbx
je 0x3fb61
leaq (%r14,%rbx), %rcx
movq -0x8(%r14,%rbx), %rax
movq (%rax), %rdi
movq (%r13,%rbx), %rsi
movq 0x8(%r13,%rbx), %rdx
jmp 0x3fb6f
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq %r12, %rdi
movq %r14, %rcx
callq 0x3e5db
addq $0x10, %rbx
jmp 0x3fb3f
testl %ebp, %ebp
je 0x3fb96
shlq $0x4, %rbp
movq -0x8(%r14,%rbp), %rax
movq (%rax), %rdi
movq (%r13,%rbp), %rsi
movq 0x8(%r13,%rbp), %rdx
jmp 0x3fba1
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq %r12, %rdi
movq 0x98(%rsp), %rbp
movq %rbp, %rcx
callq 0x3eaa2
leaq 0x110(%rsp), %r13
movslq 0xc(%r13), %r15
movsd (%r12,%r15,8), %xmm0
movq (%rbp), %rdi
movq 0x8(%rbp), %rsi
leaq 0xc8(%rsp), %rdx
callq 0x3ef3f
movsd %xmm0, 0x98(%rsp)
movq 0x8(%rbp), %rax
movq (%rax), %rdi
movl 0xa4(%rsp), %esi
callq 0x339b7
movl %eax, %ebx
cvttsd2si (%r12,%r15,8), %eax
movq 0x8(%rbp), %rcx
movq (%rcx), %rcx
movslq %eax, %r15
movsd (%rcx,%r15,8), %xmm0
movq 0xb8(%rsp), %rax
movsd %xmm0, (%rax)
movq 0xb0(%rsp), %rdi
movq 0xa8(%rsp), %rsi
callq 0x3929f
movl 0x5c(%r13), %esi
movq %r14, %rdi
callq 0x3ef02
xorl %eax, %eax
cmpl %r15d, %ebx
sete %al
movq 0xc0(%rsp), %rcx
movl %eax, (%rcx)
movsd 0x98(%rsp), %xmm0
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq