double calc_temp(double alt) {
  double geopot_height = alt / 1000.0;
  if (geopot_height <= 11.0)
    return 288.15f - (6.5 * geopot_height);
  else if (geopot_height <= 20.0)
    return 216.65f;
  else if (geopot_height <= 32.0)
    return 196.65f + geopot_height;
  else if (geopot_height <= 47.0)
    return 228.65f + 2.8 * (geopot_height - 32.0);
  else if (geopot_height <= 51.0)
    return 270.65f;
  else if (geopot_height <= 71.0)
    return 270.65f - 2.8 * (geopot_height - 51.0);
  else if (geopot_height <= 84.85)
    return 214.65f - 2.0 * (geopot_height - 71.0);
}


x86 assembly (clang, -O0):
<calc_temp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xef2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xed9(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1159 <calc_temp+0x59>
movsd  -0x18(%rbp),%xmm0
movsd  0xf39(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xf35(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b5 <calc_temp+0x1b5>
movsd  0xeaf(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     117e <calc_temp+0x7e>
movsd  0xefc(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b5 <calc_temp+0x1b5>
movsd  0xe92(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     11a8 <calc_temp+0xa8>
movsd  0xecf(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b5 <calc_temp+0x1b5>
movsd  0xe70(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     11ee <calc_temp+0xee>
movsd  -0x18(%rbp),%xmm0
movsd  0xe50(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe84(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe80(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b5 <calc_temp+0x1b5>
movsd  0xe32(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1213 <calc_temp+0x113>
movsd  0xe47(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b5 <calc_temp+0x1b5>
movsd  0xe15(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1259 <calc_temp+0x159>
movsd  -0x18(%rbp),%xmm0
movsd  0xdf5(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe09(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe05(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b5 <calc_temp+0x1b5>
movsd  0xdd7(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1297 <calc_temp+0x197>
movsd  -0x18(%rbp),%xmm1
movsd  0xdb7(%rip),%xmm0
subsd  %xmm0,%xmm1
addsd  %xmm1,%xmm1
movsd  0xdb7(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b5 <calc_temp+0x1b5>
jmp    129c <calc_temp+0x19c>
jmp    12a1 <calc_temp+0x1a1>
jmp    12a6 <calc_temp+0x1a6>
jmp    12ab <calc_temp+0x1ab>
jmp    12b0 <calc_temp+0x1b0>
jmp    12b5 <calc_temp+0x1b5>
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_temp>:
divsd  0xef8(%rip),%xmm0
movsd  0xef8(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1187 <calc_temp+0x87>
movsd  0xf0a(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1198 <calc_temp+0x98>
movsd  0xf04(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11a1 <calc_temp+0xa1>
movsd  0xf06(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11aa <calc_temp+0xaa>
movsd  0xf20(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11c3 <calc_temp+0xc3>
movsd  0xf1a(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11cc <calc_temp+0xcc>
movsd  0xf24(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     1186 <calc_temp+0x86>
addsd  0xf1e(%rip),%xmm0
addsd  %xmm0,%xmm0
movsd  0xf1a(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret
mulsd  0xe81(%rip),%xmm0
addsd  0xe81(%rip),%xmm0
ret
movsd  0xe80(%rip),%xmm0
ret
addsd  0xe8f(%rip),%xmm0
ret
addsd  0xe96(%rip),%xmm0
mulsd  0xe96(%rip),%xmm0
addsd  0xe96(%rip),%xmm0
ret
movsd  0xe95(%rip),%xmm0
ret
addsd  0xea4(%rip),%xmm0
mulsd  0xea4(%rip),%xmm0
addsd  0xe7c(%rip),%xmm0
ret

LLVM IR (-O0):
define double @calc_temp(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = fdiv double %5, 1.000000e+03
store double %6, double* %4
%7 = load double, double* %4
%8 = fcmp ole double %7, 1.100000e+01
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load double, double* %4
%11 = call double @llvm.fmuladd.f64(double -6.500000e+00, double %10, double 0x4072026660000000)
store double %11, double* %2
br label %53
12: ; preds = %1
%13 = load double, double* %4
%14 = fcmp ole double %13, 2.000000e+01
br i1 %14, label %15, label %16
15: ; preds = %12
store double 0x406B14CCC0000000, double* %2
br label %53
16: ; preds = %12
%17 = load double, double* %4
%18 = fcmp ole double %17, 3.200000e+01
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load double, double* %4
%21 = fadd double 0x406894CCC0000000, %20
store double %21, double* %2
br label %53
22: ; preds = %16
%23 = load double, double* %4
%24 = fcmp ole double %23, 4.700000e+01
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = load double, double* %4
%27 = fsub double %26, 3.200000e+01
%28 = call double @llvm.fmuladd.f64(double 2.800000e+00, double %27, double 0x406C94CCC0000000)
store double %28, double* %2
br label %53
29: ; preds = %22
%30 = load double, double* %4
%31 = fcmp ole double %30, 5.100000e+01
br i1 %31, label %32, label %33
32: ; preds = %29
store double 0x4070EA6660000000, double* %2
br label %53
33: ; preds = %29
%34 = load double, double* %4
%35 = fcmp ole double %34, 7.100000e+01
br i1 %35, label %36, label %40
36: ; preds = %33
%37 = load double, double* %4
%38 = fsub double %37, 5.100000e+01
%39 = call double @llvm.fmuladd.f64(double -2.800000e+00, double %38, double 0x4070EA6660000000)
store double %39, double* %2
br label %53
40: ; preds = %33
%41 = load double, double* %4
%42 = fcmp ole double %41, 8.485000e+01
br i1 %42, label %43, label %47
43: ; preds = %40
%44 = load double, double* %4
%45 = fsub double %44, 7.100000e+01
%46 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %45, double 0x406AD4CCC0000000)
store double %46, double* %2
br label %53
47: ; preds = %40
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48
br label %50
50: ; preds = %49
br label %51
51: ; preds = %50
br label %52
52: ; preds = %51
br label %53
53: ; preds = %9, %15, %19, %25, %32, %36, %43, %52
%54 = load double, double* %2
ret double %54
}

LLVM IR (-O2):
define double @calc_temp(double %0) {
%2 = fdiv double %0, 1.000000e+03
%3 = fcmp ugt double %2, 1.100000e+01
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call double @llvm.fmuladd.f64(double %2, double -6.500000e+00, double 0x4072026660000000)
br label %29
6: ; preds = %1
%7 = fcmp ugt double %2, 2.000000e+01
br i1 %7, label %8, label %29
8: ; preds = %6
%9 = fcmp ugt double %2, 3.200000e+01
br i1 %9, label %12, label %10
10: ; preds = %8
%11 = fadd double %2, 0x406894CCC0000000
br label %29
12: ; preds = %8
%13 = fcmp ugt double %2, 4.700000e+01
br i1 %13, label %17, label %14
14: ; preds = %12
%15 = fadd double %2, -3.200000e+01
%16 = tail call double @llvm.fmuladd.f64(double %15, double 2.800000e+00, double 0x406C94CCC0000000)
br label %29
17: ; preds = %12
%18 = fcmp ugt double %2, 5.100000e+01
br i1 %18, label %19, label %29
19: ; preds = %17
%20 = fcmp ugt double %2, 7.100000e+01
br i1 %20, label %24, label %21
21: ; preds = %19
%22 = fadd double %2, -5.100000e+01
%23 = tail call double @llvm.fmuladd.f64(double %22, double -2.800000e+00, double 0x4070EA6660000000)
br label %29
24: ; preds = %19
%25 = fcmp ugt double %2, 8.485000e+01
br i1 %25, label %29, label %26
26: ; preds = %24
%27 = fadd double %2, -7.100000e+01
%28 = tail call double @llvm.fmuladd.f64(double %27, double -2.000000e+00, double 0x406AD4CCC0000000)
br label %29
29: ; preds = %24, %17, %6, %26, %21, %14, %10, %4
%30 = phi double [ %5, %4 ], [ %11, %10 ], [ %16, %14 ], [ %23, %21 ], [ %28, %26 ], [ 0x406B14CCC0000000, %6 ], [ 0x4070EA6660000000, %17 ], [ undef, %24 ]
ret double %30
}