// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/omnivariatetree.c
// Function: prune_tree_global
void prune_tree_global(Decisionnodeptr root, Decisionnodeptr currentnode, int modelselectionmethod)
{
 double performancebefore, performance, error;
 int i, h, tmp;
 if (currentnode->featureno == LEAF_NODE)
   return;
 switch (modelselectionmethod)
  {
   case MODEL_SELECTION_SRM:error = decisiontree_falsepositive_count(root) / (root->covered + 0.0);
                            h = decisiontree_vc_dimension_recursive(current_dataset, root);
                            performancebefore = srm_classification(error, h, root->covered, get_parameter_f("srma1"), get_parameter_f("srma2"));
                            break;
  }
 tmp = currentnode->featureno;
 currentnode->featureno = LEAF_NODE;
 switch (modelselectionmethod)
  {
   case MODEL_SELECTION_SRM:error = decisiontree_falsepositive_count(root) / (root->covered + 0.0);
                            h = decisiontree_vc_dimension_recursive(current_dataset, root);
                            performance = srm_classification(error, h, root->covered, get_parameter_f("srma1"),  get_parameter_f("srma2"));
                            break;
  }
 if (performance < performancebefore)
  {
   accumulate_instances_tree(&(currentnode->instances), currentnode);
   free_children(currentnode);
  }
 else
  {
   currentnode->featureno = tmp;
   if (currentnode->featureno >= 0 && (currentnode->conditiontype != HYBRID_CONDITION) && current_dataset->features[currentnode->featureno].type == STRING)
     for (i = 0; i < current_dataset->features[currentnode->featureno].valuecount; i++)
       prune_tree_global(root, &(currentnode->string[i]), modelselectionmethod);
   else
    {
     prune_tree_global(root, currentnode->left, modelselectionmethod);
     prune_tree_global(root, currentnode->right, modelselectionmethod);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl 0x30(%rsi), %ebp
cmpl $-0x1, %ebp
je 0x52d5d
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rsi), %r12
movl %edx, 0xc(%rsp)
cmpl $0x3, %edx
jne 0x52d0c
movq %r14, %rdi
callq 0x1cac6
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdl 0x84(%r14), %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
leaq 0x82c4e(%rip), %rax     # 0xd5870
movq (%rax), %rdi
movq %r14, %rsi
callq 0xa31da
movl %eax, %r13d
movl 0x84(%r14), %r15d
leaq 0x52dfe(%rip), %rdi     # 0xa5a3c
callq 0x549ba
movsd %xmm0, 0x10(%rsp)
leaq 0x52df2(%rip), %rdi     # 0xa5a42
callq 0x549ba
movapd %xmm0, %xmm2
movsd 0x18(%rsp), %xmm0
movl %r13d, %edi
movl %r15d, %esi
movsd 0x10(%rsp), %xmm1
callq 0x4896e
movsd %xmm0, 0x18(%rsp)
movl (%r12), %ebp
movl $0xffffffff, (%r12)     # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x1cac6
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdl 0x84(%r14), %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
leaq 0x82bc2(%rip), %rax     # 0xd5870
movq (%rax), %rdi
movq %r14, %rsi
callq 0xa31da
movl %eax, %r15d
movl 0x84(%r14), %r13d
leaq 0x52d72(%rip), %rdi     # 0xa5a3c
callq 0x549ba
movsd %xmm0, 0x20(%rsp)
leaq 0x52d66(%rip), %rdi     # 0xa5a42
callq 0x549ba
movapd %xmm0, %xmm2
movsd 0x10(%rsp), %xmm0
movl %r15d, %edi
movl %r13d, %esi
movsd 0x20(%rsp), %xmm1
callq 0x4896e
movl 0xc(%rsp), %edx
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x52d6c
movl %ebp, (%r12)
testl %ebp, %ebp
js 0x52d3a
cmpl $0x2, 0x98(%rbx)
je 0x52d3a
leaq 0x82b4c(%rip), %rax     # 0xd5870
movq (%rax), %rax
movl %ebp, %ecx
imulq $0x340, %rcx, %rsi      # imm = 0x340
cmpl $0x1, 0x30f08(%rax,%rsi)
je 0x52d8e
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x52bc5
movl 0xc(%rsp), %edx
movq 0x8(%rbx), %rbx
leaq 0x30(%rbx), %r12
movl 0x30(%rbx), %ebp
cmpl $-0x1, %ebp
jne 0x52bed
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20(%rbx), %rdi
movq %rbx, %rsi
callq 0x1cef5
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1d8e3
addq $0x30f08, %rax          # imm = 0x30F08
imulq $0x340, %rcx, %rcx      # imm = 0x340
cmpl $0x0, 0x18(%rax,%rcx)
jle 0x52d5d
xorl %r15d, %r15d
xorl %r13d, %r13d
movq 0x10(%rbx), %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0x52bc5
movl 0xc(%rsp), %edx
incq %r13
leaq 0x82aab(%rip), %rax     # 0xd5870
movq (%rax), %rax
movslq (%r12), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
movslq 0x30f20(%rax,%rcx), %rax
addq $0x160, %r15            # imm = 0x160
cmpq %rax, %r13
jl 0x52da8
jmp 0x52d5d