// File: /workspace/github_c_makefile_star2_O1/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 0x95b63
testq %rax, %rax
je 0x96771
movq %rax, %r14
movslq 0x38(%rsp), %r13
cmpl 0x3c(%rsp), %r13d
jne 0x96783
movq %r15, 0x8(%rsp)
movq %rbx, 0x58(%rsp)
leaq (,%r13,8), %rdi
leaq 0x18621(%rip), %rbx     # 0xaecc6
movq %rbx, %rsi
movl $0xf, %edx
callq 0x390f5
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 0x390f5
movq %rax, 0x10(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movl $0x11, %edx
callq 0x390f5
movq %rax, 0x60(%rsp)
testl %r13d, %r13d
jle 0x967a1
movl %ebp, 0x1c(%rsp)
xorpd %xmm1, %xmm1
xorl %r12d, %r12d
leaq 0xef15(%rip), %rbp      # 0xa5621
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 0xc079(%rip), %rdi      # 0xa27b0
movl %ebx, %esi
movl $0x1, %edx
movq %rbp, %rcx
movb $0x1, %al
callq 0x32c64
movsd 0x20(%rsp), %xmm1
addsd (%r15,%r12,8), %xmm1
movq %rbx, %r12
cmpq %rbx, %r13
jne 0x9670c
xorpd %xmm0, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm1
setbe %al
incl %eax
movl 0x1c(%rsp), %ebp
jmp 0x967a6
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
jmp 0x9690d
leaq 0x1876b(%rip), %rdi     # 0xaeef5
callq 0x4090
movq %r14, %rdi
movl $0x2, %esi
callq 0x3915f
jmp 0x9690d
movl $0x2, %eax
movq 0x8(%rsp), %r12
movl %eax, (%r12)
leaq 0x12286(%rip), %rdi     # 0xa8a3c
callq 0x536e7
testl %eax, %eax
movq 0x10(%rsp), %rbx
jne 0x967d1
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 0x9684c
movl %ebp, %eax
movq %r15, %rcx
addq $0x8, %rcx
xorl %edx, %edx
movsd 0xc51d(%rip), %xmm2     # 0xa2d18
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 0x967fb
mulsd 0x1840c(%rip), %xmm6    # 0xaec58
movapd %xmm6, 0x20(%rsp)
divsd 0xe546(%rip), %xmm0     # 0xa4da0
ucomisd %xmm1, %xmm0
jb 0x96866
sqrtsd %xmm0, %xmm0
jmp 0x9686b
callq 0x4300
movsd %xmm0, 0x8(%rsp)
movq %r14, %rdi
movl $0x2, %esi
callq 0x3915f
movq %r15, %rdi
callq 0x39194
movq %rbx, %rdi
callq 0x39194
movq %r12, %rdi
callq 0x39194
xorpd %xmm0, %xmm0
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x968a8
jnp 0x9690d
movapd 0x20(%rsp), %xmm0
divsd 0xe4ea(%rip), %xmm0     # 0xa4da0
divsd %xmm1, %xmm0
movapd %xmm0, 0x20(%rsp)
movl %ebp, %edi
callq 0x20892
movsd 0xbc51(%rip), %xmm1     # 0xa2520
subsd %xmm0, %xmm1
movq 0x58(%rsp), %rax
movsd %xmm1, (%rax)
leaq 0x12d0c(%rip), %rdi     # 0xa95ef
callq 0x5341c
movsd 0xbc30(%rip), %xmm0     # 0xa2520
subsd 0x40(%rsp), %xmm0
cmpl $0x1, %eax
jne 0x96924
movl %ebp, %edi
callq 0x208dc
ucomisd 0x20(%rsp), %xmm0
setbe %al
jmp 0x9690f
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 0xc3ec(%rip), %xmm0     # 0xa2d18
movsd %xmm0, 0x10(%rsp)
movl %ebp, %edi
callq 0x208dc
movapd %xmm0, 0x40(%rsp)
movsd 0x10(%rsp), %xmm0
movl %ebp, %edi
callq 0x208dc
xorpd 0xc87c(%rip), %xmm0     # 0xa31d0
movapd 0x20(%rsp), %xmm1
cmpnltpd %xmm1, %xmm0
cmpnltpd 0x40(%rsp), %xmm1
orpd %xmm0, %xmm1
movd %xmm1, %eax
jmp 0x9690f