// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/softregtree.c
// Function: find_best_soft_regtree_split
BOOLEAN find_best_soft_regtree_split(Regressionnodeptr rootnode, Regressionnodeptr node, Instanceptr cvdata, Softregtree_parameterptr param)
{
 int i, j, datasize;
 double performancebefore, performancenow, performancebest, tmp, eta, lambda;
 BOOLEAN result = BOOLEAN_TRUE;
 matrix tmpw;
 Regressionnodeptr bestnode;
 if (param->leaftype != CONSTANTLEAF)
   tmpw = matrix_copy(node->w);
 else
   tmp = node->regressionvalue;
 performancebefore = mse_error_of_soft_regression_tree(rootnode, cvdata);
 performancebest = performancebefore;
 datasize = data_size(rootnode->instances);
 node->left = createnewregnode(node, 1, param->leaftype);
 node->right = createnewregnode(node, 1, param->leaftype);
 node->featureno = SOFTLIN;
 bestnode = createnewregnode(node, 1, param->leaftype);
 bestnode->left = createnewregnode(node, 1, param->leaftype);
 bestnode->right = createnewregnode(node, 1, param->leaftype);
 if (param->regularization == NO_REGULARIZATION)
  {
   for (i = 0; i <= 10; i++)
    {
     eta = 10.0 / (pow(2, i));
     gradient_descent_soft_regtree(rootnode, node, param, eta, 0.0);
     performancenow = mse_error_of_soft_regression_tree(rootnode, cvdata);
     if (performancenow < performancebest)
      {    
       if (performancebest != performancebefore)
         free_soft_regtree_ws(bestnode);
       performancebest = performancenow;
       copy_soft_regtree_ws(bestnode, node);
      }
     free_soft_regtree_ws(node);
    }
  }
 else
  {
   for (i = 0; i <= 10; i++)
    {
     eta = 10.0 / pow(2, i);
     for (j = 1; j <= 10; j++)
      {
       lambda = 1.0 / pow(2, j);
       gradient_descent_soft_regtree(rootnode, node, param, eta, lambda);
       performancenow = mse_error_of_soft_regression_tree(rootnode, cvdata);
       if (performancenow < performancebest)
        {    
         if (performancebest != performancebefore)
           free_soft_regtree_ws(bestnode);
         performancebest = performancenow;
         copy_soft_regtree_ws(bestnode, node);
        }
       free_soft_regtree_ws(node);
      }
    }
  }
 if (performancebefore - performancebest <= 0.0001)
  {
   result = BOOLEAN_FALSE;
   safe_free(node->left);
   safe_free(node->right);
   make_leaf_regression_node(node, param->leaftype);
   if (param->leaftype != CONSTANTLEAF)
     node->w = tmpw;
   else
     node->regressionvalue = tmp;
  }
 else
  {
   if (param->leaftype != CONSTANTLEAF)
     matrix_free(tmpw);
   copy_soft_regtree_ws(node, bestnode);
   if (param->regularization != NO_REGULARIZATION)
     for (j = 0; j < current_dataset->multifeaturecount; j++)
       if (fabs(node->w.values[j][0]) < 1 / (1000.0 * current_dataset->multifeaturecount))
         node->w.values[j][0] = 0.0;
  }
 if (performancebest != performancebefore)
   free_soft_regtree_ws(bestnode);
 safe_free(bestnode->left);
 safe_free(bestnode->right);
 safe_free(bestnode);
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x1, -0x64(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xbe5c2
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movq 0x38(%rax), %rsi
callq 0x58550
movq %rax, -0x90(%rbp)
movq %rdx, -0x88(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0xbe5d0
movq -0x10(%rbp), %rax
movsd 0x70(%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xbdd20
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x449f0
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %edx
movl $0x1, %esi
callq 0xa6d80
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %edx
movl $0x1, %esi
callq 0xa6d80
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl $0xfffffffa, 0x68(%rax) # imm = 0xFFFFFFFA
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %edx
movl $0x1, %esi
callq 0xa6d80
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %edx
movl $0x1, %esi
callq 0xa6d80
movq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %edx
movl $0x1, %esi
callq 0xa6d80
movq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0xbe765
movl $0x0, -0x24(%rbp)
cmpl $0xa, -0x24(%rbp)
jg 0xbe760
cvtsi2sdl -0x24(%rbp), %xmm1
movsd 0x245db(%rip), %xmm0    # 0xe2ca0
callq 0x4290
movaps %xmm0, %xmm1
movsd 0x26273(%rip), %xmm0    # 0xe4948
divsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movsd -0x58(%rbp), %xmm0
xorps %xmm1, %xmm1
callq 0xbddc0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xbdd20
movsd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xbe749
movsd -0x48(%rbp), %xmm0
ucomisd -0x38(%rbp), %xmm0
jne 0xbe729
jp 0xbe729
jmp 0xbe732
movq -0x80(%rbp), %rdi
callq 0xbe3f0
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xbe450
movq -0x10(%rbp), %rdi
callq 0xbe3f0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xbe6ae
jmp 0xbe869
movl $0x0, -0x24(%rbp)
cmpl $0xa, -0x24(%rbp)
jg 0xbe867
cvtsi2sdl -0x24(%rbp), %xmm1
movsd 0x2451d(%rip), %xmm0    # 0xe2ca0
callq 0x4290
movaps %xmm0, %xmm1
movsd 0x261b5(%rip), %xmm0    # 0xe4948
divsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movl $0x1, -0x28(%rbp)
cmpl $0xa, -0x28(%rbp)
jg 0xbe857
cvtsi2sdl -0x28(%rbp), %xmm1
movsd 0x244e6(%rip), %xmm0    # 0xe2ca0
callq 0x4290
movaps %xmm0, %xmm1
movsd 0x2384e(%rip), %xmm0    # 0xe2018
divsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movsd -0x58(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
callq 0xbddc0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xbdd20
movsd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xbe840
movsd -0x48(%rbp), %xmm0
ucomisd -0x38(%rbp), %xmm0
jne 0xbe820
jp 0xbe820
jmp 0xbe829
movq -0x80(%rbp), %rdi
callq 0xbe3f0
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xbe450
movq -0x10(%rbp), %rdi
callq 0xbe3f0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xbe7a3
jmp 0xbe859
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xbe76c
jmp 0xbe869
movsd -0x38(%rbp), %xmm1
subsd -0x48(%rbp), %xmm1
movsd 0x25c7d(%rip), %xmm0    # 0xe44f8
ucomisd %xmm1, %xmm0
jb 0xbe8e2
movl $0x0, -0x64(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x52e80
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x52e80
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %esi
callq 0xa60c0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xbe8cf
movq -0x10(%rbp), %rax
movq -0x78(%rbp), %rcx
movq %rcx, 0x30(%rax)
movq -0x70(%rbp), %rcx
movq %rcx, 0x38(%rax)
jmp 0xbe8dd
movsd -0x50(%rbp), %xmm0
movq -0x10(%rbp), %rax
movsd %xmm0, 0x70(%rax)
jmp 0xbe9a9
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xbe8f8
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x59ea0
movq -0x10(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0xbe450
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0xbe9a7
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
leaq 0x46f1c(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1c0(%rcx), %eax
jge 0xbe9a5
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax), %xmm1
movaps 0x24516(%rip), %xmm0    # 0xe2e60
pand %xmm0, %xmm1
leaq 0x46eeb(%rip), %rax     # 0x105840
movq (%rax), %rax
cvtsi2sdl 0x1c0(%rax), %xmm0
movsd 0x28e68(%rip), %xmm2    # 0xe77d0
mulsd %xmm0, %xmm2
movsd 0x236a4(%rip), %xmm0    # 0xe2018
divsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0xbe995
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0xbe997
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xbe91a
jmp 0xbe9a7
jmp 0xbe9a9
movsd -0x48(%rbp), %xmm0
ucomisd -0x38(%rbp), %xmm0
jne 0xbe9b9
jp 0xbe9b9
jmp 0xbe9c2
movq -0x80(%rbp), %rdi
callq 0xbe3f0
movq -0x80(%rbp), %rax
movq (%rax), %rdi
callq 0x52e80
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x52e80
movq -0x80(%rbp), %rdi
callq 0x52e80
movl -0x64(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq