// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/multivariatetree.c
// Function: best_multivariate_split_lp
int best_multivariate_split_lp(Instanceptr positives, Instanceptr negatives, matrix* w, double* w0, MULTIVARIATE_TYPE multivariate_type, int* newdim)
{
 /*!Last Changed 26.05.2005*/
 /*!Last Changed 13.02.2005*/
 Mlpparameters mlpparams;
 Mlpnetwork neuralnetwork;
 matrix train1, train2, train;
 int i, dim;
 if (multivariate_type == MULTIVARIATE_LINEAR)
   dim = current_dataset->multifeaturecount - 1;
 else
   dim = multifeaturecount_2d(current_dataset);
 mlpparams = prepare_Mlpparameters(positives, positives, 0, 0.0, 0, NULL, 0, 0.0, 0.0, 0, CLASSIFICATION);
 mlpparams.inputnum = data_size(positives) + data_size(negatives);
 mlpparams.cvnum = mlpparams.inputnum;
 train1 = instancelist_to_matrix(positives, 3, 1, multivariate_type);
 train2 = instancelist_to_matrix(negatives, 3, 0, multivariate_type);
 train = matrix_merge_rows(train1, train2);
 matrix_free(train1);
 matrix_free(train2);
 neuralnetwork = mlpn_general(train, train, &mlpparams, CLASSIFICATION);
 *newdim = dim;
 *w0 = neuralnetwork.weights->values[1][0] - neuralnetwork.weights->values[0][0];
 *w = matrix_alloc(1, dim);
 for (i = 0; i < dim; i++)
   (*w).values[0][i] = neuralnetwork.weights->values[0][i + 1] - neuralnetwork.weights->values[1][i + 1];
 free_mlpnnetwork(&neuralnetwork);
 matrix_free(train);
 return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x320, %rsp            # imm = 0x320
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
cmpl $-0x2, -0x24(%rbp)
jne 0x6e244
leaq 0x97610(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %eax
subl $0x1, %eax
movl %eax, -0x190(%rbp)
jmp 0x6e259
leaq 0x975f5(%rip), %rax     # 0x105840
movq (%rax), %rdi
callq 0x1b690
movl %eax, -0x190(%rbp)
movq -0x8(%rbp), %rsi
movq -0x8(%rbp), %rdx
leaq -0x220(%rbp), %rdi
xorl %r8d, %r8d
xorps %xmm2, %xmm2
xorl %eax, %eax
movl %eax, %r9d
movl %r8d, %ecx
movaps %xmm2, %xmm0
movl $0x0, (%rsp)
movaps %xmm2, %xmm1
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x61f60
leaq -0xc0(%rbp), %rdi
leaq -0x220(%rbp), %rsi
movl $0x90, %edx
callq 0x42b0
movq -0x8(%rbp), %rdi
callq 0x449f0
movl %eax, -0x304(%rbp)
movq -0x10(%rbp), %rdi
callq 0x449f0
movl %eax, %ecx
movl -0x304(%rbp), %eax
addl %ecx, %eax
movl %eax, -0xb8(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0xb4(%rbp)
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %ecx
movl $0x3, %esi
movl $0x1, %edx
callq 0x44720
movq %rax, -0x230(%rbp)
movq %rdx, -0x228(%rbp)
movq -0x230(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x228(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %ecx
movl $0x3, %esi
xorl %edx, %edx
callq 0x44720
movq %rax, -0x240(%rbp)
movq %rdx, -0x238(%rbp)
movq -0x240(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x238(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x168(%rbp), %rdi
movq -0x160(%rbp), %rsi
movq -0x178(%rbp), %rdx
movq -0x170(%rbp), %rcx
callq 0x57e90
movq %rax, -0x250(%rbp)
movq %rdx, -0x248(%rbp)
movq -0x250(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x248(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x168(%rbp), %rdi
movq -0x160(%rbp), %rsi
callq 0x59ea0
movq -0x178(%rbp), %rdi
movq -0x170(%rbp), %rsi
callq 0x59ea0
movq -0x188(%rbp), %rsi
movq -0x180(%rbp), %rdx
movq -0x188(%rbp), %rcx
movq -0x180(%rbp), %r8
leaq -0x2e8(%rbp), %rdi
leaq -0xc0(%rbp), %r9
xorl %eax, %eax
movl $0x0, (%rsp)
callq 0x61710
leaq -0x158(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
movl $0x98, %edx
callq 0x42b0
movl -0x190(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x158(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movq -0x158(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
subsd (%rax), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x300(%rbp)
movl -0x190(%rbp), %esi
movl $0x1, %edi
callq 0x57fc0
movq %rax, %rcx
movq -0x300(%rbp), %rax
movq %rcx, -0x2f8(%rbp)
movq %rdx, -0x2f0(%rbp)
movq -0x2f8(%rbp), %rcx
movq %rcx, (%rax)
movq -0x2f0(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x0, -0x18c(%rbp)
movl -0x18c(%rbp), %eax
cmpl -0x190(%rbp), %eax
jge 0x6e522
movq -0x158(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movl -0x18c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x158(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movl -0x18c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movslq -0x18c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x18c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18c(%rbp)
jmp 0x6e4ad
leaq -0x158(%rbp), %rdi
callq 0x63ab0
movq -0x188(%rbp), %rdi
movq -0x180(%rbp), %rsi
callq 0x59ea0
movl $0x1, %eax
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
nop