// File: /workspace/github_c_makefile_star2_O1/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)
movq %rsi, 0xb0(%rsp)
movq %rdi, %r14
xorl %ebx, %ebx
leaq 0x98(%rsp), %rax
movq %rbx, (%rax)
leaq 0xc8(%rsp), %rax
movq %rbx, (%rax)
movl 0x1407120(%rdi), %eax
movl %eax, %esi
shrl $0x1f, %esi
addl %eax, %esi
sarl %esi
movl $0x1, %edx
callq 0x1a20c
movq %rax, %r15
leaq 0xd8(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x5c7af
movq (%r12), %rdi
callq 0x10964
leaq 0x1407128(%r14), %rdi
movq %rdi, 0xb8(%rsp)
addq $0x1407138, %r14        # imm = 0x1407138
movq %r14, %rsi
callq 0x395a3
movq (%r12), %rsi
leaq 0x110(%rsp), %r13
movq %r13, %rdi
callq 0x12519
movq (%r12), %rsi
leaq 0xe0(%rsp), %rbp
movq %rbp, %rdi
callq 0x1286d
movq (%r12), %rdi
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups 0x20(%rbp), %xmm2
movups %xmm2, 0x50(%rsp)
movups %xmm1, 0x40(%rsp)
movups %xmm0, 0x30(%rsp)
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups 0x20(%r13), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x107bc
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups 0x20(%rbp), %xmm2
movups %xmm2, 0x50(%rsp)
movups %xmm1, 0x40(%rsp)
movups %xmm0, 0x30(%rsp)
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups 0x20(%r13), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r15, %rdi
movq %r15, %r13
movq %r15, 0xa8(%rsp)
callq 0x107bc
movq (%r12), %rdx
movl %ebx, 0x10(%rsp)
movl %ebx, 0x8(%rsp)
movl %ebx, (%rsp)
leaq 0x1d8(%rsp), %rbx
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %rbx, %rdi
movq %rdx, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x43275
movq (%r12), %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
callq 0x2f755
movq %rax, %rbp
movq %rdx, %r15
movq %r13, %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
callq 0x2f755
movq %rax, %r12
movq %rdx, 0xa0(%rsp)
movl $0x2, (%rsp)
leaq 0x140(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbp, %rcx
movq %r15, %r8
movq %rbx, %r9
callq 0x42ac4
leaq 0x148(%rsp), %rdi
movl $0x90, %edx
movq %rbx, %rsi
callq 0x4310
movl $0x13, %ecx
movq %rsp, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xd0(%rsp), %rdx
movq %rbp, %rdi
movq %r15, %rsi
leaq 0x98(%rsp), %rcx
callq 0x45586
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %ebp, %xmm1
divsd %xmm1, %xmm0
movsd 0x879be(%rip), %xmm1    # 0xa2520
subsd %xmm0, %xmm1
movq 0xb0(%rsp), %rax
movsd %xmm1, (%rax)
movl $0x90, %edx
leaq 0x148(%rsp), %rdi
movq %rbx, %rsi
callq 0x4310
movl $0x13, %ecx
movq %rsp, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r12, %rdi
movq 0xa0(%rsp), %rbx
movq %rbx, %rsi
leaq 0xd0(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
callq 0x45586
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
divsd %xmm1, %xmm0
movsd 0x8794d(%rip), %xmm1    # 0xa2520
subsd %xmm0, %xmm1
movq 0xc0(%rsp), %rax
movsd %xmm1, (%rax)
movq %r13, %rdi
callq 0x442bb
leaq 0x110(%rsp), %rax
movq (%rax), %rdi
callq 0x39194
leaq 0xe0(%rsp), %rax
movq (%rax), %rdi
callq 0x39194
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3dbad
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3dbad
movq 0xb8(%rsp), %rdi
movq %r14, %rsi
callq 0x395a3
leaq 0xd8(%rsp), %rax
movq (%rax), %rdi
callq 0x2f616
movq 0xa8(%rsp), %rdi
callq 0x2f616
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