#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 cos(int);
double sin(int);
double rad2ref_aster(double radiance, double doy, double sun_elevation,
                     double k_exo) {
  double result, ds;
  ds = (1 + 0.01672 * sin(2 * 3.1415926 * (doy - 93.5) / 365));
  result =
      (radiance /
       ((cos((90 - sun_elevation) * 3.1415926 / 180) / (3.1415926 * ds * ds)) *
        k_exo));
  return result;
}


x86 assembly (clang, -O0):
<rad2ref_aster>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xeef(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xedb(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xec7(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movsd  0xea2(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9e(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe73(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe52(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  0xe2d(%rip),%xmm2
mulsd  -0x30(%rbp),%xmm2
mulsd  -0x30(%rbp),%xmm2
divsd  %xmm2,%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rad2ref_aster>:
sub    $0x28,%rsp
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm0,0x18(%rsp)
addsd  0xec2(%rip),%xmm1
mulsd  0xec2(%rip),%xmm1
divsd  0xec2(%rip),%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sin@plt>
mulsd  0xeb9(%rip),%xmm0
addsd  0xeb9(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xeb3(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
mulsd  0xead(%rip),%xmm0
divsd  0xead(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <cos@plt>
movsd  0x8(%rsp),%xmm1
movsd  0xe8e(%rip),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @rad2ref_aster(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%11 = load double, double* %6
%12 = fsub double %11, 9.350000e+01
%13 = fmul double 0x401921FB4D12D84A, %12
%14 = fdiv double %13, 3.650000e+02
%15 = fptosi double %14 to i32
%16 = call double @sin(i32 %15)
%17 = call double @llvm.fmuladd.f64(double 1.672000e-02, double %16, double 1.000000e+00)
store double %17, double* %10
%18 = load double, double* %5
%19 = load double, double* %7
%20 = fsub double 9.000000e+01, %19
%21 = fmul double %20, 0x400921FB4D12D84A
%22 = fdiv double %21, 1.800000e+02
%23 = fptosi double %22 to i32
%24 = call double @cos(i32 %23)
%25 = load double, double* %10
%26 = fmul double 0x400921FB4D12D84A, %25
%27 = load double, double* %10
%28 = fmul double %26, %27
%29 = fdiv double %24, %28
%30 = load double, double* %8
%31 = fmul double %29, %30
%32 = fdiv double %18, %31
store double %32, double* %9
%33 = load double, double* %9
ret double %33
}

LLVM IR (-O2):
define double @rad2ref_aster(double %0, double %1, double %2, double %3) {
%5 = fadd double %1, -9.350000e+01
%6 = fmul double %5, 0x401921FB4D12D84A
%7 = fdiv double %6, 3.650000e+02
%8 = fptosi double %7 to i32
%9 = tail call double @sin(i32 %8)
%10 = tail call double @llvm.fmuladd.f64(double %9, double 1.672000e-02, double 1.000000e+00)
%11 = fsub double 9.000000e+01, %2
%12 = fmul double %11, 0x400921FB4D12D84A
%13 = fdiv double %12, 1.800000e+02
%14 = fptosi double %13 to i32
%15 = tail call double @cos(i32 %14)
%16 = fmul double %10, 0x400921FB4D12D84A
%17 = fmul double %10, %16
%18 = fdiv double %15, %17
%19 = fmul double %18, %3
%20 = fdiv double %0, %19
ret double %20
}