void sunpos(double d, double *lon, double *r) {
  double M, w, e, E, x, y, v;
  M = fmod(357.52911 + 0.985600281725 * d + -4.20718412047e-09 * d * d +
               1.03430001369e-12 * d * d * d,
           360.0);
  w = 282.9404 + 4.70935E-5 * d;
  e = 0.016709 - 1.151E-9 * d;
  E = M + e * (180.0 / 3.1415926535897932384) *
              sin((M) * (3.1415926535897932384 / 180.0)) *
              (1.0 + e * cos((M) * (3.1415926535897932384 / 180.0)));
  x = cos((E) * (3.1415926535897932384 / 180.0)) - e;
  y = sqrt(1.0 - e * e) * sin((E) * (3.1415926535897932384 / 180.0));
  *r = sqrt(x * x + y * y);
  v = ((180.0 / 3.1415926535897932384) * atan2(y, x));
  ;
  *lon = fmod(v + w, 360.0);
}


x86 assembly (clang, -O0):
<sunpos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xedb(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed7(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xebb(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe99(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe3a(%rip),%xmm1
call   1040 <fmod@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe53(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe4f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe21(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe1d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xde2(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xdd8(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xdab(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1060 <cos@plt>
movsd  -0x70(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm3,%xmm2
movsd  0xd8b(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xd6a(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
call   1060 <cos@plt>
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xd31(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  0xd13(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movsd  0xcad(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  0xc8a(%rip),%xmm1
call   1040 <fmod@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sunpos>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movapd %xmm0,%xmm2
movsd  %xmm0,(%rsp)
movsd  0xe92(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe8e(%rip),%xmm0
movsd  0xe8e(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe82(%rip),%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe72(%rip),%xmm1
call   1040 <fmod@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe67(%rip),%xmm2
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x18(%rsp)
mulsd  0xe60(%rip),%xmm1
addsd  0xe60(%rip),%xmm1
movsd  %xmm1,(%rsp)
movsd  0xe5b(%rip),%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
mulsd  0xe51(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
call   1050 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
call   1060 <cos@plt>
mulsd  (%rsp),%xmm0
addsd  0xe2a(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
mulsd  0xe0e(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1060 <cos@plt>
movsd  (%rsp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm1,%xmm1
movsd  0xdf0(%rip),%xmm2
subsd  %xmm1,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
movapd %xmm2,%xmm0
jb     1280 <sunpos+0x130>
sqrtsd %xmm0,%xmm0
jmp    1285 <sunpos+0x135>
call   1070 <sqrt@plt>
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
addsd  0xd98(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
movapd %xmm0,%xmm2
mulsd  (%rsp),%xmm2
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xd90(%rip),%xmm0
jb     12d8 <sunpos+0x188>
sqrtsd %xmm0,%xmm0
jmp    12e7 <sunpos+0x197>
movsd  %xmm2,(%rsp)
call   1070 <sqrt@plt>
movsd  (%rsp),%xmm2
movsd  %xmm0,(%rbx)
movapd %xmm2,%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <atan2@plt>
mulsd  0xd46(%rip),%xmm0
addsd  0x18(%rsp),%xmm0
movsd  0xd10(%rip),%xmm1
call   1040 <fmod@plt>
movsd  %xmm0,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @sunpos(double %0, double* %1, double* %2) {
%4 = alloca double
%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* %4
store double* %1, double** %5
store double* %2, double** %6
%14 = load double, double* %4
%15 = call double @llvm.fmuladd.f64(double 0x3FEF8A099A1DFE0C, double %14, double 0x407658773C0C1FC9)
%16 = load double, double* %4
%17 = fmul double 0xBE3211D90D6548F0, %16
%18 = load double, double* %4
%19 = call double @llvm.fmuladd.f64(double %17, double %18, double %15)
%20 = load double, double* %4
%21 = fmul double 0x3D723212BA5E19B0, %20
%22 = load double, double* %4
%23 = fmul double %21, %22
%24 = load double, double* %4
%25 = call double @llvm.fmuladd.f64(double %23, double %24, double %19)
%26 = call double @fmod(double %25, double 3.600000e+02)
store double %26, double* %7
%27 = load double, double* %4
%28 = call double @llvm.fmuladd.f64(double 4.709350e-05, double %27, double 0x4071AF0BE0DED289)
store double %28, double* %8
%29 = load double, double* %4
%30 = call double @llvm.fmuladd.f64(double -1.151000e-09, double %29, double 1.670900e-02)
store double %30, double* %9
%31 = load double, double* %7
%32 = load double, double* %9
%33 = fmul double %32, 0x404CA5DC1A63C1F8
%34 = load double, double* %7
%35 = fmul double %34, 0x3F91DF46A2529D39
%36 = call double @sin(double %35)
%37 = fmul double %33, %36
%38 = load double, double* %9
%39 = load double, double* %7
%40 = fmul double %39, 0x3F91DF46A2529D39
%41 = call double @cos(double %40)
%42 = call double @llvm.fmuladd.f64(double %38, double %41, double 1.000000e+00)
%43 = call double @llvm.fmuladd.f64(double %37, double %42, double %31)
store double %43, double* %10
%44 = load double, double* %10
%45 = fmul double %44, 0x3F91DF46A2529D39
%46 = call double @cos(double %45)
%47 = load double, double* %9
%48 = fsub double %46, %47
store double %48, double* %11
%49 = load double, double* %9
%50 = load double, double* %9
%51 = fneg double %49
%52 = call double @llvm.fmuladd.f64(double %51, double %50, double 1.000000e+00)
%53 = call double @sqrt(double %52)
%54 = load double, double* %10
%55 = fmul double %54, 0x3F91DF46A2529D39
%56 = call double @sin(double %55)
%57 = fmul double %53, %56
store double %57, double* %12
%58 = load double, double* %11
%59 = load double, double* %11
%60 = load double, double* %12
%61 = load double, double* %12
%62 = fmul double %60, %61
%63 = call double @llvm.fmuladd.f64(double %58, double %59, double %62)
%64 = call double @sqrt(double %63)
%65 = load double*, double** %6
store double %64, double* %65
%66 = load double, double* %12
%67 = load double, double* %11
%68 = call double @atan2(double %66, double %67)
%69 = fmul double 0x404CA5DC1A63C1F8, %68
store double %69, double* %13
%70 = load double, double* %13
%71 = load double, double* %8
%72 = fadd double %70, %71
%73 = call double @fmod(double %72, double 3.600000e+02)
%74 = load double*, double** %5
store double %73, double* %74
ret void
}

LLVM IR (-O2):
define void @sunpos(double %0, double* nocapture writeonly %1, double* nocapture writeonly %2) {
%4 = tail call double @llvm.fmuladd.f64(double %0, double 0x3FEF8A099A1DFE0C, double 0x407658773C0C1FC9)
%5 = fmul double %0, 0xBE3211D90D6548F0
%6 = tail call double @llvm.fmuladd.f64(double %5, double %0, double %4)
%7 = fmul double %0, 0x3D723212BA5E19B0
%8 = fmul double %7, %0
%9 = tail call double @llvm.fmuladd.f64(double %8, double %0, double %6)
%10 = tail call double @fmod(double %9, double 3.600000e+02)
%11 = tail call double @llvm.fmuladd.f64(double %0, double 4.709350e-05, double 0x4071AF0BE0DED289)
%12 = tail call double @llvm.fmuladd.f64(double %0, double -1.151000e-09, double 1.670900e-02)
%13 = fmul double %12, 0x404CA5DC1A63C1F8
%14 = fmul double %10, 0x3F91DF46A2529D39
%15 = tail call double @sin(double %14)
%16 = fmul double %13, %15
%17 = tail call double @cos(double %14)
%18 = tail call double @llvm.fmuladd.f64(double %12, double %17, double 1.000000e+00)
%19 = tail call double @llvm.fmuladd.f64(double %16, double %18, double %10)
%20 = fmul double %19, 0x3F91DF46A2529D39
%21 = tail call double @cos(double %20)
%22 = fsub double %21, %12
%23 = fneg double %12
%24 = tail call double @llvm.fmuladd.f64(double %23, double %12, double 1.000000e+00)
%25 = tail call double @sqrt(double %24)
%26 = tail call double @sin(double %20)
%27 = fmul double %25, %26
%28 = fmul double %27, %27
%29 = tail call double @llvm.fmuladd.f64(double %22, double %22, double %28)
%30 = tail call double @sqrt(double %29)
store double %30, double* %2
%31 = tail call double @atan2(double %27, double %22)
%32 = fmul double %31, 0x404CA5DC1A63C1F8
%33 = fadd double %11, %32
%34 = tail call double @fmod(double %33, double 3.600000e+02)
store double %34, double* %1
ret void
}