#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 /*<<< orphan*/ asin(double);
int /*<<< orphan*/ atan2(double, double);
double cos(double);
double ephAngleRed(double);
double ephDegToRad(double);
double ephRadToDeg(int /*<<< orphan*/);
double sin(double);
double tan(double);
void ephAltAz(double lat, double ha, double delta, double *pAlt, double *pAz) {
  double n1;
  double d1;
  double a1;
  double a2;
  lat = ephDegToRad(lat);
  ha = ephDegToRad(ha);
  delta = ephDegToRad(delta);
  n1 = sin(ha);
  d1 = cos(ha) * sin(lat) - tan(delta) * cos(lat);
  a1 = sin(lat) * sin(delta);
  a2 = cos(lat) * cos(delta) * cos(ha);
  *pAlt = ephRadToDeg(asin(a1 + a2));
  *pAz = ephRadToDeg(atan2(n1, d1));
  *pAz = ephAngleRed(*pAz + 180);
  return;
}


x86 assembly (clang, -O0):
<ephAltAz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <ephDegToRad@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <ephDegToRad@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <ephDegToRad@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   10a0 <cos@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1090 <tan@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x8(%rbp),%xmm0
call   10a0 <cos@plt>
movsd  -0x78(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
call   10a0 <cos@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
call   10a0 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
call   10a0 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
call   1080 <asin@plt>
mov    %eax,%edi
call   1070 <ephRadToDeg@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
call   1040 <atan2@plt>
mov    %eax,%edi
call   1070 <ephRadToDeg@plt>
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0xcfa(%rip),%xmm0
addsd  (%rax),%xmm0
call   1050 <ephAngleRed@plt>
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ephAltAz>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x18(%rsp)
call   1030 <ephDegToRad@plt>
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <ephDegToRad@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <ephDegToRad@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x18(%rsp),%xmm0
call   10a0 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1090 <tan@plt>
movsd  %xmm0,0x28(%rsp)
movsd  (%rsp),%xmm0
call   10a0 <cos@plt>
mulsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   10a0 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   10a0 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   10a0 <cos@plt>
mulsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
call   1080 <asin@plt>
mov    %eax,%edi
call   1070 <ephRadToDeg@plt>
movsd  %xmm0,(%r14)
movsd  0x30(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1040 <atan2@plt>
mov    %eax,%edi
call   1070 <ephRadToDeg@plt>
movsd  %xmm0,(%rbx)
addsd  0xd3c(%rip),%xmm0
call   1050 <ephAngleRed@plt>
movsd  %xmm0,(%rbx)
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ephAltAz(double %0, double %1, double %2, double* %3, double* %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double*
%10 = alloca double*
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double* %3, double** %9
store double* %4, double** %10
%15 = load double, double* %6
%16 = call double @ephDegToRad(double %15)
store double %16, double* %6
%17 = load double, double* %7
%18 = call double @ephDegToRad(double %17)
store double %18, double* %7
%19 = load double, double* %8
%20 = call double @ephDegToRad(double %19)
store double %20, double* %8
%21 = load double, double* %7
%22 = call double @sin(double %21)
store double %22, double* %11
%23 = load double, double* %7
%24 = call double @cos(double %23)
%25 = load double, double* %6
%26 = call double @sin(double %25)
%27 = load double, double* %8
%28 = call double @tan(double %27)
%29 = load double, double* %6
%30 = call double @cos(double %29)
%31 = fmul double %28, %30
%32 = fneg double %31
%33 = call double @llvm.fmuladd.f64(double %24, double %26, double %32)
store double %33, double* %12
%34 = load double, double* %6
%35 = call double @sin(double %34)
%36 = load double, double* %8
%37 = call double @sin(double %36)
%38 = fmul double %35, %37
store double %38, double* %13
%39 = load double, double* %6
%40 = call double @cos(double %39)
%41 = load double, double* %8
%42 = call double @cos(double %41)
%43 = fmul double %40, %42
%44 = load double, double* %7
%45 = call double @cos(double %44)
%46 = fmul double %43, %45
store double %46, double* %14
%47 = load double, double* %13
%48 = load double, double* %14
%49 = fadd double %47, %48
%50 = call i32 @asin(double %49)
%51 = call double @ephRadToDeg(i32 %50)
%52 = load double*, double** %9
store double %51, double* %52
%53 = load double, double* %11
%54 = load double, double* %12
%55 = call i32 @atan2(double %53, double %54)
%56 = call double @ephRadToDeg(i32 %55)
%57 = load double*, double** %10
store double %56, double* %57
%58 = load double*, double** %10
%59 = load double, double* %58
%60 = fadd double %59, 1.800000e+02
%61 = call double @ephAngleRed(double %60)
%62 = load double*, double** %10
store double %61, double* %62
ret void
}

LLVM IR (-O2):
define void @ephAltAz(double %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4) {
%6 = tail call double @ephDegToRad(double %0)
%7 = tail call double @ephDegToRad(double %1)
%8 = tail call double @ephDegToRad(double %2)
%9 = tail call double @sin(double %7)
%10 = tail call double @cos(double %7)
%11 = tail call double @sin(double %6)
%12 = tail call double @tan(double %8)
%13 = tail call double @cos(double %6)
%14 = fneg double %12
%15 = fmul double %13, %14
%16 = tail call double @llvm.fmuladd.f64(double %10, double %11, double %15)
%17 = tail call double @sin(double %6)
%18 = tail call double @sin(double %8)
%19 = fmul double %17, %18
%20 = tail call double @cos(double %6)
%21 = tail call double @cos(double %8)
%22 = fmul double %20, %21
%23 = tail call double @cos(double %7)
%24 = fmul double %22, %23
%25 = fadd double %19, %24
%26 = tail call i32 @asin(double %25)
%27 = tail call double @ephRadToDeg(i32 %26)
store double %27, double* %3
%28 = tail call i32 @atan2(double %9, double %16)
%29 = tail call double @ephRadToDeg(i32 %28)
store double %29, double* %4
%30 = fadd double %29, 1.800000e+02
%31 = tail call double @ephAngleRed(double %30)
store double %31, double* %4
ret void
}