#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(float);
float pow(float, float);
void SimpleAtmosphere(const float alt, float *sigma, float *delta,
                      float *theta) {
  float REARTH = 6369.0;
  float GMR = 34.163195;
  float h;
  h = alt * REARTH / (alt + REARTH);
  if (h < 11.0) {
    *theta = (288.15 - 6.5 * h) / 288.15;
    *delta = pow(*theta, GMR / 6.5);
  } else {
    *theta = 216.65 / 288.15;
    *delta = 0.2233611 * exp(-GMR * (h - 11.0) / 216.65);
  }
  *sigma = *delta / *theta;
}


x86 assembly (clang, -O0):
<SimpleAtmosphere>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movss  0xef3(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xee2(%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,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe7f(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11f7 <SimpleAtmosphere+0xd7>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe8c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe78(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe6c(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x28(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe3b(%rip),%xmm2
divsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
call   1040 <pow@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    1266 <SimpleAtmosphere+0x146>
mov    -0x20(%rbp),%rax
movss  0xe35(%rip),%xmm0
movss  %xmm0,(%rax)
movss  -0x28(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x2c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xdd2(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdd2(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xdb2(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%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    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SimpleAtmosphere>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
movss  0xeca(%rip),%xmm1
movaps %xmm0,%xmm2
mulss  %xmm1,%xmm2
addss  %xmm1,%xmm0
divss  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
movss  0xeb0(%rip),%xmm1
ucomiss %xmm2,%xmm1
jbe    1188 <SimpleAtmosphere+0x68>
mulsd  0xecf(%rip),%xmm0
movsd  0xecf(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rbx)
movss  0xe87(%rip),%xmm1
call   1040 <pow@plt>
jmp    11bb <SimpleAtmosphere+0x9b>
movl   $0x3f407a3f,(%rbx)
addsd  0xe7a(%rip),%xmm0
mulsd  0xe7a(%rip),%xmm0
divsd  0xe7a(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <exp@plt>
mulsd  0xe71(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r15)
divss  (%rbx),%xmm0
movss  %xmm0,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @SimpleAtmosphere(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 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
%12 = load float, float* %5
%13 = load float, float* %9
%14 = fmul float %12, %13
%15 = load float, float* %5
%16 = load float, float* %9
%17 = fadd float %15, %16
%18 = fdiv float %14, %17
store float %18, float* %11
%19 = load float, float* %11
%20 = fpext float %19 to double
%21 = fcmp olt double %20, 1.100000e+01
br i1 %21, label %22, label %37
22: ; preds = %4
%23 = load float, float* %11
%24 = fpext float %23 to double
%25 = call double @llvm.fmuladd.f64(double -6.500000e+00, double %24, double 2.881500e+02)
%26 = fdiv double %25, 2.881500e+02
%27 = fptrunc double %26 to float
%28 = load float*, float** %8
store float %27, float* %28
%29 = load float*, float** %8
%30 = load float, float* %29
%31 = load float, float* %10
%32 = fpext float %31 to double
%33 = fdiv double %32, 6.500000e+00
%34 = fptrunc double %33 to float
%35 = call float @pow(float %30, float %34)
%36 = load float*, float** %7
store float %35, float* %36
br label %52
37: ; preds = %4
%38 = load float*, float** %8
store float 0x3FE80F47E0000000, float* %38
%39 = load float, float* %10
%40 = fneg float %39
%41 = fpext float %40 to double
%42 = load float, float* %11
%43 = fpext float %42 to double
%44 = fsub double %43, 1.100000e+01
%45 = fmul double %41, %44
%46 = fdiv double %45, 2.166500e+02
%47 = fptrunc double %46 to float
%48 = call double @exp(float %47)
%49 = fmul double 0x3FCC9718B5D96B41, %48
%50 = fptrunc double %49 to float
%51 = load float*, float** %7
store float %50, float* %51
br label %52
52: ; preds = %37, %22
%53 = load float*, float** %7
%54 = load float, float* %53
%55 = load float*, float** %8
%56 = load float, float* %55
%57 = fdiv float %54, %56
%58 = load float*, float** %6
store float %57, float* %58
ret void
}

LLVM IR (-O2):
define void @SimpleAtmosphere(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
%8 = fpext float %7 to double
%9 = fcmp olt float %7, 1.100000e+01
br i1 %9, label %10, label %15
10: ; preds = %4
%11 = tail call double @llvm.fmuladd.f64(double %8, double -6.500000e+00, double 2.881500e+02)
%12 = fdiv double %11, 2.881500e+02
%13 = fptrunc double %12 to float
store float %13, float* %3
%14 = tail call float @pow(float %13, float 0x4015060480000000)
br label %23
15: ; preds = %4
store float 0x3FE80F47E0000000, float* %3
%16 = fadd double %8, -1.100000e+01
%17 = fmul double %16, 0xC04114E3A0000000
%18 = fdiv double %17, 2.166500e+02
%19 = fptrunc double %18 to float
%20 = tail call double @exp(float %19)
%21 = fmul double %20, 0x3FCC9718B5D96B41
%22 = fptrunc double %21 to float
br label %23
23: ; preds = %15, %10
%24 = phi float [ %22, %15 ], [ %14, %10 ]
store float %24, float* %2
%25 = load float, float* %3
%26 = fdiv float %24, %25
store float %26, float* %1
ret void
}