#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 acos(double);
double cos(double);
double sqrt(int);
double tan(double);
double c_bidir_reflectivity_hapke(double wvnmlo, double wvnmhi, double mu,
                                  double mup, double dphi) {
  double b0, b, ctheta, Xgamm, h0, h, hh, p, thetah, w;
  ctheta = mu * mup + sqrt((1. - mu * mu) * (1. - mup * mup)) * cos(dphi);
  thetah = acos(ctheta);
  p = 1. + .5 * ctheta;
  hh = .06;
  b0 = 1.;
  b = b0 * hh / (hh + tan(.5 * thetah));
  w = 0.6;
  Xgamm = sqrt(1. - w);
  h0 = (1. + 2. * mup) / (1. + 2. * Xgamm * mup);
  h = (1. + 2. * mu) / (1. + 2. * Xgamm * mu);
  return .25 * w * ((1. + b) * p + h0 * h - 1.0) / (mu + mup);
}


x86 assembly (clang, -O0):
<c_bidir_reflectivity_hapke>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%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  %xmm0,-0x90(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe55(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe24(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movsd  -0x98(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xdd9(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdad(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xdc4(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xd8f(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xd86(%rip),%xmm0
mulsd  -0x70(%rbp),%xmm0
call   1040 <tan@plt>
movsd  -0x88(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x80(%rbp),%xmm0
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xd4f(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xd2a(%rip),%xmm0
subsd  -0x78(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xd06(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xd0a(%rip),%xmm1
mulsd  -0x48(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xce4(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xcc6(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xcca(%rip),%xmm1
mulsd  -0x48(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xca4(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xc97(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xc82(%rip),%xmm1
addsd  -0x38(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm3
movsd  -0x50(%rbp),%xmm2
mulsd  -0x58(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  0xc5e(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_bidir_reflectivity_hapke>:
sub    $0x38,%rsp
movsd  %xmm4,(%rsp)
movapd %xmm3,0x10(%rsp)
movapd %xmm2,0x20(%rsp)
movapd %xmm2,%xmm0
unpcklpd %xmm3,%xmm0
mulpd  %xmm0,%xmm0
movapd 0xe97(%rip),%xmm1
subpd  %xmm0,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
call   1030 <acos@plt>
movsd  0xe56(%rip),%xmm1
movsd  (%rsp),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xe4d(%rip),%xmm2
movsd  %xmm2,(%rsp)
mulsd  %xmm1,%xmm0
call   1040 <tan@plt>
movsd  0xe3f(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
xor    %edi,%edi
call   1060 <sqrt@plt>
addsd  %xmm0,%xmm0
movapd 0x10(%rsp),%xmm3
movapd %xmm3,%xmm1
movapd 0x20(%rsp),%xmm2
unpcklpd %xmm2,%xmm1
unpcklpd %xmm0,%xmm0
mulpd  %xmm1,%xmm0
addpd  %xmm1,%xmm1
movapd 0xdde(%rip),%xmm4
addpd  %xmm4,%xmm1
addpd  %xmm4,%xmm0
divpd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
addsd  0xddc(%rip),%xmm0
mulsd  (%rsp),%xmm0
movapd %xmm0,%xmm4
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm4,%xmm0
addsd  0xdcb(%rip),%xmm0
mulsd  0xdcb(%rip),%xmm0
movapd %xmm2,%xmm1
addsd  %xmm3,%xmm1
divsd  %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @c_bidir_reflectivity_hapke(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
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = 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
%21 = load double, double* %8
%22 = load double, double* %9
%23 = load double, double* %8
%24 = load double, double* %8
%25 = fneg double %23
%26 = call double @llvm.fmuladd.f64(double %25, double %24, double 1.000000e+00)
%27 = load double, double* %9
%28 = load double, double* %9
%29 = fneg double %27
%30 = call double @llvm.fmuladd.f64(double %29, double %28, double 1.000000e+00)
%31 = fmul double %26, %30
%32 = fptosi double %31 to i32
%33 = call double @sqrt(i32 %32)
%34 = load double, double* %10
%35 = call double @cos(double %34)
%36 = fmul double %33, %35
%37 = call double @llvm.fmuladd.f64(double %21, double %22, double %36)
store double %37, double* %13
%38 = load double, double* %13
%39 = call double @acos(double %38)
store double %39, double* %19
%40 = load double, double* %13
%41 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %40, double 1.000000e+00)
store double %41, double* %18
store double 6.000000e-02, double* %17
store double 1.000000e+00, double* %11
%42 = load double, double* %11
%43 = load double, double* %17
%44 = fmul double %42, %43
%45 = load double, double* %17
%46 = load double, double* %19
%47 = fmul double 5.000000e-01, %46
%48 = call double @tan(double %47)
%49 = fadd double %45, %48
%50 = fdiv double %44, %49
store double %50, double* %12
store double 6.000000e-01, double* %20
%51 = load double, double* %20
%52 = fsub double 1.000000e+00, %51
%53 = fptosi double %52 to i32
%54 = call double @sqrt(i32 %53)
store double %54, double* %14
%55 = load double, double* %9
%56 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %55, double 1.000000e+00)
%57 = load double, double* %14
%58 = fmul double 2.000000e+00, %57
%59 = load double, double* %9
%60 = call double @llvm.fmuladd.f64(double %58, double %59, double 1.000000e+00)
%61 = fdiv double %56, %60
store double %61, double* %15
%62 = load double, double* %8
%63 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %62, double 1.000000e+00)
%64 = load double, double* %14
%65 = fmul double 2.000000e+00, %64
%66 = load double, double* %8
%67 = call double @llvm.fmuladd.f64(double %65, double %66, double 1.000000e+00)
%68 = fdiv double %63, %67
store double %68, double* %16
%69 = load double, double* %20
%70 = fmul double 2.500000e-01, %69
%71 = load double, double* %12
%72 = fadd double 1.000000e+00, %71
%73 = load double, double* %18
%74 = load double, double* %15
%75 = load double, double* %16
%76 = fmul double %74, %75
%77 = call double @llvm.fmuladd.f64(double %72, double %73, double %76)
%78 = fsub double %77, 1.000000e+00
%79 = fmul double %70, %78
%80 = load double, double* %8
%81 = load double, double* %9
%82 = fadd double %80, %81
%83 = fdiv double %79, %82
ret double %83
}

LLVM IR (-O2):
define double @c_bidir_reflectivity_hapke(double %0, double %1, double %2, double %3, double %4) {
%6 = insertelement <2 x double> poison, double %2, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fneg <2 x double> %7
%9 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %8, <2 x double> %7, <2 x double> <double 1.000000e+00, double 1.000000e+00>)
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%11 = fmul <2 x double> %9, %10
%12 = extractelement <2 x double> %11, i64 0
%13 = fptosi double %12 to i32
%14 = tail call double @sqrt(i32 %13)
%15 = tail call double @cos(double %4)
%16 = fmul double %14, %15
%17 = tail call double @llvm.fmuladd.f64(double %2, double %3, double %16)
%18 = tail call double @acos(double %17)
%19 = tail call double @llvm.fmuladd.f64(double %17, double 5.000000e-01, double 1.000000e+00)
%20 = fmul double %18, 5.000000e-01
%21 = tail call double @tan(double %20)
%22 = fadd double %21, 6.000000e-02
%23 = fdiv double 6.000000e-02, %22
%24 = tail call double @sqrt(i32 0)
%25 = fmul double %24, 2.000000e+00
%26 = insertelement <2 x double> poison, double %3, i64 0
%27 = insertelement <2 x double> %26, double %2, i64 1
%28 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %27, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> <double 1.000000e+00, double 1.000000e+00>)
%29 = insertelement <2 x double> poison, double %25, i64 0
%30 = shufflevector <2 x double> %29, <2 x double> poison, <2 x i32> zeroinitializer
%31 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %30, <2 x double> %27, <2 x double> <double 1.000000e+00, double 1.000000e+00>)
%32 = fdiv <2 x double> %28, %31
%33 = fadd double %23, 1.000000e+00
%34 = shufflevector <2 x double> %32, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%35 = fmul <2 x double> %32, %34
%36 = extractelement <2 x double> %35, i64 0
%37 = tail call double @llvm.fmuladd.f64(double %33, double %19, double %36)
%38 = fadd double %37, -1.000000e+00
%39 = fmul double %38, 1.500000e-01
%40 = fadd double %2, %3
%41 = fdiv double %39, %40
ret double %41
}