// File: /workspace/github_c_makefile_star2_O1/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 0x95b63
testq %rax, %rax
je 0x9aaa3
movq %rax, %r12
movl 0x8(%rsp), %r14d
cmpl 0xc(%rsp), %r14d
jne 0x9aab2
movq %rbx, 0x10(%rsp)
movslq %r14d, %rdi
shlq $0x3, %rdi
leaq 0x14444(%rip), %rsi     # 0xaed87
movl $0xf, %edx
callq 0x390f5
movq %rax, %r15
testl %r14d, %r14d
jle 0x9a978
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 0x9a960
movq %r12, %rdi
movl $0x2, %esi
callq 0x3915f
movq %r15, %rdi
movl %r14d, %esi
callq 0x37ae1
cvtsi2sd %r14d, %xmm1
movsd %xmm1, 0x18(%rsp)
divsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movl %r14d, %edi
callq 0x38632
movq %rax, %r12
movl %r14d, %ebx
xorl %r13d, %r13d
movapd 0x8822(%rip), %xmm2     # 0xa31e0
movapd 0x880a(%rip), %xmm3     # 0xa31d0
xorl %ebp, %ebp
xorpd %xmm0, %xmm0
testl %r14d, %r14d
jle 0x9a9f6
xorl %eax, %eax
cmpl $0x0, (%r12,%rax,4)
movsd (%r15,%rax,8), %xmm1
je 0x9a9e6
andpd %xmm2, %xmm1
jmp 0x9a9ea
orpd %xmm3, %xmm1
addsd %xmm1, %xmm0
incq %rax
cmpq %rax, %rbx
jne 0x9a9d3
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 0x38bb6
movapd 0x87a8(%rip), %xmm3     # 0xa31d0
movapd 0x87b0(%rip), %xmm2     # 0xa31e0
testl %eax, %eax
jne 0x9a9c8
leaq 0xebb4(%rip), %rdi      # 0xa95ef
callq 0x5341c
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 0x9aadc
movsd 0x7ab7(%rip), %xmm1     # 0xa2520
movsd (%rsp), %xmm2
addsd %xmm2, %xmm1
mulsd 0x829e(%rip), %xmm1     # 0xa2d18
ucomisd %xmm0, %xmm1
jbe 0x9aa9c
movsd 0x7a98(%rip), %xmm1     # 0xa2520
subsd %xmm2, %xmm1
mulsd 0x8284(%rip), %xmm1     # 0xa2d18
xorl %eax, %eax
ucomisd %xmm1, %xmm0
ja 0x9aacd
movl $0x1, %eax
jmp 0x9aacd
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
jmp 0x9aacb
leaq 0x1443c(%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
xorl %eax, %eax
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
setbe %al
jmp 0x9aacd