// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/ripper.c
// Function: simplify_ruleset
void simplify_ruleset(Ruleset* r, int positive, Instanceptr list1, Instanceptr list2, double proportion)
{
 /*!Last Changed 04.12.2003 Rewritten*/
 /*!Last Changed 31.05.2003 Delete rules starting from the last rule until the first rule*/
 /*!Last Changed 19.05.2003 If deleted is the first rule error occurs*/
 /*!Last Changed 18.05.2003*/
 int covered = 0, uncovered, fp = 0, fn, needrecount = 0;
 Decisionruleptr deleted, deletedbefore, tmprule;
 uncovered = data_size(list1) + data_size(list2);
 fn = find_class_count(list1, positive) + find_class_count(list2, positive);
 tmprule = r->start;
 while (tmprule && tmprule->classno != positive)
   tmprule = tmprule->next;
 while (tmprule)
  {
   uncovered -= (tmprule->covered + tmprule->falsepositives);
   covered += (tmprule->covered + tmprule->falsepositives);
   fn -= tmprule->covered;
   fp += tmprule->falsepositives;
   tmprule = tmprule->next;
  }
 deleted = r->end;
 while (deleted)
  {
   tmprule = r->start;
   if (tmprule != deleted)
    {
     while (tmprule->next != deleted)
       tmprule = tmprule->next;
     deletedbefore = tmprule;
    }
   else
     deletedbefore = NULL;
   if (deleted->classno == positive)
     if (can_delete_rule(deleted, &covered, &uncovered, &fp, &fn, proportion, r->possibleconditioncount))
      {
       remove_rule_after(r, deletedbefore, deleted);
       free_rule(*deleted);
       safe_free(deleted);
       needrecount = 1;
      }
   deleted = deletedbefore;
  }
 if (needrecount)
  {
   fp = 0;
   covered = 0;
   uncovered = data_size(list1) + data_size(list2);
   fn = find_class_count(list1, positive) + find_class_count(list2, positive);
   tmprule = r->start;
   while (tmprule && tmprule->classno != positive)
     tmprule = tmprule->next;
   if (tmprule)
    {
     initialize_counts(tmprule);
     update_counts_rules(tmprule, list1, &covered, &uncovered, &fp, &fn);
     update_counts_rules(tmprule, list2, &covered, &uncovered, &fp, &fn);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movsd %xmm0, 0x60(%rsp)
movq %rcx, %r14
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, %r15
xorl %eax, %eax
movl %eax, 0x4c(%rsp)
movl %eax, 0x44(%rsp)
movq %rdx, %rdi
callq 0x2fa14
movl %eax, %ebx
movq %r14, %rdi
callq 0x2fa14
addl %ebx, %eax
movl %eax, 0x48(%rsp)
movq %r13, %rdi
movl %ebp, %esi
callq 0x11534
movl %eax, %ebx
movq %r14, %rdi
movl %ebp, %esi
callq 0x11534
addl %ebx, %eax
movl %eax, 0x40(%rsp)
movq (%r15), %rax
testq %rax, %rax
je 0x77b99
cmpl %ebp, (%rax)
je 0x77b99
movq 0x30(%rax), %rax
jmp 0x77b8a
movl 0x48(%rsp), %edi
movl 0x4c(%rsp), %esi
movl 0x40(%rsp), %edx
movl 0x44(%rsp), %ecx
testq %rax, %rax
je 0x77bcc
movl 0x4(%rax), %r8d
movl 0x8(%rax), %r9d
leal (%r9,%r8), %r10d
subl %r10d, %edi
addl %r10d, %esi
subl %r8d, %edx
addl %r9d, %ecx
movq 0x30(%rax), %rax
jmp 0x77ba9
movl %edi, 0x48(%rsp)
movl %esi, 0x4c(%rsp)
movl %edx, 0x40(%rsp)
movl %ecx, 0x44(%rsp)
movq 0x8(%r15), %r12
testq %r12, %r12
je 0x77d42
movq %r13, 0x50(%rsp)
movq %r14, 0x58(%rsp)
xorl %ebx, %ebx
leaq 0x40(%rsp), %r14
movq %r12, %r13
movq (%r15), %rax
cmpq %r12, %rax
je 0x77c13
movq %rax, %r12
movq 0x30(%rax), %rax
cmpq %r13, %rax
jne 0x77c05
jmp 0x77c16
xorl %r12d, %r12d
cmpl %ebp, (%r13)
jne 0x77c8a
movl 0x20(%r15), %r9d
movq %r13, %rdi
leaq 0x4c(%rsp), %rsi
leaq 0x48(%rsp), %rdx
leaq 0x44(%rsp), %rcx
movq %r14, %r8
movsd 0x60(%rsp), %xmm0
callq 0x9b7e7
testl %eax, %eax
je 0x77c8a
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x7afd2
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)
callq 0x7a989
movq %r13, %rdi
callq 0x39194
movl $0x1, %ebx
testq %r12, %r12
jne 0x77bfa
testl %ebx, %ebx
movq 0x58(%rsp), %r14
movq 0x50(%rsp), %r13
je 0x77d42
xorl %eax, %eax
movl %eax, 0x44(%rsp)
movl %eax, 0x4c(%rsp)
movq %r13, %rdi
callq 0x2fa14
movl %eax, %ebx
movq %r14, %rdi
callq 0x2fa14
addl %ebx, %eax
movl %eax, 0x48(%rsp)
movq %r13, %rdi
movl %ebp, %esi
callq 0x11534
movl %eax, %ebx
movq %r14, %rdi
movl %ebp, %esi
callq 0x11534
addl %ebx, %eax
movl %eax, 0x40(%rsp)
movq (%r15), %rbx
testq %rbx, %rbx
je 0x77d42
cmpl %ebp, (%rbx)
je 0x77cf5
movq 0x30(%rbx), %rbx
jmp 0x77ce6
movq %rbx, %rdi
callq 0x7a921
movq %r14, %rbp
leaq 0x4c(%rsp), %r14
leaq 0x48(%rsp), %r15
leaq 0x44(%rsp), %r12
movq %r13, %rsi
leaq 0x40(%rsp), %r13
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0x9b73c
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0x9b73c
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq