#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 atan(int);
int /*<<< orphan*/ localHourAngle(double *, double, double, double,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double, ...);
int /*<<< orphan*/ solarAltitude(double *, double, double, double);
int /*<<< orphan*/ sunDeclination(double *, int);
int /*<<< orphan*/ timeDifference(double *, double, double);
int main() {
  double lat = 40.100178;
  double longi = -105.99758;
  double stdMer = -106.0;
  int day = 172;
  double time = 43200;
  double sunDec = 0.0;
  double timeDiff = 0.0;
  double localHrAng = 0.0;
  double solarAlt = 0.0;
  sunDeclination(&sunDec, day);
  timeDifference(&timeDiff, stdMer, longi);
  localHourAngle(&localHrAng, time, timeDiff, 0.0, 0);
  printf("vals are: %f, %f\n", sunDec, localHrAng);
  solarAltitude(&solarAlt, sunDec, lat * (4 * atan(1) / 180.0), localHrAng);
  printf("solar alt is: %f\n", solarAlt * 180 / (4 * atan(1)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xea9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe94(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe7f(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0xac,-0x24(%rbp)
movsd  0xe63(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x24(%rbp),%esi
lea    -0x38(%rbp),%rdi
call   1040 <sunDeclination@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    -0x40(%rbp),%rdi
call   1050 <timeDifference@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
lea    -0x48(%rbp),%rdi
xorps  %xmm2,%xmm2
xor    %esi,%esi
call   1080 <localHourAngle@plt>
movsd  -0x38(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
lea    0xe16(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    $0x1,%edi
call   1070 <atan@plt>
movsd  -0x68(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
shl    $0x2,%eax
cvtsi2sd %eax,%xmm2
movsd  0xdb0(%rip),%xmm3
divsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  -0x48(%rbp),%xmm2
lea    -0x50(%rbp),%rdi
call   1030 <solarAltitude@plt>
movsd  0xd92(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    $0x1,%edi
call   1070 <atan@plt>
movsd  -0x58(%rbp),%xmm0
shl    $0x2,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
lea    0xda1(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movq   $0x0,0x18(%rsp)
movq   $0x0,0x28(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
lea    0x18(%rsp),%rdi
mov    $0xac,%esi
call   1040 <sunDeclination@plt>
lea    0x28(%rsp),%rdi
movsd  0xe5c(%rip),%xmm0
movsd  0xe5c(%rip),%xmm1
call   1050 <timeDifference@plt>
movsd  0x28(%rsp),%xmm1
lea    0x10(%rsp),%rdi
movsd  0xe4c(%rip),%xmm0
xorps  %xmm2,%xmm2
xor    %esi,%esi
call   1080 <localHourAngle@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
lea    0xe47(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
mov    $0x1,%edi
call   1070 <atan@plt>
shl    $0x2,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0xe08(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
divsd  %xmm0,%xmm1
mulsd  0xdfe(%rip),%xmm1
movsd  0x10(%rsp),%xmm2
lea    0x20(%rsp),%rdi
movsd  0x30(%rsp),%xmm0
call   1030 <solarAltitude@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x1,%edi
call   1070 <atan@plt>
shl    $0x2,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x8(%rsp),%xmm0
divsd  %xmm1,%xmm0
lea    0xdcb(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"vals are: %f, %f\0A\00"
@.str.1 = [18 x i8] c"solar alt is: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 0, i32* %1
store double 0x40440CD2A1F8E3AC, double* %2
store double 0xC05A7FD859C8C932, double* %3
store double -1.060000e+02, double* %4
store i32 172, i32* %5
store double 4.320000e+04, double* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
store double 0.000000e+00, double* %10
%11 = load i32, i32* %5
%12 = call i32 @sunDeclination(double* %7, i32 %11)
%13 = load double, double* %4
%14 = load double, double* %3
%15 = call i32 @timeDifference(double* %8, double %13, double %14)
%16 = load double, double* %6
%17 = load double, double* %8
%18 = call i32 @localHourAngle(double* %9, double %16, double %17, double 0.000000e+00, i32 0)
%19 = load double, double* %7
%20 = load double, double* %9
%21 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double %19, double %20)
%22 = load double, double* %7
%23 = load double, double* %2
%24 = call i32 @atan(i32 1)
%25 = mul nsw i32 4, %24
%26 = sitofp i32 %25 to double
%27 = fdiv double %26, 1.800000e+02
%28 = fmul double %23, %27
%29 = load double, double* %9
%30 = call i32 @solarAltitude(double* %10, double %22, double %28, double %29)
%31 = load double, double* %10
%32 = fmul double %31, 1.800000e+02
%33 = call i32 @atan(i32 1)
%34 = mul nsw i32 4, %33
%35 = sitofp i32 %34 to double
%36 = fdiv double %32, %35
%37 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"vals are: %f, %f\0A\00"
@.str.1 = [18 x i8] c"solar alt is: %f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %1
%6 = bitcast double* %2 to i8*
store double 0.000000e+00, double* %2
%7 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%8 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %4
%9 = call i32 @sunDeclination(double* %1, i32 172)
%10 = call i32 @timeDifference(double* %2, double -1.060000e+02, double 0xC05A7FD859C8C932)
%11 = load double, double* %2
%12 = call i32 @localHourAngle(double* %3, double 4.320000e+04, double %11, double 0.000000e+00, i32 0)
%13 = load double, double* %1
%14 = load double, double* %3
%15 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double %13, double %14)
%16 = load double, double* %1
%17 = call i32 @atan(i32 1)
%18 = shl nsw i32 %17, 2
%19 = sitofp i32 %18 to double
%20 = fdiv double %19, 1.800000e+02
%21 = fmul double %20, 0x40440CD2A1F8E3AC
%22 = load double, double* %3
%23 = call i32 @solarAltitude(double* %4, double %16, double %21, double %22)
%24 = load double, double* %4
%25 = fmul double %24, 1.800000e+02
%26 = call i32 @atan(i32 1)
%27 = shl nsw i32 %26, 2
%28 = sitofp i32 %27 to double
%29 = fdiv double %25, %28
%30 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double %29)
ret i32 0
}