// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/omnivariaterule.c
// Function: log_likelihood_of_ruleset
double log_likelihood_of_ruleset(Ruleset set, Instanceptr list, int positive, int* covered)
{
 /*!Last Changed 19.02.2005*/
 int *poscounts, *negcounts, posuncovered = 0, neguncovered = 0, classno, i, iscovered;
 Instanceptr tmp;
 Decisionruleptr rule;
 double result = 0;
 poscounts = safecalloc(set.rulecount, sizeof(int), "log_likelihood_of_ruleset", 5);
 negcounts = safecalloc(set.rulecount, sizeof(int), "log_likelihood_of_ruleset", 6);
 tmp = list;
 while (tmp)
  {
   rule = set.start;
   i = 0;
   classno = give_classno(tmp);
   iscovered = 0;
   while (rule)
    {
     if (rule_cover_instance(tmp, *rule))
      {
       iscovered = 1;
       if (classno == rule->classno)
         poscounts[i]++;
       else
         negcounts[i]++;
       break;
      }
     i++;
     rule = rule->next;
    }
   if (!iscovered)
    {
     if (classno == positive)
       posuncovered++;
     else
       neguncovered++;
    }
   tmp = tmp->next;
  }
 *covered = 0;
 for (i = 0; i < set.rulecount; i++)
  {
   *covered += poscounts[i];
   result += log_likelihood_for_rule_induction(poscounts[i], negcounts[i]);
  }
 *covered += posuncovered;
 result += log_likelihood_for_rule_induction(posuncovered, neguncovered);
 safe_free(poscounts);
 safe_free(negcounts);
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, 0x60(%rsp)
movl %esi, 0x38(%rsp)
movq %rdi, %r12
movl 0xb0(%rsp), %eax
movq %rax, 0x58(%rsp)
movslq %eax, %r15
leaq 0x5125e(%rip), %rbx     # 0x9a7fa
pushq $0x4
popq %r13
pushq $0x5
popq %rcx
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x35067
movq %rax, %r14
pushq $0x6
popq %rcx
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x35067
movq %rax, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
movq 0xa0(%rsp), %r15
movl $0x0, 0x44(%rsp)
testq %r12, %r12
je 0x49675
movq %r12, %rdi
callq 0x2b47e
movl %eax, %r13d
xorl %ebp, %ebp
movq %r15, %rbx
testq %rbx, %rbx
je 0x4963d
movq 0x30(%rbx), %rax
movq %rax, 0x30(%rsp)
movupd (%rbx), %xmm0
movupd 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm2, 0x20(%rsp)
movupd %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x71406
testl %eax, %eax
jne 0x4964a
movq 0x30(%rbx), %rbx
addq $0x4, %rbp
jmp 0x495fc
cmpl 0x38(%rsp), %r13d
jne 0x49655
incl 0x44(%rsp)
jmp 0x4966b
cmpl (%rbx), %r13d
jne 0x49663
incl (%r14,%rbp)
jmp 0x4966b
movq 0x48(%rsp), %rax
incl %eax
movq %rax, 0x48(%rsp)
jmp 0x4966b
movq 0x50(%rsp), %rax
incl (%rax,%rbp)
movq 0x10(%r12), %r12
jmp 0x495e3
movq 0x60(%rsp), %r15
andl $0x0, (%r15)
xorl %ebx, %ebx
movq 0x58(%rsp), %r12
testl %r12d, %r12d
cmovlel %ebx, %r12d
xorpd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
cmpq %rbx, %r12
je 0x496c8
movl (%r14,%rbx,4), %eax
addl %eax, (%r15)
movl (%r14,%rbx,4), %edi
movq 0x50(%rsp), %rax
movl (%rax,%rbx,4), %esi
callq 0x493b4
movsd 0x38(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x38(%rsp)
incq %rbx
jmp 0x49696
movl 0x44(%rsp), %edi
addl %edi, (%r15)
movq 0x48(%rsp), %rsi
callq 0x493b4
addsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movq %r14, %rdi
callq 0x34ff7
movq 0x50(%rsp), %rdi
callq 0x34ff7
movsd 0x38(%rsp), %xmm0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq