#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(double);
double cos(double);
double sin(double);
double HourAngle(double TopoAlt, double TopoDecl, double Lat) {
  double Alti = TopoAlt * (3.14159265358979323846 / 180.0);
  double decli = TopoDecl * (3.14159265358979323846 / 180.0);
  double Lati = Lat * (3.14159265358979323846 / 180.0);
  double ha = (sin(Alti) - sin(Lati) * sin(decli)) / cos(Lati) / cos(decli);
  if (ha < -1)
    ha = -1;
  if (ha > 1)
    ha = 1;
  return acos(ha) / (3.14159265358979323846 / 180.0) / 15.0;
}


x86 assembly (clang, -O0):
<HourAngle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xeb9(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xea7(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe95(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xdec(%rip),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    122c <HourAngle+0xfc>
movsd  0xdd9(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xdd7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1250 <HourAngle+0x120>
movsd  0xdc5(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <acos@plt>
movsd  0xda6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdaa(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HourAngle>:
sub    $0x28,%rsp
movsd  0xec4(%rip),%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm3,%xmm1
movsd  %xmm1,0x18(%rsp)
mulsd  %xmm3,%xmm2
movsd  %xmm2,0x10(%rsp)
call   1040 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x20(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
movsd  0x8(%rsp),%xmm2
divsd  %xmm0,%xmm2
movsd  0xe3f(%rip),%xmm1
maxsd  %xmm2,%xmm1
movsd  0xe3b(%rip),%xmm0
minsd  %xmm1,%xmm0
call   1030 <acos@plt>
divsd  0xe1a(%rip),%xmm0
divsd  0xe2a(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @HourAngle(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
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%11 = load double, double* %4
%12 = fmul double %11, 0x3F91DF46A2529D39
store double %12, double* %7
%13 = load double, double* %5
%14 = fmul double %13, 0x3F91DF46A2529D39
store double %14, double* %8
%15 = load double, double* %6
%16 = fmul double %15, 0x3F91DF46A2529D39
store double %16, double* %9
%17 = load double, double* %7
%18 = call double @sin(double %17)
%19 = load double, double* %9
%20 = call double @sin(double %19)
%21 = load double, double* %8
%22 = call double @sin(double %21)
%23 = fneg double %20
%24 = call double @llvm.fmuladd.f64(double %23, double %22, double %18)
%25 = load double, double* %9
%26 = call double @cos(double %25)
%27 = fdiv double %24, %26
%28 = load double, double* %8
%29 = call double @cos(double %28)
%30 = fdiv double %27, %29
store double %30, double* %10
%31 = load double, double* %10
%32 = fcmp olt double %31, -1.000000e+00
br i1 %32, label %33, label %34
33: ; preds = %3
store double -1.000000e+00, double* %10
br label %34
34: ; preds = %33, %3
%35 = load double, double* %10
%36 = fcmp ogt double %35, 1.000000e+00
br i1 %36, label %37, label %38
37: ; preds = %34
store double 1.000000e+00, double* %10
br label %38
38: ; preds = %37, %34
%39 = load double, double* %10
%40 = call double @acos(double %39)
%41 = fdiv double %40, 0x3F91DF46A2529D39
%42 = fdiv double %41, 1.500000e+01
ret double %42
}

LLVM IR (-O2):
define double @HourAngle(double %0, double %1, double %2) {
%4 = fmul double %0, 0x3F91DF46A2529D39
%5 = fmul double %1, 0x3F91DF46A2529D39
%6 = fmul double %2, 0x3F91DF46A2529D39
%7 = tail call double @sin(double %4)
%8 = tail call double @sin(double %6)
%9 = tail call double @sin(double %5)
%10 = fneg double %8
%11 = tail call double @llvm.fmuladd.f64(double %10, double %9, double %7)
%12 = tail call double @cos(double %6)
%13 = fdiv double %11, %12
%14 = tail call double @cos(double %5)
%15 = fdiv double %13, %14
%16 = fcmp olt double %15, -1.000000e+00
%17 = select i1 %16, double -1.000000e+00, double %15
%18 = fcmp ogt double %17, 1.000000e+00
%19 = select i1 %18, double 1.000000e+00, double %17
%20 = tail call double @acos(double %19)
%21 = fdiv double %20, 0x3F91DF46A2529D39
%22 = fdiv double %21, 1.500000e+01
ret double %22
}