// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/rise.c
// Function: nearest_rule
Decisionruleptr nearest_rule(Model_riseptr m, Instanceptr instance, int leaveoneout)
{
 Decisionruleptr rule, nearest = NULL;
 double mindistance = +INT_MAX, distance, minlaplace = +INT_MAX, laplace;
 rule = m->rules.start;
 while (rule)
  {
   if (rule->covered + rule->falsepositives > 1 || !leaveoneout)
    {
     distance = distance_to_rule(m, instance, rule);
     if (distance < mindistance)
      {
       mindistance = distance;
       nearest = rule;
       minlaplace = laplace_estimate_of_rule_kclass(*rule);
      }
     else
       if (distance == mindistance)
        {
         laplace = laplace_estimate_of_rule_kclass(*rule);
         if (laplace < minlaplace)
          {
           minlaplace = laplace;
           nearest = rule;           
          }
         else
           if (laplace == minlaplace && m->counts[rule->classno] > m->counts[nearest->classno])
             nearest = rule;
        }
    }
   rule = rule->next;
  }
 return nearest;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq $0x0, -0x28(%rbp)
movsd 0x3734a(%rip), %xmm0    # 0xe2010
movsd %xmm0, -0x30(%rbp)
movsd 0x3733d(%rip), %xmm0    # 0xe2010
movsd %xmm0, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xaae35
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x20(%rbp), %rcx
addl 0x8(%rcx), %eax
cmpl $0x1, %eax
jg 0xaad0b
cmpl $0x0, -0x14(%rbp)
jne 0xaae24
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xaa970
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xaad77
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%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 0xaee70
movsd %xmm0, -0x40(%rbp)
jmp 0xaae22
movsd -0x38(%rbp), %xmm0
ucomisd -0x30(%rbp), %xmm0
jne 0xaae20
jp 0xaae20
movq -0x20(%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 0xaee70
movsd %xmm0, -0x48(%rbp)
movsd -0x48(%rbp), %xmm1
movsd -0x40(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xaade0
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xaae1e
movsd -0x48(%rbp), %xmm0
ucomisd -0x40(%rbp), %xmm0
jne 0xaae1c
jp 0xaae1c
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %eax
movq -0x8(%rbp), %rcx
movq 0x30(%rcx), %rcx
movq -0x28(%rbp), %rdx
movslq (%rdx), %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0xaae1c
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xaae1e
jmp 0xaae20
jmp 0xaae22
jmp 0xaae24
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0xaace3
movq -0x28(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)