// File: /workspace/github_c_makefile_star2_O3/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 0xbb64
movsd 0x9a373(%rip), %xmm0    # 0xa5de0
movsd %xmm0, 0x60(%rsp)
movb $0x1, %bpl
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 0x7b9ee
testl %eax, %eax
jne 0xbab6
movq 0x30(%r13), %r13
testq %r13, %r13
jne 0xba76
jmp 0xbb5a
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 0x7cc0e
movsd 0x60(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xbafc
movl (%r13), %eax
movl %eax, 0x8(%rbx)
movsd %xmm0, 0x60(%rsp)
movq %r13, %rdi
callq 0x7cc5f
testq %rax, %rax
je 0xbc34
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 0x7b9ee
testl %eax, %eax
jne 0xbab6
movq 0x30(%r13), %r13
xorl %ebp, %ebp
testq %r13, %r13
jne 0xba76
jmp 0xbc34
testb $0x1, %bpl
je 0xbc34
movl $0x1, 0x20(%r15)
movq 0x28(%r12), %rdi
movl 0x40(%r14), %edx
leaq 0x3a64e4(%rip), %rax    # 0x3b2060
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x50(%rsp)
movups %xmm1, 0x40(%rsp)
movups %xmm0, 0x30(%rsp)
leaq 0x3a6493(%rip), %rax    # 0x3b2030
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 0x31649
movq %rax, %r15
leaq 0xc9ca8(%rip), %r13     # 0xd5870
movq (%r13), %rax
movslq 0x10(%rax), %rdi
leaq 0x9a3e0(%rip), %rdx     # 0xa5fb7
movl $0x4, %esi
movl $0x28, %ecx
callq 0x3a1fc
movq %rax, %r12
cmpl $0x0, 0x40(%r14)
jle 0xbc12
xorl %ebp, %ebp
movq (%r15,%rbp,8), %rdi
testq %rdi, %rdi
je 0xbc12
callq 0x2f33a
cltq
incl (%r12,%rax,4)
incq %rbp
movslq 0x40(%r14), %rax
cmpq %rax, %rbp
jl 0xbbf2
movq (%r13), %rax
movl 0x10(%rax), %esi
movq %r12, %rdi
callq 0x38002
movl %eax, 0x8(%rbx)
movq %r12, %rdi
callq 0x3a180
movq %r15, %rdi
callq 0x3a180
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq