// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/decisiontree.c
// Function: information_gain_from_ratios
double information_gain_from_ratios(int ratio[MAXVALUES][MAXCLASSES])
{
/*!Last Changed 23.04.2003*/
 int i, j, howmany = 0;
 double totalover, totalunder, sum[MAXVALUES], res[MAXVALUES], p;
 totalover = 0;
 totalunder = 0;
 for (i = 0; i < MAXVALUES; i++)
  {
   sum[i] = 0;
   for (j = 0; j < current_dataset->classno; j++)
     sum[i] += ratio[i][j];
   res[i] = 0;
   if (sum[i] > 0)
    {
     for (j = 0; j < current_dataset->classno; j++)
       if (ratio[i][j] > 0)
        {
         p = ratio[i][j] / (sum[i] + 0.0);
         res[i] -= p * log2(p);
        }
     howmany++;
    }
   totalunder += sum[i];
   totalover += sum[i] * res[i];
  }
 if (totalunder == 0 || howmany == 1)
   return ISELL;
 else
   return totalover / totalunder;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x680, %rsp            # imm = 0x680
movq %rdi, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x64, -0x14(%rbp)
jge 0x2a911
movslq -0x14(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, -0x350(%rbp,%rax,8)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
leaq 0xdb0d8(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0x2a7ac
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movslq -0x14(%rbp), %rax
addsd -0x350(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x350(%rbp,%rax,8)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2a75e
movslq -0x14(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, -0x670(%rbp,%rax,8)
movslq -0x14(%rbp), %rax
movsd -0x350(%rbp,%rax,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x2a8c0
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
leaq 0xdb059(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0x2a8b7
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jle 0x2a8a7
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movslq -0x14(%rbp), %rax
xorps %xmm1, %xmm1
addsd -0x350(%rbp,%rax,8), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x678(%rbp)
movsd -0x678(%rbp), %xmm0
movsd %xmm0, -0x680(%rbp)
movsd -0x678(%rbp), %xmm0
callq 0x52ad0
movaps %xmm0, %xmm2
movsd -0x680(%rbp), %xmm0
movslq -0x14(%rbp), %rax
movsd -0x670(%rbp,%rax,8), %xmm1
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x670(%rbp,%rax,8)
jmp 0x2a8a9
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2a7dd
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movslq -0x14(%rbp), %rax
movsd -0x350(%rbp,%rax,8), %xmm0
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movslq -0x14(%rbp), %rax
movsd -0x350(%rbp,%rax,8), %xmm0
movslq -0x14(%rbp), %rax
movsd -0x670(%rbp,%rax,8), %xmm2
movsd -0x28(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2a73d
movsd -0x30(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2a923
jp 0x2a923
jmp 0x2a929
cmpl $0x1, -0x1c(%rbp)
jne 0x2a938
movsd 0xb8067(%rip), %xmm0    # 0xe2998
movsd %xmm0, -0x8(%rbp)
jmp 0x2a947
movsd -0x28(%rbp), %xmm0
divsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x680, %rsp            # imm = 0x680
popq %rbp
retq
nopw %cs:(%rax,%rax)