// File: /workspace/github_c_makefile_star2_O1/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 0x1c583
movslq %eax, %rbx
incl %eax
movl %eax, 0x10(%rsp)
leaq 0x8(,%rbx,8), %r13
movq %r13, %rdi
leaq 0x58d70(%rip), %r12     # 0xa775c
movq %r12, %rsi
movl $0x7, %edx
callq 0x390f5
movq %rax, %rbp
movq %r13, %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x390f5
movq %rax, %r13
movq %r15, %rdi
callq 0x1c3b2
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x83e3f(%rip), %rax     # 0xd2870
movq (%rax), %rdi
movl 0x8(%r14), %edx
addl $-0x5, %edx
movl %ebx, %esi
callq 0xa0337
movsd 0x18(%r14), %xmm1
movsd 0x20(%r14), %xmm2
movsd 0x20(%rsp), %xmm0
movl %eax, %edi
movl 0xc(%rsp), %ebx
movl %ebx, %esi
callq 0x475c7
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 0x4e8a0
movq %r13, %rdi
movl 0x10(%rsp), %esi
callq 0x37740
testl %eax, %eax
je 0x4eb05
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 0x39a80
testl %eax, %eax
je 0x4eacf
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x3dbad
leaq 0x20(%rbx), %rdi
movq %rbx, %rsi
callq 0x1c787
movl $0xffffffff, 0x30(%rbx) # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x1d173
movq %rbp, %rdi
callq 0x39194
movq %r13, %rdi
callq 0x39194
testl %r12d, %r12d
jne 0x4e9c9
jmp 0x4eb15
movq %rbp, %rdi
callq 0x39194
movq %r13, %rdi
callq 0x39194
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq