// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/univariaterule.c
// Function: prunerule
void prunerule(Decisionruleptr rule, Instanceptr pruneset, int positive, int reptype)
{
 /*!Last Changed 02.12.2004 added free_condition and safe_free*/
 /*!Last Changed 16.06.2003 added if (P == 0) return;*/
 /*!Last Changed 10.05.2003*/
 int P = 0, N = 0, p = 0, n = 0, improved = 1;
 double v, bestv;
 Instanceptr tmp;
 Decisionconditionptr best, bestbefore, tmpcondition, tmpbefore;
 tmp = pruneset;
 while (tmp)
  {
   if (give_classno(tmp) == positive)
    {
     P++;
     if (rule_cover_instance(tmp, *rule))
       p++;
    }
   else
    {
     N++;
     if (rule_cover_instance(tmp, *rule))
       n++;
    }
   tmp = tmp->next;
  }
 if (P == 0)
   return;
 bestv = rule_value_metric(n, p, N, P, reptype);
 while (improved)
  {
   improved = 0;
   tmpbefore = NULL;
   tmpcondition = rule->start;
   while (tmpcondition)
    {
     remove_condition_after(rule, tmpbefore, tmpcondition);
     calculate_performance_for_prune(pruneset, *rule, &p, &n, positive);
     v = rule_value_metric(n, p, N, P, reptype);
     if (dless(bestv, v) || dequal(bestv, v))
      {
       bestv = v;
       bestbefore = tmpbefore;
       best = tmpcondition;
       improved = 1;
      }
     add_condition_after(rule, tmpbefore, tmpcondition);
     tmpbefore = tmpcondition;
     tmpcondition = tmpcondition->next;
    }
   if (improved)
    {
     remove_condition_after(rule, bestbefore, best);
     free_condition(*best);
     safe_free(best);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x1, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0xdb26c
movq -0x48(%rbp), %rdi
callq 0x43530
cmpl -0x14(%rbp), %eax
jne 0xdb214
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x48(%rbp), %rdi
movq -0x8(%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 0xacfd0
cmpl $0x0, %eax
je 0xdb212
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xdb25b
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movq -0x48(%rbp), %rdi
movq -0x8(%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 0xacfd0
cmpl $0x0, %eax
je 0xdb259
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xdb25b
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0xdb1b4
cmpl $0x0, -0x1c(%rbp)
jne 0xdb277
jmp 0xdb3ff
movl -0x28(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x20(%rbp), %edx
movl -0x1c(%rbp), %ecx
movl -0x18(%rbp), %r8d
callq 0xdae80
movsd %xmm0, -0x40(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0xdb3ff
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0xdb398
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0xae6b0
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rdx
movl -0x14(%rbp), %ecx
movq 0x30(%rdx), %rsi
movq %rsp, %rax
movq %rsi, 0x30(%rax)
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movups 0x20(%rdx), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x24(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0xadab0
movl -0x28(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x20(%rbp), %edx
movl -0x1c(%rbp), %ecx
movl -0x18(%rbp), %r8d
callq 0xdae80
movsd %xmm0, -0x38(%rbp)
movsd -0x40(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
callq 0x52750
cmpl $0x0, %eax
jne 0xdb34d
movsd -0x40(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
callq 0x526b0
cmpl $0x0, %eax
je 0xdb36e
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x1, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0xae5c0
movq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0xdb2b6
cmpl $0x0, -0x2c(%rbp)
je 0xdb3fa
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0xae6b0
movq -0x50(%rbp), %rcx
movups 0x60(%rcx), %xmm0
movq %rsp, %rax
movups %xmm0, 0x60(%rax)
movups 0x50(%rcx), %xmm0
movups %xmm0, 0x50(%rax)
movups 0x40(%rcx), %xmm0
movups %xmm0, 0x40(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups 0x30(%rcx), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0xadc90
movq -0x50(%rbp), %rdi
callq 0x52e80
jmp 0xdb291
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax,%rax)