void erdl_coeff(double r, double d, double m1, double *a0, double *a1,
                double *a2) {
  double G, H;
  double g, h;
  double rsq, dsq;
  double m1sq;
  double m2;
  rsq = ((r) * (r));
  dsq = ((d) * (d));
  m1sq = ((m1) * (m1));
  m2 = 1.0 - m1;
  if (m2 < 0.0) {
    m1 = 1.0;
    m2 = 0.0;
  } else if (m2 > 1.0) {
    m1 = 0.0;
    m2 = 1.0;
  }
  G = rsq + dsq;
  H = 2.0 * d * r;
  g = 1.0 - m1sq / ((rsq) * (rsq));
  h = 2.0 * m1 * m2 / rsq;
  *a2 = ((H) * (H)) * g - 2.0 * dsq * h;
  *a1 = H * (h - 2 * G * g);
  *a0 = G * (G * g - h) + 2.0 * dsq * h - ((m2) * (m2));
}


x86 assembly (clang, -O0):
<erdl_coeff>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xeac(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x70(%rbp),%xmm0
jbe    1186 <erdl_coeff+0x86>
movsd  0xe8c(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    11b7 <erdl_coeff+0xb7>
movsd  -0x70(%rbp),%xmm0
movsd  0xe6d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11b2 <erdl_coeff+0xb2>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe53(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    11b7 <erdl_coeff+0xb7>
movsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe3a(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x68(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe08(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xdff(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  0xdd4(%rip),%xmm1
mulsd  -0x60(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  0xd91(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm3
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm3
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm3,%xmm2
addsd  %xmm0,%xmm2
movsd  0xd21(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<erdl_coeff>:
movapd %xmm0,%xmm5
mulsd  %xmm0,%xmm5
movapd %xmm1,%xmm4
mulsd  %xmm1,%xmm4
movsd  0xee8(%rip),%xmm3
movapd %xmm3,%xmm7
subsd  %xmm2,%xmm7
xorpd  %xmm8,%xmm8
ucomisd %xmm7,%xmm8
movapd %xmm3,%xmm6
ja     1150 <erdl_coeff+0x50>
ucomisd 0xec8(%rip),%xmm7
movapd %xmm2,%xmm6
movapd %xmm7,%xmm8
jbe    1150 <erdl_coeff+0x50>
movsd  0xeb4(%rip),%xmm8
xorpd  %xmm6,%xmm6
mulsd  %xmm2,%xmm2
movapd %xmm5,%xmm7
addsd  %xmm4,%xmm7
addsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm5,%xmm0
mulsd  %xmm5,%xmm0
divsd  %xmm0,%xmm2
subsd  %xmm2,%xmm3
addsd  %xmm6,%xmm6
mulsd  %xmm8,%xmm6
divsd  %xmm5,%xmm6
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm4,%xmm4
mulsd  %xmm6,%xmm4
mulsd  %xmm3,%xmm0
subsd  %xmm4,%xmm0
movsd  %xmm0,(%rdx)
movsd  0xe63(%rip),%xmm0
mulsd  %xmm7,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm6,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%rsi)
mulsd  %xmm7,%xmm3
subsd  %xmm6,%xmm3
mulsd  %xmm7,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm8,%xmm8
subsd  %xmm8,%xmm3
movsd  %xmm3,(%rdi)
ret

LLVM IR (-O0):
define void @erdl_coeff(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
%19 = alloca double
%20 = 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
%21 = load double, double* %7
%22 = load double, double* %7
%23 = fmul double %21, %22
store double %23, double* %17
%24 = load double, double* %8
%25 = load double, double* %8
%26 = fmul double %24, %25
store double %26, double* %18
%27 = load double, double* %9
%28 = load double, double* %9
%29 = fmul double %27, %28
store double %29, double* %19
%30 = load double, double* %9
%31 = fsub double 1.000000e+00, %30
store double %31, double* %20
%32 = load double, double* %20
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %34, label %35
34: ; preds = %6
store double 1.000000e+00, double* %9
store double 0.000000e+00, double* %20
br label %40
35: ; preds = %6
%36 = load double, double* %20
%37 = fcmp ogt double %36, 1.000000e+00
br i1 %37, label %38, label %39
38: ; preds = %35
store double 0.000000e+00, double* %9
store double 1.000000e+00, double* %20
br label %39
39: ; preds = %38, %35
br label %40
40: ; preds = %39, %34
%41 = load double, double* %17
%42 = load double, double* %18
%43 = fadd double %41, %42
store double %43, double* %13
%44 = load double, double* %8
%45 = fmul double 2.000000e+00, %44
%46 = load double, double* %7
%47 = fmul double %45, %46
store double %47, double* %14
%48 = load double, double* %19
%49 = load double, double* %17
%50 = load double, double* %17
%51 = fmul double %49, %50
%52 = fdiv double %48, %51
%53 = fsub double 1.000000e+00, %52
store double %53, double* %15
%54 = load double, double* %9
%55 = fmul double 2.000000e+00, %54
%56 = load double, double* %20
%57 = fmul double %55, %56
%58 = load double, double* %17
%59 = fdiv double %57, %58
store double %59, double* %16
%60 = load double, double* %14
%61 = load double, double* %14
%62 = fmul double %60, %61
%63 = load double, double* %15
%64 = load double, double* %18
%65 = fmul double 2.000000e+00, %64
%66 = load double, double* %16
%67 = fmul double %65, %66
%68 = fneg double %67
%69 = call double @llvm.fmuladd.f64(double %62, double %63, double %68)
%70 = load double*, double** %12
store double %69, double* %70
%71 = load double, double* %14
%72 = load double, double* %16
%73 = load double, double* %13
%74 = fmul double 2.000000e+00, %73
%75 = load double, double* %15
%76 = fneg double %74
%77 = call double @llvm.fmuladd.f64(double %76, double %75, double %72)
%78 = fmul double %71, %77
%79 = load double*, double** %11
store double %78, double* %79
%80 = load double, double* %13
%81 = load double, double* %13
%82 = load double, double* %15
%83 = load double, double* %16
%84 = fneg double %83
%85 = call double @llvm.fmuladd.f64(double %81, double %82, double %84)
%86 = load double, double* %18
%87 = fmul double 2.000000e+00, %86
%88 = load double, double* %16
%89 = fmul double %87, %88
%90 = call double @llvm.fmuladd.f64(double %80, double %85, double %89)
%91 = load double, double* %20
%92 = load double, double* %20
%93 = fneg double %91
%94 = call double @llvm.fmuladd.f64(double %93, double %92, double %90)
%95 = load double*, double** %10
store double %94, double* %95
ret void
}

LLVM IR (-O2):
define void @erdl_coeff(double %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = fmul double %0, %0
%8 = fmul double %1, %1
%9 = fsub double 1.000000e+00, %2
%10 = fcmp olt double %9, 0.000000e+00
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = fcmp ogt double %9, 1.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %11
br label %14
14: ; preds = %6, %11, %13
%15 = phi double [ 0.000000e+00, %13 ], [ %2, %11 ], [ 1.000000e+00, %6 ]
%16 = phi double [ 1.000000e+00, %13 ], [ %9, %11 ], [ 0.000000e+00, %6 ]
%17 = fmul double %2, %2
%18 = fadd double %7, %8
%19 = fmul double %1, 2.000000e+00
%20 = fmul double %19, %0
%21 = fmul double %7, %7
%22 = fdiv double %17, %21
%23 = fsub double 1.000000e+00, %22
%24 = fmul double %15, 2.000000e+00
%25 = fmul double %24, %16
%26 = fdiv double %25, %7
%27 = fmul double %20, %20
%28 = fmul double %8, 2.000000e+00
%29 = fmul double %28, %26
%30 = fneg double %29
%31 = tail call double @llvm.fmuladd.f64(double %27, double %23, double %30)
store double %31, double* %5
%32 = fmul double %18, -2.000000e+00
%33 = tail call double @llvm.fmuladd.f64(double %32, double %23, double %26)
%34 = fmul double %20, %33
store double %34, double* %4
%35 = fneg double %26
%36 = tail call double @llvm.fmuladd.f64(double %18, double %23, double %35)
%37 = tail call double @llvm.fmuladd.f64(double %18, double %36, double %29)
%38 = fneg double %16
%39 = tail call double @llvm.fmuladd.f64(double %38, double %16, double %37)
store double %39, double* %3
ret void
}