// File: /workspace/github_c_makefile_star2_O1/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 0x95b63
testq %rax, %rax
je 0x99ae0
movl 0x18(%rsp), %ecx
xorl %r15d, %r15d
cmpl 0x1c(%rsp), %ecx
jne 0x99bca
movl $0x0, %ebp
testl %ecx, %ecx
jle 0x99ab6
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 0x99a88
movq %rax, %rdi
movl $0x2, %esi
callq 0x3915f
cmpl %ebp, %r15d
jge 0x99af5
movl $0x1, (%r14)
leaq 0xef66(%rip), %rdi      # 0xa8a3c
callq 0x536e7
movl %r15d, %r12d
jmp 0x99b0b
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, (%rbx)
xorl %r15d, %r15d
jmp 0x99bca
movl $0x2, (%r14)
leaq 0xef39(%rip), %rdi      # 0xa8a3c
callq 0x536e7
movl %ebp, %r12d
testl %eax, %eax
jne 0x99b1a
movl $0x3, %eax
subl (%r14), %eax
movl %eax, (%r14)
addl %r15d, %ebp
incl %r12d
xorl %r14d, %r14d
xorpd %xmm0, %xmm0
movsd 0x89f1(%rip), %xmm1     # 0xa2520
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
movl %ebp, %edi
movl %r14d, %esi
callq 0x38eff
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x89c6(%rip), %xmm0     # 0xa2520
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 0x99b35
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, (%rbx)
leaq 0xfa61(%rip), %rdi      # 0xa95ef
callq 0x5341c
movsd 0x8(%rsp), %xmm0
subsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
cmpl $0x1, %eax
jne 0x99bb2
movsd 0x8(%rsp), %xmm0
jmp 0x99bc0
movsd 0x8(%rsp), %xmm0
mulsd 0x9158(%rip), %xmm0     # 0xa2d18
ucomisd 0x10(%rsp), %xmm0
seta %r15b
movzbl %r15b, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq