// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/krule.c
// Function: update_best_discrete_condition
void update_best_discrete_condition(Korderingsplit* split, int* perm[], int* rangelist, int* iter, int** featurecounts, int partitioncounts[], double* bestgain)
{
	int i, j, size = split->featurecount, permpos, permmultiplier;
 int* mixediter;
 int counts[2][2];
	double gain, it, itdot;
 counts[COVERED][POSITIVE_CLASS] = 0;
 counts[COVERED][NEGATIVE_CLASS] = 0;
 counts[UNCOVERED][POSITIVE_CLASS] = partitioncounts[POSITIVE_CLASS];
 counts[UNCOVERED][NEGATIVE_CLASS] = partitioncounts[NEGATIVE_CLASS];
 mixediter = first_mixed_iterator(size);
 it = information(partitioncounts[POSITIVE_CLASS], partitioncounts[POSITIVE_CLASS] + partitioncounts[NEGATIVE_CLASS]);
 do{
   permpos = 0;
   permmultiplier = 1;
   for (i = 0; i < size; i++)
    {
     permpos += permmultiplier * perm[i][mixediter[i]];
     permmultiplier *= rangelist[i];
    }
   counts[COVERED][POSITIVE_CLASS] += featurecounts[permpos][POSITIVE_CLASS];
   counts[COVERED][NEGATIVE_CLASS] += featurecounts[permpos][NEGATIVE_CLASS];
   counts[UNCOVERED][POSITIVE_CLASS] -= featurecounts[permpos][POSITIVE_CLASS];
   counts[UNCOVERED][NEGATIVE_CLASS] -= featurecounts[permpos][NEGATIVE_CLASS];
   itdot = information(counts[COVERED][POSITIVE_CLASS], counts[COVERED][POSITIVE_CLASS] + counts[COVERED][NEGATIVE_CLASS]);
   gain = counts[COVERED][POSITIVE_CLASS] * (it - itdot);
   if (dless(*bestgain, gain))
    {
     *bestgain = gain;
     for (i = 0; i < size; i++)
      {
       split->featurelist[i] = iter[i];
       split->discretesplit[i] = mixediter[i];
       split->sortorder[i] = safemalloc(rangelist[i] * sizeof(int), "find_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
movq %rsp, %rbp
subq $0x80, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x60(%rbp)
movl $0x0, -0x5c(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x54(%rbp)
movl -0x3c(%rbp), %edi
callq 0x51b80
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %edi
movq -0x30(%rbp), %rax
movl (%rax), %esi
movq -0x30(%rbp), %rax
addl 0x4(%rax), %esi
callq 0xae3a0
movsd %xmm0, -0x70(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x1, -0x44(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x474e9
movl -0x44(%rbp), %eax
movq -0x10(%rbp), %rcx
movslq -0x34(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq -0x50(%rbp), %rdx
movslq -0x34(%rbp), %rsi
movslq (%rdx,%rsi,4), %rdx
imull (%rcx,%rdx,4), %eax
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %eax
imull -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x4749f
movq -0x28(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
movq -0x28(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x4(%rax), %eax
addl -0x5c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movq -0x28(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %ecx
movl -0x58(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x4(%rax), %ecx
movl -0x54(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x54(%rbp)
movl -0x60(%rbp), %edi
movl -0x60(%rbp), %esi
addl -0x5c(%rbp), %esi
callq 0xae3a0
movsd %xmm0, -0x78(%rbp)
cvtsi2sdl -0x60(%rbp), %xmm0
movsd -0x70(%rbp), %xmm1
subsd -0x78(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movq 0x10(%rbp), %rax
movsd (%rax), %xmm0
movsd -0x68(%rbp), %xmm1
callq 0x52750
cmpl $0x0, %eax
je 0x4766b
movsd -0x68(%rbp), %xmm0
movq 0x10(%rbp), %rax
movsd %xmm0, (%rax)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x47669
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x50(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rcx
movslq (%rax,%rcx,4), %rdi
shlq $0x2, %rdi
leaq 0x9e1c7(%rip), %rsi     # 0xe57b7
movl $0x46, %edx
callq 0x52d70
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x18(%rbp), %rcx
movslq -0x34(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x47659
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x47614
jmp 0x4765b
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x47599
jmp 0x4766b
jmp 0x4766d
movq -0x50(%rbp), %rdi
movl -0x3c(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0x523a0
cmpl $0x0, %eax
jne 0x4748a
movq -0x50(%rbp), %rdi
callq 0x52e80
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)