// File: /workspace/github_c_makefile_star2_O2/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 %r8, %rbx
movq %rcx, 0x18(%rsp)
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movl (%rdi), %eax
movl %eax, 0x4(%rsp)
xorl %eax, %eax
cmpq $0x32, %rax
je 0x2e76a
andl $0x0, 0xe8(%rsp,%rax,4)
andl $0x0, 0x20(%rsp,%rax,4)
incq %rax
jmp 0x2e752
leaq 0x9f0ff(%rip), %rax     # 0xcd870
movq (%rax), %rax
movslq 0x10(%rax), %rax
xorl %ecx, %ecx
cmpq %rax, %rcx
jge 0x2e78f
movl (%r9,%rcx,4), %edx
movl %edx, 0xe8(%rsp,%rcx,4)
incq %rcx
jmp 0x2e77a
movl 0x4(%rsp), %ebp
movl %ebp, %edi
callq 0x3466d
movq %rax, 0x8(%rsp)
xorl %ecx, %ecx
testl %ebp, %ebp
movl $0x0, %r14d
cmovgl %ebp, %r14d
pushq $0x1
popq %rsi
xorl %edx, %edx
cmpq %r14, %rcx
jne 0x2e7e9
leaq 0x9f0b2(%rip), %rax     # 0xcd870
movq (%rax), %rax
movslq %edx, %rcx
xorl %edx, %edx
movslq 0x10(%rax), %rsi
cmpq %rsi, %rdx
jge 0x2e808
movq (%rbx,%rcx,8), %rsi
movl (%rsi,%rdx,4), %edi
addl %edi, 0x20(%rsp,%rdx,4)
movl (%rsi,%rdx,4), %esi
subl %esi, 0xe8(%rsp,%rdx,4)
incq %rdx
jmp 0x2e7c6
movq (%r12,%rcx,8), %rax
movq 0x8(%rsp), %rdi
movslq (%rdi,%rcx,4), %rdi
movl (%rax,%rdi,4), %eax
imull %esi, %eax
addl %eax, %edx
imull (%r15,%rcx,4), %esi
incq %rcx
jmp 0x2e7b2
leaq 0x20(%rsp), %rdi
callq 0x1ba06
movq 0x1f0(%rsp), %rax
movsd (%rax), %xmm1
movsd %xmm0, 0x10(%rsp)
callq 0x34c76
testl %eax, %eax
je 0x2e8bb
movq 0x1f0(%rsp), %rax
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
xorl %ebp, %ebp
cmpq %r14, %rbp
je 0x2e8bb
movq 0x18(%rsp), %rax
movl (%rax,%rbp,4), %eax
movq 0x8(%r13), %rcx
movl %eax, (%rcx,%rbp,4)
movq 0x8(%rsp), %rax
movl (%rax,%rbp,4), %eax
movq 0x10(%r13), %rcx
movl %eax, (%rcx,%rbp,4)
movq 0x18(%r13), %rax
movq (%rax,%rbp,8), %rdi
callq 0x34ff7
movslq (%r15,%rbp,4), %rdi
shlq $0x2, %rdi
leaq 0x6a3f3(%rip), %rsi     # 0x98c77
pushq $0x46
popq %rdx
callq 0x34f59
movq 0x18(%r13), %rcx
movq %rax, (%rcx,%rbp,8)
xorl %eax, %eax
movslq (%r15,%rbp,4), %rcx
cmpq %rcx, %rax
jge 0x2e8b6
movq (%r12,%rbp,8), %rcx
movl (%rcx,%rax,4), %ecx
movq 0x18(%r13), %rdx
movq (%rdx,%rbp,8), %rdx
movl %ecx, (%rdx,%rax,4)
incq %rax
jmp 0x2e896
incq %rbp
jmp 0x2e845
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
movq %r15, %rdx
callq 0x34b0d
xorl %ecx, %ecx
movl $0x0, %edx
pushq $0x1
popq %rsi
testl %eax, %eax
jne 0x2e7b2
movq 0x8(%rsp), %rdi
callq 0x34ff7
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq