// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/svmtree.c
// Function: find_best_svm_split_for_partition
Svm_split find_best_svm_split_for_partition(Instanceptr data, Partition p)
{
 /*!Last Changed 18.02.2008*/
 int i, j, size;
 Svm_parameter param;
 Svm_problem prob;
 Svm_modelptr model;
 Svm_split result;
 prepare_svm_problem(&prob, TWO_CLASS, data, p);
 prepare_svm_parameters(&param, TWO_CLASS);
 model = svm_train(prob, param, BOOLEAN_FALSE);
 result.l = model->l;
 result.nSV = model->nSV[0] + model->nSV[1];
 result.param = param;
 result.rho = model->rho[0];
 result.sv_coef = safemalloc(model->l * sizeof(double), "find_best_svm_split_for_partition", 13);
 memcpy(result.sv_coef, model->sv_coef[0], model->l * sizeof(double));
 result.SV = safemalloc(model->l * sizeof(Svm_nodeptr), "find_best_svm_split_for_partition", 15);
 result.weights = safecalloc(current_dataset->multifeaturecount - 1, sizeof(double), "find_best_svm_split_for_partition", 16); 
 for (i = 0; i < model->l; i++)
  {
   size = support_vector_length(model->SV[i]);
   result.SV[i] = safemalloc(sizeof(Svm_node) * size, "find_best_svm_split_for_partition", 19);
   for (j = 0; j < size - 1; j++)
    {
     result.SV[i][j].index = model->SV[i][j].index;
     result.SV[i][j].value = model->SV[i][j].value;
     result.weights[result.SV[i][j].index] += result.sv_coef[i] * result.SV[i][j].value;
    }
   result.SV[i][j].index = model->SV[i][j].index;
   result.SV[i][j].value = model->SV[i][j].value;
  }
 free_svm_model(model);
 free_svm_problem(prob);
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %rdx
movq %rdi, %rbx
movq 0x140(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x130(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x80(%rsp), %r14
pushq $0x5
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x85b64
leaq 0xa0(%rsp), %r13
movq %r13, %rdi
movl %ebp, %esi
callq 0x85c92
leaq 0x20(%rsp), %rdi
pushq $0xb
popq %r12
movq %r12, %rcx
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x8362c
movq %rax, %r14
movslq 0x5c(%rax), %rax
movl %eax, 0x58(%rbx)
movq 0x78(%r14), %rcx
movl 0x4(%rcx), %edx
addl (%rcx), %edx
movl %edx, 0x80(%rbx)
movq %r12, %rcx
movq %rbx, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq 0x70(%r14), %rcx
movsd (%rcx), %xmm0
movsd %xmm0, 0x70(%rbx)
shlq $0x3, %rax
leaq 0x18cd8(%rip), %rbp     # 0xa1be8
pushq $0xd
popq %rdx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x34f59
movq %rax, %r12
movq %rax, 0x68(%rbx)
movq 0x68(%r14), %rax
movq (%rax), %rsi
movslq 0x5c(%r14), %rdx
shlq $0x3, %rdx
movq %r12, %rdi
callq 0x4310
movslq 0x5c(%r14), %rdi
shlq $0x3, %rdi
pushq $0xf
popq %rdx
movq %rbp, %rsi
callq 0x34f59
movq %rax, %r13
movq %rax, 0x60(%rbx)
leaq 0x44913(%rip), %rax     # 0xcd870
movq (%rax), %rax
movslq 0x1c0(%rax), %rdi
decq %rdi
pushq $0x8
popq %rsi
pushq $0x10
popq %rcx
movq %rbp, %rdx
callq 0x35067
movq %rax, %rbp
movq %rbx, 0x78(%rsp)
movq %rax, 0x78(%rbx)
movslq 0x5c(%r14), %rax
cmpq %rax, %r15
jge 0x8901f
movq 0x60(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x88e40
movslq %eax, %rbx
movq %rbx, %rdi
shlq $0x4, %rdi
leaq 0x18c39(%rip), %rsi     # 0xa1be8
pushq $0x13
popq %rdx
callq 0x34f59
movq %rax, (%r13,%r15,8)
cmpl $0x2, %ebx
pushq $0x1
popq %rcx
cmovll %ecx, %ebx
decl %ebx
movq 0x60(%r14), %rcx
movq (%rcx,%r15,8), %rcx
shlq $0x4, %rbx
xorl %edx, %edx
cmpq %rdx, %rbx
je 0x89005
movslq (%rcx,%rdx), %rsi
movl %esi, (%rax,%rdx)
movsd 0x8(%rcx,%rdx), %xmm0
movsd %xmm0, 0x8(%rax,%rdx)
mulsd (%r12,%r15,8), %xmm0
addsd (%rbp,%rsi,8), %xmm0
movsd %xmm0, (%rbp,%rsi,8)
addq $0x10, %rdx
jmp 0x88fd5
movl (%rcx,%rbx), %edx
movl %edx, (%rax,%rbx)
movsd 0x8(%rcx,%rbx), %xmm0
movsd %xmm0, 0x8(%rax,%rbx)
incq %r15
jmp 0x88f84
movq %r14, %rdi
callq 0x8290c
movups 0x80(%rsp), %xmm0
movups 0x90(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x8297b
movq 0x78(%rsp), %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq