// File: /workspace/github_c_makefile_star2_O1/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 $0x68, %rsp
movq %rcx, 0x58(%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdi, 0x48(%rsp)
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movq %rax, 0x28(%rsp)
leaq 0x911ef(%rip), %rbx     # 0xd2870
movq (%rbx), %rax
movl 0x10(%rax), %eax
leal -0x1(%rax), %ecx
imull %eax, %ecx
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
movslq %eax, %rdi
shlq $0x3, %rdi
leaq 0x65b63(%rip), %rsi     # 0xa7207
movl $0x2, %edx
callq 0x390f5
movq %rax, 0x18(%rsp)
movq (%rbx), %rax
cmpl $0x0, 0x10(%rax)
jle 0x41837
movq 0x20(%rsp), %rax
addl $0xfffffc18, %eax       # imm = 0xFFFFFC18
cltq
leaq (%rax,%rax,4), %rax
shlq $0x3, %rax
addq 0x8f8d5(%rip), %rax     # 0xd0fb0
movq %rax, 0x40(%rsp)
movl $0x501c51, %r13d        # imm = 0x501C51
xorl %ecx, %ecx
xorl %edx, %edx
movq %rcx, 0x60(%rsp)
incq %rcx
movq (%rbx), %rax
movslq 0x10(%rax), %rax
movq %rcx, 0x30(%rsp)
cmpq %rax, %rcx
movq %r13, 0x38(%rsp)
jge 0x4181a
movslq %edx, %rax
movq 0x18(%rsp), %rcx
leaq (%rcx,%rax,8), %rbp
movl %edx, 0x14(%rsp)
movq 0x48(%rsp), %rax
movq (%rax), %rdi
leal -0x501c50(%r13), %r14d
leaq 0x8(%rsp), %rsi
movq 0x60(%rsp), %r12
movl %r12d, %edx
movl %r14d, %ecx
callq 0x3025c
movq 0x50(%rsp), %rax
movq (%rax), %rdi
leaq 0x28(%rsp), %r15
movq %r15, %rsi
movl %r12d, %edx
movl %r14d, %ecx
callq 0x3025c
movq (%rbx), %rdi
callq 0x12df0
movq %rax, %r14
movq (%rbx), %rax
movl $0x2, 0x10(%rax)
movl 0x1407140(%r14,%r12,4), %ecx
movl %ecx, 0x1407140(%rax)
movl (%r14,%r13,4), %ecx
movl %ecx, 0x1407144(%rax)
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
movq 0x58(%rsp), %rdx
movq 0x40(%rsp), %rax
callq *(%rax)
movq %rax, (%rbp)
movl 0x10(%r14), %eax
movq (%rbx), %rcx
movl %eax, 0x10(%rcx)
movl 0x1407140(%r14), %eax
movl %eax, 0x1407140(%rcx)
movl 0x1407144(%r14), %eax
movl %eax, 0x1407144(%rcx)
movq %r14, %rdi
callq 0x13765
movq 0x20(%rsp), %rdi
movl $0x1, %esi
movl $0x3e9, %edx            # imm = 0x3E9
xorl %eax, %eax
callq 0x39a80
testl %eax, %eax
jne 0x417fa
movq 0x8(%rsp), %rdi
callq 0x2f616
movq 0x28(%rsp), %rdi
callq 0x2f616
movq (%rbx), %rax
incq %r13
leal -0x501c50(%r13), %ecx
addq $0x8, %rbp
movl 0x14(%rsp), %edx
incl %edx
cmpl %ecx, 0x10(%rax)
jg 0x41718
movq (%rbx), %rax
movslq 0x10(%rax), %rax
movq 0x38(%rsp), %r13
incq %r13
movq 0x30(%rsp), %rcx
cmpq %rax, %rcx
jl 0x416ea
movq 0x18(%rsp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq