// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/univariaterule.c
// Function: find_best_condition_for_realized_features
Decisionconditionptr find_best_condition_for_realized_features(Instanceptr growset, int positive)
{
 /*!Last Changed 22.01.2004*/
 int i, j, size, tpositive, t, tdotpositive, tdot, equal, equalpositive;
 Instanceptr instancelist, tmp;
 double bestgain = 0, valuebefore, value, it;
 Decisionconditionptr result;
 result = empty_condition();
 result->conditiontype = HYBRID_CONDITION;
 result->freeparam = 1;
 tmp = growset;
 tpositive = 0;
 t = 0;
 while (tmp)
  {
   t++;
   if (give_classno(tmp) == positive)
     tpositive++;
   tmp = tmp->next;
  }
 if (tpositive == 0)
  {
   safe_free(result);
   return NULL;
  }
 it = information(tpositive, t);
 for (i = 0; i < current_dataset->multifeaturecount - 1; i++)
  { 
   instancelist = sort_instances(growset, i, &size);
   valuebefore = real_feature(&(instancelist[0]), i);
   tdot = 1;
   if (give_classno(&(instancelist[0])) == positive)
     tdotpositive = 1;
   else
     tdotpositive = 0;
   equalpositive = tdotpositive;
   equal = 1;
   for (j = 1; j < size; j++)
    {
     value = real_feature(&(instancelist[j]), i);
     if (value != valuebefore)
      {
       check_for_bestgain(tdotpositive, tdot, it, &bestgain, result, '<', valuebefore + DBL_EPSILON, i);
       check_for_bestgain(tpositive - tdotpositive + equalpositive, t - tdot + equal, it, &bestgain, result, '>', valuebefore - DBL_EPSILON, i);
       valuebefore = value;
       equal = 0;
       equalpositive = 0;
      }
     equal++;
     if (give_classno(&(instancelist[j])) == positive)
      {
       tdotpositive++;
       equalpositive++;
      }
     tdot++;
    }
   check_for_bestgain(equalpositive, equal, it, &bestgain, result, '>', value - DBL_EPSILON, i);
   safe_free(instancelist);
  }
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movq $0x0, 0x30(%rsp)
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x7aa9e
movq %rax, %r14
movabsq $0x200000001, %rax      # imm = 0x200000001
movq %rax, 0x3c(%r14)
movl $0x0, %r12d
movq %rbx, 0x40(%rsp)
testq %rbx, %rbx
je 0x9ba71
xorl %r12d, %r12d
movq 0x40(%rsp), %rbx
xorl %r15d, %r15d
incl %r12d
movq %rbx, %rdi
callq 0x2eaca
xorl %ecx, %ecx
cmpl %ebp, %eax
sete %cl
addl %ecx, %r15d
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
jne 0x9ba53
testl %r15d, %r15d
je 0x9bc58
movl %r15d, %edi
movl %r12d, %esi
callq 0x7adaf
movsd %xmm0, 0x28(%rsp)
leaq 0x36dde(%rip), %rax     # 0xd2870
movq (%rax), %rax
cmpl $0x2, 0x1c0(%rax)
jl 0x9bc63
movl %r15d, 0x3c(%rsp)
decl %r12d
movl %r12d, 0x38(%rsp)
xorl %ebx, %ebx
movq %r14, 0x20(%rsp)
movl %ebp, 0x10(%rsp)
movq 0x40(%rsp), %rdi
movl %ebx, %esi
leaq 0x14(%rsp), %rdx
callq 0x9d053
movq %rax, %r14
movq %rax, %rdi
movl %ebx, 0xc(%rsp)
movl %ebx, %esi
callq 0x2e4b6
movsd %xmm0, 0x18(%rsp)
movq %r14, %rdi
callq 0x2eaca
xorl %r15d, %r15d
cmpl %ebp, %eax
sete %r15b
movl $0x1, %r12d
cmpl $0x2, 0x14(%rsp)
movq %r14, 0x50(%rsp)
jl 0x9bbf3
leaq 0x30(%r14), %rbp
movl $0x1, %ebx
movl 0x38(%rsp), %r13d
movl %r15d, %r14d
movq %rbp, %rdi
movl 0xc(%rsp), %esi
callq 0x2e4b6
movsd 0x18(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movsd %xmm0, 0x48(%rsp)
jne 0x9bb3e
jnp 0x9bbc1
movsd %xmm1, 0x18(%rsp)
addsd 0x1386c(%rip), %xmm1    # 0xaf3b8
movl %r14d, %edi
movl %ebx, %esi
movsd 0x28(%rsp), %xmm0
leaq 0x30(%rsp), %rdx
movq 0x20(%rsp), %rcx
movl $0x3c, %r8d
movl 0xc(%rsp), %r9d
callq 0x9b96d
movl 0x3c(%rsp), %edi
subl %r14d, %edi
addl %r15d, %edi
addl %r13d, %r12d
movsd 0x18(%rsp), %xmm1
addsd 0x13834(%rip), %xmm1    # 0xaf3c0
movl %r12d, %esi
movsd 0x28(%rsp), %xmm0
leaq 0x30(%rsp), %rdx
movq 0x20(%rsp), %rcx
movl $0x3e, %r8d
movl 0xc(%rsp), %r9d
callq 0x9b96d
xorl %r12d, %r12d
xorl %r15d, %r15d
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
incl %r12d
movq %rbp, %rdi
callq 0x2eaca
xorl %ecx, %ecx
cmpl 0x10(%rsp), %eax
sete %cl
addl %ecx, %r14d
addl %ecx, %r15d
incq %rbx
movslq 0x14(%rsp), %rax
decl %r13d
addq $0x30, %rbp
cmpq %rax, %rbx
jl 0x9bb1a
movsd 0x48(%rsp), %xmm1
addsd 0x137bf(%rip), %xmm1    # 0xaf3c0
movl %r15d, %edi
movl %r12d, %esi
movsd 0x28(%rsp), %xmm0
leaq 0x30(%rsp), %rdx
movq 0x20(%rsp), %r14
movq %r14, %rcx
movl $0x3e, %r8d
movl 0xc(%rsp), %ebx
movl %ebx, %r9d
callq 0x9b96d
movq 0x50(%rsp), %rdi
callq 0x39194
incl %ebx
leaq 0x36c31(%rip), %rax     # 0xd2870
movq (%rax), %rax
movl 0x1c0(%rax), %eax
decl %eax
cmpl %eax, %ebx
movl 0x10(%rsp), %ebp
jl 0x9baba
jmp 0x9bc63
movq %r14, %rdi
callq 0x39194
xorl %r14d, %r14d
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq