#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double exp(double);
double pow(double, double);
double CalculateAirDensity(double Altitude) {
  double Temperature, Pressure;
  if (Altitude < 11000.0) {
    Temperature = 15.04 - (0.00649 * Altitude);
    Pressure = 101.29 * pow((Temperature + 273.1) / 288.08, 5.256);
  } else if (Altitude < 25000.0) {
    Temperature = -56.46;
    Pressure = 22.65 * exp(1.73 - (0.000157 * Altitude));
  } else {
    Temperature = -131.21 + (0.00299 * Altitude);
    Pressure = 2.488 * pow((Temperature + 273.1) / 216.6, -11.388);
  }
  return Pressure / (0.2869 * (Temperature + 273.1));
}


x86 assembly (clang, -O0):
<CalculateAirDensity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xecb(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11a1 <CalculateAirDensity+0x81>
movsd  -0x8(%rbp),%xmm0
movsd  0xf2b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xf27(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xebe(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xef9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xee5(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xecd(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    125d <CalculateAirDensity+0x13d>
movsd  0xe5f(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11fc <CalculateAirDensity+0xdc>
movsd  0xe9c(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe7a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe76(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xe52(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1258 <CalculateAirDensity+0x138>
movsd  -0x8(%rbp),%xmm0
movsd  0xe27(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe23(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe02(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xded(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdd9(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xdc1(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    125d <CalculateAirDensity+0x13d>
movsd  -0x18(%rbp),%xmm0
movsd  0xdbe(%rip),%xmm2
addsd  -0x10(%rbp),%xmm2
movsd  0xe11(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalculateAirDensity>:
push   %rax
movapd %xmm0,%xmm1
movsd  0xed3(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1178 <CalculateAirDensity+0x58>
mulsd  0xf25(%rip),%xmm1
addsd  0xf25(%rip),%xmm1
movsd  %xmm1,(%rsp)
movsd  0xed0(%rip),%xmm0
addsd  %xmm1,%xmm0
divsd  0xf14(%rip),%xmm0
movsd  0xf14(%rip),%xmm1
call   1040 <pow@plt>
movsd  (%rsp),%xmm1
mulsd  0xf0a(%rip),%xmm0
jmp    11f4 <CalculateAirDensity+0xd4>
movsd  0xe88(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11b1 <CalculateAirDensity+0x91>
mulsd  0xeb2(%rip),%xmm1
addsd  0xeb2(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <exp@plt>
mulsd  0xea9(%rip),%xmm0
movsd  0xea9(%rip),%xmm1
jmp    11f4 <CalculateAirDensity+0xd4>
mulsd  0xe57(%rip),%xmm1
addsd  0xe57(%rip),%xmm1
movsd  %xmm1,(%rsp)
movsd  0xe52(%rip),%xmm0
addsd  %xmm1,%xmm0
divsd  0xe4e(%rip),%xmm0
movsd  0xe4e(%rip),%xmm1
call   1040 <pow@plt>
movsd  (%rsp),%xmm1
mulsd  0xe44(%rip),%xmm0
addsd  0xe24(%rip),%xmm1
mulsd  0xe84(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @CalculateAirDensity(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = fcmp olt double %5, 1.100000e+04
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load double, double* %2
%9 = call double @llvm.fmuladd.f64(double -6.490000e-03, double %8, double 1.504000e+01)
store double %9, double* %3
%10 = load double, double* %3
%11 = fadd double %10, 2.731000e+02
%12 = fdiv double %11, 2.880800e+02
%13 = call double @pow(double %12, double 5.256000e+00)
%14 = fmul double 1.012900e+02, %13
store double %14, double* %4
br label %32
15: ; preds = %1
%16 = load double, double* %2
%17 = fcmp olt double %16, 2.500000e+04
br i1 %17, label %18, label %23
18: ; preds = %15
store double -5.646000e+01, double* %3
%19 = load double, double* %2
%20 = call double @llvm.fmuladd.f64(double -1.570000e-04, double %19, double 1.730000e+00)
%21 = call double @exp(double %20)
%22 = fmul double 2.265000e+01, %21
store double %22, double* %4
br label %31
23: ; preds = %15
%24 = load double, double* %2
%25 = call double @llvm.fmuladd.f64(double 2.990000e-03, double %24, double -1.312100e+02)
store double %25, double* %3
%26 = load double, double* %3
%27 = fadd double %26, 2.731000e+02
%28 = fdiv double %27, 2.166000e+02
%29 = call double @pow(double %28, double -1.138800e+01)
%30 = fmul double 2.488000e+00, %29
store double %30, double* %4
br label %31
31: ; preds = %23, %18
br label %32
32: ; preds = %31, %7
%33 = load double, double* %4
%34 = load double, double* %3
%35 = fadd double %34, 2.731000e+02
%36 = fmul double 2.869000e-01, %35
%37 = fdiv double %33, %36
ret double %37
}

LLVM IR (-O2):
define double @CalculateAirDensity(double %0) {
%2 = fcmp olt double %0, 1.100000e+04
br i1 %2, label %3, label %9
3: ; preds = %1
%4 = tail call double @llvm.fmuladd.f64(double %0, double -6.490000e-03, double 1.504000e+01)
%5 = fadd double %4, 2.731000e+02
%6 = fdiv double %5, 2.880800e+02
%7 = tail call double @pow(double %6, double 5.256000e+00)
%8 = fmul double %7, 1.012900e+02
br label %21
9: ; preds = %1
%10 = fcmp olt double %0, 2.500000e+04
br i1 %10, label %11, label %15
11: ; preds = %9
%12 = tail call double @llvm.fmuladd.f64(double %0, double -1.570000e-04, double 1.730000e+00)
%13 = tail call double @exp(double %12)
%14 = fmul double %13, 2.265000e+01
br label %21
15: ; preds = %9
%16 = tail call double @llvm.fmuladd.f64(double %0, double 2.990000e-03, double -1.312100e+02)
%17 = fadd double %16, 2.731000e+02
%18 = fdiv double %17, 2.166000e+02
%19 = tail call double @pow(double %18, double -1.138800e+01)
%20 = fmul double %19, 2.488000e+00
br label %21
21: ; preds = %11, %15, %3
%22 = phi double [ %4, %3 ], [ -5.646000e+01, %11 ], [ %16, %15 ]
%23 = phi double [ %8, %3 ], [ %14, %11 ], [ %20, %15 ]
%24 = fadd double %22, 2.731000e+02
%25 = fmul double %24, 2.869000e-01
%26 = fdiv double %23, %25
ret double %26
}