void sun_RA_dec(double d, double *RA, double *dec, double *r) {
  double lon, obl_ecl;
  double xs, ys;
  double xe, ye, ze;
  sunpos(d, &lon, r);
  xs = *r * cos((lon) * (3.1415926535897932384 / 180.0));
  ys = *r * sin((lon) * (3.1415926535897932384 / 180.0));
  obl_ecl = 23.4393 - 3.563E-7 * d;
  xe = xs;
  ye = ys * cos((obl_ecl) * (3.1415926535897932384 / 180.0));
  ze = ys * sin((obl_ecl) * (3.1415926535897932384 / 180.0));
  *RA = ((180.0 / 3.1415926535897932384) * atan2(ye, xe));
  *dec = ((180.0 / 3.1415926535897932384) * atan2(ze, sqrt(xe * xe + ye * ye)));
}


x86 assembly (clang, -O0):
<sun_RA_dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%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,-0x80(%rbp)
movsd  0xe73(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xe43(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe23(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe1f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xdea(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xdbd(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movsd  0xd80(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movsd  0xd31(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x80,%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    0x28(%rsp),%rdi
mov    %rdx,%rsi
mov    $0x1,%al
call   1070 <sunpos@plt>
movsd  (%rbx),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x28(%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  0x28(%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   1050 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1030 <atan2@plt>
mulsd  0xde6(%rip),%xmm0
movsd  %xmm0,(%r15)
movsd  0x20(%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     1266 <sun_RA_dec+0x116>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    126f <sun_RA_dec+0x11f>
call   1060 <sqrt@plt>
movapd %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
call   1030 <atan2@plt>
mulsd  0xd96(%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
%14 = alloca double
%15 = alloca double
store double %0, double* %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%16 = load double, double* %5
%17 = load double*, double** %8
%18 = call i32 (double, double*, double*, ...) bitcast (i32 (...)* @sunpos to i32 (double, double*, double*, ...)*)(double %16, double* %9, double* %17)
%19 = load double*, double** %8
%20 = load double, double* %19
%21 = load double, double* %9
%22 = fmul double %21, 0x3F91DF46A2529D39
%23 = call double @cos(double %22)
%24 = fmul double %20, %23
store double %24, double* %11
%25 = load double*, double** %8
%26 = load double, double* %25
%27 = load double, double* %9
%28 = fmul double %27, 0x3F91DF46A2529D39
%29 = call double @sin(double %28)
%30 = fmul double %26, %29
store double %30, double* %12
%31 = load double, double* %5
%32 = call double @llvm.fmuladd.f64(double -3.563000e-07, double %31, double 2.343930e+01)
store double %32, double* %10
%33 = load double, double* %11
store double %33, double* %13
%34 = load double, double* %12
%35 = load double, double* %10
%36 = fmul double %35, 0x3F91DF46A2529D39
%37 = call double @cos(double %36)
%38 = fmul double %34, %37
store double %38, double* %14
%39 = load double, double* %12
%40 = load double, double* %10
%41 = fmul double %40, 0x3F91DF46A2529D39
%42 = call double @sin(double %41)
%43 = fmul double %39, %42
store double %43, double* %15
%44 = load double, double* %14
%45 = load double, double* %13
%46 = call double @atan2(double %44, double %45)
%47 = fmul double 0x404CA5DC1A63C1F8, %46
%48 = load double*, double** %6
store double %47, double* %48
%49 = load double, double* %15
%50 = load double, double* %13
%51 = load double, double* %13
%52 = load double, double* %14
%53 = load double, double* %14
%54 = fmul double %52, %53
%55 = call double @llvm.fmuladd.f64(double %50, double %51, double %54)
%56 = call double @sqrt(double %55)
%57 = call double @atan2(double %49, double %56)
%58 = fmul double 0x404CA5DC1A63C1F8, %57
%59 = load double*, double** %7
store double %58, double* %59
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 2.343930e+01)
%19 = fmul double %18, 0x3F91DF46A2529D39
%20 = call double @cos(double %19)
%21 = fmul double %17, %20
%22 = call double @sin(double %19)
%23 = fmul double %17, %22
%24 = call double @atan2(double %21, double %12)
%25 = fmul double %24, 0x404CA5DC1A63C1F8
store double %25, double* %1
%26 = fmul double %21, %21
%27 = call double @llvm.fmuladd.f64(double %12, double %12, double %26)
%28 = call double @sqrt(double %27)
%29 = call double @atan2(double %23, double %28)
%30 = fmul double %29, 0x404CA5DC1A63C1F8
store double %30, double* %2
ret void
}