// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/tests.c
// Function: hotellingt
int hotellingt(char **files, int *which, double confidence, double *real_confidence)
{
 /*!Last Changed 12.01.2009*/
 int i, k, p, m, df1, df2;
 double *samplemean, num, denom, statistic;
 matrix observations[2], difference, covariance, mean, eigenvec, dummy, result, tmp, meant, weights;
 p = read_multivariate_observations_for_two_file(files, observations);
 if (p == -1)
  {
   matrix_free(observations[0]);
   matrix_free(observations[1]);
   return 0;
  }
 if (observations[0].row != observations[1].row)
  {
   printf(m1426);
   return 0;
  }
 multivariate_normality_test(files[0], confidence, &statistic);
 set_default_variable("out4", statistic + 0.0);
 multivariate_normality_test(files[1], confidence, &statistic);
 set_default_variable("out5", statistic + 0.0);
 k = observations[0].row;
 *which = 3;
 difference = matrix_difference(observations[0], observations[1]);
 covariance = matrix_covariance(difference, &samplemean);
 mean = matrix_alloc(1, p);
 memcpy(mean.values[0], samplemean, p * sizeof(double));
 safe_free(samplemean);
 dummy = matrix_copy(covariance);
 if (!matrix_inverse(&dummy))
  {
   find_eigenvalues_eigenvectors(&eigenvec, covariance, &p, 1.0 - DBL_DELTA);
   reduce_dimension_of_covariance_matrix(&covariance, p, eigenvec);
   reduce_dimension_of_vector(&mean, p, eigenvec);
   matrix_free(eigenvec);
   p++;
  }
 set_default_variable("out3", p + 0.0);
 matrix_free(dummy);
 m = k - 1;
 matrix_inverse(&covariance);
 tmp = matrix_multiply(mean, covariance);
 meant = matrix_transpose(mean);
 result = matrix_multiply(tmp, meant);
 weights = matrix_multiply(covariance, meant);
 for (i = 0; i < p; i++)
   write_array_variables("aout", i + 1, 1, "f", weights.values[i][0]); 
 matrix_free(weights);
 num = (m - p + 1) * k * result.values[0][0];
 matrix_free(meant);
 matrix_free(tmp);
 matrix_free(result);
 matrix_free(covariance);
 matrix_free(mean);
 for (i = 0; i < 2; i++)
   matrix_free(observations[i]);
 denom = p * m;
 df1 = p;
 df2 = m - p + 1;
 if (denom != 0)
   (*real_confidence) = 1 - f_distribution(num / denom, df1, df2);
 else
   return 0;
 if (get_parameter_i("tailed") == 2)
  {
   if ((num / denom) < f_distribution_inverse(1 - confidence, df1, df2))
     return 0;
   else
     return 1;
  }
 else
   printf(m1316);
 return 0;  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %r13
movsd %xmm0, 0x20(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rsp), %rsi
callq 0x89b89
movl %eax, 0x4(%rsp)
cmpl $-0x1, %eax
je 0x8bc4b
movl 0x30(%rsp), %eax
cmpl 0x40(%rsp), %eax
jne 0x8bc6b
movl %eax, 0x2c(%rsp)
movq (%r14), %rdi
leaq 0xa8(%rsp), %r15
movsd 0x20(%rsp), %xmm0
movq %r15, %rsi
callq 0x8b8c1
xorpd %xmm1, %xmm1
movsd (%r15), %xmm0
addsd %xmm1, %xmm0
leaq 0xd3f5(%rip), %rdi      # 0x98f6a
callq 0x30597
movq 0x8(%r14), %rdi
movsd 0x20(%rsp), %xmm0
movq %r15, %rsi
callq 0x8b8c1
xorpd %xmm0, %xmm0
addsd (%r15), %xmm0
leaq 0xd3d4(%rip), %rdi      # 0x98f70
callq 0x30597
movl $0x3, (%rbx)
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
callq 0x39cca
leaq 0xb0(%rsp), %rbx
movq %rax, %rdi
movq %rdx, %rsi
movq %rbx, %rdx
callq 0x3a4c9
movq %rax, %r14
movq %rdx, %r15
movq %rax, 0x58(%rsp)
movq %rdx, 0x60(%rsp)
movslq 0x4(%rsp), %r12
pushq $0x1
popq %rdi
movl %r12d, %esi
callq 0x380d3
movq %rax, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movq (%rdx), %rdi
movq (%rbx), %rsi
shlq $0x3, %r12
movq %r12, %rdx
callq 0x4310
movq (%rbx), %rdi
callq 0x34ff7
movq %r14, %rdi
movq %r15, %rsi
callq 0x383f4
leaq 0x98(%rsp), %rdi
movq %rax, (%rdi)
movq %rdx, 0x8(%rdi)
callq 0x3a9f7
testl %eax, %eax
movq %r13, 0x68(%rsp)
je 0x8bc8d
movl 0x4(%rsp), %eax
jmp 0x8bcef
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x3929f
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x3929f
jmp 0x8bc77
leaq 0x161ca(%rip), %rdi     # 0xa1e3c
callq 0x4090
xorl %ebx, %ebx
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x58(%rsp), %r15
movq (%r15), %rsi
movq 0x8(%r15), %rdx
leaq 0xb8(%rsp), %r14
leaq 0x4(%rsp), %rbx
movsd 0x15f82(%rip), %xmm0    # 0xa1c30
movq %r14, %rdi
movq %rbx, %rcx
callq 0x3c5f6
movl (%rbx), %esi
movq (%r14), %rdx
movq 0x8(%r14), %rcx
movq %r15, %rdi
callq 0x1cd3e
movl (%rbx), %esi
movq (%r14), %rdx
movq 0x8(%r14), %rcx
leaq 0x10(%rsp), %rdi
callq 0x1cdfe
movq (%r14), %rdi
movq 0x8(%r14), %rsi
callq 0x3929f
movl (%rbx), %eax
incl %eax
movl %eax, (%rbx)
cvtsi2sd %eax, %xmm0
leaq 0xd26a(%rip), %rdi      # 0x98f64
callq 0x30597
movq 0x98(%rsp), %rdi
movq 0xa0(%rsp), %rsi
callq 0x3929f
leaq 0x58(%rsp), %r14
movq %r14, %rdi
callq 0x3a9f7
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq (%r14), %rdx
movq 0x8(%r14), %rcx
callq 0x3933d
movq %rax, %rbx
movq %rdx, %r15
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x392ac
movq %rax, %r12
movq %rdx, %r13
movq %rbx, 0x90(%rsp)
movq %rbx, %rdi
movq %r15, 0x88(%rsp)
movq %r15, %rsi
movq %rax, %rdx
movq %r13, %rcx
callq 0x3933d
movq %rax, 0x70(%rsp)
movq %rdx, 0x78(%rsp)
movq (%r14), %rdi
movq 0x8(%r14), %rsi
movq %r12, 0x80(%rsp)
movq %r12, %rdx
movq %r13, %rcx
callq 0x3933d
movq %rax, 0x8(%rsp)
movq %rdx, %r15
xorl %ebx, %ebx
leaq 0x9a08(%rip), %rbp      # 0x957b0
leaq 0xc84a(%rip), %r14      # 0x985f9
pushq $0x1
popq %r12
movslq 0x4(%rsp), %rax
cmpq %rax, %rbx
jge 0x8bddc
movq (%r15,%rbx,8), %rax
incq %rbx
movsd (%rax), %xmm0
movq %rbp, %rdi
movl %ebx, %esi
movl %r12d, %edx
movq %r14, %rcx
movb $0x1, %al
callq 0x2f310
jmp 0x8bdb3
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x3929f
movl 0x2c(%rsp), %r15d
movl %r15d, %ebp
subl 0x4(%rsp), %ebp
imull %r15d, %ebp
movq 0x78(%rsp), %rbx
movq (%rbx), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x80(%rsp), %rdi
movq %r13, %rsi
callq 0x3929f
movq 0x90(%rsp), %rdi
movq 0x88(%rsp), %rsi
callq 0x3929f
movq 0x70(%rsp), %rdi
movq %rbx, %rsi
callq 0x3929f
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x3929f
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x3929f
xorl %ebx, %ebx
cmpq $0x20, %rbx
je 0x8be78
movq 0x30(%rsp,%rbx), %rdi
movq 0x38(%rsp,%rbx), %rsi
callq 0x3929f
addq $0x10, %rbx
jmp 0x8be5d
decl %r15d
movl 0x4(%rsp), %r14d
movl %r14d, %eax
imull %r15d, %eax
xorl %ebx, %ebx
testl %eax, %eax
je 0x8bc79
subl %r14d, %r15d
incl %r15d
cvtsi2sd %ebp, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movl %r14d, %edi
movl %r15d, %esi
callq 0x1db37
movsd 0x965a(%rip), %xmm1     # 0x95520
subsd %xmm0, %xmm1
movq 0x68(%rsp), %rax
movsd %xmm1, (%rax)
leaq 0x10705(%rip), %rdi     # 0x9c5df
callq 0x4cd35
cmpl $0x2, %eax
jne 0x8bf0d
movsd 0x9634(%rip), %xmm0     # 0x95520
subsd 0x20(%rsp), %xmm0
movl %r14d, %edi
movl %r15d, %esi
callq 0x1dde6
xorl %ebx, %ebx
ucomisd 0x8(%rsp), %xmm0
setbe %bl
jmp 0x8bc79
leaq 0x15f8c(%rip), %rdi     # 0xa1ea0
callq 0x4090
jmp 0x8bc79