// File: /workspace/github_c_makefile_star2_O1/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, %r15d
movq %rdi, %rbx
leaq 0x55217(%rip), %rdi     # 0xa5c20
callq 0x5341c
movl %eax, %ebp
movl %eax, 0x7c(%rsp)
testl %eax, %eax
jle 0x50ad0
xorl %r12d, %r12d
cmpl $0x2, %r12d
je 0x50a62
cmpl $0x1, %r12d
je 0x50a45
testl %r12d, %r12d
jne 0x50a7d
movq (%rbx), %rdi
movl %r15d, %esi
callq 0x9ba01
movq %rax, 0x80(%rsp)
jmp 0x50a7d
movq %rbx, %rdi
movl %r15d, %esi
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
movq %r14, %rcx
callq 0x4b5d1
movq %rax, 0x88(%rsp)
jmp 0x50a7d
movq %rbx, %rdi
movl %r15d, %esi
movl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
movq %r14, %rcx
callq 0x4b5d1
movq %rax, 0x90(%rsp)
movq 0x80(%rsp,%r12,8), %r13
movsd 0x5231b(%rip), %xmm0    # 0xa2da8
testq %r13, %r13
je 0x50aba
movq (%rbx), %rsi
movq %r13, %rdi
movl %r15d, %edx
leaq 0x9c(%rsp), %rcx
callq 0x4f4f4
movl 0x3c(%r13), %eax
incl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
callq 0x464c1
movsd %xmm0, 0xa0(%rsp,%r12,8)
incq %r12
cmpq %r12, %rbp
jne 0x50a1f
leaq 0xa0(%rsp), %rdi
movl 0x7c(%rsp), %r15d
movl %r15d, %esi
callq 0x37740
cmpl $-0x1, %eax
je 0x50b4e
movl %eax, %r14d
testl %r15d, %r15d
jle 0x50b2d
movl %r14d, %r12d
xorl %r13d, %r13d
cmpq %r13, %r12
je 0x50b25
movq 0x80(%rsp,%r13,8), %r15
testq %r15, %r15
je 0x50b25
movl $0xe, %ecx
movq %rsp, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x7a935
movq %r15, %rdi
callq 0x39194
incq %r13
cmpq %r13, %rbp
jne 0x50af8
movq (%rbx), %rdi
callq 0x2fa14
movl %eax, %ecx
movslq %r14d, %rax
movq 0x80(%rsp,%rax,8), %rax
movl %ecx, 0x38(%rax)
movl $0x2, 0x40(%rax)
jmp 0x50b50
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq