// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/classification.c
// Function: train_nodeboundedtree
void* train_nodeboundedtree(Instanceptr* trdata, Instanceptr *cvdata, void* parameters)
{
 /*!Last Changed 30.09.2007 added postpruning via SRM*/
 /*!Last Changed 31.05.2006*/
 Decisionnodeptr rootnode, besttree = NULL;
 int i, j, k, performance, maxperformance = -1, size = data_size(*trdata);
 double bin;
 Instanceptr data = *trdata;
 Nodeboundedtree_parameterptr p;
 p = (Nodeboundedtree_parameterptr) parameters;
 bin = 4.0 / p->partitioncount;
 if (in_list(p->prunetype, 3, MODELSELECTIONPRUNING, PREPRUNING, VALIDATIONPRUNING))
  {
   k = 0;
   for (i = 0; i < p->partitioncount; i++)
     for (j = 0; j < p->partitioncount; j++)
      {
       rootnode = createnewnode(NULL, 1);
       rootnode->instances = data;
       p->a1 = (i + 1) * bin;
       p->a2 = (j + 1) * bin; 
       create_node_bounded_tree(rootnode, p);
       switch (p->prunetype)
        {
         case     VALIDATIONPRUNING:prune_node_bounded_tree(rootnode, p, size);
                                    break;
         case MODELSELECTIONPRUNING:set_float_parameter("srma1", p->a1);
                                    set_float_parameter("srma2", p->a2);
                                    prune_tree_according_to_model_selection_method(rootnode, MODEL_SELECTION_SRM);
                                    break;
        }
       performance = test_tree(rootnode, *cvdata);
       write_array_variables("aout", k + 1, 3, "d", performance);
       data = NULL;
       accumulate_instances_tree(&data, rootnode);
       if (performance > maxperformance)
        {
         if (maxperformance != -1)
           deallocate_tree(besttree);
         maxperformance = performance;
         besttree = rootnode;       
        }
       else
         deallocate_tree(rootnode);
       k++;
      }
   *trdata = data;
  }
 else
  {
   besttree = createnewnode(NULL, 1);
   besttree->instances = *trdata;  
   create_node_bounded_tree(besttree, p);
  } 
 return besttree;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movq %rsi, 0x38(%rsp)
movq %rdi, %r15
movq (%rdi), %rdi
callq 0x30309
movl %eax, 0x24(%rsp)
movq (%r15), %rbx
movq %rbx, 0x18(%rsp)
cvtsi2sdl 0x4(%r14), %xmm0
movsd %xmm0, 0x8(%rsp)
movl 0x14(%r14), %edi
movl $0x3, %esi
movl $0x2, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
xorl %eax, %eax
callq 0x3aa8c
testl %eax, %eax
je 0xbfca
movl 0x4(%r14), %eax
testl %eax, %eax
jle 0xbfee
movq %r15, 0x30(%rsp)
movsd 0x99fad(%rip), %xmm0    # 0xa5de8
divsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq $0x0, 0x10(%rsp)
xorl %ecx, %ecx
movq $0x0, 0x8(%rsp)
incl %ecx
testl %eax, %eax
jle 0xbfb1
movl %ecx, 0x20(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
mulsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
xorl %r15d, %r15d
movl %r15d, %r13d
xorl %edi, %edi
movl $0x1, %esi
callq 0x1d107
movq %rax, %r12
movq 0x18(%rsp), %rax
movq %rax, 0x20(%r12)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x18(%r14)
leal 0x1(%r13), %r15d
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
mulsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x20(%r14)
movq %r12, %rdi
movq %r14, %rsi
callq 0x50293
movl 0x14(%r14), %eax
cmpl $0x2, %eax
je 0xbeee
cmpl $0x1, %eax
jne 0xbf1f
movq %r12, %rdi
movq %r14, %rsi
movl 0x24(%rsp), %edx
callq 0x4fec0
jmp 0xbf1f
movsd 0x18(%r14), %xmm0
leaq 0x99b41(%rip), %rdi     # 0xa5a3c
callq 0x54a3c
movsd 0x20(%r14), %xmm0
leaq 0x99b35(%rip), %rdi     # 0xa5a42
callq 0x54a3c
movq %r12, %rdi
movl $0x3, %esi
callq 0x52dec
movq 0x38(%rsp), %rax
movq (%rax), %rsi
movq %r12, %rdi
callq 0x1d5ec
movl %eax, %ebx
movq 0x8(%rsp), %rax
leal (%rax,%r13), %esi
incl %esi
leaq 0x9986d(%rip), %rdi     # 0xa57b0
movl $0x3, %edx
leaq 0xa4ca7(%rip), %rcx     # 0xb0bf6
movl %ebx, %r8d
xorl %eax, %eax
callq 0x33644
movq $0x0, 0x18(%rsp)
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x1cef5
cmpl %ebp, %ebx
jle 0xbf8b
cmpl $-0x1, %ebp
je 0xbf82
movq 0x10(%rsp), %rdi
callq 0x1d74c
movl %ebx, %ebp
movq %r12, 0x10(%rsp)
jmp 0xbf93
movq %r12, %rdi
callq 0x1d74c
movl 0x4(%r14), %eax
cmpl %eax, %r15d
jl 0xbe84
movq 0x8(%rsp), %rcx
addl %r15d, %ecx
movq %rcx, 0x8(%rsp)
movl 0x20(%rsp), %ecx
cmpl %eax, %ecx
jl 0xbe60
movq 0x18(%rsp), %rbx
movq 0x30(%rsp), %r15
movq 0x10(%rsp), %r12
jmp 0xbff1
xorl %edi, %edi
movl $0x1, %esi
callq 0x1d107
movq %rax, %r12
movq (%r15), %rax
movq %rax, 0x20(%r12)
movq %r12, %rdi
movq %r14, %rsi
callq 0x50293
jmp 0xbff4
xorl %r12d, %r12d
movq %rbx, (%r15)
movq %r12, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq