#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, 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 = 2 * (ws * sin(deltarad) * sin(latrad) +
               cos(deltarad) * cos(latrad) * sin(ws));
  result = (cosun * 1367 * tsw) / (2 * ws * 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  0xee9(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xec5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xeb1(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  0xeb0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeac(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe8b(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe76(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe62(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xe46(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe2d(%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,-0x74(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1050 <tan@plt>
mov    -0x74(%rbp),%edi
imul   %eax,%edi
call   1030 <acos@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x60(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xd44(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xd3b(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xd21(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solar_day>:
push   %rbx
sub    $0x50,%rsp
movaps %xmm2,0x40(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,(%rsp)
movsd  0xea3(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xe9f(%rip),%xmm0
divsd  0xe9f(%rip),%xmm0
call   1040 <sin@plt>
mulsd  0xe9a(%rip),%xmm0
addsd  0xe9a(%rip),%xmm0
movapd %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe6e(%rip),%xmm0
divsd  0xe6e(%rip),%xmm0
addsd  0xe7e(%rip),%xmm0
call   1040 <sin@plt>
mulsd  0xe79(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xe6e(%rip),%xmm0
divsd  0xe6e(%rip),%xmm0
movsd  %xmm0,(%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>
movaps %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1060 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
addsd  %xmm1,%xmm0
unpcklpd 0x10(%rsp),%xmm0
addpd  %xmm0,%xmm0
movapd 0xdd7(%rip),%xmm1
movapd 0x30(%rsp),%xmm2
unpcklpd %xmm2,%xmm1
mulpd  %xmm1,%xmm0
movapd 0x40(%rsp),%xmm1
unpcklpd %xmm2,%xmm1
mulpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  %xmm1,%xmm0
add    $0x50,%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
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%13 = load double, double* %5
%14 = fsub double %13, 9.350000e+01
%15 = fmul double 0x401921FB5A7ED197, %14
%16 = fdiv double %15, 3.650000e+02
%17 = call double @sin(double %16)
%18 = call double @llvm.fmuladd.f64(double 1.672000e-02, double %17, double 1.000000e+00)
store double %18, double* %11
%19 = load double, double* %5
%20 = fmul double 0x401921FB5A7ED197, %19
%21 = fdiv double %20, 3.650000e+02
%22 = fsub double %21, 1.390000e+00
%23 = call double @sin(double %22)
%24 = fmul double 4.093000e-01, %23
store double %24, double* %10
%25 = load double, double* %4
%26 = fmul double %25, 0x400921FB5A7ED197
%27 = fdiv double %26, 1.800000e+02
store double %27, double* %9
%28 = load double, double* %9
%29 = call i32 @tan(double %28)
%30 = sub nsw i32 0, %29
%31 = load double, double* %10
%32 = call i32 @tan(double %31)
%33 = mul nsw i32 %30, %32
%34 = call double @acos(i32 %33)
store double %34, double* %7
%35 = load double, double* %7
%36 = load double, double* %10
%37 = call double @sin(double %36)
%38 = fmul double %35, %37
%39 = load double, double* %9
%40 = call double @sin(double %39)
%41 = load double, double* %10
%42 = call double @cos(double %41)
%43 = load double, double* %9
%44 = call double @cos(double %43)
%45 = fmul double %42, %44
%46 = load double, double* %7
%47 = call double @sin(double %46)
%48 = fmul double %45, %47
%49 = call double @llvm.fmuladd.f64(double %38, double %40, double %48)
%50 = fmul double 2.000000e+00, %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* %7
%56 = fmul double 2.000000e+00, %55
%57 = load double, double* %11
%58 = fmul double %56, %57
%59 = load double, double* %11
%60 = fmul double %58, %59
%61 = fdiv double %54, %60
store double %61, double* %12
%62 = load double, double* %12
ret double %62
}

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