// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/classification.c
// Function: train_svmtree
void* train_svmtree(Instanceptr* trdata, Instanceptr *cvdata, void* parameters)
{
 /*!Last Changed 09.07.2009*/
 int i, j, k = 0;
 Decisionnodeptr rootnode;
 Svmtree_parameterptr param;
 Decisionnodeptr* forest;
 Instanceptr positives, negatives;
 param = (Svmtree_parameterptr) parameters;
 if (param->multiclasstype == ONE_VS_ONE)
  {
   forest = safemalloc((current_dataset->classno * (current_dataset->classno - 1) / 2) * sizeof(Decisionnodeptr), "train_svmtree", 3);
   for (i = 0; i < current_dataset->classno; i++)
     for (j = i + 1; j < current_dataset->classno; j++)
      {
       rootnode = createnewnode(NULL, 1);
       positives = negatives = NULL;
       divide_instancelist_one_vs_one(trdata, &positives, i, j);
       rootnode->instances = positives;
       create_svmtreechildren(rootnode, param, i);
       positives = NULL;
       accumulate_instances_tree(&positives, rootnode);
       rootnode->instances = NULL;
       merge_instancelist(trdata, positives);
       if (in_list(param->c45param.prunetype, 2, MODELSELECTIONPRUNING, VALIDATIONPRUNING))
        {
         positives = negatives = NULL;
         divide_instancelist_one_vs_one(cvdata, &positives, i, j);
         prune_tree(rootnode, rootnode, positives);
         merge_instancelist(cvdata, positives);
        }
       forest[k] = rootnode;
       k++;
      }
  }
 else
  {
   forest = safemalloc(current_dataset->classno * sizeof(Decisionnodeptr), "train_svmtree", 3);
   for (i = 0; i < current_dataset->classno; i++)
    {
     rootnode = createnewnode(NULL, 1);
     rootnode->instances = *trdata;
     create_svmtreechildren(rootnode, param, i);
     *trdata = NULL;
     accumulate_instances_tree(trdata, rootnode);
     rootnode->instances = NULL;
     if (in_list(param->c45param.prunetype, 2, MODELSELECTIONPRUNING, VALIDATIONPRUNING))
       prune_tree(rootnode, rootnode, *cvdata);
     forest[i] = rootnode;
    }
  }
 return forest;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, 0x20(%rsp)
movq %rdx, 0x30(%rsp)
cmpl $0x0, 0x10(%rdx)
movq %rdi, 0x28(%rsp)
leaq 0xc9066(%rip), %rbp     # 0xd5870
movq (%rbp), %rax
movslq 0x10(%rax), %rdi
je 0xc8db
shlq $0x3, %rdi
leaq 0x997c4(%rip), %rsi     # 0xa5fe7
movl $0x3, %edx
callq 0x3a0e1
movq %rax, 0x10(%rsp)
movq (%rbp), %rax
cmpl $0x0, 0x10(%rax)
jle 0xca55
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x28(%rsp), %r13
movq 0x30(%rsp), %r15
xorl %edi, %edi
movl $0x1, %esi
callq 0x1d107
movq %rax, %r12
movq (%r13), %rax
movq %rax, 0x20(%r12)
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x97d1d
movq %rbx, (%r13)
movq %r13, %rdi
movq %r12, %rsi
callq 0x1cef5
movq %rbx, 0x20(%r12)
movl (%r15), %edi
movl $0x2, %esi
movl $0x2, %edx
movl $0x1, %ecx
xorl %eax, %eax
callq 0x3aa8c
testl %eax, %eax
je 0xc8b9
movq 0x20(%rsp), %rax
movq (%rax), %rdx
movq %r12, %rdi
movq %r12, %rsi
callq 0x1d99b
movq 0x10(%rsp), %rax
movq %r12, (%rax,%r14,8)
incq %r14
movq (%rbp), %rax
movslq 0x10(%rax), %rax
cmpq %rax, %r14
jl 0xc84f
jmp 0xca55
leal -0x1(%rdi), %eax
imull %edi, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rdi
shlq $0x3, %rdi
leaq 0x996ef(%rip), %rsi     # 0xa5fe7
movl $0x3, %edx
callq 0x3a0e1
movq %rax, 0x10(%rsp)
movq (%rbp), %rax
movl 0x10(%rax), %eax
testl %eax, %eax
jle 0xca55
leaq 0x8(%rsp), %rbx
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x30(%rsp), %r13
leal 0x1(%rcx), %r12d
cmpl %eax, %r12d
movl %r12d, 0x18(%rsp)
jge 0xca49
movq %rcx, 0x38(%rsp)
movslq %edx, %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %rcx
movq %rcx, 0x40(%rsp)
movl %edx, 0x1c(%rsp)
xorl %edi, %edi
movl $0x1, %esi
callq 0x1d107
movq %rax, %r14
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movq 0x28(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
movq 0x38(%rsp), %r15
movl %r15d, %edx
movl %r12d, %ecx
callq 0x30c03
movq 0x8(%rsp), %rax
movq %rax, 0x20(%r14)
movq %r14, %rdi
movq %r13, %rsi
movl %r15d, %edx
callq 0x97d1d
xorl %r15d, %r15d
movq %r15, 0x8(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1cef5
movq %r15, 0x20(%r14)
movq 0x8(%rsp), %rsi
movq %rbp, %rdi
movq %rbx, %rbp
callq 0x30648
movl (%r13), %edi
movl $0x2, %esi
movl $0x2, %edx
movl $0x1, %ecx
xorl %eax, %eax
callq 0x3aa8c
testl %eax, %eax
je 0xca1b
movq $0x0, 0x8(%rsp)
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movq 0x38(%rsp), %rdx
movl %r12d, %ecx
callq 0x30c03
movq 0x8(%rsp), %rdx
movq %r14, %rdi
movq %r14, %rsi
callq 0x1d99b
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x30648
movq 0x40(%rsp), %rcx
movq %r14, (%rcx)
incl %r12d
leaq 0xc8e43(%rip), %rax     # 0xd5870
movq (%rax), %rax
movl 0x10(%rax), %eax
addq $0x8, %rcx
movl 0x1c(%rsp), %edx
incl %edx
cmpl %eax, %r12d
movq %rbp, %rbx
jl 0xc947
movl 0x18(%rsp), %ecx
cmpl %eax, %ecx
jl 0xc924
movq 0x10(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq