// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/krule.c
// Function: find_best_discrete_condition
Decisionconditionptr find_best_discrete_condition(Instanceptr growset, int depth, int positive, double* bestgain)
{
 int* iter;
 int* rangelist;
 int counts[2];
 int** featurecounts;
 int permsize;
 int i, j, anysame;
 Decisionconditionptr result;
 result = empty_condition();
 result->conditiontype = UNIVARIATE_CONDITION;
 result->featureindex = DISCRETEMIX;
 result->freeparam = 1;
 result->comparison = '<';
 *bestgain = 0.0;
 iter = first_iterator(depth);
 result->ksplit.featurecount = depth;
 result->ksplit.sortorder = safemalloc(depth * sizeof(int*), "find_best_discrete_split", 6);
 result->ksplit.featurelist = safemalloc(depth * sizeof(int), "find_best_discrete_split", 7);
 result->ksplit.discretesplit = safemalloc(depth * sizeof(int), "find_best_discrete_split", 8);
 rangelist = safemalloc(depth * sizeof(int), "find_best_discrete_split", 9);
 counts[POSITIVE_CLASS] = find_class_count(growset, positive);
 counts[NEGATIVE_CLASS] = data_size(growset) - counts[POSITIVE_CLASS];
 do{
   anysame = NO;
   for (i = 0; i < depth; i++)
     for (j = i + 1; j < depth; j++)
       if (iter[i] == iter[j])
         anysame = YES;
   for (i = 0; i < depth; i++)
     if (iter[i] == current_dataset->classdefno)
       anysame = YES;
   if (anysame)
     continue;
   featurecounts = count_feature_combinations_one_vs_rest(growset, iter, depth, &permsize, positive);
   for (i = 0; i < depth; i++)
     rangelist[i] = current_dataset->features[iter[i]].valuecount;
   switch (depth)
    {
     case 1:find_best_discrete_condition_1(&(result->ksplit), rangelist, iter, featurecounts, counts, positive, bestgain);
            break;
     case 2:find_best_discrete_condition_2(&(result->ksplit), rangelist, iter, featurecounts, counts, positive, bestgain);
            break;
     case 3:find_best_discrete_condition_3(&(result->ksplit), rangelist, iter, featurecounts, counts, positive, bestgain);
            break;
     case 4:find_best_discrete_condition_4(&(result->ksplit), rangelist, iter, featurecounts, counts, positive, bestgain);
            break;
     default:find_best_discrete_condition_1(&(result->ksplit), rangelist, iter, featurecounts, counts, positive, bestgain);
             break;
    }
   free_2d((void**) featurecounts, permsize);
 }while (next_iterator(iter, depth, current_dataset->featurecount - 1));
 safe_free(iter);
 safe_free(rangelist);
 if (*bestgain == 0)
   result->featureindex = -1;
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movb $0x0, %al
callq 0xadea0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl $0x0, 0x40(%rax)
movq -0x50(%rbp), %rax
movl $0xfffffffb, (%rax)     # imm = 0xFFFFFFFB
movq -0x50(%rbp), %rax
movl $0x1, 0x3c(%rax)
movq -0x50(%rbp), %rax
movb $0x3c, 0x4(%rax)
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movl -0xc(%rbp), %edi
callq 0x51b20
movq %rax, -0x20(%rbp)
movl -0xc(%rbp), %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x50(%rax)
movslq -0xc(%rbp), %rdi
shlq $0x3, %rdi
leaq 0x9dc1e(%rip), %rsi     # 0xe57b7
movl $0x6, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x68(%rax)
movslq -0xc(%rbp), %rdi
shlq $0x2, %rdi
leaq 0x9dbfa(%rip), %rsi     # 0xe57b7
movl $0x7, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x58(%rax)
movslq -0xc(%rbp), %rdi
shlq $0x2, %rdi
leaq 0x9dbd6(%rip), %rsi     # 0xe57b7
movl $0x8, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x60(%rax)
movslq -0xc(%rbp), %rdi
shlq $0x2, %rdi
leaq 0x9dbb2(%rip), %rsi     # 0xe57b7
movl $0x9, %edx
callq 0x52d70
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x18240
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x449f0
subl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x47c91
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x47c84
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x20(%rbp), %rcx
movslq -0x44(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x47c77
movl $0x1, -0x48(%rbp)
jmp 0x47c79
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x47c50
jmp 0x47c86
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x47c3f
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x47cd1
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
leaq 0xbdb8e(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1407128(%rcx), %eax
jne 0x47cc4
movl $0x1, -0x48(%rbp)
jmp 0x47cc6
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x47c98
cmpl $0x0, -0x48(%rbp)
je 0x47cdc
jmp 0x47e52
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %r8d
leaq -0x3c(%rbp), %rcx
callq 0x47290
movq %rax, -0x38(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x47d46
leaq 0xbdb32(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq -0x20(%rbp), %rcx
movslq -0x40(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl 0x18(%rax), %edx
movq -0x28(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x47cff
movl -0xc(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x3, %eax
ja 0x47e1d
movq -0x58(%rbp), %rax
leaq 0x9da27(%rip), %rcx     # 0xe578c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x50(%rbp), %rdi
addq $0x50, %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
leaq -0x30(%rbp), %r8
movl -0x10(%rbp), %r9d
movq -0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x476a0
jmp 0x47e46
movq -0x50(%rbp), %rdi
addq $0x50, %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
leaq -0x30(%rbp), %r8
movl -0x10(%rbp), %r9d
movq -0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x47720
jmp 0x47e46
movq -0x50(%rbp), %rdi
addq $0x50, %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
leaq -0x30(%rbp), %r8
movl -0x10(%rbp), %r9d
movq -0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x477d0
jmp 0x47e46
movq -0x50(%rbp), %rdi
addq $0x50, %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
leaq -0x30(%rbp), %r8
movl -0x10(%rbp), %r9d
movq -0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x478b0
jmp 0x47e46
movq -0x50(%rbp), %rdi
addq $0x50, %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
leaq -0x30(%rbp), %r8
movl -0x10(%rbp), %r9d
movq -0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x476a0
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x52e20
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0xbd9e0(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1bc(%rax), %edx
subl $0x1, %edx
callq 0x52330
cmpl $0x0, %eax
jne 0x47c31
movq -0x20(%rbp), %rdi
callq 0x52e80
movq -0x28(%rbp), %rdi
callq 0x52e80
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x47ea9
jp 0x47ea9
movq -0x50(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq -0x50(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)