// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/tests.c
// Function: ttest
int ttest(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 12.02.2002*/
 int i, j, counts[2], df;
 double means[2], **observations, sse = 0.0, nom, denom, 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);
 free_2d((void**)observations, 2);
 denom = sqrt(sse);
 df = counts[0] + counts[1] - 2;
 nom = (means[0] - means[1]) * sqrt((counts[0] * counts[1] * df) / (counts[0] + counts[1] + 0.0));
 (*real_confidence) = 1 - t_distribution(nom / denom, df);
 if (get_parameter_i("tailed") == 1)
  {
   upper = t_distribution_inverse(1 - confidence, df);
   if ((nom / denom) < upper)
     return 0;
   else
     return 1;
  }
 else
  {
   upper = t_distribution_inverse((1 - confidence) / 2, df);
   lower = -t_distribution_inverse((1 - confidence) / 2, df);
   if ((nom / denom) > lower && (nom / denom) < upper)
     return 0;
   else
     return 1;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xd2020
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0xd7ad8
movq -0x28(%rbp), %rax
movsd 0xaef0(%rip), %xmm0     # 0xe29b8
movsd %xmm0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0xd7da4
movl $0x0, -0x2c(%rbp)
cmpl $0x2, -0x2c(%rbp)
jge 0xd7b5f
movslq -0x2c(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp,%rax,8)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movslq -0x2c(%rbp), %rcx
cmpl -0x38(%rbp,%rcx,4), %eax
jge 0xd7b36
movq -0x58(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x30(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movslq -0x2c(%rbp), %rax
addsd -0x50(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x50(%rbp,%rax,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xd7af9
movslq -0x2c(%rbp), %rax
cvtsi2sdl -0x38(%rbp,%rax,4), %xmm1
movslq -0x2c(%rbp), %rax
movsd -0x50(%rbp,%rax,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp,%rax,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xd7adf
movsd -0x50(%rbp), %xmm0
ucomisd -0x48(%rbp), %xmm0
jbe 0xd7b77
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
jmp 0xd7b81
movq -0x18(%rbp), %rax
movl $0x2, (%rax)
leaq 0x10834(%rip), %rdi     # 0xe83bc
callq 0x79440
cmpl $0x0, %eax
jne 0xd7ba3
movq -0x18(%rbp), %rax
movl $0x3, %ecx
subl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x2c(%rbp)
cmpl $0x2, -0x2c(%rbp)
jge 0xd7c12
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movslq -0x2c(%rbp), %rcx
cmpl -0x38(%rbp,%rcx,4), %eax
jge 0xd7c05
movq -0x58(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x30(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movslq -0x2c(%rbp), %rax
subsd -0x50(%rbp,%rax,8), %xmm0
movsd 0xb0b5(%rip), %xmm1     # 0xe2ca0
callq 0x4290
addsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xd7bb7
jmp 0xd7c07
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xd7baa
movq -0x58(%rbp), %rdi
movl $0x2, %esi
callq 0x52e20
movsd -0x60(%rbp), %xmm0
callq 0x42a0
movsd %xmm0, -0x70(%rbp)
movl -0x38(%rbp), %eax
addl -0x34(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x3c(%rbp)
movsd -0x50(%rbp), %xmm0
subsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movl -0x38(%rbp), %eax
imull -0x34(%rbp), %eax
imull -0x3c(%rbp), %eax
cvtsi2sd %eax, %xmm0
movl -0x38(%rbp), %eax
addl -0x34(%rbp), %eax
cvtsi2sd %eax, %xmm1
xorps %xmm2, %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x42a0
movaps %xmm0, %xmm1
movsd -0x88(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x68(%rbp), %xmm0
divsd -0x70(%rbp), %xmm0
movl -0x3c(%rbp), %edi
callq 0x2f370
movaps %xmm0, %xmm1
movsd 0xa371(%rip), %xmm0     # 0xe2018
subsd %xmm1, %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
leaq 0x1158a(%rip), %rdi     # 0xe9244
callq 0x78f10
cmpl $0x1, %eax
jne 0xd7d0b
movsd 0xa34c(%rip), %xmm0     # 0xe2018
subsd -0x20(%rbp), %xmm0
movl -0x3c(%rbp), %edi
callq 0x2f400
movsd %xmm0, -0x78(%rbp)
movsd -0x68(%rbp), %xmm1
divsd -0x70(%rbp), %xmm1
movsd -0x78(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xd7cff
movl $0x0, -0x4(%rbp)
jmp 0xd7da4
movl $0x1, -0x4(%rbp)
jmp 0xd7da4
movsd 0xa305(%rip), %xmm0     # 0xe2018
subsd -0x20(%rbp), %xmm0
movsd 0xaf80(%rip), %xmm1     # 0xe2ca0
divsd %xmm1, %xmm0
movl -0x3c(%rbp), %edi
callq 0x2f400
movsd %xmm0, -0x78(%rbp)
movsd 0xa2df(%rip), %xmm0     # 0xe2018
subsd -0x20(%rbp), %xmm0
movsd 0xaf5a(%rip), %xmm1     # 0xe2ca0
divsd %xmm1, %xmm0
movl -0x3c(%rbp), %edi
callq 0x2f400
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x68(%rbp), %xmm0
divsd -0x70(%rbp), %xmm0
ucomisd -0x80(%rbp), %xmm0
jbe 0xd7d9d
movsd -0x68(%rbp), %xmm1
divsd -0x70(%rbp), %xmm1
movsd -0x78(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xd7d9d
movl $0x0, -0x4(%rbp)
jmp 0xd7da4
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq