#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 */
scalar_t__ deg2rad(double);
int /*<<< orphan*/ eraRefco(double, double, double, double, double *, double *);
double rad2deg(double);
double tan(scalar_t__);
double qp_refraction(double el, double temp, double press, double hum,
                     double freq) {
  double A, B;
  eraRefco(press, temp, hum, 299792458.0 * 1e-3 / freq, &A, &B);
  double tz = tan(1.57079632679489661923 - deg2rad(el));
  double ref = tz * (A + B * tz * tz);
  return rad2deg(ref);
}


x86 assembly (clang, -O0):
<qp_refraction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  0xe90(%rip),%xmm3
divsd  -0x28(%rbp),%xmm3
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1060 <eraRefco@plt>
movsd  -0x8(%rbp),%xmm0
call   1030 <deg2rad@plt>
cvtsi2sd %rax,%xmm1
movsd  0xe5f(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1050 <tan@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1040 <rad2deg@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qp_refraction>:
sub    $0x18,%rsp
movaps %xmm3,%xmm5
movsd  %xmm0,(%rsp)
movsd  0xeac(%rip),%xmm3
divsd  %xmm4,%xmm3
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
movaps %xmm2,%xmm0
movaps %xmm5,%xmm2
call   1060 <eraRefco@plt>
movsd  (%rsp),%xmm0
call   1030 <deg2rad@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0xe81(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1050 <tan@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <rad2deg@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @qp_refraction(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%15 = load double, double* %8
%16 = load double, double* %7
%17 = load double, double* %9
%18 = load double, double* %10
%19 = fdiv double 0x41124C41D4FDF3B6, %18
%20 = call i32 @eraRefco(double %15, double %16, double %17, double %19, double* %11, double* %12)
%21 = load double, double* %6
%22 = call i64 @deg2rad(double %21)
%23 = sitofp i64 %22 to double
%24 = fsub double 0x3FF921FB54442D18, %23
%25 = fptosi double %24 to i64
%26 = call double @tan(i64 %25)
store double %26, double* %13
%27 = load double, double* %13
%28 = load double, double* %11
%29 = load double, double* %12
%30 = load double, double* %13
%31 = fmul double %29, %30
%32 = load double, double* %13
%33 = call double @llvm.fmuladd.f64(double %31, double %32, double %28)
%34 = fmul double %27, %33
store double %34, double* %14
%35 = load double, double* %14
%36 = call double @rad2deg(double %35)
ret double %36
}

LLVM IR (-O2):
define double @qp_refraction(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = bitcast double* %6 to i8*
%9 = bitcast double* %7 to i8*
%10 = fdiv double 0x41124C41D4FDF3B6, %4
%11 = call i32 @eraRefco(double %2, double %1, double %3, double %10, double* %6, double* %7)
%12 = call i64 @deg2rad(double %0)
%13 = sitofp i64 %12 to double
%14 = fsub double 0x3FF921FB54442D18, %13
%15 = fptosi double %14 to i64
%16 = call double @tan(i64 %15)
%17 = load double, double* %6
%18 = load double, double* %7
%19 = fmul double %16, %18
%20 = call double @llvm.fmuladd.f64(double %19, double %16, double %17)
%21 = fmul double %16, %20
%22 = call double @rad2deg(double %21)
ret double %22
}