#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(int);
double cos(double);
double sin(double);
int tan(double);
double solar_day(double lat, double doy, double tsw) {
  double ws, cosun, latrad, delta, deltarad, ds, result;
  ds = 1.0 + 0.01672 * sin(2 * 3.1415927 * (doy - 93.5) / 365.0);
  deltarad = 0.4093 * sin((2 * 3.1415927 * doy / 365) - 1.39);
  latrad = lat * 3.1415927 / 180.0;
  ws = acos(-tan(latrad) * tan(deltarad));
  cosun =
      ws * sin(deltarad) * sin(latrad) + cos(deltarad) * cos(latrad) * sin(ws);
  result = (cosun * 1367 * tsw) / (3.1415927 * ds * ds);
  return result;
}


x86 assembly (clang, -O0):
<solar_day>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xee1(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xebd(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xea9(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  0xea8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea4(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe83(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe6e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe5a(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xe3e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe15(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe18(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1050 <tan@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x7c(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1050 <tan@plt>
mov    -0x7c(%rbp),%edi
imul   %eax,%edi
call   1030 <acos@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x68(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xd47(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xd2d(%rip),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solar_day>:
push   %rbx
sub    $0x60,%rsp
movaps %xmm2,0x50(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
movsd  0xea2(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xe9e(%rip),%xmm0
divsd  0xe9e(%rip),%xmm0
call   1040 <sin@plt>
movapd %xmm0,0x40(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0xe7d(%rip),%xmm0
divsd  0xe7d(%rip),%xmm0
addsd  0xe7d(%rip),%xmm0
call   1040 <sin@plt>
mulsd  0xe78(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe6c(%rip),%xmm0
divsd  0xe6c(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1050 <tan@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1050 <tan@plt>
imul   %eax,%ebx
neg    %ebx
mov    %ebx,%edi
call   1030 <acos@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x18(%rsp),%xmm0
movapd %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movapd 0x30(%rsp),%xmm1
unpcklpd 0x40(%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
shufpd $0x2,0xdd7(%rip),%xmm2
shufpd $0x2,0xdde(%rip),%xmm0
mulpd  %xmm1,%xmm2
addpd  %xmm2,%xmm0
movapd 0xdde(%rip),%xmm1
mulpd  %xmm0,%xmm1
movlpd 0x50(%rsp),%xmm0
mulpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @solar_day(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%14 = load double, double* %5
%15 = fsub double %14, 9.350000e+01
%16 = fmul double 0x401921FB5A7ED197, %15
%17 = fdiv double %16, 3.650000e+02
%18 = call double @sin(double %17)
%19 = call double @llvm.fmuladd.f64(double 1.672000e-02, double %18, double 1.000000e+00)
store double %19, double* %12
%20 = load double, double* %5
%21 = fmul double 0x401921FB5A7ED197, %20
%22 = fdiv double %21, 3.650000e+02
%23 = fsub double %22, 1.390000e+00
%24 = call double @sin(double %23)
%25 = fmul double 4.093000e-01, %24
store double %25, double* %11
%26 = load double, double* %4
%27 = fmul double %26, 0x400921FB5A7ED197
%28 = fdiv double %27, 1.800000e+02
store double %28, double* %9
%29 = load double, double* %9
%30 = call i32 @tan(double %29)
%31 = sub nsw i32 0, %30
%32 = load double, double* %11
%33 = call i32 @tan(double %32)
%34 = mul nsw i32 %31, %33
%35 = call double @acos(i32 %34)
store double %35, double* %7
%36 = load double, double* %7
%37 = load double, double* %11
%38 = call double @sin(double %37)
%39 = fmul double %36, %38
%40 = load double, double* %9
%41 = call double @sin(double %40)
%42 = load double, double* %11
%43 = call double @cos(double %42)
%44 = load double, double* %9
%45 = call double @cos(double %44)
%46 = fmul double %43, %45
%47 = load double, double* %7
%48 = call double @sin(double %47)
%49 = fmul double %46, %48
%50 = call double @llvm.fmuladd.f64(double %39, double %41, double %49)
store double %50, double* %8
%51 = load double, double* %8
%52 = fmul double %51, 1.367000e+03
%53 = load double, double* %6
%54 = fmul double %52, %53
%55 = load double, double* %12
%56 = fmul double 0x400921FB5A7ED197, %55
%57 = load double, double* %12
%58 = fmul double %56, %57
%59 = fdiv double %54, %58
store double %59, double* %13
%60 = load double, double* %13
ret double %60
}

LLVM IR (-O2):
define double @solar_day(double %0, double %1, double %2) {
%4 = fadd double %1, -9.350000e+01
%5 = fmul double %4, 0x401921FB5A7ED197
%6 = fdiv double %5, 3.650000e+02
%7 = tail call double @sin(double %6)
%8 = fmul double %1, 0x401921FB5A7ED197
%9 = fdiv double %8, 3.650000e+02
%10 = fadd double %9, -1.390000e+00
%11 = tail call double @sin(double %10)
%12 = fmul double %11, 4.093000e-01
%13 = fmul double %0, 0x400921FB5A7ED197
%14 = fdiv double %13, 1.800000e+02
%15 = tail call i32 @tan(double %14)
%16 = tail call i32 @tan(double %12)
%17 = mul i32 %15, %16
%18 = sub i32 0, %17
%19 = tail call double @acos(i32 %18)
%20 = tail call double @sin(double %12)
%21 = fmul double %19, %20
%22 = tail call double @sin(double %14)
%23 = tail call double @cos(double %12)
%24 = tail call double @cos(double %14)
%25 = fmul double %23, %24
%26 = tail call double @sin(double %19)
%27 = fmul double %25, %26
%28 = insertelement <2 x double> poison, double %21, i64 0
%29 = insertelement <2 x double> %28, double %7, i64 1
%30 = insertelement <2 x double> <double poison, double 1.672000e-02>, double %22, i64 0
%31 = insertelement <2 x double> <double poison, double 1.000000e+00>, double %27, i64 0
%32 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %29, <2 x double> %30, <2 x double> %31)
%33 = fmul <2 x double> %32, <double 1.367000e+03, double 0x400921FB5A7ED197>
%34 = insertelement <2 x double> %32, double %2, i64 0
%35 = fmul <2 x double> %34, %33
%36 = extractelement <2 x double> %35, i64 0
%37 = extractelement <2 x double> %35, i64 1
%38 = fdiv double %36, %37
ret double %38
}