double mjd2mst(dj)
double dj;
{
  double dt, t, t2, t3, mst, st;
  dt = dj - 51544.5;
  t = dt / 36525.0;
  t2 = t * t;
  t3 = t2 * t;
  st = (8640184.812866 * t) + (3155760000.0 * t) - (0.0000062 * t3) +
       (0.093104 * t2) + 67310.54841;
  mst = dmod(st, 86400.0);
  if (mst < 0.0)
    mst = mst + 86400.0;
  return (mst);
}


x86 assembly (clang, -O0):
<mjd2mst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xf0e(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xef0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xeb4(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  0xe9f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xe82(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  0xe65(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe4d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xe2f(%rip),%xmm1
mov    $0x2,%al
call   1030 <dmod@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    1201 <mjd2mst+0xf1>
movsd  0xe09(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mjd2mst>:
push   %rax
addsd  0xee7(%rip),%xmm0
divsd  0xee7(%rip),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movsd  0xed7(%rip),%xmm3
mulsd  %xmm0,%xmm3
mulsd  0xed3(%rip),%xmm0
addsd  %xmm3,%xmm0
mulsd  0xecf(%rip),%xmm2
mulsd  0xecf(%rip),%xmm1
addsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  0xec7(%rip),%xmm0
movsd  0xec7(%rip),%xmm1
mov    $0x2,%al
call   1030 <dmod@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
test   %eax,%eax
jns    118b <mjd2mst+0x7b>
addsd  0xead(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @mjd2mst(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %2
%9 = load double, double* %2
%10 = fsub double %9, 5.154450e+04
store double %10, double* %3
%11 = load double, double* %3
%12 = fdiv double %11, 3.652500e+04
store double %12, double* %4
%13 = load double, double* %4
%14 = load double, double* %4
%15 = fmul double %13, %14
store double %15, double* %5
%16 = load double, double* %5
%17 = load double, double* %4
%18 = fmul double %16, %17
store double %18, double* %6
%19 = load double, double* %4
%20 = load double, double* %4
%21 = fmul double 3.155760e+09, %20
%22 = call double @llvm.fmuladd.f64(double 0x41607AD71A02FF8F, double %19, double %21)
%23 = load double, double* %6
%24 = call double @llvm.fmuladd.f64(double -6.200000e-06, double %23, double %22)
%25 = load double, double* %5
%26 = call double @llvm.fmuladd.f64(double 9.310400e-02, double %25, double %24)
%27 = fadd double %26, 0x40F06EE8C649906D
store double %27, double* %8
%28 = load double, double* %8
%29 = call i32 (double, double, ...) bitcast (i32 (...)* @dmod to i32 (double, double, ...)*)(double %28, double 8.640000e+04)
%30 = sitofp i32 %29 to double
store double %30, double* %7
%31 = load double, double* %7
%32 = fcmp olt double %31, 0.000000e+00
br i1 %32, label %33, label %36
33: ; preds = %1
%34 = load double, double* %7
%35 = fadd double %34, 8.640000e+04
store double %35, double* %7
br label %36
36: ; preds = %33, %1
%37 = load double, double* %7
ret double %37
}

LLVM IR (-O2):
define double @mjd2mst(double %0) {
%2 = fadd double %0, -5.154450e+04
%3 = fdiv double %2, 3.652500e+04
%4 = fmul double %3, %3
%5 = fmul double %3, %4
%6 = fmul double %3, 3.155760e+09
%7 = tail call double @llvm.fmuladd.f64(double %3, double 0x41607AD71A02FF8F, double %6)
%8 = tail call double @llvm.fmuladd.f64(double %5, double -6.200000e-06, double %7)
%9 = tail call double @llvm.fmuladd.f64(double %4, double 9.310400e-02, double %8)
%10 = fadd double %9, 0x40F06EE8C649906D
%11 = tail call i32 (double, double, ...) bitcast (i32 (...)* @dmod to i32 (double, double, ...)*)(double %10, double 8.640000e+04)
%12 = sitofp i32 %11 to double
%13 = icmp slt i32 %11, 0
%14 = fadd double %12, 8.640000e+04
%15 = select i1 %13, double %14, double %12
ret double %15
}