// File: /workspace/github_c_makefile_star2_O1/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 $0x68, %rsp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdx), %r13
movl $0xffffffff, 0x8(%rdi)  # imm = 0xFFFFFFFF
testq %r13, %r13
je 0xbaf4
movsd 0x973d4(%rip), %xmm0    # 0xa2de0
movsd %xmm0, 0x60(%rsp)
xorl %ebp, %ebp
movq 0x30(%r13), %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 %r15, %rdi
callq 0x7a0fc
testl %eax, %eax
je 0xbadf
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 0xba90
movl (%r13), %eax
movl %eax, 0x8(%rbx)
movsd %xmm0, 0x60(%rsp)
movq %r13, %rdi
callq 0x7b390
testq %rax, %rax
je 0xbbc4
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 %r15, %rdi
callq 0x7a0fc
testl %eax, %eax
jne 0xba4a
movl $0x1, %ebp
movq 0x30(%r13), %r13
testq %r13, %r13
jne 0xba14
testl %ebp, %ebp
jne 0xbbc4
movl $0x1, 0x20(%r15)
movq 0x28(%r12), %rdi
movl 0x40(%r14), %edx
leaq 0x3a3554(%rip), %rax    # 0x3af060
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x50(%rsp)
movups %xmm1, 0x40(%rsp)
movups %xmm0, 0x30(%rsp)
leaq 0x3a3503(%rip), %rax    # 0x3af030
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r15, %rsi
callq 0x30dd6
movq %rax, %r15
leaq 0xc6d18(%rip), %r13     # 0xd2870
movq (%r13), %rax
movslq 0x10(%rax), %rdi
leaq 0x97450(%rip), %rdx     # 0xa2fb7
movl $0x4, %esi
movl $0x28, %ecx
callq 0x39210
movq %rax, %r12
cmpl $0x0, 0x40(%r14)
jle 0xbba2
xorl %ebp, %ebp
movq (%r15,%rbp,8), %rdi
testq %rdi, %rdi
je 0xbba2
callq 0x2eaca
cltq
incl (%r12,%rax,4)
incq %rbp
movslq 0x40(%r14), %rax
cmpq %rax, %rbp
jl 0xbb82
movq (%r13), %rax
movl 0x10(%rax), %esi
movq %r12, %rdi
callq 0x37504
movl %eax, 0x8(%rbx)
movq %r12, %rdi
callq 0x39194
movq %r15, %rdi
callq 0x39194
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq