#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 declination(int);
double fabs(double);
double sin(double);
int standard_time(int, int, double, double);
int zenith2time(int day, double zenith_angle, double latitude, double longitude,
                double long_std, int *time1, int *time2) {
  double delta = 3.1415926 / 180.0 * declination(day);
  double phi = 3.1415926 / 180.0 * latitude;
  double theta = 3.1415926 / 180.0 * zenith_angle;
  double cos_omega =
      (cos(theta) - sin(delta) * sin(phi)) / cos(delta) / cos(phi);
  double omega1 = 0, omega2 = 0;
  int lat1 = 0, lat2 = 0;
  if (fabs(cos_omega) > 1.0)
    return -1;
  omega1 = acos(cos_omega);
  omega2 = 0.0 - omega1;
  lat1 = 43200 * (1 - omega1 / 3.1415926);
  lat2 = 43200 * (1 - omega2 / 3.1415926);
  *time1 = standard_time(lat1, day, longitude, long_std);
  *time2 = standard_time(lat2, day, longitude, long_std);
  return 0;
}


x86 assembly (clang, -O0):
<zenith2time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
mov    %rdx,-0x38(%rbp)
mov    -0x8(%rbp),%edi
call   1070 <declination@plt>
movaps %xmm0,%xmm1
movsd  0xe7b(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe6a(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe58(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x90(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
movl   $0x0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movaps 0xda1(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xd75(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12a1 <zenith2time+0x151>
movl   $0xffffffff,-0x4(%rbp)
jmp    135e <zenith2time+0x20e>
movsd  -0x58(%rbp),%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xd4e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd2a(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xd2e(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x6c(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  0xd1e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xcfa(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xcfe(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x70(%rbp)
mov    -0x6c(%rbp),%edi
mov    -0x8(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1050 <standard_time@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x70(%rbp),%edi
mov    -0x8(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1050 <standard_time@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zenith2time>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
movsd  %xmm3,0x30(%rsp)
movsd  %xmm2,0x28(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %edi,%ebp
call   1070 <declination@plt>
movsd  0xe79(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  0x8(%rsp),%xmm1
mulsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  %xmm2,%xmm0
call   1060 <cos@plt>
movapd %xmm0,0x10(%rsp)
movsd  0x38(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x40(%rsp),%xmm0
movapd 0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movsd  0x38(%rsp),%xmm0
call   1060 <cos@plt>
movapd 0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <cos@plt>
movapd 0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd 0xe00(%rip),%xmm0
andpd  %xmm1,%xmm0
mov    $0xffffffff,%eax
ucomisd 0xdd7(%rip),%xmm0
ja     12b0 <zenith2time+0x160>
movapd %xmm1,%xmm0
call   1030 <acos@plt>
xorpd  %xmm1,%xmm1
subsd  %xmm0,%xmm1
movsd  0xdc4(%rip),%xmm2
divsd  %xmm2,%xmm0
movsd  0xdb0(%rip),%xmm3
movapd %xmm3,%xmm4
subsd  %xmm0,%xmm4
movsd  0xdb0(%rip),%xmm0
mulsd  %xmm0,%xmm4
cvttsd2si %xmm4,%edi
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm3
mulsd  %xmm0,%xmm3
cvttsd2si %xmm3,%ebx
mov    %ebp,%esi
movsd  0x28(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
call   1050 <standard_time@plt>
mov    %eax,(%r15)
mov    %ebx,%edi
mov    %ebp,%esi
movsd  0x28(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
call   1050 <standard_time@plt>
mov    %eax,(%r14)
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @zenith2time(i32 %0, double %1, double %2, double %3, double %4, i32* %5, i32* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca i32
%23 = alloca i32
store i32 %0, i32* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store i32* %5, i32** %14
store i32* %6, i32** %15
%24 = load i32, i32* %9
%25 = call double @declination(i32 %24)
%26 = fmul double 0x3F91DF469D353918, %25
store double %26, double* %16
%27 = load double, double* %11
%28 = fmul double 0x3F91DF469D353918, %27
store double %28, double* %17
%29 = load double, double* %10
%30 = fmul double 0x3F91DF469D353918, %29
store double %30, double* %18
%31 = load double, double* %18
%32 = call double @cos(double %31)
%33 = load double, double* %16
%34 = call double @sin(double %33)
%35 = load double, double* %17
%36 = call double @sin(double %35)
%37 = fneg double %34
%38 = call double @llvm.fmuladd.f64(double %37, double %36, double %32)
%39 = load double, double* %16
%40 = call double @cos(double %39)
%41 = fdiv double %38, %40
%42 = load double, double* %17
%43 = call double @cos(double %42)
%44 = fdiv double %41, %43
store double %44, double* %19
store double 0.000000e+00, double* %20
store double 0.000000e+00, double* %21
store i32 0, i32* %22
store i32 0, i32* %23
%45 = load double, double* %19
%46 = call double @llvm.fabs.f64(double %45)
%47 = fcmp ogt double %46, 1.000000e+00
br i1 %47, label %48, label %49
48: ; preds = %7
store i32 -1, i32* %8
br label %76
49: ; preds = %7
%50 = load double, double* %19
%51 = call double @acos(double %50)
store double %51, double* %20
%52 = load double, double* %20
%53 = fsub double 0.000000e+00, %52
store double %53, double* %21
%54 = load double, double* %20
%55 = fdiv double %54, 0x400921FB4D12D84A
%56 = fsub double 1.000000e+00, %55
%57 = fmul double 4.320000e+04, %56
%58 = fptosi double %57 to i32
store i32 %58, i32* %22
%59 = load double, double* %21
%60 = fdiv double %59, 0x400921FB4D12D84A
%61 = fsub double 1.000000e+00, %60
%62 = fmul double 4.320000e+04, %61
%63 = fptosi double %62 to i32
store i32 %63, i32* %23
%64 = load i32, i32* %22
%65 = load i32, i32* %9
%66 = load double, double* %12
%67 = load double, double* %13
%68 = call i32 @standard_time(i32 %64, i32 %65, double %66, double %67)
%69 = load i32*, i32** %14
store i32 %68, i32* %69
%70 = load i32, i32* %23
%71 = load i32, i32* %9
%72 = load double, double* %12
%73 = load double, double* %13
%74 = call i32 @standard_time(i32 %70, i32 %71, double %72, double %73)
%75 = load i32*, i32** %15
store i32 %74, i32* %75
store i32 0, i32* %8
br label %76
76: ; preds = %49, %48
%77 = load i32, i32* %8
ret i32 %77
}

LLVM IR (-O2):
define i32 @zenith2time(i32 %0, double %1, double %2, double %3, double %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6) {
%8 = tail call double @declination(i32 %0)
%9 = fmul double %8, 0x3F91DF469D353918
%10 = fmul double %2, 0x3F91DF469D353918
%11 = fmul double %1, 0x3F91DF469D353918
%12 = tail call double @cos(double %11)
%13 = tail call double @sin(double %9)
%14 = tail call double @sin(double %10)
%15 = fneg double %13
%16 = tail call double @llvm.fmuladd.f64(double %15, double %14, double %12)
%17 = tail call double @cos(double %9)
%18 = fdiv double %16, %17
%19 = tail call double @cos(double %10)
%20 = fdiv double %18, %19
%21 = tail call double @llvm.fabs.f64(double %20)
%22 = fcmp ogt double %21, 1.000000e+00
br i1 %22, label %36, label %23
23: ; preds = %7
%24 = tail call double @acos(double %20)
%25 = fsub double 0.000000e+00, %24
%26 = fdiv double %24, 0x400921FB4D12D84A
%27 = fsub double 1.000000e+00, %26
%28 = fmul double %27, 4.320000e+04
%29 = fptosi double %28 to i32
%30 = fdiv double %25, 0x400921FB4D12D84A
%31 = fsub double 1.000000e+00, %30
%32 = fmul double %31, 4.320000e+04
%33 = fptosi double %32 to i32
%34 = tail call i32 @standard_time(i32 %29, i32 %0, double %3, double %4)
store i32 %34, i32* %5
%35 = tail call i32 @standard_time(i32 %33, i32 %0, double %3, double %4)
store i32 %35, i32* %6
br label %36
36: ; preds = %7, %23
%37 = phi i32 [ 0, %23 ], [ -1, %7 ]
ret i32 %37
}