// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/ktree.c
// Function: find_best_discrete_split
Korderingsplit find_best_discrete_split(Decisionnodeptr node, int depth, double* gain)
{
 int* iter;
 int* rangelist;
 int** featurecounts;
 int permsize;
 int i, j, anysame;
 Korderingsplit ksplit;
 *gain = +INT_MAX;
 iter = first_iterator(depth);
 ksplit.featurecount = depth;
 ksplit.sortorder = safemalloc(depth * sizeof(int*), "find_best_discrete_split", 6);
 for (i = 0; i < depth; i++)
   ksplit.sortorder[i] = safemalloc(sizeof(int), "find_best_discrete_split", 6);
 ksplit.featurelist = safemalloc(depth * sizeof(int), "find_best_discrete_split", 7);
 ksplit.discretesplit = safemalloc(depth * sizeof(int), "find_best_discrete_split", 8);
 rangelist = safemalloc(depth * sizeof(int), "find_best_discrete_split", 9);
 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(node->instances, iter, depth, &permsize);
   for (i = 0; i < depth; i++)
     rangelist[i] = current_dataset->features[iter[i]].valuecount;
   switch (depth)
    {
     case 1:find_best_discrete_split_1(&ksplit, rangelist, iter, featurecounts, node->counts, gain);
            break;
     case 2:find_best_discrete_split_2(&ksplit, rangelist, iter, featurecounts, node->counts, gain);
            break;
     case 3:find_best_discrete_split_3(&ksplit, rangelist, iter, featurecounts, node->counts, gain);
            break;
     case 4:find_best_discrete_split_4(&ksplit, rangelist, iter, featurecounts, node->counts, gain);
            break;
     default:find_best_discrete_split_1(&ksplit, rangelist, iter, featurecounts, node->counts, gain);
             break;
    }
   free_2d((void**) featurecounts, permsize);
 }while (next_iterator(iter, depth, current_dataset->featurecount - 1));
 safe_free(iter);
 safe_free(rangelist);
 if (*gain == ISELL)
   ksplit.featurecount = 0;
 return ksplit;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %r12d
movq %rsi, 0x20(%rsp)
movq %rdi, %r15
movabsq $0x41dfffffffc00000, %rax # imm = 0x41DFFFFFFFC00000
movq %rcx, 0x10(%rsp)
movq %rax, (%rcx)
movl %edx, %edi
callq 0x3930e
movq %rax, %r13
movl %r12d, (%r15)
movslq %r12d, %rbx
leaq (,%rbx,8), %rdi
leaq 0x75d3a(%rip), %rsi     # 0xa8c7f
movl $0x6, %edx
callq 0x3a0e1
movq %r15, 0x8(%rsp)
movq %rax, 0x18(%r15)
movq %r12, 0x28(%rsp)
movl %r12d, %r12d
testl %ebx, %ebx
jle 0x32f8f
movq %rax, %r14
xorl %r15d, %r15d
leaq 0x75d0e(%rip), %rbp     # 0xa8c7f
movl $0x4, %edi
movq %rbp, %rsi
movl $0x6, %edx
callq 0x3a0e1
movq %rax, (%r14,%r15,8)
incq %r15
cmpq %r15, %r12
jne 0x32f71
leaq (,%rbx,4), %r14
leaq 0x75ce1(%rip), %rbp     # 0xa8c7f
movq %r14, %rdi
movq %rbp, %rsi
movl $0x7, %edx
callq 0x3a0e1
movq 0x8(%rsp), %r15
movq %rax, 0x8(%r15)
movq %r14, %rdi
movq %rbp, %rsi
movl $0x8, %edx
callq 0x3a0e1
movq %rax, 0x10(%r15)
movq %r14, %rdi
movq %rbp, %rsi
movl $0x9, %edx
callq 0x3a0e1
movq %rax, %rbp
movl $0x1, %r15d
movq 0x28(%rsp), %r14
movq %rax, 0x30(%rsp)
testl %r14d, %r14d
jle 0x330ce
xorl %esi, %esi
movq %r12, %rcx
movq %r13, %rdx
xorl %eax, %eax
movq %rsi, %rdi
incq %rsi
cmpq %rbx, %rsi
jge 0x33027
movl (%r13,%rdi,4), %edi
movl $0x1, %r8d
cmpl (%rdx,%r8,4), %edi
cmovel %r15d, %eax
incq %r8
cmpq %r8, %rcx
jne 0x33017
addq $0x4, %rdx
decq %rcx
cmpq %r12, %rsi
jne 0x33001
testl %r14d, %r14d
jle 0x330c6
leaq 0xa282d(%rip), %rcx     # 0xd5870
movq (%rcx), %rcx
movl 0x1407128(%rcx), %ecx
xorl %edx, %edx
cmpl %ecx, (%r13,%rdx,4)
cmovel %r15d, %eax
incq %rdx
cmpq %rdx, %r12
jne 0x3304e
testl %eax, %eax
jne 0x3318b
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rdi
movq %r13, %rsi
movl %r14d, %edx
leaq 0x1c(%rsp), %rcx
callq 0xa0e62
movq %r14, %rcx
movq %rax, %r14
testl %ecx, %ecx
jle 0x330ba
leaq 0xa27df(%rip), %rax     # 0xd5870
movq (%rax), %rax
movl $0x30f08, %ecx          # imm = 0x30F08
addq %rcx, %rax
xorl %ecx, %ecx
movslq (%r13,%rcx,4), %rdx
imulq $0x340, %rdx, %rdx      # imm = 0x340
movl 0x18(%rax,%rdx), %edx
movl %edx, (%rbp,%rcx,4)
incq %rcx
cmpq %rcx, %r12
jne 0x3309e
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %rdx
jmp 0x330f5
testl %eax, %eax
jne 0x3318b
movq 0x20(%rsp), %rbp
movq 0x20(%rbp), %rdi
movq %r13, %rsi
movl %r14d, %edx
leaq 0x1c(%rsp), %rcx
callq 0xa0e62
movq %rbp, %rdx
movq 0x30(%rsp), %rbp
movq %r14, %rcx
movq %rax, %r14
movq 0xa0(%rdx), %r8
leal -0x1(%rcx), %eax
cmpl $0x3, %eax
ja 0x33114
leaq 0x75bd5(%rip), %rcx     # 0xa8ce0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r14, %rcx
movq 0x10(%rsp), %r9
callq 0x328c3
jmp 0x3317a
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r14, %rcx
movq 0x10(%rsp), %r9
callq 0x32c94
jmp 0x3317a
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r14, %rcx
movq 0x10(%rsp), %r9
callq 0x32da7
jmp 0x3317a
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r14, %rcx
movq 0x10(%rsp), %r9
callq 0x32bc7
movl 0x1c(%rsp), %esi
movq %r14, %rdi
callq 0x3a14b
movq 0x28(%rsp), %r14
leaq 0xa26de(%rip), %rax     # 0xd5870
movq (%rax), %rax
movl 0x1bc(%rax), %edx
decl %edx
movq %r13, %rdi
movl %r14d, %esi
callq 0x3991a
testl %eax, %eax
jne 0x32fee
movq %r13, %rdi
callq 0x3a180
movq %rbp, %rdi
callq 0x3a180
movq 0x10(%rsp), %rax
movsd (%rax), %xmm0
ucomisd 0x72b1f(%rip), %xmm0    # 0xa5cf0
movq 0x8(%rsp), %rax
jne 0x331e0
jp 0x331e0
movl $0x0, (%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq