// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/dataset.c
// Function: find_counts_for_all_splits
int** find_counts_for_all_splits(Datasetptr original, int fno, Instanceptr data, int* size, double** values)
{
 int i, j, k, count, **counts, classno;
 Instanceptr sorted;
 double previous = +INT_MAX, value;
 *size = 0;
 sorted = sort_instances(data, fno, &count);
 for (i = 0; i < count; i++)
  {
   switch (original->features[fno].type)
    {
     case INTEGER:value = sorted[i].values[fno].intvalue;
                  break;
     case    REAL:value = sorted[i].values[fno].floatvalue;
                  break; 
    }
   if (value != previous)
    {
     previous = value;
     (*size)++;
    }
  }
 counts = (int **) safecalloc_2d(sizeof(int*), sizeof(int), *size, MAXCLASSES, "find_counts_for_all_splits", 12);
 *values = safemalloc((*size) * sizeof(double), "find_counts_for_all_splits", 13); 
 j = -1;
 previous = +INT_MAX;
 for (i = 0; i < count; i++)
  {
   switch (original->features[fno].type)
    {
     case INTEGER:value = sorted[i].values[fno].intvalue;
                  break;
     case    REAL:value = sorted[i].values[fno].floatvalue;
                  break; 
    }
   classno = give_classno(&(sorted[i]));
   if (value != previous)
    {
     previous = value;
     j++;
     (*values)[j] = value;
     if (j != 0)
       for (k = 0; k < original->classno; k++)
         counts[j][k] = counts[j - 1][k];
    }
   counts[j][classno]++;
  }
 safe_free(sorted);
 return counts;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, 0x18(%rsp)
movq %rcx, %r13
movl %esi, %ebp
movq %rdi, %r14
andl $0x0, (%rcx)
leaq 0x14(%rsp), %r12
movq %rdx, %rdi
movq %r12, %rdx
callq 0x90c1a
movq %rax, %r15
movl (%r12), %ecx
movslq %ebp, %rdx
movq %rdx, (%rsp)
imulq $0x340, %rdx, %rax      # imm = 0x340
leaq (%r14,%rax), %rbx
addq $0x30f08, %rbx          # imm = 0x30F08
xorl %eax, %eax
testl %ecx, %ecx
cmovlel %eax, %ecx
imulq $0x30, %rcx, %rcx
movsd 0x80e20(%rip), %xmm0    # 0x95518
cmpq %rax, %rcx
je 0x1473a
movl (%rbx), %edx
cmpl $0x2, %edx
je 0x14717
testl %edx, %edx
jne 0x14724
movq (%r15,%rax), %rdx
movq (%rsp), %rsi
cvtsi2sdl (%rdx,%rsi,8), %xmm1
jmp 0x14724
movq (%r15,%rax), %rdx
movq (%rsp), %rsi
movsd (%rdx,%rsi,8), %xmm1
ucomisd %xmm0, %xmm1
jne 0x1472c
jnp 0x14734
incl (%r13)
movapd %xmm1, %xmm0
addq $0x30, %rax
jmp 0x146f8
movl (%r13), %edx
leaq 0x8213b(%rip), %rbp     # 0x96880
pushq $0x8
popq %rdi
pushq $0x4
popq %rsi
pushq $0x32
popq %rcx
pushq $0xc
popq %r9
movq %rbp, %r8
movsd %xmm1, 0x8(%rsp)
callq 0x3509c
movq %rax, %r12
movslq (%r13), %rdi
shlq $0x3, %rdi
pushq $0xd
popq %rdx
movq %rbp, %rsi
callq 0x34f59
movsd 0x8(%rsp), %xmm0
movq 0x18(%rsp), %rcx
movq %rax, (%rcx)
movsd 0x80d8c(%rip), %xmm1    # 0x95518
pushq $-0x1
popq %rbp
xorl %r13d, %r13d
movslq 0x14(%rsp), %rax
cmpq %rax, %r13
jge 0x1485a
movl (%rbx), %eax
cmpl $0x2, %eax
movsd %xmm1, 0x20(%rsp)
je 0x147c4
testl %eax, %eax
jne 0x147d5
imulq $0x30, %r13, %rax
movq (%r15,%rax), %rax
movq (%rsp), %rcx
cvtsi2sdl (%rax,%rcx,8), %xmm0
jmp 0x147d5
imulq $0x30, %r13, %rax
movq (%r15,%rax), %rax
movq (%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x8(%rsp)
imulq $0x30, %r13, %rdi
addq %r15, %rdi
callq 0x2b47e
movsd 0x8(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jne 0x147fb
jnp 0x1483a
xorl %edx, %edx
movl %ebp, %ecx
movq 0x18(%rsp), %rsi
movq (%rsi), %rdi
movapd %xmm0, %xmm1
incl %ecx
movslq %ecx, %rsi
movsd %xmm0, (%rdi,%rsi,8)
je 0x14844
movslq %ebp, %rdx
xorl %edi, %edi
movslq 0x10(%r14), %r8
cmpq %r8, %rdi
jge 0x1483e
movq (%r12,%rdx,8), %r8
movl (%r8,%rdi,4), %r8d
movq (%r12,%rsi,8), %r9
movl %r8d, (%r9,%rdi,4)
incq %rdi
jmp 0x1481c
movl %ebp, %edx
jmp 0x14844
movl %ecx, %edx
movapd %xmm0, %xmm1
movslq %edx, %rcx
movq (%r12,%rcx,8), %rcx
cltq
incl (%rcx,%rax,4)
incq %r13
movl %edx, %ebp
jmp 0x14792
movq %r15, %rdi
callq 0x34ff7
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq