#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);
double cos(double);
double sin(double);
double parallacticLDA(double lt, double dec, double alt) {
  double ca = sin(lt);
  double cb = sin(dec);
  double sb = cos(dec);
  double cc = sin(alt);
  double sc = cos(alt);
  double cpa;
  if (sb == 0 || sc == 0)
    return (0);
  cpa = (ca - cb * cc) / (sb * sc);
  if (cpa < -1)
    cpa = -1;
  if (cpa > 1)
    cpa = 1;
  return (acos(cpa));
}


x86 assembly (clang, -O0):
<parallacticLDA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11af <parallacticLDA+0x7f>
jp     11af <parallacticLDA+0x7f>
jmp    11c7 <parallacticLDA+0x97>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11d4 <parallacticLDA+0xa4>
jp     11d4 <parallacticLDA+0xa4>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1268 <parallacticLDA+0x138>
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xde3(%rip),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    1235 <parallacticLDA+0x105>
movsd  0xdd0(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xdc6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1259 <parallacticLDA+0x129>
movsd  0xdb4(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parallacticLDA>:
sub    $0x28,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,(%rsp)
call   1040 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
movsd  (%rsp),%xmm3
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm3
jne    1196 <parallacticLDA+0x66>
jnp    11dd <parallacticLDA+0xad>
ucomisd %xmm1,%xmm0
jne    119e <parallacticLDA+0x6e>
jnp    11dd <parallacticLDA+0xad>
movsd  0x18(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm3
divsd  %xmm3,%xmm2
movsd  0xe3c(%rip),%xmm1
maxsd  %xmm2,%xmm1
movsd  0xe38(%rip),%xmm0
minsd  %xmm1,%xmm0
add    $0x28,%rsp
jmp    1030 <acos@plt>
xorpd  %xmm0,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @parallacticLDA(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 double
%12 = alloca double
%13 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%14 = load double, double* %5
%15 = call double @sin(double %14)
store double %15, double* %8
%16 = load double, double* %6
%17 = call double @sin(double %16)
store double %17, double* %9
%18 = load double, double* %6
%19 = call double @cos(double %18)
store double %19, double* %10
%20 = load double, double* %7
%21 = call double @sin(double %20)
store double %21, double* %11
%22 = load double, double* %7
%23 = call double @cos(double %22)
store double %23, double* %12
%24 = load double, double* %10
%25 = fcmp oeq double %24, 0.000000e+00
br i1 %25, label %29, label %26
26: ; preds = %3
%27 = load double, double* %12
%28 = fcmp oeq double %27, 0.000000e+00
br i1 %28, label %29, label %30
29: ; preds = %26, %3
store double 0.000000e+00, double* %4
br label %50
30: ; preds = %26
%31 = load double, double* %8
%32 = load double, double* %9
%33 = load double, double* %11
%34 = fneg double %32
%35 = call double @llvm.fmuladd.f64(double %34, double %33, double %31)
%36 = load double, double* %10
%37 = load double, double* %12
%38 = fmul double %36, %37
%39 = fdiv double %35, %38
store double %39, double* %13
%40 = load double, double* %13
%41 = fcmp olt double %40, -1.000000e+00
br i1 %41, label %42, label %43
42: ; preds = %30
store double -1.000000e+00, double* %13
br label %43
43: ; preds = %42, %30
%44 = load double, double* %13
%45 = fcmp ogt double %44, 1.000000e+00
br i1 %45, label %46, label %47
46: ; preds = %43
store double 1.000000e+00, double* %13
br label %47
47: ; preds = %46, %43
%48 = load double, double* %13
%49 = call double @acos(double %48)
store double %49, double* %4
br label %50
50: ; preds = %47, %29
%51 = load double, double* %4
ret double %51
}

LLVM IR (-O2):
define double @parallacticLDA(double %0, double %1, double %2) {
%4 = tail call double @sin(double %0)
%5 = tail call double @sin(double %1)
%6 = tail call double @cos(double %1)
%7 = tail call double @sin(double %2)
%8 = tail call double @cos(double %2)
%9 = fcmp oeq double %6, 0.000000e+00
%10 = fcmp oeq double %8, 0.000000e+00
%11 = select i1 %9, i1 true, i1 %10
br i1 %11, label %22, label %12
12: ; preds = %3
%13 = fneg double %5
%14 = tail call double @llvm.fmuladd.f64(double %13, double %7, double %4)
%15 = fmul double %6, %8
%16 = fdiv double %14, %15
%17 = fcmp olt double %16, -1.000000e+00
%18 = select i1 %17, double -1.000000e+00, double %16
%19 = fcmp ogt double %18, 1.000000e+00
%20 = select i1 %19, double 1.000000e+00, double %18
%21 = tail call double @acos(double %20)
br label %22
22: ; preds = %3, %12
%23 = phi double [ %21, %12 ], [ 0.000000e+00, %3 ]
ret double %23
}