// File: /workspace/github_c_makefile_star2_O2/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, %r12
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, %r14
movq %rdx, %rdi
callq 0x2c3cc
movl %eax, %r15d
movq %r12, %rdi
callq 0x2c3cc
movl %eax, %ebx
addl %r15d, %ebx
movq %r13, 0x50(%rsp)
movq %r13, %rdi
movl %ebp, %esi
callq 0x10827
movl %eax, %r15d
movq %r12, 0x58(%rsp)
movq %r12, %rdi
movl %ebp, %esi
callq 0x10827
addl %r15d, %eax
movq %r14, %rcx
movq (%rcx), %rcx
testq %rcx, %rcx
je 0x6f0a1
cmpl %ebp, (%rcx)
je 0x6f0a1
addq $0x30, %rcx
jmp 0x6f08f
xorl %edx, %edx
xorl %esi, %esi
testq %rcx, %rcx
je 0x6f0c6
movl 0x4(%rcx), %edi
movl 0x8(%rcx), %r8d
leal (%r8,%rdi), %r9d
subl %r9d, %ebx
addl %r9d, %esi
subl %edi, %eax
addl %r8d, %edx
movq 0x30(%rcx), %rcx
jmp 0x6f0a5
leaq 0x3c(%rsp), %rcx
movl %ebx, (%rcx)
leaq 0x40(%rsp), %rcx
movl %esi, (%rcx)
leaq 0x48(%rsp), %rbx
movl %eax, (%rbx)
leaq 0x4c(%rsp), %r15
movl %edx, (%r15)
movq 0x8(%r14), %r12
movb $0x1, %al
movl %eax, 0x44(%rsp)
testq %r12, %r12
je 0x6f18c
movq %r12, %r13
movq (%r14), %rax
cmpq %r12, %rax
je 0x6f10f
movq %rax, %r12
movq 0x30(%rax), %rax
cmpq %r13, %rax
jne 0x6f101
jmp 0x6f112
xorl %r12d, %r12d
cmpl %ebp, (%r13)
jne 0x6f0ed
movl 0x20(%r14), %r9d
movq %r13, %rdi
leaq 0x40(%rsp), %rsi
leaq 0x3c(%rsp), %rdx
movq %r15, %rcx
movq %rbx, %r8
movsd 0x60(%rsp), %xmm0
callq 0x8f5b6
testl %eax, %eax
je 0x6f0ed
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x721ae
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 0x71be8
movq %r13, %rdi
callq 0x34ff7
movl $0x0, 0x44(%rsp)
jmp 0x6f0ed
testb $0x1, 0x44(%rsp)
jne 0x6f240
andl $0x0, 0x4c(%rsp)
andl $0x0, 0x40(%rsp)
movq 0x50(%rsp), %r12
movq %r12, %rdi
callq 0x2c3cc
movl %eax, %ebx
movq 0x58(%rsp), %r15
movq %r15, %rdi
callq 0x2c3cc
addl %ebx, %eax
movl %eax, 0x3c(%rsp)
movq %r12, %rdi
movl %ebp, %esi
callq 0x10827
movl %eax, %ebx
movq %r15, %rdi
movl %ebp, %esi
callq 0x10827
addl %ebx, %eax
movl %eax, 0x48(%rsp)
movq (%r14), %r14
testq %r14, %r14
je 0x6f240
cmpl %ebp, (%r14)
je 0x6f1f2
addq $0x30, %r14
jmp 0x6f1df
movq %r14, %rdi
callq 0x71b80
leaq 0x40(%rsp), %rbx
leaq 0x3c(%rsp), %r15
leaq 0x4c(%rsp), %r12
leaq 0x48(%rsp), %r13
movq %r14, %rdi
movq 0x50(%rsp), %rsi
movq %rbx, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0x8f517
movq %r14, %rdi
movq 0x58(%rsp), %rsi
movq %rbx, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0x8f517
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq