// File: /workspace/github_c_makefile_star2_O1/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 $0x18, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
cmpl $-0x1, 0x30(%rbx)
je 0x518d9
cmpl $0x3, %ebp
jne 0x51774
movq %r14, %rdi
callq 0x1c3b2
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdl 0x84(%r14), %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
leaq 0x8114c(%rip), %rax     # 0xd2870
movq (%rax), %rdi
movq %r14, %rsi
callq 0xa02d6
movl %eax, %r13d
movl 0x84(%r14), %r15d
leaq 0x512fc(%rip), %rdi     # 0xa2a3c
callq 0x534b6
movsd %xmm0, (%rsp)
leaq 0x512f1(%rip), %rdi     # 0xa2a42
callq 0x534b6
movapd %xmm0, %xmm2
movsd 0x8(%rsp), %xmm0
movl %r13d, %edi
movl %r15d, %esi
movsd (%rsp), %xmm1
callq 0x475c7
movapd %xmm0, %xmm1
movl 0x30(%rbx), %r12d
movl $0xffffffff, 0x30(%rbx) # imm = 0xFFFFFFFF
cmpl $0x3, %ebp
jne 0x5180c
movq %r14, %rdi
movsd %xmm1, 0x8(%rsp)
callq 0x1c3b2
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdl 0x84(%r14), %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
leaq 0x810b7(%rip), %rax     # 0xd2870
movq (%rax), %rdi
movq %r14, %rsi
callq 0xa02d6
movl %eax, %r15d
movl 0x84(%r14), %r13d
leaq 0x51267(%rip), %rdi     # 0xa2a3c
callq 0x534b6
movsd %xmm0, 0x10(%rsp)
leaq 0x5125b(%rip), %rdi     # 0xa2a42
callq 0x534b6
movapd %xmm0, %xmm2
movsd (%rsp), %xmm0
movl %r15d, %edi
movl %r13d, %esi
movsd 0x10(%rsp), %xmm1
callq 0x475c7
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x51855
movl %r12d, 0x30(%rbx)
testl %r12d, %r12d
js 0x5183f
cmpl $0x2, 0x98(%rbx)
je 0x5183f
leaq 0x81045(%rip), %rax     # 0xd2870
movq (%rax), %rax
imulq $0x340, %r12, %rcx      # imm = 0x340
cmpl $0x1, 0x30f08(%rax,%rcx)
je 0x51877
movq (%rbx), %rsi
movq %r14, %rdi
movl %ebp, %edx
callq 0x516d3
movq 0x8(%rbx), %rbx
jmp 0x516e9
leaq 0x20(%rbx), %rdi
movq %rbx, %rsi
callq 0x1c787
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1d173
leaq 0x80ff2(%rip), %rax     # 0xd2870
movq (%rax), %rax
movslq 0x30(%rbx), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
cmpl $0x0, 0x30f20(%rax,%rcx)
jle 0x518d9
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x10(%rbx), %rsi
addq %r15, %rsi
movq %r14, %rdi
movl %ebp, %edx
callq 0x516d3
incq %r12
leaq 0x80fb9(%rip), %rax     # 0xd2870
movq (%rax), %rax
movslq 0x30(%rbx), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
movslq 0x30f20(%rax,%rcx), %rax
addq $0x160, %r15            # imm = 0x160
cmpq %rax, %r12
jl 0x5189c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq