void astro_sunRADec(double jd, double *RA, double *dec, double *r) {
  double lon, obl_ecl, x, y, z;
  astro_sunpos(jd, &lon, r);
  x = *r * cos((lon) * (3.1415926535897932384 / 180.0));
  y = *r * sin((lon) * (3.1415926535897932384 / 180.0));
  obl_ecl = 23.4393 - 3.563E-7 * ((jd)-2451544.0);
  z = y * sin((obl_ecl) * (3.1415926535897932384 / 180.0));
  y = y * cos((obl_ecl) * (3.1415926535897932384 / 180.0));
  *RA = ((180.0 / 3.1415926535897932384) * atan2(y, x));
  *dec = ((180.0 / 3.1415926535897932384) * atan2(z, sqrt(x * x + y * y)));
}


x86 assembly (clang, -O0):
<astro_sunRADec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdi
mov    $0x1,%al
call   1060 <astro_sunpos@plt>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xe76(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe46(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe36(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe1a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe16(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xdeb(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xdbe(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movsd  0xd81(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movsd  0xd32(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<astro_sunRADec>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
movsd  %xmm0,0x8(%rsp)
lea    0x20(%rsp),%rdi
mov    %rdx,%rsi
mov    $0x1,%al
call   1060 <astro_sunpos@plt>
movsd  (%rbx),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  0xe71(%rip),%xmm0
call   1050 <cos@plt>
mulsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  0xe48(%rip),%xmm0
call   1040 <sin@plt>
movapd %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
addsd  0xe39(%rip),%xmm0
mulsd  0xe39(%rip),%xmm0
mulsd  0x10(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
addsd  0xe2d(%rip),%xmm0
mulsd  0xe0d(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm1
call   1030 <atan2@plt>
mulsd  0xdec(%rip),%xmm0
movsd  %xmm0,(%r15)
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
jb     1268 <astro_sunRADec+0x118>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    1271 <astro_sunRADec+0x121>
call   1070 <sqrt@plt>
movapd %xmm0,%xmm1
movsd  0x28(%rsp),%xmm0
call   1030 <atan2@plt>
mulsd  0xd9c(%rip),%xmm0
movsd  %xmm0,(%r14)
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @astro_sunRADec(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
%12 = alloca double
%13 = alloca double
store double %0, double* %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%14 = load double, double* %5
%15 = load double*, double** %8
%16 = call i32 (double, double*, double*, ...) bitcast (i32 (...)* @astro_sunpos to i32 (double, double*, double*, ...)*)(double %14, double* %9, double* %15)
%17 = load double*, double** %8
%18 = load double, double* %17
%19 = load double, double* %9
%20 = fmul double %19, 0x3F91DF46A2529D39
%21 = call double @cos(double %20)
%22 = fmul double %18, %21
store double %22, double* %11
%23 = load double*, double** %8
%24 = load double, double* %23
%25 = load double, double* %9
%26 = fmul double %25, 0x3F91DF46A2529D39
%27 = call double @sin(double %26)
%28 = fmul double %24, %27
store double %28, double* %12
%29 = load double, double* %5
%30 = fsub double %29, 0x4142B42C00000000
%31 = call double @llvm.fmuladd.f64(double -3.563000e-07, double %30, double 2.343930e+01)
store double %31, double* %10
%32 = load double, double* %12
%33 = load double, double* %10
%34 = fmul double %33, 0x3F91DF46A2529D39
%35 = call double @sin(double %34)
%36 = fmul double %32, %35
store double %36, double* %13
%37 = load double, double* %12
%38 = load double, double* %10
%39 = fmul double %38, 0x3F91DF46A2529D39
%40 = call double @cos(double %39)
%41 = fmul double %37, %40
store double %41, double* %12
%42 = load double, double* %12
%43 = load double, double* %11
%44 = call double @atan2(double %42, double %43)
%45 = fmul double 0x404CA5DC1A63C1F8, %44
%46 = load double*, double** %6
store double %45, double* %46
%47 = load double, double* %13
%48 = load double, double* %11
%49 = load double, double* %11
%50 = load double, double* %12
%51 = load double, double* %12
%52 = fmul double %50, %51
%53 = call double @llvm.fmuladd.f64(double %48, double %49, double %52)
%54 = call double @sqrt(double %53)
%55 = call double @atan2(double %47, double %54)
%56 = fmul double 0x404CA5DC1A63C1F8, %55
%57 = load double*, double** %7
store double %56, double* %57
ret void
}

LLVM IR (-O2):
define void @astro_sunRADec(double %0, double* nocapture writeonly %1, double* nocapture writeonly %2, double* %3) {
%5 = alloca double
%6 = bitcast double* %5 to i8*
%7 = call i32 (double, double*, double*, ...) bitcast (i32 (...)* @astro_sunpos to i32 (double, double*, double*, ...)*)(double %0, double* %5, double* %3)
%8 = load double, double* %3
%9 = load double, double* %5
%10 = fmul double %9, 0x3F91DF46A2529D39
%11 = call double @cos(double %10)
%12 = fmul double %8, %11
%13 = load double, double* %3
%14 = load double, double* %5
%15 = fmul double %14, 0x3F91DF46A2529D39
%16 = call double @sin(double %15)
%17 = fmul double %13, %16
%18 = fadd double %0, 0xC142B42C00000000
%19 = call double @llvm.fmuladd.f64(double %18, double -3.563000e-07, double 2.343930e+01)
%20 = fmul double %19, 0x3F91DF46A2529D39
%21 = call double @sin(double %20)
%22 = fmul double %17, %21
%23 = call double @cos(double %20)
%24 = fmul double %17, %23
%25 = call double @atan2(double %24, double %12)
%26 = fmul double %25, 0x404CA5DC1A63C1F8
store double %26, double* %1
%27 = fmul double %24, %24
%28 = call double @llvm.fmuladd.f64(double %12, double %12, double %27)
%29 = call double @sqrt(double %28)
%30 = call double @atan2(double %22, double %29)
%31 = fmul double %30, 0x404CA5DC1A63C1F8
store double %31, double* %2
ret void
}