// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/dataset.c
// Function: lp_separability
double lp_separability(Datasetptr d, double* trainerror, double* testerror)
{
 /*!Last Changed 10.05.2006 Oya*/
 Instanceptr traindata, testdata;
 Instance mean, variance;
 double result, loglikelihood, losstrain = 0, losstest = 0;
 int performance;
 Mlpparameters mlpparams;
 Mlpnetwork neuralnetwork;
 matrix train, test; 
 testdata = create_linear_test_set(d, d->datacount / 2, YES);
 read_from_train_file(d, &traindata);
 realize(traindata);
 exchange_classdefno(d);
 mean = find_mean(traindata);
 variance = find_variance(traindata);
 normalize(traindata, mean, variance);
 normalize(testdata, mean, variance);               
 mlpparams = prepare_Mlpparameters(traindata, traindata, 0, 0.0, 0, NULL, 0, 0.0, 0.0, 0, CLASSIFICATION);
 train = instancelist_to_matrix(traindata, CLASSIFICATION, -1, MULTIVARIATE_LINEAR);
 test = instancelist_to_matrix(testdata, CLASSIFICATION, -1, MULTIVARIATE_LINEAR);
 neuralnetwork = mlpn_general(train, train, &mlpparams, AUTOENCODER);
 neuralnetwork.P = mlpparams;
 performance = testMlpnNetwork2_cls(train, neuralnetwork, &loglikelihood, &losstrain);
 *trainerror = 1 - (performance / (train.row + 0.0));
 neuralnetwork.P = mlpparams;
 performance = testMlpnNetwork2_cls(test, neuralnetwork, &loglikelihood, &losstest); 
 *testerror = 1 - (performance / (test.row + 0.0));
 free_mlpnnetwork(&neuralnetwork);               
 safe_free(mean.values);
 safe_free(variance.values);
 matrix_free(train);
 matrix_free(test);
 exchange_classdefno(d);
 deallocate(traindata); 
 deallocate(testdata); 
 result = losstrain;
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movq %rdx, 0xc0(%rsp)
leaq 0x98(%rsp), %rax
andq $0x0, (%rax)
leaq 0xc8(%rsp), %rax
andq $0x0, (%rax)
movq %rsi, 0xb0(%rsp)
movq %rdi, %rbx
movl 0x1407120(%rdi), %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
pushq $0x1
popq %rdx
movl %eax, %esi
callq 0x188a3
movq %rax, %r14
leaq 0xd0(%rsp), %r15
movq %rbx, %rdi
movq %rbx, 0xb8(%rsp)
movq %r15, %rsi
callq 0x5577a
movq (%r15), %rdi
callq 0xfc81
movq %rbx, %rdi
callq 0x11d5c
movq (%r15), %rsi
leaq 0x110(%rsp), %rbx
movq %rbx, %rdi
callq 0x116b6
movq (%r15), %rsi
leaq 0xe0(%rsp), %r12
movq %r12, %rdi
callq 0x1197e
movq (%r15), %rdi
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x50(%rsp)
movups %xmm1, 0x40(%rsp)
movups %xmm0, 0x30(%rsp)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0xfad8
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x50(%rsp)
movups %xmm1, 0x40(%rsp)
movups %xmm0, 0x30(%rsp)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r14, %rdi
movq %r14, %r12
movq %r14, 0xa8(%rsp)
callq 0xfad8
movq (%r15), %rdx
andl $0x0, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, (%rsp)
leaq 0x140(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %rdx, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x3df0e
movq (%r15), %rdi
pushq $-0x1
popq %rbx
pushq $-0x2
popq %r14
xorl %esi, %esi
movl %ebx, %edx
movl %r14d, %ecx
callq 0x2c130
movq %rax, %rbp
movq %rdx, %r15
movq %r12, %rdi
xorl %esi, %esi
movl %ebx, %edx
movl %r14d, %ecx
callq 0x2c130
movq %rax, %r12
movq %rdx, 0xa0(%rsp)
movl $0x2, (%rsp)
leaq 0x1d0(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbp, %rcx
movq %r15, %r8
leaq 0x140(%rsp), %rbx
movq %rbx, %r9
callq 0x3d96a
leaq 0x1d8(%rsp), %rdi
movl $0x90, %edx
movq %rbx, %rsi
callq 0x4310
pushq $0x13
popq %rbx
movq %rbx, %rcx
movq %rsp, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xd8(%rsp), %r14
movq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rdx
leaq 0x98(%rsp), %rcx
callq 0x3feb9
cvtsi2sd %eax, %xmm0
cvtsi2sd %ebp, %xmm1
divsd %xmm1, %xmm0
movsd 0x7c426(%rip), %xmm1    # 0x95520
subsd %xmm0, %xmm1
movq 0xb0(%rsp), %rax
movsd %xmm1, (%rax)
movl $0x90, %edx
leaq 0x1d8(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x4310
movq %rbx, %rcx
movq %rsp, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r12, %rdi
movq 0xa0(%rsp), %rbx
movq %rbx, %rsi
movq %r14, %rdx
leaq 0xc8(%rsp), %rcx
callq 0x3feb9
cvtsi2sd %eax, %xmm0
cvtsi2sd %r12d, %xmm1
divsd %xmm1, %xmm0
movsd 0x7c3bd(%rip), %xmm1    # 0x95520
subsd %xmm0, %xmm1
movq 0xc0(%rsp), %rax
movsd %xmm1, (%rax)
movq %r13, %rdi
callq 0x3eeb2
leaq 0x110(%rsp), %rax
movq (%rax), %rdi
callq 0x34ff7
leaq 0xe0(%rsp), %rax
movq (%rax), %rdi
callq 0x34ff7
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3929f
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3929f
movq 0xb8(%rsp), %rdi
callq 0x11d5c
leaq 0xd0(%rsp), %rax
movq (%rax), %rdi
callq 0x2c010
movq 0xa8(%rsp), %rdi
callq 0x2c010
leaq 0x98(%rsp), %rax
movsd (%rax), %xmm0
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)