// File: /workspace/github_c_makefile_star2_O3/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
movq %rdx, %rdi
callq 0x30309
movl %eax, %ebx
movq %r14, %rdi
callq 0x30309
movl %eax, %r12d
addl %ebx, %r12d
movq %r13, 0x50(%rsp)
movq %r13, %rdi
movl %ebp, %esi
callq 0x114f9
movl %eax, %ebx
movq %r14, 0x58(%rsp)
movq %r14, %rdi
movl %ebp, %esi
callq 0x114f9
addl %ebx, %eax
movq (%r15), %rdx
xorl %ecx, %ecx
testq %rdx, %rdx
je 0x794e8
cmpl %ebp, (%rdx)
je 0x794ec
movq 0x30(%rdx), %rdx
jmp 0x794d9
xorl %esi, %esi
jmp 0x7950f
xorl %esi, %esi
xorl %ecx, %ecx
movl 0x4(%rdx), %edi
movl 0x8(%rdx), %r8d
leal (%r8,%rdi), %r9d
subl %r9d, %r12d
addl %r9d, %esi
subl %edi, %eax
addl %r8d, %ecx
movq 0x30(%rdx), %rdx
testq %rdx, %rdx
jne 0x794f0
movl %r12d, 0x44(%rsp)
movl %esi, 0x48(%rsp)
movl %eax, 0x3c(%rsp)
movl %ecx, 0x40(%rsp)
movq 0x8(%r15), %r12
testq %r12, %r12
je 0x79690
movb $0x1, %al
leaq 0x40(%rsp), %rbx
leaq 0x3c(%rsp), %r14
movl %eax, 0x4c(%rsp)
movq %r12, %r13
movq (%r15), %rax
cmpq %r13, %rax
je 0x79556
movq %rax, %r12
movq 0x30(%rax), %rax
cmpq %r13, %rax
jne 0x79548
jmp 0x79559
xorl %r12d, %r12d
cmpl %ebp, (%r13)
jne 0x79585
movl 0x20(%r15), %r9d
movq %r13, %rdi
leaq 0x48(%rsp), %rsi
leaq 0x44(%rsp), %rdx
movq %rbx, %rcx
movq %r14, %r8
movsd 0x60(%rsp), %xmm0
callq 0x9e828
testl %eax, %eax
jne 0x7958f
movq %r12, %r13
testq %r12, %r12
jne 0x79540
jmp 0x795dd
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x7c89d
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 0x7c251
movq %r13, %rdi
callq 0x3a180
xorl %eax, %eax
testq %r12, %r12
jne 0x79539
jmp 0x795e8
testb $0x1, 0x4c(%rsp)
jne 0x79690
xorl %eax, %eax
movl %eax, 0x40(%rsp)
movl %eax, 0x48(%rsp)
movq 0x50(%rsp), %r12
movq %r12, %rdi
callq 0x30309
movl %eax, %ebx
movq 0x58(%rsp), %r14
movq %r14, %rdi
callq 0x30309
addl %ebx, %eax
movl %eax, 0x44(%rsp)
movq %r12, %rdi
movl %ebp, %esi
callq 0x114f9
movl %eax, %ebx
movq %r14, %rdi
movl %ebp, %esi
callq 0x114f9
addl %ebx, %eax
movl %eax, 0x3c(%rsp)
movq (%r15), %rbx
testq %rbx, %rbx
je 0x79690
cmpl %ebp, (%rbx)
je 0x79642
movq 0x30(%rbx), %rbx
jmp 0x79633
movq %rbx, %rdi
callq 0x7c1e0
leaq 0x48(%rsp), %r14
leaq 0x44(%rsp), %r15
leaq 0x40(%rsp), %r12
leaq 0x3c(%rsp), %r13
movq %rbx, %rdi
movq 0x50(%rsp), %rsi
movq %r14, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0x9e77d
movq %rbx, %rdi
movq 0x58(%rsp), %rsi
movq %r14, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0x9e77d
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq