#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 */
int M_PI;
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 * M_PI * (doy - 93.5) / 365.0);
  delta = 0.4093 * sin((2 * M_PI * doy / 365) - 1.39);
  n10_temp = lat * M_PI / 180.0;
  ws = acos(-tan(n10_temp) * tan(delta * M_PI / 180.0));
  cosun = ws * sin(delta * M_PI / 180.0) * sin(n10_temp) +
          cos(delta * M_PI / 180.0) * cos(n10_temp) * sin(ws);
  result = (cosun * 1367 * tsw) / (M_PI * 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)
mov    0x2e87(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xec1(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe99(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  0xe90(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe8c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    0x2e34(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe42(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xe26(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2de9(%rip),%rax
cvtsi2sdl (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdf9(%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
mov    0x2db1(%rip),%rax
cvtsi2sdl (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdc1(%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  -0x38(%rbp),%xmm0
mov    0x2d72(%rip),%rax
cvtsi2sdl (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd82(%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  -0x38(%rbp),%xmm0
mov    0x2d2d(%rip),%rax
cvtsi2sdl (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd3d(%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  0xcd7(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mov    0x2cae(%rip),%rax
cvtsi2sdl (%rax),%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   %r14
push   %rbx
sub    $0x68,%rsp
movaps %xmm2,0x50(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    0x2e89(%rip),%r14
mov    (%r14),%eax
add    %eax,%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
movsd  0xe8d(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
divsd  0xe85(%rip),%xmm0
call   1040 <sin@plt>
movapd %xmm0,0x40(%rsp)
mov    (%r14),%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
divsd  0xe60(%rip),%xmm0
addsd  0xe60(%rip),%xmm0
call   1040 <sin@plt>
mulsd  0xe5b(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl (%r14),%xmm0
mulsd  0x10(%rsp),%xmm0
divsd  0xe47(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1050 <tan@plt>
mov    %eax,%ebx
xorps  %xmm0,%xmm0
cvtsi2sdl (%r14),%xmm0
mulsd  0x8(%rsp),%xmm0
divsd  0xe24(%rip),%xmm0
call   1050 <tan@plt>
imul   %eax,%ebx
neg    %ebx
mov    %ebx,%edi
call   1030 <acos@plt>
movsd  %xmm0,0x18(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl (%r14),%xmm0
mulsd  0x8(%rsp),%xmm0
divsd  0xdf7(%rip),%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)
xorps  %xmm0,%xmm0
cvtsi2sdl (%r14),%xmm0
mulsd  0x8(%rsp),%xmm0
divsd  0xdc0(%rip),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movapd 0x30(%rsp),%xmm2
unpcklpd 0x40(%rsp),%xmm2
movapd 0x20(%rsp),%xmm1
shufpd $0x2,0xd82(%rip),%xmm1
mulpd  %xmm2,%xmm1
movapd %xmm1,%xmm2
shufpd $0x2,0xd81(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl (%r14),%xmm1
addpd  %xmm2,%xmm0
movapd 0xd7d(%rip),%xmm2
unpcklpd %xmm1,%xmm2
mulpd  %xmm0,%xmm2
movlpd 0x50(%rsp),%xmm0
mulpd  %xmm2,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  %xmm1,%xmm0
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@M_PI = global i32 0
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 i32, i32* @M_PI
%14 = mul nsw i32 2, %13
%15 = sitofp i32 %14 to double
%16 = load double, double* %5
%17 = fsub double %16, 9.350000e+01
%18 = fmul double %15, %17
%19 = fdiv double %18, 3.650000e+02
%20 = call double @sin(double %19)
%21 = call double @llvm.fmuladd.f64(double 1.672000e-02, double %20, double 1.000000e+00)
store double %21, double* %11
%22 = load i32, i32* @M_PI
%23 = mul nsw i32 2, %22
%24 = sitofp i32 %23 to double
%25 = load double, double* %5
%26 = fmul double %24, %25
%27 = fdiv double %26, 3.650000e+02
%28 = fsub double %27, 1.390000e+00
%29 = call double @sin(double %28)
%30 = fmul double 4.093000e-01, %29
store double %30, double* %10
%31 = load double, double* %4
%32 = load i32, i32* @M_PI
%33 = sitofp i32 %32 to double
%34 = fmul double %31, %33
%35 = fdiv double %34, 1.800000e+02
store double %35, double* %9
%36 = load double, double* %9
%37 = call i32 @tan(double %36)
%38 = sub nsw i32 0, %37
%39 = load double, double* %10
%40 = load i32, i32* @M_PI
%41 = sitofp i32 %40 to double
%42 = fmul double %39, %41
%43 = fdiv double %42, 1.800000e+02
%44 = call i32 @tan(double %43)
%45 = mul nsw i32 %38, %44
%46 = call double @acos(i32 %45)
store double %46, double* %7
%47 = load double, double* %7
%48 = load double, double* %10
%49 = load i32, i32* @M_PI
%50 = sitofp i32 %49 to double
%51 = fmul double %48, %50
%52 = fdiv double %51, 1.800000e+02
%53 = call double @sin(double %52)
%54 = fmul double %47, %53
%55 = load double, double* %9
%56 = call double @sin(double %55)
%57 = load double, double* %10
%58 = load i32, i32* @M_PI
%59 = sitofp i32 %58 to double
%60 = fmul double %57, %59
%61 = fdiv double %60, 1.800000e+02
%62 = call double @cos(double %61)
%63 = load double, double* %9
%64 = call double @cos(double %63)
%65 = fmul double %62, %64
%66 = load double, double* %7
%67 = call double @sin(double %66)
%68 = fmul double %65, %67
%69 = call double @llvm.fmuladd.f64(double %54, double %56, double %68)
store double %69, double* %8
%70 = load double, double* %8
%71 = fmul double %70, 1.367000e+03
%72 = load double, double* %6
%73 = fmul double %71, %72
%74 = load i32, i32* @M_PI
%75 = sitofp i32 %74 to double
%76 = load double, double* %11
%77 = fmul double %75, %76
%78 = load double, double* %11
%79 = fmul double %77, %78
%80 = fdiv double %73, %79
store double %80, double* %12
%81 = load double, double* %12
ret double %81
}

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