// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0xd2020
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0xd787d
movq -0x28(%rbp), %rax
movsd 0xb14b(%rip), %xmm0     # 0xe29b8
movsd %xmm0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0xd7a76
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
je 0xd7891
movl $0x0, -0x4(%rbp)
jmp 0xd7a76
movl $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0xd7917
movq -0x50(%rbp), %rax
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xd78de
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0xd790a
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xd790c
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xd78a6
movq -0x50(%rbp), %rdi
movl $0x2, %esi
callq 0x52e20
movl -0x38(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0xd7961
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
leaq 0x10a7e(%rip), %rdi     # 0xe83bc
callq 0x79440
cmpl $0x0, %eax
jne 0xd7959
movq -0x18(%rbp), %rax
movl $0x3, %ecx
subl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x38(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0xd7993
movq -0x18(%rbp), %rax
movl $0x2, (%rax)
leaq 0x10a4a(%rip), %rdi     # 0xe83bc
callq 0x79440
cmpl $0x0, %eax
jne 0xd798d
movq -0x18(%rbp), %rax
movl $0x3, %ecx
subl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x3c(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x38(%rbp), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x40(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x44(%rbp), %eax
jg 0xd79fa
movl -0x40(%rbp), %edi
movl -0x2c(%rbp), %esi
callq 0x52ba0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x60(%rbp)
cvtsi2sdl -0x40(%rbp), %xmm1
movsd 0xb2cc(%rip), %xmm0     # 0xe2ca0
callq 0x4290
movaps %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
divsd %xmm1, %xmm0
addsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xd79ab
movsd -0x58(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
leaq 0x11836(%rip), %rdi     # 0xe9244
callq 0x78f10
cmpl $0x1, %eax
jne 0xd7a42
movsd -0x58(%rbp), %xmm1
movsd 0xa5f3(%rip), %xmm0     # 0xe2018
subsd -0x20(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xd7a39
movl $0x1, -0x4(%rbp)
jmp 0xd7a76
movl $0x0, -0x4(%rbp)
jmp 0xd7a76
movsd -0x58(%rbp), %xmm1
movsd 0xa5c9(%rip), %xmm0     # 0xe2018
subsd -0x20(%rbp), %xmm0
movsd 0xb244(%rip), %xmm2     # 0xe2ca0
divsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0xd7a6f
movl $0x1, -0x4(%rbp)
jmp 0xd7a76
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop