double drag_cd_g5(double mach) {
  if (mach > 2.0)
    return 0.671388 + mach * (-0.185208 + mach * 0.0204508);
  else if (mach > 1.1)
    return 0.134374 + mach * (0.4378330 - mach * 0.1570190);
  else if (mach > 0.9)
    return -0.924258 + mach * 1.24904;
  else if (mach >= 0.6)
    return 0.654405 + mach * (-1.4275000 + mach * 0.998463);
  else
    return 0.186386 + mach * (-0.0342136 - mach * 0.035691);
}


x86 assembly (clang, -O0):
<drag_cd_g5>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    115c <drag_cd_g5+0x5c>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xf4e(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xf4a(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xf2a(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a5 <drag_cd_g5+0x1a5>
movsd  -0x10(%rbp),%xmm0
movsd  0xe9f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c6 <drag_cd_g5+0xc6>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xecc(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xec8(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea8(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a5 <drag_cd_g5+0x1a5>
movsd  -0x10(%rbp),%xmm0
movsd  0xe3d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1204 <drag_cd_g5+0x104>
movsd  -0x10(%rbp),%xmm0
movsd  0xe66(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe62(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a5 <drag_cd_g5+0x1a5>
movsd  -0x10(%rbp),%xmm0
movsd  0xe07(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1257 <drag_cd_g5+0x157>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe13(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe0f(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdef(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a5 <drag_cd_g5+0x1a5>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xda8(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xda4(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd84(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<drag_cd_g5>:
ucomisd 0xef8(%rip),%xmm0
jbe    112f <drag_cd_g5+0x2f>
movsd  0xf66(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xf62(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xf5e(%rip),%xmm1
movapd %xmm1,%xmm0
ret
ucomisd 0xed1(%rip),%xmm0
jbe    115e <drag_cd_g5+0x5e>
movsd  0xf1f(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xf1b(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xf17(%rip),%xmm1
movapd %xmm1,%xmm0
ret
ucomisd 0xeaa(%rip),%xmm0
jbe    1179 <drag_cd_g5+0x79>
mulsd  0xee0(%rip),%xmm0
addsd  0xee0(%rip),%xmm0
ret
ucomisd 0xe97(%rip),%xmm0
jae    11a8 <drag_cd_g5+0xa8>
movsd  0xead(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xea9(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xea5(%rip),%xmm1
movapd %xmm1,%xmm0
ret
movsd  0xe70(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe6c(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe68(%rip),%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @drag_cd_g5(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ogt double %4, 2.000000e+00
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load double, double* %3
%8 = load double, double* %3
%9 = call double @llvm.fmuladd.f64(double %8, double 2.045080e-02, double -1.852080e-01)
%10 = call double @llvm.fmuladd.f64(double %7, double %9, double 6.713880e-01)
store double %10, double* %2
br label %40
11: ; preds = %1
%12 = load double, double* %3
%13 = fcmp ogt double %12, 1.100000e+00
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load double, double* %3
%16 = load double, double* %3
%17 = fneg double %16
%18 = call double @llvm.fmuladd.f64(double %17, double 1.570190e-01, double 4.378330e-01)
%19 = call double @llvm.fmuladd.f64(double %15, double %18, double 1.343740e-01)
store double %19, double* %2
br label %40
20: ; preds = %11
%21 = load double, double* %3
%22 = fcmp ogt double %21, 9.000000e-01
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load double, double* %3
%25 = call double @llvm.fmuladd.f64(double %24, double 1.249040e+00, double -9.242580e-01)
store double %25, double* %2
br label %40
26: ; preds = %20
%27 = load double, double* %3
%28 = fcmp oge double %27, 6.000000e-01
br i1 %28, label %29, label %34
29: ; preds = %26
%30 = load double, double* %3
%31 = load double, double* %3
%32 = call double @llvm.fmuladd.f64(double %31, double 0x3FEFF368AD688377, double -1.427500e+00)
%33 = call double @llvm.fmuladd.f64(double %30, double %32, double 6.544050e-01)
store double %33, double* %2
br label %40
34: ; preds = %26
%35 = load double, double* %3
%36 = load double, double* %3
%37 = fneg double %36
%38 = call double @llvm.fmuladd.f64(double %37, double 3.569100e-02, double -3.421360e-02)
%39 = call double @llvm.fmuladd.f64(double %35, double %38, double 1.863860e-01)
store double %39, double* %2
br label %40
40: ; preds = %34, %29, %23, %14, %6
%41 = load double, double* %2
ret double %41
}

LLVM IR (-O2):
define double @drag_cd_g5(double %0) {
%2 = fcmp ogt double %0, 2.000000e+00
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call double @llvm.fmuladd.f64(double %0, double 2.045080e-02, double -1.852080e-01)
%5 = tail call double @llvm.fmuladd.f64(double %0, double %4, double 6.713880e-01)
br label %25
6: ; preds = %1
%7 = fcmp ogt double %0, 1.100000e+00
br i1 %7, label %8, label %12
8: ; preds = %6
%9 = fneg double %0
%10 = tail call double @llvm.fmuladd.f64(double %9, double 1.570190e-01, double 4.378330e-01)
%11 = tail call double @llvm.fmuladd.f64(double %0, double %10, double 1.343740e-01)
br label %25
12: ; preds = %6
%13 = fcmp ogt double %0, 9.000000e-01
br i1 %13, label %14, label %16
14: ; preds = %12
%15 = tail call double @llvm.fmuladd.f64(double %0, double 1.249040e+00, double -9.242580e-01)
br label %25
16: ; preds = %12
%17 = fcmp ult double %0, 6.000000e-01
br i1 %17, label %21, label %18
18: ; preds = %16
%19 = tail call double @llvm.fmuladd.f64(double %0, double 0x3FEFF368AD688377, double -1.427500e+00)
%20 = tail call double @llvm.fmuladd.f64(double %0, double %19, double 6.544050e-01)
br label %25
21: ; preds = %16
%22 = fneg double %0
%23 = tail call double @llvm.fmuladd.f64(double %22, double 3.569100e-02, double -3.421360e-02)
%24 = tail call double @llvm.fmuladd.f64(double %0, double %23, double 1.863860e-01)
br label %25
25: ; preds = %21, %18, %14, %8, %3
%26 = phi double [ %5, %3 ], [ %11, %8 ], [ %15, %14 ], [ %20, %18 ], [ %24, %21 ]
ret double %26
}