// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/c45rules.c
// Function: find_class_rulesets
void find_class_rulesets(Ruleset* r, Instanceptr traindata)
{
/*!Last Changed 30.10.2003*/
 Ruleset sets[MAXCLASSES];
 Decisionruleptr rule = r->start;
 Decisionruleptr rulenext;
 Decisionruleptr rulesetstart = rule;
 int i, currentclass = rule->classno, rulecount = 1, classcount = 0;
 rule = rule->next;
 while (rule != NULL)
  {
   if (rule)
     rulenext = rule->next;
   if (rule->classno != currentclass)
    {
     if (rulecount <= 10)
       sets[classcount] = check_all_subsets(rulesetstart, rulecount, traindata, r->possibleconditioncount);
     else
       sets[classcount] = check_different_percentages(rulesetstart, rulecount, traindata, r->possibleconditioncount);
     classcount++;
     rulecount = 1;
     rulesetstart = rule;
     currentclass = rule->classno;
    }
   else
     rulecount++;
   rule = rulenext;
  }
 if (rulecount <= 10)
   sets[classcount] = check_all_subsets(rulesetstart, rulecount, traindata, r->possibleconditioncount);
 else
   sets[classcount] = check_different_percentages(rulesetstart, rulecount, traindata, r->possibleconditioncount);
 classcount++;
 merge_rulesets(r, sets, classcount);
 for (i = 0; i < classcount; i++)
   safe_free(sets[i].counts);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x8d0, %rsp            # imm = 0x8D0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x7e8(%rbp)
movq -0x7e8(%rbp), %rax
movq %rax, -0x7f8(%rbp)
movq -0x7e8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x800(%rbp)
movl $0x1, -0x804(%rbp)
movl $0x0, -0x808(%rbp)
movq -0x7e8(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x7e8(%rbp)
cmpq $0x0, -0x7e8(%rbp)
je 0xa73a
cmpq $0x0, -0x7e8(%rbp)
je 0xa60e
movq -0x7e8(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x7f0(%rbp)
movq -0x7e8(%rbp), %rax
movl (%rax), %eax
cmpl -0x800(%rbp), %eax
je 0xa718
cmpl $0xa, -0x804(%rbp)
jg 0xa687
movslq -0x808(%rbp), %rcx
leaq -0x7e0(%rbp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x8b0(%rbp)
movq -0x7f8(%rbp), %rsi
movl -0x804(%rbp), %edx
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x20(%rax), %r8d
leaq -0x830(%rbp), %rdi
callq 0x9d60
movq -0x8b0(%rbp), %rdi
leaq -0x830(%rbp), %rsi
movl $0x28, %edx
callq 0x42b0
jmp 0xa6e0
movslq -0x808(%rbp), %rcx
leaq -0x7e0(%rbp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x8b8(%rbp)
movq -0x7f8(%rbp), %rsi
movl -0x804(%rbp), %edx
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x20(%rax), %r8d
leaq -0x858(%rbp), %rdi
callq 0xa2f0
movq -0x8b8(%rbp), %rdi
leaq -0x858(%rbp), %rsi
movl $0x28, %edx
callq 0x42b0
movl -0x808(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x808(%rbp)
movl $0x1, -0x804(%rbp)
movq -0x7e8(%rbp), %rax
movq %rax, -0x7f8(%rbp)
movq -0x7e8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x800(%rbp)
jmp 0xa727
movl -0x804(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x804(%rbp)
movq -0x7f0(%rbp), %rax
movq %rax, -0x7e8(%rbp)
jmp 0xa5e4
cmpl $0xa, -0x804(%rbp)
jg 0xa79e
movslq -0x808(%rbp), %rcx
leaq -0x7e0(%rbp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x8c0(%rbp)
movq -0x7f8(%rbp), %rsi
movl -0x804(%rbp), %edx
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x20(%rax), %r8d
leaq -0x880(%rbp), %rdi
callq 0x9d60
movq -0x8c0(%rbp), %rdi
leaq -0x880(%rbp), %rsi
movl $0x28, %edx
callq 0x42b0
jmp 0xa7f7
movslq -0x808(%rbp), %rcx
leaq -0x7e0(%rbp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x8c8(%rbp)
movq -0x7f8(%rbp), %rsi
movl -0x804(%rbp), %edx
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x20(%rax), %r8d
leaq -0x8a8(%rbp), %rdi
callq 0xa2f0
movq -0x8c8(%rbp), %rdi
leaq -0x8a8(%rbp), %rsi
movl $0x28, %edx
callq 0x42b0
movl -0x808(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x808(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x7e0(%rbp), %rsi
movl -0x808(%rbp), %edx
callq 0xa500
movl $0x0, -0x7fc(%rbp)
movl -0x7fc(%rbp), %eax
cmpl -0x808(%rbp), %eax
jge 0xa863
movslq -0x7fc(%rbp), %rcx
leaq -0x7e0(%rbp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
callq 0x52e80
movl -0x7fc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7fc(%rbp)
jmp 0xa826
addq $0x8d0, %rsp            # imm = 0x8D0
popq %rbp
retq
nopl (%rax)