#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 sqrt(double);
double calculate_Tajima_D(double totalHZ, double totalTheta, double S, double n,
                          double a1, double a2) {
  double b1;
  double b2;
  double e1;
  double e2;
  double numerator;
  double denominator;
  b1 = (n + 1) / (3 * (n - 1));
  b2 = (2 * (n * n + n + 3)) / (9 * n * (n - 1));
  e1 = (b1 - (1 / a1)) / a1;
  e2 = (b2 - (n + 2) / (a1 * n) + (a2 / (a1 * a1))) / ((a1 * a1) + a2);
  numerator = totalHZ - totalTheta;
  denominator = sqrt((e1 * S) + (e2 * S * (S - 1)));
  return (numerator / denominator);
}


x86 assembly (clang, -O0):
<calculate_Tajima_D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  0xec2(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  0xeb0(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  0xebc(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe90(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe74(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe70(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  0xe4e(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xe30(%rip),%xmm1
divsd  -0x28(%rbp),%xmm1
subsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xe18(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  -0x28(%rbp),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm3
movsd  0xd92(%rip),%xmm4
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_Tajima_D>:
push   %rax
movapd %xmm0,%xmm11
movsd  0xee2(%rip),%xmm0
addsd  %xmm3,%xmm0
movsd  0xedd(%rip),%xmm9
movapd %xmm3,%xmm7
addsd  %xmm9,%xmm7
movsd  0xed3(%rip),%xmm8
movapd %xmm4,%xmm10
unpcklpd %xmm7,%xmm10
mulsd  %xmm8,%xmm7
movapd %xmm3,%xmm6
mulsd  %xmm3,%xmm6
addsd  %xmm3,%xmm6
addsd  %xmm8,%xmm6
addsd  %xmm6,%xmm6
movsd  0xeae(%rip),%xmm8
mulsd  %xmm3,%xmm8
shufpd $0x2,0xeb8(%rip),%xmm0
unpcklpd %xmm4,%xmm7
divpd  %xmm7,%xmm0
movapd %xmm0,%xmm7
unpckhpd %xmm0,%xmm7
subsd  %xmm7,%xmm0
divsd  %xmm4,%xmm0
movsd  0xe88(%rip),%xmm7
addsd  %xmm3,%xmm7
mulsd  %xmm4,%xmm3
divsd  %xmm3,%xmm7
movapd %xmm4,%xmm3
unpcklpd %xmm8,%xmm3
mulpd  %xmm3,%xmm10
mulsd  %xmm4,%xmm4
addsd  %xmm5,%xmm4
unpcklpd %xmm6,%xmm5
divpd  %xmm10,%xmm5
movapd %xmm5,%xmm3
unpckhpd %xmm5,%xmm3
subsd  %xmm7,%xmm3
addsd  %xmm5,%xmm3
divsd  %xmm4,%xmm3
subsd  %xmm1,%xmm11
mulsd  %xmm2,%xmm3
addsd  %xmm2,%xmm9
mulsd  %xmm3,%xmm9
mulsd  %xmm2,%xmm0
addsd  %xmm9,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1203 <calculate_Tajima_D+0xf3>
sqrtsd %xmm0,%xmm0
jmp    1214 <calculate_Tajima_D+0x104>
movsd  %xmm11,(%rsp)
call   1030 <sqrt@plt>
movsd  (%rsp),%xmm11
divsd  %xmm0,%xmm11
movapd %xmm11,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @calculate_Tajima_D(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%19 = load double, double* %10
%20 = fadd double %19, 1.000000e+00
%21 = load double, double* %10
%22 = fsub double %21, 1.000000e+00
%23 = fmul double 3.000000e+00, %22
%24 = fdiv double %20, %23
store double %24, double* %13
%25 = load double, double* %10
%26 = load double, double* %10
%27 = load double, double* %10
%28 = call double @llvm.fmuladd.f64(double %25, double %26, double %27)
%29 = fadd double %28, 3.000000e+00
%30 = fmul double 2.000000e+00, %29
%31 = load double, double* %10
%32 = fmul double 9.000000e+00, %31
%33 = load double, double* %10
%34 = fsub double %33, 1.000000e+00
%35 = fmul double %32, %34
%36 = fdiv double %30, %35
store double %36, double* %14
%37 = load double, double* %13
%38 = load double, double* %11
%39 = fdiv double 1.000000e+00, %38
%40 = fsub double %37, %39
%41 = load double, double* %11
%42 = fdiv double %40, %41
store double %42, double* %15
%43 = load double, double* %14
%44 = load double, double* %10
%45 = fadd double %44, 2.000000e+00
%46 = load double, double* %11
%47 = load double, double* %10
%48 = fmul double %46, %47
%49 = fdiv double %45, %48
%50 = fsub double %43, %49
%51 = load double, double* %12
%52 = load double, double* %11
%53 = load double, double* %11
%54 = fmul double %52, %53
%55 = fdiv double %51, %54
%56 = fadd double %50, %55
%57 = load double, double* %11
%58 = load double, double* %11
%59 = load double, double* %12
%60 = call double @llvm.fmuladd.f64(double %57, double %58, double %59)
%61 = fdiv double %56, %60
store double %61, double* %16
%62 = load double, double* %7
%63 = load double, double* %8
%64 = fsub double %62, %63
store double %64, double* %17
%65 = load double, double* %15
%66 = load double, double* %9
%67 = load double, double* %16
%68 = load double, double* %9
%69 = fmul double %67, %68
%70 = load double, double* %9
%71 = fsub double %70, 1.000000e+00
%72 = fmul double %69, %71
%73 = call double @llvm.fmuladd.f64(double %65, double %66, double %72)
%74 = call double @sqrt(double %73)
store double %74, double* %18
%75 = load double, double* %17
%76 = load double, double* %18
%77 = fdiv double %75, %76
ret double %77
}

LLVM IR (-O2):
define double @calculate_Tajima_D(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fadd double %3, 1.000000e+00
%8 = fadd double %3, -1.000000e+00
%9 = fmul double %8, 3.000000e+00
%10 = tail call double @llvm.fmuladd.f64(double %3, double %3, double %3)
%11 = fadd double %10, 3.000000e+00
%12 = fmul double %11, 2.000000e+00
%13 = fmul double %3, 9.000000e+00
%14 = insertelement <2 x double> <double poison, double 1.000000e+00>, double %7, i64 0
%15 = insertelement <2 x double> poison, double %4, i64 1
%16 = insertelement <2 x double> %15, double %9, i64 0
%17 = fdiv <2 x double> %14, %16
%18 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%19 = fsub <2 x double> %17, %18
%20 = extractelement <2 x double> %19, i64 0
%21 = fdiv double %20, %4
%22 = fadd double %3, 2.000000e+00
%23 = fmul double %3, %4
%24 = fdiv double %22, %23
%25 = insertelement <2 x double> poison, double %4, i64 0
%26 = insertelement <2 x double> %25, double %13, i64 1
%27 = insertelement <2 x double> %25, double %8, i64 1
%28 = fmul <2 x double> %26, %27
%29 = insertelement <2 x double> poison, double %5, i64 0
%30 = insertelement <2 x double> %29, double %12, i64 1
%31 = fdiv <2 x double> %30, %28
%32 = extractelement <2 x double> %31, i64 1
%33 = fsub double %32, %24
%34 = extractelement <2 x double> %31, i64 0
%35 = fadd double %34, %33
%36 = tail call double @llvm.fmuladd.f64(double %4, double %4, double %5)
%37 = fdiv double %35, %36
%38 = fsub double %0, %1
%39 = fmul double %37, %2
%40 = fadd double %2, -1.000000e+00
%41 = fmul double %40, %39
%42 = tail call double @llvm.fmuladd.f64(double %21, double %2, double %41)
%43 = tail call double @sqrt(double %42)
%44 = fdiv double %38, %43
ret double %44
}