// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/univariatetree.c
// Function: find_best_ldt_feature_for_realized
int find_best_ldt_feature_for_realized(Instanceptr instances, double* split)
{
/*!Last Changed 23.09.2004*/
 int i,j,bestfeature=-1,improved;
 double bestgain=+INT_MAX,gain,bestpartitiongain,currentsplit,bestsplit;
 Partition initial,current,best;
 initial = get_initial_partition(instances);
 for (i = 0 ; i < current_dataset->multifeaturecount - 1;i++)
   if (initial.count <= 2)
    {
     bestpartitiongain = find_gain_for_partition(instances,initial,i,&bestsplit, HYBRID_CONDITION);
     if (dless(bestpartitiongain,bestgain))
      {
       bestgain = bestpartitiongain;
       bestfeature = i;
       (*split) = bestsplit;
       if (bestpartitiongain == 0)
        {
         free_partition(initial);
         return bestfeature;
        }
      }
     continue;
    }
   else
    {
     current = create_copy(initial);
     bestpartitiongain = find_gain_for_partition(instances,current,i,&bestsplit, HYBRID_CONDITION);
     best = create_copy(current);
     improved = 1;
     while (improved)
      {
       improved = 0;
       for (j = 0; j < current.count; j++)
        {
         current.assignments[j] = 1-current.assignments[j];
         gain = find_gain_for_partition(instances,current,i,&currentsplit, HYBRID_CONDITION);
         if (dless(gain,bestpartitiongain))
          {
           bestsplit = currentsplit;
           bestpartitiongain = gain;
           free_partition(best);
           best = create_copy(current);
           improved = 1;
          }
         current.assignments[j]=1-current.assignments[j];
        }
       if (improved)
        {
         free_partition(current);
         current = create_copy(best);
        }
      }
     if (dless(bestpartitiongain,bestgain))
      {
       bestgain = bestpartitiongain;
       bestfeature = i;
       (*split) = bestsplit;
       if (bestgain == 0)
        {
         free_partition(best);
         free_partition(current);
         free_partition(initial);
         return bestfeature;
        }
      }
     free_partition(best);
     free_partition(current);
    }
 free_partition(initial);
 if (bestgain == ISELL)
   return -1;
 else
   return bestfeature;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movsd 0x337e(%rip), %xmm0     # 0xe2010
movsd %xmm0, -0x30(%rbp)
movq -0x10(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x2aea0
movq -0xb0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
leaq 0x26b67(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
movl 0x1c0(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xdf154
cmpl $0x2, -0x58(%rbp)
jg 0xdeda3
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq -0x68(%rbp), %rax
leaq -0x50(%rbp), %rdx
movl $0x2, %ecx
movq (%rax), %r8
movq %r8, (%rsp)
movq 0x8(%rax), %r8
movq %r8, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xdec00
movsd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
callq 0x52750
cmpl $0x0, %eax
je 0xded9e
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movsd -0x50(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xded9c
jp 0xded9c
leaq -0x68(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7aa80
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xdf19a
jmp 0xded9e
jmp 0xdf146
leaq -0xc8(%rbp), %rdi
leaq -0x68(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7a990
movq -0xc8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq -0x80(%rbp), %rax
leaq -0x50(%rbp), %rdx
movl $0x2, %ecx
movq (%rax), %r8
movq %r8, (%rsp)
movq 0x8(%rax), %r8
movq %r8, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xdec00
movsd %xmm0, -0x40(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0x80(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7a990
movq -0xe0(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x88(%rbp)
movl $0x1, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0xdf042
movl $0x0, -0x28(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x70(%rbp), %eax
jge 0xdefc8
movq -0x78(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl $0x1, %edx
subl (%rax,%rcx,4), %edx
movq -0x78(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq -0x80(%rbp), %rax
leaq -0x48(%rbp), %rdx
movl $0x2, %ecx
movq (%rax), %r8
movq %r8, (%rsp)
movq 0x8(%rax), %r8
movq %r8, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xdec00
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
callq 0x52750
cmpl $0x0, %eax
je 0xdef9f
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x98(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7aa80
leaq -0xf8(%rbp), %rdi
leaq -0x80(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7a990
movq -0xf8(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0x88(%rbp)
movl $0x1, -0x28(%rbp)
movq -0x78(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl $0x1, %edx
subl (%rax,%rcx,4), %edx
movq -0x78(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xdee96
cmpl $0x0, -0x28(%rbp)
je 0xdf03d
leaq -0x80(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7aa80
leaq -0x110(%rbp), %rdi
leaq -0x98(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7a990
movq -0x110(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x108(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x100(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0xdee7e
movsd -0x40(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
callq 0x52750
cmpl $0x0, %eax
je 0xdf0fd
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movsd -0x50(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0x30(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xdf0fb
jp 0xdf0fb
leaq -0x98(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7aa80
leaq -0x80(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7aa80
leaq -0x68(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7aa80
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xdf19a
jmp 0xdf0fd
leaq -0x98(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7aa80
leaq -0x80(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7aa80
jmp 0xdf146
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xdeccf
leaq -0x68(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7aa80
movsd -0x30(%rbp), %xmm0
movsd 0x3815(%rip), %xmm1     # 0xe2998
ucomisd %xmm1, %xmm0
jne 0xdf194
jp 0xdf194
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xdf19a
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw %cs:(%rax,%rax)