#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double fcdf(double, double, double);
double mahalanobis_pvalue(double DM, unsigned long m, unsigned long n,
                          unsigned long D) {
  double na, nb, p, Tsq, F;
  na = (double)m;
  nb = (double)n;
  p = (double)D;
  Tsq = ((na * nb) / (na + nb)) * DM * DM;
  F = ((na + nb - p - 1.0) / (p * (na + nb - 2.0))) * Tsq;
  return 1.0 - fcdf(F, p, na + nb - p - 1.0);
}


x86 assembly (clang, -O0):
<mahalanobis_pvalue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   -0x10(%rbp),%xmm0
movaps 0xedb(%rip),%xmm2
punpckldq %xmm2,%xmm0
movapd 0xedf(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm3
unpckhpd %xmm0,%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm0,-0x28(%rbp)
movq   -0x18(%rbp),%xmm0
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm3
unpckhpd %xmm0,%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm0,-0x30(%rbp)
movq   -0x20(%rbp),%xmm0
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
addsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  0xe33(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
addsd  -0x30(%rbp),%xmm2
movsd  0xe20(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
addsd  -0x30(%rbp),%xmm2
subsd  -0x38(%rbp),%xmm2
movsd  0xde1(%rip),%xmm3
subsd  %xmm3,%xmm2
call   1030 <fcdf@plt>
movaps %xmm0,%xmm1
movsd  0xdcd(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mahalanobis_pvalue>:
push   %rax
movq   %rdi,%xmm1
movdqa 0xee2(%rip),%xmm2
punpckldq %xmm2,%xmm1
movapd 0xee6(%rip),%xmm3
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm4
unpckhpd %xmm1,%xmm4
addsd  %xmm1,%xmm4
movq   %rsi,%xmm1
punpckldq %xmm2,%xmm1
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm5
unpckhpd %xmm1,%xmm5
addsd  %xmm1,%xmm5
movq   %rdx,%xmm6
punpckldq %xmm2,%xmm6
subpd  %xmm3,%xmm6
movapd %xmm6,%xmm1
unpckhpd %xmm6,%xmm1
addsd  %xmm6,%xmm1
movapd %xmm4,%xmm3
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm5
divsd  %xmm5,%xmm3
mulsd  %xmm0,%xmm3
movapd %xmm5,%xmm2
subsd  %xmm1,%xmm2
addsd  0xe90(%rip),%xmm2
addsd  0xe90(%rip),%xmm5
mulsd  %xmm3,%xmm0
mulsd  %xmm1,%xmm5
movapd %xmm2,%xmm3
divsd  %xmm5,%xmm3
mulsd  %xmm3,%xmm0
call   1030 <fcdf@plt>
movsd  0xe77(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @mahalanobis_pvalue(double %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca double
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%14 = load i64, i64* %6
%15 = uitofp i64 %14 to double
store double %15, double* %9
%16 = load i64, i64* %7
%17 = uitofp i64 %16 to double
store double %17, double* %10
%18 = load i64, i64* %8
%19 = uitofp i64 %18 to double
store double %19, double* %11
%20 = load double, double* %9
%21 = load double, double* %10
%22 = fmul double %20, %21
%23 = load double, double* %9
%24 = load double, double* %10
%25 = fadd double %23, %24
%26 = fdiv double %22, %25
%27 = load double, double* %5
%28 = fmul double %26, %27
%29 = load double, double* %5
%30 = fmul double %28, %29
store double %30, double* %12
%31 = load double, double* %9
%32 = load double, double* %10
%33 = fadd double %31, %32
%34 = load double, double* %11
%35 = fsub double %33, %34
%36 = fsub double %35, 1.000000e+00
%37 = load double, double* %11
%38 = load double, double* %9
%39 = load double, double* %10
%40 = fadd double %38, %39
%41 = fsub double %40, 2.000000e+00
%42 = fmul double %37, %41
%43 = fdiv double %36, %42
%44 = load double, double* %12
%45 = fmul double %43, %44
store double %45, double* %13
%46 = load double, double* %13
%47 = load double, double* %11
%48 = load double, double* %9
%49 = load double, double* %10
%50 = fadd double %48, %49
%51 = load double, double* %11
%52 = fsub double %50, %51
%53 = fsub double %52, 1.000000e+00
%54 = call double @fcdf(double %46, double %47, double %53)
%55 = fsub double 1.000000e+00, %54
ret double %55
}

LLVM IR (-O2):
define double @mahalanobis_pvalue(double %0, i64 %1, i64 %2, i64 %3) {
%5 = uitofp i64 %1 to double
%6 = uitofp i64 %2 to double
%7 = uitofp i64 %3 to double
%8 = fmul double %5, %6
%9 = fadd double %5, %6
%10 = fdiv double %8, %9
%11 = fmul double %10, %0
%12 = fmul double %11, %0
%13 = fsub double %9, %7
%14 = fadd double %13, -1.000000e+00
%15 = fadd double %9, -2.000000e+00
%16 = fmul double %15, %7
%17 = fdiv double %14, %16
%18 = fmul double %17, %12
%19 = tail call double @fcdf(double %18, double %7, double %14)
%20 = fsub double 1.000000e+00, %19
ret double %20
}