// File: /workspace/github_c_makefile_star2_O2/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 $0x78, %rsp
movq %rcx, %r15
movq %rdx, 0x68(%rsp)
movq %rsi, %r14
andq $0x0, 0x38(%rsp)
movq %rdi, %rbx
andq $0x0, 0x58(%rsp)
callq 0x71c9d
movq (%r14), %rdi
leaq 0x70(%rsp), %rsi
callq 0x10916
pushq $0xa
popq %rcx
cltd
idivl %ecx
testl %edx, %edx
je 0x4b083
movq (%r14), %rdi
callq 0x108c8
movq %rax, %r12
leaq 0x82a9b(%rip), %rax     # 0xcd870
movq (%rax), %rax
movl 0x10(%rax), %esi
leaq 0x74(%rsp), %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x3372d
movq %rax, %rbp
movq %r12, %rdi
callq 0x34ff7
movq %rbp, 0x50(%rsp)
movl (%rbp), %eax
movl %eax, 0x14(%rbx)
movl (%r13), %ecx
leaq 0x38(%rsp), %rbp
cmpl $0x2, %ecx
jl 0x4b06c
decq %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x60(%rsp)
movl (%rax,%rcx,4), %r13d
movq (%r14), %rdi
movl %r13d, %esi
callq 0x10855
testl %eax, %eax
je 0x4afaa
cmpl $0x0, 0x38(%r15)
movq %r14, %rdi
jne 0x4ae5c
movq %r14, %rdi
leaq 0x40(%rsp), %rsi
leaq 0x48(%rsp), %r12
movq %r12, %rdx
pushq $0x3
popq %rcx
callq 0x2cfe5
movq %r12, %rdi
movl %r13d, %esi
movq %r15, %rdx
callq 0x49fb2
movq %rax, %r12
cmpq $0x0, 0x18(%rax)
je 0x4ae99
movl 0x38(%r15), %edx
testl %edx, %edx
je 0x4ae86
movq (%r14), %rsi
movq %r12, %rdi
callq 0x4a105
jmp 0x4ae99
movq 0x40(%rsp), %rsi
movq %r12, %rdi
movl %r13d, %edx
pushq $0x2
popq %rcx
callq 0x90239
cmpl $0x0, 0x38(%r15)
je 0x4aeab
movq (%r14), %rsi
movq %r12, %rdi
pushq $0x1
popq %rdx
jmp 0x4aec5
movq 0x48(%rsp), %rsi
movq %r12, %rdi
pushq $0x1
popq %rdx
callq 0x722ae
movq 0x40(%rsp), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x722ae
cmpq $0x0, 0x18(%r12)
je 0x4af4e
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 0x7247e
ucomisd 0x4ae16(%rip), %xmm0    # 0x95d20
jae 0x4af4e
movq %rbx, %rdi
movq %r12, %rsi
callq 0x7228a
cmpl $0x0, 0x38(%r15)
jne 0x4af3b
movq (%r14), %rdi
movq 0x48(%rsp), %rsi
callq 0x2d2da
movq %rax, (%r14)
movq 0x40(%rsp), %rsi
movq %r14, %rdi
callq 0x2c6e4
movq %r14, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x90582
jmp 0x4ae24
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 0x71be8
movq %r12, %rdi
callq 0x34ff7
cmpl $0x0, 0x38(%r15)
jne 0x4afaa
movq (%r14), %rdi
movq 0x48(%rsp), %rsi
callq 0x2d2da
movq %rax, (%r14)
movq 0x40(%rsp), %rsi
movq %r14, %rdi
callq 0x2c6e4
xorl %r12d, %r12d
movq 0x38(%rsp), %rsi
cmpl 0x10(%r15), %r12d
jge 0x4b052
movq %r14, %rdi
callq 0x2c6e4
andq $0x0, 0x38(%rsp)
cmpl $0x0, 0x38(%r15)
je 0x4aff6
movq %rbx, %rdi
movl %r13d, %esi
movq %r14, %rdx
movq %r15, %rcx
callq 0x49a37
movq (%r14), %rdx
movl 0x38(%r15), %ecx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4a3f1
jmp 0x4b022
movq %rbx, %rdi
movl %r13d, %esi
movq %r14, %rdx
movq 0x68(%rsp), %rbp
movq %rbp, %rcx
movq %r15, %r8
callq 0x44c65
movq %rbx, %rdi
movl %r13d, %esi
movq %rbp, %rdx
leaq 0x38(%rsp), %rbp
callq 0x454d2
movq 0x20(%rbx), %rax
movq %rax, 0x20(%rsp)
movupd (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
movq %r14, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x90483
incl %r12d
jmp 0x4afad
leaq 0x58(%rsp), %rdi
callq 0x2c6e4
andq $0x0, 0x38(%rsp)
movq 0x60(%rsp), %rcx
jmp 0x4ae0a
movq 0x50(%rsp), %rdi
callq 0x34ff7
movq 0x58(%rsp), %rsi
movq %r14, %rdi
callq 0x2c6e4
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)