// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x34(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
leaq 0xa5b6b(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x10(%rax), %eax
leaq 0xa5b5e(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
imull %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movslq %eax, %rdi
shlq $0x3, %rdi
leaq 0x870c2(%rip), %rsi     # 0xe6dc6
movl $0x2, %edx
callq 0x52d70
movq %rax, -0x40(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
leaq 0xa5b1d(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0x5feb8
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
leaq 0xa5afe(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0x5fea8
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0x2c(%rbp), %edx
movl -0x30(%rbp), %ecx
leaq -0x48(%rbp), %rsi
callq 0x457d0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x2c(%rbp), %edx
movl -0x30(%rbp), %ecx
leaq -0x50(%rbp), %rsi
callq 0x457d0
leaq 0xa5abf(%rip), %rax     # 0x105840
movq (%rax), %rdi
callq 0x1aa40
movq %rax, -0x28(%rbp)
leaq 0xa5aac(%rip), %rax     # 0x105840
movq (%rax), %rax
movl $0x2, 0x10(%rax)
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl 0x1407140(%rax,%rcx,4), %ecx
leaq 0xa5a8c(%rip), %rax     # 0x105840
movq (%rax), %rax
movl %ecx, 0x1407140(%rax)
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl 0x1407140(%rax,%rcx,4), %ecx
leaq 0xa5a6d(%rip), %rax     # 0x105840
movq (%rax), %rax
movl %ecx, 0x1407144(%rax)
movl -0x14(%rbp), %eax
subl $0x3e8, %eax            # imm = 0x3E8
movslq %eax, %rcx
leaq 0xa43a2(%rip), %rax     # 0x104190
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x20(%rbp), %rdx
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq *%rax
movq %rax, %rdx
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %ecx
leaq 0xa5a1d(%rip), %rax     # 0x105840
movq (%rax), %rax
movl %ecx, 0x10(%rax)
movq -0x28(%rbp), %rax
movl 0x1407140(%rax), %ecx
leaq 0xa5a06(%rip), %rax     # 0x105840
movq (%rax), %rax
movl %ecx, 0x1407140(%rax)
movq -0x28(%rbp), %rax
movl 0x1407144(%rax), %ecx
leaq 0xa59ec(%rip), %rax     # 0x105840
movq (%rax), %rax
movl %ecx, 0x1407144(%rax)
movq -0x28(%rbp), %rdi
callq 0x1b710
movl -0x14(%rbp), %edi
movl $0x1, %esi
movl $0x3e9, %edx            # imm = 0x3E9
movb $0x0, %al
callq 0x53e40
cmpl $0x0, %eax
jne 0x5fe91
movq -0x48(%rbp), %rdi
callq 0x44510
movq -0x50(%rbp), %rdi
callq 0x44510
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x5fd38
jmp 0x5feaa
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x5fd19
movq -0x40(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)