#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*/ EarthVel(double, double *);
int /*<<< orphan*/ Precess(double, double *);
double cos(double);
double sin(double);
double RadialVel(double ra_targ, double dec_targ, double mjd) {
  double ra, dec;
  double velocity[3];
  double target[3];
  double vel_r;
  int i;
  ra = ra_targ * (3.1415926535897932384626433 / 180.);
  dec = dec_targ * (3.1415926535897932384626433 / 180.);
  target[0] = cos(dec) * cos(ra);
  target[1] = cos(dec) * sin(ra);
  target[2] = sin(dec);
  Precess(mjd, target);
  EarthVel(mjd, velocity);
  vel_r = 0.;
  for (i = 0; i < 3; i++)
    vel_r += (velocity[i] * target[i]);
  return (-vel_r);
}


x86 assembly (clang, -O0):
<RadialVel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xe9e(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe8c(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    -0x60(%rbp),%rdi
call   1040 <Precess@plt>
movsd  -0x18(%rbp),%xmm0
lea    -0x40(%rbp),%rdi
call   1030 <EarthVel@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
cmpl   $0x3,-0x6c(%rbp)
jge    124a <RadialVel+0x10a>
movslq -0x6c(%rbp),%rax
movsd  -0x40(%rbp,%rax,8),%xmm0
movslq -0x6c(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    120c <RadialVel+0xcc>
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RadialVel>:
sub    $0x98,%rsp
movsd  %xmm2,0x18(%rsp)
movapd %xmm0,%xmm2
movsd  0xea7(%rip),%xmm0
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
call   1060 <cos@plt>
movapd %xmm0,0x80(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,0x70(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,0x60(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
movapd 0x80(%rsp),%xmm1
unpcklpd 0x60(%rsp),%xmm1
movapd 0x70(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm1,%xmm2
movapd %xmm2,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,0x30(%rsp)
lea    0x20(%rsp),%rdi
movsd  0x18(%rsp),%xmm0
call   1040 <Precess@plt>
lea    0x40(%rsp),%rdi
movsd  0x18(%rsp),%xmm0
call   1030 <EarthVel@plt>
movsd  0x40(%rsp),%xmm0
mulsd  0x20(%rsp),%xmm0
movsd  0x48(%rsp),%xmm1
xorpd  %xmm2,%xmm2
mulsd  0x28(%rsp),%xmm1
addsd  %xmm0,%xmm2
movsd  0x50(%rsp),%xmm0
mulsd  0x30(%rsp),%xmm0
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
xorpd  0xdda(%rip),%xmm0
add    $0x98,%rsp
ret

LLVM IR (-O0):
define double @RadialVel(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca [3 x double]
%10 = alloca [3 x double]
%11 = alloca double
%12 = alloca i32
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%13 = load double, double* %4
%14 = fmul double %13, 0x3F91DF46A2529D39
store double %14, double* %7
%15 = load double, double* %5
%16 = fmul double %15, 0x3F91DF46A2529D39
store double %16, double* %8
%17 = load double, double* %8
%18 = call double @cos(double %17)
%19 = load double, double* %7
%20 = call double @cos(double %19)
%21 = fmul double %18, %20
%22 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
store double %21, double* %22
%23 = load double, double* %8
%24 = call double @cos(double %23)
%25 = load double, double* %7
%26 = call double @sin(double %25)
%27 = fmul double %24, %26
%28 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 1
store double %27, double* %28
%29 = load double, double* %8
%30 = call double @sin(double %29)
%31 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 2
store double %30, double* %31
%32 = load double, double* %6
%33 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%34 = call i32 @Precess(double %32, double* %33)
%35 = load double, double* %6
%36 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%37 = call i32 @EarthVel(double %35, double* %36)
store double 0.000000e+00, double* %11
store i32 0, i32* %12
br label %38
38: ; preds = %52, %3
%39 = load i32, i32* %12
%40 = icmp slt i32 %39, 3
br i1 %40, label %41, label %55
41: ; preds = %38
%42 = load i32, i32* %12
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 %43
%45 = load double, double* %44
%46 = load i32, i32* %12
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 %47
%49 = load double, double* %48
%50 = load double, double* %11
%51 = call double @llvm.fmuladd.f64(double %45, double %49, double %50)
store double %51, double* %11
br label %52
52: ; preds = %41
%53 = load i32, i32* %12
%54 = add nsw i32 %53, 1
store i32 %54, i32* %12
br label %38
55: ; preds = %38
%56 = load double, double* %11
%57 = fneg double %56
ret double %57
}

LLVM IR (-O2):
define double @RadialVel(double %0, double %1, double %2) {
%4 = alloca [3 x double]
%5 = alloca [3 x double]
%6 = bitcast [3 x double]* %4 to i8*
%7 = bitcast [3 x double]* %5 to i8*
%8 = fmul double %0, 0x3F91DF46A2529D39
%9 = fmul double %1, 0x3F91DF46A2529D39
%10 = tail call double @cos(double %9)
%11 = tail call double @cos(double %8)
%12 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%13 = tail call double @cos(double %9)
%14 = tail call double @sin(double %8)
%15 = insertelement <2 x double> poison, double %10, i64 0
%16 = insertelement <2 x double> %15, double %13, i64 1
%17 = insertelement <2 x double> poison, double %11, i64 0
%18 = insertelement <2 x double> %17, double %14, i64 1
%19 = fmul <2 x double> %16, %18
%20 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
%21 = bitcast [3 x double]* %5 to <2 x double>*
store <2 x double> %19, <2 x double>* %21
%22 = tail call double @sin(double %9)
%23 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
store double %22, double* %23
%24 = call i32 @Precess(double %2, double* %12)
%25 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%26 = call i32 @EarthVel(double %2, double* %25)
%27 = load double, double* %25
%28 = load double, double* %12
%29 = call double @llvm.fmuladd.f64(double %27, double %28, double 0.000000e+00)
%30 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 1
%31 = load double, double* %30
%32 = load double, double* %20
%33 = call double @llvm.fmuladd.f64(double %31, double %32, double %29)
%34 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 2
%35 = load double, double* %34
%36 = load double, double* %23
%37 = call double @llvm.fmuladd.f64(double %35, double %36, double %33)
%38 = fneg double %37
ret double %38
}