// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/cart.c
// Function: find_best_cart_split
int find_best_cart_split(Decisionnodeptr node)
{
 int i;
 Instanceptr inst;
 double w0, v, gamma, bestc, c, delta, impurity, bestimpurity, bestdelta, bestgamma;
 matrix w;
 BOOLEAN improved = BOOLEAN_TRUE;
 node->w = matrix_alloc(1, current_dataset->multifeaturecount - 1);
 w = matrix_alloc(1, current_dataset->multifeaturecount - 1);
 node->w0 = 0;
 for (i = 0; i < current_dataset->multifeaturecount - 1; i++)
   node->w.values[0][i] = 1 / sqrt(current_dataset->multifeaturecount - 1);
 while (improved)
  {
   matrix_identical(&w, node->w);
   w0 = node->w0;
   for (i = 0; i < current_dataset->multifeaturecount - 1; i++)
    {
     bestimpurity = ISELL;
     for (gamma = -0.25; gamma < 0.3; gamma += 0.25)
      {
       inst = node->instances;
       while (inst)
        {
         v = multiply_with_matrix(inst, w);
         if (real_feature(inst, i) + gamma != 0.0)
          {
           delta = (v - w0) / (real_feature(inst, i) + gamma);
           w.values[0][i] -= delta;
           w0 += delta * gamma;
           impurity = information_gain_for_multivariate_split(node->instances, w, w0);
           w.values[0][i] += delta;
           w0 -= delta * gamma;
           if (impurity < bestimpurity)
            {                     
             bestimpurity = impurity;
             bestdelta = delta;
             bestgamma = gamma;
            }
          }
         inst = inst->next;
        }
      }
     if (bestimpurity != ISELL)
      {
       w.values[0][i] -= bestdelta;
       w0 += bestdelta * bestgamma;      
      }
    }
   bestimpurity = ISELL;
   inst = node->instances;
   while (inst)
    {
     c = multiply_with_matrix(inst, w);
     impurity = information_gain_for_multivariate_split(node->instances, w, c);
     if (impurity < bestimpurity)
      {
       bestc = c;
       bestimpurity = impurity;
      }
     inst = inst->next;
    }
   if (bestimpurity != ISELL)
     w0 = bestc;
   if (information_gain_for_multivariate_split(node->instances, w, w0) < information_gain_for_multivariate_split(node->instances, node->w, node->w0))
    {
     matrix_identical(&(node->w), w);
     node->w0 = w0;
     improved = BOOLEAN_TRUE;
    }
   else
     improved = BOOLEAN_FALSE;
  }
 matrix_free(w);
 if (information_gain_for_multivariate_split(node->instances, node->w, node->w0) == ISELL)
   return 0;
 return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movl $0x1, -0x84(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq 0xfc6c5(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %esi
subl $0x1, %esi
movl $0x1, %edi
callq 0x57fc0
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movq %rcx, -0x98(%rbp)
movq %rdx, -0x90(%rbp)
movq -0x98(%rbp), %rcx
movq %rcx, 0x38(%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x40(%rax)
leaq 0xfc67a(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %esi
subl $0x1, %esi
movl $0x1, %edi
callq 0x57fc0
movq %rax, -0xa8(%rbp)
movq %rdx, -0xa0(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x48(%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0xfc623(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
movl 0x1c0(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x9277
leaq 0xfc60c(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm0
callq 0x42a0
movaps %xmm0, %xmm1
movsd 0xd8dc4(%rip), %xmm0    # 0xe2018
divsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x9213
jmp 0x9279
cmpl $0x0, -0x84(%rbp)
je 0x9619
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
movq 0x40(%rax), %rdx
leaq -0x80(%rbp), %rdi
callq 0x5c040
movq -0x10(%rbp), %rax
movsd 0x48(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0xfc586(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
movl 0x1c0(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x94e1
movsd 0xd96c2(%rip), %xmm0    # 0xe2998
movsd %xmm0, -0x60(%rbp)
movsd 0xd96bd(%rip), %xmm0    # 0xe29a0
movsd %xmm0, -0x38(%rbp)
movsd 0xd96b8(%rip), %xmm0    # 0xe29a8
ucomisd -0x38(%rbp), %xmm0
jbe 0x9480
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x9467
movq -0x20(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0x42fb0
movsd %xmm0, -0x30(%rbp)
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x42c40
addsd -0x38(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x9349
jp 0x9349
jmp 0x9456
movsd -0x30(%rbp), %xmm0
subsd -0x28(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x42c40
movaps %xmm0, %xmm1
movsd -0xb8(%rbp), %xmm0
addsd -0x38(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm1
movq -0x78(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movsd -0x50(%rbp), %xmm0
movsd -0x38(%rbp), %xmm2
movsd -0x28(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movsd -0x28(%rbp), %xmm0
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0x6fa40
movsd %xmm0, -0x58(%rbp)
movsd -0x50(%rbp), %xmm0
movq -0x78(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movsd -0x50(%rbp), %xmm0
movsd -0x38(%rbp), %xmm2
movsd -0x28(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x58(%rbp), %xmm1
movsd -0x60(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x9454
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
jmp 0x9456
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x9307
jmp 0x9469
movsd 0xd953f(%rip), %xmm0    # 0xe29b0
addsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0x92e8
movsd -0x60(%rbp), %xmm0
movsd 0xd950b(%rip), %xmm1    # 0xe2998
ucomisd %xmm1, %xmm0
jne 0x9497
jp 0x9497
jmp 0x94d1
movsd -0x68(%rbp), %xmm1
movq -0x78(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movsd -0x68(%rbp), %xmm0
movsd -0x70(%rbp), %xmm2
movsd -0x28(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x94d3
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x92b0
movsd 0xd94af(%rip), %xmm0    # 0xe2998
movsd %xmm0, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x9568
movq -0x20(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0x42fb0
movsd %xmm0, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movsd -0x48(%rbp), %xmm0
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0x6fa40
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm1
movsd -0x60(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x955a
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x94fa
movsd -0x60(%rbp), %xmm0
movsd 0xd9423(%rip), %xmm1    # 0xe2998
ucomisd %xmm1, %xmm0
jne 0x957f
jp 0x957f
jmp 0x9589
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movsd -0x28(%rbp), %xmm0
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0x6fa40
movsd %xmm0, -0xc0(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movsd 0x48(%rcx), %xmm0
movq 0x38(%rax), %rsi
movq 0x40(%rax), %rdx
callq 0x6fa40
movsd -0xc0(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x960a
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0x5c040
movsd -0x28(%rbp), %xmm0
movq -0x10(%rbp), %rax
movsd %xmm0, 0x48(%rax)
movl $0x1, -0x84(%rbp)
jmp 0x9614
movl $0x0, -0x84(%rbp)
jmp 0x9279
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x59ea0
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movsd 0x48(%rcx), %xmm0
movq 0x38(%rax), %rsi
movq 0x40(%rax), %rdx
callq 0x6fa40
movsd 0xd9348(%rip), %xmm1    # 0xe2998
ucomisd %xmm1, %xmm0
jne 0x9661
jp 0x9661
movl $0x0, -0x4(%rbp)
jmp 0x9668
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)