#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, n10_temp, delta, ds, result;
  ds = 1.0 + 0.01672 * sin(2 * 3.1415927 * (doy - 93.5) / 365.0);
  delta = 0.4093 * sin((2 * 3.1415927 * doy / 365) - 1.39);
  n10_temp = lat * 3.1415927 / 180.0;
  ws = acos(-tan(n10_temp) * tan(delta * 3.1415927 / 180.0));
  cosun = ws * sin(delta * 3.1415927 / 180.0) * sin(n10_temp) +
          cos(delta * 3.1415927 / 180.0) * cos(n10_temp) * 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,-0x40(%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,-0x38(%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,-0x74(%rbp)
movsd  0xde4(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xde7(%rip),%xmm1
divsd  %xmm1,%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  0xdac(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xdaf(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  0xd6e(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xd71(%rip),%xmm1
divsd  %xmm1,%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,-0x60(%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,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xd0b(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xcf1(%rip),%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    $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
mulsd  0xe49(%rip),%xmm0
divsd  0xe49(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
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,0xdc1(%rip),%xmm2
shufpd $0x2,0xdc8(%rip),%xmm0
mulpd  %xmm1,%xmm2
addpd  %xmm2,%xmm0
movapd 0xdc8(%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
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 = fmul double %31, 0x400921FB5A7ED197
%33 = fdiv double %32, 1.800000e+02
%34 = call i32 @tan(double %33)
%35 = mul nsw i32 %30, %34
%36 = call double @acos(i32 %35)
store double %36, double* %7
%37 = load double, double* %7
%38 = load double, double* %10
%39 = fmul double %38, 0x400921FB5A7ED197
%40 = fdiv double %39, 1.800000e+02
%41 = call double @sin(double %40)
%42 = fmul double %37, %41
%43 = load double, double* %9
%44 = call double @sin(double %43)
%45 = load double, double* %10
%46 = fmul double %45, 0x400921FB5A7ED197
%47 = fdiv double %46, 1.800000e+02
%48 = call double @cos(double %47)
%49 = load double, double* %9
%50 = call double @cos(double %49)
%51 = fmul double %48, %50
%52 = load double, double* %7
%53 = call double @sin(double %52)
%54 = fmul double %51, %53
%55 = call double @llvm.fmuladd.f64(double %42, double %44, double %54)
store double %55, double* %8
%56 = load double, double* %8
%57 = fmul double %56, 1.367000e+03
%58 = load double, double* %6
%59 = fmul double %57, %58
%60 = load double, double* %11
%61 = fmul double 0x400921FB5A7ED197, %60
%62 = load double, double* %11
%63 = fmul double %61, %62
%64 = fdiv double %59, %63
store double %64, double* %12
%65 = load double, double* %12
ret double %65
}

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