// File: /workspace/github_c_makefile_star2_O1/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 0x53922(%rip), %rdi     # 0xa5c20
callq 0x5341c
movl %eax, %ebp
movq 0x20(%rbx), %rdi
callq 0x2fa14
movl %eax, %r15d
cvtsi2sdl 0x88(%rbx), %xmm0
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd 0x30(%r14), %xmm1
movsd 0x38(%r14), %xmm2
movl $0x1, %edi
movl %eax, %esi
callq 0x475c7
movsd %xmm0, 0x38(%rsp)
movsd 0x20(%r14), %xmm0
leaq 0x8(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x20(%rsp), %rcx
movq %rbx, %rdi
movl %ebp, %r8d
callq 0x51d05
movl %ebp, 0x4(%rsp)
testl %ebp, %ebp
jle 0x52477
movl 0x4(%rsp), %r12d
xorl %r13d, %r13d
leaq 0x40(%rsp), %rdi
movsd 0x20(%rsp,%r13,8), %xmm0
ucomisd 0x50a21(%rip), %xmm0    # 0xa2da8
jne 0x5238f
jnp 0x5246b
cmpl $0x2, %r13d
je 0x5240e
cmpl $0x1, %r13d
je 0x523f3
movl $0x2, %ebp
testl %r13d, %r13d
jne 0x52441
leaq 0x804c0(%rip), %rax     # 0xd2870
movq (%rax), %rax
movl 0x1c0(%rax), %eax
decl %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x38e99
cvttsd2si %xmm0, %ebp
incl %ebp
movq 0x20(%rbx), %rdi
movl 0x30(%rbx), %esi
movsd 0x28(%rbx), %xmm0
leaq 0x40(%rsp), %rdx
leaq 0x108(%rsp), %rcx
movl $0x2, %r8d
callq 0x9e1bf
jmp 0x5243c
movl 0x90(%rbx), %ebp
incl %ebp
movsd 0x48(%rbx), %xmm0
movq 0x20(%rbx), %rdi
movq 0x38(%rbx), %rsi
movq 0x40(%rbx), %rdx
jmp 0x5242a
movl 0x94(%rbx), %ebp
incl %ebp
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 0x4c971
leaq 0x40(%rsp), %rdi
movl %r15d, %esi
callq 0x1d8fb
movsd 0x30(%r14), %xmm1
movsd 0x38(%r14), %xmm2
movl %ebp, %edi
movl %r15d, %esi
callq 0x475c7
leaq 0x40(%rsp), %rdi
movsd %xmm0, 0x20(%rsp,%r13,8)
incq %r13
cmpq %r13, %r12
jne 0x52378
leaq 0x20(%rsp), %rdi
movl 0x4(%rsp), %ebp
movl %ebp, %esi
callq 0x37740
cmpl $-0x1, %eax
je 0x5249c
cltq
movsd 0x20(%rsp,%rax,8), %xmm0
ucomisd 0x38(%rsp), %xmm0
jbe 0x524f1
cmpl $0x2, %ebp
jl 0x524c0
movsd 0x28(%rsp), %xmm0
ucomisd 0x508f9(%rip), %xmm0    # 0xa2da8
jne 0x524b3
jnp 0x524c0
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x3dbad
cmpl $0x3, %ebp
jl 0x524e6
movsd 0x30(%rsp), %xmm0
ucomisd 0x508d5(%rip), %xmm0    # 0xa2da8
jne 0x524d7
jnp 0x524e6
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3dbad
movl $0xffffffff, 0x30(%rbx) # imm = 0xFFFFFFFF
xorl %eax, %eax
jmp 0x52511
movsd 0x18(%rsp), %xmm0
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rcx
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %r8d
callq 0x51edb
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq