void sun_RA_dec(double d, double *RA, double *dec, double *r) {
  double lon, obl_ecl, x, y, z;
  sunpos(d, &lon, r);
  x = *r * cos((lon) * (3.1415926535897932384 / 180.0));
  y = *r * sin((lon) * (3.1415926535897932384 / 180.0));
  obl_ecl = 23.439291 - 3.563E-7 * d;
  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):
<sun_RA_dec>:
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   1070 <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  0xe26(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe22(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xdf7(%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  0xdca(%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  0xd8d(%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   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movsd  0xd3e(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sun_RA_dec>:
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   1070 <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
mulsd  0xe39(%rip),%xmm0
mulsd  0x10(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
addsd  0xe2d(%rip),%xmm0
mulsd  0xe15(%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     1260 <sun_RA_dec+0x110>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    1269 <sun_RA_dec+0x119>
call   1060 <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 @sun_RA_dec(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 (...)* @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 = call double @llvm.fmuladd.f64(double -3.563000e-07, double %29, double 0x403770755FFE6D59)
store double %30, double* %10
%31 = load double, double* %12
%32 = load double, double* %10
%33 = fmul double %32, 0x3F91DF46A2529D39
%34 = call double @sin(double %33)
%35 = fmul double %31, %34
store double %35, double* %13
%36 = load double, double* %12
%37 = load double, double* %10
%38 = fmul double %37, 0x3F91DF46A2529D39
%39 = call double @cos(double %38)
%40 = fmul double %36, %39
store double %40, double* %12
%41 = load double, double* %12
%42 = load double, double* %11
%43 = call double @atan2(double %41, double %42)
%44 = fmul double 0x404CA5DC1A63C1F8, %43
%45 = load double*, double** %6
store double %44, double* %45
%46 = load double, double* %13
%47 = load double, double* %11
%48 = load double, double* %11
%49 = load double, double* %12
%50 = load double, double* %12
%51 = fmul double %49, %50
%52 = call double @llvm.fmuladd.f64(double %47, double %48, double %51)
%53 = call double @sqrt(double %52)
%54 = call double @atan2(double %46, double %53)
%55 = fmul double 0x404CA5DC1A63C1F8, %54
%56 = load double*, double** %7
store double %55, double* %56
ret void
}

LLVM IR (-O2):
define void @sun_RA_dec(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 (...)* @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 = call double @llvm.fmuladd.f64(double %0, double -3.563000e-07, double 0x403770755FFE6D59)
%19 = fmul double %18, 0x3F91DF46A2529D39
%20 = call double @sin(double %19)
%21 = fmul double %17, %20
%22 = call double @cos(double %19)
%23 = fmul double %17, %22
%24 = call double @atan2(double %23, double %12)
%25 = fmul double %24, 0x404CA5DC1A63C1F8
store double %25, double* %1
%26 = fmul double %23, %23
%27 = call double @llvm.fmuladd.f64(double %12, double %12, double %26)
%28 = call double @sqrt(double %27)
%29 = call double @atan2(double %21, double %28)
%30 = fmul double %29, 0x404CA5DC1A63C1F8
store double %30, double* %2
ret void
}