// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/omnivariatetree.c
// Function: prune_tree_according_to_model_selection_method
void prune_tree_according_to_model_selection_method(Decisionnodeptr root, int modelselectionmethod)
{
 /*!Last Changed 24.05.2006 added free_children*/
 /*!Last Changed 10.02.2005*/
 double performancebefore, performance, loglikelihoodbefore, loglikelihood, exceptionlengthbefore, exceptionlength, error;
 int d, *classcounts, N, i, C, fp, h;
 if (root->featureno == LEAF_NODE)
   return;
 switch (modelselectionmethod)
  {
   case MODEL_SELECTION_AIC:loglikelihoodbefore = decisiontree_loglikelihood(root);
                            d = decisiontree_complexity_count(root);
                            performancebefore = aic_loglikelihood(loglikelihoodbefore, d);
                            classcounts = safecalloc(current_dataset->classno, sizeof(int), "prune_tree_according_to_model_selection_method", 10);
                            find_subtree_class_counts(root, classcounts);
                            loglikelihood = log_likelihood_for_classification(classcounts);
                            safe_free(classcounts);
                            performance = aic_loglikelihood(loglikelihood, 0);
                            break;
   case MODEL_SELECTION_BIC:loglikelihoodbefore = decisiontree_loglikelihood(root);
                            d = decisiontree_complexity_count(root);
                            classcounts = safecalloc(current_dataset->classno, sizeof(int), "prune_tree_according_to_model_selection_method", 18);
                            find_subtree_class_counts(root, classcounts);
                            N = 0;
                            for (i = 0; i < current_dataset->classno; i++)
                              N += classcounts[i];
                            performancebefore = bic_loglikelihood(loglikelihoodbefore, d, N);
                            loglikelihood = log_likelihood_for_classification(classcounts);
                            safe_free(classcounts);
                            performance = bic_loglikelihood(loglikelihood, 0, N);
                            break;
   case MODEL_SELECTION_SRM:error = decisiontree_falsepositive_count(root) / (root->covered + 0.0);
                            switch (root->conditiontype)
                             {
                              case   UNIVARIATE_CONDITION:h = decisiontree_vc_dimension_recursive(current_dataset, root);
                                                          break;
                              case MULTIVARIATE_CONDITION:
                              case       HYBRID_CONDITION:h = omnivariatetree_vc_dimension(current_dataset, root);
                                                          break;
                             }
                            performancebefore = srm_classification(error, h, root->covered, get_parameter_f("srma1"), get_parameter_f("srma2"));
                            error = root->falsepositives / (root->covered + 0.0);
                            performance = srm_classification(error, 1, root->covered, get_parameter_f("srma1"), get_parameter_f("srma2"));
                            break;
   case MODEL_SELECTION_MDL:C = 0;
                            fp = 0;
                            subtree_covered_and_false_positives(root, &C, &fp);
                            exceptionlengthbefore = description_length_of_exceptions(C, 0, fp, 0, 1);
                            d = decisiontree_complexity_count(root);
                            performancebefore = mdl(exceptionlengthbefore, d, 0.01, BITS_FOR_REAL_NUMBER);
                            exceptionlength = description_length_of_exceptions(root->covered, 0, root->falsepositives, 0, 1);
                            performance = mdl(exceptionlength, 0, 0.01, BITS_FOR_REAL_NUMBER);
                            break;
   default                 :performance = 1.0;
                            performancebefore = 0.0;
                            break;
  }
 if (performance < performancebefore)
  {
   if (in_list(root->featureno, 2, LINEAR, QUADRATIC))
     matrix_free(root->w);
   accumulate_instances_tree(&(root->instances), root);
   free_children(root);
   root->featureno = LEAF_NODE;
  }
 else
  {
   if (root->featureno >= 0 && (root->conditiontype != HYBRID_CONDITION) && current_dataset->features[root->featureno].type == STRING)
     for (i = 0; i < current_dataset->features[root->featureno].valuecount; i++)
       prune_tree_according_to_model_selection_method(&(root->string[i]), modelselectionmethod);
   else
    {
     prune_tree_according_to_model_selection_method(root->left, modelselectionmethod);
     prune_tree_according_to_model_selection_method(root->right, modelselectionmethod);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
cmpl $-0x1, 0x30(%rax)
jne 0x765c1
jmp 0x76aba
movl -0xc(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x78(%rbp)
subl $0x3, %eax
ja 0x76974
movq -0x78(%rbp), %rax
leaq 0x70ec0(%rip), %rcx     # 0xe74a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
callq 0x2aa80
movsd %xmm0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28b80
movl %eax, -0x4c(%rbp)
movsd -0x28(%rbp), %xmm0
cvtsi2sdl -0x4c(%rbp), %xmm1
callq 0x66430
movsd %xmm0, -0x18(%rbp)
leaq 0x8f222(%rip), %rax     # 0x105840
movq (%rax), %rax
movslq 0x10(%rax), %rdi
movl $0x4, %esi
leaq 0x70ec9(%rip), %rdx     # 0xe74fa
movl $0xa, %ecx
callq 0x52f40
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x2a960
movq -0x58(%rbp), %rdi
callq 0x2ab10
movsd %xmm0, -0x30(%rbp)
movq -0x58(%rbp), %rdi
callq 0x52e80
movsd -0x30(%rbp), %xmm0
xorps %xmm1, %xmm1
callq 0x66430
movsd %xmm0, -0x20(%rbp)
jmp 0x76989
movq -0x8(%rbp), %rdi
callq 0x2aa80
movsd %xmm0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28b80
movl %eax, -0x4c(%rbp)
leaq 0x8f1a5(%rip), %rax     # 0x105840
movq (%rax), %rax
movslq 0x10(%rax), %rdi
movl $0x4, %esi
leaq 0x70e4c(%rip), %rdx     # 0xe74fa
movl $0x12, %ecx
callq 0x52f40
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x2a960
movl $0x0, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
leaq 0x8f15f(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0x76705
movq -0x58(%rbp), %rax
movslq -0x60(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl -0x5c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x766d7
movsd -0x28(%rbp), %xmm0
cvtsi2sdl -0x4c(%rbp), %xmm1
movl -0x5c(%rbp), %edi
callq 0x669d0
movsd %xmm0, -0x18(%rbp)
movq -0x58(%rbp), %rdi
callq 0x2ab10
movsd %xmm0, -0x30(%rbp)
movq -0x58(%rbp), %rdi
callq 0x52e80
movsd -0x30(%rbp), %xmm0
movl -0x5c(%rbp), %edi
xorps %xmm1, %xmm1
callq 0x669d0
movsd %xmm0, -0x20(%rbp)
jmp 0x76989
movq -0x8(%rbp), %rdi
callq 0x28a70
cvtsi2sd %eax, %xmm0
movq -0x8(%rbp), %rax
cvtsi2sdl 0x84(%rax), %xmm1
xorps %xmm2, %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x8(%rbp), %rax
movl 0x98(%rax), %eax
movl %eax, -0x7c(%rbp)
testl %eax, %eax
je 0x76795
jmp 0x76789
movl -0x7c(%rbp), %eax
decl %eax
subl $0x2, %eax
jb 0x767ad
jmp 0x767c3
leaq 0x8f0a4(%rip), %rax     # 0x105840
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0xe04e0
movl %eax, -0x6c(%rbp)
jmp 0x767c3
leaq 0x8f08c(%rip), %rax     # 0x105840
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0xe0700
movl %eax, -0x6c(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0xb0(%rbp)
movq -0x8(%rbp), %rax
movl 0x84(%rax), %eax
movl %eax, -0xac(%rbp)
leaq 0x6bfc1(%rip), %rdi     # 0xe27b1
callq 0x79040
movsd %xmm0, -0xa8(%rbp)
leaq 0x6bfb3(%rip), %rdi     # 0xe27b7
callq 0x79040
movl -0xb0(%rbp), %edi
movl -0xac(%rbp), %esi
movsd -0xa8(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0xa0(%rbp), %xmm0
callq 0x67a20
movsd %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rax
cvtsi2sdl 0x88(%rax), %xmm0
movq -0x8(%rbp), %rax
cvtsi2sdl 0x84(%rax), %xmm1
xorps %xmm2, %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x8(%rbp), %rax
movl 0x84(%rax), %eax
movl %eax, -0x94(%rbp)
leaq 0x6bf33(%rip), %rdi     # 0xe27b1
callq 0x79040
movsd %xmm0, -0x90(%rbp)
leaq 0x6bf25(%rip), %rdi     # 0xe27b7
callq 0x79040
movl -0x94(%rbp), %esi
movsd -0x90(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x88(%rbp), %xmm0
movl $0x1, %edi
callq 0x67a20
movsd %xmm0, -0x20(%rbp)
jmp 0x76989
movl $0x0, -0x64(%rbp)
movl $0x0, -0x68(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x64(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0x2aa00
movl -0x64(%rbp), %edi
movl -0x68(%rbp), %edx
xorl %ecx, %ecx
movsd 0x6b725(%rip), %xmm0    # 0xe2018
movl %ecx, %esi
callq 0xabdd0
movsd %xmm0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28b80
movl %eax, -0x4c(%rbp)
movsd -0x38(%rbp), %xmm0
movl -0x4c(%rbp), %edi
movsd 0x6b705(%rip), %xmm1    # 0xe2020
movl $0x20, %esi
callq 0x67b80
movsd %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x84(%rax), %edi
movq -0x8(%rbp), %rax
movl 0x88(%rax), %edx
xorl %ecx, %ecx
movsd 0x6b6d0(%rip), %xmm0    # 0xe2018
movl %ecx, %esi
callq 0xabdd0
movsd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
xorl %edi, %edi
movsd 0x6b6bd(%rip), %xmm1    # 0xe2020
movl $0x20, %esi
callq 0x67b80
movsd %xmm0, -0x20(%rbp)
jmp 0x76989
movsd 0x6b69c(%rip), %xmm0    # 0xe2018
movsd %xmm0, -0x20(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x20(%rbp), %xmm1
movsd -0x18(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x769f6
movq -0x8(%rbp), %rax
movl 0x30(%rax), %edi
movl $0x2, %esi
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
movl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
movb $0x0, %al
callq 0x53e40
cmpl $0x0, %eax
je 0x769cc
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movq 0x40(%rax), %rsi
callq 0x59ea0
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
movq -0x8(%rbp), %rsi
callq 0x29160
movq -0x8(%rbp), %rdi
callq 0x2a250
movq -0x8(%rbp), %rax
movl $0xffffffff, 0x30(%rax) # imm = 0xFFFFFFFF
jmp 0x76aba
movq -0x8(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jl 0x76a99
movq -0x8(%rbp), %rax
cmpl $0x2, 0x98(%rax)
je 0x76a99
leaq 0x8ee24(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq -0x8(%rbp), %rcx
movslq 0x30(%rcx), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
cmpl $0x1, (%rax)
jne 0x76a99
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
leaq 0x8edf3(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
addq $0x30f08, %rcx          # imm = 0x30F08
movq -0x8(%rbp), %rdx
movslq 0x30(%rdx), %rdx
imulq $0x340, %rdx, %rdx      # imm = 0x340
addq %rdx, %rcx
cmpl 0x18(%rcx), %eax
jge 0x76a97
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x60(%rbp), %rax
imulq $0x160, %rax, %rax      # imm = 0x160
addq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x765a0
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x76a43
jmp 0x76ab8
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0xc(%rbp), %esi
callq 0x765a0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0xc(%rbp), %esi
callq 0x765a0
jmp 0x76aba
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)