// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/cn2.c
// Function: learn_ruleset_cn2
Ruleset learn_ruleset_cn2(Instanceptr* instances, Cn2_parameterptr param)
{
 Decisionruleptr newrule;
 int classno, classcount, *classes, posclass;
 Instanceptr covered = NULL;
 int *counts, maxcount, i;
 double positive_ratio;
 Ruleset result;
 BOOLEAN givenperm;
 if (strlen(param->classpermutation) == 0)
   givenperm = BOOLEAN_FALSE;
 else
   givenperm = BOOLEAN_TRUE; 
 empty_ruleset(&result);
 classno = all_in_one_class(*instances, &maxcount);
 if (!(classno % 10))
   return result; 
 counts = find_class_counts(*instances);
 if (!givenperm)
   classes = find_max_occured(counts, current_dataset->classno, &classcount);
 else
   classcount = current_dataset->classno;
 if (!givenperm)
   result.defaultclass = classes[0];
 else
   result.defaultclass = param->classpermutation[classcount - 1] - '0';
 for (i = classcount - 1; i > 0; i--)
  {
   if (!givenperm)
     posclass = classes[i];
   else
     posclass = param->classpermutation[classcount - i - 1] - '0';
   positive_ratio = find_class_count(*instances, posclass) / (data_size(*instances) + 0.0);
   while (find_class_count(*instances, posclass) > 0)
    {
     newrule = find_best_complex(instances, posclass, param->maxstar, positive_ratio);
     if (newrule)
      {
       remove_covered(instances, &covered, newrule);
       add_rule(&result, newrule);
      }
     else 
       break;
    }
  }
 merge_instancelist(instances, covered);
 safe_free(counts);
 if (!givenperm)
   safe_free(classes);
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq $0x0, 0x20(%rsp)
movb 0x10(%rdx), %r13b
callq 0x7c32b
movq (%r14), %rdi
leaq 0x44(%rsp), %rsi
callq 0x115f8
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
addl $0x19999998, %eax       # imm = 0x19999998
rorl %eax
cmpl $0x19999999, %eax       # imm = 0x19999999
jb 0xddeb
movq (%r14), %rdi
callq 0x115a6
movq %rax, %rbp
leaq 0xc7bd8(%rip), %rax     # 0xd5870
movq (%rax), %rax
movl 0x10(%rax), %esi
testb %r13b, %r13b
je 0xdcb5
movslq %esi, %rax
movl %eax, 0xc(%rsp)
movsbl 0xf(%r15,%rax), %eax
addl $-0x30, %eax
jmp 0xdcd0
leaq 0xc(%rsp), %r12
movq %rbp, %rdi
movq %r12, %rdx
callq 0x38089
movq %rax, 0x18(%rsp)
movl (%rax), %eax
movl (%r12), %esi
movl %eax, 0x14(%rbx)
cmpl $0x2, %esi
jl 0xddca
movq %rbp, 0x28(%rsp)
movl %esi, %eax
leaq 0x20(%rsp), %rbp
movb %r13b, 0xb(%rsp)
leaq -0x1(%rax), %rcx
testb %r13b, %r13b
movq %rcx, 0x38(%rsp)
movq %rax, 0x30(%rsp)
je 0xdd17
movq %rax, %rdx
movl 0xc(%rsp), %eax
subl %edx, %eax
cltq
movsbl 0x10(%r15,%rax), %r12d
addl $-0x30, %r12d
jmp 0xdd20
movq 0x18(%rsp), %rax
movl (%rax,%rcx,4), %r12d
movq (%r14), %rdi
movl %r12d, %esi
callq 0x114f9
movl %eax, 0x10(%rsp)
movq (%r14), %rdi
callq 0x30309
movl %eax, %r13d
movq (%r14), %rdi
movl %r12d, %esi
callq 0x114f9
testl %eax, %eax
jle 0xdda8
xorps %xmm1, %xmm1
cvtsi2sdl 0x10(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movl (%r15), %edx
movq %r14, %rdi
movl %r12d, %esi
movsd 0x10(%rsp), %xmm0
callq 0xda38
testq %rax, %rax
je 0xdda8
movq %rax, %r13
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x9f94e
movq %rbx, %rdi
movq %r13, %rsi
callq 0x7c9c6
movq (%r14), %rdi
movl %r12d, %esi
callq 0x114f9
testl %eax, %eax
jg 0xdd64
cmpq $0x2, 0x30(%rsp)
movb 0xb(%rsp), %r13b
movq 0x38(%rsp), %rax
jg 0xdced
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rbp
jmp 0xddcc
xorl %esi, %esi
movq %r14, %rdi
callq 0x30648
movq %rbp, %rdi
callq 0x3a180
testb %r13b, %r13b
jne 0xddeb
movq 0x18(%rsp), %rdi
callq 0x3a180
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)