#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 Map12(double);
double Map180(double);
double Map360(double);
double asin(int);
double atan2(int, int);
int cos(double);
int sin(double);
void HorizontalToEquatorial(double az, double alt, double *ha, double *dec) {
  double phi, hourangle, declination;
  extern double SiteLatitude;
  alt = alt * 3.14159265358 / 180.;
  az = Map360(az);
  az = az * 3.14159265358 / 180.;
  phi = SiteLatitude * 3.14159265358 / 180.;
  hourangle = atan2(-sin(az) * cos(alt),
                    cos(phi) * sin(alt) - sin(phi) * cos(alt) * cos(az));
  declination = asin(sin(phi) * sin(alt) + cos(phi) * cos(alt) * cos(az));
  hourangle = Map12(hourangle * 12. / 3.14159265358);
  declination = Map180(declination * 180. / 3.14159265358);
  if (declination > 90.) {
    *ha = Map12(hourangle + 12.);
    *dec = 180. - declination;
  } else if (declination < -90.) {
    *ha = Map12(hourangle + 12.);
    *dec = declination + 180;
  } else {
    *ha = hourangle;
    *dec = declination;
  }
}


x86 assembly (clang, -O0):
<HorizontalToEquatorial>:
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  0xe76(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe71(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <Map360@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  0xe49(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe44(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe2b(%rip),%xmm0
mov    0x2dfc(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xe20(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <sin@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1090 <cos@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1090 <cos@plt>
mov    %eax,-0x5c(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <sin@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x54(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <sin@plt>
mov    %eax,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1090 <cos@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x4c(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1090 <cos@plt>
mov    -0x54(%rbp),%esi
mov    -0x50(%rbp),%edi
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
imul   %ecx,%eax
sub    %eax,%esi
call   1040 <atan2@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <sin@plt>
mov    %eax,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <sin@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1090 <cos@plt>
mov    %eax,-0x44(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1090 <cos@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x3c(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1090 <cos@plt>
mov    -0x40(%rbp),%edi
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
imul   %ecx,%eax
add    %eax,%edi
call   1060 <asin@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  0xd22(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  0xd05(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1070 <Map12@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xcf7(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xce2(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1080 <Map180@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xcbf(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    137f <HorizontalToEquatorial+0x20f>
movsd  0xcc5(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
call   1070 <Map12@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xca3(%rip),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    13e5 <HorizontalToEquatorial+0x275>
movsd  0xc99(%rip),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    13c6 <HorizontalToEquatorial+0x256>
movsd  0xc7e(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
call   1070 <Map12@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xc5c(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    13e0 <HorizontalToEquatorial+0x270>
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    13e5 <HorizontalToEquatorial+0x275>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HorizontalToEquatorial>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
mulsd  0xe74(%rip),%xmm1
divsd  0xe74(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
call   1030 <Map360@plt>
movsd  0xe59(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xe55(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
mov    0x2e1c(%rip),%rax
movsd  (%rax),%xmm3
mulsd  %xmm2,%xmm3
divsd  %xmm1,%xmm3
movsd  %xmm3,0x10(%rsp)
call   1050 <sin@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
call   1090 <cos@plt>
imul   %eax,%ebp
neg    %ebp
movsd  0x10(%rsp),%xmm0
call   1090 <cos@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
imul   %eax,%ebx
movsd  0x10(%rsp),%xmm0
call   1050 <sin@plt>
mov    %eax,%r12d
movsd  0x8(%rsp),%xmm0
call   1090 <cos@plt>
mov    %eax,%r13d
movsd  0x18(%rsp),%xmm0
call   1090 <cos@plt>
imul   %r13d,%eax
imul   %r12d,%eax
sub    %eax,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <atan2@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <sin@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
imul   %eax,%ebx
movsd  0x10(%rsp),%xmm0
call   1090 <cos@plt>
mov    %eax,%r12d
movsd  0x8(%rsp),%xmm0
call   1090 <cos@plt>
mov    %eax,%ebp
movsd  0x18(%rsp),%xmm0
call   1090 <cos@plt>
imul   %eax,%ebp
imul   %r12d,%ebp
add    %ebx,%ebp
mov    %ebp,%edi
call   1060 <asin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  0xd63(%rip),%xmm0
divsd  0xd4b(%rip),%xmm0
call   1070 <Map12@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xd3a(%rip),%xmm0
divsd  0xd2a(%rip),%xmm0
call   1080 <Map180@plt>
movapd %xmm0,%xmm1
ucomisd 0xd31(%rip),%xmm0
jbe    1317 <HorizontalToEquatorial+0x1a7>
movsd  0x8(%rsp),%xmm0
addsd  0xd19(%rip),%xmm0
movsd  %xmm1,0x8(%rsp)
call   1070 <Map12@plt>
movsd  %xmm0,(%r15)
movsd  0xcf9(%rip),%xmm0
subsd  0x8(%rsp),%xmm0
jmp    1360 <HorizontalToEquatorial+0x1f0>
movsd  0x8(%rsp),%xmm2
movsd  0xcfb(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1357 <HorizontalToEquatorial+0x1e7>
movapd %xmm2,%xmm0
addsd  0xcd9(%rip),%xmm0
movsd  %xmm1,0x8(%rsp)
call   1070 <Map12@plt>
movsd  %xmm0,(%r15)
movsd  0x8(%rsp),%xmm0
addsd  0xcb3(%rip),%xmm0
jmp    1360 <HorizontalToEquatorial+0x1f0>
movsd  %xmm2,(%r15)
movapd %xmm1,%xmm0
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 @HorizontalToEquatorial(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* %6
%13 = fmul double %12, 0x400921FB5443D6F4
%14 = fdiv double %13, 1.800000e+02
store double %14, double* %6
%15 = load double, double* %5
%16 = call double @Map360(double %15)
store double %16, double* %5
%17 = load double, double* %5
%18 = fmul double %17, 0x400921FB5443D6F4
%19 = fdiv double %18, 1.800000e+02
store double %19, double* %5
%20 = load double, double* @SiteLatitude
%21 = fmul double %20, 0x400921FB5443D6F4
%22 = fdiv double %21, 1.800000e+02
store double %22, double* %9
%23 = load double, double* %5
%24 = call i32 @sin(double %23)
%25 = sub nsw i32 0, %24
%26 = load double, double* %6
%27 = call i32 @cos(double %26)
%28 = mul nsw i32 %25, %27
%29 = load double, double* %9
%30 = call i32 @cos(double %29)
%31 = load double, double* %6
%32 = call i32 @sin(double %31)
%33 = mul nsw i32 %30, %32
%34 = load double, double* %9
%35 = call i32 @sin(double %34)
%36 = load double, double* %6
%37 = call i32 @cos(double %36)
%38 = mul nsw i32 %35, %37
%39 = load double, double* %5
%40 = call i32 @cos(double %39)
%41 = mul nsw i32 %38, %40
%42 = sub nsw i32 %33, %41
%43 = call double @atan2(i32 %28, i32 %42)
store double %43, double* %10
%44 = load double, double* %9
%45 = call i32 @sin(double %44)
%46 = load double, double* %6
%47 = call i32 @sin(double %46)
%48 = mul nsw i32 %45, %47
%49 = load double, double* %9
%50 = call i32 @cos(double %49)
%51 = load double, double* %6
%52 = call i32 @cos(double %51)
%53 = mul nsw i32 %50, %52
%54 = load double, double* %5
%55 = call i32 @cos(double %54)
%56 = mul nsw i32 %53, %55
%57 = add nsw i32 %48, %56
%58 = call double @asin(i32 %57)
store double %58, double* %11
%59 = load double, double* %10
%60 = fmul double %59, 1.200000e+01
%61 = fdiv double %60, 0x400921FB5443D6F4
%62 = call double @Map12(double %61)
store double %62, double* %10
%63 = load double, double* %11
%64 = fmul double %63, 1.800000e+02
%65 = fdiv double %64, 0x400921FB5443D6F4
%66 = call double @Map180(double %65)
store double %66, double* %11
%67 = load double, double* %11
%68 = fcmp ogt double %67, 9.000000e+01
br i1 %68, label %69, label %77
69: ; preds = %4
%70 = load double, double* %10
%71 = fadd double %70, 1.200000e+01
%72 = call double @Map12(double %71)
%73 = load double*, double** %7
store double %72, double* %73
%74 = load double, double* %11
%75 = fsub double 1.800000e+02, %74
%76 = load double*, double** %8
store double %75, double* %76
br label %94
77: ; preds = %4
%78 = load double, double* %11
%79 = fcmp olt double %78, -9.000000e+01
br i1 %79, label %80, label %88
80: ; preds = %77
%81 = load double, double* %10
%82 = fadd double %81, 1.200000e+01
%83 = call double @Map12(double %82)
%84 = load double*, double** %7
store double %83, double* %84
%85 = load double, double* %11
%86 = fadd double %85, 1.800000e+02
%87 = load double*, double** %8
store double %86, double* %87
br label %93
88: ; preds = %77
%89 = load double, double* %10
%90 = load double*, double** %7
store double %89, double* %90
%91 = load double, double* %11
%92 = load double*, double** %8
store double %91, double* %92
br label %93
93: ; preds = %88, %80
br label %94
94: ; preds = %93, %69
ret void
}

LLVM IR (-O2):
@SiteLatitude = external global double
define void @HorizontalToEquatorial(double %0, double %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = fmul double %1, 0x400921FB5443D6F4
%6 = fdiv double %5, 1.800000e+02
%7 = tail call double @Map360(double %0)
%8 = fmul double %7, 0x400921FB5443D6F4
%9 = fdiv double %8, 1.800000e+02
%10 = load double, double* @SiteLatitude
%11 = fmul double %10, 0x400921FB5443D6F4
%12 = fdiv double %11, 1.800000e+02
%13 = tail call i32 @sin(double %9)
%14 = tail call i32 @cos(double %6)
%15 = mul i32 %13, %14
%16 = sub i32 0, %15
%17 = tail call i32 @cos(double %12)
%18 = tail call i32 @sin(double %6)
%19 = mul nsw i32 %18, %17
%20 = tail call i32 @sin(double %12)
%21 = tail call i32 @cos(double %6)
%22 = mul nsw i32 %21, %20
%23 = tail call i32 @cos(double %9)
%24 = mul nsw i32 %22, %23
%25 = sub nsw i32 %19, %24
%26 = tail call double @atan2(i32 %16, i32 %25)
%27 = tail call i32 @sin(double %12)
%28 = tail call i32 @sin(double %6)
%29 = mul nsw i32 %28, %27
%30 = tail call i32 @cos(double %12)
%31 = tail call i32 @cos(double %6)
%32 = mul nsw i32 %31, %30
%33 = tail call i32 @cos(double %9)
%34 = mul nsw i32 %32, %33
%35 = add nsw i32 %34, %29
%36 = tail call double @asin(i32 %35)
%37 = fmul double %26, 1.200000e+01
%38 = fdiv double %37, 0x400921FB5443D6F4
%39 = tail call double @Map12(double %38)
%40 = fmul double %36, 1.800000e+02
%41 = fdiv double %40, 0x400921FB5443D6F4
%42 = tail call double @Map180(double %41)
%43 = fcmp ogt double %42, 9.000000e+01
br i1 %43, label %44, label %48
44: ; preds = %4
%45 = fadd double %39, 1.200000e+01
%46 = tail call double @Map12(double %45)
store double %46, double* %2
%47 = fsub double 1.800000e+02, %42
br label %55
48: ; preds = %4
%49 = fcmp olt double %42, -9.000000e+01
br i1 %49, label %50, label %54
50: ; preds = %48
%51 = fadd double %39, 1.200000e+01
%52 = tail call double @Map12(double %51)
store double %52, double* %2
%53 = fadd double %42, 1.800000e+02
br label %55
54: ; preds = %48
store double %39, double* %2
br label %55
55: ; preds = %50, %54, %44
%56 = phi double [ %53, %50 ], [ %42, %54 ], [ %47, %44 ]
store double %56, double* %3
ret void
}