double eval_bw_dfdp0(double a, double pi, double p0, double A, double B,
                     double C, double D, double E) {
  double term1 = (D + a * A) / p0;
  double term2 = B * pi * a * pow(p0, a - 1) / (pi * pow(p0, a) + 1 - pi);
  double subterm3a = (1 - pi) * pi * a * (a - 1) * pow(p0, a - 2);
  double subterm3b = ((pi) * (pi)) * a * pow(p0, 2 * a - 2);
  double term3 = B * (subterm3a - subterm3b) /
                 ((pi * pow(p0, a) + 1 - pi) * (pi * pow(p0, a) + 1 - pi));
  double term4 = (D + a * A) / ((p0) * (p0));
  return 1 - E / ((term1 + term2) * (term1 + term2)) * (term3 - term4);
}


x86 assembly (clang, -O0):
<eval_bw_dfdp0>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%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  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xe73(%rip),%xmm2
subsd  %xmm2,%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
call   1030 <pow@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
movsd  0xe18(%rip),%xmm2
addsd  %xmm2,%xmm1
subsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xdfe(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xde2(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xdd0(%rip),%xmm2
subsd  %xmm2,%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xd7e(%rip),%xmm2
addsd  %xmm2,%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
subsd  -0x60(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  0xd0e(%rip),%xmm1
addsd  %xmm1,%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
call   1030 <pow@plt>
movsd  -0x88(%rbp),%xmm2
ff
movsd  -0x80(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm3,%xmm2
movsd  0xcc3(%rip),%xmm3
addsd  %xmm3,%xmm2
subsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
addsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
addsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  -0x68(%rbp),%xmm1
subsd  -0x70(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xc35(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval_bw_dfdp0>:
sub    $0x98,%rsp
movsd  %xmm7,0x58(%rsp)
movsd  %xmm4,0x50(%rsp)
movapd %xmm2,0x10(%rsp)
movapd %xmm1,0x40(%rsp)
movapd %xmm0,0x30(%rsp)
mulsd  %xmm0,%xmm3
addsd  %xmm6,%xmm3
movapd %xmm3,0x60(%rsp)
mulsd  %xmm4,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
movsd  0xea8(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movapd %xmm2,%xmm0
call   1030 <pow@plt>
mulsd  (%rsp),%xmm0
movapd %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
movaps 0x30(%rsp),%xmm1
call   1030 <pow@plt>
movapd 0x40(%rsp),%xmm3
mulsd  %xmm3,%xmm0
movsd  0xe71(%rip),%xmm4
addsd  %xmm4,%xmm0
subsd  %xmm3,%xmm0
movapd 0x60(%rsp),%xmm5
unpcklpd (%rsp),%xmm5
movapd 0x10(%rsp),%xmm2
movapd %xmm2,%xmm1
unpcklpd %xmm0,%xmm1
divpd  %xmm1,%xmm5
movapd %xmm5,0x80(%rsp)
subsd  %xmm3,%xmm4
mulsd  %xmm3,%xmm4
movapd %xmm4,0x70(%rsp)
movapd 0x30(%rsp),%xmm1
addsd  0xe2f(%rip),%xmm1
movapd %xmm2,%xmm0
call   1030 <pow@plt>
movapd %xmm0,(%rsp)
movapd 0x40(%rsp),%xmm1
movapd 0x70(%rsp),%xmm3
unpcklpd %xmm1,%xmm3
movapd 0x30(%rsp),%xmm2
movapd %xmm2,%xmm0
unpcklpd %xmm1,%xmm0
mulpd  %xmm3,%xmm0
movapd 0x20(%rsp),%xmm1
unpcklpd %xmm2,%xmm1
mulpd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movapd %xmm2,%xmm1
addsd  %xmm2,%xmm1
addsd  0xddb(%rip),%xmm1
movapd 0x10(%rsp),%xmm0
call   1030 <pow@plt>
movapd (%rsp),%xmm1
unpcklpd %xmm0,%xmm1
mulpd  0x20(%rsp),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
subsd  %xmm0,%xmm1
mulsd  0x50(%rsp),%xmm1
movapd %xmm1,(%rsp)
movapd 0x10(%rsp),%xmm0
movaps 0x30(%rsp),%xmm1
call   1030 <pow@plt>
movapd 0x40(%rsp),%xmm1
mulsd  %xmm1,%xmm0
addsd  0xd80(%rip),%xmm0
subsd  %xmm1,%xmm0
movapd %xmm0,0x20(%rsp)
movapd 0x10(%rsp),%xmm0
movaps 0x30(%rsp),%xmm1
call   1030 <pow@plt>
movapd 0x40(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd54(%rip),%xmm2
addsd  %xmm2,%xmm0
subsd  %xmm1,%xmm0
movapd 0x10(%rsp),%xmm1
movapd 0x20(%rsp),%xmm3
unpcklpd %xmm1,%xmm3
unpcklpd %xmm1,%xmm0
mulpd  %xmm3,%xmm0
movapd (%rsp),%xmm3
unpcklpd 0x60(%rsp),%xmm3
divpd  %xmm0,%xmm3
movapd 0x80(%rsp),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm0,%xmm0
movapd %xmm3,%xmm1
unpckhpd %xmm3,%xmm1
subsd  %xmm1,%xmm3
movsd  0x58(%rsp),%xmm1
divsd  %xmm0,%xmm1
mulsd  %xmm3,%xmm1
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
add    $0x98,%rsp
ret

LLVM IR (-O0):
define double @eval_bw_dfdp0(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%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
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
store double %0, double* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double %5, double* %14
store double %6, double* %15
store double %7, double* %16
%23 = load double, double* %15
%24 = load double, double* %9
%25 = load double, double* %12
%26 = call double @llvm.fmuladd.f64(double %24, double %25, double %23)
%27 = load double, double* %11
%28 = fdiv double %26, %27
store double %28, double* %17
%29 = load double, double* %13
%30 = load double, double* %10
%31 = fmul double %29, %30
%32 = load double, double* %9
%33 = fmul double %31, %32
%34 = load double, double* %11
%35 = load double, double* %9
%36 = fsub double %35, 1.000000e+00
%37 = call double @pow(double %34, double %36)
%38 = fmul double %33, %37
%39 = load double, double* %10
%40 = load double, double* %11
%41 = load double, double* %9
%42 = call double @pow(double %40, double %41)
%43 = call double @llvm.fmuladd.f64(double %39, double %42, double 1.000000e+00)
%44 = load double, double* %10
%45 = fsub double %43, %44
%46 = fdiv double %38, %45
store double %46, double* %18
%47 = load double, double* %10
%48 = fsub double 1.000000e+00, %47
%49 = load double, double* %10
%50 = fmul double %48, %49
%51 = load double, double* %9
%52 = fmul double %50, %51
%53 = load double, double* %9
%54 = fsub double %53, 1.000000e+00
%55 = fmul double %52, %54
%56 = load double, double* %11
%57 = load double, double* %9
%58 = fsub double %57, 2.000000e+00
%59 = call double @pow(double %56, double %58)
%60 = fmul double %55, %59
store double %60, double* %19
%61 = load double, double* %10
%62 = load double, double* %10
%63 = fmul double %61, %62
%64 = load double, double* %9
%65 = fmul double %63, %64
%66 = load double, double* %11
%67 = load double, double* %9
%68 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %67, double -2.000000e+00)
%69 = call double @pow(double %66, double %68)
%70 = fmul double %65, %69
store double %70, double* %20
%71 = load double, double* %13
%72 = load double, double* %19
%73 = load double, double* %20
%74 = fsub double %72, %73
%75 = fmul double %71, %74
%76 = load double, double* %10
%77 = load double, double* %11
%78 = load double, double* %9
%79 = call double @pow(double %77, double %78)
%80 = call double @llvm.fmuladd.f64(double %76, double %79, double 1.000000e+00)
%81 = load double, double* %10
%82 = fsub double %80, %81
%83 = load double, double* %10
%84 = load double, double* %11
%85 = load double, double* %9
%86 = call double @pow(double %84, double %85)
%87 = call double @llvm.fmuladd.f64(double %83, double %86, double 1.000000e+00)
%88 = load double, double* %10
%89 = fsub double %87, %88
%90 = fmul double %82, %89
%91 = fdiv double %75, %90
store double %91, double* %21
%92 = load double, double* %15
%93 = load double, double* %9
%94 = load double, double* %12
%95 = call double @llvm.fmuladd.f64(double %93, double %94, double %92)
%96 = load double, double* %11
%97 = load double, double* %11
%98 = fmul double %96, %97
%99 = fdiv double %95, %98
store double %99, double* %22
%100 = load double, double* %16
%101 = load double, double* %17
%102 = load double, double* %18
%103 = fadd double %101, %102
%104 = load double, double* %17
%105 = load double, double* %18
%106 = fadd double %104, %105
%107 = fmul double %103, %106
%108 = fdiv double %100, %107
%109 = load double, double* %21
%110 = load double, double* %22
%111 = fsub double %109, %110
%112 = fneg double %108
%113 = call double @llvm.fmuladd.f64(double %112, double %111, double 1.000000e+00)
ret double %113
}

LLVM IR (-O2):
define double @eval_bw_dfdp0(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = tail call double @llvm.fmuladd.f64(double %0, double %3, double %6)
%10 = fmul double %1, %4
%11 = fmul double %10, %0
%12 = fadd double %0, -1.000000e+00
%13 = tail call double @pow(double %2, double %12)
%14 = fmul double %11, %13
%15 = tail call double @pow(double %2, double %0)
%16 = tail call double @llvm.fmuladd.f64(double %1, double %15, double 1.000000e+00)
%17 = fsub double %16, %1
%18 = insertelement <2 x double> poison, double %9, i64 0
%19 = insertelement <2 x double> %18, double %14, i64 1
%20 = insertelement <2 x double> poison, double %2, i64 0
%21 = insertelement <2 x double> %20, double %17, i64 1
%22 = fdiv <2 x double> %19, %21
%23 = fsub double 1.000000e+00, %1
%24 = fmul double %23, %1
%25 = fadd double %0, -2.000000e+00
%26 = tail call double @pow(double %2, double %25)
%27 = insertelement <2 x double> poison, double %1, i64 1
%28 = insertelement <2 x double> %27, double %24, i64 0
%29 = insertelement <2 x double> poison, double %0, i64 0
%30 = insertelement <2 x double> %29, double %1, i64 1
%31 = fmul <2 x double> %28, %30
%32 = insertelement <2 x double> poison, double %0, i64 1
%33 = insertelement <2 x double> %32, double %12, i64 0
%34 = fmul <2 x double> %31, %33
%35 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double -2.000000e+00)
%36 = tail call double @pow(double %2, double %35)
%37 = insertelement <2 x double> poison, double %26, i64 0
%38 = insertelement <2 x double> %37, double %36, i64 1
%39 = fmul <2 x double> %34, %38
%40 = shufflevector <2 x double> %39, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%41 = fsub <2 x double> %39, %40
%42 = extractelement <2 x double> %41, i64 0
%43 = fmul double %42, %4
%44 = tail call double @pow(double %2, double %0)
%45 = tail call double @llvm.fmuladd.f64(double %1, double %44, double 1.000000e+00)
%46 = fsub double %45, %1
%47 = tail call double @pow(double %2, double %0)
%48 = tail call double @llvm.fmuladd.f64(double %1, double %47, double 1.000000e+00)
%49 = fsub double %48, %1
%50 = insertelement <2 x double> poison, double %2, i64 1
%51 = insertelement <2 x double> %50, double %46, i64 0
%52 = insertelement <2 x double> %50, double %49, i64 0
%53 = fmul <2 x double> %51, %52
%54 = insertelement <2 x double> poison, double %43, i64 0
%55 = insertelement <2 x double> %54, double %9, i64 1
%56 = fdiv <2 x double> %55, %53
%57 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%58 = fadd <2 x double> %22, %57
%59 = fmul <2 x double> %58, %58
%60 = extractelement <2 x double> %59, i64 0
%61 = shufflevector <2 x double> %56, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%62 = fsub <2 x double> %56, %61
%63 = extractelement <2 x double> %62, i64 0
%64 = fneg double %7
%65 = fdiv double %64, %60
%66 = tail call double @llvm.fmuladd.f64(double %65, double %63, double 1.000000e+00)
ret double %66
}