#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 pow(int, double);
double SPtoALT(double mb, double meters) {
  double F1;
  double F2;
  double F3;
  double F;
  double alt;
  F1 = (pow(1013.25, 0.190284) * 0.0065) / 288;
  F2 = meters / pow((mb - 0.3), 0.190284);
  F3 = 1 / 0.190284;
  F = pow((1 + (F1 * F2)), F3);
  alt = (mb - 0.3) * F;
  return alt;
}


x86 assembly (clang, -O0):
<SPtoALT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x3f5,%edi
movsd  0xee9(%rip),%xmm0
call   1030 <pow@plt>
movsd  0xeec(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe98(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  0xea0(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe7a(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe57(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  -0x28(%rbp),%xmm0
call   1030 <pow@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe2b(%rip),%xmm1
subsd  %xmm1,%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SPtoALT>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,(%rsp)
movsd  0xed9(%rip),%xmm0
mov    $0x3f5,%edi
call   1030 <pow@plt>
mulsd  0xecf(%rip),%xmm0
divsd  0xecf(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
addsd  0xec4(%rip),%xmm0
movsd  %xmm0,(%rsp)
cvttsd2si %xmm0,%edi
movsd  0xe9b(%rip),%xmm0
call   1030 <pow@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
addsd  0xe9e(%rip),%xmm1
cvttsd2si %xmm1,%edi
movsd  0xe9a(%rip),%xmm0
call   1030 <pow@plt>
mulsd  (%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @SPtoALT(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %3
store double %1, double* %4
%10 = call double @pow(i32 1013, double 1.902840e-01)
%11 = fmul double %10, 0x3F7A9FBE76C8B439
%12 = fdiv double %11, 2.880000e+02
store double %12, double* %5
%13 = load double, double* %4
%14 = load double, double* %3
%15 = fsub double %14, 3.000000e-01
%16 = fptosi double %15 to i32
%17 = call double @pow(i32 %16, double 1.902840e-01)
%18 = fdiv double %13, %17
store double %18, double* %6
store double 0x4015056E0B7BE58B, double* %7
%19 = load double, double* %5
%20 = load double, double* %6
%21 = call double @llvm.fmuladd.f64(double %19, double %20, double 1.000000e+00)
%22 = fptosi double %21 to i32
%23 = load double, double* %7
%24 = call double @pow(i32 %22, double %23)
store double %24, double* %8
%25 = load double, double* %3
%26 = fsub double %25, 3.000000e-01
%27 = load double, double* %8
%28 = fmul double %26, %27
store double %28, double* %9
%29 = load double, double* %9
ret double %29
}

LLVM IR (-O2):
define double @SPtoALT(double %0, double %1) {
%3 = tail call double @pow(i32 1013, double 1.902840e-01)
%4 = fmul double %3, 0x3F7A9FBE76C8B439
%5 = fdiv double %4, 2.880000e+02
%6 = fadd double %0, -3.000000e-01
%7 = fptosi double %6 to i32
%8 = tail call double @pow(i32 %7, double 1.902840e-01)
%9 = fdiv double %1, %8
%10 = tail call double @llvm.fmuladd.f64(double %5, double %9, double 1.000000e+00)
%11 = fptosi double %10 to i32
%12 = tail call double @pow(i32 %11, double 0x4015056E0B7BE58B)
%13 = fmul double %6, %12
ret double %13
}