// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/tests.c
// Function: signtest
int signtest(char **files, int *which, double confidence, double *real_confidence)
{
 /*Last Changed 28.01.2005*/
 /*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 j, counts[2], plus, minus, total, range;
 double **observations, prob;
 observations = read_observations_for_two_file(files, counts);
 if (!observations)
  {
   *real_confidence = 0.5;
   return 0;
  }
 if (counts[0] != counts[1])
   return 0;
 plus = 0;
 minus = 0;
 for (j = 0; j < counts[0]; j++)
  {
   if (observations[0][j] < observations[1][j])
     plus++;
   if (observations[0][j] > observations[1][j])
     minus++;
  }
 free_2d((void**)observations, 2);
 if (plus < minus)
  {
   (*which) = 1;
   if (!get_parameter_o("accuracy")) 
     (*which) = 3 - (*which);    
   range = plus;
  }
 else
  {
   (*which) = 2; 
   if (!get_parameter_o("accuracy")) 
     (*which) = 3 - (*which);    
   range = minus;
  }
 total = plus + minus;
 prob = 0.0;
 for (j = 0; j <= range; j++)
   prob += binom(total, j) / pow(2, total);
 (*real_confidence) = prob;
 if (get_parameter_i("tailed") == 1)
  {
   if (prob < 1 - confidence)
     return 1;
   else
     return 0;
  }
 else
  {
   if (prob < (1 - confidence) / 2)
     return 1;
   else
     return 0;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
movsd %xmm0, 0x10(%rsp)
movq %rsi, %r14
leaq 0x8(%rsp), %rsi
callq 0x89dc2
testq %rax, %rax
je 0x8d94b
movl 0x8(%rsp), %ecx
xorl %r15d, %r15d
cmpl 0xc(%rsp), %ecx
jne 0x8da39
testl %ecx, %ecx
cmovlel %r15d, %ecx
xorl %edx, %edx
xorl %ebp, %ebp
cmpq %rdx, %rcx
je 0x8d960
movq (%rax), %rsi
movq 0x8(%rax), %rdi
movsd (%rsi,%rdx,8), %xmm0
movsd (%rdi,%rdx,8), %xmm1
xorl %esi, %esi
ucomisd %xmm0, %xmm1
seta %sil
addl %esi, %r15d
xorl %esi, %esi
ucomisd %xmm1, %xmm0
seta %sil
addl %esi, %ebp
incq %rdx
jmp 0x8d917
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
xorl %r15d, %r15d
jmp 0x8da39
pushq $0x2
popq %rsi
movq %rax, %rdi
callq 0x34fc3
cmpl %ebp, %r15d
jae 0x8d98b
movl $0x1, (%r14)
leaq 0xe0ae(%rip), %rdi      # 0x9ba2c
callq 0x4cff1
movl %r15d, %ecx
movl %r15d, %r12d
jmp 0x8d9a3
movl $0x2, (%r14)
leaq 0xe093(%rip), %rdi      # 0x9ba2c
callq 0x4cff1
movl %ebp, %ecx
movl %ebp, %r12d
testl %eax, %eax
jne 0x8d9b3
pushq $0x3
popq %rax
subl (%r14), %eax
movl %eax, (%r14)
movl %ecx, %r12d
addl %r15d, %ebp
incl %r12d
xorpd %xmm0, %xmm0
xorl %r14d, %r14d
cmpl %r14d, %r12d
movsd %xmm0, (%rsp)
je 0x8da05
movl %ebp, %edi
movl %r14d, %esi
callq 0x34dce
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x7b3a(%rip), %xmm0     # 0x95520
movl %ebp, %edi
callq 0x4080
movsd 0x18(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd (%rsp), %xmm0
addsd %xmm1, %xmm0
incl %r14d
jmp 0x8d9c0
movsd %xmm0, (%rbx)
leaq 0xebcf(%rip), %rdi      # 0x9c5df
callq 0x4cd35
movsd 0x7b03(%rip), %xmm0     # 0x95520
subsd 0x10(%rsp), %xmm0
cmpl $0x1, %eax
je 0x8da30
mulsd 0x82f0(%rip), %xmm0     # 0x95d20
ucomisd (%rsp), %xmm0
seta %r15b
movzbl %r15b, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq