// File: /workspace/github_c_makefile_star2_O3/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, %r13d
movq %rdi, %r12
leaq 0x17735(%rip), %rdi     # 0xa5928
callq 0x549ba
movsd %xmm0, 0x8(%rsp)
movslq %r13d, %r14
leaq (,%r14,8), %rdi
leaq 0x2353a(%rip), %r15     # 0xb174a
movq %r15, %rsi
movl $0x4, %edx
callq 0x3a0e1
movq %rax, %rbx
shlq $0x2, %r14
movq %r14, %rdi
movq %r15, %rsi
movl $0x5, %edx
callq 0x3a0e1
movq %rax, %r14
movl $0x10, %edi
movq %r15, %rsi
movl $0x6, %edx
callq 0x3a0e1
movq %rax, 0x10(%rsp)
testl %r13d, %r13d
jle 0x8e33f
leal -0x1(%r13), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x172ac(%rip), %xmm0    # 0xa5520
subsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movq %r13, 0x20(%rsp)
movl %r13d, %ebp
xorl %r13d, %r13d
movq %r12, 0x8(%rsp)
movl %r13d, (%r14,%r13,4)
movq %r12, %rdi
movl $0x1, %esi
callq 0x8e3a1
movsd %xmm0, (%rbx,%r13,8)
incq %r13
addq $0x8, %r12
cmpq %r13, %rbp
jne 0x8e28e
movq %rbx, %rdi
movq %r14, %rsi
movq 0x20(%rsp), %rdx
callq 0x3a870
movl (%r14), %r15d
cmpl $0x1, %ebp
je 0x8e350
movl $0x1, %r12d
movq %rbx, 0x28(%rsp)
movq 0x8(%rsp), %r13
movslq (%r14,%r12,4), %rax
cmpl %eax, %r15d
jle 0x8e335
movq 0x10(%rsp), %rbx
movq (%rbx), %rdi
movq (%r13,%rax,8), %rsi
callq 0x3b494
movq %rax, (%rbx)
movq 0x8(%rbx), %rdi
movslq (%r14), %rax
movq (%r13,%rax,8), %rsi
callq 0x3b494
movq %rax, 0x8(%rbx)
movl 0x1c(%rsp), %edi
movq %rbx, %rsi
movq 0x28(%rsp), %rbx
leaq 0x3c(%rsp), %rdx
movsd 0x30(%rsp), %xmm0
leaq 0x40(%rsp), %rcx
callq 0x8dee7
testl %eax, %eax
je 0x8e37f
incq %r12
cmpq %r12, %rbp
jne 0x8e2dd
jmp 0x8e350
movq %rbx, %rdi
movq %r14, %rsi
movl %r13d, %edx
callq 0x3a870
movl (%r14), %r15d
movq %rbx, %rdi
callq 0x3a180
movq %r14, %rdi
callq 0x3a180
movq 0x10(%rsp), %rdi
callq 0x3a180
incl %r15d
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x3a180
movq %r14, %rdi
callq 0x3a180
movq 0x10(%rsp), %rdi
callq 0x3a180
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x8e36d