#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);
int cos(double);
double degToRad(double);
int tan(double);
double calcHourAngleSunset(double lat, double solarDec) {
  double latRad = degToRad(lat);
  double sdRad = degToRad(solarDec);
  double HA = (acos(cos(degToRad(90.833)) / (cos(latRad) * cos(sdRad)) -
                    tan(latRad) * tan(sdRad)));
  return -HA;
}


x86 assembly (clang, -O0):
<calcHourAngleSunset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <degToRad@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1060 <degToRad@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xe88(%rip),%xmm0
call   1060 <degToRad@plt>
call   1050 <cos@plt>
mov    %eax,-0x34(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
mov    %eax,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <cos@plt>
mov    -0x38(%rbp),%ecx
mov    %eax,%edx
mov    -0x34(%rbp),%eax
imul   %edx,%ecx
cltd
idiv   %ecx
mov    %eax,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <tan@plt>
mov    %eax,-0x2c(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <tan@plt>
mov    -0x30(%rbp),%edi
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
imul   %ecx,%eax
sub    %eax,%edi
call   1030 <acos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcHourAngleSunset>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
call   1060 <degToRad@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <degToRad@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe90(%rip),%xmm0
call   1060 <degToRad@plt>
call   1050 <cos@plt>
mov    %eax,%ebx
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
mov    %eax,%ecx
imul   %ebp,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %eax,%ebx
movsd  0x10(%rsp),%xmm0
call   1040 <tan@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
call   1040 <tan@plt>
imul   %ebp,%eax
sub    %eax,%ebx
mov    %ebx,%edi
call   1030 <acos@plt>
xorps  0xe45(%rip),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @calcHourAngleSunset(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* %3
%9 = call double @degToRad(double %8)
store double %9, double* %5
%10 = load double, double* %4
%11 = call double @degToRad(double %10)
store double %11, double* %6
%12 = call double @degToRad(double 9.083300e+01)
%13 = call i32 @cos(double %12)
%14 = load double, double* %5
%15 = call i32 @cos(double %14)
%16 = load double, double* %6
%17 = call i32 @cos(double %16)
%18 = mul nsw i32 %15, %17
%19 = sdiv i32 %13, %18
%20 = load double, double* %5
%21 = call i32 @tan(double %20)
%22 = load double, double* %6
%23 = call i32 @tan(double %22)
%24 = mul nsw i32 %21, %23
%25 = sub nsw i32 %19, %24
%26 = call double @acos(i32 %25)
store double %26, double* %7
%27 = load double, double* %7
%28 = fneg double %27
ret double %28
}

LLVM IR (-O2):
define double @calcHourAngleSunset(double %0, double %1) {
%3 = tail call double @degToRad(double %0)
%4 = tail call double @degToRad(double %1)
%5 = tail call double @degToRad(double 9.083300e+01)
%6 = tail call i32 @cos(double %5)
%7 = tail call i32 @cos(double %3)
%8 = tail call i32 @cos(double %4)
%9 = mul nsw i32 %8, %7
%10 = sdiv i32 %6, %9
%11 = tail call i32 @tan(double %3)
%12 = tail call i32 @tan(double %4)
%13 = mul nsw i32 %12, %11
%14 = sub nsw i32 %10, %13
%15 = tail call double @acos(i32 %14)
%16 = fneg double %15
ret double %16
}