void sunpos(double d, double *lon, double *r) {
  double M, w, e, E, x, y, v;
  M = revolution(356.0470 + 0.9856002585 * d);
  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 = v + w;
  if (*lon >= 360.0)
    *lon -= 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  0xecb(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec7(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    $0x1,%al
call   1050 <revolution@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe8e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe8a(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe5c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe58(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe1d(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xe13(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1040 <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  0xde6(%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  0xdc6(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xda5(%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  0xd6c(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  0xd4e(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
call   1040 <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  0xce8(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xcb5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     136d <sunpos+0x21d>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xc9b(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sunpos>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movapd %xmm0,%xmm1
movsd  %xmm0,0x8(%rsp)
movsd  0xe91(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe8d(%rip),%xmm0
mov    $0x1,%al
call   1050 <revolution@plt>
cvtsi2sd %eax,%xmm2
movsd  %xmm2,0x18(%rsp)
movsd  0xe7c(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movapd %xmm0,0x20(%rsp)
mulsd  0xe74(%rip),%xmm1
addsd  0xe74(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xe6e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movapd %xmm2,%xmm0
mulsd  0xe60(%rip),%xmm0
movsd  %xmm0,0x30(%rsp)
call   1040 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x30(%rsp),%xmm0
call   1060 <cos@plt>
mulsd  0x8(%rsp),%xmm0
addsd  0xe38(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
mulsd  0xe1c(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1060 <cos@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
mulsd  %xmm1,%xmm1
movsd  0xdfd(%rip),%xmm2
subsd  %xmm1,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
movapd %xmm2,%xmm0
jb     125b <sunpos+0x10b>
sqrtsd %xmm0,%xmm0
jmp    1260 <sunpos+0x110>
call   1070 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
addsd  0xda4(%rip),%xmm0
movapd %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
movapd %xmm0,%xmm2
mulsd  0x8(%rsp),%xmm2
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movsd  0x18(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xdab(%rip),%xmm0
jb     12b5 <sunpos+0x165>
sqrtsd %xmm0,%xmm0
jmp    12c6 <sunpos+0x176>
movsd  %xmm2,0x8(%rsp)
call   1070 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
movsd  %xmm0,(%rbx)
movapd %xmm2,%xmm0
movsd  0x18(%rsp),%xmm1
call   1030 <atan2@plt>
mulsd  0xd4f(%rip),%xmm0
movapd 0x20(%rsp),%xmm2
addsd  %xmm0,%xmm2
movsd  0xd55(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  0xd51(%rip),%xmm1
cmpnlesd %xmm2,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movlpd %xmm1,(%r14)
add    $0x38,%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 0x3FEF8A098DA5F901, double %14, double 3.560470e+02)
%16 = call i32 (double, ...) bitcast (i32 (...)* @revolution to i32 (double, ...)*)(double %15)
%17 = sitofp i32 %16 to double
store double %17, double* %7
%18 = load double, double* %4
%19 = call double @llvm.fmuladd.f64(double 4.709350e-05, double %18, double 0x4071AF0BE0DED289)
store double %19, double* %8
%20 = load double, double* %4
%21 = call double @llvm.fmuladd.f64(double -1.151000e-09, double %20, double 1.670900e-02)
store double %21, double* %9
%22 = load double, double* %7
%23 = load double, double* %9
%24 = fmul double %23, 0x404CA5DC1A63C1F8
%25 = load double, double* %7
%26 = fmul double %25, 0x3F91DF46A2529D39
%27 = call double @sin(double %26)
%28 = fmul double %24, %27
%29 = load double, double* %9
%30 = load double, double* %7
%31 = fmul double %30, 0x3F91DF46A2529D39
%32 = call double @cos(double %31)
%33 = call double @llvm.fmuladd.f64(double %29, double %32, double 1.000000e+00)
%34 = call double @llvm.fmuladd.f64(double %28, double %33, double %22)
store double %34, double* %10
%35 = load double, double* %10
%36 = fmul double %35, 0x3F91DF46A2529D39
%37 = call double @cos(double %36)
%38 = load double, double* %9
%39 = fsub double %37, %38
store double %39, double* %11
%40 = load double, double* %9
%41 = load double, double* %9
%42 = fneg double %40
%43 = call double @llvm.fmuladd.f64(double %42, double %41, double 1.000000e+00)
%44 = call double @sqrt(double %43)
%45 = load double, double* %10
%46 = fmul double %45, 0x3F91DF46A2529D39
%47 = call double @sin(double %46)
%48 = fmul double %44, %47
store double %48, double* %12
%49 = load double, double* %11
%50 = load double, double* %11
%51 = load double, double* %12
%52 = load double, double* %12
%53 = fmul double %51, %52
%54 = call double @llvm.fmuladd.f64(double %49, double %50, double %53)
%55 = call double @sqrt(double %54)
%56 = load double*, double** %6
store double %55, double* %56
%57 = load double, double* %12
%58 = load double, double* %11
%59 = call double @atan2(double %57, double %58)
%60 = fmul double 0x404CA5DC1A63C1F8, %59
store double %60, double* %13
%61 = load double, double* %13
%62 = load double, double* %8
%63 = fadd double %61, %62
%64 = load double*, double** %5
store double %63, double* %64
%65 = load double*, double** %5
%66 = load double, double* %65
%67 = fcmp oge double %66, 3.600000e+02
br i1 %67, label %68, label %72
68: ; preds = %3
%69 = load double*, double** %5
%70 = load double, double* %69
%71 = fsub double %70, 3.600000e+02
store double %71, double* %69
br label %72
72: ; preds = %68, %3
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 0x3FEF8A098DA5F901, double 3.560470e+02)
%5 = tail call i32 (double, ...) bitcast (i32 (...)* @revolution to i32 (double, ...)*)(double %4)
%6 = sitofp i32 %5 to double
%7 = tail call double @llvm.fmuladd.f64(double %0, double 4.709350e-05, double 0x4071AF0BE0DED289)
%8 = tail call double @llvm.fmuladd.f64(double %0, double -1.151000e-09, double 1.670900e-02)
%9 = fmul double %8, 0x404CA5DC1A63C1F8
%10 = fmul double %6, 0x3F91DF46A2529D39
%11 = tail call double @sin(double %10)
%12 = fmul double %9, %11
%13 = tail call double @cos(double %10)
%14 = tail call double @llvm.fmuladd.f64(double %8, double %13, double 1.000000e+00)
%15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %6)
%16 = fmul double %15, 0x3F91DF46A2529D39
%17 = tail call double @cos(double %16)
%18 = fsub double %17, %8
%19 = fneg double %8
%20 = tail call double @llvm.fmuladd.f64(double %19, double %8, double 1.000000e+00)
%21 = tail call double @sqrt(double %20)
%22 = tail call double @sin(double %16)
%23 = fmul double %21, %22
%24 = fmul double %23, %23
%25 = tail call double @llvm.fmuladd.f64(double %18, double %18, double %24)
%26 = tail call double @sqrt(double %25)
store double %26, double* %2
%27 = tail call double @atan2(double %23, double %18)
%28 = fmul double %27, 0x404CA5DC1A63C1F8
%29 = fadd double %7, %28
%30 = fcmp ult double %29, 3.600000e+02
%31 = fadd double %29, -3.600000e+02
%32 = select i1 %30, double %29, double %31
store double %32, double* %1
ret void
}