// File: /workspace/github_c_makefile_star2_O2/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 0x89dc2
testq %rax, %rax
je 0x8a921
movq %rax, %r14
movslq 0x38(%rsp), %rbp
cmpl 0x3c(%rsp), %ebp
jne 0x8a933
movq %r15, 0x8(%rsp)
movq %rbx, 0x58(%rsp)
movq %rbp, %rdi
shlq $0x3, %rdi
leaq 0x1742c(%rip), %rbx     # 0xa1c9e
pushq $0xf
popq %rdx
movq %rbx, %rsi
callq 0x34f59
movq %rax, %r15
pushq $0x2
popq %rcx
movl %ebp, %eax
cltd
idivl %ecx
movl %eax, 0x1c(%rsp)
movslq %eax, %r12
shlq $0x3, %r12
pushq $0x10
popq %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x34f59
movq %rax, 0x10(%rsp)
pushq $0x11
popq %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x34f59
movq %rax, 0x60(%rsp)
xorl %r13d, %r13d
testl %ebp, %ebp
movl $0x0, %ebx
cmovgl %ebp, %ebx
xorpd %xmm1, %xmm1
pushq $0x1
popq %r12
cmpq %r13, %rbx
je 0x8a94f
movq (%r14), %rax
movq 0x8(%r14), %rcx
movsd (%rax,%r13,8), %xmm0
subsd (%rcx,%r13,8), %xmm0
movsd %xmm0, (%r15,%r13,8)
leaq 0x1(%r13), %rbp
leaq 0xaeb9(%rip), %rdi      # 0x957b0
movl %ebp, %esi
movl %r12d, %edx
leaq 0xdcf6(%rip), %rcx      # 0x985f9
movb $0x1, %al
movsd %xmm1, 0x20(%rsp)
callq 0x2f310
movsd 0x20(%rsp), %xmm1
addsd (%r15,%r13,8), %xmm1
movq %rbp, %r13
jmp 0x8a8ce
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
jmp 0x8aac4
leaq 0x17593(%rip), %rdi     # 0xa1ecd
callq 0x4090
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x34fc3
jmp 0x8aac4
xorpd %xmm0, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm1
setbe %al
incl %eax
movq 0x8(%rsp), %rbx
movl %eax, (%rbx)
leaq 0x110c0(%rip), %rdi     # 0x9ba2c
callq 0x4cff1
testl %eax, %eax
jne 0x8a97c
pushq $0x3
popq %rax
subl (%rbx), %eax
movl %eax, (%rbx)
xorl %eax, %eax
movl 0x1c(%rsp), %ebx
testl %ebx, %ebx
movl %ebx, %ecx
cmovlel %eax, %ecx
shlq $0x3, %rcx
movsd 0xb38b(%rip), %xmm1     # 0x95d20
xorpd %xmm0, %xmm0
xorpd %xmm5, %xmm5
movq 0x10(%rsp), %r12
movq 0x60(%rsp), %r13
cmpq %rax, %rcx
je 0x8a9f9
movsd (%r15,%rax,2), %xmm2
addsd 0x8(%r15,%rax,2), %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, (%r12,%rax)
addsd %xmm2, %xmm5
movsd (%r15,%rax,2), %xmm3
movsd 0x8(%r15,%rax,2), %xmm4
subsd %xmm2, %xmm3
subsd %xmm2, %xmm4
mulsd %xmm4, %xmm4
mulsd %xmm3, %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, (%r13,%rax)
addsd %xmm3, %xmm0
addq $0x8, %rax
jmp 0x8a9a7
movapd %xmm5, 0x20(%rsp)
divsd 0xd3a1(%rip), %xmm0     # 0x97da8
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x8aa17
sqrtsd %xmm0, %xmm0
jmp 0x8aa1c
callq 0x4300
movsd %xmm0, 0x8(%rsp)
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x34fc3
movq %r15, %rdi
callq 0x34ff7
movq %r12, %rdi
callq 0x34ff7
movq %r13, %rdi
callq 0x34ff7
movsd 0x8(%rsp), %xmm1
ucomisd 0xb2c5(%rip), %xmm1     # 0x95d18
jne 0x8aa57
jnp 0x8aac4
movapd 0x20(%rsp), %xmm0
mulsd 0x171c3(%rip), %xmm0    # 0xa1c28
divsd 0xd33b(%rip), %xmm0     # 0x97da8
divsd %xmm1, %xmm0
movapd %xmm0, 0x20(%rsp)
movl %ebx, %edi
callq 0x1e9ba
movsd 0xaa9a(%rip), %xmm1     # 0x95520
subsd %xmm0, %xmm1
movq 0x58(%rsp), %rax
movsd %xmm1, (%rax)
leaq 0x11b45(%rip), %rdi     # 0x9c5df
callq 0x4cd35
movsd 0xaa79(%rip), %xmm0     # 0x95520
subsd 0x40(%rsp), %xmm0
cmpl $0x1, %eax
jne 0x8aadb
movl %ebx, %edi
callq 0x1ea02
ucomisd 0x20(%rsp), %xmm0
setbe %al
jmp 0x8aac6
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 0xb23d(%rip), %xmm0     # 0x95d20
movsd %xmm0, 0x10(%rsp)
movl %ebx, %edi
callq 0x1ea02
movapd %xmm0, 0x40(%rsp)
movsd 0x10(%rsp), %xmm0
movl %ebx, %edi
callq 0x1ea02
xorpd 0xb6c5(%rip), %xmm0     # 0x961d0
movapd 0x20(%rsp), %xmm1
cmpnltpd %xmm1, %xmm0
cmpnltpd 0x40(%rsp), %xmm1
orpd %xmm0, %xmm1
movd %xmm1, %eax
jmp 0x8aac6