#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 tan(double);
double calc_astronomical_refr(double inalt, double atpress, double attemp) {
  double r;
  if (inalt > 17.904104638432) {
    r = 0.97 / tan(inalt * (3.14159265358979323846 / 180.0));
  } else {
    r = (34.46 + 4.23 * inalt + 0.004 * inalt * inalt) /
        (1 + 0.505 * inalt + 0.0845 * inalt * inalt);
  }
  r = ((atpress - 80) / 930 / (1 + 0.00008 * (r + 39) * (attemp - 10)) * r) /
      60.0;
  return r;
}


x86 assembly (clang, -O0):
<calc_astronomical_refr>:
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  0xecc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1169 <calc_astronomical_refr+0x59>
movsd  0xefa(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <tan@plt>
movaps %xmm0,%xmm1
movsd  0xedd(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11e0 <calc_astronomical_refr+0xd0>
movsd  -0x8(%rbp),%xmm1
movsd  0xeb2(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xeae(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe92(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xe63(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  0xe5f(%rip),%xmm1
addsd  %xmm1,%xmm2
movsd  0xe43(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe83(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe6f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe5b(%rip),%xmm2
addsd  -0x20(%rbp),%xmm2
movsd  0xe46(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  0xe2d(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xde5(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xe00(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_astronomical_refr>:
sub    $0x18,%rsp
movapd %xmm1,%xmm3
ucomisd 0xee0(%rip),%xmm0
jbe    1151 <calc_astronomical_refr+0x41>
mulsd  0xede(%rip),%xmm0
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
call   1030 <tan@plt>
movsd  0x8(%rsp),%xmm2
movsd  0x10(%rsp),%xmm3
movsd  0xec1(%rip),%xmm1
jmp    1185 <calc_astronomical_refr+0x75>
unpcklpd %xmm0,%xmm0
movapd 0xef3(%rip),%xmm4
mulpd  %xmm0,%xmm4
addpd  0xef7(%rip),%xmm4
movapd 0xeff(%rip),%xmm1
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm1
addpd  %xmm4,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
divsd  %xmm0,%xmm1
addsd  0xe87(%rip),%xmm3
divsd  0xe87(%rip),%xmm3
movsd  0xe87(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xe83(%rip),%xmm0
addsd  0xe83(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xe7f(%rip),%xmm2
divsd  %xmm2,%xmm3
mulsd  %xmm1,%xmm3
divsd  0xe77(%rip),%xmm3
movapd %xmm3,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @calc_astronomical_refr(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 = fcmp ogt double %8, 0x4031E77366CE3A33
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load double, double* %4
%12 = fmul double %11, 0x3F91DF46A2529D39
%13 = call double @tan(double %12)
%14 = fdiv double 0x3FEF0A3D70A3D70A, %13
store double %14, double* %7
br label %29
15: ; preds = %3
%16 = load double, double* %4
%17 = call double @llvm.fmuladd.f64(double 4.230000e+00, double %16, double 3.446000e+01)
%18 = load double, double* %4
%19 = fmul double 4.000000e-03, %18
%20 = load double, double* %4
%21 = call double @llvm.fmuladd.f64(double %19, double %20, double %17)
%22 = load double, double* %4
%23 = call double @llvm.fmuladd.f64(double 5.050000e-01, double %22, double 1.000000e+00)
%24 = load double, double* %4
%25 = fmul double 8.450000e-02, %24
%26 = load double, double* %4
%27 = call double @llvm.fmuladd.f64(double %25, double %26, double %23)
%28 = fdiv double %21, %27
store double %28, double* %7
br label %29
29: ; preds = %15, %10
%30 = load double, double* %5
%31 = fsub double %30, 8.000000e+01
%32 = fdiv double %31, 9.300000e+02
%33 = load double, double* %7
%34 = fadd double %33, 3.900000e+01
%35 = fmul double 8.000000e-05, %34
%36 = load double, double* %6
%37 = fsub double %36, 1.000000e+01
%38 = call double @llvm.fmuladd.f64(double %35, double %37, double 1.000000e+00)
%39 = fdiv double %32, %38
%40 = load double, double* %7
%41 = fmul double %39, %40
%42 = fdiv double %41, 6.000000e+01
store double %42, double* %7
%43 = load double, double* %7
ret double %43
}

LLVM IR (-O2):
define double @calc_astronomical_refr(double %0, double %1, double %2) {
%4 = fcmp ogt double %0, 0x4031E77366CE3A33
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = fmul double %0, 0x3F91DF46A2529D39
%7 = tail call double @tan(double %6)
%8 = fdiv double 0x3FEF0A3D70A3D70A, %7
br label %18
9: ; preds = %3
%10 = insertelement <2 x double> poison, double %0, i64 0
%11 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> zeroinitializer
%12 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> <double 4.230000e+00, double 5.050000e-01>, <2 x double> <double 3.446000e+01, double 1.000000e+00>)
%13 = fmul <2 x double> %11, <double 4.000000e-03, double 8.450000e-02>
%14 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %11, <2 x double> %12)
%15 = extractelement <2 x double> %14, i64 0
%16 = extractelement <2 x double> %14, i64 1
%17 = fdiv double %15, %16
br label %18
18: ; preds = %9, %5
%19 = phi double [ %8, %5 ], [ %17, %9 ]
%20 = fadd double %1, -8.000000e+01
%21 = fdiv double %20, 9.300000e+02
%22 = fadd double %19, 3.900000e+01
%23 = fmul double %22, 8.000000e-05
%24 = fadd double %2, -1.000000e+01
%25 = tail call double @llvm.fmuladd.f64(double %23, double %24, double 1.000000e+00)
%26 = fdiv double %21, %25
%27 = fmul double %19, %26
%28 = fdiv double %27, 6.000000e+01
ret double %28
}