// File: /workspace/github_c_makefile_star2_O3/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 0x98796
testq %rax, %rax
je 0x9dd99
movq %rax, %r12
movl 0x18(%rsp), %r14d
cmpl 0x1c(%rsp), %r14d
jne 0x9dda8
movslq %r14d, %r13
movq %r13, %rdi
shlq $0x5, %rdi
leaq 0x1416e(%rip), %rsi     # 0xb1e1f
movl $0x7, %edx
callq 0x3a0e1
movq %rax, %r15
testl %r14d, %r14d
movq %rbx, 0x20(%rsp)
jle 0x9ddd2
movq (%r12), %rax
movq 0x8(%r12), %rcx
movq %r15, %rdx
addq $0x18, %rdx
xorl %esi, %esi
movapd 0x84fa(%rip), %xmm0     # 0xa61e0
movsd (%rax,%rsi,8), %xmm1
subsd (%rcx,%rsi,8), %xmm1
andpd %xmm0, %xmm1
movlpd %xmm1, -0x10(%rdx)
movl %esi, (%rdx)
movsd (%rax,%rsi,8), %xmm1
xorl %edi, %edi
ucomisd (%rcx,%rsi,8), %xmm1
seta %dil
leal -0x1(,%rdi,2), %edi
movl %edi, -0x18(%rdx)
movq $0x0, -0x8(%rdx)
incq %rsi
addq $0x20, %rdx
cmpq %rsi, %r14
jne 0x9dce6
movq %r12, %rdi
movl $0x2, %esi
callq 0x3a14b
leaq -0x6370c(%rip), %rcx    # 0x3a631
movl $0x20, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x4240
movq %r15, %rdi
movl %r14d, %esi
callq 0x97e0c
testl %r14d, %r14d
jle 0x9de01
movq %r14, %rax
shlq $0x5, %rax
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %ecx, %ecx
cmpl $0x1, (%r15,%rcx)
jne 0x9dd8e
movsd 0x8(%rsp), %xmm0
addsd 0x10(%r15,%rcx), %xmm0
movsd %xmm0, 0x8(%rsp)
addq $0x20, %rcx
cmpq %rcx, %rax
jne 0x9dd74
jmp 0x9de0b
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
jmp 0x9ddc1
leaq 0x141c6(%rip), %rdi     # 0xb1f75
callq 0x4090
movq %r12, %rdi
movl $0x2, %esi
callq 0x3a14b
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movl $0x2, %esi
callq 0x3a14b
leaq -0x637b5(%rip), %rcx    # 0x3a631
movl $0x20, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x4240
movq %r15, %rdi
movl %r14d, %esi
callq 0x97e0c
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movl %r14d, %edi
callq 0x3930e
movq %rax, %r12
movl %r14d, %ebx
shlq $0x2, %rbx
xorl %r13d, %r13d
xorl %ebp, %ebp
xorpd %xmm0, %xmm0
testl %r14d, %r14d
jle 0x9de44
xorl %eax, %eax
cmpl $0x0, (%r12,%rax)
je 0x9de3b
addsd 0x10(%r15,%rax,8), %xmm0
addq $0x4, %rax
cmpq %rax, %rbx
jne 0x9de2d
incl %ebp
xorl %eax, %eax
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
seta %al
addl %eax, %r13d
movq %r12, %rdi
movl %r14d, %esi
movl $0x1, %edx
callq 0x3991a
testl %eax, %eax
jne 0x9de22
movq %r15, %rdi
callq 0x3a180
leaq 0xe840(%rip), %rdi      # 0xac6bb
callq 0x54920
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %ebp, %xmm1
divsd %xmm1, %xmm0
movq 0x20(%rsp), %rcx
movsd %xmm0, (%rcx)
cmpl $0x2, %eax
jne 0x9deeb
movsd 0x7677(%rip), %xmm1     # 0xa5520
movsd 0x10(%rsp), %xmm2
addsd %xmm2, %xmm1
mulsd 0x7e5d(%rip), %xmm1     # 0xa5d18
ucomisd %xmm0, %xmm1
jbe 0x9dee1
movsd 0x7657(%rip), %xmm1     # 0xa5520
subsd %xmm2, %xmm1
mulsd 0x7e43(%rip), %xmm1     # 0xa5d18
xorl %eax, %eax
ucomisd %xmm1, %xmm0
ja 0x9ddc3
movl $0x1, %eax
jmp 0x9ddc3
xorl %eax, %eax
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
setbe %al
jmp 0x9ddc3