// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %rdx, %rbx
movsd %xmm0, 0x40(%rsp)
movq %rsi, %r12
leaq 0x20(%rsp), %rsi
callq 0x95b63
testq %rax, %rax
je 0x96c00
movq %rax, %r15
movslq 0x20(%rsp), %r14
cmpl 0x24(%rsp), %r14d
jne 0x96c0f
movq %r12, 0x8(%rsp)
movq %rbx, 0x28(%rsp)
leaq (,%r14,8), %rdi
leaq 0x1830a(%rip), %rbx     # 0xaecd3
movq %rbx, %rsi
movl $0x10, %edx
callq 0x390f5
movq %rax, %r12
movl %r14d, %eax
shrl $0x1f, %eax
addl %r14d, %eax
sarl %eax
movl %eax, 0x1c(%rsp)
movslq %eax, %r13
shlq $0x3, %r13
movq %r13, %rdi
movq %rbx, %rsi
movl $0x11, %edx
callq 0x390f5
movq %rax, 0x38(%rsp)
movq %r13, %rdi
movq %rbx, %rsi
movl $0x12, %edx
callq 0x390f5
movq %rax, 0x30(%rsp)
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
testl %r14d, %r14d
jle 0x96aa3
xorl %ebx, %ebx
leaq 0xebf2(%rip), %r13      # 0xa5621
movsd %xmm0, (%rsp)
movsd %xmm1, 0x10(%rsp)
movq (%r15), %rax
movq 0x8(%r15), %rcx
movsd (%rax,%rbx,8), %xmm0
subsd (%rcx,%rbx,8), %xmm0
movsd %xmm0, (%r12,%rbx,8)
movq %r14, %rbp
leaq 0x1(%rbx), %r14
leaq 0xbd51(%rip), %rdi      # 0xa27b0
movl %r14d, %esi
movl $0x1, %edx
movq %r13, %rcx
movb $0x1, %al
callq 0x32c64
movsd 0x10(%rsp), %xmm1
movsd (%r12,%rbx,8), %xmm0
addsd %xmm0, %xmm1
mulsd %xmm0, %xmm0
movsd (%rsp), %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, (%rsp)
movsd (%rsp), %xmm0
movq %r14, %rbx
cmpq %r14, %rbp
movq %rbp, %r14
jne 0x96a2f
movsd %xmm0, (%rsp)
xorl %eax, %eax
movsd %xmm1, 0x10(%rsp)
ucomisd 0xc250(%rip), %xmm1     # 0xa2d08
setbe %al
incl %eax
movq 0x8(%rsp), %rbx
movl %eax, (%rbx)
leaq 0x11f71(%rip), %rdi     # 0xa8a3c
callq 0x536e7
testl %eax, %eax
jne 0x96add
movl $0x3, %eax
subl (%rbx), %eax
movl %eax, (%rbx)
xorpd %xmm4, %xmm4
cmpl $0x2, %r14d
movl 0x1c(%rsp), %r13d
movq 0x38(%rsp), %rbx
movq 0x30(%rsp), %rbp
jl 0x96b53
movl %r13d, %eax
movq %r12, %rcx
addq $0x8, %rcx
xorl %edx, %edx
movsd 0xc20e(%rip), %xmm0     # 0xa2d18
movsd -0x8(%rcx), %xmm1
addsd (%rcx), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rbx,%rdx,8)
movsd -0x8(%rcx), %xmm2
movsd (%rcx), %xmm3
subsd %xmm1, %xmm2
subsd %xmm1, %xmm3
mulsd %xmm3, %xmm3
mulsd %xmm2, %xmm2
addsd %xmm3, %xmm2
movsd %xmm2, (%rbp,%rdx,8)
addsd %xmm2, %xmm4
incq %rdx
addq $0x10, %rcx
cmpq %rdx, %rax
jne 0x96b0a
addsd %xmm4, %xmm4
movsd %xmm4, 0x8(%rsp)
movq %r15, %rdi
movl $0x2, %esi
callq 0x3915f
movq %r12, %rdi
callq 0x39194
movq %rbx, %rdi
callq 0x39194
movq %rbp, %rdi
callq 0x39194
movsd 0x8(%rsp), %xmm1
xorl %ebx, %ebx
ucomisd 0xc17a(%rip), %xmm1     # 0xa2d08
jne 0x96b96
jnp 0x96c2a
movsd (%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movl %r14d, %edi
movl %r13d, %esi
callq 0x1faa9
movsd 0xb969(%rip), %xmm1     # 0xa2520
subsd %xmm0, %xmm1
movq %r14, %r15
movq 0x28(%rsp), %r14
movsd %xmm1, (%r14)
leaq 0x12a20(%rip), %rdi     # 0xa95ef
callq 0x5341c
movl %eax, %ebp
movsd 0xb942(%rip), %xmm0     # 0xa2520
subsd 0x40(%rsp), %xmm0
movl %r15d, %edi
movl %r13d, %esi
callq 0x1fd87
cmpl $0x2, %ebp
jne 0x96c3b
xorl %ebx, %ebx
ucomisd (%rsp), %xmm0
setbe %bl
jmp 0x96c2a
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
jmp 0x96c28
leaq 0x182df(%rip), %rdi     # 0xaeef5
callq 0x4090
movq %r15, %rdi
movl $0x2, %esi
callq 0x3915f
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
ucomisd (%rsp), %xmm0
ja 0x96c2a
movl $0x1, %ebx
xorpd %xmm0, %xmm0
ucomisd 0x10(%rsp), %xmm0
jbe 0x96c2a
movsd 0xb8c5(%rip), %xmm0     # 0xa2520
subsd (%r14), %xmm0
movsd %xmm0, (%r14)
jmp 0x96c28