#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 sin(double);
int tan(double);
double get_refraction_adj_apparent(double altitude, double atm_pres,
                                   double temp) {
  double R;
  R = 1 /
      tan(((altitude + (7.31 / (altitude + 4.4))) * 3.141592653589793 / 180));
  R -= 0.06 * sin(((14.7 * (R / 60.0) + 13.0) * 3.141592653589793 / 180));
  R *= ((atm_pres / 1010) * (283 / (273 + temp)));
  R /= 60.0;
  return (R);
}


x86 assembly (clang, -O0):
<get_refraction_adj_apparent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xf0c(%rip),%xmm2
addsd  -0x8(%rbp),%xmm2
movsd  0xef7(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  0xecf(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xebb(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <tan@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe6a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe96(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe92(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe76(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe62(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  -0x20(%rbp),%xmm1
movsd  0xe44(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe22(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe0e(%rip),%xmm2
addsd  -0x18(%rbp),%xmm2
movsd  0xdf9(%rip),%xmm1
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xdd2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_refraction_adj_apparent>:
sub    $0x38,%rsp
movaps %xmm2,0x10(%rsp)
movaps %xmm1,0x20(%rsp)
movsd  0xeca(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xec6(%rip),%xmm2
divsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
mulsd  0xebe(%rip),%xmm0
divsd  0xebe(%rip),%xmm0
call   1040 <tan@plt>
lea    0x1(%rax),%ecx
xor    %edx,%edx
cmp    $0x3,%ecx
cmovb  %eax,%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x8(%rsp)
divsd  0xea1(%rip),%xmm0
mulsd  0xea1(%rip),%xmm0
addsd  0xea1(%rip),%xmm0
mulsd  0xe79(%rip),%xmm0
divsd  0xe79(%rip),%xmm0
call   1030 <sin@plt>
mulsd  0xe8c(%rip),%xmm0
movapd 0x10(%rsp),%xmm3
addsd  0xe86(%rip),%xmm3
movapd 0x20(%rsp),%xmm2
shufpd $0x2,0xe87(%rip),%xmm2
addsd  0x8(%rsp),%xmm0
movapd 0xe89(%rip),%xmm1
unpcklpd %xmm3,%xmm1
divpd  %xmm1,%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
divsd  0xe29(%rip),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @get_refraction_adj_apparent(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %4
%9 = load double, double* %4
%10 = fadd double %9, 4.400000e+00
%11 = fdiv double 7.310000e+00, %10
%12 = fadd double %8, %11
%13 = fmul double %12, 0x400921FB54442D18
%14 = fdiv double %13, 1.800000e+02
%15 = call i32 @tan(double %14)
%16 = sdiv i32 1, %15
%17 = sitofp i32 %16 to double
store double %17, double* %7
%18 = load double, double* %7
%19 = fdiv double %18, 6.000000e+01
%20 = call double @llvm.fmuladd.f64(double 1.470000e+01, double %19, double 1.300000e+01)
%21 = fmul double %20, 0x400921FB54442D18
%22 = fdiv double %21, 1.800000e+02
%23 = call double @sin(double %22)
%24 = load double, double* %7
%25 = call double @llvm.fmuladd.f64(double -6.000000e-02, double %23, double %24)
store double %25, double* %7
%26 = load double, double* %5
%27 = fdiv double %26, 1.010000e+03
%28 = load double, double* %6
%29 = fadd double 2.730000e+02, %28
%30 = fdiv double 2.830000e+02, %29
%31 = fmul double %27, %30
%32 = load double, double* %7
%33 = fmul double %32, %31
store double %33, double* %7
%34 = load double, double* %7
%35 = fdiv double %34, 6.000000e+01
store double %35, double* %7
%36 = load double, double* %7
ret double %36
}

LLVM IR (-O2):
define double @get_refraction_adj_apparent(double %0, double %1, double %2) {
%4 = fadd double %0, 4.400000e+00
%5 = fdiv double 7.310000e+00, %4
%6 = fadd double %5, %0
%7 = fmul double %6, 0x400921FB54442D18
%8 = fdiv double %7, 1.800000e+02
%9 = tail call i32 @tan(double %8)
%10 = add i32 %9, 1
%11 = icmp ult i32 %10, 3
%12 = select i1 %11, i32 %9, i32 0
%13 = sitofp i32 %12 to double
%14 = fdiv double %13, 6.000000e+01
%15 = tail call double @llvm.fmuladd.f64(double %14, double 1.470000e+01, double 1.300000e+01)
%16 = fmul double %15, 0x400921FB54442D18
%17 = fdiv double %16, 1.800000e+02
%18 = tail call double @sin(double %17)
%19 = tail call double @llvm.fmuladd.f64(double %18, double -6.000000e-02, double %13)
%20 = fadd double %2, 2.730000e+02
%21 = insertelement <2 x double> <double poison, double 2.830000e+02>, double %1, i64 0
%22 = insertelement <2 x double> <double 1.010000e+03, double poison>, double %20, i64 1
%23 = fdiv <2 x double> %21, %22
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%25 = fmul <2 x double> %23, %24
%26 = extractelement <2 x double> %25, i64 0
%27 = fmul double %26, %19
%28 = fdiv double %27, 6.000000e+01
ret double %28
}