// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xa0, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movslq 0x10(%rax), %rdi
movl $0x4, %esi
leaq 0x736a5(%rip), %rdx     # 0xe73d9
movl $0x5, %ecx
callq 0x52f40
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, -0x20(%rbp)
movslq 0x10(%rax), %rdi
movl $0x4, %esi
leaq 0x73680(%rip), %rdx     # 0xe73d9
movl $0x6, %ecx
callq 0x52f40
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x73e64
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x48(%rbp), %rdi
callq 0x43530
movl %eax, -0x34(%rbp)
movl $0x0, -0x3c(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x73e2f
movq -0x48(%rbp), %rdi
movq -0x50(%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 0x73e15
movl $0x1, -0x3c(%rbp)
movl -0x34(%rbp), %eax
movq -0x50(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x73e02
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x73e13
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x73e2f
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x50(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x73d9f
cmpl $0x0, -0x3c(%rbp)
jne 0x73e53
movl -0x34(%rbp), %eax
cmpl -0xc(%rbp), %eax
jne 0x73e48
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x73e51
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x73e53
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x73d6f
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movl $0x0, -0x38(%rbp)
movq -0x60(%rbp), %rcx
movl -0x38(%rbp), %eax
cmpl 0x10(%rcx), %eax
jge 0x73ec4
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x18(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %edi
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x73a60
addsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x73e75
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movl -0x2c(%rbp), %edi
movl -0x30(%rbp), %esi
callq 0x73a60
addsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x20(%rbp), %rdi
callq 0x52e80
movq -0x28(%rbp), %rdi
callq 0x52e80
movsd -0x58(%rbp), %xmm0
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)