// File: /workspace/github_c_makefile_star2_O1/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 0xc60f5(%rip), %rbp     # 0xd2870
movq (%rbp), %rax
movslq 0x10(%rax), %rdi
je 0xc84c
shlq $0x3, %rdi
leaq 0x96853(%rip), %rsi     # 0xa2fe7
movl $0x3, %edx
callq 0x390f5
movq %rax, 0x10(%rsp)
movq (%rbp), %rax
cmpl $0x0, 0x10(%rax)
jle 0xc9d1
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x28(%rsp), %r13
movq 0x30(%rsp), %r15
xorl %edi, %edi
movl $0x1, %esi
callq 0x1c996
movq %rax, %r12
movq (%r13), %rax
movq %rax, 0x20(%r12)
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x95187
movq %rbx, (%r13)
movq %r13, %rdi
movq %r12, %rsi
callq 0x1c787
movq %rbx, 0x20(%r12)
movl (%r15), %edi
movl $0x2, %esi
movl $0x2, %edx
movl $0x1, %ecx
xorl %eax, %eax
callq 0x39a80
testl %eax, %eax
je 0xc82a
movq 0x20(%rsp), %rax
movq (%rax), %rdx
movq %r12, %rdi
movq %r12, %rsi
callq 0x1d22a
movq 0x10(%rsp), %rax
movq %r12, (%rax,%r14,8)
incq %r14
movq (%rbp), %rax
movslq 0x10(%rax), %rax
cmpq %rax, %r14
jl 0xc7c0
jmp 0xc9d1
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 0x9677e(%rip), %rsi     # 0xa2fe7
movl $0x3, %edx
callq 0x390f5
movq %rax, 0x10(%rsp)
movq (%rbp), %rax
cmpl $0x0, 0x10(%rax)
jle 0xc9d1
leaq 0x8(%rsp), %rbx
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x30(%rsp), %r15
leal 0x1(%rcx), %r12d
movq (%rbp), %rax
cmpl 0x10(%rax), %r12d
movl %r12d, 0x18(%rsp)
jge 0xc9c0
movq %rcx, 0x38(%rsp)
movslq %edx, %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %rax
movq %rax, 0x40(%rsp)
movl %edx, 0x1c(%rsp)
xorl %edi, %edi
movl $0x1, %esi
callq 0x1c996
movq %rax, %r14
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movq 0x28(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
movq 0x38(%rsp), %r13
movl %r13d, %edx
movl %r12d, %ecx
callq 0x3031b
movq 0x8(%rsp), %rax
movq %rax, 0x20(%r14)
movq %r14, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x95187
xorl %r13d, %r13d
movq %r13, 0x8(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1c787
movq %r13, 0x20(%r14)
movq 0x8(%rsp), %rsi
movq %rbp, %rdi
callq 0x2fd59
movl (%r15), %edi
movl $0x2, %esi
movl $0x2, %edx
movl $0x1, %ecx
xorl %eax, %eax
callq 0x39a80
testl %eax, %eax
je 0xc98e
movq $0x0, 0x8(%rsp)
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
movq 0x38(%rsp), %rdx
movl %r12d, %ecx
callq 0x3031b
movq 0x8(%rsp), %rdx
movq %r14, %rdi
movq %r14, %rsi
callq 0x1d22a
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x2fd59
movq 0x40(%rsp), %rcx
movq %r14, (%rcx)
incl %r12d
leaq 0xc5ed0(%rip), %rbp     # 0xd2870
movq (%rbp), %rax
addq $0x8, %rcx
movl 0x1c(%rsp), %edx
incl %edx
cmpl 0x10(%rax), %r12d
leaq 0x8(%rsp), %rbx
movq %rcx, %rax
jl 0xc8bc
movq (%rbp), %rax
movl 0x18(%rsp), %ecx
cmpl 0x10(%rax), %ecx
jl 0xc894
movq 0x10(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq