// File: /workspace/github_c_makefile_star2_O3/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 0x98796
testq %rax, %rax
je 0x998bd
movq %rax, %r15
movslq 0x20(%rsp), %r14
cmpl 0x24(%rsp), %r14d
jne 0x998cc
movq %r12, 0x8(%rsp)
movq %rbx, 0x28(%rsp)
leaq (,%r14,8), %rdi
leaq 0x186cd(%rip), %rbx     # 0xb1d53
movq %rbx, %rsi
movl $0x10, %edx
callq 0x3a0e1
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 0x3a0e1
movq %rax, 0x38(%rsp)
movq %r13, %rdi
movq %rbx, %rsi
movl $0x12, %edx
callq 0x3a0e1
movq %rax, 0x30(%rsp)
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
testl %r14d, %r14d
jle 0x99760
xorl %ebx, %ebx
leaq 0xef8d(%rip), %r13      # 0xa8679
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 0xc094(%rip), %rdi      # 0xa57b0
movl %r14d, %esi
movl $0x1, %edx
movq %r13, %rcx
movb $0x1, %al
callq 0x33644
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 0x996ec
movsd %xmm0, (%rsp)
xorl %eax, %eax
movsd %xmm1, 0x10(%rsp)
ucomisd 0xc593(%rip), %xmm1     # 0xa5d08
setbe %al
incl %eax
movq 0x8(%rsp), %rbx
movl %eax, (%rbx)
leaq 0x12380(%rip), %rdi     # 0xabb08
callq 0x54bec
testl %eax, %eax
jne 0x9979a
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 0x99810
movl %r13d, %eax
movq %r12, %rcx
addq $0x8, %rcx
xorl %edx, %edx
movsd 0xc551(%rip), %xmm0     # 0xa5d18
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 0x997c7
addsd %xmm4, %xmm4
movsd %xmm4, 0x8(%rsp)
movq %r15, %rdi
movl $0x2, %esi
callq 0x3a14b
movq %r12, %rdi
callq 0x3a180
movq %rbx, %rdi
callq 0x3a180
movq %rbp, %rdi
callq 0x3a180
movsd 0x8(%rsp), %xmm1
xorl %ebx, %ebx
ucomisd 0xc4bd(%rip), %xmm1     # 0xa5d08
jne 0x99853
jnp 0x998e7
movsd (%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movl %r14d, %edi
movl %r13d, %esi
callq 0x201ed
movsd 0xbcac(%rip), %xmm1     # 0xa5520
subsd %xmm0, %xmm1
movq %r14, %r15
movq 0x28(%rsp), %r14
movsd %xmm1, (%r14)
leaq 0x12e2f(%rip), %rdi     # 0xac6bb
callq 0x54920
movl %eax, %ebp
movsd 0xbc85(%rip), %xmm0     # 0xa5520
subsd 0x40(%rsp), %xmm0
movl %r15d, %edi
movl %r13d, %esi
callq 0x204cb
cmpl $0x2, %ebp
jne 0x998f8
xorl %ebx, %ebx
ucomisd (%rsp), %xmm0
setbe %bl
jmp 0x998e7
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
jmp 0x998e5
leaq 0x186a2(%rip), %rdi     # 0xb1f75
callq 0x4090
movq %r15, %rdi
movl $0x2, %esi
callq 0x3a14b
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 0x998e7
movl $0x1, %ebx
xorpd %xmm0, %xmm0
ucomisd 0x10(%rsp), %xmm0
jbe 0x998e7
movsd 0xbc08(%rip), %xmm0     # 0xa5520
subsd (%r14), %xmm0
movsd %xmm0, (%r14)
jmp 0x998e5