#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);
int atan(int);
double cos(double);
double sin(double);
void azimuth(double *azimuth, double solarAlt, double latitude,
             double declination, int time) {
  *azimuth = ((sin(solarAlt) * sin((latitude / 180.0) * (4 * atan(1)))) -
              sin(declination)) /
             (cos(solarAlt) * cos((latitude / 180.0) * (4 * atan(1))));
  *azimuth = acos(*azimuth);
  if (time <= 43200)
    *azimuth = -*azimuth;
}


x86 assembly (clang, -O0):
<azimuth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe86(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    $0x1,%edi
call   1050 <atan@plt>
movsd  -0x58(%rbp),%xmm0
shl    $0x2,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x50(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe02(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    $0x1,%edi
call   1050 <atan@plt>
movsd  -0x40(%rbp),%xmm0
shl    $0x2,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
call   1060 <cos@plt>
movsd  -0x38(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <acos@plt>
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
cmpl   $0xa8c0,-0x24(%rbp)
jg     128c <azimuth+0x14c>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<azimuth>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %esi,%ebp
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
call   1040 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
divsd  0xe8c(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
call   1050 <atan@plt>
shl    $0x2,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <sin@plt>
movsd  0x10(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x1,%edi
call   1050 <atan@plt>
shl    $0x2,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
call   1060 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <acos@plt>
cmp    $0xa8c1,%ebp
jge    1216 <azimuth+0xd6>
xorpd  0xdfa(%rip),%xmm0
movsd  %xmm0,(%rbx)
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @azimuth(double* %0, double %1, double %2, double %3, i32 %4) {
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i32
store double* %0, double** %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store i32 %4, i32* %10
%11 = load double, double* %7
%12 = call double @sin(double %11)
%13 = load double, double* %8
%14 = fdiv double %13, 1.800000e+02
%15 = call i32 @atan(i32 1)
%16 = mul nsw i32 4, %15
%17 = sitofp i32 %16 to double
%18 = fmul double %14, %17
%19 = call double @sin(double %18)
%20 = load double, double* %9
%21 = call double @sin(double %20)
%22 = fneg double %21
%23 = call double @llvm.fmuladd.f64(double %12, double %19, double %22)
%24 = load double, double* %7
%25 = call double @cos(double %24)
%26 = load double, double* %8
%27 = fdiv double %26, 1.800000e+02
%28 = call i32 @atan(i32 1)
%29 = mul nsw i32 4, %28
%30 = sitofp i32 %29 to double
%31 = fmul double %27, %30
%32 = call double @cos(double %31)
%33 = fmul double %25, %32
%34 = fdiv double %23, %33
%35 = load double*, double** %6
store double %34, double* %35
%36 = load double*, double** %6
%37 = load double, double* %36
%38 = call double @acos(double %37)
%39 = load double*, double** %6
store double %38, double* %39
%40 = load i32, i32* %10
%41 = icmp sle i32 %40, 43200
br i1 %41, label %42, label %47
42: ; preds = %5
%43 = load double*, double** %6
%44 = load double, double* %43
%45 = fneg double %44
%46 = load double*, double** %6
store double %45, double* %46
br label %47
47: ; preds = %42, %5
ret void
}

LLVM IR (-O2):
define void @azimuth(double* nocapture writeonly %0, double %1, double %2, double %3, i32 %4) {
%6 = tail call double @sin(double %1)
%7 = fdiv double %2, 1.800000e+02
%8 = tail call i32 @atan(i32 1)
%9 = shl nsw i32 %8, 2
%10 = sitofp i32 %9 to double
%11 = fmul double %7, %10
%12 = tail call double @sin(double %11)
%13 = tail call double @sin(double %3)
%14 = fneg double %13
%15 = tail call double @llvm.fmuladd.f64(double %6, double %12, double %14)
%16 = tail call double @cos(double %1)
%17 = tail call i32 @atan(i32 1)
%18 = shl nsw i32 %17, 2
%19 = sitofp i32 %18 to double
%20 = fmul double %7, %19
%21 = tail call double @cos(double %20)
%22 = fmul double %16, %21
%23 = fdiv double %15, %22
%24 = tail call double @acos(double %23)
%25 = icmp slt i32 %4, 43201
%26 = fneg double %24
%27 = select i1 %25, double %26, double %24
store double %27, double* %0
ret void
}