// File: /workspace/github_c_makefile_star2_O3/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, 0x28(%rsp)
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x7c366
movq %rax, %r14
movabsq $0x200000001, %rax      # imm = 0x200000001
movq %rax, 0x3c(%r14)
movq %rbx, 0x38(%rsp)
testq %rbx, %rbx
je 0x9eca4
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x2f33a
xorl %ecx, %ecx
cmpl %ebp, %eax
sete %cl
addl %ecx, %r15d
movq 0x10(%rbx), %rbx
incl %r12d
testq %rbx, %rbx
jne 0x9ea92
testl %r15d, %r15d
je 0x9eca4
leal 0x1(%r12), %esi
movl %r15d, %edi
callq 0x7c668
movsd %xmm0, 0x20(%rsp)
leaq 0x36d9d(%rip), %rax     # 0xd5870
movq (%rax), %rax
cmpl $0x2, 0x1c0(%rax)
jl 0x9ecaf
movl %r15d, 0x34(%rsp)
xorl %ebx, %ebx
movq %r12, 0x48(%rsp)
movq %r14, 0x18(%rsp)
movl %ebp, 0x4(%rsp)
movq 0x38(%rsp), %rdi
movl %ebx, %esi
leaq 0xc(%rsp), %rdx
callq 0xa0055
movq %rax, %r13
movq %rax, %rdi
movl %ebx, (%rsp)
movl %ebx, %esi
callq 0x2ed6a
movsd %xmm0, 0x10(%rsp)
movq %r13, %rdi
callq 0x2f33a
xorl %r15d, %r15d
cmpl %ebp, %eax
sete %r15b
movl $0x1, %r14d
cmpl $0x2, 0xc(%rsp)
movq %r13, 0x50(%rsp)
jl 0x9ec3b
leaq 0x30(%r13), %rbp
movl $0x1, %ebx
movl %r15d, %r13d
movl %r12d, 0x8(%rsp)
movq %rbp, %rdi
movl (%rsp), %esi
movl %esi, %r12d
callq 0x2ed6a
movsd 0x10(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
jne 0x9eb7d
jnp 0x9ec04
movsd %xmm1, 0x10(%rsp)
addsd 0x138ad(%rip), %xmm1    # 0xb2438
movl %r13d, %edi
movl %ebx, %esi
movsd 0x20(%rsp), %xmm0
leaq 0x28(%rsp), %rdx
movq 0x18(%rsp), %rcx
movl $0x3c, %r8d
movl %r12d, %r9d
callq 0x9e9ae
movl 0x34(%rsp), %edi
subl %r13d, %edi
addl %r15d, %edi
movl 0x8(%rsp), %r12d
addl %r12d, %r14d
movsd 0x10(%rsp), %xmm1
addsd 0x13872(%rip), %xmm1    # 0xb2440
movl %r14d, %esi
movsd 0x20(%rsp), %xmm0
leaq 0x28(%rsp), %rdx
movq 0x18(%rsp), %rcx
movl $0x3e, %r8d
movl (%rsp), %r9d
callq 0x9e9ae
xorl %r14d, %r14d
xorl %r15d, %r15d
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
jmp 0x9ec09
movl 0x8(%rsp), %r12d
incl %r14d
movq %rbp, %rdi
callq 0x2f33a
xorl %ecx, %ecx
cmpl 0x4(%rsp), %eax
sete %cl
addl %ecx, %r13d
addl %ecx, %r15d
incq %rbx
movslq 0xc(%rsp), %rax
decl %r12d
addq $0x30, %rbp
cmpq %rax, %rbx
jl 0x9eb52
movsd 0x40(%rsp), %xmm1
addsd 0x137f7(%rip), %xmm1    # 0xb2440
movl %r15d, %edi
movl %r14d, %esi
movsd 0x20(%rsp), %xmm0
leaq 0x28(%rsp), %rdx
movq 0x18(%rsp), %r14
movq %r14, %rcx
movl $0x3e, %r8d
movl (%rsp), %ebx
movl %ebx, %r9d
callq 0x9e9ae
movq 0x50(%rsp), %rdi
callq 0x3a180
incl %ebx
leaq 0x36bea(%rip), %rax     # 0xd5870
movq (%rax), %rax
movl 0x1c0(%rax), %eax
decl %eax
cmpl %eax, %ebx
movl 0x4(%rsp), %ebp
movq 0x48(%rsp), %r12
jl 0x9eaf8
jmp 0x9ecaf
movq %r14, %rdi
callq 0x3a180
xorl %r14d, %r14d
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq