// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/ktree.c
// Function: update_best_discrete_split
void update_best_discrete_split(Korderingsplit* split, int* perm[], int* rangelist, int* iter, int** featurecounts, int* nodecounts, double* bestgain)
{
	int i, j, size = split->featurecount, permpos, permmultiplier;
 int* mixediter;
 int counts[2][MAXCLASSES];
	double gain;
 for (i = 0; i < MAXCLASSES; i++)
   counts[0][i] = counts[1][i] = 0;
 for (i = 0; i < current_dataset->classno; i++)
   counts[1][i] = nodecounts[i];
 mixediter = first_mixed_iterator(size);
 do{
   permpos = 0;
   permmultiplier = 1;
   for (i = 0; i < size; i++)
    {
     permpos += permmultiplier * perm[i][mixediter[i]];
     permmultiplier *= rangelist[i];
    }
   for (i = 0; i < current_dataset->classno; i++)
    {
     counts[0][i] += featurecounts[permpos][i];
     counts[1][i] -= featurecounts[permpos][i];
    }
   gain = information_gain(counts);
   if (dless(gain, *bestgain))
    {
     *bestgain = gain;
     for (i = 0; i < size; i++)
      {
       split->featurelist[i] = iter[i];
       split->discretesplit[i] = mixediter[i];
       safe_free(split->sortorder[i]);
       split->sortorder[i] = safemalloc(rangelist[i] * sizeof(int), "update_best_discrete_split", 70);
       for (j = 0; j < rangelist[i]; j++)
         split->sortorder[i][j] = perm[i][j];
      }
    }
 }while (next_mixed_iterator(mixediter, size, rangelist));
 safe_free(mixediter);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %r9, %rbx
movq %r8, 0x8(%rsp)
movq %rcx, 0x18(%rsp)
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movl (%rdi), %ebp
leaq 0x20(%rsp), %rdi
movl $0xc8, %edx
xorl %esi, %esi
callq 0x4050
movl $0x32, %eax
movl $0x0, 0x20(%rsp,%rax,4)
incq %rax
cmpq $0x64, %rax
jne 0x3204a
leaq 0xa080e(%rip), %rax     # 0xd2870
movq (%rax), %rax
cmpl $0x0, 0x10(%rax)
jle 0x32083
xorl %ecx, %ecx
movl (%rbx,%rcx,4), %edx
movl %edx, 0xe8(%rsp,%rcx,4)
incq %rcx
movslq 0x10(%rax), %rdx
cmpq %rdx, %rcx
jl 0x3206d
movl %ebp, %edi
callq 0x38678
movq %rax, %rbx
testl %ebp, %ebp
jle 0x320bc
xorl %eax, %eax
movl $0x1, %ecx
xorl %edx, %edx
movq (%r12,%rax,8), %rsi
movslq (%rbx,%rax,4), %rdi
movl (%rsi,%rdi,4), %esi
imull %ecx, %esi
addl %esi, %edx
imull (%r15,%rax,4), %ecx
incq %rax
cmpq %rax, %rbp
jne 0x3209a
movslq %edx, %rcx
jmp 0x320be
xorl %ecx, %ecx
leaq 0xa07ab(%rip), %rax     # 0xd2870
movq (%rax), %rax
cmpl $0x0, 0x10(%rax)
jle 0x320f6
movq 0x8(%rsp), %rdx
movq (%rdx,%rcx,8), %rcx
xorl %edx, %edx
movl (%rcx,%rdx,4), %esi
addl %esi, 0x20(%rsp,%rdx,4)
movl (%rcx,%rdx,4), %esi
subl %esi, 0xe8(%rsp,%rdx,4)
incq %rdx
movslq 0x10(%rax), %rsi
cmpq %rsi, %rdx
jl 0x320d9
leaq 0x20(%rsp), %rdi
callq 0x1d7dc
movq 0x1f0(%rsp), %rax
movsd (%rax), %xmm1
movsd %xmm0, 0x10(%rsp)
callq 0x38d8e
testl %eax, %eax
je 0x321b2
movq 0x1f0(%rsp), %rax
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
testl %ebp, %ebp
jle 0x321b2
xorl %r14d, %r14d
movq 0x18(%rsp), %rax
movl (%rax,%r14,4), %eax
movq 0x8(%r13), %rcx
movl %eax, (%rcx,%r14,4)
movl (%rbx,%r14,4), %eax
movq 0x10(%r13), %rcx
movl %eax, (%rcx,%r14,4)
movq 0x18(%r13), %rax
movq (%rax,%r14,8), %rdi
callq 0x39194
movslq (%r15,%r14,4), %rdi
shlq $0x2, %rdi
leaq 0x73b0e(%rip), %rsi     # 0xa5c7f
movl $0x46, %edx
callq 0x390f5
movq 0x18(%r13), %rcx
movq %rax, (%rcx,%r14,8)
cmpl $0x0, (%r15,%r14,4)
jle 0x321aa
movq (%r12,%r14,8), %rax
movq 0x18(%r13), %rcx
movq (%rcx,%r14,8), %rcx
xorl %edx, %edx
movl (%rax,%rdx,4), %esi
movl %esi, (%rcx,%rdx,4)
incq %rdx
movslq (%r15,%r14,4), %rsi
cmpq %rsi, %rdx
jl 0x32198
incq %r14
cmpq %rbp, %r14
jne 0x32138
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x38be7
testl %eax, %eax
jne 0x3208d
movq %rbx, %rdi
callq 0x39194
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq