// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/c45rules.c
// Function: check_different_percentages
Ruleset check_different_percentages(Decisionruleptr start, int rulecount, Instanceptr traindata, int conditioncount)
{
 /*!Last Changed 02.12.2004 added remove_rules_according_rules_themselves*/
 /*!Last Changed 05.11.2003 If best ruleset is empty return empty ruleset*/
 /*!Last Changed 31.10.2003*/
 int i = 0, bestcount, classno = start->classno;
 double bestlength = +1000000, length;
 Ruleset best, inlist, outlist;
 Decisionruleptr* rules;
 Decisionruleptr* bestrules = NULL;
 rules = create_array_from_link_list_of_rules(start, rulecount);
 empty_ruleset(&best);
 for (i = 0; i <= 10; i++)
  {
   create_percentage_of_ruleset(rules, rulecount, i, &inlist, &outlist);
   inlist.possibleconditioncount = conditioncount;
   length = search_best_ruleset(&inlist, &outlist, traindata, classno);
   if (dless(length,bestlength))
    {
     bestlength = length;
     if (bestrules)
       safe_free(bestrules);
     bestrules = create_array_from_link_list_of_rules(inlist.start, inlist.rulecount);
     bestcount = inlist.rulecount;
    }
   safe_free(inlist.counts);
   safe_free(outlist.counts);
  }
 remove_rules_according_rules_themselves(rules, rulecount, bestrules, bestcount);
 best.possibleconditioncount = conditioncount;
 if (bestcount != 0)
  {
   best.rulecount = bestcount;
   best.start = bestrules[0];
   best.end = bestrules[bestcount - 1];
   best.end->next = NULL;
  }
 for (i = 0; i < bestcount - 1; i++)
   bestrules[i]->next = bestrules[i+1];
 if (bestrules)
   safe_free(bestrules);
 safe_free(rules);
 return best;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %r8d, 0x4(%rsp)
movq %rcx, 0x28(%rsp)
movl %edx, %r12d
movq %rdi, %r14
movl (%rsi), %ebx
movq %rsi, %rdi
movl %edx, %esi
callq 0x7774
movq %rax, 0x8(%rsp)
movq %r14, 0x20(%rsp)
movq %r14, %rdi
callq 0x7c32b
movsd 0x9e23d(%rip), %xmm0    # 0xa5d20
movsd %xmm0, 0x18(%rsp)
xorl %r15d, %r15d
leaq 0x38(%rsp), %r14
leaq 0x60(%rsp), %rbp
xorl %r13d, %r13d
movq %rax, 0x10(%rsp)
movq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %r13d, %edx
movq %r14, %rcx
movq %rbp, %r8
callq 0x7a06
movl 0x4(%rsp), %eax
movl %eax, 0x58(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
movq 0x28(%rsp), %rdx
movl %ebx, %ecx
callq 0x77c4
movsd %xmm0, 0x30(%rsp)
movsd 0x18(%rsp), %xmm1
callq 0x39aee
testl %eax, %eax
je 0x7b76
testq %r15, %r15
je 0x7b50
movq %r15, %rdi
callq 0x3a180
movq 0x38(%rsp), %rdi
movl 0x48(%rsp), %esi
callq 0x7774
movq %rax, %r15
movl 0x48(%rsp), %eax
movq %rax, 0x10(%rsp)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x50(%rsp), %rdi
callq 0x3a180
movq 0x78(%rsp), %rdi
callq 0x3a180
incl %r13d
cmpl $0xb, %r13d
jne 0x7afe
movq 0x8(%rsp), %rdi
movl %r12d, %esi
movq %r15, %rdx
movq 0x10(%rsp), %rbx
movl %ebx, %ecx
callq 0x7570
movq %rbx, %rdx
movq 0x20(%rsp), %rbx
movl 0x4(%rsp), %eax
movl %eax, 0x20(%rbx)
testl %edx, %edx
je 0x7c00
movl %edx, 0x10(%rbx)
movq (%r15), %rax
movq %rax, (%rbx)
leal -0x1(%rdx), %eax
movslq %eax, %rcx
movq (%r15,%rcx,8), %rcx
movq %rcx, 0x8(%rbx)
movq $0x0, 0x30(%rcx)
cmpl $0x2, %edx
jl 0x7c05
movq (%r15), %rdx
xorl %ecx, %ecx
movq 0x8(%r15,%rcx,8), %rsi
incq %rcx
movq %rsi, 0x30(%rdx)
movq %rsi, %rdx
cmpq %rcx, %rax
jne 0x7bea
jmp 0x7c05
testq %r15, %r15
je 0x7c0d
movq %r15, %rdi
callq 0x3a180
movq 0x8(%rsp), %rdi
callq 0x3a180
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq