#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(float 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
movss  %xmm0,-0x4(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xe71(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%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     1277 <sun_hour_angle_at_rise_set+0x107>
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)
cvtss2sd %xmm0,%xmm0
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     1245 <sun_hour_angle_at_rise_set+0xd5>
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  0xdb3(%rip),%xmm0
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
define double @sun_hour_angle_at_rise_set(float %0, double %1, double %2) {
%4 = fpext float %0 to double
%5 = tail call double @deg2rad(double %4)
%6 = tail call double @deg2rad(double %1)
%7 = tail call double @deg2rad(double %2)
%8 = tail call double @sin(double %7)
%9 = tail call double @sin(double %5)
%10 = tail call double @sin(double %6)
%11 = fneg double %9
%12 = tail call double @llvm.fmuladd.f64(double %11, double %10, double %8)
%13 = tail call double @cos(double %5)
%14 = tail call double @cos(double %6)
%15 = fmul double %13, %14
%16 = fdiv double %12, %15
%17 = tail call i32 @fabs(double %16)
%18 = icmp slt i32 %17, 2
br i1 %18, label %19, label %23
19: ; preds = %3
%20 = tail call i32 @acos(double %16)
%21 = tail call i32 @rad2deg(i32 %20)
%22 = tail call double @limit_degrees180(i32 %21)
br label %23
23: ; preds = %19, %3
%24 = phi double [ %22, %19 ], [ -9.999900e+04, %3 ]
ret double %24
}