// File: /workspace/github_c_makefile_star2_O1/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 $0x148, %rsp            # imm = 0x148
movl %r8d, %r13d
movq %rsi, %r14
movq %rdi, %r15
leaq 0x86bdd(%rip), %rax     # 0xd2870
movq (%rax), %rdi
cmpl $-0x2, %r8d
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq %r9, 0x8(%rsp)
jne 0x4bcb5
movl 0x1c0(%rdi), %eax
decl %eax
jmp 0x4bcba
callq 0x13726
movl %eax, 0x4(%rsp)
subq $0x8, %rsp
xorl %eax, %eax
leaq 0xc0(%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
pushq %rax
pushq %rax
pushq %rax
callq 0x43275
addq $0x20, %rsp
movq %r15, %rdi
callq 0x2fa14
movl %eax, %ebx
movq %r14, %rdi
callq 0x2fa14
addl %ebx, %eax
movl %eax, 0x8(%r12)
movl %eax, 0xc(%r12)
movq %r15, %rdi
movl $0x3, %esi
movl $0x1, %edx
movl %r13d, %ecx
callq 0x2f755
movq %rax, %rbx
movq %rdx, %r15
movq %r14, %rdi
movl $0x3, %esi
xorl %edx, %edx
movl %r13d, %ecx
callq 0x2f755
movq %rax, %r12
movq %rdx, %rbp
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %rbp, %rcx
callq 0x3c5fc
movq %rax, %r14
movq %rdx, %r13
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3dbad
movq %r12, %rdi
movq %rbp, %rsi
callq 0x3dbad
subq $0x8, %rsp
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r14, %rcx
movq %r13, %r8
leaq 0xc0(%rsp), %r9
xorl %eax, %eax
pushq %rax
callq 0x42ac4
addq $0x10, %rsp
movl 0x4(%rsp), %ebp
movq 0x8(%rsp), %rax
movl %ebp, (%rax)
movq (%rbx), %rax
movq 0x8(%rax), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
subsd (%rcx), %xmm0
movq 0x10(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x1, %edi
movl %ebp, %esi
callq 0x3c6e5
movq 0x18(%rsp), %rcx
movq %rax, (%rcx)
movq %rdx, 0x8(%rcx)
testl %ebp, %ebp
jle 0x4be16
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
movq (%rdx), %rdx
movl %ebp, %esi
xorl %edi, %edi
movsd 0x8(%rax,%rdi,8), %xmm0
subsd 0x8(%rcx,%rdi,8), %xmm0
movsd %xmm0, (%rdx,%rdi,8)
leaq 0x1(%rdi), %r8
movq %r8, %rdi
cmpq %r8, %rsi
jne 0x4bdf9
leaq 0x20(%rsp), %rdi
callq 0x442bb
movq %r14, %rdi
movq %r13, %rsi
callq 0x3dbad
movl $0x1, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq