double drag_cd_g6(double mach) {
  if (mach > 2.0)
    return 0.746228 + mach * (-0.255926 + mach * 0.0291726);
  else if (mach > 1.1)
    return 0.513638 + mach * (-0.015269 - mach * 0.0331221);
  else if (mach > 0.9)
    return -0.908802 + mach * 1.25814;
  else if (mach >= 0.6)
    return 0.366723 + mach * (-0.458435 + mach * 0.337906);
  else
    return 0.264481 + mach * (-0.157237 + mach * 0.117441);
}


x86 assembly (clang, -O0):
<drag_cd_g6>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    115c <drag_cd_g6+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    128e <drag_cd_g6+0x18e>
movsd  -0x10(%rbp),%xmm0
movsd  0xe9f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c6 <drag_cd_g6+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    128e <drag_cd_g6+0x18e>
movsd  -0x10(%rbp),%xmm0
movsd  0xe3d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1204 <drag_cd_g6+0x104>
movsd  -0x10(%rbp),%xmm0
movsd  0xe66(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe62(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    128e <drag_cd_g6+0x18e>
movsd  -0x10(%rbp),%xmm0
movsd  0xe07(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1257 <drag_cd_g6+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    128e <drag_cd_g6+0x18e>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xdbf(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xdbb(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd9b(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<drag_cd_g6>:
ucomisd 0xef8(%rip),%xmm0
jbe    112f <drag_cd_g6+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_g6+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_g6+0x79>
mulsd  0xee0(%rip),%xmm0
addsd  0xee0(%rip),%xmm0
ret
ucomisd 0xe97(%rip),%xmm0
jae    11a8 <drag_cd_g6+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_g6(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.917260e-02, double -2.559260e-01)
%10 = call double @llvm.fmuladd.f64(double %7, double %9, double 7.462280e-01)
store double %10, double* %2
br label %39
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 3.312210e-02, double -1.526900e-02)
%19 = call double @llvm.fmuladd.f64(double %15, double %18, double 5.136380e-01)
store double %19, double* %2
br label %39
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.258140e+00, double -9.088020e-01)
store double %25, double* %2
br label %39
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 3.379060e-01, double -4.584350e-01)
%33 = call double @llvm.fmuladd.f64(double %30, double %32, double 3.667230e-01)
store double %33, double* %2
br label %39
34: ; preds = %26
%35 = load double, double* %3
%36 = load double, double* %3
%37 = call double @llvm.fmuladd.f64(double %36, double 1.174410e-01, double -1.572370e-01)
%38 = call double @llvm.fmuladd.f64(double %35, double %37, double 2.644810e-01)
store double %38, double* %2
br label %39
39: ; preds = %34, %29, %23, %14, %6
%40 = load double, double* %2
ret double %40
}

LLVM IR (-O2):
define double @drag_cd_g6(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.917260e-02, double -2.559260e-01)
%5 = tail call double @llvm.fmuladd.f64(double %0, double %4, double 7.462280e-01)
br label %24
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 3.312210e-02, double -1.526900e-02)
%11 = tail call double @llvm.fmuladd.f64(double %0, double %10, double 5.136380e-01)
br label %24
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.258140e+00, double -9.088020e-01)
br label %24
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 3.379060e-01, double -4.584350e-01)
%20 = tail call double @llvm.fmuladd.f64(double %0, double %19, double 3.667230e-01)
br label %24
21: ; preds = %16
%22 = tail call double @llvm.fmuladd.f64(double %0, double 1.174410e-01, double -1.572370e-01)
%23 = tail call double @llvm.fmuladd.f64(double %0, double %22, double 2.644810e-01)
br label %24
24: ; preds = %21, %18, %14, %8, %3
%25 = phi double [ %5, %3 ], [ %11, %8 ], [ %15, %14 ], [ %20, %18 ], [ %23, %21 ]
ret double %25
}