// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0xa0(%rbp)
movq %rdi, -0xa8(%rbp)
movq %rsi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movq %rcx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x28(%rbp)
movsd 0xd8690(%rip), %xmm0    # 0xe29c0
movsd %xmm0, -0x30(%rbp)
movq $0x0, -0x98(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x9f20
movq -0xa0(%rbp), %rdi
movq %rax, -0x90(%rbp)
callq 0xade30
movl $0x0, -0x20(%rbp)
cmpl $0xa, -0x20(%rbp)
jg 0xa41c
movq -0x90(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x20(%rbp), %edx
leaq -0x60(%rbp), %rcx
leaq -0x88(%rbp), %r8
callq 0xa230
movl -0x1c(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x18(%rbp), %rdx
movl -0x28(%rbp), %ecx
leaq -0x60(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x9fb0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
callq 0x52750
cmpl $0x0, %eax
je 0xa3fc
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
cmpq $0x0, -0x98(%rbp)
je 0xa3e3
movq -0x98(%rbp), %rdi
callq 0x52e80
movq -0x60(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0x9f20
movq %rax, -0x98(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x48(%rbp), %rdi
callq 0x52e80
movq -0x70(%rbp), %rdi
callq 0x52e80
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xa366
movq -0x90(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x98(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x9c90
movq -0xa0(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, 0x20(%rax)
cmpl $0x0, -0x24(%rbp)
je 0xa486
movq -0xa0(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, 0x10(%rax)
movq -0x98(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq -0x98(%rbp), %rcx
movl -0x24(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rax), %rax
movq $0x0, 0x30(%rax)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xa4cc
movq -0x98(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
movq -0x98(%rbp), %rax
movslq -0x20(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x30(%rax)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xa48d
cmpq $0x0, -0x98(%rbp)
je 0xa4e2
movq -0x98(%rbp), %rdi
callq 0x52e80
movq -0x90(%rbp), %rdi
callq 0x52e80
movq -0xa8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nop