#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 sin(int);
int tan(double);
double daily_N(double doy, double lat) {
  double latrad = lat * 3.1415927 / 180.0;
  double deltarad = 0.409 * sin(2 * 3.1415927 / 365 * doy - 1.39);
  double ws = acos(-tan(latrad) * tan(deltarad));
  return (24 * ws / 3.1415927);
}


x86 assembly (clang, -O0):
<daily_N>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xeb6(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xed1(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeab(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea7(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xe7f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <tan@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <tan@plt>
mov    -0x2c(%rbp),%edi
imul   %eax,%edi
call   1030 <acos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xe39(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xe24(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<daily_N>:
push   %rbx
sub    $0x10,%rsp
mulsd  0xec3(%rip),%xmm1
divsd  0xec3(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  0xebd(%rip),%xmm0
addsd  0xebd(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
mulsd  0xeb4(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <tan@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
call   1050 <tan@plt>
imul   %eax,%ebx
neg    %ebx
mov    %ebx,%edi
call   1030 <acos@plt>
mulsd  0xe8c(%rip),%xmm0
divsd  0xe5c(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @daily_N(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %3
store double %1, double* %4
%8 = load double, double* %4
%9 = fmul double %8, 0x400921FB5A7ED197
%10 = fdiv double %9, 1.800000e+02
store double %10, double* %5
%11 = load double, double* %3
%12 = call double @llvm.fmuladd.f64(double 0x3F91A099D9121BC4, double %11, double -1.390000e+00)
%13 = fptosi double %12 to i32
%14 = call double @sin(i32 %13)
%15 = fmul double 4.090000e-01, %14
store double %15, double* %6
%16 = load double, double* %5
%17 = call i32 @tan(double %16)
%18 = sub nsw i32 0, %17
%19 = load double, double* %6
%20 = call i32 @tan(double %19)
%21 = mul nsw i32 %18, %20
%22 = call double @acos(i32 %21)
store double %22, double* %7
%23 = load double, double* %7
%24 = fmul double 2.400000e+01, %23
%25 = fdiv double %24, 0x400921FB5A7ED197
ret double %25
}

LLVM IR (-O2):
define double @daily_N(double %0, double %1) {
%3 = fmul double %1, 0x400921FB5A7ED197
%4 = fdiv double %3, 1.800000e+02
%5 = tail call double @llvm.fmuladd.f64(double %0, double 0x3F91A099D9121BC4, double -1.390000e+00)
%6 = fptosi double %5 to i32
%7 = tail call double @sin(i32 %6)
%8 = fmul double %7, 4.090000e-01
%9 = tail call i32 @tan(double %4)
%10 = tail call i32 @tan(double %8)
%11 = mul i32 %9, %10
%12 = sub i32 0, %11
%13 = tail call double @acos(i32 %12)
%14 = fmul double %13, 2.400000e+01
%15 = fdiv double %14, 0x400921FB5A7ED197
ret double %15
}