// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/tests.c
// Function: permutation_test_paired
int permutation_test_paired(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], count, total;
 double **observations, *difference, mean, current;
 int* iterator;
 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;
  }
 difference = (double *)safemalloc(counts[0] * sizeof(double), "permutation_test_paired", 15);
 for (i = 0; i < counts[0]; i++)
   difference[i] = observations[0][i] - observations[1][i];
 free_2d((void**)observations, 2);
 mean = sum_of_list_double(difference, counts[0]) / counts[0];
 iterator = first_iterator(counts[0]);
 count = 0;
 total = 0;
 do{
   current = 0;
   for (i = 0; i < counts[0]; i++)
     if (iterator[i])
       current += fabs(difference[i]);
     else
       current += -fabs(difference[i]);
   total++;
   if (mean > current / counts[0])
     count++;
 }while (next_iterator(iterator, counts[0], 1));
 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, (%rsp)
leaq 0x8(%rsp), %rsi
callq 0x98796
testq %rax, %rax
je 0x9da35
movq %rax, %r12
movl 0x8(%rsp), %r14d
cmpl 0xc(%rsp), %r14d
jne 0x9da44
movq %rbx, 0x10(%rsp)
movslq %r14d, %rdi
shlq $0x3, %rdi
leaq 0x14532(%rip), %rsi     # 0xb1e07
movl $0xf, %edx
callq 0x3a0e1
movq %rax, %r15
testl %r14d, %r14d
jle 0x9d90a
movq (%r12), %rax
movq 0x8(%r12), %rcx
xorl %edx, %edx
movsd (%rax,%rdx,8), %xmm0
subsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, (%r15,%rdx,8)
incq %rdx
cmpq %rdx, %r14
jne 0x9d8f2
movq %r12, %rdi
movl $0x2, %esi
callq 0x3a14b
movq %r15, %rdi
movl %r14d, %esi
callq 0x38677
cvtsi2sd %r14d, %xmm1
movsd %xmm1, 0x18(%rsp)
divsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movl %r14d, %edi
callq 0x3930e
movq %rax, %r12
movl %r14d, %ebx
xorl %r13d, %r13d
movapd 0x8890(%rip), %xmm2     # 0xa61e0
movapd 0x8878(%rip), %xmm3     # 0xa61d0
xorl %ebp, %ebp
xorpd %xmm0, %xmm0
testl %r14d, %r14d
jle 0x9d988
xorl %eax, %eax
cmpl $0x0, (%r12,%rax,4)
movsd (%r15,%rax,8), %xmm1
je 0x9d978
andpd %xmm2, %xmm1
jmp 0x9d97c
orpd %xmm3, %xmm1
addsd %xmm1, %xmm0
incq %rax
cmpq %rax, %rbx
jne 0x9d965
incl %r13d
divsd 0x18(%rsp), %xmm0
xorl %eax, %eax
movsd 0x20(%rsp), %xmm1
ucomisd %xmm0, %xmm1
seta %al
addl %eax, %ebp
movq %r12, %rdi
movl %r14d, %esi
movl $0x1, %edx
callq 0x3991a
movapd 0x8816(%rip), %xmm3     # 0xa61d0
movapd 0x881e(%rip), %xmm2     # 0xa61e0
testl %eax, %eax
jne 0x9d95a
leaq 0xecee(%rip), %rdi      # 0xac6bb
callq 0x54920
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r13d, %xmm1
divsd %xmm1, %xmm0
movq 0x10(%rsp), %rcx
movsd %xmm0, (%rcx)
cmpl $0x2, %eax
jne 0x9da6e
movsd 0x7b25(%rip), %xmm1     # 0xa5520
movsd (%rsp), %xmm2
addsd %xmm2, %xmm1
mulsd 0x830c(%rip), %xmm1     # 0xa5d18
ucomisd %xmm0, %xmm1
jbe 0x9da2e
movsd 0x7b06(%rip), %xmm1     # 0xa5520
subsd %xmm2, %xmm1
mulsd 0x82f2(%rip), %xmm1     # 0xa5d18
xorl %eax, %eax
ucomisd %xmm1, %xmm0
ja 0x9da5f
movl $0x1, %eax
jmp 0x9da5f
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
jmp 0x9da5d
leaq 0x1452a(%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
xorl %eax, %eax
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
setbe %al
jmp 0x9da5f