// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movl %edx, 0x14(%rsp)
movl %esi, %ebx
movq %rdi, 0x18(%rsp)
leaq 0x16ed4(%rip), %rdi     # 0xa2928
callq 0x534b6
movsd %xmm0, (%rsp)
movslq %ebx, %r12
leaq (,%r12,8), %rdi
leaq 0x22c4a(%rip), %r13     # 0xae6ba
movq %r13, %rsi
movl $0x4, %edx
callq 0x390f5
movq %rax, %r15
shlq $0x2, %r12
movq %r12, %rdi
movq %r13, %rsi
movl $0x5, %edx
callq 0x390f5
movq %rax, %r12
movl $0x10, %edi
movq %r13, %rsi
movl %ebx, %r13d
movl $0x6, %edx
callq 0x390f5
movq %rax, 0x8(%rsp)
movl %ebx, %ebx
testl %r13d, %r13d
jle 0x8bae3
xorl %r14d, %r14d
movq 0x18(%rsp), %rbp
movl %r14d, (%r12,%r14,4)
movq %rbp, %rdi
movl $0x1, %esi
callq 0x8bbed
movsd %xmm0, (%r15,%r14,8)
incq %r14
addq $0x8, %rbp
cmpq %r14, %rbx
jne 0x8bac0
movq %r15, %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0x39864
movl (%r12), %ebp
cmpl $0x2, %r13d
jl 0x8bb9f
decl %r13d
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x16a05(%rip), %xmm0    # 0xa2520
subsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movl $0x1, %r14d
movq %rbx, 0x20(%rsp)
movslq (%r12,%r14,4), %rax
cmpl %eax, %ebp
jle 0x8bb97
movq 0x8(%rsp), %rbx
movq (%rbx), %rdi
movq %r15, %r13
movl %ebp, %r15d
movq 0x18(%rsp), %rbp
movq (%rbp,%rax,8), %rsi
callq 0x3a404
movq %rax, (%rbx)
movq 0x8(%rbx), %rdi
movslq (%r12), %rax
movq (%rbp,%rax,8), %rsi
movl %r15d, %ebp
movq %r13, %r15
callq 0x3a404
movq %rax, 0x8(%rbx)
movl 0x14(%rsp), %edi
movq %rbx, %rsi
movq 0x20(%rsp), %rbx
leaq 0x2c(%rsp), %rdx
movsd (%rsp), %xmm0
leaq 0x30(%rsp), %rcx
callq 0x8b74b
testl %eax, %eax
je 0x8bbcc
incq %r14
cmpq %r14, %rbx
jne 0x8bb2f
movq %r15, %rdi
callq 0x39194
movq %r12, %rdi
callq 0x39194
movq 0x8(%rsp), %rdi
callq 0x39194
incl %ebp
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x39194
movq %r12, %rdi
callq 0x39194
movq 0x8(%rsp), %rdi
callq 0x39194
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x8bbbb