// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/classification.c
// Function: test_rexripper
Prediction test_rexripper(Instanceptr data, void* model, void* parameters, double* posterior)
{
 /*!Last Changed 03.12.2004 added deallocate(exceptiondata)*/
 /*!Last Changed 08.05.2004*/
 Model_rexripperptr m;
 Ripper_parameterptr p;
 int covered = 0, j, *classcounts;
 double besterror = 1.5, error;
 Instanceptr *neighbors;
 Decisionruleptr tmp;
 Prediction predicted;
 m = (Model_rexripperptr) model;
 p = (Ripper_parameterptr) parameters;
 tmp = m->r.start;
 predicted.classno = -1;
 while (tmp)
  {
   if (rule_cover_instance(data, *tmp))
    {
     covered = 1;
     error = laplace_estimate_of_rule(*tmp);
     if (error < besterror)
      {
       besterror = error;
       predicted.classno = tmp->classno;
      }
     tmp = get_next_class_rule(tmp);
     if (tmp)
       continue;
     else
       break;
    }
   tmp = tmp->next;
  }
 if (!covered)
  {
   data->isexception = 1;
   neighbors = find_nearest_neighbors_before_normalize(m->exceptiondata, data, p->nearcount, testmean, testvariance);
   classcounts = safecalloc(current_dataset->classno, sizeof(int), "test_rexripper", 40);
   for (j = 0; j < p->nearcount; j++)
     if (neighbors[j])
       classcounts[give_classno(neighbors[j])]++;
     else
       break;
   predicted.classno = find_max_in_list(classcounts, current_dataset->classno);
   safe_free(classcounts);
   safe_free(neighbors);
  }
 return predicted;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, 0x70(%rsp)
movq %rdx, %r12
movq %rdi, %rbx
movq (%rdx), %r13
orl $-0x1, 0x8(%rdi)
movq %rsi, %r15
xorl %ebp, %ebp
movsd 0x8a97c(%rip), %xmm0    # 0x95de8
movsd %xmm0, 0x68(%rsp)
pushq $0x1
popq %r14
testq %r13, %r13
je 0xb520
movq 0x30(%r13), %rax
movq %rax, 0x30(%rsp)
movupd (%r13), %xmm0
movupd 0x10(%r13), %xmm1
movups 0x20(%r13), %xmm2
movups %xmm2, 0x20(%rsp)
movupd %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
movq %r15, %rdi
callq 0x71406
testl %eax, %eax
je 0xb517
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 0x724bd
movsd 0x68(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xb4fb
movl (%r13), %eax
movl %eax, 0x8(%rbx)
movsd %xmm0, 0x68(%rsp)
movq %r13, %rdi
callq 0x7250e
movq %rax, %r13
movl %r14d, %ebp
testq %rax, %rax
jne 0xb47f
jmp 0xb5f6
movq 0x30(%r13), %r13
jmp 0xb476
testl %ebp, %ebp
jne 0xb5f6
movl $0x1, 0x20(%r15)
movq 0x28(%r12), %rdi
movq 0x70(%rsp), %rbp
movl 0x40(%rbp), %edx
leaq 0x39eb1c(%rip), %rax    # 0x3aa060
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x50(%rsp)
movups %xmm1, 0x40(%rsp)
movups %xmm0, 0x30(%rsp)
leaq 0x39eacb(%rip), %rax    # 0x3aa030
movupd (%rax), %xmm0
movupd 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rsp)
movupd %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
movq %r15, %rsi
callq 0x2d585
movq %rax, %r15
leaq 0xc22dc(%rip), %r14     # 0xcd870
movq (%r14), %rax
movslq 0x10(%rax), %rdi
leaq 0x8aa1d(%rip), %rdx     # 0x95fbf
pushq $0x4
popq %rsi
pushq $0x28
popq %rcx
callq 0x35067
movq %rax, %r12
xorl %r13d, %r13d
movslq 0x40(%rbp), %rax
cmpq %rax, %r13
jge 0xb5d5
movq (%r15,%r13,8), %rdi
testq %rdi, %rdi
je 0xb5d5
callq 0x2b47e
cltq
incl (%r12,%rax,4)
incq %r13
jmp 0xb5b3
movq (%r14), %rax
movl 0x10(%rax), %esi
movq %r12, %rdi
callq 0x336b5
movl %eax, 0x8(%rbx)
movq %r12, %rdi
callq 0x34ff7
movq %r15, %rdi
callq 0x34ff7
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq