// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/tests.c
// Function: multivariate_normality_test
int multivariate_normality_test(char* filename, double confidence, double* test_statistic)
{
 double* averages;
 matrix observations, S, g, observations_transpose, tmp;
 int i, j, p, n, freedom;
 double sum, res;
 observations = read_multivariate_observations_for_file(filename);
 p = observations.col;
 n = observations.row;
 if (n == 1)
  {
   matrix_free(observations);
   return 1;
  }
 S = matrix_covariance(observations, &averages);
 if (matrix_determinant(S) == 0)
  {
   matrix_free(observations);
   matrix_free(S);
   safe_free(averages);
   return 1;
  }
 matrix_inverse(&S);
 for (i = 0; i < n; i++)
   for (j = 0; j < p; j++)
     observations.values[i][j] -= averages[j];
 observations_transpose = matrix_transpose(observations);
 tmp = matrix_multiply(observations, S);
 g = matrix_multiply(tmp, observations_transpose);
 matrix_free(tmp);
 matrix_free(observations_transpose);
 matrix_free(observations);
 matrix_free(S);
 safe_free(averages);
 sum = 0.0;
 for (i = 0; i < n; i++)
   for (j = 0; j < n; j++)
     sum += g.values[i][j] * g.values[i][j] * g.values[i][j];
 matrix_free(g);
 sum /= (n * n);
 *test_statistic = (sum * n) / 6.0;
 freedom = (p * (p + 1) * (p + 2)) / 6;
 res = 1 - chi_square(freedom, *test_statistic);
 if (res > confidence)
   return 1;
 else
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0xd1ef0
movq %rax, -0xb0(%rbp)
movq %rdx, -0xa8(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x88(%rbp)
cmpl $0x1, -0x88(%rbp)
jne 0xd4979
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x59ea0
movl $0x1, -0x4(%rbp)
jmp 0xd4cb9
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0x5bc50
movq %rax, -0xc0(%rbp)
movq %rdx, -0xb8(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x5c130
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xd49f5
jp 0xd49f5
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x59ea0
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x59ea0
movq -0x28(%rbp), %rdi
callq 0x52e80
movl $0x1, -0x4(%rbp)
jmp 0xd4cb9
leaq -0x48(%rbp), %rdi
callq 0x5c470
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x88(%rbp), %eax
jge 0xd4a65
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
cmpl -0x84(%rbp), %eax
jge 0xd4a58
movq -0x28(%rbp), %rax
movslq -0x80(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x30(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x80(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0xd4a17
jmp 0xd4a5a
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0xd4a05
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x59ed0
movq %rax, -0xd0(%rbp)
movq %rdx, -0xc8(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x59fe0
movq %rax, -0xe0(%rbp)
movq %rdx, -0xd8(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x60(%rbp), %rcx
callq 0x59fe0
movq %rax, -0xf0(%rbp)
movq %rdx, -0xe8(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x59ea0
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x59ea0
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x59ea0
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x59ea0
movq -0x28(%rbp), %rdi
callq 0x52e80
xorps %xmm0, %xmm0
movsd %xmm0, -0x98(%rbp)
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x88(%rbp), %eax
jge 0xd4bea
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
cmpl -0x88(%rbp), %eax
jge 0xd4bda
movq -0x50(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x80(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x50(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x80(%rbp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movq -0x50(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x80(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x98(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0xd4b6d
jmp 0xd4bdc
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0xd4b57
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x59ea0
movl -0x88(%rbp), %eax
imull -0x88(%rbp), %eax
cvtsi2sd %eax, %xmm1
movsd -0x98(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x98(%rbp), %xmm0
cvtsi2sdl -0x88(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0xfc30(%rip), %xmm1     # 0xe4868
divsd %xmm1, %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
movl -0x84(%rbp), %eax
movl -0x84(%rbp), %ecx
addl $0x1, %ecx
imull %ecx, %eax
movl -0x84(%rbp), %ecx
addl $0x2, %ecx
imull %ecx, %eax
movl $0x6, %ecx
cltd
idivl %ecx
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %edi
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
callq 0x2d5e0
movaps %xmm0, %xmm1
movsd 0xd38a(%rip), %xmm0     # 0xe2018
subsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0xa0(%rbp), %xmm0
ucomisd -0x18(%rbp), %xmm0
jbe 0xd4cb2
movl $0x1, -0x4(%rbp)
jmp 0xd4cb9
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xf0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)