#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 cos(int);
double dayangle(int);
double sin(int);
int equation_of_time(int day) {
  double angle = 0, et = 0;
  angle = dayangle(day);
  et = (0.000075 + 0.001868 * cos(angle) - 0.032077 * sin(angle) -
        0.014615 * cos(2 * angle) - 0.04089 * sin(2 * angle)) *
       13750.8;
  return (int)(et + 0.5);
}


x86 assembly (clang, -O0):
<equation_of_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <dayangle@plt>
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x10(%rbp),%edi
call   1050 <cos@plt>
movsd  0xec6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec2(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cvttsd2si -0x10(%rbp),%edi
call   1030 <sin@plt>
movsd  -0x30(%rbp),%xmm1
movsd  0xe92(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe6d(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <cos@plt>
movsd  -0x28(%rbp),%xmm1
movsd  0xe5a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe3d(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movsd  -0x20(%rbp),%xmm1
movsd  0xe1a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe02(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xde9(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equation_of_time>:
push   %rbx
sub    $0x10,%rsp
call   1040 <dayangle@plt>
movsd  %xmm0,0x8(%rsp)
cvttsd2si %xmm0,%ebx
mov    %ebx,%edi
call   1050 <cos@plt>
mulsd  0xead(%rip),%xmm0
addsd  0xead(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
call   1030 <sin@plt>
mulsd  0xea1(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%ebx
mov    %ebx,%edi
call   1050 <cos@plt>
mulsd  0xe82(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1030 <sin@plt>
mulsd  0xe70(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
mulsd  0xe6a(%rip),%xmm0
addsd  0xe6a(%rip),%xmm0
cvttsd2si %xmm0,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @equation_of_time(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
store i32 %0, i32* %2
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %4
%5 = load i32, i32* %2
%6 = call double @dayangle(i32 %5)
store double %6, double* %3
%7 = load double, double* %3
%8 = fptosi double %7 to i32
%9 = call double @cos(i32 %8)
%10 = call double @llvm.fmuladd.f64(double 1.868000e-03, double %9, double 7.500000e-05)
%11 = load double, double* %3
%12 = fptosi double %11 to i32
%13 = call double @sin(i32 %12)
%14 = call double @llvm.fmuladd.f64(double -3.207700e-02, double %13, double %10)
%15 = load double, double* %3
%16 = fmul double 2.000000e+00, %15
%17 = fptosi double %16 to i32
%18 = call double @cos(i32 %17)
%19 = call double @llvm.fmuladd.f64(double -1.461500e-02, double %18, double %14)
%20 = load double, double* %3
%21 = fmul double 2.000000e+00, %20
%22 = fptosi double %21 to i32
%23 = call double @sin(i32 %22)
%24 = call double @llvm.fmuladd.f64(double -4.089000e-02, double %23, double %19)
%25 = fmul double %24, 1.375080e+04
store double %25, double* %4
%26 = load double, double* %4
%27 = fadd double %26, 5.000000e-01
%28 = fptosi double %27 to i32
ret i32 %28
}

LLVM IR (-O2):
define i32 @equation_of_time(i32 %0) {
%2 = tail call double @dayangle(i32 %0)
%3 = fptosi double %2 to i32
%4 = tail call double @cos(i32 %3)
%5 = tail call double @llvm.fmuladd.f64(double %4, double 1.868000e-03, double 7.500000e-05)
%6 = tail call double @sin(i32 %3)
%7 = tail call double @llvm.fmuladd.f64(double %6, double -3.207700e-02, double %5)
%8 = fmul double %2, 2.000000e+00
%9 = fptosi double %8 to i32
%10 = tail call double @cos(i32 %9)
%11 = tail call double @llvm.fmuladd.f64(double %10, double -1.461500e-02, double %7)
%12 = tail call double @sin(i32 %9)
%13 = tail call double @llvm.fmuladd.f64(double %12, double -4.089000e-02, double %11)
%14 = fmul double %13, 1.375080e+04
%15 = fadd double %14, 5.000000e-01
%16 = fptosi double %15 to i32
ret i32 %16
}