// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/tests.c
// Function: signed_rank_test
int signed_rank_test(char **files, int *which, double confidence, double *real_confidence)
{
 /*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.*/
 int i, counts[2], *iterator, count, total;
 double** observations, ranksum, current;
 Obs *obs = NULL;
 observations = read_observations_for_two_file(files, counts);
 if (!observations)
  {
   *real_confidence = 0.5;
   return 0;
  }
 if (counts[0] != counts[1])
  {
   printf(m1315);
   free_2d((void**)observations, 2);
   return 0;
  }
 obs = (Obs *)safemalloc(counts[0] * sizeof(Obs), "wilcoxon", 7);
 for (i = 0; i < counts[0]; i++)
  {
   obs[i].observation = fabs(observations[0][i] - observations[1][i]);
   obs[i].index = i;
   if (observations[0][i] > observations[1][i])
     obs[i].observation_no = 1;
   else
     obs[i].observation_no = -1;
   obs[i].rij = 0;
  }
 free_2d((void**)observations, 2);
 qsort(obs, counts[0], sizeof(Obs), sort_function_observation_ascending);
 assign_ranks_to_observations(obs, counts[0]);
 ranksum = 0;
 for (i = 0; i < counts[0]; i++)
   if (obs[i].observation_no == 1)
     ranksum += obs[i].rij;
 iterator = first_iterator(counts[0]);
 count = 0;
 total = 0;
 do{
   current = 0;
   for (i = 0; i < counts[0]; i++)
     if (iterator[i])
       current += obs[i].rij;
   total++;
   if (ranksum > current)
     count++;
 }while (next_iterator(iterator, counts[0], 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
  {
   (*real_confidence) = count / (total + 0.0);
   if ((*real_confidence) < confidence)
     return 0;
   else
     return 1;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movsd %xmm0, 0x10(%rsp)
leaq 0x18(%rsp), %rsi
callq 0x89dc2
testq %rax, %rax
je 0x8eb80
movq %rax, %r12
movslq 0x18(%rsp), %r14
cmpl 0x1c(%rsp), %r14d
jne 0x8eb8f
movq %r14, %rdi
shlq $0x5, %rdi
leaq 0x13267(%rip), %rsi     # 0xa1d77
pushq $0x7
popq %rdx
callq 0x34f59
xorl %ecx, %ecx
testl %r14d, %r14d
movl $0x0, %r13d
cmovgl %r14d, %r13d
movq %rax, %r15
addq $0x18, %rax
movapd 0x76aa(%rip), %xmm0     # 0x961e0
cmpq %rcx, %r13
je 0x8ebb7
movq (%r12), %rdx
movq 0x8(%r12), %rsi
movsd (%rdx,%rcx,8), %xmm1
subsd (%rsi,%rcx,8), %xmm1
andpd %xmm0, %xmm1
movlpd %xmm1, -0x10(%rax)
movl %ecx, (%rax)
movsd (%rdx,%rcx,8), %xmm1
xorl %edx, %edx
ucomisd (%rsi,%rcx,8), %xmm1
seta %dl
leal -0x1(,%rdx,2), %edx
movl %edx, -0x18(%rax)
andq $0x0, -0x8(%rax)
incq %rcx
addq $0x20, %rax
jmp 0x8eb36
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
jmp 0x8eba6
leaq 0x13337(%rip), %rdi     # 0xa1ecd
callq 0x4090
pushq $0x2
popq %rsi
movq %r12, %rdi
callq 0x34fc3
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x2
popq %rsi
movq %r12, %rdi
callq 0x34fc3
leaq -0x597d0(%rip), %rcx    # 0x353f9
pushq $0x20
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x4240
movq %r15, %rdi
movl %r14d, %esi
callq 0x89558
movq %r13, %rax
shlq $0x5, %rax
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x8ec1a
cmpl $0x1, (%r15,%rcx)
jne 0x8ec14
movsd 0x8(%rsp), %xmm0
addsd 0x10(%r15,%rcx), %xmm0
movsd %xmm0, 0x8(%rsp)
addq $0x20, %rcx
jmp 0x8ebf5
movq %rbx, 0x20(%rsp)
movl %r14d, %edi
callq 0x3463b
movq %rax, %r12
shlq $0x2, %r13
xorl %ebx, %ebx
xorl %ebp, %ebp
xorpd %xmm0, %xmm0
xorl %eax, %eax
cmpq %rax, %r13
je 0x8ec51
cmpl $0x0, (%r12,%rax)
je 0x8ec4b
addsd 0x10(%r15,%rax,8), %xmm0
addq $0x4, %rax
jmp 0x8ec38
incl %ebp
xorl %eax, %eax
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
seta %al
addl %eax, %ebx
movq %r12, %rdi
movl %r14d, %esi
pushq $0x1
popq %rdx
callq 0x34ae8
testl %eax, %eax
jne 0x8ec32
movq %r15, %rdi
callq 0x34ff7
leaq 0xd95a(%rip), %rdi      # 0x9c5df
callq 0x4cd35
cvtsi2sd %ebx, %xmm0
cvtsi2sd %ebp, %xmm1
divsd %xmm1, %xmm0
movq 0x20(%rsp), %rcx
movsd %xmm0, (%rcx)
cmpl $0x2, %eax
jne 0x8ecec
movsd 0x6874(%rip), %xmm1     # 0x95520
movsd 0x10(%rsp), %xmm2
addsd %xmm2, %xmm1
mulsd 0x7062(%rip), %xmm1     # 0x95d20
ucomisd %xmm0, %xmm1
jbe 0x8ece4
movsd 0x6854(%rip), %xmm1     # 0x95520
subsd %xmm2, %xmm1
mulsd 0x7048(%rip), %xmm1     # 0x95d20
xorl %eax, %eax
ucomisd %xmm1, %xmm0
ja 0x8eba8
pushq $0x1
popq %rax
jmp 0x8eba8
xorl %eax, %eax
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
setbe %al
jmp 0x8eba8