#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 /*<<< orphan*/ acos(double);
double cos(double);
double deg2rad(double);
int fabs(double);
double limit_degrees180(int /*<<< orphan*/);
int /*<<< orphan*/ rad2deg(int /*<<< orphan*/);
double sin(double);
double sun_hour_angle_at_rise_set(double latitude, double delta_zero,
                                  double h0_prime) {
  double h0 = -99999;
  double latitude_rad = deg2rad(latitude);
  double delta_zero_rad = deg2rad(delta_zero);
  double argument =
      (sin(deg2rad(h0_prime)) - sin(latitude_rad) * sin(delta_zero_rad)) /
      (cos(latitude_rad) * cos(delta_zero_rad));
  if (fabs(argument) <= 1)
    h0 = limit_degrees180(rad2deg(acos(argument)));
  return h0;
}


x86 assembly (clang, -O0):
<sun_hour_angle_at_rise_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xe71(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <deg2rad@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <deg2rad@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <deg2rad@plt>
call   1060 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1060 <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,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1080 <cos@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1080 <cos@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1050 <fabs@plt>
cmp    $0x1,%eax
jg     1273 <sun_hour_angle_at_rise_set+0x103>
movsd  -0x38(%rbp),%xmm0
call   1030 <acos@plt>
mov    %eax,%edi
call   1070 <rad2deg@plt>
mov    %eax,%edi
call   1090 <limit_degrees180@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sun_hour_angle_at_rise_set>:
sub    $0x28,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
call   1040 <deg2rad@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <deg2rad@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <deg2rad@plt>
call   1060 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <sin@plt>
mulsd  0x20(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1080 <cos@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
call   1080 <cos@plt>
mulsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
call   1050 <fabs@plt>
cmp    $0x1,%eax
jg     1241 <sun_hour_angle_at_rise_set+0xd1>
movsd  0x8(%rsp),%xmm0
call   1030 <acos@plt>
mov    %eax,%edi
call   1070 <rad2deg@plt>
mov    %eax,%edi
add    $0x28,%rsp
jmp    1090 <limit_degrees180@plt>
movsd  0xdb7(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @sun_hour_angle_at_rise_set(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
store double -9.999900e+04, double* %7
%11 = load double, double* %4
%12 = call double @deg2rad(double %11)
store double %12, double* %8
%13 = load double, double* %5
%14 = call double @deg2rad(double %13)
store double %14, double* %9
%15 = load double, double* %6
%16 = call double @deg2rad(double %15)
%17 = call double @sin(double %16)
%18 = load double, double* %8
%19 = call double @sin(double %18)
%20 = load double, double* %9
%21 = call double @sin(double %20)
%22 = fneg double %19
%23 = call double @llvm.fmuladd.f64(double %22, double %21, double %17)
%24 = load double, double* %8
%25 = call double @cos(double %24)
%26 = load double, double* %9
%27 = call double @cos(double %26)
%28 = fmul double %25, %27
%29 = fdiv double %23, %28
store double %29, double* %10
%30 = load double, double* %10
%31 = call i32 @fabs(double %30)
%32 = icmp sle i32 %31, 1
br i1 %32, label %33, label %38
33: ; preds = %3
%34 = load double, double* %10
%35 = call i32 @acos(double %34)
%36 = call i32 @rad2deg(i32 %35)
%37 = call double @limit_degrees180(i32 %36)
store double %37, double* %7
br label %38
38: ; preds = %33, %3
%39 = load double, double* %7
ret double %39
}

LLVM IR (-O2):
define double @sun_hour_angle_at_rise_set(double %0, double %1, double %2) {
%4 = tail call double @deg2rad(double %0)
%5 = tail call double @deg2rad(double %1)
%6 = tail call double @deg2rad(double %2)
%7 = tail call double @sin(double %6)
%8 = tail call double @sin(double %4)
%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 %4)
%13 = tail call double @cos(double %5)
%14 = fmul double %12, %13
%15 = fdiv double %11, %14
%16 = tail call i32 @fabs(double %15)
%17 = icmp slt i32 %16, 2
br i1 %17, label %18, label %22
18: ; preds = %3
%19 = tail call i32 @acos(double %15)
%20 = tail call i32 @rad2deg(i32 %19)
%21 = tail call double @limit_degrees180(i32 %20)
br label %22
22: ; preds = %18, %3
%23 = phi double [ %21, %18 ], [ -9.999900e+04, %3 ]
ret double %23
}