#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 Map360(double);
double asin(int);
double atan2(int, int);
int cos(double);
int sin(double);
void EquatorialToHorizontal(double ha, double dec, double *az, double *alt) {
  double phi, altitude, azimuth;
  extern double SiteLatitude;
  ha = ha * 3.14159265358 / 12.;
  phi = SiteLatitude * 3.14159265358 / 180.;
  dec = dec * 3.14159265358 / 180.;
  altitude = asin(sin(phi) * sin(dec) + cos(phi) * cos(dec) * cos(ha));
  altitude = altitude * 180.0 / 3.14159265358;
  azimuth = atan2(-cos(dec) * sin(ha),
                  sin(dec) * cos(phi) - sin(phi) * cos(dec) * cos(ha));
  azimuth = azimuth * 180.0 / 3.14159265358;
  azimuth = Map360(azimuth);
  *alt = altitude;
  *az = azimuth;
}


x86 assembly (clang, -O0):
<EquatorialToHorizontal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  0xe8e(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe91(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe70(%rip),%xmm0
mov    0x2e49(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xe65(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe4c(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe47(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <sin@plt>
mov    %eax,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <sin@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1070 <cos@plt>
mov    %eax,-0x5c(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1070 <cos@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x54(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <cos@plt>
mov    -0x58(%rbp),%edi
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
imul   %ecx,%eax
add    %eax,%edi
call   1060 <asin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xdd1(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  0xdbc(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1070 <cos@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <sin@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <sin@plt>
mov    %eax,-0x4c(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1070 <cos@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x44(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <sin@plt>
mov    %eax,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1070 <cos@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x3c(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <cos@plt>
mov    -0x44(%rbp),%esi
mov    -0x40(%rbp),%edi
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
imul   %ecx,%eax
sub    %eax,%esi
call   1040 <atan2@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  0xd23(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xd0e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <Map360@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EquatorialToHorizontal>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  0xe9a(%rip),%xmm2
mulsd  %xmm2,%xmm0
divsd  0xe96(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    %rsi,%r15
mov    %rdi,%r14
mov    0x2e5b(%rip),%rax
movsd  (%rax),%xmm0
mulsd  %xmm2,%xmm0
movsd  0xe7b(%rip),%xmm3
divsd  %xmm3,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm2,%xmm1
divsd  %xmm3,%xmm1
movsd  %xmm1,0x8(%rsp)
call   1050 <sin@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
imul   %eax,%ebx
movsd  0x10(%rsp),%xmm0
call   1070 <cos@plt>
mov    %eax,%r12d
movsd  0x8(%rsp),%xmm0
call   1070 <cos@plt>
mov    %eax,%ebp
movsd  0x18(%rsp),%xmm0
call   1070 <cos@plt>
imul   %eax,%ebp
imul   %r12d,%ebp
add    %ebx,%ebp
mov    %ebp,%edi
call   1060 <asin@plt>
mulsd  0xe10(%rip),%xmm0
divsd  0xdf8(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1070 <cos@plt>
mov    %eax,%ebp
movsd  0x18(%rsp),%xmm0
call   1050 <sin@plt>
imul   %eax,%ebp
neg    %ebp
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
mov    %eax,%ebx
movsd  0x10(%rsp),%xmm0
call   1070 <cos@plt>
imul   %eax,%ebx
movsd  0x10(%rsp),%xmm0
call   1050 <sin@plt>
mov    %eax,%r12d
movsd  0x8(%rsp),%xmm0
call   1070 <cos@plt>
mov    %eax,%r13d
movsd  0x18(%rsp),%xmm0
call   1070 <cos@plt>
imul   %r13d,%eax
imul   %r12d,%eax
sub    %eax,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <atan2@plt>
mulsd  0xd88(%rip),%xmm0
divsd  0xd70(%rip),%xmm0
call   1030 <Map360@plt>
movsd  0x20(%rsp),%xmm1
movsd  %xmm1,(%r15)
movsd  %xmm0,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SiteLatitude = external global double
define void @EquatorialToHorizontal(double %0, double %1, double* %2, double* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %5
store double %1, double* %6
store double* %2, double** %7
store double* %3, double** %8
%12 = load double, double* %5
%13 = fmul double %12, 0x400921FB5443D6F4
%14 = fdiv double %13, 1.200000e+01
store double %14, double* %5
%15 = load double, double* @SiteLatitude
%16 = fmul double %15, 0x400921FB5443D6F4
%17 = fdiv double %16, 1.800000e+02
store double %17, double* %9
%18 = load double, double* %6
%19 = fmul double %18, 0x400921FB5443D6F4
%20 = fdiv double %19, 1.800000e+02
store double %20, double* %6
%21 = load double, double* %9
%22 = call i32 @sin(double %21)
%23 = load double, double* %6
%24 = call i32 @sin(double %23)
%25 = mul nsw i32 %22, %24
%26 = load double, double* %9
%27 = call i32 @cos(double %26)
%28 = load double, double* %6
%29 = call i32 @cos(double %28)
%30 = mul nsw i32 %27, %29
%31 = load double, double* %5
%32 = call i32 @cos(double %31)
%33 = mul nsw i32 %30, %32
%34 = add nsw i32 %25, %33
%35 = call double @asin(i32 %34)
store double %35, double* %10
%36 = load double, double* %10
%37 = fmul double %36, 1.800000e+02
%38 = fdiv double %37, 0x400921FB5443D6F4
store double %38, double* %10
%39 = load double, double* %6
%40 = call i32 @cos(double %39)
%41 = sub nsw i32 0, %40
%42 = load double, double* %5
%43 = call i32 @sin(double %42)
%44 = mul nsw i32 %41, %43
%45 = load double, double* %6
%46 = call i32 @sin(double %45)
%47 = load double, double* %9
%48 = call i32 @cos(double %47)
%49 = mul nsw i32 %46, %48
%50 = load double, double* %9
%51 = call i32 @sin(double %50)
%52 = load double, double* %6
%53 = call i32 @cos(double %52)
%54 = mul nsw i32 %51, %53
%55 = load double, double* %5
%56 = call i32 @cos(double %55)
%57 = mul nsw i32 %54, %56
%58 = sub nsw i32 %49, %57
%59 = call double @atan2(i32 %44, i32 %58)
store double %59, double* %11
%60 = load double, double* %11
%61 = fmul double %60, 1.800000e+02
%62 = fdiv double %61, 0x400921FB5443D6F4
store double %62, double* %11
%63 = load double, double* %11
%64 = call double @Map360(double %63)
store double %64, double* %11
%65 = load double, double* %10
%66 = load double*, double** %8
store double %65, double* %66
%67 = load double, double* %11
%68 = load double*, double** %7
store double %67, double* %68
ret void
}

LLVM IR (-O2):
@SiteLatitude = external global double
define void @EquatorialToHorizontal(double %0, double %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = fmul double %0, 0x400921FB5443D6F4
%6 = fdiv double %5, 1.200000e+01
%7 = load double, double* @SiteLatitude
%8 = fmul double %7, 0x400921FB5443D6F4
%9 = fdiv double %8, 1.800000e+02
%10 = fmul double %1, 0x400921FB5443D6F4
%11 = fdiv double %10, 1.800000e+02
%12 = tail call i32 @sin(double %9)
%13 = tail call i32 @sin(double %11)
%14 = mul nsw i32 %13, %12
%15 = tail call i32 @cos(double %9)
%16 = tail call i32 @cos(double %11)
%17 = mul nsw i32 %16, %15
%18 = tail call i32 @cos(double %6)
%19 = mul nsw i32 %17, %18
%20 = add nsw i32 %19, %14
%21 = tail call double @asin(i32 %20)
%22 = fmul double %21, 1.800000e+02
%23 = fdiv double %22, 0x400921FB5443D6F4
%24 = tail call i32 @cos(double %11)
%25 = tail call i32 @sin(double %6)
%26 = mul i32 %24, %25
%27 = sub i32 0, %26
%28 = tail call i32 @sin(double %11)
%29 = tail call i32 @cos(double %9)
%30 = mul nsw i32 %29, %28
%31 = tail call i32 @sin(double %9)
%32 = tail call i32 @cos(double %11)
%33 = mul nsw i32 %32, %31
%34 = tail call i32 @cos(double %6)
%35 = mul nsw i32 %33, %34
%36 = sub nsw i32 %30, %35
%37 = tail call double @atan2(i32 %27, i32 %36)
%38 = fmul double %37, 1.800000e+02
%39 = fdiv double %38, 0x400921FB5443D6F4
%40 = tail call double @Map360(double %39)
store double %23, double* %3
store double %40, double* %2
ret void
}