// File: /workspace/github_c_makefile_star2_O2/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 0xc179c(%rip), %rbx     # 0xcd870
movq (%rbx), %rax
movslq 0x10(%rax), %rdi
je 0xc192
shlq $0x3, %rdi
leaq 0x89f03(%rip), %rsi     # 0x95fef
pushq $0x3
popq %rdx
callq 0x34f59
movq %rax, 0x10(%rsp)
pushq $0x1
popq %rbp
pushq $0x2
popq %r14
xorl %r12d, %r12d
movq 0x28(%rsp), %r15
movq (%rbx), %rax
movslq 0x10(%rax), %rax
cmpq %rax, %r12
jge 0xc2d4
xorl %edi, %edi
movl %ebp, %esi
callq 0x1ac98
movq %rax, %r13
movq (%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
movq 0x30(%rsp), %rbx
movq %rbx, %rsi
movl %r12d, %edx
callq 0x8947f
andq $0x0, (%r15)
movq %r15, %rdi
movq %r13, %rsi
callq 0x1aad3
andq $0x0, 0x20(%r13)
movl (%rbx), %edi
movl %r14d, %esi
movl %r14d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x35812
testl %eax, %eax
je 0xc17a
movq 0x20(%rsp), %rax
movq (%rax), %rdx
movq %r13, %rdi
movq %r13, %rsi
callq 0x1b4d4
movq 0x10(%rsp), %rax
movq %r13, (%rax,%r12,8)
incq %r12
leaq 0xc16e3(%rip), %rbx     # 0xcd870
jmp 0xc108
leal -0x1(%rdi), %eax
imull %edi, %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
movslq %eax, %rdi
shlq $0x3, %rdi
leaq 0x89e43(%rip), %rsi     # 0x95fef
pushq $0x3
popq %rdx
callq 0x34f59
movq %rax, 0x10(%rsp)
movq (%rbx), %rax
movl 0x10(%rax), %eax
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x28(%rsp), %r12
cmpl %eax, %edx
jge 0xc2d4
movq %rdx, 0x38(%rsp)
leal 0x1(%rdx), %ebp
movslq %ecx, %rcx
movl %ebp, 0x1c(%rsp)
cmpl %eax, %ebp
jge 0xc2cb
movq %rcx, 0x40(%rsp)
xorl %edi, %edi
pushq $0x1
popq %rsi
callq 0x1ac98
movq %rax, %r13
andq $0x0, 0x8(%rsp)
movq %r12, %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
movq 0x38(%rsp), %r14
movl %r14d, %edx
movl %ebp, %ecx
callq 0x2cc06
movq 0x8(%rsp), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
movq 0x30(%rsp), %r15
movq %r15, %rsi
movl %r14d, %edx
callq 0x8947f
andq $0x0, 0x8(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1aad3
andq $0x0, 0x20(%r13)
movq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0x2c6e4
movl (%r15), %edi
pushq $0x2
popq %rdx
movl %edx, %esi
pushq $0x1
popq %rcx
xorl %eax, %eax
callq 0x35812
testl %eax, %eax
je 0xc2a6
andq $0x0, 0x8(%rsp)
movq 0x20(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x2cc06
movq 0x8(%rsp), %rdx
movq %r13, %rdi
movq %r13, %rsi
callq 0x1b4d4
movq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x2c6e4
movq 0x10(%rsp), %rax
movq 0x40(%rsp), %rcx
movq %r13, (%rax,%rcx,8)
incq %rcx
incl %ebp
leaq 0xc15b0(%rip), %rax     # 0xcd870
movq (%rax), %rax
movl 0x10(%rax), %eax
jmp 0xc1df
movl 0x1c(%rsp), %edx
jmp 0xc1c8
movq 0x10(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq