#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_yday;
};

/* Variables and functions */
double M_PI;
double acos(int);
double asin(int);
int /*<<< orphan*/ get_time();
int /*<<< orphan*/ gmtime_r(int /*<<< orphan*/ *, struct tm *);
int sin(double);
int tan(double);
void sunup(double DEST_Lat, double *sunrise, double *sundown) {
  double lat;
  double sun_lat;
  double total_days;
  double sunshine;
  lat = DEST_Lat / (180.0 / M_PI);
  time_t now = get_time();
  struct tm time_tm;
  gmtime_r(&now, &time_tm);
  total_days = time_tm.tm_yday + 10;
  if (total_days >= 365.25)
    total_days -= 365.25;
  if (total_days <= 0.0)
    total_days += 365.25;
  sun_lat = asin(sin(23.439 / (180.0 / M_PI)) *
                 sin(((total_days - 90.086) / 365.25) * 360 / (180.0 / M_PI))) *
            (180.0 / M_PI);
  sunshine = (24.0 / 180.0) * (180.0 / M_PI) *
             acos(-tan(lat) * tan(sun_lat / (180.0 / M_PI)));
  *sunrise = 12.0 - sunshine / 2;
  *sundown = 12.0 + sunshine / 2;
}


x86 assembly (clang, -O0):
<sunup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe86(%rip),%xmm1
mov    0x2e5f(%rip),%rax
divsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1050 <get_time@plt>
mov    %eax,-0x3c(%rbp)
lea    -0x3c(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <gmtime_r@plt>
mov    -0x40(%rbp),%eax
add    $0xa,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe37(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11e9 <sunup+0x89>
movsd  -0x30(%rbp),%xmm0
movsd  0xe20(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x30(%rbp),%xmm0
jb     1209 <sunup+0xa9>
movsd  0xe01(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xdf7(%rip),%xmm1
mov    0x2dd0(%rip),%rax
divsd  (%rax),%xmm1
movsd  0xe14(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
mov    %eax,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xdf3(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xdb7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdd3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xda7(%rip),%xmm1
mov    0x2d80(%rip),%rax
divsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
mov    -0x50(%rbp),%edi
imul   %eax,%edi
call   1070 <asin@plt>
movsd  0xd80(%rip),%xmm1
mov    0x2d59(%rip),%rax
divsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xd64(%rip),%xmm1
mov    0x2d3d(%rip),%rax
divsd  (%rax),%xmm1
movsd  0xd69(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1080 <tan@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x4c(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xd28(%rip),%xmm1
mov    0x2d01(%rip),%rax
divsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
call   1080 <tan@plt>
mov    -0x4c(%rbp),%edi
imul   %eax,%edi
call   1040 <acos@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  0xcfb(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xce7(%rip),%xmm0
subsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm1
movsd  0xcd6(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xcc2(%rip),%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sunup>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movsd  %xmm0,0x10(%rsp)
mov    0x2e6b(%rip),%rbx
movsd  0xe7b(%rip),%xmm0
divsd  (%rbx),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1050 <get_time@plt>
mov    %eax,0x1c(%rsp)
lea    0x1c(%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1030 <gmtime_r@plt>
mov    0x18(%rsp),%eax
lea    0xa(%rax),%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
cmp    $0x164,%eax
jl     11c6 <sunup+0x66>
addsd  0xe42(%rip),%xmm0
movapd %xmm0,%xmm1
addsd  0xe3e(%rip),%xmm1
xorpd  %xmm2,%xmm2
movapd %xmm0,%xmm3
cmpnlesd %xmm2,%xmm3
andpd  %xmm3,%xmm0
andnpd %xmm1,%xmm3
orpd   %xmm0,%xmm3
movapd %xmm3,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xdf5(%rip),%xmm1
divsd  (%rbx),%xmm1
movsd  0xe01(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
movapd 0x20(%rsp),%xmm1
addsd  0xdf2(%rip),%xmm1
divsd  0xdda(%rip),%xmm1
mulsd  0xdea(%rip),%xmm1
mov    %eax,%ebp
movsd  0xdb8(%rip),%xmm0
divsd  (%rbx),%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1060 <sin@plt>
imul   %eax,%ebp
mov    %ebp,%edi
call   1070 <asin@plt>
movsd  0xd95(%rip),%xmm1
divsd  (%rbx),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
mulsd  0xdaf(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1080 <tan@plt>
mov    %eax,%ebp
movsd  0xd64(%rip),%xmm1
divsd  (%rbx),%xmm1
movsd  0x20(%rsp),%xmm0
divsd  %xmm1,%xmm0
call   1080 <tan@plt>
imul   %eax,%ebp
neg    %ebp
mov    %ebp,%edi
call   1040 <acos@plt>
mulsd  0x8(%rsp),%xmm0
mulsd  0xd6f(%rip),%xmm0
movsd  0xd6f(%rip),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,(%r15)
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@M_PI = global double 0.000000e+00
define void @sunup(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
%11 = alloca i32
%12 = alloca %struct.tm
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
%13 = load double, double* %4
%14 = load double, double* @M_PI
%15 = fdiv double 1.800000e+02, %14
%16 = fdiv double %13, %15
store double %16, double* %7
%17 = call i32 (...) @get_time()
store i32 %17, i32* %11
%18 = call i32 @gmtime_r(i32* %11, %struct.tm* %12)
%19 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 0
%20 = load i32, i32* %19
%21 = add nsw i32 %20, 10
%22 = sitofp i32 %21 to double
store double %22, double* %9
%23 = load double, double* %9
%24 = fcmp oge double %23, 3.652500e+02
br i1 %24, label %25, label %28
25: ; preds = %3
%26 = load double, double* %9
%27 = fsub double %26, 3.652500e+02
store double %27, double* %9
br label %28
28: ; preds = %25, %3
%29 = load double, double* %9
%30 = fcmp ole double %29, 0.000000e+00
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load double, double* %9
%33 = fadd double %32, 3.652500e+02
store double %33, double* %9
br label %34
34: ; preds = %31, %28
%35 = load double, double* @M_PI
%36 = fdiv double 1.800000e+02, %35
%37 = fdiv double 2.343900e+01, %36
%38 = call i32 @sin(double %37)
%39 = load double, double* %9
%40 = fsub double %39, 0x405685810624DD2F
%41 = fdiv double %40, 3.652500e+02
%42 = fmul double %41, 3.600000e+02
%43 = load double, double* @M_PI
%44 = fdiv double 1.800000e+02, %43
%45 = fdiv double %42, %44
%46 = call i32 @sin(double %45)
%47 = mul nsw i32 %38, %46
%48 = call double @asin(i32 %47)
%49 = load double, double* @M_PI
%50 = fdiv double 1.800000e+02, %49
%51 = fmul double %48, %50
store double %51, double* %8
%52 = load double, double* @M_PI
%53 = fdiv double 1.800000e+02, %52
%54 = fmul double 0x3FC1111111111111, %53
%55 = load double, double* %7
%56 = call i32 @tan(double %55)
%57 = sub nsw i32 0, %56
%58 = load double, double* %8
%59 = load double, double* @M_PI
%60 = fdiv double 1.800000e+02, %59
%61 = fdiv double %58, %60
%62 = call i32 @tan(double %61)
%63 = mul nsw i32 %57, %62
%64 = call double @acos(i32 %63)
%65 = fmul double %54, %64
store double %65, double* %10
%66 = load double, double* %10
%67 = fdiv double %66, 2.000000e+00
%68 = fsub double 1.200000e+01, %67
%69 = load double*, double** %5
store double %68, double* %69
%70 = load double, double* %10
%71 = fdiv double %70, 2.000000e+00
%72 = fadd double 1.200000e+01, %71
%73 = load double*, double** %6
store double %72, double* %73
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@M_PI = global double 0.000000e+00
define void @sunup(double %0, double* nocapture writeonly %1, double* nocapture writeonly %2) {
%4 = alloca i32
%5 = alloca %struct.tm
%6 = load double, double* @M_PI
%7 = bitcast i32* %4 to i8*
%8 = tail call i32 (...) @get_time()
store i32 %8, i32* %4
%9 = bitcast %struct.tm* %5 to i8*
%10 = call i32 @gmtime_r(i32* %4, %struct.tm* %5)
%11 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 0
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 10
%14 = sitofp i32 %13 to double
%15 = icmp sgt i32 %12, 355
%16 = fadd double %14, -3.652500e+02
%17 = select i1 %15, double %16, double %14
%18 = fcmp ugt double %17, 0.000000e+00
%19 = fadd double %17, 3.652500e+02
%20 = select i1 %18, double %17, double %19
%21 = fdiv double 1.800000e+02, %6
%22 = fdiv double %0, %21
%23 = load double, double* @M_PI
%24 = fdiv double 1.800000e+02, %23
%25 = fdiv double 2.343900e+01, %24
%26 = call i32 @sin(double %25)
%27 = fadd double %20, 0xC05685810624DD2F
%28 = fdiv double %27, 3.652500e+02
%29 = fmul double %28, 3.600000e+02
%30 = load double, double* @M_PI
%31 = fdiv double 1.800000e+02, %30
%32 = fdiv double %29, %31
%33 = call i32 @sin(double %32)
%34 = mul nsw i32 %33, %26
%35 = call double @asin(i32 %34)
%36 = load double, double* @M_PI
%37 = fdiv double 1.800000e+02, %36
%38 = fmul double %35, %37
%39 = fmul double %37, 0x3FC1111111111111
%40 = call i32 @tan(double %22)
%41 = load double, double* @M_PI
%42 = fdiv double 1.800000e+02, %41
%43 = fdiv double %38, %42
%44 = call i32 @tan(double %43)
%45 = mul i32 %40, %44
%46 = sub i32 0, %45
%47 = call double @acos(i32 %46)
%48 = fmul double %39, %47
%49 = fmul double %48, 5.000000e-01
%50 = fsub double 1.200000e+01, %49
store double %50, double* %1
%51 = fadd double %49, 1.200000e+01
store double %51, double* %2
ret void
}