// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x68(%rbp)
movq %rdi, -0x60(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
callq 0x4150
cmpq $0x0, %rax
jne 0x12b1c
movl $0x0, -0x54(%rbp)
jmp 0x12b23
movl $0x1, -0x54(%rbp)
movq -0x68(%rbp), %rdi
callq 0xade30
movq -0x8(%rbp), %rax
movq (%rax), %rdi
leaq -0x44(%rbp), %rsi
callq 0x18420
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x12b54
jmp 0x12cdd
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x183a0
movq %rax, -0x40(%rbp)
cmpl $0x0, -0x54(%rbp)
jne 0x12b8a
movq -0x40(%rbp), %rdi
leaq 0xf2ccb(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x10(%rax), %esi
leaq -0x20(%rbp), %rdx
callq 0x50160
movq %rax, -0x28(%rbp)
jmp 0x12b9a
leaq 0xf2caf(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x10(%rax), %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x54(%rbp)
jne 0x12baf
movq -0x68(%rbp), %rax
movq -0x28(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, 0x14(%rax)
jmp 0x12bcb
movq -0x68(%rbp), %rax
movq -0x10(%rbp), %rcx
movl -0x20(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movsbl 0x10(%rcx,%rdx), %ecx
subl $0x30, %ecx
movl %ecx, 0x14(%rax)
movl -0x20(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
jle 0x12cb6
cmpl $0x0, -0x54(%rbp)
jne 0x12bf4
movq -0x28(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x2c(%rbp)
jmp 0x12c0f
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
subl -0x48(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl 0x10(%rax,%rcx), %eax
subl $0x30, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0x2c(%rbp), %esi
callq 0x18240
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x449f0
movsd -0x70(%rbp), %xmm0
cvtsi2sd %eax, %xmm1
xorps %xmm2, %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0x2c(%rbp), %esi
callq 0x18240
cmpl $0x0, %eax
jle 0x12ca6
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq -0x10(%rbp), %rax
movl (%rax), %edx
movsd -0x50(%rbp), %xmm0
callq 0x128d0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x12ca2
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x38(%rbp), %rsi
callq 0xdb5b0
movq -0x68(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xaea30
jmp 0x12ca4
jmp 0x12ca6
jmp 0x12c4c
jmp 0x12ca8
movl -0x48(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x12bd4
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x44f40
movq -0x40(%rbp), %rdi
callq 0x52e80
cmpl $0x0, -0x54(%rbp)
jne 0x12cdb
movq -0x28(%rbp), %rdi
callq 0x52e80
jmp 0x12cdd
movq -0x60(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)