void binaryStarOrbit(double t, double T, double e, double o, double O, double i,
                     double a, double P, double *thetap, double *rhop) {
  double M, E, cosE, nu, cosnu, r, rho, theta;
  M = 2 * 3.141592653589793 / P * (t - T);
  range(&M, 2 * 3.141592653589793);
  E = solveKepler(M, e);
  cosE = cos(E);
  cosnu = (cosE - e) / (1.0 - e * cosE);
  r = a * (1.0 - e * e) / (1.0 + e * cosnu);
  nu = acos(cosnu);
  if (E > 3.141592653589793)
    nu = -nu;
  theta = atan(tan(nu + ((o)*3.141592653589793 / 180.)) *
               cos(((i)*3.141592653589793 / 180.))) +
          ((O)*3.141592653589793 / 180.);
  rho = r * cos(nu + ((o)*3.141592653589793 / 180.)) /
        cos(theta - ((O)*3.141592653589793 / 180.));
  if (rho < 0) {
    theta += 3.141592653589793;
    rho = -rho;
  }
  range(&theta, 2 * 3.141592653589793);
  *thetap = theta;
  *rhop = rho;
}


x86 assembly (clang, -O0):
<binaryStarOrbit>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
mov    %rdi,-0x48(%rbp)
mov    %rsi,-0x50(%rbp)
movsd  0xe6d(%rip),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
lea    -0x58(%rbp),%rdi
movsd  0xe49(%rip),%xmm0
mov    $0x1,%al
call   1060 <range@plt>
movsd  -0x58(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    $0x2,%al
call   1050 <solveKepler@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1080 <cos@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xdda(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xd9b(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd7d(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xd4c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12df <binaryStarOrbit+0x17f>
movsd  -0x70(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  0xd14(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  0xd1f(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
call   1070 <tan@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  0xcea(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  0xcf5(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1080 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
call   1040 <atan@plt>
movsd  0xcb8(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  0xcc3(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  0xc81(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  0xc8c(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
call   1080 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  0xc40(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  0xc4b(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
call   1080 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
ucomisd -0x88(%rbp),%xmm0
ff
jbe    1441 <binaryStarOrbit+0x2e1>
movsd  0xbf6(%rip),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
lea    -0x90(%rbp),%rdi
movsd  0xbc0(%rip),%xmm0
mov    $0x1,%al
call   1060 <range@plt>
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binaryStarOrbit>:
push   %rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm6,0x28(%rsp)
movsd  %xmm5,0x48(%rsp)
movsd  %xmm4,0x38(%rsp)
movsd  %xmm3,0x30(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  0xe6c(%rip),%xmm2
movapd %xmm2,%xmm3
divsd  %xmm7,%xmm3
subsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x40(%rsp)
lea    0x40(%rsp),%rdi
movapd %xmm2,%xmm0
mov    $0x1,%al
call   1060 <range@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    $0x2,%al
call   1050 <solveKepler@plt>
mov    %eax,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
call   1080 <cos@plt>
movsd  0x10(%rsp),%xmm4
movapd %xmm4,%xmm1
mulsd  %xmm0,%xmm1
subsd  %xmm4,%xmm0
movsd  0xe13(%rip),%xmm2
movapd %xmm2,%xmm3
subsd  %xmm1,%xmm3
divsd  %xmm3,%xmm0
movapd %xmm4,%xmm1
mulsd  %xmm4,%xmm1
mulsd  %xmm0,%xmm4
addsd  %xmm2,%xmm4
subsd  %xmm1,%xmm2
mulsd  0x28(%rsp),%xmm2
divsd  %xmm4,%xmm2
movapd %xmm2,0x10(%rsp)
call   1030 <acos@plt>
cmp    $0x4,%ebp
jl     1237 <binaryStarOrbit+0xd7>
xorpd  0xde9(%rip),%xmm0
movsd  0x30(%rsp),%xmm1
mulsd  0xdcb(%rip),%xmm1
divsd  0xdcb(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x30(%rsp)
movapd %xmm1,%xmm0
call   1070 <tan@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x48(%rsp),%xmm0
mulsd  0xd9c(%rip),%xmm0
divsd  0xd9c(%rip),%xmm0
call   1080 <cos@plt>
mulsd  0x28(%rsp),%xmm0
call   1040 <atan@plt>
movsd  0x38(%rsp),%xmm1
mulsd  0xd76(%rip),%xmm1
divsd  0xd76(%rip),%xmm1
movsd  %xmm1,0x38(%rsp)
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x30(%rsp),%xmm0
call   1080 <cos@plt>
movapd 0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  0x38(%rsp),%xmm0
call   1080 <cos@plt>
movapd 0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    130e <binaryStarOrbit+0x1ae>
movsd  0x8(%rsp),%xmm0
addsd  0xd10(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xorpd  0xd12(%rip),%xmm1
movapd %xmm1,0x10(%rsp)
lea    0x8(%rsp),%rdi
movsd  0xcdf(%rip),%xmm0
mov    $0x1,%al
call   1060 <range@plt>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movaps 0x10(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @binaryStarOrbit(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double* %8, double* %9) {
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double*
%20 = alloca double*
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
store double %0, double* %11
store double %1, double* %12
store double %2, double* %13
store double %3, double* %14
store double %4, double* %15
store double %5, double* %16
store double %6, double* %17
store double %7, double* %18
store double* %8, double** %19
store double* %9, double** %20
%29 = load double, double* %18
%30 = fdiv double 0x401921FB54442D18, %29
%31 = load double, double* %11
%32 = load double, double* %12
%33 = fsub double %31, %32
%34 = fmul double %30, %33
store double %34, double* %21
%35 = call i32 (double*, double, ...) bitcast (i32 (...)* @range to i32 (double*, double, ...)*)(double* %21, double 0x401921FB54442D18)
%36 = load double, double* %21
%37 = load double, double* %13
%38 = call i32 (double, double, ...) bitcast (i32 (...)* @solveKepler to i32 (double, double, ...)*)(double %36, double %37)
%39 = sitofp i32 %38 to double
store double %39, double* %22
%40 = load double, double* %22
%41 = call double @cos(double %40)
store double %41, double* %23
%42 = load double, double* %23
%43 = load double, double* %13
%44 = fsub double %42, %43
%45 = load double, double* %13
%46 = load double, double* %23
%47 = fneg double %45
%48 = call double @llvm.fmuladd.f64(double %47, double %46, double 1.000000e+00)
%49 = fdiv double %44, %48
store double %49, double* %25
%50 = load double, double* %17
%51 = load double, double* %13
%52 = load double, double* %13
%53 = fneg double %51
%54 = call double @llvm.fmuladd.f64(double %53, double %52, double 1.000000e+00)
%55 = fmul double %50, %54
%56 = load double, double* %13
%57 = load double, double* %25
%58 = call double @llvm.fmuladd.f64(double %56, double %57, double 1.000000e+00)
%59 = fdiv double %55, %58
store double %59, double* %26
%60 = load double, double* %25
%61 = call double @acos(double %60)
store double %61, double* %24
%62 = load double, double* %22
%63 = fcmp ogt double %62, 0x400921FB54442D18
br i1 %63, label %64, label %67
64: ; preds = %10
%65 = load double, double* %24
%66 = fneg double %65
store double %66, double* %24
br label %67
67: ; preds = %64, %10
%68 = load double, double* %24
%69 = load double, double* %14
%70 = fmul double %69, 0x400921FB54442D18
%71 = fdiv double %70, 1.800000e+02
%72 = fadd double %68, %71
%73 = call double @tan(double %72)
%74 = load double, double* %16
%75 = fmul double %74, 0x400921FB54442D18
%76 = fdiv double %75, 1.800000e+02
%77 = call double @cos(double %76)
%78 = fmul double %73, %77
%79 = call double @atan(double %78)
%80 = load double, double* %15
%81 = fmul double %80, 0x400921FB54442D18
%82 = fdiv double %81, 1.800000e+02
%83 = fadd double %79, %82
store double %83, double* %28
%84 = load double, double* %26
%85 = load double, double* %24
%86 = load double, double* %14
%87 = fmul double %86, 0x400921FB54442D18
%88 = fdiv double %87, 1.800000e+02
%89 = fadd double %85, %88
%90 = call double @cos(double %89)
%91 = fmul double %84, %90
%92 = load double, double* %28
%93 = load double, double* %15
%94 = fmul double %93, 0x400921FB54442D18
%95 = fdiv double %94, 1.800000e+02
%96 = fsub double %92, %95
%97 = call double @cos(double %96)
%98 = fdiv double %91, %97
store double %98, double* %27
%99 = load double, double* %27
%100 = fcmp olt double %99, 0.000000e+00
br i1 %100, label %101, label %106
101: ; preds = %67
%102 = load double, double* %28
%103 = fadd double %102, 0x400921FB54442D18
store double %103, double* %28
%104 = load double, double* %27
%105 = fneg double %104
store double %105, double* %27
br label %106
106: ; preds = %101, %67
%107 = call i32 (double*, double, ...) bitcast (i32 (...)* @range to i32 (double*, double, ...)*)(double* %28, double 0x401921FB54442D18)
%108 = load double, double* %28
%109 = load double*, double** %19
store double %108, double* %109
%110 = load double, double* %27
%111 = load double*, double** %20
store double %110, double* %111
ret void
}

LLVM IR (-O2):
define void @binaryStarOrbit(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double* nocapture writeonly %8, double* nocapture writeonly %9) {
%11 = alloca double
%12 = alloca double
%13 = bitcast double* %11 to i8*
%14 = bitcast double* %12 to i8*
%15 = fdiv double 0x401921FB54442D18, %7
%16 = fsub double %0, %1
%17 = fmul double %16, %15
store double %17, double* %11
%18 = call i32 (double*, double, ...) bitcast (i32 (...)* @range to i32 (double*, double, ...)*)(double* %11, double 0x401921FB54442D18)
%19 = load double, double* %11
%20 = call i32 (double, double, ...) bitcast (i32 (...)* @solveKepler to i32 (double, double, ...)*)(double %19, double %2)
%21 = sitofp i32 %20 to double
%22 = call double @cos(double %21)
%23 = fsub double %22, %2
%24 = fneg double %2
%25 = call double @llvm.fmuladd.f64(double %24, double %22, double 1.000000e+00)
%26 = fdiv double %23, %25
%27 = call double @llvm.fmuladd.f64(double %24, double %2, double 1.000000e+00)
%28 = fmul double %27, %6
%29 = call double @llvm.fmuladd.f64(double %2, double %26, double 1.000000e+00)
%30 = fdiv double %28, %29
%31 = call double @acos(double %26)
%32 = icmp sgt i32 %20, 3
%33 = fneg double %31
%34 = select i1 %32, double %33, double %31
%35 = fmul double %3, 0x400921FB54442D18
%36 = fdiv double %35, 1.800000e+02
%37 = fadd double %36, %34
%38 = call double @tan(double %37)
%39 = fmul double %5, 0x400921FB54442D18
%40 = fdiv double %39, 1.800000e+02
%41 = call double @cos(double %40)
%42 = fmul double %38, %41
%43 = call double @atan(double %42)
%44 = fmul double %4, 0x400921FB54442D18
%45 = fdiv double %44, 1.800000e+02
%46 = fadd double %45, %43
store double %46, double* %12
%47 = call double @cos(double %37)
%48 = fmul double %30, %47
%49 = load double, double* %12
%50 = fsub double %49, %45
%51 = call double @cos(double %50)
%52 = fdiv double %48, %51
%53 = fcmp olt double %52, 0.000000e+00
br i1 %53, label %54, label %58
54: ; preds = %10
%55 = load double, double* %12
%56 = fadd double %55, 0x400921FB54442D18
store double %56, double* %12
%57 = fneg double %52
br label %58
58: ; preds = %54, %10
%59 = phi double [ %57, %54 ], [ %52, %10 ]
%60 = call i32 (double*, double, ...) bitcast (i32 (...)* @range to i32 (double*, double, ...)*)(double* %12, double 0x401921FB54442D18)
%61 = load double, double* %12
store double %61, double* %8
store double %59, double* %9
ret void
}