// File: /workspace/github_c_makefile_star2_O2/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, %r13d
movq %rdi, %rbx
movl (%rsi), %eax
movl %eax, 0x1c(%rsp)
movq %rsi, %rdi
movl %edx, %esi
callq 0x7548
movq %rax, 0x8(%rsp)
movq %rbx, 0x20(%rsp)
movq %rbx, %rdi
callq 0x71c9d
xorl %ebp, %ebp
movsd 0x8e486(%rip), %xmm0    # 0x95d28
leaq 0x38(%rsp), %rbx
leaq 0x60(%rsp), %r14
xorl %r15d, %r15d
cmpl $0xb, %ebp
je 0x7954
movq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
movq %rbx, %rcx
movq %r14, %r8
movsd %xmm0, 0x10(%rsp)
callq 0x77c9
movl 0x4(%rsp), %eax
movl %eax, 0x58(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq 0x28(%rsp), %rdx
movl 0x1c(%rsp), %ecx
callq 0x7595
movsd %xmm0, 0x30(%rsp)
movsd 0x10(%rsp), %xmm1
callq 0x34c76
testl %eax, %eax
je 0x7933
testq %r15, %r15
je 0x7911
movq %r15, %rdi
callq 0x34ff7
movq 0x38(%rsp), %rdi
movl 0x48(%rsp), %esi
callq 0x7548
movq %rax, %r15
movl 0x48(%rsp), %r12d
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x50(%rsp), %rdi
callq 0x34ff7
movq 0x78(%rsp), %rdi
callq 0x34ff7
incl %ebp
movsd 0x10(%rsp), %xmm0
jmp 0x78af
movq 0x8(%rsp), %rdi
movl %r13d, %esi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x7363
movq 0x20(%rsp), %rbx
movl 0x4(%rsp), %eax
movl %eax, 0x20(%rbx)
testl %r12d, %r12d
je 0x7998
movl %r12d, 0x10(%rbx)
movq (%r15), %rax
movq %rax, (%rbx)
movslq %r12d, %rax
decl %r12d
movq -0x8(%r15,%rax,8), %rax
movq %rax, 0x8(%rbx)
andq $0x0, 0x30(%rax)
jmp 0x799c
pushq $-0x1
popq %r12
xorl %eax, %eax
testl %r12d, %r12d
cmovlel %eax, %r12d
cmpq %rax, %r12
je 0x79bc
movq (%r15,%rax,8), %rcx
movq 0x8(%r15,%rax,8), %rdx
incq %rax
movq %rdx, 0x30(%rcx)
jmp 0x79a5
testq %r15, %r15
je 0x79c9
movq %r15, %rdi
callq 0x34ff7
movq 0x8(%rsp), %rdi
callq 0x34ff7
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq