// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/omnivariaterule.c
// Function: generalization_error_of_ruleset_with_deleted_rules
double generalization_error_of_ruleset_with_deleted_rules(Ruleset set, Instanceptr data, int* deleted, int positive, int modelselectionmethod)
{
 /*!Last Changed 20.02.2005*/
 Instanceptr test = data;
 Decisionruleptr tmp;
 int complexity = 0, i, *poscounts, *negcounts, posuncovered = 0, neguncovered = 0, classno, iscovered, covered;
 double loglikelihood, result;
 tmp = set.start;
 i = 0;
 while (tmp)
  {
   if ((!deleted[i]) && tmp->classno == positive)
     complexity += complexity_of_rule(tmp);
   tmp = tmp->next;
   i++;
  }
 poscounts = safecalloc(i, sizeof(int), "generalization_error_of_ruleset_with_deleted_rules", 14); 
 negcounts = safecalloc(i, sizeof(int), "generalization_error_of_ruleset_with_deleted_rules", 15); 
 while (test)
  {
   classno = give_classno(test);
   tmp = set.start;
   i = 0;
   iscovered = 0;
   while (tmp)
    {
     if (!(deleted[i]) && rule_cover_instance(test, *tmp))
      {
       iscovered = 1;
       if (tmp->classno == classno)
         poscounts[i]++;
       else
         negcounts[i]++;
       break;
      }
     i++;
     tmp = tmp->next;
    }
   if (!iscovered)
    {
     if (classno == positive)
       posuncovered++;
     else
       neguncovered++;
    }
   test = test->next;
  }
 loglikelihood = 0;
 covered = 0;
 for (i = 0; i < set.rulecount; i++)
   if (!(deleted[i]))
    {
     covered += poscounts[i];
     loglikelihood += log_likelihood_for_rule_induction(poscounts[i], negcounts[i]);
    }
 loglikelihood += log_likelihood_for_rule_induction(posuncovered, neguncovered);
 covered += posuncovered;
 switch (modelselectionmethod)
  {
   case MODEL_SELECTION_AIC:result = aic_loglikelihood(loglikelihood, complexity);
                            break;
   case MODEL_SELECTION_BIC:result = bic_loglikelihood(loglikelihood, complexity, covered);
                            break;
  }
 safe_free(poscounts);
 safe_free(negcounts);
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x8(%rbp), %rcx
movq %rcx, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x30(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x73fa2
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x73f8b
movq -0x28(%rbp), %rax
movl (%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x73f8b
movq -0x28(%rbp), %rdi
callq 0xabab0
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x73f5c
movslq -0x30(%rbp), %rdi
movl $0x4, %esi
leaq 0x73441(%rip), %rdx     # 0xe73f3
movl $0xe, %ecx
callq 0x52f40
movq %rax, -0x38(%rbp)
movslq -0x30(%rbp), %rdi
movl $0x4, %esi
leaq 0x73423(%rip), %rdx     # 0xe73f3
movl $0xf, %ecx
callq 0x52f40
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x740e3
movq -0x20(%rbp), %rdi
callq 0x43530
movl %eax, %ecx
movq -0x70(%rbp), %rax
movl %ecx, -0x4c(%rbp)
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x50(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x740ae
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x74094
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rcx
movq 0x30(%rcx), %rdx
movq %rsp, %rax
movq %rdx, 0x30(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0xacfd0
cmpl $0x0, %eax
je 0x74094
movl $0x1, -0x50(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
cmpl -0x4c(%rbp), %eax
jne 0x74081
movq -0x38(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x74092
movq -0x40(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x740ae
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x74010
cmpl $0x0, -0x50(%rbp)
jne 0x740d2
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x740c7
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x740d0
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x740d2
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x73fde
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
movl $0x0, -0x54(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x70(%rbp), %rcx
movl -0x30(%rbp), %eax
cmpl 0x10(%rcx), %eax
jge 0x74156
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x74149
movq -0x38(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x38(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edi
movq -0x40(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x73a60
addsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
jmp 0x7414b
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x740f9
movl -0x44(%rbp), %edi
movl -0x48(%rbp), %esi
callq 0x73a60
movaps %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movl -0x44(%rbp), %ecx
movl -0x54(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x54(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x74(%rbp)
subl $0x1, %eax
je 0x74194
jmp 0x7418a
movl -0x74(%rbp), %eax
subl $0x2, %eax
je 0x741aa
jmp 0x741c1
movsd -0x60(%rbp), %xmm0
cvtsi2sdl -0x2c(%rbp), %xmm1
callq 0x66430
movsd %xmm0, -0x68(%rbp)
jmp 0x741c1
movsd -0x60(%rbp), %xmm0
cvtsi2sdl -0x2c(%rbp), %xmm1
movl -0x54(%rbp), %edi
callq 0x669d0
movsd %xmm0, -0x68(%rbp)
movq -0x38(%rbp), %rdi
callq 0x52e80
movq -0x40(%rbp), %rdi
callq 0x52e80
movsd -0x68(%rbp), %xmm0
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)