// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/tests.c
// Function: bonferroni
int bonferroni(char **files,int *which,double confidence,double *real_confidence)
{
 /*Last Changed 02.02.2004 added safemalloc*/
 /*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.*/
 /*Last Changed 07.05.2001*/
 int i, j, counts[2], df;
 double means[2], **observations, mse, sse = 0.0, variance, res, upper, lower;
 observations = read_observations_for_two_file(files, counts);
 if (!observations)
  {
   *real_confidence = 0.5;
   return 0;
  }
 for (i = 0; i < 2; i++)
  {
   means[i] = 0.0;
   for (j = 0; j < counts[i]; j++)
     means[i] += observations[i][j];
   means[i] /= counts[i];
  }
 if (means[0] > means[1])
   (*which) = 1;
 else
   (*which) = 2;
 if (!get_parameter_o("accuracy")) 
   (*which) = 3 - (*which); 
 for (i = 0; i < 2; i++)
   for (j = 0; j < counts[i]; j++)
     sse += pow(observations[i][j] - means[i], 2);
 df = counts[0] + counts[1] - 2;
 mse = sse / df;
 free_2d((void**)observations, 2);
 variance = sqrt(mse * (1.0 / counts[0] + 1.0 / counts[1]));
 (*real_confidence) = 1 - t_distribution((means[0] - means[1]) / variance, df);
 if (get_parameter_i("tailed") == 1)
  {
   res = t_distribution_inverse(1 - confidence, df);
   if ((means[0] - means[1]) < res * variance)
     return 0;
   else
     return 1;
  }
 else
  {
   res = t_distribution_inverse((1 - confidence) / 2, df);
   lower = -variance * res;
   upper = variance * res;
   if ((means[0] - means[1] > lower) && (means[0] - means[1] < upper))
     return 0;
   else
     return 1;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rdx, %rbx
movsd %xmm0, 0x48(%rsp)
movq %rsi, %r15
leaq 0x8(%rsp), %rsi
callq 0x89dc2
testq %rax, %rax
je 0x8a73c
movq %rax, %r14
xorl %eax, %eax
cmpq $0x2, %rax
je 0x8a647
movl 0x8(%rsp,%rax,4), %ecx
testl %ecx, %ecx
movl $0x0, %edx
cmovgl %ecx, %edx
xorpd %xmm0, %xmm0
xorl %esi, %esi
cmpq %rsi, %rdx
je 0x8a634
movq (%r14,%rax,8), %rdi
addsd (%rdi,%rsi,8), %xmm0
movsd %xmm0, 0x30(%rsp,%rax,8)
incq %rsi
jmp 0x8a61b
cvtsi2sd %ecx, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp,%rax,8)
incq %rax
jmp 0x8a601
movsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
xorl %eax, %eax
movapd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x20(%rsp)
ucomisd %xmm1, %xmm0
setbe %al
incl %eax
movl %eax, (%r15)
leaq 0x113b8(%rip), %rdi     # 0x9ba2c
callq 0x4cff1
testl %eax, %eax
jne 0x8a686
pushq $0x3
popq %rax
subl (%r15), %eax
movl %eax, (%r15)
xorpd %xmm1, %xmm1
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x2, %rcx
je 0x8a6c5
movl 0x8(%rsp,%rcx,4), %edx
testl %edx, %edx
cmovlel %eax, %edx
xorl %esi, %esi
cmpq %rsi, %rdx
je 0x8a6c0
movq (%r14,%rcx,8), %rdi
movsd (%rdi,%rsi,8), %xmm0
subsd 0x30(%rsp,%rcx,8), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm0, %xmm1
incq %rsi
jmp 0x8a69f
incq %rcx
jmp 0x8a68e
movl 0x8(%rsp), %r15d
movl 0xc(%rsp), %r12d
leal (%r15,%r12), %ebp
addl $-0x2, %ebp
pushq $0x2
popq %rsi
movq %r14, %rdi
movapd %xmm1, 0x50(%rsp)
callq 0x34fc3
movd %ebp, %xmm0
movd %r15d, %xmm1
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
cvtdq2pd %xmm0, %xmm0
movapd 0x50(%rsp), %xmm2
shufpd $0x2, 0x17539(%rip), %xmm2 # xmm2 = xmm2[0],mem[1]
divpd %xmm0, %xmm2
cvtsi2sd %r12d, %xmm0
movsd 0xae08(%rip), %xmm1     # 0x95520
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
addsd %xmm1, %xmm0
mulsd %xmm2, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x8a750
sqrtsd %xmm0, %xmm2
jmp 0x8a759
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
xorl %eax, %eax
jmp 0x8a808
callq 0x4300
movapd %xmm0, %xmm2
movapd 0x10(%rsp), %xmm0
subsd 0x20(%rsp), %xmm0
movapd %xmm0, 0x10(%rsp)
movapd %xmm2, 0x20(%rsp)
divsd %xmm2, %xmm0
movl %ebp, %edi
callq 0x1e9ba
movsd 0xad9c(%rip), %xmm1     # 0x95520
subsd %xmm0, %xmm1
movsd %xmm1, (%rbx)
leaq 0x11e4c(%rip), %rdi     # 0x9c5df
callq 0x4cd35
movsd 0xad80(%rip), %xmm0     # 0x95520
subsd 0x48(%rsp), %xmm0
cmpl $0x1, %eax
jne 0x8a7c7
movl %ebp, %edi
callq 0x1ea02
movapd 0x20(%rsp), %xmm1
mulsd %xmm0, %xmm1
ucomisd 0x10(%rsp), %xmm1
setbe %al
jmp 0x8a808
mulsd 0xb551(%rip), %xmm0     # 0x95d20
movl %ebp, %edi
callq 0x1ea02
movapd 0xb9f2(%rip), %xmm1     # 0x961d0
movapd 0x20(%rsp), %xmm2
xorpd %xmm2, %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm2
movapd 0x10(%rsp), %xmm0
cmpnltpd %xmm0, %xmm1
cmpnltpd %xmm2, %xmm0
orpd %xmm1, %xmm0
movd %xmm0, %eax
movzbl %al, %eax
andl $0x1, %eax
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq