// File: /workspace/github_c_makefile_star2_O1/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, %rbx
movl (%rsi), %eax
movl %eax, 0x14(%rsp)
movq %rsi, %rdi
movl %edx, %esi
callq 0x779a
movq %rax, 0x8(%rsp)
movq %rbx, 0x20(%rsp)
movq %rbx, %rdi
callq 0x7aa63
movsd 0x9b20c(%rip), %xmm0    # 0xa2d20
movsd %xmm0, 0x18(%rsp)
xorl %r15d, %r15d
leaq 0x38(%rsp), %rbp
leaq 0x60(%rsp), %r13
xorl %r14d, %r14d
movq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %r14d, %edx
movq %rbp, %rcx
movq %r13, %r8
callq 0x7a33
movl 0x4(%rsp), %eax
movl %eax, 0x58(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
movq 0x28(%rsp), %rdx
movl 0x14(%rsp), %ecx
callq 0x77ea
movsd %xmm0, 0x30(%rsp)
movsd 0x18(%rsp), %xmm1
callq 0x38d8e
testl %eax, %eax
je 0x7b9f
testq %r15, %r15
je 0x7b7e
movq %r15, %rdi
callq 0x39194
movq 0x38(%rsp), %rdi
movl 0x48(%rsp), %esi
callq 0x779a
movq %rax, %r15
movl 0x48(%rsp), %ebx
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x50(%rsp), %rdi
callq 0x39194
movq 0x78(%rsp), %rdi
callq 0x39194
incl %r14d
cmpl $0xb, %r14d
jne 0x7b2a
movq 0x8(%rsp), %rdi
movl %r12d, %esi
movq %r15, %rdx
movl %ebx, %ecx
callq 0x7591
movq 0x20(%rsp), %r14
movl 0x4(%rsp), %eax
movl %eax, 0x20(%r14)
testl %ebx, %ebx
je 0x7c01
movl %ebx, 0x10(%r14)
movq (%r15), %rax
movq %rax, (%r14)
movslq %ebx, %rax
movq -0x8(%r15,%rax,8), %rax
movq %rax, 0x8(%r14)
movq $0x0, 0x30(%rax)
cmpl $0x2, %ebx
jl 0x7c23
decl %ebx
xorl %eax, %eax
movq (%r15,%rax,8), %rcx
movq 0x8(%r15,%rax,8), %rdx
leaq 0x1(%rax), %rsi
movq %rdx, 0x30(%rcx)
movq %rsi, %rax
cmpq %rsi, %rbx
jne 0x7c0a
testq %r15, %r15
je 0x7c30
movq %r15, %rdi
callq 0x39194
movq 0x8(%rsp), %rdi
callq 0x39194
movq %r14, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq