// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/nodeboundedtree.c
// Function: prune_node_bounded_tree
void prune_node_bounded_tree(Decisionnodeptr root, Nodeboundedtree_parameterptr param, int datasize)
{
 /*!Last Changed 30.09.2007*/
 int finished = NO, count, h, index, best;
 double *generalizationerror, error;
 Decisionnodeptr *nodes, toberemoved;
 while (!finished)
  {
   count = decisiontree_node_count(root) + 1;
   nodes = safemalloc(count * sizeof(Decisionnodeptr), "prune_node_bounded_tree", 7);
   generalizationerror = safemalloc(count * sizeof(double), "prune_node_bounded_tree", 8);
   error = decisiontree_falsepositive_count(root) / (datasize + 0.0);
   h = decisiontree_vc_dimension_wrt_nodetype(current_dataset, count - 1, param->model - 5);
   generalizationerror[0] = srm_classification(error, h, datasize, param->a1, param->a2);
   index = 0;
   prune_node_bounded_tree_nodes(root, root, param, nodes, generalizationerror, &index, datasize);
   best = find_min_in_list_double(generalizationerror, count);
   finished = YES;
   if (best != 0)
    {
     toberemoved = nodes[best];
     finished = NO;
     if (in_list(toberemoved->featureno, 2, LINEAR, QUADRATIC))
       matrix_free(toberemoved->w);
     accumulate_instances_tree(&(toberemoved->instances), toberemoved);
     toberemoved->featureno = LEAF_NODE;
     free_children(toberemoved);
    }
   safe_free(nodes);
   safe_free(generalizationerror);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movl %edx, 0xc(%rsp)
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x18(%rsp)
movq %rdi, %r15
movq %r15, %rdi
callq 0x1cce7
movslq %eax, %rbx
incl %eax
movl %eax, 0x10(%rsp)
leaq 0x8(,%rbx,8), %r13
movq %r13, %rdi
leaq 0x5a8f7(%rip), %r12     # 0xaa7fc
movq %r12, %rsi
movl $0x7, %edx
callq 0x3a0e1
movq %rax, %rbp
movq %r13, %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x3a0e1
movq %rax, %r13
movq %r15, %rdi
callq 0x1cac6
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x85926(%rip), %rax     # 0xd5870
movq (%rax), %rdi
movl 0x8(%r14), %edx
addl $-0x5, %edx
movl %ebx, %esi
callq 0xa323d
movsd 0x18(%r14), %xmm1
movsd 0x20(%r14), %xmm2
movsd 0x20(%rsp), %xmm0
movl %eax, %edi
movl 0xc(%rsp), %ebx
movl %ebx, %esi
callq 0x4896e
movsd %xmm0, (%r13)
movl $0x0, 0x14(%rsp)
movl %ebx, (%rsp)
movq %r15, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbp, %rcx
movq %r13, %r8
leaq 0x14(%rsp), %r9
callq 0x4fdb0
movq %r13, %rdi
movl 0x10(%rsp), %esi
callq 0x38250
testl %eax, %eax
je 0x5002b
movl %eax, %r12d
cltq
movq (%rbp,%rax,8), %rbx
movl 0x30(%rbx), %edi
movl $0x2, %esi
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
movl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
xorl %eax, %eax
callq 0x3aa8c
testl %eax, %eax
je 0x4ffe8
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x3ed51
leaq 0x20(%rbx), %rdi
movq %rbx, %rsi
callq 0x1cef5
movl $0xffffffff, 0x30(%rbx) # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x1d8e3
movq %rbp, %rdi
callq 0x3a180
movq %r13, %rdi
callq 0x3a180
testl %r12d, %r12d
jne 0x4fee2
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
callq 0x3a180
movq %r13, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3a180