// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/omnivariaterule.c
// Function: hybrid_rule_learner
Ruleset hybrid_rule_learner(Instanceptr* instances, Instanceptr cvdata, Ripper_parameterptr param)
{
 /*!Last Changed 19.02.2005*/
 Ruleset result;
 int classno, *counts, *classes, posclass, classcount, i, j, maxcount;
 Instanceptr grow, prune, removed = NULL, totalremoved = NULL;
 Decisionruleptr newrule;
 empty_ruleset(&result);
 classno = all_in_one_class(*instances, &maxcount);
 if (!(classno % 10))
   return result;
 counts = find_class_counts(*instances);
 classes = find_max_occured(counts, current_dataset->classno, &classcount);
 safe_free(counts);
 result.defaultclass = classes[0];
 for (i = classcount - 1; i > 0; i--)
  {
   posclass = classes[i];
   while (class_exists_in_list(*instances, posclass))
    {
     if (param->modelselectionmethod == 0)
      {
       divide_instancelist(instances, &prune, &grow, 3);
       newrule = growrule_omnivariate(&grow, posclass, param);
      }
     else
       newrule = growrule_omnivariate(instances, posclass, param);
     if (newrule->start)
      {
       if (param->modelselectionmethod == 0)       
         prunerule(newrule, prune, posclass, 2);
       else
         prunerule_with_modelselection(newrule, *instances, param->modelselectionmethod);
      }
     if (param->modelselectionmethod == 0)
      {
       update_counts(newrule, grow, 1);
       update_counts(newrule, prune, 0);
      }
     else
       update_counts(newrule, *instances, 1);
     if (!(newrule->start) || (error_rate_of_rule(*newrule) >= 0.5))
      {
       free_rule(*newrule);
       safe_free(newrule);
       if (param->modelselectionmethod == 0)
        {
         *instances = restore_instancelist(*instances, grow);
         merge_instancelist(instances, prune);
        }
       break;
      }
     add_rule(&result, newrule);
     if (param->modelselectionmethod == 0)
      {
       *instances = restore_instancelist(*instances, grow);
       merge_instancelist(instances, prune);     
      }
     remove_covered(instances, &removed, newrule);
    }
   for (j = 0; j < param->optimizecount; j++)
    {
     merge_instancelist(instances, removed);
     removed = NULL;
     if (param->modelselectionmethod == 0)
      {
       optimize_ruleset_multivariate(&result, posclass, instances, cvdata, param);
       simplify_ruleset_multivariate(&result, posclass, cvdata);
      }
     else
      {
       optimize_ruleset_modelselection(&result, posclass, instances, param);
       simplify_ruleset_modelselection(&result, posclass, *instances, param->modelselectionmethod);
      }
     remove_covered_by_ruleset(instances, &removed, result, 0);
    }
   merge_instancelist(&totalremoved, removed);
   removed = NULL;
  }
 safe_free(classes);
 merge_instancelist(instances, totalremoved);
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, %r15
movq %rdx, 0x78(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
xorl %eax, %eax
movq %rax, 0x48(%rsp)
movq %rax, 0x68(%rsp)
callq 0x7c32b
movq (%r14), %rdi
leaq 0x80(%rsp), %rsi
callq 0x115f8
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
addl $0x19999998, %eax       # imm = 0x19999998
rorl %eax
cmpl $0x19999999, %eax       # imm = 0x19999999
jb 0x52a6c
movq (%r14), %rdi
callq 0x115a6
movq %rax, %r12
leaq 0x8310c(%rip), %rax     # 0xd5870
movq (%rax), %rax
movl 0x10(%rax), %esi
leaq 0x84(%rsp), %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x38089
movq %rax, %rbp
movq %r12, %rdi
callq 0x3a180
movq %rbp, 0x60(%rsp)
movl (%rbp), %eax
movq %rbx, 0x40(%rsp)
movl %eax, 0x14(%rbx)
movslq (%r13), %r12
cmpq $0x2, %r12
jl 0x52a50
leaq 0x48(%rsp), %rbp
leaq 0x50(%rsp), %r13
movq 0x60(%rsp), %rax
movq %r12, 0x70(%rsp)
movl -0x4(%rax,%r12,4), %esi
movq (%r14), %rdi
movl %esi, 0x3c(%rsp)
callq 0x1152e
testl %eax, %eax
je 0x5295b
cmpl $0x0, 0x38(%r15)
movq %r14, %rdi
jne 0x527f8
movq %r14, %rdi
movq %r13, %rsi
leaq 0x58(%rsp), %r12
movq %r12, %rdx
movl $0x3, %ecx
callq 0x31019
movq %r12, %rdi
movl 0x3c(%rsp), %esi
movq %r15, %rdx
callq 0x51829
movq %rax, %r12
cmpq $0x0, 0x18(%rax)
je 0x52839
movl 0x38(%r15), %edx
testl %edx, %edx
je 0x52823
movq (%r14), %rsi
movq %r12, %rdi
callq 0x51991
jmp 0x52839
movq 0x50(%rsp), %rsi
movq %r12, %rdi
movl 0x3c(%rsp), %edx
movl $0x2, %ecx
callq 0x9f536
cmpl $0x0, 0x38(%r15)
je 0x5284d
movq (%r14), %rsi
movq %r12, %rdi
movl $0x1, %edx
jmp 0x52869
movq 0x58(%rsp), %rsi
movq %r12, %rdi
movl $0x1, %edx
callq 0x7c9ed
movq 0x50(%rsp), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x7c9ed
cmpq $0x0, 0x18(%r12)
je 0x528ff
movq 0x30(%r12), %rax
movq %rax, 0x30(%rsp)
movupd (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
callq 0x7cbcf
ucomisd 0x53466(%rip), %xmm0    # 0xa5d18
jae 0x528ff
movq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x7c9c6
cmpl $0x0, 0x38(%r15)
jne 0x528e5
movq (%r14), %rdi
movq 0x58(%rsp), %rsi
callq 0x31345
movq %rax, (%r14)
movq 0x50(%rsp), %rsi
movq %r14, %rdi
callq 0x30648
movq %r14, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x9f94e
movq (%r14), %rdi
movl 0x3c(%rsp), %esi
jmp 0x527c6
movq 0x30(%r12), %rax
movq %rax, 0x30(%rsp)
movupd (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
callq 0x7c251
movq %r12, %rdi
callq 0x3a180
cmpl $0x0, 0x38(%r15)
jne 0x5295b
movq (%r14), %rdi
movq 0x58(%rsp), %rsi
callq 0x31345
movq %rax, (%r14)
movq 0x50(%rsp), %rsi
movq %r14, %rdi
callq 0x30648
cmpl $0x0, 0x10(%r15)
movq 0x40(%rsp), %r13
jle 0x52a20
xorl %r12d, %r12d
movq 0x48(%rsp), %rsi
movq %r14, %rdi
callq 0x30648
movq $0x0, 0x48(%rsp)
cmpl $0x0, 0x38(%r15)
je 0x529b2
movq %r13, %rdi
movl 0x3c(%rsp), %ebx
movl %ebx, %esi
movq %r14, %rdx
movq %r15, %rcx
callq 0x512e5
movq (%r14), %rdx
movl 0x38(%r15), %ecx
movq %r13, %rdi
movl %ebx, %esi
callq 0x51c8e
jmp 0x529e8
movq %r13, %rdi
movl 0x3c(%rsp), %ebx
movl %ebx, %esi
movq %r14, %rdx
movq %rbp, %r13
movq 0x78(%rsp), %rbp
movq %rbp, %rcx
movq %r15, %r8
callq 0x4bdbc
movq 0x40(%rsp), %rdi
movl %ebx, %esi
movq %rbp, %rdx
movq %r13, %rbp
movq 0x40(%rsp), %r13
callq 0x4c690
movq 0x20(%r13), %rax
movq %rax, 0x20(%rsp)
movupd (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
movq %r14, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x9f84f
incl %r12d
cmpl 0x10(%r15), %r12d
jl 0x5296e
movq 0x70(%rsp), %r13
leaq -0x1(%r13), %r12
movq 0x48(%rsp), %rsi
leaq 0x68(%rsp), %rdi
callq 0x30648
movq $0x0, 0x48(%rsp)
cmpq $0x2, %r13
leaq 0x50(%rsp), %r13
jg 0x527b0
movq 0x60(%rsp), %rdi
callq 0x3a180
movq 0x68(%rsp), %rsi
movq %r14, %rdi
callq 0x30648
movq 0x40(%rsp), %rbx
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)