// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/metaclassification.c
// Function: test_one_vs_one
Prediction test_one_vs_one(Instanceptr data, void** model, int algorithm, void* parameters, double* posterior)
{
 int i, j, k = 0, *votes, tmp;
 Prediction result, prediction;
 double* tmp_posteriors;
 tmp_posteriors = safemalloc(current_dataset->classno * sizeof(double), "test_one_vs_one", 3);
 votes = safecalloc(current_dataset->classno, sizeof(int), "test_one_vs_one", 4);
 tmp = current_dataset->classno;
 for (i = 0; i < current_dataset->classno; i++)
   for (j = i + 1; j < current_dataset->classno; j++)
    {
     current_dataset->classno = 2;
     prediction = classification_algorithms[algorithm - SELECTMAX].test_algorithm(data, model[k], parameters, tmp_posteriors);
     current_dataset->classno = tmp;
     if (prediction.classno == 0)
       votes[i]++;
     else
       votes[j]++;
     k++;
    }
 safe_free(tmp_posteriors);
 result.classno = find_max_in_list(votes, current_dataset->classno);
 normalize_array(votes, posterior, current_dataset->classno);
 safe_free(votes);
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, 0x18(%rsp)
movq %r8, %r12
movl %ecx, %ebx
movq %rdx, 0x28(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdi, 0x20(%rsp)
leaq 0x92c83(%rip), %r14     # 0xd5870
movq (%r14), %rax
movslq 0x10(%rax), %rdi
shlq $0x3, %rdi
leaq 0x676b9(%rip), %rbp     # 0xaa2b8
movq %rbp, %rsi
movl $0x3, %edx
callq 0x3a0e1
movq %rax, 0x8(%rsp)
movq (%r14), %rax
movslq 0x10(%rax), %rdi
movl $0x4, %esi
movq %rbp, %rdx
movl $0x4, %ecx
callq 0x3a1fc
movq %rax, %r13
movq (%r14), %rax
movl 0x10(%rax), %esi
testl %esi, %esi
jle 0x42d35
addl $0xfffffc18, %ebx       # imm = 0xFFFFFC18
movslq %ebx, %rcx
leaq (%rcx,%rcx,4), %rcx
leaq 0x91571(%rip), %rdx     # 0xd41c0
leaq (%rdx,%rcx,8), %r9
addq $0x8, %r9
xorl %r10d, %r10d
movl $0x1, %r8d
leaq 0x50(%rsp), %rdi
movl %esi, %ecx
xorl %ebx, %ebx
movq %r12, 0x40(%rsp)
movq %r13, 0x10(%rsp)
movq %r10, %r15
incq %r10
movslq %ecx, %rdx
cmpq %rdx, %r10
jge 0x42d29
movq %r10, 0x30(%rsp)
addq $0x10, %rax
movslq %ebx, %rcx
movq 0x28(%rsp), %rdx
leaq (%rdx,%rcx,8), %rbp
movq %r8, 0x38(%rsp)
movq %r8, %r14
movq %rax, %rdx
movl %ebx, 0x4(%rsp)
movl $0x2, (%rdx)
movq (%rbp), %rdx
movl %esi, %ebx
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rcx
movq %rdi, %r12
movq 0x8(%rsp), %r8
movq %r9, %r13
callq *(%r9)
movq %r12, %rdi
movq %r13, %r9
movl %ebx, %esi
movl 0x4(%rsp), %ebx
leaq 0x92b90(%rip), %rax     # 0xd5870
movq (%rax), %rax
leaq 0x10(%rax), %rdx
cmpl $0x0, 0x58(%rsp)
movl %esi, 0x10(%rax)
movq %r14, %rcx
cmoveq %r15, %rcx
movq 0x10(%rsp), %r8
incl (%r8,%rcx,4)
incq %r14
movl 0x10(%rax), %ecx
addq $0x8, %rbp
incl %ebx
cmpl %r14d, %ecx
jg 0x42ca5
movslq %ecx, %rdx
leaq 0x92b56(%rip), %r14     # 0xd5870
movq 0x10(%rsp), %r13
movq 0x38(%rsp), %r8
movq 0x30(%rsp), %r10
incq %r8
cmpq %rdx, %r10
jl 0x42c73
movq 0x8(%rsp), %rdi
callq 0x3a180
movq (%r14), %rax
movl 0x10(%rax), %esi
movq %r13, %rdi
callq 0x38002
movq 0x20(%rsp), %rbx
movl %eax, 0x8(%rbx)
movq (%r14), %rax
movl 0x10(%rax), %edx
movq %r13, %rdi
movq 0x18(%rsp), %rsi
callq 0x38540
movq %r13, %rdi
callq 0x3a180
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq