// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/omnivariatetree.c
// Function: find_best_hybrid_ldt_split_srm
int find_best_hybrid_ldt_split_srm(Decisionnodeptr node, Multildt_parameterptr param)
{
 /*!Last Changed 06.11.2007 added SRM prepruning*/
 /*!Last Changed 25.08.2007*/
 int hybridspace = get_parameter_i("hybridspace");
 int i, N = data_size(node->instances), h, counts[2][MAXCLASSES], bestmodel;
 matrix qw;
 double qw0, results[3], error, base_generalization_error;
 base_generalization_error = srm_classification(node->falsepositives / (N + 0.0), 1, N, param->a1, param->a2);
 find_uni_and_multi_splits(node, &qw, &qw0, results, param->variance_explained, hybridspace);
 for (i = 0; i < hybridspace; i++)
   if (results[i] != -1)
    {
     switch (i)
      {
       case 0:h = (int) log2(current_dataset->multifeaturecount - 1) + 1;
              find_counts_for_split(node->instances, node->featureno, node->split, counts[0], counts[1], HYBRID_CONDITION);
              break;
       case 1:h = node->lineard + 1;
              find_counts_for_multivariate_split(node->instances, node->w, node->w0, counts[0], counts[1]);
              break;
       case 2:h = node->quadraticd + 1;
              find_counts_for_multivariate_split(node->instances, qw, qw0, counts[0], counts[1]);
              break;
       default:h = 2;
               break;
      }
     error = error_of_split(counts, N);
     results[i] = srm_classification(error, h, N, param->a1, param->a2);
    }
 /*To implement prepruning, compare generalization error of the leaf with the best model*/
 bestmodel = find_min_in_list_double(results, hybridspace);
 if (bestmodel == -1 || results[bestmodel] > base_generalization_error)
  {
   if (hybridspace > 1 && results[1] != -1)
     matrix_free(node->w);
   if (hybridspace > 2 && results[2] != -1)
     matrix_free(qw);  
   node->featureno = LEAF_NODE;
   return 0;
  }
 else
   return set_best_hybrid_split(results, node, qw, qw0, hybridspace);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4cec0(%rip), %rdi     # 0x98c18
callq 0x4cd35
movl %eax, %r13d
movq 0x20(%rbx), %rdi
callq 0x2c3cc
movl %eax, %r15d
cvtsi2sdl 0x88(%rbx), %xmm0
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd 0x30(%r14), %xmm1
movsd 0x38(%r14), %xmm2
pushq $0x1
popq %rdi
movl %eax, %esi
callq 0x41c3e
movsd %xmm0, 0x38(%rsp)
movsd 0x20(%r14), %xmm0
leaq 0x8(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x20(%rsp), %rcx
movq %rbx, %rdi
movl %r13d, %r8d
callq 0x4b77a
xorl %r12d, %r12d
testl %r13d, %r13d
movl $0x0, %ebp
movl %r13d, 0x4(%rsp)
cmovgl %r13d, %ebp
leaq 0x40(%rsp), %rdi
cmpq %r12, %rbp
je 0x4bed6
movsd 0x20(%rsp,%r12,8), %xmm0
ucomisd 0x49fc7(%rip), %xmm0    # 0x95db0
jne 0x4bdf1
jnp 0x4bece
cmpl $0x2, %r12d
je 0x4be6e
cmpl $0x1, %r12d
je 0x4be51
pushq $0x2
popq %r13
testl %r12d, %r12d
jne 0x4bea3
leaq 0x81a5f(%rip), %rax     # 0xcd870
movq (%rax), %rax
movl 0x1c0(%rax), %eax
decl %eax
cvtsi2sd %eax, %xmm0
callq 0x34d77
cvttsd2si %xmm0, %r13d
incl %r13d
movq 0x20(%rbx), %rdi
movl 0x30(%rbx), %esi
movsd 0x28(%rbx), %xmm0
leaq 0x40(%rsp), %rdx
leaq 0x108(%rsp), %rcx
pushq $0x2
popq %r8
callq 0x91c39
jmp 0x4be9e
movl 0x90(%rbx), %r13d
incl %r13d
movsd 0x48(%rbx), %xmm0
movq 0x20(%rbx), %rdi
movq 0x38(%rbx), %rsi
movq 0x40(%rbx), %rdx
jmp 0x4be8c
movl 0x94(%rbx), %r13d
incl %r13d
movq 0x20(%rbx), %rdi
movsd 0x18(%rsp), %xmm0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x40(%rsp), %rcx
leaq 0x108(%rsp), %r8
callq 0x46bb8
leaq 0x40(%rsp), %rdi
movl %r15d, %esi
callq 0x1bb11
movsd 0x30(%r14), %xmm1
movsd 0x38(%r14), %xmm2
movl %r13d, %edi
movl %r15d, %esi
callq 0x41c3e
leaq 0x40(%rsp), %rdi
movsd %xmm0, 0x20(%rsp,%r12,8)
incq %r12
jmp 0x4bdd1
leaq 0x20(%rsp), %rdi
movl 0x4(%rsp), %ebp
movl %ebp, %esi
callq 0x338cc
cmpl $-0x1, %eax
je 0x4befb
cltq
movsd 0x20(%rsp,%rax,8), %xmm0
ucomisd 0x38(%rsp), %xmm0
jbe 0x4bf4d
cmpl $0x2, %ebp
jl 0x4bf1f
movsd 0x28(%rsp), %xmm0
ucomisd 0x49ea2(%rip), %xmm0    # 0x95db0
jne 0x4bf12
jnp 0x4bf1f
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x3929f
cmpl $0x3, %ebp
jl 0x4bf45
movsd 0x30(%rsp), %xmm0
ucomisd 0x49e7e(%rip), %xmm0    # 0x95db0
jne 0x4bf36
jnp 0x4bf45
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3929f
orl $-0x1, 0x30(%rbx)
xorl %eax, %eax
jmp 0x4bf6d
movsd 0x18(%rsp), %xmm0
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rcx
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %r8d
callq 0x4b945
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq