// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/omnivariaterule.c
// Function: find_best_hybrid_condition_aic
Decisionconditionptr find_best_hybrid_condition_aic(Instanceptr* growset, int positive, Ripper_parameterptr param)
{
 /*!Last Changed 19.02.2005*/
 int hybridspace = get_parameter_i("hybridspace");
 double loglikelihood, results[3];
 int bestmodel, i, covered;
 Decisionconditionptr conditions[3];
 for (i = 0; i < hybridspace; i++)
  {
   switch (i)
    {
     case MODEL_UNI:conditions[0] = find_best_condition_for_realized_features(*growset, positive);
                    break;
     case MODEL_LIN:conditions[1] = find_best_multivariate_condition(growset, positive, MULTIVARIATE_LINEAR, param);
                    break;
     case MODEL_QUA:conditions[2] = find_best_multivariate_condition(growset, positive, MULTIVARIATE_QUADRATIC, param);
                    break;
    }
   if (conditions[i])
    {
     loglikelihood = log_likelihood_of_condition(conditions[i], *growset, positive, &covered);
     results[i] = aic_loglikelihood(loglikelihood, conditions[i]->freeparam + 1);
    }
   else
     results[i] = -1;
  }
 bestmodel = find_min_in_list_double(results, hybridspace);
 if (bestmodel == -1)
  {
   return NULL;
  }
 else
  {
   for (i = 0; i < hybridspace; i++)
     if (i != bestmodel && conditions[i])
      {
       free_condition(*(conditions[i]));
       safe_free(conditions[i]);
      }
   conditions[bestmodel]->datasize = data_size(*growset);
   conditions[bestmodel]->conditiontype = HYBRID_CONDITION;
   return conditions[bestmodel];
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x4e618(%rip), %rdi     # 0x98c18
callq 0x4cd35
xorl %r15d, %r15d
testl %eax, %eax
movl %eax, 0x7c(%rsp)
movl %eax, %r13d
cmovlel %r15d, %r13d
cmpq %r15, %r13
je 0x4a6c1
cmpl $0x2, %r15d
je 0x4a65d
cmpl $0x1, %r15d
je 0x4a643
testl %r15d, %r15d
jne 0x4a675
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x8f7c3
movq %rax, 0x80(%rsp)
jmp 0x4a675
movq %rbx, %rdi
movl %ebp, %esi
pushq $-0x2
popq %rdx
movq %r14, %rcx
callq 0x45899
movq %rax, 0x88(%rsp)
jmp 0x4a675
movq %rbx, %rdi
movl %ebp, %esi
pushq $-0x3
popq %rdx
movq %r14, %rcx
callq 0x45899
movq %rax, 0x90(%rsp)
movq 0x80(%rsp,%r15,8), %r12
movsd 0x4b72b(%rip), %xmm0    # 0x95db0
testq %r12, %r12
je 0x4a6af
movq (%rbx), %rsi
movq %r12, %rdi
movl %ebp, %edx
leaq 0x9c(%rsp), %rcx
callq 0x493e6
movl 0x3c(%r12), %eax
incl %eax
cvtsi2sd %eax, %xmm1
callq 0x40bcb
movsd %xmm0, 0xa0(%rsp,%r15,8)
incq %r15
jmp 0x4a615
leaq 0xa0(%rsp), %rdi
movl 0x7c(%rsp), %esi
callq 0x338cc
cmpl $-0x1, %eax
je 0x4a73c
movl %eax, 0x7c(%rsp)
movl %eax, %r12d
xorl %ebp, %ebp
pushq $0xe
popq %r14
cmpq %rbp, %r13
je 0x4a719
cmpq %rbp, %r12
je 0x4a714
movq 0x80(%rsp,%rbp,8), %r15
testq %r15, %r15
je 0x4a714
movq %r14, %rcx
movq %rsp, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x71b91
movq %r15, %rdi
callq 0x34ff7
incq %rbp
jmp 0x4a6e4
movq (%rbx), %rdi
callq 0x2c3cc
movl %eax, %ecx
movslq 0x7c(%rsp), %rax
movq 0x80(%rsp,%rax,8), %rax
movl %ecx, 0x38(%rax)
movl $0x2, 0x40(%rax)
jmp 0x4a73e
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq