#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 */
float exp(float);
float pow(float, float);
void Atmosphere(const float alt, float *sigma, float *delta, float *theta) {
  float REARTH = 6369.0;
  float GMR = 34.163195;
  int i, j, k;
  float h, tgrad, deltah, tbase, tlocal;
  static float htab[8] = {0.0, 11.0, 20.0, 32.0, 47.0, 51.0, 71.0, 84.852};
  static float ttab[8] = {288.15, 216.65, 216.65, 228.65,
                          270.65, 270.65, 214.65, 186.946};
  static float ptab[8] = {1.0,          2.2336110E-1, 5.4032950E-2,
                          8.5666784E-3, 1.0945601E-3, 6.6063531E-4,
                          3.9046834E-5, 3.68501E-6};
  static float gtab[8] = {-6.5, 0, 1.0, 2.8, 0, -2.8, -2.0, 0};
  h = alt * REARTH / (alt + REARTH);
  i = 0;
  j = 8 - 1;
  do {
    k = (i + j) / 2;
    if (h < htab[k])
      j = k;
    else
      i = k;
  } while (j > i + 1);
  tgrad = gtab[i];
  tbase = ttab[i];
  deltah = h - htab[i];
  tlocal = tbase + tgrad * deltah;
  *theta = tlocal / ttab[0];
  if (tgrad == 0.0)
    *delta = ptab[i] * exp(-GMR * deltah / tbase);
  else
    *delta = ptab[i] * pow(tbase / tlocal, GMR / tgrad);
  *sigma = *delta / *theta;
}


x86 assembly (clang, -O0):
<Atmosphere>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movss  0xec3(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xeb2(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x24(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
addss  -0x24(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x7,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
movss  -0x38(%rbp),%xmm1
movslq -0x34(%rbp),%rcx
lea    0x2ea1(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
ucomiss %xmm1,%xmm0
jbe    11b8 <Atmosphere+0x98>
mov    -0x34(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    11be <Atmosphere+0x9e>
mov    -0x34(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    11c3 <Atmosphere+0xa3>
mov    -0x30(%rbp),%eax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     117e <Atmosphere+0x5e>
movslq -0x2c(%rbp),%rcx
lea    0x2ec1(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x3c(%rbp)
movslq -0x2c(%rbp),%rcx
lea    0x2e6c(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x38(%rbp),%xmm0
movslq -0x2c(%rbp),%rcx
lea    0x2e32(%rip),%rax
subss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x44(%rbp),%xmm1
movss  -0x3c(%rbp),%xmm0
movss  -0x40(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x48(%rbp),%xmm0
divss  0x2e1f(%rip),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12b4 <Atmosphere+0x194>
jp     12b4 <Atmosphere+0x194>
movslq -0x2c(%rbp),%rcx
lea    0x2e10(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x28(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x40(%rbp),%xmm0
divss  -0x44(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movss  -0x4c(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    12f6 <Atmosphere+0x1d6>
movslq -0x2c(%rbp),%rcx
lea    0x2dc1(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x44(%rbp),%xmm0
divss  -0x48(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
divss  -0x3c(%rbp),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x50(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x20(%rbp),%rax
divss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Atmosphere>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
movaps %xmm0,%xmm1
movss  0xec3(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm2,%xmm1
divss  %xmm1,%xmm0
xor    %eax,%eax
mov    $0x7,%edx
lea    0xeb9(%rip),%rcx
jmp    1169 <Atmosphere+0x49>
nopl   0x0(%rax)
mov    %esi,%eax
lea    0x1(%rax),%esi
cmp    %esi,%edx
jle    1186 <Atmosphere+0x66>
lea    (%rax,%rdx,1),%edi
mov    %edi,%esi
shr    $0x1f,%esi
add    %edi,%esi
sar    %esi
movslq %esi,%rdi
movss  (%rcx,%rdi,4),%xmm1
ucomiss %xmm0,%xmm1
jbe    1160 <Atmosphere+0x40>
mov    %esi,%edx
jmp    1162 <Atmosphere+0x42>
movslq %eax,%rdx
lea    0xee0(%rip),%rsi
movss  (%rsi,%rdx,4),%xmm3
lea    0xe94(%rip),%rsi
movss  (%rsi,%rdx,4),%xmm2
subss  (%rcx,%rdx,4),%xmm0
movaps %xmm3,%xmm1
mulss  %xmm0,%xmm1
addss  %xmm2,%xmm1
movaps %xmm1,%xmm4
divss  0xe48(%rip),%xmm4
movss  %xmm4,(%rbx)
mov    $0x92,%ecx
bt     %rax,%rcx
lea    0xe80(%rip),%rax
movss  (%rax,%rdx,4),%xmm4
movss  %xmm4,0xc(%rsp)
jb     11f7 <Atmosphere+0xd7>
divss  %xmm1,%xmm2
movss  0xe23(%rip),%xmm1
divss  %xmm3,%xmm1
movaps %xmm2,%xmm0
call   1040 <pow@plt>
jmp    1208 <Atmosphere+0xe8>
mulss  0xe09(%rip),%xmm0
divss  %xmm2,%xmm0
call   1030 <exp@plt>
movss  0xc(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%r15)
divss  (%rbx),%xmm1
movss  %xmm1,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@Atmosphere.htab = internal global [8 x float] [float 0.000000e+00, float 1.100000e+01, float 2.000000e+01, float 3.200000e+01, float 4.700000e+01, float 5.100000e+01, float 7.100000e+01, float 0x4055368720000000]
@Atmosphere.ttab = internal global [8 x float] [float 0x4072026660000000, float 0x406B14CCC0000000, float 0x406B14CCC0000000, float 0x406C94CCC0000000, float 0x4070EA6660000000, float 0x4070EA6660000000, float 0x406AD4CCC0000000, float 0x40675E45A0000000]
@Atmosphere.ptab = internal global [8 x float] [float 1.000000e+00, float 0x3FCC9718C0000000, float 0x3FABAA3500000000, float 0x3F818B6820000000, float 0x3F51EEEB00000000, float 0x3F45A5CF80000000, float 0x3F0478C700000000, float 0x3ECEE97FA0000000]
@Atmosphere.gtab = internal global [8 x float] [float -6.500000e+00, float 0.000000e+00, float 1.000000e+00, float 0x4006666660000000, float 0.000000e+00, float 0xC006666660000000, float -2.000000e+00, float 0.000000e+00]
define void @Atmosphere(float %0, float* %1, float* %2, float* %3) {
%5 = alloca float
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca float
%10 = alloca float
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
store float %0, float* %5
store float* %1, float** %6
store float* %2, float** %7
store float* %3, float** %8
store float 6.369000e+03, float* %9
store float 0x404114E3A0000000, float* %10
%19 = load float, float* %5
%20 = load float, float* %9
%21 = fmul float %19, %20
%22 = load float, float* %5
%23 = load float, float* %9
%24 = fadd float %22, %23
%25 = fdiv float %21, %24
store float %25, float* %14
store i32 0, i32* %11
store i32 7, i32* %12
br label %26
26: ; preds = %42, %4
%27 = load i32, i32* %11
%28 = load i32, i32* %12
%29 = add nsw i32 %27, %28
%30 = sdiv i32 %29, 2
store i32 %30, i32* %13
%31 = load float, float* %14
%32 = load i32, i32* %13
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [8 x float], [8 x float]* @Atmosphere.htab, i64 0, i64 %33
%35 = load float, float* %34
%36 = fcmp olt float %31, %35
br i1 %36, label %37, label %39
37: ; preds = %26
%38 = load i32, i32* %13
store i32 %38, i32* %12
br label %41
39: ; preds = %26
%40 = load i32, i32* %13
store i32 %40, i32* %11
br label %41
41: ; preds = %39, %37
br label %42
42: ; preds = %41
%43 = load i32, i32* %12
%44 = load i32, i32* %11
%45 = add nsw i32 %44, 1
%46 = icmp sgt i32 %43, %45
br i1 %46, label %26, label %47
47: ; preds = %42
%48 = load i32, i32* %11
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [8 x float], [8 x float]* @Atmosphere.gtab, i64 0, i64 %49
%51 = load float, float* %50
store float %51, float* %15
%52 = load i32, i32* %11
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [8 x float], [8 x float]* @Atmosphere.ttab, i64 0, i64 %53
%55 = load float, float* %54
store float %55, float* %17
%56 = load float, float* %14
%57 = load i32, i32* %11
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [8 x float], [8 x float]* @Atmosphere.htab, i64 0, i64 %58
%60 = load float, float* %59
%61 = fsub float %56, %60
store float %61, float* %16
%62 = load float, float* %17
%63 = load float, float* %15
%64 = load float, float* %16
%65 = call float @llvm.fmuladd.f32(float %63, float %64, float %62)
store float %65, float* %18
%66 = load float, float* %18
%67 = load float, float* getelementptr inbounds ([8 x float], [8 x float]* @Atmosphere.ttab, i64 0, i64 0)
%68 = fdiv float %66, %67
%69 = load float*, float** %8
store float %68, float* %69
%70 = load float, float* %15
%71 = fpext float %70 to double
%72 = fcmp oeq double %71, 0.000000e+00
br i1 %72, label %73, label %87
73: ; preds = %47
%74 = load i32, i32* %11
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [8 x float], [8 x float]* @Atmosphere.ptab, i64 0, i64 %75
%77 = load float, float* %76
%78 = load float, float* %10
%79 = fneg float %78
%80 = load float, float* %16
%81 = fmul float %79, %80
%82 = load float, float* %17
%83 = fdiv float %81, %82
%84 = call float @exp(float %83)
%85 = fmul float %77, %84
%86 = load float*, float** %7
store float %85, float* %86
br label %101
87: ; preds = %47
%88 = load i32, i32* %11
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [8 x float], [8 x float]* @Atmosphere.ptab, i64 0, i64 %89
%91 = load float, float* %90
%92 = load float, float* %17
%93 = load float, float* %18
%94 = fdiv float %92, %93
%95 = load float, float* %10
%96 = load float, float* %15
%97 = fdiv float %95, %96
%98 = call float @pow(float %94, float %97)
%99 = fmul float %91, %98
%100 = load float*, float** %7
store float %99, float* %100
br label %101
101: ; preds = %87, %73
%102 = load float*, float** %7
%103 = load float, float* %102
%104 = load float*, float** %8
%105 = load float, float* %104
%106 = fdiv float %103, %105
%107 = load float*, float** %6
store float %106, float* %107
ret void
}

LLVM IR (-O2):
@Atmosphere.htab = internal unnamed_addr constant [8 x float] [float 0.000000e+00, float 1.100000e+01, float 2.000000e+01, float 3.200000e+01, float 4.700000e+01, float 5.100000e+01, float 7.100000e+01, float 0x4055368720000000]
@Atmosphere.ttab = internal unnamed_addr constant [8 x float] [float 0x4072026660000000, float 0x406B14CCC0000000, float 0x406B14CCC0000000, float 0x406C94CCC0000000, float 0x4070EA6660000000, float 0x4070EA6660000000, float 0x406AD4CCC0000000, float 0x40675E45A0000000]
@Atmosphere.ptab = internal unnamed_addr constant [8 x float] [float 1.000000e+00, float 0x3FCC9718C0000000, float 0x3FABAA3500000000, float 0x3F818B6820000000, float 0x3F51EEEB00000000, float 0x3F45A5CF80000000, float 0x3F0478C700000000, float 0x3ECEE97FA0000000]
@Atmosphere.gtab = internal unnamed_addr constant [8 x float] [float -6.500000e+00, float 0.000000e+00, float 1.000000e+00, float 0x4006666660000000, float 0.000000e+00, float 0xC006666660000000, float -2.000000e+00, float 0.000000e+00]
define void @Atmosphere(float %0, float* nocapture writeonly %1, float* nocapture writeonly %2, float* nocapture %3) {
%5 = fmul float %0, 6.369000e+03
%6 = fadd float %0, 6.369000e+03
%7 = fdiv float %5, %6
br label %8
8: ; preds = %8, %4
%9 = phi i32 [ 7, %4 ], [ %17, %8 ]
%10 = phi i32 [ 0, %4 ], [ %18, %8 ]
%11 = add nsw i32 %10, %9
%12 = sdiv i32 %11, 2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [8 x float], [8 x float]* @Atmosphere.htab, i64 0, i64 %13
%15 = load float, float* %14
%16 = fcmp olt float %7, %15
%17 = select i1 %16, i32 %12, i32 %9
%18 = select i1 %16, i32 %10, i32 %12
%19 = add nsw i32 %18, 1
%20 = icmp sgt i32 %17, %19
br i1 %20, label %8, label %21
21: ; preds = %8
%22 = sext i32 %18 to i64
%23 = getelementptr inbounds [8 x float], [8 x float]* @Atmosphere.gtab, i64 0, i64 %22
%24 = load float, float* %23
%25 = getelementptr inbounds [8 x float], [8 x float]* @Atmosphere.ttab, i64 0, i64 %22
%26 = load float, float* %25
%27 = getelementptr inbounds [8 x float], [8 x float]* @Atmosphere.htab, i64 0, i64 %22
%28 = load float, float* %27
%29 = fsub float %7, %28
%30 = tail call float @llvm.fmuladd.f32(float %24, float %29, float %26)
%31 = fdiv float %30, 0x4072026660000000
store float %31, float* %3
%32 = lshr i64 146, %22
%33 = and i64 %32, 1
%34 = icmp eq i64 %33, 0
%35 = getelementptr inbounds [8 x float], [8 x float]* @Atmosphere.ptab, i64 0, i64 %22
%36 = load float, float* %35
br i1 %34, label %41, label %37
37: ; preds = %21
%38 = fmul float %29, 0xC04114E3A0000000
%39 = fdiv float %38, %26
%40 = tail call float @exp(float %39)
br label %45
41: ; preds = %21
%42 = fdiv float %26, %30
%43 = fdiv float 0x404114E3A0000000, %24
%44 = tail call float @pow(float %42, float %43)
br label %45
45: ; preds = %41, %37
%46 = phi float [ %44, %41 ], [ %40, %37 ]
%47 = fmul float %36, %46
store float %47, float* %2
%48 = load float, float* %3
%49 = fdiv float %47, %48
store float %49, float* %1
ret void
}