// File: /workspace/github_c_makefile_star2_O3/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
movl $0x0, (%rcx)
leaq 0x4(%rsp), %r12
movq %rdx, %rdi
movq %r12, %rdx
callq 0xa0055
movq %rax, %r15
movslq (%r12), %rcx
movslq %ebp, %rdi
testq %rcx, %rcx
jle 0x15ba1
imulq $0x340, %rdi, %rax      # imm = 0x340
addq %r14, %rax
addq $0x30f08, %rax          # imm = 0x30F08
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rcx
movsd 0x8f9b6(%rip), %xmm0    # 0xa5518
xorl %edx, %edx
movl (%rax), %esi
cmpl $0x2, %esi
je 0x15b7d
testl %esi, %esi
jne 0x15b86
movq (%r15,%rdx), %rsi
xorps %xmm1, %xmm1
cvtsi2sdl (%rsi,%rdi,8), %xmm1
jmp 0x15b86
movq (%r15,%rdx), %rsi
movsd (%rsi,%rdi,8), %xmm1
ucomisd %xmm0, %xmm1
jne 0x15b8e
jnp 0x15b96
incl (%r13)
movapd %xmm1, %xmm0
addq $0x30, %rdx
cmpq %rdx, %rcx
jne 0x15b64
jmp 0x15ba1
movsd %xmm1, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movl (%r13), %edx
leaq 0x90d29(%rip), %rbx     # 0xa68e0
movl $0x8, %edi
movl $0x4, %esi
movl $0x32, %ecx
movq %rbx, %r8
movl $0xc, %r9d
callq 0x3a231
movq %rax, %r12
movslq (%r13), %rdi
shlq $0x3, %rdi
movq %rbx, %rsi
movl $0xd, %edx
callq 0x3a0e1
movsd 0x10(%rsp), %xmm0
movq 0x18(%rsp), %rcx
movq %rax, (%rcx)
cmpl $0x0, 0x4(%rsp)
jle 0x15d03
imulq $0x340, 0x8(%rsp), %rax # imm = 0x340
leaq (%r14,%rax), %r13
addq $0x30f08, %r13          # imm = 0x30F08
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movsd 0x8f8f2(%rip), %xmm1    # 0xa5518
xorl %ebx, %ebx
movl (%r13), %eax
cmpl $0x2, %eax
movsd %xmm1, 0x20(%rsp)
je 0x15c56
testl %eax, %eax
jne 0x15c6c
leaq (%rbx,%rbx,2), %rax
shlq $0x4, %rax
movq (%r15,%rax), %rax
movq 0x8(%rsp), %rcx
xorps %xmm0, %xmm0
cvtsi2sdl (%rax,%rcx,8), %xmm0
jmp 0x15c6c
leaq (%rbx,%rbx,2), %rax
shlq $0x4, %rax
movq (%r15,%rax), %rax
movq 0x8(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq (%rbx,%rbx,2), %rdi
shlq $0x4, %rdi
addq %r15, %rdi
callq 0x2f33a
movsd 0x10(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jne 0x15c96
jnp 0x15ce2
xorl %ecx, %ecx
movl %ebp, %edx
movq 0x18(%rsp), %rsi
movq (%rsi), %rdi
movapd %xmm0, %xmm1
incl %edx
movslq %edx, %rsi
movsd %xmm0, (%rdi,%rsi,8)
je 0x15ce4
cmpl $0x0, 0x10(%r14)
jle 0x15cda
movslq %ebp, %rcx
movq (%r12,%rcx,8), %rcx
movq (%r12,%rsi,8), %rsi
xorl %edi, %edi
movl (%rcx,%rdi,4), %r8d
movl %r8d, (%rsi,%rdi,4)
incq %rdi
movslq 0x10(%r14), %r8
cmpq %r8, %rdi
jl 0x15cc6
movl %edx, %ecx
movapd %xmm0, %xmm1
jmp 0x15ce4
movl %ebp, %ecx
movslq %ecx, %rdx
movq (%r12,%rdx,8), %rdx
cltq
incl (%rdx,%rax,4)
incq %rbx
movslq 0x4(%rsp), %rax
movl %ecx, %ebp
cmpq %rax, %rbx
jl 0x15c28
movq %r15, %rdi
callq 0x3a180
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq