// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/univariatetree.c
// Function: find_best_split_for_feature_i
int find_best_split_for_feature_i(Instanceptr instances, int currentfeature, double* split, double* bestgain)
{
 int j, k, counts[2][MAXCLASSES], size, isbetter = NO;
 Instanceptr sorted;
 double gain, value, valuebefore;
 switch (current_dataset->features[currentfeature].type)
  {
   case REAL   :
   case INTEGER:sorted = sort_instances(instances, currentfeature, &size);
                for (j = 0; j < current_dataset->classno; j++)
                 {
                  counts[0][j]=0;
                  counts[1][j]=0;
                 }
                for (k = 0; k < size; k++)
                 {
                  j = give_classno(&(sorted[k]));
                  counts[0][j]++;
                 }
                k = 0;
                valuebefore = -INT_MAX;
                while (k < size)
                 {
                  if (current_dataset->features[currentfeature].type == INTEGER)
                    value = sorted[k].values[currentfeature].intvalue;
                  else
                    value = sorted[k].values[currentfeature].floatvalue;
                  if (value != valuebefore)
                   {
                    if (valuebefore != -INT_MAX)
                     {
                      gain = information_gain(counts);
                      if (dless(gain, *bestgain))
                       {
                        *bestgain = gain;
                        isbetter = YES;
                        (*split) = (value + valuebefore)/2;
                        if (*bestgain == 0)
                         {
                          safe_free(sorted);
                          return YES;
                         }
                       }
                     }
                    valuebefore = value;
                   }
                  j = give_classno(&(sorted[k]));
                  counts[0][j]--;
                  counts[1][j]++;
                  k++;
                 }
                safe_free(sorted);
                break;
   case STRING :gain = information_gain_for_discrete_feature(instances, currentfeature);
                if (dless(gain, *bestgain))
                 {
                  *bestgain = gain;
                  isbetter = YES;
                  (*split) = 0;
                  if (gain == 0)
                    return YES;
                 }
                break;
  }
 return isbetter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x1c8(%rbp)
leaq 0x28e75(%rip), %rax     # 0x105840
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
movl 0x30f08(%rax,%rcx), %eax
movl %eax, -0x1ec(%rbp)
testl %eax, %eax
je 0xdca0e
jmp 0xdc9ec
movl -0x1ec(%rbp), %eax
subl $0x1, %eax
je 0xdcc8e
jmp 0xdc9fd
movl -0x1ec(%rbp), %eax
subl $0x2, %eax
jne 0xdcd01
jmp 0xdca0e
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
leaq -0x1c4(%rbp), %rdx
callq 0xdc050
movq %rax, -0x1d0(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
leaq 0x28e07(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0xdca6a
movslq -0x2c(%rbp), %rax
movl $0x0, -0x1c0(%rbp,%rax,4)
movslq -0x2c(%rbp), %rax
movl $0x0, -0xf8(%rbp,%rax,4)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xdca2f
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x1c4(%rbp), %eax
jge 0xdcab6
movq -0x1d0(%rbp), %rdi
movslq -0x30(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
callq 0x43530
movl %eax, -0x2c(%rbp)
movslq -0x2c(%rbp), %rax
movl -0x1c0(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x1c0(%rbp,%rax,4)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xdca71
movl $0x0, -0x30(%rbp)
movsd 0x5543(%rip), %xmm0     # 0xe2008
movsd %xmm0, -0x1e8(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x1c4(%rbp), %eax
jge 0xdcc80
leaq 0x28d5d(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x14(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
cmpl $0x0, (%rax)
jne 0xdcb27
movq -0x1d0(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x1e0(%rbp)
jmp 0xdcb4d
movq -0x1d0(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x1e0(%rbp)
movsd -0x1e0(%rbp), %xmm0
ucomisd -0x1e8(%rbp), %xmm0
jne 0xdcb66
jp 0xdcb66
jmp 0xdcc2e
movsd -0x1e8(%rbp), %xmm0
movsd 0x5492(%rip), %xmm1     # 0xe2008
ucomisd %xmm1, %xmm0
jne 0xdcb83
jp 0xdcb83
jmp 0xdcc1e
leaq -0x1c0(%rbp), %rdi
callq 0x2ac00
movsd %xmm0, -0x1d8(%rbp)
movsd -0x1d8(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd (%rax), %xmm1
callq 0x52750
cmpl $0x0, %eax
je 0xdcc1c
movsd -0x1d8(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
movl $0x1, -0x1c8(%rbp)
movsd -0x1e0(%rbp), %xmm0
addsd -0x1e8(%rbp), %xmm0
movsd 0x60bd(%rip), %xmm1     # 0xe2ca0
divsd %xmm1, %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xdcc1a
jp 0xdcc1a
movq -0x1d0(%rbp), %rdi
callq 0x52e80
movl $0x1, -0x4(%rbp)
jmp 0xdcd0a
jmp 0xdcc1c
jmp 0xdcc1e
movsd -0x1e0(%rbp), %xmm0
movsd %xmm0, -0x1e8(%rbp)
movq -0x1d0(%rbp), %rdi
movslq -0x30(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
callq 0x43530
movl %eax, -0x2c(%rbp)
movslq -0x2c(%rbp), %rax
movl -0x1c0(%rbp,%rax,4), %ecx
addl $-0x1, %ecx
movl %ecx, -0x1c0(%rbp,%rax,4)
movslq -0x2c(%rbp), %rax
movl -0xf8(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0xf8(%rbp,%rax,4)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xdcacd
movq -0x1d0(%rbp), %rdi
callq 0x52e80
jmp 0xdcd01
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0xdbc30
movsd %xmm0, -0x1d8(%rbp)
movsd -0x1d8(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd (%rax), %xmm1
callq 0x52750
cmpl $0x0, %eax
je 0xdccff
movsd -0x1d8(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
movl $0x1, -0x1c8(%rbp)
movq -0x20(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movsd -0x1d8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xdccfd
jp 0xdccfd
movl $0x1, -0x4(%rbp)
jmp 0xdcd0a
jmp 0xdccff
jmp 0xdcd01
movl -0x1c8(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
nopw %cs:(%rax,%rax)