// File: /workspace/github_c_makefile_star2_O1/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 0x7aa63
movq (%r14), %rdi
leaq 0x80(%rsp), %rsi
callq 0x11633
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
addl $0x19999998, %eax       # imm = 0x19999998
rorl %eax
cmpl $0x19999999, %eax       # imm = 0x19999999
jb 0x51588
movq (%r14), %rdi
callq 0x115e1
movq %rax, %r12
leaq 0x815f0(%rip), %rax     # 0xd2870
movq (%rax), %rax
movl 0x10(%rax), %esi
leaq 0x84(%rsp), %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x3758b
movq %rax, %rbp
movq %r12, %rdi
callq 0x39194
movq %rbp, 0x60(%rsp)
movl (%rbp), %eax
movq %rbx, 0x40(%rsp)
movl %eax, 0x14(%rbx)
movslq (%r13), %r12
cmpq $0x2, %r12
jl 0x5156c
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 0x11569
testl %eax, %eax
je 0x51477
cmpl $0x0, 0x38(%r15)
movq %r14, %rdi
jne 0x51314
movq %r14, %rdi
movq %r13, %rsi
leaq 0x58(%rsp), %r12
movq %r12, %rdx
movl $0x3, %ecx
callq 0x30746
movq %r12, %rdi
movl 0x3c(%rsp), %esi
movq %r15, %rdx
callq 0x50397
movq %rax, %r12
cmpq $0x0, 0x18(%rax)
je 0x51355
movl 0x38(%r15), %edx
testl %edx, %edx
je 0x5133f
movq (%r14), %rsi
movq %r12, %rdi
callq 0x504f6
jmp 0x51355
movq 0x50(%rsp), %rsi
movq %r12, %rdi
movl 0x3c(%rsp), %edx
movl $0x2, %ecx
callq 0x9c4fc
cmpl $0x0, 0x38(%r15)
je 0x51369
movq (%r14), %rsi
movq %r12, %rdi
movl $0x1, %edx
jmp 0x51385
movq 0x58(%rsp), %rsi
movq %r12, %rdi
movl $0x1, %edx
callq 0x7b122
movq 0x50(%rsp), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x7b122
cmpq $0x0, 0x18(%r12)
je 0x5141b
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 0x7b300
ucomisd 0x5194a(%rip), %xmm0    # 0xa2d18
jae 0x5141b
movq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x7b0fb
cmpl $0x0, 0x38(%r15)
jne 0x51401
movq (%r14), %rdi
movq 0x58(%rsp), %rsi
callq 0x30ad5
movq %rax, (%r14)
movq 0x50(%rsp), %rsi
movq %r14, %rdi
callq 0x2fd59
movq %r14, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x9c951
movq (%r14), %rdi
movl 0x3c(%rsp), %esi
jmp 0x512e2
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 0x7a989
movq %r12, %rdi
callq 0x39194
cmpl $0x0, 0x38(%r15)
jne 0x51477
movq (%r14), %rdi
movq 0x58(%rsp), %rsi
callq 0x30ad5
movq %rax, (%r14)
movq 0x50(%rsp), %rsi
movq %r14, %rdi
callq 0x2fd59
cmpl $0x0, 0x10(%r15)
movq 0x40(%rsp), %r13
jle 0x5153c
xorl %r12d, %r12d
movq 0x48(%rsp), %rsi
movq %r14, %rdi
callq 0x2fd59
movq $0x0, 0x48(%rsp)
cmpl $0x0, 0x38(%r15)
je 0x514ce
movq %r13, %rdi
movl 0x3c(%rsp), %ebx
movl %ebx, %esi
movq %r14, %rdx
movq %r15, %rcx
callq 0x4fded
movq (%r14), %rdx
movl 0x38(%r15), %ecx
movq %r13, %rdi
movl %ebx, %esi
callq 0x507e1
jmp 0x51504
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 0x4a943
movq 0x40(%rsp), %rdi
movl %ebx, %esi
movq %rbp, %rdx
movq %r13, %rbp
movq 0x40(%rsp), %r13
callq 0x4b1ea
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 0x9c7df
incl %r12d
cmpl 0x10(%r15), %r12d
jl 0x5148a
movq 0x70(%rsp), %r13
leaq -0x1(%r13), %r12
movq 0x48(%rsp), %rsi
leaq 0x68(%rsp), %rdi
callq 0x2fd59
movq $0x0, 0x48(%rsp)
cmpq $0x2, %r13
leaq 0x50(%rsp), %r13
jg 0x512cc
movq 0x60(%rsp), %rdi
callq 0x39194
movq 0x68(%rsp), %rsi
movq %r14, %rdi
callq 0x2fd59
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)