// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/tests.c
// Function: combined5x2t
int combined5x2t(char **files, int *which, double confidence, double *real_confidence)
{
 /*Last Changed 06.10.2004*/
 /*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, df;
 double **observations, *difference, *variance, *means, num, denom, sum, upper, lower;
 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), "combined5x2t", 15);
 means = (double *)safemalloc((counts[0] / 2) * sizeof(double), "combined5x2t", 16);
 variance = (double *)safemalloc((counts[0] / 2) * sizeof(double), "combined5x2t", 17);
 sum = 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]);
   sum += difference[i];
  }
 if (sum > 0)
   (*which) = 1;
 else
   (*which) = 2;
 if (!get_parameter_o("accuracy")) 
   (*which) = 3 - (*which);    
 denom = 0;
 num = 0;
 for (i = 0; i < (counts[0] / 2); i++)
  {
   means[i] = (difference[2 * i] + difference[2 * i + 1]) / 2;
   num += means[i];
   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];
  }
 num *= sqrt(10);
 num /= 5;
 denom /= 5;
 denom = sqrt(denom);
 free_2d((void**)observations, 2);
 safe_free(difference);
 safe_free(means);
 safe_free(variance);
 df = counts[0] / 2;
 if (denom != 0)
  {
   sum = t_distribution(num / denom, df);
   (*real_confidence) = 1 - sum;
  }
 else
   return 0;
 if (get_parameter_i("tailed") == 1)
  {
   upper = t_distribution_inverse(1 - confidence, df);
   if ((num / 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 ((num / denom) > lower && (num / denom) < upper)
     return 0;
   else
     return 1;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %rbx
movsd %xmm0, 0x40(%rsp)
movq %rsi, %r15
leaq 0x38(%rsp), %rsi
callq 0x98796
testq %rax, %rax
je 0x9942e
movq %rax, %r14
movslq 0x38(%rsp), %r13
cmpl 0x3c(%rsp), %r13d
jne 0x99440
movq %r15, 0x8(%rsp)
movq %rbx, 0x58(%rsp)
leaq (,%r13,8), %rdi
leaq 0x189e4(%rip), %rbx     # 0xb1d46
movq %rbx, %rsi
movl $0xf, %edx
callq 0x3a0e1
movq %rax, %r15
movl %r13d, %ebp
shrl $0x1f, %ebp
addl %r13d, %ebp
sarl %ebp
movslq %ebp, %r12
shlq $0x3, %r12
movq %r12, %rdi
movq %rbx, %rsi
movl $0x10, %edx
callq 0x3a0e1
movq %rax, 0x10(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movl $0x11, %edx
callq 0x3a0e1
movq %rax, 0x60(%rsp)
testl %r13d, %r13d
jle 0x9945e
movl %ebp, 0x1c(%rsp)
xorpd %xmm1, %xmm1
xorl %r12d, %r12d
leaq 0xf2b0(%rip), %rbp      # 0xa8679
movsd %xmm1, 0x20(%rsp)
movq (%r14), %rax
movq 0x8(%r14), %rcx
movsd (%rax,%r12,8), %xmm0
subsd (%rcx,%r12,8), %xmm0
movsd %xmm0, (%r15,%r12,8)
leaq 0x1(%r12), %rbx
leaq 0xc3bc(%rip), %rdi      # 0xa57b0
movl %ebx, %esi
movl $0x1, %edx
movq %rbp, %rcx
movb $0x1, %al
callq 0x33644
movsd 0x20(%rsp), %xmm1
addsd (%r15,%r12,8), %xmm1
movq %rbx, %r12
cmpq %rbx, %r13
jne 0x993c9
xorpd %xmm0, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm1
setbe %al
incl %eax
movl 0x1c(%rsp), %ebp
jmp 0x99463
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
jmp 0x995ca
leaq 0x18b2e(%rip), %rdi     # 0xb1f75
callq 0x4090
movq %r14, %rdi
movl $0x2, %esi
callq 0x3a14b
jmp 0x995ca
movl $0x2, %eax
movq 0x8(%rsp), %r12
movl %eax, (%r12)
leaq 0x12695(%rip), %rdi     # 0xabb08
callq 0x54bec
testl %eax, %eax
movq 0x10(%rsp), %rbx
jne 0x9948e
movl $0x3, %eax
subl (%r12), %eax
movl %eax, (%r12)
xorpd %xmm1, %xmm1
xorpd %xmm6, %xmm6
xorpd %xmm0, %xmm0
cmpl $0x2, %r13d
movq 0x60(%rsp), %r12
jl 0x99509
movl %ebp, %eax
movq %r15, %rcx
addq $0x8, %rcx
xorl %edx, %edx
movsd 0xc860(%rip), %xmm2     # 0xa5d18
movsd -0x8(%rcx), %xmm3
addsd (%rcx), %xmm3
mulsd %xmm2, %xmm3
movsd %xmm3, (%rbx,%rdx,8)
addsd %xmm3, %xmm6
movsd -0x8(%rcx), %xmm4
movsd (%rcx), %xmm5
subsd %xmm3, %xmm4
subsd %xmm3, %xmm5
mulsd %xmm5, %xmm5
mulsd %xmm4, %xmm4
addsd %xmm5, %xmm4
movsd %xmm4, (%r12,%rdx,8)
addsd %xmm4, %xmm0
incq %rdx
addq $0x10, %rcx
cmpq %rdx, %rax
jne 0x994b8
mulsd 0x187d7(%rip), %xmm6    # 0xb1ce0
movapd %xmm6, 0x20(%rsp)
divsd 0xe911(%rip), %xmm0     # 0xa7e28
ucomisd %xmm1, %xmm0
jb 0x99523
sqrtsd %xmm0, %xmm0
jmp 0x99528
callq 0x4300
movsd %xmm0, 0x8(%rsp)
movq %r14, %rdi
movl $0x2, %esi
callq 0x3a14b
movq %r15, %rdi
callq 0x3a180
movq %rbx, %rdi
callq 0x3a180
movq %r12, %rdi
callq 0x3a180
xorpd %xmm0, %xmm0
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x99565
jnp 0x995ca
movapd 0x20(%rsp), %xmm0
divsd 0xe8b5(%rip), %xmm0     # 0xa7e28
divsd %xmm1, %xmm0
movapd %xmm0, 0x20(%rsp)
movl %ebp, %edi
callq 0x2100c
movsd 0xbf94(%rip), %xmm1     # 0xa5520
subsd %xmm0, %xmm1
movq 0x58(%rsp), %rax
movsd %xmm1, (%rax)
leaq 0x1311b(%rip), %rdi     # 0xac6bb
callq 0x54920
movsd 0xbf73(%rip), %xmm0     # 0xa5520
subsd 0x40(%rsp), %xmm0
cmpl $0x1, %eax
jne 0x995e1
movl %ebp, %edi
callq 0x21056
ucomisd 0x20(%rsp), %xmm0
setbe %al
jmp 0x995cc
xorl %eax, %eax
movzbl %al, %eax
andl $0x1, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
mulsd 0xc72f(%rip), %xmm0     # 0xa5d18
movsd %xmm0, 0x10(%rsp)
movl %ebp, %edi
callq 0x21056
movapd %xmm0, 0x40(%rsp)
movsd 0x10(%rsp), %xmm0
movl %ebp, %edi
callq 0x21056
xorpd 0xcbbf(%rip), %xmm0     # 0xa61d0
movapd 0x20(%rsp), %xmm1
cmpnltpd %xmm1, %xmm0
cmpnltpd 0x40(%rsp), %xmm1
orpd %xmm0, %xmm1
movd %xmm1, %eax
jmp 0x995cc