// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/metaclassification.c
// Function: train_one_vs_one
void** train_one_vs_one(Instanceptr* trdata, Instanceptr* cvdata, int algorithm, void* parameters)
{
 Datasetptr tmp;
 int i, j, k = 0;
 void** model;
 Instanceptr train = NULL, cv = NULL;
 model = safemalloc(sizeof(void*) * (current_dataset->classno * (current_dataset->classno - 1) / 2), "train_one_vs_one", 2);
 for (i = 0; i < current_dataset->classno; i++)
   for (j = i + 1; j < current_dataset->classno; j++)
    {
     divide_instancelist_one_vs_one_with_copy(*trdata, &train, i, j);
     divide_instancelist_one_vs_one_with_copy(*cvdata, &cv, i, j);
     tmp = copy_of_dataset(current_dataset);
     current_dataset->classno = 2;
     current_dataset->classcounts[0] = tmp->classcounts[i];
     current_dataset->classcounts[1] = tmp->classcounts[j];
     model[k] = classification_algorithms[algorithm - SELECTMAX].train_algorithm(&train, &cv, parameters);
     current_dataset->classno = tmp->classno;
     current_dataset->classcounts[0] = tmp->classcounts[0];
     current_dataset->classcounts[1] = tmp->classcounts[1];
     free_dataset(tmp);
     if (!in_list(algorithm, 1, KNN))
      {
       deallocate(train);
       deallocate(cv);
      }
     k++;
    }
 return model;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, 0x48(%rsp)
movl %edx, %ebx
movq %rsi, 0x38(%rsp)
movq %rdi, 0x30(%rsp)
leaq 0x8(%rsp), %rax
andq $0x0, (%rax)
leaq 0x20(%rsp), %rax
andq $0x0, (%rax)
leaq 0x911ac(%rip), %rbp     # 0xcd870
movq (%rbp), %rax
movl 0x10(%rax), %ecx
leal -0x1(%rcx), %eax
imull %ecx, %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
movslq %eax, %rdi
shlq $0x3, %rdi
leaq 0x5daf2(%rip), %rsi     # 0x9a1d7
movl %ecx, %edx
callq 0x34f59
movq %rax, 0x10(%rsp)
movq %rbx, 0x40(%rsp)
leal -0x3e8(%rbx), %eax
cltq
imulq $0x28, %rax, %rax
addq 0x8f8a7(%rip), %rax     # 0xcbfb0
movq %rax, 0x28(%rsp)
movq (%rbp), %rax
movl 0x10(%rax), %eax
xorl %r14d, %r14d
xorl %ebx, %ebx
movslq %eax, %rcx
cmpq %rcx, %r14
jge 0x3c848
movslq %ebx, %rbx
movq %r14, 0x18(%rsp)
leaq 0x1(%r14), %r15
cmpl %r15d, %eax
jle 0x3c83b
movq 0x30(%rsp), %rax
movq (%rax), %rdi
leaq 0x8(%rsp), %rsi
movq 0x18(%rsp), %r13
movl %r13d, %edx
movl %r15d, %ecx
callq 0x2cb58
movq 0x38(%rsp), %rax
movq (%rax), %rdi
movq %rbx, 0x50(%rsp)
leaq 0x20(%rsp), %rbx
movq %rbx, %rsi
movl %r13d, %edx
movl %r15d, %ecx
callq 0x2cb58
movq (%rbp), %rdi
callq 0x11e73
movq %rax, %r12
movq (%rbp), %rax
movl $0x2, 0x10(%rax)
movl 0x1407140(%r12,%r13,4), %ecx
movl %ecx, 0x1407140(%rax)
movl 0x1407144(%r12,%r14,4), %ecx
movl %ecx, 0x1407144(%rax)
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq 0x50(%rsp), %rbx
movq 0x48(%rsp), %rdx
movq 0x28(%rsp), %rax
callq *(%rax)
movq 0x10(%rsp), %rcx
movq %rax, (%rcx,%rbx,8)
movl 0x10(%r12), %eax
movq (%rbp), %rcx
movl %eax, 0x10(%rcx)
movl 0x1407140(%r12), %eax
movl %eax, 0x1407140(%rcx)
movl 0x1407144(%r12), %eax
movl %eax, 0x1407144(%rcx)
movq %r12, %rdi
callq 0x12723
movq 0x40(%rsp), %rdi
pushq $0x1
popq %rsi
movl $0x3e9, %edx            # imm = 0x3E9
xorl %eax, %eax
callq 0x35812
testl %eax, %eax
jne 0x3c829
movq 0x8(%rsp), %rdi
callq 0x2c010
movq 0x20(%rsp), %rdi
callq 0x2c010
incq %rbx
movq (%rbp), %rax
movl 0x10(%rax), %eax
movq %r15, %r14
jmp 0x3c72e
movq 0x18(%rsp), %r14
incq %r14
jmp 0x3c71a
movq 0x10(%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq