// File: /workspace/github_c_makefile_star2_O3/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 0x92e7b(%rip), %rbx     # 0xd5870
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 0x6788f(%rip), %rsi     # 0xaa2a7
movl $0x2, %edx
callq 0x3a0e1
movq %rax, 0x18(%rsp)
movq (%rbx), %rax
movl 0x10(%rax), %eax
testl %eax, %eax
jle 0x42ba8
movq 0x20(%rsp), %rcx
addl $0xfffffc18, %ecx       # imm = 0xFFFFFC18
movslq %ecx, %rcx
leaq (%rcx,%rcx,4), %rcx
shlq $0x3, %rcx
addq 0x9155e(%rip), %rcx     # 0xd3fb0
movq %rcx, 0x40(%rsp)
movl $0x501c51, %r13d        # imm = 0x501C51
xorl %edx, %edx
xorl %esi, %esi
movq %rdx, 0x60(%rsp)
incq %rdx
movslq %eax, %rcx
cmpq %rcx, %rdx
jge 0x42b9c
movq %rdx, 0x30(%rsp)
movslq %esi, %rax
movq 0x18(%rsp), %rcx
leaq (%rcx,%rax,8), %rbp
movq %r13, 0x38(%rsp)
movl %esi, 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 0x30b4d
movq 0x50(%rsp), %rax
movq (%rax), %rdi
leaq 0x28(%rsp), %r15
movq %r15, %rsi
movl %r12d, %edx
movl %r14d, %ecx
callq 0x30b4d
movq (%rbx), %rdi
callq 0x12e26
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 0x1376b
movq 0x20(%rsp), %rdi
movl $0x1, %esi
movl $0x3e9, %edx            # imm = 0x3E9
xorl %eax, %eax
callq 0x3aa8c
testl %eax, %eax
jne 0x42b6d
movq 0x8(%rsp), %rdi
callq 0x2ff55
movq 0x28(%rsp), %rdi
callq 0x2ff55
movq (%rbx), %rax
movl 0x10(%rax), %eax
incq %r13
leal -0x501c50(%r13), %ecx
addq $0x8, %rbp
movl 0x14(%rsp), %esi
incl %esi
cmpl %ecx, %eax
jg 0x42a8b
movslq %eax, %rcx
movq 0x38(%rsp), %r13
movq 0x30(%rsp), %rdx
incq %r13
cmpq %rcx, %rdx
jl 0x42a61
movq 0x18(%rsp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq