#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 */
int cos(double);
double exp(int);
double Airmass(double AppAltO, double Press) {
  double airm, zend;
  zend = (90 - AppAltO) * (3.14159265358979323846 / 180.0);
  if (zend > 3.14159265358979323846 / 2)
    zend = 3.14159265358979323846 / 2;
  airm = 1 / (cos(zend) + 0.025 * exp(-11 * cos(zend)));
  return Press / 1013 * airm;
}


x86 assembly (clang, -O0):
<Airmass>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xed6(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xec1(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xea3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1174 <Airmass+0x54>
movsd  0xe91(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
imul   $0xfffffff5,%eax,%edi
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  0xe7c(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe64(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe46(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Airmass>:
sub    $0x28,%rsp
movaps %xmm1,0x10(%rsp)
movsd  0xecf(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xecb(%rip),%xmm1
movsd  0xecb(%rip),%xmm0
minsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
call   1040 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1040 <cos@plt>
imul   $0xfffffff5,%eax,%edi
call   1030 <exp@plt>
mulsd  0xe9e(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movapd 0x10(%rsp),%xmm2
shufpd $0x2,0xe91(%rip),%xmm2
movapd 0xe99(%rip),%xmm1
unpcklpd %xmm0,%xmm1
divpd  %xmm1,%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @Airmass(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
%8 = fsub double 9.000000e+01, %7
%9 = fmul double %8, 0x3F91DF46A2529D39
store double %9, double* %6
%10 = load double, double* %6
%11 = fcmp ogt double %10, 0x3FF921FB54442D18
br i1 %11, label %12, label %13
12: ; preds = %2
store double 0x3FF921FB54442D18, double* %6
br label %13
13: ; preds = %12, %2
%14 = load double, double* %6
%15 = call i32 @cos(double %14)
%16 = sitofp i32 %15 to double
%17 = load double, double* %6
%18 = call i32 @cos(double %17)
%19 = mul nsw i32 -11, %18
%20 = call double @exp(i32 %19)
%21 = call double @llvm.fmuladd.f64(double 2.500000e-02, double %20, double %16)
%22 = fdiv double 1.000000e+00, %21
store double %22, double* %5
%23 = load double, double* %4
%24 = fdiv double %23, 1.013000e+03
%25 = load double, double* %5
%26 = fmul double %24, %25
ret double %26
}

LLVM IR (-O2):
define double @Airmass(double %0, double %1) {
%3 = fsub double 9.000000e+01, %0
%4 = fmul double %3, 0x3F91DF46A2529D39
%5 = fcmp ogt double %4, 0x3FF921FB54442D18
%6 = select i1 %5, double 0x3FF921FB54442D18, double %4
%7 = tail call i32 @cos(double %6)
%8 = sitofp i32 %7 to double
%9 = tail call i32 @cos(double %6)
%10 = mul nsw i32 %9, -11
%11 = tail call double @exp(i32 %10)
%12 = tail call double @llvm.fmuladd.f64(double %11, double 2.500000e-02, double %8)
%13 = insertelement <2 x double> <double poison, double 1.000000e+00>, double %1, i64 0
%14 = insertelement <2 x double> <double 1.013000e+03, double poison>, double %12, i64 1
%15 = fdiv <2 x double> %13, %14
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%17 = fmul <2 x double> %15, %16
%18 = extractelement <2 x double> %17, i64 0
ret double %18
}