// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %r9, 0x28(%rsp)
movq %rcx, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdi, %r15
leaq 0x87940(%rip), %rax     # 0xcd870
movq (%rax), %rdi
movl %r8d, %ebp
cmpl $-0x2, %r8d
jne 0x45f46
movl 0x1c0(%rdi), %eax
decl %eax
jmp 0x45f4b
callq 0x126ea
movl %eax, 0x1c(%rsp)
andl $0x0, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, (%rsp)
xorl %r13d, %r13d
leaq 0x40(%rsp), %r12
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %r12, %rdi
movq %r15, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x3df0e
movq %r15, %rdi
callq 0x2c3cc
movl %eax, %ebx
movq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x2c3cc
addl %ebx, %eax
movl %eax, 0x8(%r12)
movl %eax, 0xc(%r12)
pushq $0x3
popq %rbx
pushq $0x1
popq %rdx
movq %r15, %rdi
movl %ebx, %esi
movl %ebp, %ecx
callq 0x2c130
movq %rax, %r15
movq %rdx, %r12
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x2c130
movq %rax, %rbx
movq %rdx, %r14
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
movq %r14, %rcx
callq 0x38014
movq %rax, %rbp
movq %r15, %rdi
movq %rdx, %r15
movq %r12, %rsi
callq 0x3929f
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %r14
callq 0x3929f
andl $0x0, (%rsp)
leaq 0xd0(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbp, %rcx
movq %r15, %r8
leaq 0x40(%rsp), %r9
callq 0x3d96a
movq 0x28(%rsp), %rax
movl 0x1c(%rsp), %ebp
movl %ebp, (%rax)
movq (%rbx), %rbx
movq 0x8(%rbx), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
subsd (%rcx), %xmm0
movq 0x30(%rsp), %rax
movsd %xmm0, (%rax)
pushq $0x1
popq %rdi
movl %ebp, %esi
callq 0x380d3
movq 0x38(%rsp), %rcx
movq %rax, (%rcx)
movq %rdx, 0x8(%rcx)
testl %ebp, %ebp
movl $0x0, %eax
cmovgl %ebp, %eax
cmpq %r13, %rax
je 0x4609e
movq 0x8(%rbx), %rcx
movq (%rcx), %rsi
movq 0x8(%rcx), %rcx
movsd 0x8(%rsi,%r13,8), %xmm0
subsd 0x8(%rcx,%r13,8), %xmm0
movq (%rdx), %rcx
movsd %xmm0, (%rcx,%r13,8)
incq %r13
jmp 0x46072
leaq 0xd0(%rsp), %rdi
callq 0x3eeb2
movq %r14, %rdi
movq %r15, %rsi
callq 0x3929f
pushq $0x1
popq %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq