// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/statistics.c
// Function: find_best_classifier
int find_best_classifier(char**files, int filecount, TEST_TYPE testtype)
{
 /*Last Changed 21.10.2004*/
 int i, *indexes, found, best, which, res;
 char **two_file;
 double* means, confidence = 1 - (get_parameter_f("confidencelevel") / (filecount - 1)), conf;
 means = safemalloc(filecount * sizeof(double), "find_best_classifier", 4);
 indexes = safemalloc(filecount * sizeof(int), "find_best_classifier", 5);
 two_file = safemalloc(2 * sizeof(char *), "find_best_classifier", 6);
 for (i = 0; i < filecount; i++)
  {
   indexes[i] = i;
   means[i] = file_mean(&(files[i]), 1);
  }
 sort_two_arrays(means, indexes, filecount);
 found = 0;
 best = indexes[0];
 for (i = 1; i < filecount; i++)
   if (best > indexes[i])
    {
     two_file[0] = strcopy(two_file[0], files[indexes[i]]);
     two_file[1] = strcopy(two_file[1], files[indexes[0]]);
     res = compare_two_files_using_test(testtype, two_file, &which, confidence, &conf);
     if (!res)
      {
       found = 1;
       break;
      }
    }
 safe_free(means);
 safe_free(indexes);
 safe_free(two_file);
 if (!found)
   return best + 1;
 else
   return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, 0x1c(%rsp)
movl %esi, %r14d
movq %rdi, 0x20(%rsp)
leaq 0x1512d(%rip), %rdi     # 0x95928
callq 0x4cdcf
leal -0x1(%r14), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movslq %r14d, %r15
leaq (,%r15,8), %rdi
leaq 0x20e86(%rip), %rbx     # 0xa16aa
pushq $0x4
popq %rdx
movq %rbx, %rsi
callq 0x34f59
movq %rax, 0x8(%rsp)
leaq (,%r15,4), %rdi
pushq $0x5
popq %rdx
movq %rbx, %rsi
callq 0x34f59
movq %rax, %r12
pushq $0x10
popq %rdi
pushq $0x6
popq %rdx
movq %rbx, %rsi
callq 0x34f59
movq %rax, %r13
xorl %ebp, %ebp
movq %r15, 0x30(%rsp)
testl %r15d, %r15d
movl $0x0, %r15d
movq %r14, 0x28(%rsp)
cmovgl %r14d, %r15d
pushq $0x1
popq %rbx
movq 0x20(%rsp), %r14
cmpq %rbp, %r15
je 0x808a2
movl %ebp, (%r12,%rbp,4)
movq %r14, %rdi
movl %ebx, %esi
callq 0x8097f
movq 0x8(%rsp), %rax
movsd %xmm0, (%rax,%rbp,8)
incq %rbp
addq $0x8, %r14
jmp 0x8087c
movsd 0x14c76(%rip), %xmm0    # 0x95520
subsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq 0x28(%rsp), %rdx
callq 0x35617
movl (%r12), %ebp
pushq $0x1
popq %r14
movl 0x1c(%rsp), %r15d
movq 0x20(%rsp), %rbx
cmpq 0x30(%rsp), %r14
jge 0x80933
movslq (%r12,%r14,4), %rax
cmpl %eax, %ebp
jle 0x8092e
movq (%r13), %rdi
movq (%rbx,%rax,8), %rsi
callq 0x3604c
movq %rax, (%r13)
movq 0x8(%r13), %rdi
movslq (%r12), %rax
movq (%rbx,%rax,8), %rsi
callq 0x3604c
movq %rax, 0x8(%r13)
movl %r15d, %edi
movq %r13, %rsi
leaq 0x3c(%rsp), %rdx
movsd 0x10(%rsp), %xmm0
leaq 0x40(%rsp), %rcx
callq 0x80505
testl %eax, %eax
je 0x80951
incq %r14
jmp 0x808da
movq 0x8(%rsp), %rdi
callq 0x34ff7
movq %r12, %rdi
callq 0x34ff7
movq %r13, %rdi
callq 0x34ff7
incl %ebp
jmp 0x8096e
movq 0x8(%rsp), %rdi
callq 0x34ff7
movq %r12, %rdi
callq 0x34ff7
movq %r13, %rdi
callq 0x34ff7
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq