// File: /workspace/github_c_makefile_star2_O3/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 $0x30, %rsp
movq %rdx, %rbx
movsd %xmm0, 0x20(%rsp)
movq %rsi, %r14
leaq 0x18(%rsp), %rsi
callq 0x98796
testq %rax, %rax
je 0x9ca20
movl 0x18(%rsp), %ecx
cmpl 0x1c(%rsp), %ecx
jne 0x9ca2d
testl %ecx, %ecx
jle 0x9ca34
movq (%rax), %rdx
movq 0x8(%rax), %rsi
xorl %edi, %edi
xorl %ebp, %ebp
xorl %r15d, %r15d
movsd (%rdx,%rdi,8), %xmm0
movsd (%rsi,%rdi,8), %xmm1
xorl %r8d, %r8d
ucomisd %xmm0, %xmm1
seta %r8b
addl %r8d, %r15d
xorl %r8d, %r8d
ucomisd %xmm1, %xmm0
seta %r8b
addl %r8d, %ebp
incq %rdi
cmpq %rdi, %rcx
jne 0x9c9c8
movq %rax, %rdi
movl $0x2, %esi
callq 0x3a14b
cmpl %ebp, %r15d
jae 0x9ca46
movl $0x1, (%r14)
leaq 0xf0f2(%rip), %rdi      # 0xabb08
callq 0x54bec
movl %r15d, %r12d
jmp 0x9ca5c
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
xorl %eax, %eax
jmp 0x9cb1a
movq %rax, %rdi
movl $0x2, %esi
callq 0x3a14b
xorl %ebp, %ebp
xorl %r15d, %r15d
movl $0x2, (%r14)
leaq 0xf0b4(%rip), %rdi      # 0xabb08
callq 0x54bec
movl %ebp, %r12d
testl %eax, %eax
jne 0x9ca6b
movl $0x3, %eax
subl (%r14), %eax
movl %eax, (%r14)
addl %r15d, %ebp
incl %r12d
xorl %r14d, %r14d
xorpd %xmm0, %xmm0
movsd 0x8aa0(%rip), %xmm1     # 0xa5520
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
movl %ebp, %edi
movl %r14d, %esi
callq 0x39ce8
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x8a75(%rip), %xmm0     # 0xa5520
movl %ebp, %edi
callq 0x4080
movsd 0x28(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
incl %r14d
cmpl %r14d, %r12d
jne 0x9ca86
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, (%rbx)
leaq 0xfbdc(%rip), %rdi      # 0xac6bb
callq 0x54920
movsd 0x8(%rsp), %xmm0
subsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
cmpl $0x1, %eax
jne 0x9cb03
movsd 0x8(%rsp), %xmm0
jmp 0x9cb11
movsd 0x8(%rsp), %xmm0
mulsd 0x9207(%rip), %xmm0     # 0xa5d18
ucomisd 0x10(%rsp), %xmm0
seta %al
movzbl %al, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq