#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 M_PI;
double arg(double, double);
double asin(double);
scalar_t__ pow(double, double);
double sqrt(scalar_t__);
void hcc2hpc(double x, double y, double z, double dsun_obs, double *tx,
             double *ty) {
  double d;
  d = sqrt(x * x + y * y + pow(dsun_obs - z, 2.0));
  *tx = 180.0 / M_PI * 3600.0 * arg(dsun_obs - z, x);
  *ty = 180.0 / M_PI * 3600.0 * asin(y / d);
  return;
}


x86 assembly (clang, -O0):
<hcc2hpc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  0xe79(%rip),%xmm1
call   1050 <pow@plt>
movsd  -0x50(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  0xe47(%rip),%xmm0
mov    0x2e20(%rip),%rax
divsd  (%rax),%xmm0
movsd  0xe2c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
call   1030 <arg@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xdfb(%rip),%xmm0
mov    0x2dd4(%rip),%rax
divsd  (%rax),%xmm0
movsd  0xde0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
call   1040 <asin@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hcc2hpc>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movsd  %xmm1,0x28(%rsp)
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
subsd  %xmm2,%xmm3
movsd  %xmm3,0x20(%rsp)
movsd  0xe81(%rip),%xmm1
movapd %xmm3,%xmm0
call   1050 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%rdi
call   1060 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x2e3b(%rip),%rbx
movsd  0xe53(%rip),%xmm0
divsd  (%rbx),%xmm0
mulsd  0xe4f(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <arg@plt>
mulsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%r15)
movsd  0xe1d(%rip),%xmm0
divsd  (%rbx),%xmm0
mulsd  0xe19(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x28(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
call   1040 <asin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define void @hcc2hpc(double %0, double %1, double %2, double %3, double* %4, double* %5) {
%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* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%14 = load double, double* %7
%15 = load double, double* %7
%16 = load double, double* %8
%17 = load double, double* %8
%18 = fmul double %16, %17
%19 = call double @llvm.fmuladd.f64(double %14, double %15, double %18)
%20 = load double, double* %10
%21 = load double, double* %9
%22 = fsub double %20, %21
%23 = call i64 @pow(double %22, double 2.000000e+00)
%24 = sitofp i64 %23 to double
%25 = fadd double %19, %24
%26 = fptosi double %25 to i64
%27 = call double @sqrt(i64 %26)
store double %27, double* %13
%28 = load double, double* @M_PI
%29 = fdiv double 1.800000e+02, %28
%30 = fmul double %29, 3.600000e+03
%31 = load double, double* %10
%32 = load double, double* %9
%33 = fsub double %31, %32
%34 = load double, double* %7
%35 = call double @arg(double %33, double %34)
%36 = fmul double %30, %35
%37 = load double*, double** %11
store double %36, double* %37
%38 = load double, double* @M_PI
%39 = fdiv double 1.800000e+02, %38
%40 = fmul double %39, 3.600000e+03
%41 = load double, double* %8
%42 = load double, double* %13
%43 = fdiv double %41, %42
%44 = call double @asin(double %43)
%45 = fmul double %40, %44
%46 = load double*, double** %12
store double %45, double* %46
ret void
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define void @hcc2hpc(double %0, double %1, double %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = fmul double %1, %1
%8 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %7)
%9 = fsub double %3, %2
%10 = tail call i64 @pow(double %9, double 2.000000e+00)
%11 = sitofp i64 %10 to double
%12 = fadd double %8, %11
%13 = fptosi double %12 to i64
%14 = tail call double @sqrt(i64 %13)
%15 = load double, double* @M_PI
%16 = fdiv double 1.800000e+02, %15
%17 = fmul double %16, 3.600000e+03
%18 = tail call double @arg(double %9, double %0)
%19 = fmul double %18, %17
store double %19, double* %4
%20 = load double, double* @M_PI
%21 = fdiv double 1.800000e+02, %20
%22 = fmul double %21, 3.600000e+03
%23 = fdiv double %1, %14
%24 = tail call double @asin(double %23)
%25 = fmul double %24, %22
store double %25, double* %5
ret void
}