// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/rise.c
// Function: update_nearest_rule
void update_nearest_rule(Model_riseptr m, Decisionruleptr* nearestrule, Instanceptr instances, int operation, Decisionruleptr rule)
{
 int i = 0;
 Instanceptr tmp;
 tmp = instances;
 while (tmp)
  {
   if (operation == 0 && nearestrule[i] == rule)
     nearestrule[i] = nearest_rule(m, tmp, YES);
   else
     if (operation == 1 && rule->falsepositives + rule->covered > 1)
      {
       if (!nearestrule[i])
         nearestrule[i] = rule;
       else
        {
         if (distance_to_rule(m, tmp, rule) < distance_to_rule(m, tmp, nearestrule[i]))
           nearestrule[i] = rule;
         else 
           if (distance_to_rule(m, tmp, rule) == distance_to_rule(m, tmp, nearestrule[i]))
            {
             if (laplace_estimate_of_rule_kclass(*rule) < laplace_estimate_of_rule_kclass(*(nearestrule[i])))
               nearestrule[i] = rule;
             else
               if (laplace_estimate_of_rule_kclass(*rule) == laplace_estimate_of_rule_kclass(*(nearestrule[i])))
                {
                 if (m->counts[rule->classno] > m->counts[nearestrule[i]->classno])
                   nearestrule[i] = rule;
                }
            }
        }
      }
   i++;
   tmp = tmp->next;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %rbx
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
pushq $0x1
popq %r13
testq %r14, %r14
je 0x7021a
cmpl $0x1, %ebp
je 0x700ab
testl %ebp, %ebp
jne 0x7020d
cmpq %rbx, (%r15)
jne 0x7020d
movq %r12, %rdi
movq %r14, %rsi
movl %r13d, %edx
callq 0x6fc90
movq %rax, (%r15)
jmp 0x7020d
movl 0x4(%rbx), %eax
addl 0x8(%rbx), %eax
cmpl $0x2, %eax
jl 0x7020d
cmpq $0x0, (%r15)
je 0x7020a
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x6fb43
movsd %xmm0, 0x40(%rsp)
movq (%r15), %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x6fb43
ucomisd 0x40(%rsp), %xmm0
ja 0x7020a
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x6fb43
movsd %xmm0, 0x40(%rsp)
movq (%r15), %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x6fb43
movsd 0x40(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x7020d
jp 0x7020d
movq 0x30(%rbx), %rax
movq %rax, 0x30(%rsp)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x724e4
movsd %xmm0, 0x40(%rsp)
movq (%r15), %rax
movq 0x30(%rax), %rcx
movq %rcx, 0x30(%rsp)
movupd (%rax), %xmm0
movupd 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rsp)
movupd %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
callq 0x724e4
ucomisd 0x40(%rsp), %xmm0
ja 0x7020a
movq 0x30(%rbx), %rax
movq %rax, 0x30(%rsp)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x724e4
movsd %xmm0, 0x40(%rsp)
movq (%r15), %rax
movq 0x30(%rax), %rcx
movq %rcx, 0x30(%rsp)
movupd (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
callq 0x724e4
movsd 0x40(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x7020d
jp 0x7020d
movq 0x30(%r12), %rax
movslq (%rbx), %rcx
movl (%rax,%rcx,4), %ecx
movq (%r15), %rdx
movslq (%rdx), %rdx
cmpl (%rax,%rdx,4), %ecx
jle 0x7020d
movq %rbx, (%r15)
movq 0x10(%r14), %r14
addq $0x8, %r15
jmp 0x70076
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq