// File: /workspace/github_c_makefile_star2_O1/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, 0x8(%rsp)
movq %r8, 0x40(%rsp)
movl %ecx, %r14d
movq %rdx, 0x18(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdi, 0x10(%rsp)
leaq 0x90ff1(%rip), %rbx     # 0xd2870
movq (%rbx), %rax
movslq 0x10(%rax), %rdi
shlq $0x3, %rdi
leaq 0x65987(%rip), %rbp     # 0xa7218
movq %rbp, %rsi
movl $0x3, %edx
callq 0x390f5
movq %rax, (%rsp)
movq (%rbx), %rax
movslq 0x10(%rax), %rdi
movl $0x4, %esi
movq %rbp, %rdx
movl $0x4, %ecx
callq 0x39210
movq %rax, %r15
movq (%rbx), %rax
movl 0x10(%rax), %r13d
testl %r13d, %r13d
jle 0x419bb
addl $0xfffffc18, %r14d      # imm = 0xFFFFFC18
movslq %r14d, %rax
leaq (%rax,%rax,4), %rax
leaq 0x8f8dd(%rip), %rcx     # 0xd11c0
leaq (%rcx,%rax,8), %r9
addq $0x8, %r9
xorl %eax, %eax
movl $0x1, %r14d
leaq 0x50(%rsp), %r12
xorl %r8d, %r8d
movq %r15, 0x30(%rsp)
movq %rax, %rdx
leaq 0x1(%rax), %rsi
movq (%rbx), %rax
movslq 0x10(%rax), %rcx
movq %rsi, 0x28(%rsp)
cmpq %rcx, %rsi
movq %r14, 0x20(%rsp)
jge 0x4199b
addq $0x10, %rax
movslq %r8d, %rcx
movq 0x18(%rsp), %rsi
leaq (%rsi,%rcx,8), %rbp
movq %rdx, 0x48(%rsp)
movl $0x2, (%rax)
movq (%rbp), %rdx
movq %r12, %rdi
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rcx
movl %r8d, %ebx
movq (%rsp), %r8
movq %r9, %r15
callq *(%r9)
movq 0x48(%rsp), %rdx
movl %ebx, %r8d
movq %r15, %r9
leaq 0x90f08(%rip), %rbx     # 0xd2870
movq 0x30(%rsp), %r15
cmpl $0x0, 0x58(%rsp)
movq (%rbx), %rax
movq %r14, %rcx
cmoveq %rdx, %rcx
movl %r13d, 0x10(%rax)
incl (%r15,%rcx,4)
incq %r14
movq (%rbx), %rcx
leaq 0x10(%rcx), %rax
addq $0x8, %rbp
incl %r8d
cmpl %r14d, 0x10(%rcx)
jg 0x41932
movq (%rbx), %rax
movslq 0x10(%rax), %rax
movq 0x20(%rsp), %r14
incq %r14
movq 0x28(%rsp), %rcx
cmpq %rax, %rcx
movq %rcx, %rax
jl 0x41900
movq (%rsp), %rdi
movq %rbx, %r14
callq 0x39194
movq (%rbx), %rax
movl 0x10(%rax), %esi
movq %r15, %rdi
callq 0x37504
movq 0x10(%rsp), %rbx
movl %eax, 0x8(%rbx)
movq (%r14), %rax
movl 0x10(%rax), %edx
movq %r15, %rdi
movq 0x8(%rsp), %rsi
callq 0x37a34
movq %r15, %rdi
callq 0x39194
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq