// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/svmregtree.c
// Function: optimize_C_for_svmregtreenode
int optimize_C_for_svmregtreenode(Regressionnodeptr node, LEAF_TYPE leaftype)
{
 /*!Last Changed 01.11.2009*/
 int bestfeature = -1, currentfeature;
 double C, currenterror, besterror = +INT_MAX, currentsplit;
 Instanceptr validate = NULL, learn = NULL, leftinstances, rightinstances, testleft, testright;
 divide_instancelist(&(node->instances), &validate, &learn, 4);
 for (C = 0.0; C <= 3.0; C+= 0.1)
  {
   currentfeature = find_best_svmregtree_feature(learn, &currentsplit, C, leaftype);
   leftinstances = rightinstances = testleft = testright = NULL;
   divide_instancelist_according_to_split(&learn, &leftinstances, &rightinstances, currentfeature, currentsplit);
   divide_instancelist_according_to_split(&validate, &testleft, &testright, currentfeature, currentsplit);
   currenterror = constant_or_linear_model_mse(leftinstances, testleft, leaftype) + constant_or_linear_model_mse(rightinstances, testright, leaftype);
   learn = restore_instancelist(learn, leftinstances);
   merge_instancelist(&learn, rightinstances); 
   validate = restore_instancelist(validate, testleft);
   merge_instancelist(&validate, testright); 
   if (currenterror < besterror)
    {
     besterror = currenterror;
     bestfeature = currentfeature;
     node->split = currentsplit;
    }
  }
 node->instances = restore_instancelist(node->instances, learn);
 merge_instancelist(&(node->instances), validate);
 return bestfeature;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0xffffffff, -0x10(%rbp) # imm = 0xFFFFFFFF
movsd 0x16262(%rip), %xmm0    # 0xe2010
movsd %xmm0, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
leaq -0x40(%rbp), %rsi
leaq -0x48(%rbp), %rdx
movl $0x4, %ecx
callq 0x45f60
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
movsd 0x18883(%rip), %xmm0    # 0xe4670
ucomisd -0x20(%rbp), %xmm0
jb 0xcbf1b
movq -0x48(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
movl -0xc(%rbp), %edx
leaq -0x38(%rbp), %rsi
callq 0xcbae0
movl %eax, -0x14(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movl -0x14(%rbp), %ecx
movsd -0x38(%rbp), %xmm0
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x456d0
movl -0x14(%rbp), %ecx
movsd -0x38(%rbp), %xmm0
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0x456d0
movq -0x50(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0xc(%rbp), %edx
callq 0xa7830
movsd %xmm0, -0x70(%rbp)
movq -0x58(%rbp), %rdi
movq -0x68(%rbp), %rsi
movl -0xc(%rbp), %edx
callq 0xa7830
movaps %xmm0, %xmm1
movsd -0x70(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x464e0
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x44f40
movq -0x40(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x464e0
movq %rax, -0x40(%rbp)
movq -0x68(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x44f40
movsd -0x28(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xcbf02
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x10(%rbp)
movsd -0x38(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsd %xmm0, 0x50(%rax)
jmp 0xcbf04
movsd 0x1b794(%rip), %xmm0    # 0xe76a0
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
jmp 0xcbde5
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x48(%rbp), %rsi
callq 0x464e0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
movq -0x40(%rbp), %rsi
callq 0x44f40
movl -0x10(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)