// File: /workspace/github_c_makefile_star2_O2/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 0x89dc2
testq %rax, %rax
je 0x8e769
movq %rax, %r12
movslq 0x8(%rsp), %r14
cmpl 0xc(%rsp), %r14d
jne 0x8e778
leaq (,%r14,8), %rdi
leaq 0x13633(%rip), %rsi     # 0xa1d5f
pushq $0xf
popq %rdx
callq 0x34f59
movq %rax, %r15
xorl %eax, %eax
testl %r14d, %r14d
movl $0x0, %r13d
cmovgl %r14d, %r13d
cmpq %rax, %r13
je 0x8e7a0
movq (%r12), %rcx
movq 0x8(%r12), %rdx
movsd (%rcx,%rax,8), %xmm0
subsd (%rdx,%rax,8), %xmm0
movsd %xmm0, (%r15,%rax,8)
incq %rax
jmp 0x8e746
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
jmp 0x8e78f
leaq 0x1374e(%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
movq %rbx, 0x10(%rsp)
pushq $0x2
popq %rsi
movq %r12, %rdi
callq 0x34fc3
movq %r15, %rdi
movl %r14d, %esi
callq 0x33c3e
cvtsi2sd %r14d, %xmm1
movsd %xmm1, 0x18(%rsp)
divsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movl %r14d, %edi
callq 0x3463b
movq %rax, %r12
xorl %ebx, %ebx
movapd 0x79fb(%rip), %xmm2     # 0x961e0
movapd 0x79e3(%rip), %xmm3     # 0x961d0
xorl %ebp, %ebp
xorpd %xmm0, %xmm0
xorl %eax, %eax
cmpq %rax, %r13
je 0x8e81a
cmpl $0x0, (%r12,%rax,4)
movsd (%r15,%rax,8), %xmm1
je 0x8e80d
andpd %xmm2, %xmm1
jmp 0x8e811
orpd %xmm3, %xmm1
addsd %xmm1, %xmm0
incq %rax
jmp 0x8e7f5
incl %ebx
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
pushq $0x1
popq %rdx
callq 0x34ae8
movapd 0x7987(%rip), %xmm3     # 0x961d0
movapd 0x798f(%rip), %xmm2     # 0x961e0
testl %eax, %eax
jne 0x8e7ef
leaq 0xdd83(%rip), %rdi      # 0x9c5df
callq 0x4cd35
cvtsi2sd %ebp, %xmm0
cvtsi2sd %ebx, %xmm1
divsd %xmm1, %xmm0
movq 0x10(%rsp), %rcx
movsd %xmm0, (%rcx)
cmpl $0x2, %eax
jne 0x8e8c2
movsd 0x6c9d(%rip), %xmm1     # 0x95520
movsd (%rsp), %xmm2
addsd %xmm2, %xmm1
mulsd 0x748c(%rip), %xmm1     # 0x95d20
ucomisd %xmm0, %xmm1
jbe 0x8e8ba
movsd 0x6c7e(%rip), %xmm1     # 0x95520
subsd %xmm2, %xmm1
mulsd 0x7472(%rip), %xmm1     # 0x95d20
xorl %eax, %eax
ucomisd %xmm1, %xmm0
ja 0x8e791
pushq $0x1
popq %rax
jmp 0x8e791
xorl %eax, %eax
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
setbe %al
jmp 0x8e791