#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 fabs(double);
double sin(int);
double get_daily_rpot(const double latitude, const double longitude,
                      const int d_, const double t_) {
  double localstandardtime;
  double localapparentsolartime;
  double tthet;
  double signedLAS;
  double omega;
  double decl_rad;
  double lat_rad;
  double theta_rad;
  double Rpot;
  double Rpot_h;
  const double pi = 3.141592654;
  const double solarconst = 1376.;
  localstandardtime = t_;
  tthet = 2. * pi * (d_ - 1.) / 365.;
  localapparentsolartime = localstandardtime;
  signedLAS = 12. - localapparentsolartime;
  signedLAS = fabs(signedLAS);
  omega = -15. * signedLAS;
  decl_rad = 0.006918 - 0.399912 * cos(tthet) + 0.070257 * sin(tthet) -
             0.006758 * cos(2 * tthet) + 0.000907 * sin(2 * tthet) -
             0.002697 * cos(3 * tthet) + 0.00148 * sin(3 * tthet);
  lat_rad = latitude * pi / 180.;
  theta_rad = acos(sin(decl_rad) * sin(lat_rad) +
                   cos(decl_rad) * cos(lat_rad) * cos(omega * pi / 180.));
  Rpot = solarconst * (1.00011 + 0.034221 * cos(tthet) + 0.00128 * sin(tthet) +
                       0.000719 * cos(2 * tthet) + 0.000077 * sin(2 * tthet));
  Rpot_h = Rpot * cos(theta_rad);
  return (Rpot_h > 0) ? Rpot_h : 0.0;
}


x86 assembly (clang, -O0):
<get_daily_rpot>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  0xeeb(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xe9e(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xf2a(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xf16(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xf02(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xedf(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movaps 0xee9(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xeb0(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1050 <cos@plt>
movsd  0xe84(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe80(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
cvttsd2si -0x38(%rbp),%edi
call   1040 <sin@plt>
movsd  -0xe8(%rbp),%xmm1
ff
movsd  0xe4a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  0xdd2(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0xe0(%rbp),%xmm1
ff
movsd  0xe10(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  0xda0(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
movsd  -0xd8(%rbp),%xmm1
ff
movsd  0xdd2(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  0xdaa(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0xd0(%rbp),%xmm1
ff
movsd  0xd98(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  0xd78(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
movsd  -0xc8(%rbp),%xmm1
ff
movsd  0xd52(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xd35(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xd20(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
cvttsd2si -0x50(%rbp),%edi
call   1040 <sin@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
cvttsd2si -0x58(%rbp),%edi
call   1040 <sin@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  0xcc0(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  0xcab(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <cos@plt>
movsd  -0xb8(%rbp),%xmm1
ff
movsd  -0xb0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1050 <cos@plt>
movsd  0xc4f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc4b(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
cvttsd2si -0x38(%rbp),%edi
call   1040 <sin@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movsd  0xc15(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xbed(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0x98(%rbp),%xmm1
ff
movsd  0xbdb(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xbbb(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
movsd  0xb92(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xb7a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    14de <get_daily_rpot+0x3ae>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
jmp    14ee <get_daily_rpot+0x3be>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
jmp    14ee <get_daily_rpot+0x3be>
movsd  -0xf0(%rbp),%xmm0
ff
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_daily_rpot>:
push   %rbp
push   %rbx
sub    $0x48,%rsp
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
addsd  0xeb5(%rip),%xmm0
mulsd  0xeb5(%rip),%xmm0
divsd  0xeb5(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xeb0(%rip),%xmm1
subsd  %xmm2,%xmm1
andpd  0xf3c(%rip),%xmm1
mulsd  0xea4(%rip),%xmm1
movapd %xmm1,0x30(%rsp)
call   1050 <cos@plt>
mulsd  0xe99(%rip),%xmm0
addsd  0xe99(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
cvttsd2si (%rsp),%ebx
mov    %ebx,%edi
call   1040 <sin@plt>
mulsd  0xe87(%rip),%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
call   1050 <cos@plt>
mulsd  0xe67(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
cvttsd2si 0x18(%rsp),%ebp
mov    %ebp,%edi
call   1040 <sin@plt>
mulsd  0xe4e(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe42(%rip),%xmm0
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
call   1050 <cos@plt>
mulsd  0xe32(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
cvttsd2si 0x28(%rsp),%edi
call   1040 <sin@plt>
mulsd  0xe1b(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm1
mulsd  0xe09(%rip),%xmm1
divsd  0xe09(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
movsd  %xmm0,0x8(%rsp)
cvttsd2si 0x10(%rsp),%edi
call   1040 <sin@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movapd 0x30(%rsp),%xmm0
mulsd  0xda5(%rip),%xmm0
divsd  0xda5(%rip),%xmm0
call   1050 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm0
call   1030 <acos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0xd75(%rip),%xmm0
addsd  0xd75(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
call   1040 <sin@plt>
mulsd  0xd69(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0xd54(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
call   1040 <sin@plt>
mulsd  0xd43(%rip),%xmm0
addsd  (%rsp),%xmm0
mulsd  0xd3e(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
maxsd  %xmm1,%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @get_daily_rpot(double %0, double %1, i32 %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%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* %5
store double %1, double* %6
store i32 %2, i32* %7
store double %3, double* %8
store double 0x400921FB54524550, double* %19
store double 1.376000e+03, double* %20
%21 = load double, double* %8
store double %21, double* %9
%22 = load i32, i32* %7
%23 = sitofp i32 %22 to double
%24 = fsub double %23, 1.000000e+00
%25 = fmul double 0x401921FB54524550, %24
%26 = fdiv double %25, 3.650000e+02
store double %26, double* %11
%27 = load double, double* %9
store double %27, double* %10
%28 = load double, double* %10
%29 = fsub double 1.200000e+01, %28
store double %29, double* %12
%30 = load double, double* %12
%31 = call double @llvm.fabs.f64(double %30)
store double %31, double* %12
%32 = load double, double* %12
%33 = fmul double -1.500000e+01, %32
store double %33, double* %13
%34 = load double, double* %11
%35 = call double @cos(double %34)
%36 = call double @llvm.fmuladd.f64(double -3.999120e-01, double %35, double 0x3F7C560C7C0F4517)
%37 = load double, double* %11
%38 = fptosi double %37 to i32
%39 = call double @sin(i32 %38)
%40 = call double @llvm.fmuladd.f64(double 7.025700e-02, double %39, double %36)
%41 = load double, double* %11
%42 = fmul double 2.000000e+00, %41
%43 = call double @cos(double %42)
%44 = call double @llvm.fmuladd.f64(double -6.758000e-03, double %43, double %40)
%45 = load double, double* %11
%46 = fmul double 2.000000e+00, %45
%47 = fptosi double %46 to i32
%48 = call double @sin(i32 %47)
%49 = call double @llvm.fmuladd.f64(double 9.070000e-04, double %48, double %44)
%50 = load double, double* %11
%51 = fmul double 3.000000e+00, %50
%52 = call double @cos(double %51)
%53 = call double @llvm.fmuladd.f64(double -2.697000e-03, double %52, double %49)
%54 = load double, double* %11
%55 = fmul double 3.000000e+00, %54
%56 = fptosi double %55 to i32
%57 = call double @sin(i32 %56)
%58 = call double @llvm.fmuladd.f64(double 1.480000e-03, double %57, double %53)
store double %58, double* %14
%59 = load double, double* %5
%60 = fmul double %59, 0x400921FB54524550
%61 = fdiv double %60, 1.800000e+02
store double %61, double* %15
%62 = load double, double* %14
%63 = fptosi double %62 to i32
%64 = call double @sin(i32 %63)
%65 = load double, double* %15
%66 = fptosi double %65 to i32
%67 = call double @sin(i32 %66)
%68 = load double, double* %14
%69 = call double @cos(double %68)
%70 = load double, double* %15
%71 = call double @cos(double %70)
%72 = fmul double %69, %71
%73 = load double, double* %13
%74 = fmul double %73, 0x400921FB54524550
%75 = fdiv double %74, 1.800000e+02
%76 = call double @cos(double %75)
%77 = fmul double %72, %76
%78 = call double @llvm.fmuladd.f64(double %64, double %67, double %77)
%79 = call double @acos(double %78)
store double %79, double* %16
%80 = load double, double* %11
%81 = call double @cos(double %80)
%82 = call double @llvm.fmuladd.f64(double 3.422100e-02, double %81, double 1.000110e+00)
%83 = load double, double* %11
%84 = fptosi double %83 to i32
%85 = call double @sin(i32 %84)
%86 = call double @llvm.fmuladd.f64(double 1.280000e-03, double %85, double %82)
%87 = load double, double* %11
%88 = fmul double 2.000000e+00, %87
%89 = call double @cos(double %88)
%90 = call double @llvm.fmuladd.f64(double 7.190000e-04, double %89, double %86)
%91 = load double, double* %11
%92 = fmul double 2.000000e+00, %91
%93 = fptosi double %92 to i32
%94 = call double @sin(i32 %93)
%95 = call double @llvm.fmuladd.f64(double 7.700000e-05, double %94, double %90)
%96 = fmul double 1.376000e+03, %95
store double %96, double* %17
%97 = load double, double* %17
%98 = load double, double* %16
%99 = call double @cos(double %98)
%100 = fmul double %97, %99
store double %100, double* %18
%101 = load double, double* %18
%102 = fcmp ogt double %101, 0.000000e+00
br i1 %102, label %103, label %105
103: ; preds = %4
%104 = load double, double* %18
br label %106
105: ; preds = %4
br label %106
106: ; preds = %105, %103
%107 = phi double [ %104, %103 ], [ 0.000000e+00, %105 ]
ret double %107
}

LLVM IR (-O2):
define double @get_daily_rpot(double %0, double %1, i32 %2, double %3) {
%5 = sitofp i32 %2 to double
%6 = fadd double %5, -1.000000e+00
%7 = fmul double %6, 0x401921FB54524550
%8 = fdiv double %7, 3.650000e+02
%9 = fsub double 1.200000e+01, %3
%10 = tail call double @llvm.fabs.f64(double %9)
%11 = fmul double %10, -1.500000e+01
%12 = tail call double @cos(double %8)
%13 = tail call double @llvm.fmuladd.f64(double %12, double -3.999120e-01, double 0x3F7C560C7C0F4517)
%14 = fptosi double %8 to i32
%15 = tail call double @sin(i32 %14)
%16 = tail call double @llvm.fmuladd.f64(double %15, double 7.025700e-02, double %13)
%17 = fmul double %8, 2.000000e+00
%18 = tail call double @cos(double %17)
%19 = tail call double @llvm.fmuladd.f64(double %18, double -6.758000e-03, double %16)
%20 = fptosi double %17 to i32
%21 = tail call double @sin(i32 %20)
%22 = tail call double @llvm.fmuladd.f64(double %21, double 9.070000e-04, double %19)
%23 = fmul double %8, 3.000000e+00
%24 = tail call double @cos(double %23)
%25 = tail call double @llvm.fmuladd.f64(double %24, double -2.697000e-03, double %22)
%26 = fptosi double %23 to i32
%27 = tail call double @sin(i32 %26)
%28 = tail call double @llvm.fmuladd.f64(double %27, double 1.480000e-03, double %25)
%29 = fmul double %0, 0x400921FB54524550
%30 = fdiv double %29, 1.800000e+02
%31 = fptosi double %28 to i32
%32 = tail call double @sin(i32 %31)
%33 = fptosi double %30 to i32
%34 = tail call double @sin(i32 %33)
%35 = tail call double @cos(double %28)
%36 = tail call double @cos(double %30)
%37 = fmul double %35, %36
%38 = fmul double %11, 0x400921FB54524550
%39 = fdiv double %38, 1.800000e+02
%40 = tail call double @cos(double %39)
%41 = fmul double %37, %40
%42 = tail call double @llvm.fmuladd.f64(double %32, double %34, double %41)
%43 = tail call double @acos(double %42)
%44 = tail call double @cos(double %8)
%45 = tail call double @llvm.fmuladd.f64(double %44, double 3.422100e-02, double 1.000110e+00)
%46 = tail call double @sin(i32 %14)
%47 = tail call double @llvm.fmuladd.f64(double %46, double 1.280000e-03, double %45)
%48 = tail call double @cos(double %17)
%49 = tail call double @llvm.fmuladd.f64(double %48, double 7.190000e-04, double %47)
%50 = tail call double @sin(i32 %20)
%51 = tail call double @llvm.fmuladd.f64(double %50, double 7.700000e-05, double %49)
%52 = fmul double %51, 1.376000e+03
%53 = tail call double @cos(double %43)
%54 = fmul double %53, %52
%55 = fcmp ogt double %54, 0.000000e+00
%56 = select i1 %55, double %54, double 0.000000e+00
ret double %56
}