// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/tests.c
// Function: rank_sum_test
int rank_sum_test(char **files, int *which, double confidence, double *real_confidence)
{
 /*Last Changed 02.02.2004 added safemalloc Added alpha/2 levels*/
 /*One Tailed Test for H0: mu1 <= mu2 H1: mu1 > mu2*/
 /*Two Tailed Test for H0: mu1 = mu2 H1: mu1 != mu2*/
 /*confidence = 0.95 for alpha = 0.05, confidence = 0.99 for alpha = 0.01 etc.*/
 /*Last Changed 30.01.2002*/
 FILE *myfile;
 int i, j, counts[2], k, count, total, *combination;
 double T[2] = {0}, tmp, current;
 Obs *obs;
 for (i = 0; i < 2; i++)
   counts[i] = file_length(files[i]);
 obs = (Obs *)safemalloc((counts[0] + counts[1]) * sizeof(Obs), "rank_sum_test", 7);
 k = 0;
 for (i = 0; i < 2; i++)
  {
   if ((myfile = fopen(files[i], "r")) == NULL)
    {
     printf(m1274, files[i]);
     return 0;
    }
   for (j = 0; j < counts[i]; j++)
    {
     fscanf(myfile, "%lf", &tmp);
     obs[k].observation = tmp;
     obs[k].observation_no = i;
     obs[k].rij = 0;
     obs[k].index = k;
     k++;
    }
   fclose(myfile);
  }
 qsort(obs, k, sizeof(Obs), sort_function_observation_ascending);
 assign_ranks_to_observations(obs, k);
 for (i = 0; i < k; i++)
   T[obs[i].observation_no] += obs[i].rij;
 count = 0;
 total = 0;
 combination = first_combination(counts[0]);
 do{
   current = 0;
   for (i = 0; i < counts[0]; i++)
     current += obs[combination[i]].rij;
   if (T[0] > current)
     count++;
   total++;
 }while (next_combination(combination, counts[0], counts[0] + counts[1] - 1)); 
 safe_free(obs);
 if (get_parameter_i("tailed") == 2)
  {
   (*real_confidence) = count / (total + 0.0);
   if ((*real_confidence) < ((1 + confidence) / 2) && (*real_confidence) > ((1 - confidence) / 2))
     return 0;
   else
     return 1;
  }
 else/*one tailed*/
  {
   (*real_confidence) = count / (total + 0.0);
   if ((*real_confidence) < confidence)
     return 0;
   else
     return 1;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x4050
movl $0x0, -0x34(%rbp)
cmpl $0x2, -0x34(%rbp)
jge 0xd953f
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x50f90
movl %eax, %ecx
movslq -0x34(%rbp), %rax
movl %ecx, -0x40(%rbp,%rax,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd9513
movl -0x40(%rbp), %eax
addl -0x3c(%rbp), %eax
movslq %eax, %rdi
shlq $0x5, %rdi
leaq 0x15028(%rip), %rsi     # 0xee57b
movl $0x7, %edx
callq 0x52d70
movq %rax, -0x88(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x34(%rbp)
cmpl $0x2, -0x34(%rbp)
jge 0xd9685
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xec17(%rip), %rsi      # 0xe81a6
callq 0x40c0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0xd95c4
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x98d9(%rip), %rdi      # 0xe2e8a
movb $0x0, %al
callq 0x4030
movl $0x0, -0x4(%rbp)
jmp 0xd987d
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movslq -0x34(%rbp), %rcx
cmpl -0x40(%rbp,%rcx,4), %eax
jge 0xd966e
movq -0x30(%rbp), %rdi
leaq 0xd1e1(%rip), %rsi      # 0xe67c8
leaq -0x78(%rbp), %rdx
movb $0x0, %al
callq 0x4070
movsd -0x78(%rbp), %xmm0
movq -0x88(%rbp), %rax
movslq -0x44(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movsd %xmm0, 0x8(%rax)
movl -0x34(%rbp), %ecx
movq -0x88(%rbp), %rax
movslq -0x44(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x88(%rbp), %rax
movslq -0x44(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rax)
movl -0x44(%rbp), %ecx
movq -0x88(%rbp), %rax
movslq -0x44(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xd95cb
movq -0x30(%rbp), %rdi
callq 0x4250
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd9572
movq -0x88(%rbp), %rdi
movslq -0x44(%rbp), %rsi
movl $0x20, %edx
leaq -0x8613c(%rip), %rcx    # 0x53560
callq 0x41f0
movq -0x88(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0xd13f0
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0xd9702
movq -0x88(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
movq -0x88(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq (%rax), %rax
addsd -0x70(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x70(%rbp,%rax,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd96b7
movl $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x40(%rbp), %edi
callq 0x51a10
movq %rax, -0x58(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0xd9767
movq -0x88(%rbp), %rax
movq -0x58(%rbp), %rcx
movslq -0x34(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
addsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd972b
movsd -0x70(%rbp), %xmm0
ucomisd -0x80(%rbp), %xmm0
jbe 0xd977c
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movq -0x58(%rbp), %rdi
movl -0x40(%rbp), %esi
movl -0x40(%rbp), %edx
addl -0x3c(%rbp), %edx
subl $0x1, %edx
callq 0x52190
cmpl $0x0, %eax
jne 0xd971c
movq -0x88(%rbp), %rdi
callq 0x52e80
leaq 0xfa8e(%rip), %rdi      # 0xe9244
callq 0x78f10
cmpl $0x2, %eax
jne 0xd983d
cvtsi2sdl -0x48(%rbp), %xmm0
cvtsi2sdl -0x4c(%rbp), %xmm1
xorps %xmm2, %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rax
movsd (%rax), %xmm1
movsd 0x882b(%rip), %xmm0     # 0xe2018
addsd -0x20(%rbp), %xmm0
movsd 0x94a6(%rip), %xmm2     # 0xe2ca0
divsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0xd9834
movq -0x28(%rbp), %rax
movsd (%rax), %xmm0
movsd 0x8804(%rip), %xmm1     # 0xe2018
subsd -0x20(%rbp), %xmm1
movsd 0x947f(%rip), %xmm2     # 0xe2ca0
divsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xd9834
movl $0x0, -0x4(%rbp)
jmp 0xd987d
movl $0x1, -0x4(%rbp)
jmp 0xd987d
cvtsi2sdl -0x48(%rbp), %xmm0
cvtsi2sdl -0x4c(%rbp), %xmm1
xorps %xmm2, %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rax
movsd (%rax), %xmm1
movsd -0x20(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xd9876
movl $0x0, -0x4(%rbp)
jmp 0xd987d
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)