// File: /workspace/github_c_makefile_star2_O1/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 0x95b63
testq %rax, %rax
je 0x9adf2
movq %rax, %r12
movl 0x18(%rsp), %r14d
cmpl 0x1c(%rsp), %r14d
jne 0x9ae01
movslq %r14d, %r13
movq %r13, %rdi
shlq $0x5, %rdi
leaq 0x1408d(%rip), %rsi     # 0xaed9f
movl $0x7, %edx
callq 0x390f5
movq %rax, %r15
testl %r14d, %r14d
jle 0x9ad81
movq (%r12), %rax
movq 0x8(%r12), %rcx
movq %r15, %rdx
addq $0x18, %rdx
xorl %esi, %esi
movapd 0x84a2(%rip), %xmm0     # 0xa31e0
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 0x9ad3e
movq %r12, %rdi
movl $0x2, %esi
callq 0x3915f
leaq -0x61770(%rip), %rcx    # 0x39625
movl $0x20, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x4240
movq %r15, %rdi
movl %r14d, %esi
callq 0x95260
testl %r14d, %r14d
movq %rbx, 0x20(%rsp)
jle 0x9ae2b
movq %r14, %rax
shlq $0x5, %rax
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %ecx, %ecx
cmpl $0x1, (%r15,%rcx)
jne 0x9ade7
movsd 0x8(%rsp), %xmm0
addsd 0x10(%r15,%rcx), %xmm0
movsd %xmm0, 0x8(%rsp)
addq $0x20, %rcx
cmpq %rcx, %rax
jne 0x9adcd
jmp 0x9ae35
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
jmp 0x9ae1a
leaq 0x140ed(%rip), %rdi     # 0xaeef5
callq 0x4090
movq %r12, %rdi
movl $0x2, %esi
callq 0x3915f
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movl %r14d, %edi
callq 0x38632
movq %rax, %r12
movl %r14d, %ebx
shlq $0x2, %rbx
xorl %r13d, %r13d
xorl %ebp, %ebp
xorpd %xmm0, %xmm0
testl %r14d, %r14d
jle 0x9ae6e
xorl %eax, %eax
cmpl $0x0, (%r12,%rax)
je 0x9ae65
addsd 0x10(%r15,%rax,8), %xmm0
addq $0x4, %rax
cmpq %rax, %rbx
jne 0x9ae57
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 0x38bb6
testl %eax, %eax
jne 0x9ae4c
movq %r15, %rdi
callq 0x39194
leaq 0xe74a(%rip), %rdi      # 0xa95ef
callq 0x5341c
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 0x9af15
movsd 0x764d(%rip), %xmm1     # 0xa2520
movsd 0x10(%rsp), %xmm2
addsd %xmm2, %xmm1
mulsd 0x7e33(%rip), %xmm1     # 0xa2d18
ucomisd %xmm0, %xmm1
jbe 0x9af0b
movsd 0x762d(%rip), %xmm1     # 0xa2520
subsd %xmm2, %xmm1
mulsd 0x7e19(%rip), %xmm1     # 0xa2d18
xorl %eax, %eax
ucomisd %xmm1, %xmm0
ja 0x9ae1c
movl $0x1, %eax
jmp 0x9ae1c
xorl %eax, %eax
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
setbe %al
jmp 0x9ae1c