double drag_cd_g1(double mach) {
  if (mach > 2.0)
    return 0.9482590 + mach * (-0.248367 + mach * 0.0344343);
  else if (mach > 1.40)
    return 0.6796810 + mach * (0.0705311 - mach * 0.0570628);
  else if (mach > 1.10)
    return -1.471970 + mach * (3.1652900 - mach * 1.1728200);
  else if (mach > 0.85)
    return -0.647392 + mach * (0.9421060 + mach * 0.1806040);
  else if (mach >= 0.55)
    return 0.6224890 + mach * (-1.426820 + mach * 1.2094500);
  else
    return 0.2637320 + mach * (-0.165665 + mach * 0.0852214);
}


x86 assembly (clang, -O0):
<drag_cd_g1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    115c <drag_cd_g1+0x5c>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xf76(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xf72(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xf52(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130d <drag_cd_g1+0x20d>
movsd  -0x10(%rbp),%xmm0
movsd  0xe9f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c6 <drag_cd_g1+0xc6>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xef4(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xef0(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed0(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130d <drag_cd_g1+0x20d>
movsd  -0x10(%rbp),%xmm0
movsd  0xe3d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1230 <drag_cd_g1+0x130>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xe72(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe6e(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe4e(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130d <drag_cd_g1+0x20d>
movsd  -0x10(%rbp),%xmm0
movsd  0xddb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1283 <drag_cd_g1+0x183>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe07(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe03(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xde3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130d <drag_cd_g1+0x20d>
movsd  -0x10(%rbp),%xmm0
movsd  0xd90(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12d6 <drag_cd_g1+0x1d6>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xd9c(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd98(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd78(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130d <drag_cd_g1+0x20d>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xd48(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd44(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd24(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<drag_cd_g1>:
ucomisd 0xef8(%rip),%xmm0
jbe    112f <drag_cd_g1+0x2f>
movsd  0xf8e(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xf8a(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xf86(%rip),%xmm1
movapd %xmm1,%xmm0
ret
ucomisd 0xed1(%rip),%xmm0
jbe    115e <drag_cd_g1+0x5e>
movsd  0xf47(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xf43(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xf3f(%rip),%xmm1
movapd %xmm1,%xmm0
ret
ucomisd 0xeaa(%rip),%xmm0
jbe    118d <drag_cd_g1+0x8d>
movsd  0xf00(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xefc(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xef8(%rip),%xmm1
movapd %xmm1,%xmm0
ret
ucomisd 0xe83(%rip),%xmm0
jbe    11bc <drag_cd_g1+0xbc>
movsd  0xeb9(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xeb5(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xeb1(%rip),%xmm1
movapd %xmm1,%xmm0
ret
ucomisd 0xe5c(%rip),%xmm0
jae    11eb <drag_cd_g1+0xeb>
movsd  0xe72(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe6e(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe6a(%rip),%xmm1
movapd %xmm1,%xmm0
ret
movsd  0xe35(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe31(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe2d(%rip),%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @drag_cd_g1(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 3.443430e-02, double -2.483670e-01)
%10 = call double @llvm.fmuladd.f64(double %7, double %9, double 0x3FEE5823422467BE)
store double %10, double* %2
br label %50
11: ; preds = %1
%12 = load double, double* %3
%13 = fcmp ogt double %12, 1.400000e+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 5.706280e-02, double 0x3FB20E537FD9D4F3)
%19 = call double @llvm.fmuladd.f64(double %15, double %18, double 6.796810e-01)
store double %19, double* %2
br label %50
20: ; preds = %11
%21 = load double, double* %3
%22 = fcmp ogt double %21, 1.100000e+00
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load double, double* %3
%25 = load double, double* %3
%26 = fneg double %25
%27 = call double @llvm.fmuladd.f64(double %26, double 1.172820e+00, double 3.165290e+00)
%28 = call double @llvm.fmuladd.f64(double %24, double %27, double -1.471970e+00)
store double %28, double* %2
br label %50
29: ; preds = %20
%30 = load double, double* %3
%31 = fcmp ogt double %30, 8.500000e-01
br i1 %31, label %32, label %37
32: ; preds = %29
%33 = load double, double* %3
%34 = load double, double* %3
%35 = call double @llvm.fmuladd.f64(double %34, double 1.806040e-01, double 9.421060e-01)
%36 = call double @llvm.fmuladd.f64(double %33, double %35, double -6.473920e-01)
store double %36, double* %2
br label %50
37: ; preds = %29
%38 = load double, double* %3
%39 = fcmp oge double %38, 5.500000e-01
br i1 %39, label %40, label %45
40: ; preds = %37
%41 = load double, double* %3
%42 = load double, double* %3
%43 = call double @llvm.fmuladd.f64(double %42, double 1.209450e+00, double -1.426820e+00)
%44 = call double @llvm.fmuladd.f64(double %41, double %43, double 6.224890e-01)
store double %44, double* %2
br label %50
45: ; preds = %37
%46 = load double, double* %3
%47 = load double, double* %3
%48 = call double @llvm.fmuladd.f64(double %47, double 8.522140e-02, double -1.656650e-01)
%49 = call double @llvm.fmuladd.f64(double %46, double %48, double 2.637320e-01)
store double %49, double* %2
br label %50
50: ; preds = %45, %40, %32, %23, %14, %6
%51 = load double, double* %2
ret double %51
}

LLVM IR (-O2):
define double @drag_cd_g1(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 3.443430e-02, double -2.483670e-01)
%5 = tail call double @llvm.fmuladd.f64(double %0, double %4, double 0x3FEE5823422467BE)
br label %31
6: ; preds = %1
%7 = fcmp ogt double %0, 1.400000e+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 5.706280e-02, double 0x3FB20E537FD9D4F3)
%11 = tail call double @llvm.fmuladd.f64(double %0, double %10, double 6.796810e-01)
br label %31
12: ; preds = %6
%13 = fcmp ogt double %0, 1.100000e+00
br i1 %13, label %14, label %18
14: ; preds = %12
%15 = fneg double %0
%16 = tail call double @llvm.fmuladd.f64(double %15, double 1.172820e+00, double 3.165290e+00)
%17 = tail call double @llvm.fmuladd.f64(double %0, double %16, double -1.471970e+00)
br label %31
18: ; preds = %12
%19 = fcmp ogt double %0, 8.500000e-01
br i1 %19, label %20, label %23
20: ; preds = %18
%21 = tail call double @llvm.fmuladd.f64(double %0, double 1.806040e-01, double 9.421060e-01)
%22 = tail call double @llvm.fmuladd.f64(double %0, double %21, double -6.473920e-01)
br label %31
23: ; preds = %18
%24 = fcmp ult double %0, 5.500000e-01
br i1 %24, label %28, label %25
25: ; preds = %23
%26 = tail call double @llvm.fmuladd.f64(double %0, double 1.209450e+00, double -1.426820e+00)
%27 = tail call double @llvm.fmuladd.f64(double %0, double %26, double 6.224890e-01)
br label %31
28: ; preds = %23
%29 = tail call double @llvm.fmuladd.f64(double %0, double 8.522140e-02, double -1.656650e-01)
%30 = tail call double @llvm.fmuladd.f64(double %0, double %29, double 2.637320e-01)
br label %31
31: ; preds = %28, %25, %20, %14, %8, %3
%32 = phi double [ %5, %3 ], [ %11, %8 ], [ %17, %14 ], [ %22, %20 ], [ %27, %25 ], [ %30, %28 ]
ret double %32
}