// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/nodeboundedtree.c
// Function: create_node_bounded_tree
int create_node_bounded_tree(Decisionnodeptr node, Nodeboundedtree_parameterptr param)
{
 /*!Last Changed 01.10.2006 added second vc calculation type*/
 /*!Last Changed 24.09.2006 discrete type is also added*/
 /*!Last Changed 01.07.2006 added nodeindex with MODEL_SELECTION_FIX*/
 /*!Last Changed 31.05.2006 added a1 and a2 to parameters*/
 /*!Last Changed 24.05.2006 added free_children and continue*/
 /*!Last Changed 19.03.2006*/
 Node_expandedptr header = NULL, nextexpanded;
 BOOLEAN isexpanded;
 int *countsleft, *countsright, expandedcount = 0, numinstances = data_size(node->instances);
 int i, error = 0, h, parenterror, lefterror, righterror, level, len, nodeindex = 0, childrenproduced;
 double bestupperbound, upperbound;
 Decisionnodeptr expanded_node;
 if (param->prunetype == PREPRUNING)
  {
   error = find_error_as_leaf(node->instances);
   bestupperbound = srm_classification((error + 0.0) / numinstances, 1, numinstances, param->a1, param->a2);
  }
 if (param->model != MODEL_SELECTION_FIX)
   add_node_to_expanded_list(node, &header, -1, param->usediscrete);
 else
  {
   add_node_to_expanded_list(node, &header, nodeindex, param->usediscrete);
   nodeindex++;
  }
 while (header && expandedcount < param->nodecount)
  {
   if (param->prunetype == PREPRUNING)     
     parenterror = find_error_as_leaf(header->node->instances);
   nextexpanded = header->next;
   expanded_node = header->node;
   safe_free(header);
   header = nextexpanded;
   switch (param->model)
    {
     case MODEL_SELECTION_UNI:if (param->usediscrete)
                               {
                                expanded_node->featureno = find_best_ldt_feature(expanded_node->instances, &(expanded_node->split));
                                if (expanded_node->featureno == -1)
                                  isexpanded = BOOLEAN_FALSE;
                                else
                                  isexpanded = BOOLEAN_TRUE;
                               }
                              else
                                isexpanded = find_best_hybrid_ldt_split_single_model(expanded_node, UNIVARIATE, param->variance_explained);
                              break;
     case MODEL_SELECTION_LIN:isexpanded = find_best_hybrid_ldt_split_single_model(expanded_node, LINEAR, param->variance_explained);
                              break;
     case MODEL_SELECTION_QUA:isexpanded = find_best_hybrid_ldt_split_single_model(expanded_node, QUADRATIC, param->variance_explained);
                              break;
     case MODEL_SELECTION_LEV:level = level_of_node(expanded_node);
                              len = strlen(param->modelstring);
                              if (level >= len)
                                level = len - 1;
                              find_best_hybrid_ldt_split_according_char(expanded_node, param->modelstring[level], param->variance_explained);
                              break;
     case MODEL_SELECTION_FIX:isexpanded = find_best_hybrid_ldt_split_according_char(expanded_node, param->modelstring[2 * expandedcount], param->variance_explained);
                              break;
     default                 :printf(m1325);
                              isexpanded = BOOLEAN_FALSE;
                              break;
    }
   if (param->usediscrete)
     childrenproduced = make_children(expanded_node);
   else
     childrenproduced = make_multivariate_children(expanded_node);
   if (isexpanded && childrenproduced)
    {     
     if (param->prunetype == PREPRUNING)     
      {
       switch (param->vccalculationtype)
        {
         case VC_GENERAL:h = decisiontree_vc_dimension_wrt_nodetype(current_dataset, expandedcount + 1, param->model - 5);
                         break;
        }
       lefterror = find_error_as_leaf(expanded_node->left->instances);
       righterror = find_error_as_leaf(expanded_node->right->instances);
       error += lefterror + righterror - parenterror;
       upperbound = srm_classification((error + 0.0) / numinstances, h, numinstances, param->a1, param->a2);
       if (upperbound < bestupperbound)
         bestupperbound = upperbound;
       else
        {
         expanded_node->instances = expanded_node->left->instances;
         merge_instancelist(&(expanded_node->instances), expanded_node->right->instances);
         expanded_node->left->instances = NULL;
         expanded_node->right->instances = NULL;
         free_children(expanded_node);
         make_leaf_node(expanded_node);
         continue;
        }
      }
     if (param->model == MODEL_SELECTION_FIX)
      {
       switch (param->modelstring[2 * expandedcount + 1]){
         case '1':countsleft = find_class_counts(expanded_node->left->instances);
                  countsright = find_class_counts(expanded_node->right->instances);
                  if (log_likelihood_for_classification(countsleft) < log_likelihood_for_classification(countsright))
                   {
                    can_be_divided(expanded_node->right, NULL);
                    make_leaf_node(expanded_node->right);
                    if (!add_node_to_expanded_list(expanded_node->left, &header, nodeindex, param->usediscrete))
                     {
                      empty_heap(header);
                      safe_free(countsleft);
                      safe_free(countsright);                      
                      return 0;
                     }
                    nodeindex++;
                   }
                  else
                   {
                    can_be_divided(expanded_node->left, NULL);
                    make_leaf_node(expanded_node->left);
                    if (!add_node_to_expanded_list(expanded_node->right, &header, nodeindex, param->usediscrete))
                     { 
                      empty_heap(header);
                      safe_free(countsleft);
                      safe_free(countsright);                      
                      return 0;
                     }
                    nodeindex++;
                   }
                  safe_free(countsleft);
                  safe_free(countsright);
                  break;
         case '2':if (!add_node_to_expanded_list(expanded_node->left, &header, nodeindex, param->usediscrete))
                   {
                    can_be_divided(expanded_node->right, NULL);
                    make_leaf_node(expanded_node->right);
                    empty_heap(header);
                    return 0;
                   }
                  nodeindex++;
                  if (!add_node_to_expanded_list(expanded_node->right, &header, nodeindex, param->usediscrete))
                   {
                    empty_heap(header);
                    return 0;
                   }
                  nodeindex++;
                  break;
         case '0':can_be_divided(expanded_node->left, NULL);
                  make_leaf_node(expanded_node->left);
                  can_be_divided(expanded_node->right, NULL);
                  make_leaf_node(expanded_node->right);
                  break;
       }
      }
     else
      {
       if (param->usediscrete && current_dataset->features[expanded_node->featureno].type == STRING)
        {
         for (i = 0; i < current_dataset->features[expanded_node->featureno].valuecount; i++)
           add_node_to_expanded_list(&(expanded_node->string[i]), &header, -1, BOOLEAN_TRUE); 
        }
       else
        {
         add_node_to_expanded_list(expanded_node->left, &header, -1, param->usediscrete);
         add_node_to_expanded_list(expanded_node->right, &header, -1, param->usediscrete);
        }
      }
     expandedcount++;      
    }
   else
    {
     make_leaf_node(expanded_node);
     if (param->model == MODEL_SELECTION_FIX)
      {
       empty_heap(header);
       return 0;
      }
    }
  }
 empty_heap(header);
 return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x449f0
movl %eax, -0x48(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x0, -0x6c(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jne 0x73053
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x18300
movl %eax, -0x50(%rbp)
cvtsi2sdl -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
addsd %xmm1, %xmm0
cvtsi2sdl -0x48(%rbp), %xmm1
divsd %xmm1, %xmm0
movl -0x48(%rbp), %esi
movq -0x18(%rbp), %rax
movsd 0x18(%rax), %xmm1
movq -0x18(%rbp), %rax
movsd 0x20(%rax), %xmm2
movl $0x1, %edi
callq 0x67a20
movsd %xmm0, -0x78(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x9, 0x8(%rax)
je 0x73078
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
leaq -0x20(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x72d90
jmp 0x73098
movq -0x10(%rbp), %rdi
movl -0x6c(%rbp), %edx
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
leaq -0x20(%rbp), %rsi
callq 0x72d90
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x7309a
xorl %eax, %eax
cmpq $0x0, -0x20(%rbp)
movb %al, -0x89(%rbp)
je 0x730bb
movl -0x44(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
setl %al
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %al
testb $0x1, %al
jne 0x730ca
jmp 0x737d5
movq -0x18(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jne 0x730e7
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rdi
callq 0x18300
movl %eax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x20(%rbp), %rdi
callq 0x52e80
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
addl $-0x5, %eax
movl %eax, %ecx
movq %rcx, -0x98(%rbp)
subl $0x4, %eax
ja 0x7327b
movq -0x98(%rbp), %rax
leaq 0x741d4(%rip), %rcx     # 0xe7310
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x73195
movq -0x88(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x88(%rbp), %rsi
addq $0x28, %rsi
callq 0xdf1b0
movl %eax, %ecx
movq -0x88(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x88(%rbp), %rax
cmpl $-0x1, 0x30(%rax)
jne 0x7318c
movl $0x0, -0x2c(%rbp)
jmp 0x73193
movl $0x1, -0x2c(%rbp)
jmp 0x731af
movq -0x88(%rbp), %rdi
movq -0x18(%rbp), %rax
movsd 0x28(%rax), %xmm0
xorl %esi, %esi
callq 0x76f70
movl %eax, -0x2c(%rbp)
jmp 0x73290
movq -0x88(%rbp), %rdi
movq -0x18(%rbp), %rax
movsd 0x28(%rax), %xmm0
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x76f70
movl %eax, -0x2c(%rbp)
jmp 0x73290
movq -0x88(%rbp), %rdi
movq -0x18(%rbp), %rax
movsd 0x28(%rax), %xmm0
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x76f70
movl %eax, -0x2c(%rbp)
jmp 0x73290
movq -0x88(%rbp), %rdi
callq 0x2b5c0
movl %eax, -0x64(%rbp)
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movl %eax, -0x68(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x68(%rbp), %eax
jl 0x73228
movl -0x68(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x64(%rbp)
movq -0x88(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x64(%rbp), %rcx
movb 0x30(%rax,%rcx), %al
movq -0x18(%rbp), %rcx
movsd 0x28(%rcx), %xmm0
movsbl %al, %esi
callq 0x78030
jmp 0x73290
movq -0x88(%rbp), %rdi
movq -0x18(%rbp), %rax
movl -0x44(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
movb 0x30(%rax,%rcx), %al
movq -0x18(%rbp), %rcx
movsd 0x28(%rcx), %xmm0
movsbl %al, %esi
callq 0x78030
movl %eax, -0x2c(%rbp)
jmp 0x73290
leaq 0x740d4(%rip), %rdi     # 0xe7356
movb $0x0, %al
callq 0x4030
movl $0x0, -0x2c(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x732ab
movq -0x88(%rbp), %rdi
callq 0xdcde0
movl %eax, -0x70(%rbp)
jmp 0x732ba
movq -0x88(%rbp), %rdi
callq 0x6f570
movl %eax, -0x70(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x737a6
cmpl $0x0, -0x70(%rbp)
je 0x737a6
movq -0x18(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jne 0x73416
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
testl %eax, %eax
jne 0x7330b
jmp 0x732e9
leaq 0x92550(%rip), %rax     # 0x105840
movq (%rax), %rdi
movl -0x44(%rbp), %esi
addl $0x1, %esi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edx
subl $0x5, %edx
callq 0xe0580
movl %eax, -0x54(%rbp)
movq -0x88(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rdi
callq 0x18300
movl %eax, -0x5c(%rbp)
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rdi
callq 0x18300
movl %eax, -0x60(%rbp)
movl -0x5c(%rbp), %eax
addl -0x60(%rbp), %eax
subl -0x58(%rbp), %eax
addl -0x50(%rbp), %eax
movl %eax, -0x50(%rbp)
cvtsi2sdl -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
addsd %xmm1, %xmm0
cvtsi2sdl -0x48(%rbp), %xmm1
divsd %xmm1, %xmm0
movl -0x54(%rbp), %edi
movl -0x48(%rbp), %esi
movq -0x18(%rbp), %rax
movsd 0x18(%rax), %xmm1
movq -0x18(%rbp), %rax
movsd 0x20(%rax), %xmm2
callq 0x67a20
movsd %xmm0, -0x80(%rbp)
movsd -0x80(%rbp), %xmm1
movsd -0x78(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7339a
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
jmp 0x73414
movq -0x88(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rcx
movq -0x88(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x88(%rbp), %rdi
addq $0x20, %rdi
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rsi
callq 0x44f40
movq -0x88(%rbp), %rax
movq (%rax), %rax
movq $0x0, 0x20(%rax)
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq $0x0, 0x20(%rax)
movq -0x88(%rbp), %rdi
callq 0x2a250
movq -0x88(%rbp), %rdi
callq 0x28a30
jmp 0x7309a
jmp 0x73416
movq -0x18(%rbp), %rax
cmpl $0x9, 0x8(%rax)
jne 0x736b4
movq -0x18(%rbp), %rax
movl -0x44(%rbp), %ecx
addl %ecx, %ecx
movslq %ecx, %rcx
movsbl 0x31(%rax,%rcx), %eax
movl %eax, -0x9c(%rbp)
subl $0x30, %eax
je 0x73669
jmp 0x73446
movl -0x9c(%rbp), %eax
subl $0x31, %eax
je 0x73467
jmp 0x73453
movl -0x9c(%rbp), %eax
subl $0x32, %eax
je 0x735c2
jmp 0x736af
movq -0x88(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rdi
callq 0x183a0
movq %rax, -0x38(%rbp)
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rdi
callq 0x183a0
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2ab10
movsd %xmm0, -0xa8(%rbp)
movq -0x40(%rbp), %rdi
callq 0x2ab10
movsd -0xa8(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x73536
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29340
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x28a30
movq -0x88(%rbp), %rax
movq (%rax), %rdi
movl -0x6c(%rbp), %edx
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
leaq -0x20(%rbp), %rsi
callq 0x72d90
cmpl $0x0, %eax
jne 0x7352b
movq -0x20(%rbp), %rdi
callq 0x72e10
movq -0x38(%rbp), %rdi
callq 0x52e80
movq -0x40(%rbp), %rdi
callq 0x52e80
movl $0x0, -0x4(%rbp)
jmp 0x737e5
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x735ab
movq -0x88(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29340
movq -0x88(%rbp), %rax
movq (%rax), %rdi
callq 0x28a30
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x6c(%rbp), %edx
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
leaq -0x20(%rbp), %rsi
callq 0x72d90
cmpl $0x0, %eax
jne 0x735a2
movq -0x20(%rbp), %rdi
callq 0x72e10
movq -0x38(%rbp), %rdi
callq 0x52e80
movq -0x40(%rbp), %rdi
callq 0x52e80
movl $0x0, -0x4(%rbp)
jmp 0x737e5
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
movq -0x38(%rbp), %rdi
callq 0x52e80
movq -0x40(%rbp), %rdi
callq 0x52e80
jmp 0x736af
movq -0x88(%rbp), %rax
movq (%rax), %rdi
movl -0x6c(%rbp), %edx
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
leaq -0x20(%rbp), %rsi
callq 0x72d90
cmpl $0x0, %eax
jne 0x7361d
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29340
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x28a30
movq -0x20(%rbp), %rdi
callq 0x72e10
movl $0x0, -0x4(%rbp)
jmp 0x737e5
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x6c(%rbp), %edx
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
leaq -0x20(%rbp), %rsi
callq 0x72d90
cmpl $0x0, %eax
jne 0x7365e
movq -0x20(%rbp), %rdi
callq 0x72e10
movl $0x0, -0x4(%rbp)
jmp 0x737e5
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x736af
movq -0x88(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29340
movq -0x88(%rbp), %rax
movq (%rax), %rdi
callq 0x28a30
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29340
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x28a30
jmp 0x7379b
movq -0x18(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x7375a
leaq 0x92177(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq -0x88(%rbp), %rcx
movslq 0x30(%rcx), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
cmpl $0x1, (%rax)
jne 0x7375a
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
leaq 0x92143(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
addq $0x30f08, %rcx          # imm = 0x30F08
movq -0x88(%rbp), %rdx
movslq 0x30(%rdx), %rdx
imulq $0x340, %rdx, %rdx      # imm = 0x340
addq %rdx, %rcx
cmpl 0x18(%rcx), %eax
jge 0x73758
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x4c(%rbp), %rax
imulq $0x160, %rax, %rax      # imm = 0x160
addq %rax, %rdi
leaq -0x20(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
callq 0x72d90
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x736f3
jmp 0x73799
movq -0x88(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
leaq -0x20(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x72d90
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
leaq -0x20(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x72d90
jmp 0x7379b
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x737d0
movq -0x88(%rbp), %rdi
callq 0x28a30
movq -0x18(%rbp), %rax
cmpl $0x9, 0x8(%rax)
jne 0x737ce
movq -0x20(%rbp), %rdi
callq 0x72e10
movl $0x0, -0x4(%rbp)
jmp 0x737e5
jmp 0x737d0
jmp 0x7309a
movq -0x20(%rbp), %rdi
callq 0x72e10
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)