// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/softtree.c
// Function: find_best_soft_tree_split
BOOLEAN find_best_soft_tree_split(Decisionnodeptr rootnode, Decisionnodeptr node, Instanceptr cvdata, Softregtree_parameterptr param)
{
 int i, j, datasize, performancebefore, performancebest, performancenow;
 double tmp, eta, lambda;
 BOOLEAN result = BOOLEAN_TRUE;
 Decisionnodeptr bestnode;
 matrix tmpw; 
 if (param->leaftype != CONSTANTLEAF)
   tmpw = matrix_copy(node->w);
 else
   tmp = node->w0;
 performancebefore = error_of_soft_tree(rootnode, cvdata);
 performancebest = performancebefore;
 datasize = data_size(rootnode->instances);
 node->left = createnewnode(node, 1);
 node->left->leaftype = param->leaftype;
 node->right = createnewnode(node, 1);
 node->right->leaftype = param->leaftype;
 node->featureno = SOFTLIN;
 bestnode = createnewnode(node, 1);
 bestnode->left = createnewnode(node, 1);
 bestnode->right = createnewnode(node, 1);
 if (param->regularization == NO_REGULARIZATION)
  {
   for (i = 0; i <= 10; i++)
    {
     eta = 10.0 / pow(2, i);
     gradient_descent_soft_tree(rootnode, node, param, eta, 0.0);
     performancenow = error_of_soft_tree(rootnode, cvdata);
     if (performancenow < performancebest)
      {    
       if (performancebest != performancebefore)
         free_soft_tree_ws(bestnode);
       performancebest = performancenow;
       copy_soft_tree_ws(bestnode, node);
      }
     free_soft_tree_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_tree(rootnode, node, param, eta, lambda);
       performancenow = error_of_soft_tree(rootnode, cvdata);
       if (performancenow < performancebest)
        {    
         if (performancebest != performancebefore)
           free_soft_tree_ws(bestnode);
         performancebest = performancenow;
         copy_soft_tree_ws(bestnode, node);
        }
       free_soft_tree_ws(node);
      }
    }
  }
 if (performancebefore <= performancebest)
  {
   result = BOOLEAN_FALSE;
   deallocate_tree_rule(node->left);
   deallocate_tree_rule(node->right);
   safe_free(node->left);
   safe_free(node->right);
   make_leaf_node(node);
   if (param->leaftype != CONSTANTLEAF)
     node->w = tmpw;
   else
     node->w0 = tmp;
  }
 else
  {
   if (param->leaftype != CONSTANTLEAF)
     matrix_free(tmpw);
   copy_soft_tree_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_tree_ws(bestnode);
 deallocate_tree_rule(bestnode->left);
 deallocate_tree_rule(bestnode->right);
 deallocate_tree_rule(bestnode);
 safe_free(bestnode->left);
 safe_free(bestnode->right);
 safe_free(bestnode);
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x1, -0x54(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xc0246
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq 0x40(%rax), %rsi
callq 0x58550
movq %rax, -0x80(%rbp)
movq %rdx, -0x78(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0xc0254
movq -0x10(%rbp), %rax
movsd 0x48(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xbeee0
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x449f0
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x29480
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl %ecx, 0x60(%rax)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x29480
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl %ecx, 0x60(%rax)
movq -0x10(%rbp), %rax
movl $0xfffffffa, 0x30(%rax) # imm = 0xFFFFFFFA
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x29480
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x29480
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x29480
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0xc03d0
movl $0x0, -0x24(%rbp)
cmpl $0xa, -0x24(%rbp)
jg 0xc03cb
cvtsi2sdl -0x24(%rbp), %xmm1
movsd 0x2295a(%rip), %xmm0    # 0xe2ca0
callq 0x4290
movaps %xmm0, %xmm1
movsd 0x245f2(%rip), %xmm0    # 0xe4948
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movsd -0x48(%rbp), %xmm0
xorps %xmm1, %xmm1
callq 0xbf560
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xbeee0
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0xc03b4
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
je 0xc03a1
movq -0x60(%rbp), %rdi
callq 0xbfbf0
movl -0x38(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xbfd00
movq -0x10(%rbp), %rdi
callq 0xbfbf0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xc032f
jmp 0xc04be
movl $0x0, -0x24(%rbp)
cmpl $0xa, -0x24(%rbp)
jg 0xc04bc
cvtsi2sdl -0x24(%rbp), %xmm1
movsd 0x228b2(%rip), %xmm0    # 0xe2ca0
callq 0x4290
movaps %xmm0, %xmm1
movsd 0x2454a(%rip), %xmm0    # 0xe4948
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movl $0x1, -0x28(%rbp)
cmpl $0xa, -0x28(%rbp)
jg 0xc04ac
cvtsi2sdl -0x28(%rbp), %xmm1
movsd 0x2287b(%rip), %xmm0    # 0xe2ca0
callq 0x4290
movaps %xmm0, %xmm1
movsd 0x21be3(%rip), %xmm0    # 0xe2018
divsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movsd -0x48(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
callq 0xbf560
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xbeee0
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0xc0495
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
je 0xc0482
movq -0x60(%rbp), %rdi
callq 0xbfbf0
movl -0x38(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xbfd00
movq -0x10(%rbp), %rdi
callq 0xbfbf0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xc040e
jmp 0xc04ae
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xc03d7
jmp 0xc04be
movl -0x30(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0xc053a
movl $0x0, -0x54(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x29ec0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x29ec0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x52e80
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x52e80
movq -0x10(%rbp), %rdi
callq 0x28a30
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xc0527
movq -0x10(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, 0x38(%rax)
movq -0x68(%rbp), %rcx
movq %rcx, 0x40(%rax)
jmp 0xc0535
movsd -0x40(%rbp), %xmm0
movq -0x10(%rbp), %rax
movsd %xmm0, 0x48(%rax)
jmp 0xc0601
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xc0550
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x59ea0
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0xbfd00
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0xc05ff
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
leaq 0x452c4(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1c0(%rcx), %eax
jge 0xc05fd
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax), %xmm1
movaps 0x228be(%rip), %xmm0    # 0xe2e60
pand %xmm0, %xmm1
leaq 0x45293(%rip), %rax     # 0x105840
movq (%rax), %rax
cvtsi2sdl 0x1c0(%rax), %xmm0
movsd 0x27210(%rip), %xmm2    # 0xe77d0
mulsd %xmm0, %xmm2
movsd 0x21a4c(%rip), %xmm0    # 0xe2018
divsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0xc05ed
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0xc05ef
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xc0572
jmp 0xc05ff
jmp 0xc0601
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
je 0xc0612
movq -0x60(%rbp), %rdi
callq 0xbfbf0
movq -0x60(%rbp), %rax
movq (%rax), %rdi
callq 0x29ec0
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x29ec0
movq -0x60(%rbp), %rdi
callq 0x29ec0
movq -0x60(%rbp), %rax
movq (%rax), %rdi
callq 0x52e80
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x52e80
movq -0x60(%rbp), %rdi
callq 0x52e80
movl -0x54(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)