// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/tests.c
// Function: ftest5x2
int ftest5x2(char **files, int *which, double confidence, double *real_confidence)
{
 /*Add divide by 0 check to num/denom */
 /*Last Changed 02.02.2004 added safemalloc*/
 /*Last Changed 16.05.2002*/
 /*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 counts[2], i, df1, df2;
 double **observations, *difference, *variance, *means, num, denom, sum;
 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), "ftest5x2", 16);
 means = (double *)safemalloc((counts[0] / 2) * sizeof(double), "ftest5x2", 17);
 variance = (double *)safemalloc((counts[0] / 2) * sizeof(double), "ftest5x2", 18);
 sum = 0;
 num = 0;
 for (i = 0; i < counts[0]; i++)
  {
   difference[i] = observations[0][i] - observations[1][i];
   write_array_variables("aout", i + 1, 1, "f", difference[i]);
   num += difference[i] * difference[i];
   sum += difference[i];
  }
 if (sum > 0)
   (*which) = 1;
 else
   (*which) = 2;
 if (!get_parameter_o("accuracy")) 
   (*which) = 3 - (*which);    
 denom = 0;
 for (i = 0; i < (counts[0] / 2); i++)
  {
   means[i] = (difference[2 * i] + difference[2 * i + 1]) / 2;
   variance[i] = (difference[2 * i] - means[i]) * (difference[2 * i] - means[i]) + (difference[2 * i + 1] - means[i]) * (difference[2 * i + 1] - means[i]);
   denom += variance[i];
  }
 denom *= 2;
 free_2d((void**)observations, 2);
 safe_free(difference);
 safe_free(means);
 safe_free(variance);
 df1 = counts[0];
 df2 = counts[0] / 2;
 if (denom != 0)
   (*real_confidence) = 1 - f_distribution(num / denom, df1, df2);
 else
   return 0;
 if (get_parameter_i("tailed") == 2)
  {
   if ((num / denom) < f_distribution_inverse(1 - confidence, df1, df2))
     return 0;
   else
     return 1;
  }
 else
	 {
   if ((num / denom) < f_distribution_inverse(1 - confidence, df1, df2))
     return 0;
   else
     if (sum < 0)
      {
       (*real_confidence) = 1 - (*real_confidence);
       return 0;      
      }
     else
       return 1;
		}
 return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %rbx
movsd %xmm0, 0x50(%rsp)
movq %rsi, %r14
leaq 0x28(%rsp), %rsi
callq 0x89dc2
testq %rax, %rax
je 0x8ac5a
movq %rax, %r12
movslq 0x28(%rsp), %rbp
cmpl 0x2c(%rsp), %ebp
jne 0x8ac6c
movq %r14, 0x10(%rsp)
movq %rbx, 0x30(%rsp)
leaq (,%rbp,8), %rdi
leaq 0x1712c(%rip), %r14     # 0xa1cab
pushq $0x10
popq %rdx
movq %r14, %rsi
callq 0x34f59
movq %rax, %r13
pushq $0x2
popq %rcx
movl %ebp, %eax
cltd
idivl %ecx
movl %eax, 0x1c(%rsp)
movslq %eax, %r15
shlq $0x3, %r15
pushq $0x11
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x34f59
movq %rax, 0x40(%rsp)
pushq $0x12
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x34f59
movq %rax, 0x38(%rsp)
xorl %ebx, %ebx
testl %ebp, %ebp
movl $0x0, %r15d
movq %rbp, 0x48(%rsp)
cmovgl %ebp, %r15d
xorpd %xmm0, %xmm0
leaq 0xda15(%rip), %rbp      # 0x985f9
xorpd %xmm2, %xmm2
movsd %xmm0, 0x8(%rsp)
cmpq %rbx, %r15
movsd %xmm2, 0x20(%rsp)
je 0x8ac88
movq (%r12), %rax
movq 0x8(%r12), %rcx
movsd (%rax,%rbx,8), %xmm0
subsd (%rcx,%rbx,8), %xmm0
movsd %xmm0, (%r13,%rbx,8)
leaq 0x1(%rbx), %r14
leaq 0xab8e(%rip), %rdi      # 0x957b0
movl %r14d, %esi
pushq $0x1
popq %rdx
movq %rbp, %rcx
movb $0x1, %al
callq 0x2f310
movsd 0x20(%rsp), %xmm2
movsd (%r13,%rbx,8), %xmm0
addsd %xmm0, %xmm2
mulsd %xmm0, %xmm0
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
movq %r14, %rbx
jmp 0x8abe8
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
jmp 0x8ae03
leaq 0x1725a(%rip), %rdi     # 0xa1ecd
callq 0x4090
pushq $0x2
popq %rsi
movq %r12, %rdi
callq 0x34fc3
jmp 0x8ae03
xorpd %xmm0, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm2
setbe %al
incl %eax
movq 0x10(%rsp), %rbx
movl %eax, (%rbx)
leaq 0x10d87(%rip), %rdi     # 0x9ba2c
callq 0x4cff1
testl %eax, %eax
jne 0x8acb5
pushq $0x3
popq %rax
subl (%rbx), %eax
movl %eax, (%rbx)
xorl %eax, %eax
movl 0x1c(%rsp), %ebp
testl %ebp, %ebp
movl %ebp, %ecx
cmovlel %eax, %ecx
shlq $0x3, %rcx
movsd 0xb052(%rip), %xmm0     # 0x95d20
movq 0x48(%rsp), %r15
movq 0x40(%rsp), %rbx
movq 0x38(%rsp), %r14
xorpd %xmm4, %xmm4
cmpq %rax, %rcx
je 0x8ad2f
movsd (%r13,%rax,2), %xmm1
addsd 0x8(%r13,%rax,2), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rbx,%rax)
movsd (%r13,%rax,2), %xmm2
movsd 0x8(%r13,%rax,2), %xmm3
subsd %xmm1, %xmm2
subsd %xmm1, %xmm3
mulsd %xmm3, %xmm3
mulsd %xmm2, %xmm2
addsd %xmm3, %xmm2
movsd %xmm2, (%r14,%rax)
addsd %xmm2, %xmm4
addq $0x8, %rax
jmp 0x8ace1
addsd %xmm4, %xmm4
movsd %xmm4, 0x10(%rsp)
pushq $0x2
popq %rsi
movq %r12, %rdi
callq 0x34fc3
movq %r13, %rdi
callq 0x34ff7
movq %rbx, %rdi
callq 0x34ff7
movq %r14, %rdi
callq 0x34ff7
movsd 0x10(%rsp), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x8ad72
jnp 0x8ae03
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movl %r15d, %edi
movl %ebp, %esi
callq 0x1db37
movsd 0xa78c(%rip), %xmm1     # 0x95520
subsd %xmm0, %xmm1
movq 0x30(%rsp), %r14
movsd %xmm1, (%r14)
leaq 0x11836(%rip), %rdi     # 0x9c5df
callq 0x4cd35
movl %eax, %ebx
movsd 0xa768(%rip), %xmm0     # 0x95520
subsd 0x50(%rsp), %xmm0
movl %r15d, %edi
movl %ebp, %esi
callq 0x1dde6
cmpl $0x2, %ebx
jne 0x8adda
xorl %eax, %eax
ucomisd 0x8(%rsp), %xmm0
setbe %al
jmp 0x8ae05
ucomisd 0x8(%rsp), %xmm0
ja 0x8ae03
xorpd %xmm0, %xmm0
ucomisd 0x20(%rsp), %xmm0
pushq $0x1
popq %rax
jbe 0x8ae05
movsd 0xa727(%rip), %xmm0     # 0x95520
subsd (%r14), %xmm0
movsd %xmm0, (%r14)
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq