// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/classification.c
// Function: test_irep
Prediction test_irep(Instanceptr data, void* model, void* parameters, double* posterior)
{
 /*!Last Changed 10.11.2003 Rulecount, decisioncount and mdl added*/
 /*!Last Changed 21.05.2003 free_ruleset function is added*/
 /*!Last Changed 13.05.2003*/
 int bestclass, rulesordered;
 BOOLEAN covered = BOOLEAN_FALSE;
 double besterror = 1.5, error; 
 Ruleset* r;
 Decisionruleptr tmp, bestrule = NULL;
 Prediction predicted;
 r = (Ruleset*) model;
 tmp = r->start;
 rulesordered = ((Ripper_parameterptr) parameters)->rulesordered;
 while (tmp)
  {
   if (rule_cover_instance(data, *tmp))
    {
     covered = BOOLEAN_TRUE;
     if (rulesordered)
      {
       if (get_parameter_o("laplaceestimate") == ON)
         normalize_array_laplace(tmp->counts, posterior, current_dataset->classno);
       else
         normalize_array(tmp->counts, posterior, current_dataset->classno);
       predicted.classno = tmp->classno;
       return predicted;
      }
     else
      {
       error = laplace_estimate_of_rule(*tmp);
       if (error < besterror)
        {
         besterror = error;
         bestclass = tmp->classno;
         bestrule = tmp;
        }
       tmp = get_next_class_rule(tmp);
       if (tmp)
         continue;
       else
         break;
      }
    }
   tmp = tmp->next;
  }
 if (!covered)
  {
   if (get_parameter_o("laplaceestimate") == ON)
     normalize_array_laplace(r->counts, posterior, current_dataset->classno);
			else
     normalize_array(r->counts, posterior, current_dataset->classno);
   predicted.classno = r->defaultclass;
   return predicted;
  }
 else
   if (!rulesordered)
    {
  			if (get_parameter_o("laplaceestimate") == ON)
       normalize_array_laplace(bestrule->counts, posterior, current_dataset->classno);
			  else
       normalize_array(bestrule->counts, posterior, current_dataset->classno);
     predicted.classno = bestclass;
     return predicted;
    }
   else
    {
  			if (get_parameter_o("laplaceestimate") == ON)
       normalize_array_laplace(r->counts, posterior, current_dataset->classno);
			  else
       normalize_array(r->counts, posterior, current_dataset->classno);
     predicted.classno = r->defaultclass;
     return predicted;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r13
movl 0xc(%rcx), %r14d
movq %rdx, 0x58(%rsp)
movq (%rdx), %r15
testq %r15, %r15
movq %r8, 0x40(%rsp)
je 0xad24
movq %rsi, %r12
movq $0x0, 0x50(%rsp)
movq %r13, 0x48(%rsp)
movsd 0x981bb(%rip), %xmm0    # 0xa2de0
movsd %xmm0, 0x60(%rsp)
xorl %ebx, %ebx
movq 0x30(%r15), %rax
movq %rax, 0x30(%rsp)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r12, %rdi
callq 0x7a0fc
movq %r15, %r13
testl %eax, %eax
je 0xad0a
testl %r14d, %r14d
jne 0xad2a
movq 0x30(%r13), %rax
movq %rax, 0x30(%rsp)
movupd (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups 0x20(%r13), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
callq 0x7b33f
movsd 0x60(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xacb4
movl (%r13), %ebp
movsd %xmm0, 0x60(%rsp)
movq %r13, %rbx
movq %r13, %rdi
callq 0x7b390
testq %rax, %rax
je 0xad58
movq %rax, %r13
movq 0x30(%rax), %rax
movq %rax, 0x30(%rsp)
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups 0x20(%r13), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r12, %rdi
callq 0x7a0fc
testl %eax, %eax
jne 0xac65
movl $0x1, %eax
movq %rax, 0x50(%rsp)
jmp 0xad0d
movq %r15, %r13
movq 0x30(%r13), %r15
testq %r15, %r15
jne 0xac2d
cmpl $0x0, 0x50(%rsp)
sete %al
jmp 0xad5a
movb $0x1, %al
xorl %ebx, %ebx
jmp 0xad5f
leaq 0x9818a(%rip), %rdi     # 0xa2ebb
callq 0x536e7
movq 0x10(%r15), %rdi
leaq 0xc7b2f(%rip), %rcx     # 0xd2870
movq (%rcx), %rcx
movl 0x10(%rcx), %edx
cmpl $0x1, %eax
jne 0xadc7
movq 0x40(%rsp), %rsi
callq 0x37a9c
jmp 0xadd1
xorl %eax, %eax
movq 0x48(%rsp), %r13
leaq 0x98155(%rip), %rdi     # 0xa2ebb
testb %al, %al
je 0xad87
callq 0x536e7
movq 0x58(%rsp), %rbx
movq 0x18(%rbx), %rdi
leaq 0xc7af1(%rip), %rcx     # 0xd2870
movq (%rcx), %rcx
movl 0x10(%rcx), %edx
jmp 0xada7
callq 0x536e7
leaq 0xc7add(%rip), %rcx     # 0xd2870
movq (%rcx), %rcx
movl 0x10(%rcx), %edx
testl %r14d, %r14d
je 0xadef
movq 0x58(%rsp), %rbx
movq 0x18(%rbx), %rdi
cmpl $0x1, %eax
jne 0xadb8
movq 0x40(%rsp), %rsi
callq 0x37a9c
jmp 0xadc2
movq 0x40(%rsp), %rsi
callq 0x37a34
movl 0x14(%rbx), %ebp
jmp 0xadd9
movq 0x40(%rsp), %rsi
callq 0x37a34
movq 0x48(%rsp), %r13
movl (%r15), %ebp
movl %ebp, 0x8(%r13)
movq %r13, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rbx), %rdi
cmpl $0x1, %eax
jne 0xae04
movq 0x40(%rsp), %rsi
callq 0x37a9c
jmp 0xadd9
movq 0x40(%rsp), %rsi
callq 0x37a34
jmp 0xadd9