// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/dataset.c
// Function: discretization_entropy
double* discretization_entropy(Datasetptr original, int fno, int valuecount, Instanceptr data)
{
 int ratio[MAXVALUES][MAXCLASSES];
 double *splits, *values = NULL, bestinfo = ISELL, info;
 int i, j, size, *combination, *best, **counts;
 splits = safemalloc((valuecount - 1) * sizeof(double), "discretization_entropy", 4);
 counts = find_counts_for_all_splits(original, fno, data, &size, &values);
 if (size > valuecount - 1)
  {
   best = safemalloc((valuecount - 1) * sizeof(int), "discretization_entropy", 5);
   combination = first_combination(valuecount - 1);
   for (i = 0; i < MAXVALUES; i++)
     for (j = 0; j < MAXCLASSES; j++)
       ratio[i][j] = 0;
   do{
     for (i = 0; i < valuecount; i++)
       for (j = 0; j < original->classno; j++)
         ratio[i][j] = 0;
     for (j = 0; j < original->classno; j++)
       ratio[0][j] = counts[combination[0]][j];
     for (i = 1; i < valuecount - 1; i++)
       for (j = 0; j < original->classno; j++)
         ratio[i][j] = counts[combination[i]][j] - counts[combination[i - 1]][j];
     for (j = 0; j < original->classno; j++)
       ratio[valuecount - 1][j] = counts[size - 1][j] - counts[combination[i - 1]][j];
     info = information_gain_from_ratios(ratio);
     if (info < bestinfo)
      {
       bestinfo = info;
       for (i = 0; i < valuecount - 1; i++)
         best[i] = combination[i];
      }
   }while (next_combination(combination, valuecount - 1, size - 1));
   for (i = 0; i < valuecount - 1; i++)
     splits[i] = values[best[i]];
   safe_free(best);
   safe_free(combination);   
  }
 else
  {
   for (i = 0; i < size; i++)
     splits[i] = values[i]; 
   for (i = size; i < valuecount - 1; i++)
     splits[i] = values[size - 1];  
  }
 safe_free(values);
 free_2d((void **) counts, size);
 return splits; 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4e90, %rsp           # imm = 0x4E90
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq $0x0, -0x4e50(%rbp)
movsd 0xc3a0c(%rip), %xmm0    # 0xe2998
movsd %xmm0, -0x4e58(%rbp)
movl -0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
leaq 0xc4559(%rip), %rsi     # 0xe3501
movl $0x4, %edx
callq 0x52d70
movq %rax, -0x4e48(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
leaq -0x4e6c(%rbp), %rcx
leaq -0x4e50(%rbp), %r8
callq 0x1eca0
movq %rax, -0x4e88(%rbp)
movl -0x4e6c(%rbp), %eax
movl -0x10(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x1f40e
movl -0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdi
shlq $0x2, %rdi
leaq 0xc44fb(%rip), %rsi     # 0xe3501
movl $0x5, %edx
callq 0x52d70
movq %rax, -0x4e80(%rbp)
movl -0x10(%rbp), %edi
subl $0x1, %edi
callq 0x51a10
movq %rax, -0x4e78(%rbp)
movl $0x0, -0x4e64(%rbp)
cmpl $0x64, -0x4e64(%rbp)
jge 0x1f099
movl $0x0, -0x4e68(%rbp)
cmpl $0x32, -0x4e68(%rbp)
jge 0x1f086
movslq -0x4e64(%rbp), %rcx
leaq -0x4e40(%rbp), %rax
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movslq -0x4e68(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x4e68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e68(%rbp)
jmp 0x1f046
jmp 0x1f088
movl -0x4e64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e64(%rbp)
jmp 0x1f033
jmp 0x1f09b
movl $0x0, -0x4e64(%rbp)
movl -0x4e64(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x1f113
movl $0x0, -0x4e68(%rbp)
movl -0x4e68(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x1f100
movslq -0x4e64(%rbp), %rcx
leaq -0x4e40(%rbp), %rax
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movslq -0x4e68(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x4e68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e68(%rbp)
jmp 0x1f0ba
jmp 0x1f102
movl -0x4e64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e64(%rbp)
jmp 0x1f0a5
movl $0x0, -0x4e68(%rbp)
movl -0x4e68(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x1f16a
movq -0x4e88(%rbp), %rax
movq -0x4e78(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x4e68(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movslq -0x4e68(%rbp), %rax
movl %ecx, -0x4e40(%rbp,%rax,4)
movl -0x4e68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e68(%rbp)
jmp 0x1f11d
movl $0x1, -0x4e64(%rbp)
movl -0x4e64(%rbp), %eax
movl -0x10(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1f244
movl $0x0, -0x4e68(%rbp)
movl -0x4e68(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x1f22e
movq -0x4e88(%rbp), %rax
movq -0x4e78(%rbp), %rcx
movslq -0x4e64(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x4e68(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x4e88(%rbp), %rax
movq -0x4e78(%rbp), %rcx
movl -0x4e64(%rbp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movslq (%rcx,%rsi,4), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x4e68(%rbp), %rcx
subl (%rax,%rcx,4), %edx
movslq -0x4e64(%rbp), %rcx
leaq -0x4e40(%rbp), %rax
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movslq -0x4e68(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x4e68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e68(%rbp)
jmp 0x1f192
jmp 0x1f230
movl -0x4e64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e64(%rbp)
jmp 0x1f174
movl $0x0, -0x4e68(%rbp)
movl -0x4e68(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x1f2e6
movq -0x4e88(%rbp), %rax
movl -0x4e6c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x4e68(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x4e88(%rbp), %rax
movq -0x4e78(%rbp), %rcx
movl -0x4e64(%rbp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movslq (%rcx,%rsi,4), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x4e68(%rbp), %rcx
subl (%rax,%rcx,4), %edx
movl -0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq -0x4e40(%rbp), %rax
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movslq -0x4e68(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x4e68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e68(%rbp)
jmp 0x1f24e
leaq -0x4e40(%rbp), %rdi
callq 0x2a710
movsd %xmm0, -0x4e60(%rbp)
movsd -0x4e60(%rbp), %xmm1
movsd -0x4e58(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1f36f
movsd -0x4e60(%rbp), %xmm0
movsd %xmm0, -0x4e58(%rbp)
movl $0x0, -0x4e64(%rbp)
movl -0x4e64(%rbp), %eax
movl -0x10(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1f36d
movq -0x4e78(%rbp), %rax
movslq -0x4e64(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x4e80(%rbp), %rax
movslq -0x4e64(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x4e64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e64(%rbp)
jmp 0x1f32a
jmp 0x1f36f
jmp 0x1f371
movq -0x4e78(%rbp), %rdi
movl -0x10(%rbp), %esi
subl $0x1, %esi
movl -0x4e6c(%rbp), %edx
subl $0x1, %edx
callq 0x52190
cmpl $0x0, %eax
jne 0x1f09b
movl $0x0, -0x4e64(%rbp)
movl -0x4e64(%rbp), %eax
movl -0x10(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1f3f1
movq -0x4e50(%rbp), %rax
movq -0x4e80(%rbp), %rcx
movslq -0x4e64(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x4e48(%rbp), %rax
movslq -0x4e64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x4e64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e64(%rbp)
jmp 0x1f39f
movq -0x4e80(%rbp), %rdi
callq 0x52e80
movq -0x4e78(%rbp), %rdi
callq 0x52e80
jmp 0x1f4b7
movl $0x0, -0x4e64(%rbp)
movl -0x4e64(%rbp), %eax
cmpl -0x4e6c(%rbp), %eax
jge 0x1f45d
movq -0x4e50(%rbp), %rax
movslq -0x4e64(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x4e48(%rbp), %rax
movslq -0x4e64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x4e64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e64(%rbp)
jmp 0x1f418
movl -0x4e6c(%rbp), %eax
movl %eax, -0x4e64(%rbp)
movl -0x4e64(%rbp), %eax
movl -0x10(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1f4b5
movq -0x4e50(%rbp), %rax
movl -0x4e6c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x4e48(%rbp), %rax
movslq -0x4e64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x4e64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e64(%rbp)
jmp 0x1f469
jmp 0x1f4b7
movq -0x4e50(%rbp), %rdi
callq 0x52e80
movq -0x4e88(%rbp), %rdi
movl -0x4e6c(%rbp), %esi
callq 0x52e20
movq -0x4e48(%rbp), %rax
addq $0x4e90, %rsp           # imm = 0x4E90
popq %rbp
retq
nopw %cs:(%rax,%rax)