// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/lerils.c
// Function: order_rulesets
Ruleset order_rulesets(Ruleset* sets, Instanceptr* instances)
{
 int i, j, *included, minexception, bestclass, exception, *counts;
 Ruleset result;
 Instanceptr covered = NULL;
 empty_ruleset(&result);
 included = (int *)safecalloc(current_dataset->classno, sizeof(int), "order_rulesets", 4);
 for (i = 0; i < current_dataset->classno; i++)
  {
   bestclass = -1;
   minexception = +INT_MAX;
   for (j = 0; j < current_dataset->classno; j++)
     if (!included[j])
      {
       exception = exception_count_of_ruleset(sets[j], *instances, j);
       if (exception < minexception)
        {
         minexception = exception;
         bestclass = j;
        }
      }
   remove_covered_by_ruleset(instances, &covered, sets[bestclass], 0);
   merge_ruleset(&result, sets[bestclass]);
   included[bestclass] = YES;
  }
 counts = find_class_counts(*instances);
 result.defaultclass = find_max_in_list(counts, current_dataset->classno);
 merge_instancelist(instances, covered);
 safe_free(counts);
 safe_free(included);
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x50(%rbp)
movq %rdi, %rax
movq %rax, -0x48(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq $0x0, -0x40(%rbp)
callq 0xade30
leaq 0xb61ae(%rip), %rax     # 0x105840
movq (%rax), %rax
movslq 0x10(%rax), %rdi
movl $0x4, %esi
leaq 0x96cb3(%rip), %rdx     # 0xe6358
movl $0x4, %ecx
callq 0x52f40
movq %rax, -0x20(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0xb617c(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0x4f7e9
movl $0xffffffff, -0x28(%rbp) # imm = 0xFFFFFFFF
movl $0x7fffffff, -0x24(%rbp) # imm = 0x7FFFFFFF
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
leaq 0xb6151(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0x4f762
movq -0x20(%rbp), %rax
movslq -0x18(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x4f755
movq -0x8(%rbp), %rcx
movslq -0x18(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x18(%rbp), %esi
movq 0x20(%rcx), %rdx
movq %rsp, %rax
movq %rdx, 0x20(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0xdb8d0
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x4f753
movl -0x2c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0x4f755
jmp 0x4f757
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x4f6e5
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rcx
movslq -0x28(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rcx
xorl %eax, %eax
movq 0x20(%rcx), %rdx
movq %rsp, %rax
movq %rdx, 0x20(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x40(%rbp), %rsi
xorl %edx, %edx
callq 0xdb410
movq -0x50(%rbp), %rdi
movq -0x8(%rbp), %rcx
movslq -0x28(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rcx
movq 0x20(%rcx), %rdx
movq %rsp, %rax
movq %rdx, 0x20(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0xadef0
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x4f6ba
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x183a0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0xb603c(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x10(%rax), %esi
callq 0x50070
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x44f40
movq -0x38(%rbp), %rdi
callq 0x52e80
movq -0x20(%rbp), %rdi
callq 0x52e80
movq -0x48(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)