// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/dataset.c
// Function: feature_efficiency
double feature_efficiency(Datasetptr d, double *overlap)
{
 /* multiclass is handled by one vs one */
 Instanceptr traindata;
 int i, j, k, ccount=0;
 double result = 0, maxefficiency, min1, max1, min2, max2;
 double efficiency, binoverlap;
 read_from_train_file(d, &traindata);
 realize(traindata);
 exchange_classdefno(d);
 maxefficiency = 0;
 *overlap = 1;
 for (i = 0; i < d->multifeaturecount; i++)
  {
   if (i != d->classdefno)
    {
     binoverlap = 0;
     efficiency = 0;
     for (j = 0; j < d->classno; j++)
      {
       for (k = j + 1; k < d->classno; k++)
        {
         find_bounds_of_feature_class(traindata, i, j, &min1, &max1);
         find_bounds_of_feature_class(traindata, i, k, &min2, &max2);
         ccount = 0;
         if (max1 > max2)
           ccount += find_thresholded_class_count(traindata, j, i, max2, UPPER);
         else
           ccount += find_thresholded_class_count(traindata, k, i, max1, UPPER);     
         if (min1 > min2)
           ccount += find_thresholded_class_count(traindata, k, i, min1, LOWER);
         else
           ccount += find_thresholded_class_count(traindata, j, i, min2, LOWER);     
         binoverlap += (fmin(max1, max2) - fmax(min1, min2)) / (fmax(max1, max2) + fmin(min1, min2));
         efficiency += ((double) ccount / (d->classcounts[j] + d->classcounts[k]));     
        }
      }
     *overlap *= (binoverlap / (d->classno * (d->classno - 1) / 2));
     if (efficiency > maxefficiency)
       maxefficiency = efficiency;
    }
  }
 result = (maxefficiency / (d->classno * (d->classno - 1) / 2));
 exchange_classdefno(d);
 deallocate(traindata);
 traindata = NULL;
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r14
movq %rdi, %r15
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x5c7af
movq (%rbx), %rdi
callq 0x10964
leaq 0x1407128(%r15), %rbx
leaq 0x1407138(%r15), %rsi
movq %rbx, %rdi
movq %rsi, 0x30(%rsp)
callq 0x395a3
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %r14, 0x48(%rsp)
movq %rax, (%r14)
cmpl $0x0, 0x1c0(%r15)
jle 0x19d2b
leaq 0x1407144(%r15), %rax
movq %rax, 0x38(%rsp)
xorl %r13d, %r13d
xorpd %xmm1, %xmm1
movq %rbx, 0x40(%rsp)
cmpl (%rbx), %r13d
je 0x19d19
movl 0x10(%r15), %eax
testl %eax, %eax
jle 0x19ce0
movsd %xmm1, 0x8(%rsp)
xorpd %xmm3, %xmm3
movl $0x1, %r14d
movq 0x38(%rsp), %rbx
xorl %ebp, %ebp
xorpd %xmm2, %xmm2
leaq 0x1(%rbp), %rcx
movslq 0x10(%r15), %rax
movq %rcx, 0x50(%rsp)
cmpq %rax, %rcx
movq %r14, 0x60(%rsp)
movq %rbx, 0x58(%rsp)
jge 0x19cb0
movsd %xmm3, 0x68(%rsp)
movsd %xmm2, 0x70(%rsp)
movq (%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
leaq 0x28(%rsp), %rcx
leaq 0x20(%rsp), %r8
callq 0x10f78
movq (%rsp), %rdi
movl %r13d, %esi
movl %r14d, %edx
leaq 0x18(%rsp), %rcx
leaq 0x10(%rsp), %r8
callq 0x10f78
movsd 0x20(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
ucomisd %xmm0, %xmm1
movq (%rsp), %rdi
minsd %xmm1, %xmm0
movl %r14d, %esi
cmoval %ebp, %esi
movl %r13d, %edx
movl $0x1, %ecx
callq 0x10fef
movl %eax, %r12d
movsd 0x28(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movq (%rsp), %rdi
maxsd %xmm1, %xmm0
movl %ebp, %esi
cmoval %r14d, %esi
movl %r13d, %edx
xorl %ecx, %ecx
callq 0x10fef
movsd 0x20(%rsp), %xmm2
movsd 0x10(%rsp), %xmm1
ucomisd %xmm2, %xmm2
movapd %xmm1, %xmm0
jp 0x19c08
movapd %xmm1, %xmm0
minsd %xmm2, %xmm0
movsd 0x28(%rsp), %xmm4
movsd 0x18(%rsp), %xmm3
ucomisd %xmm4, %xmm4
movapd %xmm3, %xmm5
jp 0x19c26
movapd %xmm3, %xmm5
maxsd %xmm4, %xmm5
subsd %xmm5, %xmm0
addl %r12d, %eax
movapd %xmm2, %xmm5
cmpunordsd %xmm2, %xmm5
movapd %xmm5, %xmm6
andpd %xmm1, %xmm6
maxsd %xmm2, %xmm1
andnpd %xmm1, %xmm5
orpd %xmm6, %xmm5
movapd %xmm4, %xmm1
cmpunordsd %xmm4, %xmm1
movapd %xmm1, %xmm2
andpd %xmm3, %xmm2
minsd %xmm4, %xmm3
andnpd %xmm3, %xmm1
orpd %xmm2, %xmm1
addsd %xmm5, %xmm1
divsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x68(%rsp), %xmm3
addsd %xmm0, %xmm3
movl (%rbx), %eax
addl 0x1407140(%r15,%rbp,4), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm0, %xmm1
movsd 0x70(%rsp), %xmm2
addsd %xmm1, %xmm2
incq %r14
addq $0x4, %rbx
cmpl %r14d, 0x10(%r15)
jg 0x19b57
movslq 0x10(%r15), %rax
movq 0x60(%rsp), %r14
incq %r14
movq 0x58(%rsp), %rbx
addq $0x4, %rbx
movq 0x50(%rsp), %rbp
cmpq %rax, %rbp
jl 0x19b37
movq 0x40(%rsp), %rbx
movsd 0x8(%rsp), %xmm1
jmp 0x19ce8
xorpd %xmm2, %xmm2
xorpd %xmm3, %xmm3
leal -0x1(%rax), %ecx
imull %eax, %ecx
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm0, %xmm3
movq 0x48(%rsp), %rax
mulsd (%rax), %xmm3
movsd %xmm3, (%rax)
ucomisd %xmm1, %xmm2
jbe 0x19d19
movapd %xmm2, %xmm1
incl %r13d
cmpl 0x1c0(%r15), %r13d
jl 0x19b07
jmp 0x19d2f
xorpd %xmm1, %xmm1
movl 0x10(%r15), %eax
leal -0x1(%rax), %ecx
imull %eax, %ecx
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0x395a3
movq (%rsp), %rdi
callq 0x2f616
movsd 0x8(%rsp), %xmm0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq