// File: /workspace/github_c_makefile_star2_O1/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), %r12b
callq 0x7aa63
movq (%r14), %rdi
leaq 0x44(%rsp), %rsi
callq 0x11633
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
addl $0x19999998, %eax       # imm = 0x19999998
rorl %eax
cmpl $0x19999999, %eax       # imm = 0x19999999
jb 0xdd68
movq (%r14), %rdi
callq 0x115e1
movq %rax, %r13
leaq 0xc4c5f(%rip), %rax     # 0xd2870
movq (%rax), %rax
movl 0x10(%rax), %esi
testb %r12b, %r12b
je 0xdc22
movl %esi, 0xc(%rsp)
jmp 0xdc34
leaq 0xc(%rsp), %rdx
movq %r13, %rdi
callq 0x3758b
movq %rax, 0x10(%rsp)
testb %r12b, %r12b
movq %r13, 0x28(%rsp)
je 0xdc4e
movslq 0xc(%rsp), %rax
movsbl 0xf(%r15,%rax), %eax
addl $-0x30, %eax
jmp 0xdc55
movq 0x10(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x14(%rbx)
movslq 0xc(%rsp), %rax
cmpq $0x2, %rax
jl 0xdd42
leaq 0x20(%rsp), %rbp
movb %r12b, 0xb(%rsp)
leaq -0x1(%rax), %rcx
testb %r12b, %r12b
movq %rcx, 0x38(%rsp)
movq %rax, 0x30(%rsp)
je 0xdc9b
movq %rax, %rdx
movl 0xc(%rsp), %eax
subl %edx, %eax
cltq
movsbl 0x10(%r15,%rax), %r12d
addl $-0x30, %r12d
jmp 0xdca4
movq 0x10(%rsp), %rax
movl (%rax,%rcx,4), %r12d
movq (%r14), %rdi
movl %r12d, %esi
callq 0x11534
movl %eax, 0x18(%rsp)
movq (%r14), %rdi
callq 0x2fa14
movl %eax, %r13d
movq (%r14), %rdi
movl %r12d, %esi
callq 0x11534
testl %eax, %eax
jle 0xdd2c
xorps %xmm1, %xmm1
cvtsi2sdl 0x18(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
movl (%r15), %edx
movq %r14, %rdi
movl %r12d, %esi
movsd 0x18(%rsp), %xmm0
callq 0xd9b1
testq %rax, %rax
je 0xdd2c
movq %rax, %r13
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x9c951
movq %rbx, %rdi
movq %r13, %rsi
callq 0x7b0fb
movq (%r14), %rdi
movl %r12d, %esi
callq 0x11534
testl %eax, %eax
jg 0xdce8
cmpq $0x2, 0x30(%rsp)
movb 0xb(%rsp), %r12b
movq 0x38(%rsp), %rax
jg 0xdc71
movq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x2fd59
movq 0x28(%rsp), %rdi
callq 0x39194
testb %r12b, %r12b
jne 0xdd68
movq 0x10(%rsp), %rdi
callq 0x39194
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop