#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(float, double);
float get_density(float altitude) {
  float temp = 0.f, pressure = 0.f;
  if (altitude > 25000) {
    temp = -131.21 + 0.00299 * altitude;
    pressure = 2.488 * pow((temp + 273.1) / 216.6, -11.388);
  }
  if (altitude <= 25000 && altitude > 11000) {
    temp = -56.46;
    pressure = 22.65 * exp(1.73 - 0.000157 * altitude);
  }
  if (altitude <= 11000) {
    temp = 15.04 - 0.00649 * altitude;
    pressure = 101.29 * pow((temp + 273.1) / 288.08, 5.256);
  }
  return pressure / (0.2869 * (temp + 273.1));
}


x86 assembly (clang, -O0):
<get_density>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeb6(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11c7 <get_density+0xa7>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xecc(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec8(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9a(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe86(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xe6e(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe56(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe31(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jb     123a <get_density+0x11a>
movss  -0x4(%rbp),%xmm0
movss  0xe1e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    123a <get_density+0x11a>
movss  0xe11(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe3b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe37(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xe13(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xdc2(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jb     12c0 <get_density+0x1a0>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe13(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe0f(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xda1(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xdd5(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xdbd(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xda5(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xd4e(%rip),%xmm1
addsd  %xmm1,%xmm2
movsd  0xd9a(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_density>:
sub    $0x18,%rsp
movaps %xmm0,%xmm2
xorps  %xmm3,%xmm3
ucomiss 0xecf(%rip),%xmm0
xorps  %xmm0,%xmm0
movss  %xmm2,0x8(%rsp)
jbe    119a <get_density+0x7a>
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mulsd  0xec5(%rip),%xmm0
addsd  0xec5(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x14(%rsp)
cvtss2sd %xmm0,%xmm0
addsd  0xeb7(%rip),%xmm0
divsd  0xeb7(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xeb3(%rip),%xmm1
call   1040 <pow@plt>
movss  0x14(%rsp),%xmm3
movss  0x8(%rsp),%xmm2
mulsd  0xea2(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0xe5e(%rip),%xmm1
ucomiss %xmm2,%xmm1
jb     11e6 <get_density+0xc6>
ucomiss 0xe56(%rip),%xmm2
jbe    11e6 <get_density+0xc6>
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mulsd  0xe81(%rip),%xmm0
addsd  0xe81(%rip),%xmm0
call   1030 <exp@plt>
movss  0x8(%rsp),%xmm2
mulsd  0xe76(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0xe22(%rip),%xmm3
movss  0xe16(%rip),%xmm1
ucomiss %xmm2,%xmm1
jae    1204 <get_density+0xe4>
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
addsd  0xe1e(%rip),%xmm1
jmp    125c <get_density+0x13c>
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mulsd  0xe45(%rip),%xmm0
addsd  0xe45(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xdf5(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
divsd  0xe2f(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xe2b(%rip),%xmm1
call   1040 <pow@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xe20(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
mulsd  0xe1c(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @get_density(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
%5 = load float, float* %2
%6 = fcmp ogt float %5, 2.500000e+04
br i1 %6, label %7, label %20
7: ; preds = %1
%8 = load float, float* %2
%9 = fpext float %8 to double
%10 = call double @llvm.fmuladd.f64(double 2.990000e-03, double %9, double -1.312100e+02)
%11 = fptrunc double %10 to float
store float %11, float* %3
%12 = load float, float* %3
%13 = fpext float %12 to double
%14 = fadd double %13, 2.731000e+02
%15 = fdiv double %14, 2.166000e+02
%16 = fptrunc double %15 to float
%17 = call double @pow(float %16, double -1.138800e+01)
%18 = fmul double 2.488000e+00, %17
%19 = fptrunc double %18 to float
store float %19, float* %4
br label %20
20: ; preds = %7, %1
%21 = load float, float* %2
%22 = fcmp ole float %21, 2.500000e+04
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load float, float* %2
%25 = fcmp ogt float %24, 1.100000e+04
br i1 %25, label %26, label %33
26: ; preds = %23
store float 0xC04C3AE140000000, float* %3
%27 = load float, float* %2
%28 = fpext float %27 to double
%29 = call double @llvm.fmuladd.f64(double -1.570000e-04, double %28, double 1.730000e+00)
%30 = call double @exp(double %29)
%31 = fmul double 2.265000e+01, %30
%32 = fptrunc double %31 to float
store float %32, float* %4
br label %33
33: ; preds = %26, %23, %20
%34 = load float, float* %2
%35 = fcmp ole float %34, 1.100000e+04
br i1 %35, label %36, label %49
36: ; preds = %33
%37 = load float, float* %2
%38 = fpext float %37 to double
%39 = call double @llvm.fmuladd.f64(double -6.490000e-03, double %38, double 1.504000e+01)
%40 = fptrunc double %39 to float
store float %40, float* %3
%41 = load float, float* %3
%42 = fpext float %41 to double
%43 = fadd double %42, 2.731000e+02
%44 = fdiv double %43, 2.880800e+02
%45 = fptrunc double %44 to float
%46 = call double @pow(float %45, double 5.256000e+00)
%47 = fmul double 1.012900e+02, %46
%48 = fptrunc double %47 to float
store float %48, float* %4
br label %49
49: ; preds = %36, %33
%50 = load float, float* %4
%51 = fpext float %50 to double
%52 = load float, float* %3
%53 = fpext float %52 to double
%54 = fadd double %53, 2.731000e+02
%55 = fmul double 2.869000e-01, %54
%56 = fdiv double %51, %55
%57 = fptrunc double %56 to float
ret float %57
}

LLVM IR (-O2):
define float @get_density(float %0) {
%2 = fcmp ogt float %0, 2.500000e+04
br i1 %2, label %3, label %14
3: ; preds = %1
%4 = fpext float %0 to double
%5 = tail call double @llvm.fmuladd.f64(double %4, double 2.990000e-03, double -1.312100e+02)
%6 = fptrunc double %5 to float
%7 = fpext float %6 to double
%8 = fadd double %7, 2.731000e+02
%9 = fdiv double %8, 2.166000e+02
%10 = fptrunc double %9 to float
%11 = tail call double @pow(float %10, double -1.138800e+01)
%12 = fmul double %11, 2.488000e+00
%13 = fptrunc double %12 to float
br label %14
14: ; preds = %3, %1
%15 = phi float [ %6, %3 ], [ 0.000000e+00, %1 ]
%16 = phi float [ %13, %3 ], [ 0.000000e+00, %1 ]
%17 = fcmp ole float %0, 2.500000e+04
%18 = fcmp ogt float %0, 1.100000e+04
%19 = and i1 %17, %18
br i1 %19, label %20, label %26
20: ; preds = %14
%21 = fpext float %0 to double
%22 = tail call double @llvm.fmuladd.f64(double %21, double -1.570000e-04, double 1.730000e+00)
%23 = tail call double @exp(double %22)
%24 = fmul double %23, 2.265000e+01
%25 = fptrunc double %24 to float
br label %26
26: ; preds = %20, %14
%27 = phi float [ 0xC04C3AE140000000, %20 ], [ %15, %14 ]
%28 = phi float [ %25, %20 ], [ %16, %14 ]
%29 = fcmp ugt float %0, 1.100000e+04
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = fpext float %27 to double
%32 = fadd double %31, 2.731000e+02
br label %44
33: ; preds = %26
%34 = fpext float %0 to double
%35 = tail call double @llvm.fmuladd.f64(double %34, double -6.490000e-03, double 1.504000e+01)
%36 = fptrunc double %35 to float
%37 = fpext float %36 to double
%38 = fadd double %37, 2.731000e+02
%39 = fdiv double %38, 2.880800e+02
%40 = fptrunc double %39 to float
%41 = tail call double @pow(float %40, double 5.256000e+00)
%42 = fmul double %41, 1.012900e+02
%43 = fptrunc double %42 to float
br label %44
44: ; preds = %30, %33
%45 = phi double [ %32, %30 ], [ %38, %33 ]
%46 = phi float [ %28, %30 ], [ %43, %33 ]
%47 = fpext float %46 to double
%48 = fmul double %45, 2.869000e-01
%49 = fdiv double %47, %48
%50 = fptrunc double %49 to float
ret float %50
}