#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 GetTKelvinFromTCelsius(double);
double GetTRankineFromTFahrenheit(double);
double exp(double);
scalar_t__ isIP();
double GetSeaLevelPressure(double StnPressure, double Altitude,
                           double TDryBulb) {
  double TColumn, H;
  if (isIP()) {
    TColumn = TDryBulb + 0.0036 * Altitude / 2.;
    H = 53.351 * GetTRankineFromTFahrenheit(TColumn);
  } else {
    TColumn = TDryBulb + 0.0065 * Altitude / 2.;
    H = 287.055 * GetTKelvinFromTCelsius(TColumn) / 9.807;
  }
  double SeaLevelPressure = StnPressure * exp(Altitude / H);
  return SeaLevelPressure;
}


x86 assembly (clang, -O0):
<GetSeaLevelPressure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    $0x0,%al
call   1050 <isIP@plt>
cmp    $0x0,%rax
je     11b2 <GetSeaLevelPressure+0x72>
movsd  -0x18(%rbp),%xmm0
movsd  0xeb3(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xe8e(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1060 <GetTRankineFromTFahrenheit@plt>
movaps %xmm0,%xmm1
movsd  0xe7c(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1203 <GetSeaLevelPressure+0xc3>
movsd  -0x18(%rbp),%xmm0
movsd  0xe59(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xe44(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <GetTKelvinFromTCelsius@plt>
movaps %xmm0,%xmm1
movsd  0xe1a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe06(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetSeaLevelPressure>:
sub    $0x18,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1050 <isIP@plt>
test   %rax,%rax
je     118b <GetSeaLevelPressure+0x4b>
movsd  0xe97(%rip),%xmm0
mulsd  (%rsp),%xmm0
mulsd  0xe92(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
call   1060 <GetTRankineFromTFahrenheit@plt>
mulsd  0xe87(%rip),%xmm0
jmp    11bb <GetSeaLevelPressure+0x7b>
movsd  0xe85(%rip),%xmm0
mulsd  (%rsp),%xmm0
mulsd  0xe68(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
call   1030 <GetTKelvinFromTCelsius@plt>
mulsd  0xe6d(%rip),%xmm0
divsd  0xe6d(%rip),%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <exp@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @GetSeaLevelPressure(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%10 = call i64 (...) @isIP()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %3
%13 = load double, double* %6
%14 = load double, double* %5
%15 = fmul double 3.600000e-03, %14
%16 = fdiv double %15, 2.000000e+00
%17 = fadd double %13, %16
store double %17, double* %7
%18 = load double, double* %7
%19 = call double @GetTRankineFromTFahrenheit(double %18)
%20 = fmul double 5.335100e+01, %19
store double %20, double* %8
br label %31
21: ; preds = %3
%22 = load double, double* %6
%23 = load double, double* %5
%24 = fmul double 0x3F7A9FBE76C8B439, %23
%25 = fdiv double %24, 2.000000e+00
%26 = fadd double %22, %25
store double %26, double* %7
%27 = load double, double* %7
%28 = call double @GetTKelvinFromTCelsius(double %27)
%29 = fmul double 2.870550e+02, %28
%30 = fdiv double %29, 9.807000e+00
store double %30, double* %8
br label %31
31: ; preds = %21, %12
%32 = load double, double* %4
%33 = load double, double* %5
%34 = load double, double* %8
%35 = fdiv double %33, %34
%36 = call double @exp(double %35)
%37 = fmul double %32, %36
store double %37, double* %9
%38 = load double, double* %9
ret double %38
}

LLVM IR (-O2):
define double @GetSeaLevelPressure(double %0, double %1, double %2) {
%4 = tail call i64 (...) @isIP()
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %3
%7 = fmul double %1, 3.600000e-03
%8 = fmul double %7, 5.000000e-01
%9 = fadd double %8, %2
%10 = tail call double @GetTRankineFromTFahrenheit(double %9)
%11 = fmul double %10, 5.335100e+01
br label %19
12: ; preds = %3
%13 = fmul double %1, 0x3F7A9FBE76C8B439
%14 = fmul double %13, 5.000000e-01
%15 = fadd double %14, %2
%16 = tail call double @GetTKelvinFromTCelsius(double %15)
%17 = fmul double %16, 2.870550e+02
%18 = fdiv double %17, 9.807000e+00
br label %19
19: ; preds = %12, %6
%20 = phi double [ %11, %6 ], [ %18, %12 ]
%21 = fdiv double %1, %20
%22 = tail call double @exp(double %21)
%23 = fmul double %22, %0
ret double %23
}