// File: /workspace/github_c_makefile_star2_O3/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 $0xa8, %rsp
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x56de3(%rip), %rdi     # 0xa8c98
callq 0x54920
movl %eax, %r14d
testl %eax, %eax
jle 0x51fc2
xorl %r12d, %r12d
cmpl $0x2, %r12d
je 0x51f03
cmpl $0x1, %r12d
je 0x51eea
testl %r12d, %r12d
jne 0x51f1d
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x9ea42
movq %rax, 0x70(%rsp)
jmp 0x51f1d
movq %rbx, %rdi
movl %ebp, %esi
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
movq %r15, %rcx
callq 0x4ca77
movq %rax, 0x78(%rsp)
jmp 0x51f1d
movq %rbx, %rdi
movl %ebp, %esi
movl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
movq %r15, %rcx
callq 0x4ca77
movq %rax, 0x80(%rsp)
movq 0x70(%rsp,%r12,8), %r13
movsd 0x53e7e(%rip), %xmm0    # 0xa5da8
testq %r13, %r13
je 0x51f56
movq (%rbx), %rsi
movq %r13, %rdi
movl %ebp, %edx
leaq 0x8c(%rsp), %rcx
callq 0x509ec
movl 0x3c(%r13), %eax
incl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
callq 0x47871
movsd %xmm0, 0x90(%rsp,%r12,8)
incq %r12
cmpq %r12, %r14
jne 0x51ec8
leaq 0x90(%rsp), %rdi
movl %r14d, %esi
callq 0x38250
cmpl $-0x1, %eax
je 0x51ff7
movl %eax, %ebp
testl %r14d, %r14d
jle 0x51fd9
movl %ebp, %r12d
xorl %r13d, %r13d
cmpq %r13, %r12
je 0x51fb8
movq 0x70(%rsp,%r13,8), %r15
testq %r15, %r15
je 0x51fb8
movl $0xe, %ecx
movq %rsp, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x7c1f4
movq %r15, %rdi
callq 0x3a180
incq %r13
cmpq %r13, %r14
jne 0x51f8e
jmp 0x51fd9
leaq 0x90(%rsp), %rdi
movl %r14d, %esi
callq 0x38250
movl %eax, %ebp
cmpl $-0x1, %eax
je 0x51ff7
movq (%rbx), %rdi
callq 0x30309
movl %eax, %ecx
movslq %ebp, %rax
movq 0x70(%rsp,%rax,8), %rax
movl %ecx, 0x38(%rax)
movl $0x2, 0x40(%rax)
jmp 0x51ff9
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq