double calculate(double a) {
  double b = 0;
  if (a > 1000) {
    b = (a - 1000) * 10.97 + 4450 + 790 + 1870;
  } else if (a > 500) {
    b = (a - 500) * 8.9 + 790 + 1870;
  } else if (a > 400) {
    b = (a - 400) * 7.9 + 1870;
  } else if (a > 300) {
    b = (a - 300) * 6.9 + 1180;
  } else if (a > 200) {
    b = (a - 200) * 5.9 + 590;
  } else if (a > 150) {
    b = (a - 150) * 4.5 + 365;
  } else if (a > 100) {
    b = (a - 100) * 3.55 + 187.5;
  } else if (a > 50) {
    b = (a - 50) * 2.6 + 57.5;
  } else {
    b = a * 1.15;
  }
  return b;
}


x86 assembly (clang, -O0):
<calculate>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1173 <calculate+0x73>
movsd  -0x8(%rbp),%xmm0
movsd  0xecb(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xf77(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xf73(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xf57(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xf3b(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    13ba <calculate+0x2ba>
movsd  -0x8(%rbp),%xmm0
movsd  0xe88(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c9 <calculate+0xc9>
movsd  -0x8(%rbp),%xmm0
movsd  0xe71(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xf05(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xf01(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xee5(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    13b5 <calculate+0x2b5>
movsd  -0x8(%rbp),%xmm0
movsd  0xe3a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1213 <calculate+0x113>
movsd  -0x8(%rbp),%xmm0
movsd  0xe23(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe9f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9b(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    13b0 <calculate+0x2b0>
movsd  -0x8(%rbp),%xmm0
movsd  0xdf8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    125d <calculate+0x15d>
movsd  -0x8(%rbp),%xmm0
movsd  0xde1(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe45(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe41(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    13ab <calculate+0x2ab>
movsd  -0x8(%rbp),%xmm0
movsd  0xdb6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12a7 <calculate+0x1a7>
movsd  -0x8(%rbp),%xmm0
movsd  0xd9f(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xdeb(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xde7(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    13a6 <calculate+0x2a6>
movsd  -0x8(%rbp),%xmm0
movsd  0xd74(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12f1 <calculate+0x1f1>
movsd  -0x8(%rbp),%xmm0
movsd  0xd5d(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xd91(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd8d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    13a1 <calculate+0x2a1>
movsd  -0x8(%rbp),%xmm0
movsd  0xd32(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    133b <calculate+0x23b>
movsd  -0x8(%rbp),%xmm0
movsd  0xd1b(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xd37(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd33(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    139c <calculate+0x29c>
movsd  -0x8(%rbp),%xmm0
movsd  0xcf0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1385 <calculate+0x285>
movsd  -0x8(%rbp),%xmm0
movsd  0xcd9(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xcdd(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcd9(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1397 <calculate+0x297>
movsd  0xcb3(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    139c <calculate+0x29c>
jmp    13a1 <calculate+0x2a1>
jmp    13a6 <calculate+0x2a6>
jmp    13ab <calculate+0x2ab>
jmp    13b0 <calculate+0x2b0>
jmp    13b5 <calculate+0x2b5>
jmp    13ba <calculate+0x2ba>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate>:
ucomisd 0xef8(%rip),%xmm0
jbe    1124 <calculate+0x24>
addsd  0xfde(%rip),%xmm0
mulsd  0xfde(%rip),%xmm0
addsd  0xfde(%rip),%xmm0
jmp    113e <calculate+0x3e>
ucomisd 0xedc(%rip),%xmm0
jbe    114f <calculate+0x4f>
addsd  0xfa2(%rip),%xmm0
mulsd  0xfa2(%rip),%xmm0
addsd  0xfa2(%rip),%xmm0
addsd  0xf82(%rip),%xmm0
ret
ucomisd 0xeb9(%rip),%xmm0
jbe    1172 <calculate+0x72>
addsd  0xf5f(%rip),%xmm0
mulsd  0xf5f(%rip),%xmm0
addsd  0xf5f(%rip),%xmm0
ret
ucomisd 0xe9e(%rip),%xmm0
jbe    1195 <calculate+0x95>
addsd  0xf24(%rip),%xmm0
mulsd  0xf24(%rip),%xmm0
addsd  0xf24(%rip),%xmm0
ret
ucomisd 0xe83(%rip),%xmm0
jbe    11b8 <calculate+0xb8>
addsd  0xee9(%rip),%xmm0
mulsd  0xee9(%rip),%xmm0
addsd  0xee9(%rip),%xmm0
ret
ucomisd 0xe68(%rip),%xmm0
jbe    11db <calculate+0xdb>
addsd  0xeae(%rip),%xmm0
mulsd  0xeae(%rip),%xmm0
addsd  0xeae(%rip),%xmm0
ret
ucomisd 0xe4d(%rip),%xmm0
jbe    11fe <calculate+0xfe>
addsd  0xe73(%rip),%xmm0
mulsd  0xe73(%rip),%xmm0
addsd  0xe73(%rip),%xmm0
ret
ucomisd 0xe32(%rip),%xmm0
jbe    1221 <calculate+0x121>
addsd  0xe38(%rip),%xmm0
mulsd  0xe38(%rip),%xmm0
addsd  0xe38(%rip),%xmm0
ret
mulsd  0xe17(%rip),%xmm0
ret

LLVM IR (-O0):
define double @calculate(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 0.000000e+00, double* %3
%4 = load double, double* %2
%5 = fcmp ogt double %4, 1.000000e+03
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load double, double* %2
%8 = fsub double %7, 1.000000e+03
%9 = call double @llvm.fmuladd.f64(double %8, double 1.097000e+01, double 4.450000e+03)
%10 = fadd double %9, 7.900000e+02
%11 = fadd double %10, 1.870000e+03
store double %11, double* %3
br label %72
12: ; preds = %1
%13 = load double, double* %2
%14 = fcmp ogt double %13, 5.000000e+02
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load double, double* %2
%17 = fsub double %16, 5.000000e+02
%18 = call double @llvm.fmuladd.f64(double %17, double 8.900000e+00, double 7.900000e+02)
%19 = fadd double %18, 1.870000e+03
store double %19, double* %3
br label %71
20: ; preds = %12
%21 = load double, double* %2
%22 = fcmp ogt double %21, 4.000000e+02
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load double, double* %2
%25 = fsub double %24, 4.000000e+02
%26 = call double @llvm.fmuladd.f64(double %25, double 7.900000e+00, double 1.870000e+03)
store double %26, double* %3
br label %70
27: ; preds = %20
%28 = load double, double* %2
%29 = fcmp ogt double %28, 3.000000e+02
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load double, double* %2
%32 = fsub double %31, 3.000000e+02
%33 = call double @llvm.fmuladd.f64(double %32, double 6.900000e+00, double 1.180000e+03)
store double %33, double* %3
br label %69
34: ; preds = %27
%35 = load double, double* %2
%36 = fcmp ogt double %35, 2.000000e+02
br i1 %36, label %37, label %41
37: ; preds = %34
%38 = load double, double* %2
%39 = fsub double %38, 2.000000e+02
%40 = call double @llvm.fmuladd.f64(double %39, double 5.900000e+00, double 5.900000e+02)
store double %40, double* %3
br label %68
41: ; preds = %34
%42 = load double, double* %2
%43 = fcmp ogt double %42, 1.500000e+02
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = load double, double* %2
%46 = fsub double %45, 1.500000e+02
%47 = call double @llvm.fmuladd.f64(double %46, double 4.500000e+00, double 3.650000e+02)
store double %47, double* %3
br label %67
48: ; preds = %41
%49 = load double, double* %2
%50 = fcmp ogt double %49, 1.000000e+02
br i1 %50, label %51, label %55
51: ; preds = %48
%52 = load double, double* %2
%53 = fsub double %52, 1.000000e+02
%54 = call double @llvm.fmuladd.f64(double %53, double 3.550000e+00, double 1.875000e+02)
store double %54, double* %3
br label %66
55: ; preds = %48
%56 = load double, double* %2
%57 = fcmp ogt double %56, 5.000000e+01
br i1 %57, label %58, label %62
58: ; preds = %55
%59 = load double, double* %2
%60 = fsub double %59, 5.000000e+01
%61 = call double @llvm.fmuladd.f64(double %60, double 2.600000e+00, double 5.750000e+01)
store double %61, double* %3
br label %65
62: ; preds = %55
%63 = load double, double* %2
%64 = fmul double %63, 1.150000e+00
store double %64, double* %3
br label %65
65: ; preds = %62, %58
br label %66
66: ; preds = %65, %51
br label %67
67: ; preds = %66, %44
br label %68
68: ; preds = %67, %37
br label %69
69: ; preds = %68, %30
br label %70
70: ; preds = %69, %23
br label %71
71: ; preds = %70, %15
br label %72
72: ; preds = %71, %6
%73 = load double, double* %3
ret double %73
}

LLVM IR (-O2):
define double @calculate(double %0) {
%2 = fcmp ogt double %0, 1.000000e+03
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = fadd double %0, -1.000000e+03
%5 = tail call double @llvm.fmuladd.f64(double %4, double 1.097000e+01, double 4.450000e+03)
%6 = fadd double %5, 7.900000e+02
%7 = fadd double %6, 1.870000e+03
br label %46
8: ; preds = %1
%9 = fcmp ogt double %0, 5.000000e+02
br i1 %9, label %10, label %14
10: ; preds = %8
%11 = fadd double %0, -5.000000e+02
%12 = tail call double @llvm.fmuladd.f64(double %11, double 8.900000e+00, double 7.900000e+02)
%13 = fadd double %12, 1.870000e+03
br label %46
14: ; preds = %8
%15 = fcmp ogt double %0, 4.000000e+02
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = fadd double %0, -4.000000e+02
%18 = tail call double @llvm.fmuladd.f64(double %17, double 7.900000e+00, double 1.870000e+03)
br label %46
19: ; preds = %14
%20 = fcmp ogt double %0, 3.000000e+02
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = fadd double %0, -3.000000e+02
%23 = tail call double @llvm.fmuladd.f64(double %22, double 6.900000e+00, double 1.180000e+03)
br label %46
24: ; preds = %19
%25 = fcmp ogt double %0, 2.000000e+02
br i1 %25, label %26, label %29
26: ; preds = %24
%27 = fadd double %0, -2.000000e+02
%28 = tail call double @llvm.fmuladd.f64(double %27, double 5.900000e+00, double 5.900000e+02)
br label %46
29: ; preds = %24
%30 = fcmp ogt double %0, 1.500000e+02
br i1 %30, label %31, label %34
31: ; preds = %29
%32 = fadd double %0, -1.500000e+02
%33 = tail call double @llvm.fmuladd.f64(double %32, double 4.500000e+00, double 3.650000e+02)
br label %46
34: ; preds = %29
%35 = fcmp ogt double %0, 1.000000e+02
br i1 %35, label %36, label %39
36: ; preds = %34
%37 = fadd double %0, -1.000000e+02
%38 = tail call double @llvm.fmuladd.f64(double %37, double 3.550000e+00, double 1.875000e+02)
br label %46
39: ; preds = %34
%40 = fcmp ogt double %0, 5.000000e+01
br i1 %40, label %41, label %44
41: ; preds = %39
%42 = fadd double %0, -5.000000e+01
%43 = tail call double @llvm.fmuladd.f64(double %42, double 2.600000e+00, double 5.750000e+01)
br label %46
44: ; preds = %39
%45 = fmul double %0, 1.150000e+00
br label %46
46: ; preds = %10, %21, %31, %41, %44, %36, %26, %16, %3
%47 = phi double [ %7, %3 ], [ %13, %10 ], [ %18, %16 ], [ %23, %21 ], [ %28, %26 ], [ %33, %31 ], [ %38, %36 ], [ %43, %41 ], [ %45, %44 ]
ret double %47
}