double gst2jd(sdj)
double sdj;
{
  double dj, tsd, djd, st0, dj0, eqnx;
  dj0 = (double)((int)sdj) + 0.5;
  st0 = jd2mst(dj0);
  tsd = (sdj - dj0) * 86400.0;
  if (tsd < 0.0)
    tsd = tsd + 86400.0;
  djd = ((tsd - st0) / 1.0027379093) / 86400.0;
  dj = dj0 + djd;
  eqnx = eqeqnx(dj) / 1.002737909;
  dj = dj - eqnx / 86400.0;
  if (dj < dj0)
    dj = dj + 1.0;
  return (dj);
}


x86 assembly (clang, -O0):
<gst2jd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xeca(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    $0x1,%al
call   1040 <jd2mst@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  0xe92(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1197 <gst2jd+0x77>
movsd  0xe73(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  0xe6f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe4b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
call   1030 <eqeqnx@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe2b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  0xe00(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1233 <gst2jd+0x113>
movsd  0xdf7(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gst2jd>:
sub    $0x28,%rsp
movapd %xmm0,(%rsp)
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm0
addsd  0xec7(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
mov    $0x1,%al
call   1040 <jd2mst@plt>
cvtsi2sd %eax,%xmm4
movapd 0x10(%rsp),%xmm3
movapd (%rsp),%xmm6
subsd  %xmm3,%xmm6
movsd  0xea7(%rip),%xmm2
mulsd  %xmm2,%xmm6
movapd %xmm6,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm2,%xmm5
xorpd  %xmm2,%xmm2
movapd %xmm6,%xmm0
cmpltsd %xmm2,%xmm0
andpd  %xmm0,%xmm1
andnpd %xmm6,%xmm0
orpd   %xmm1,%xmm0
subsd  %xmm4,%xmm0
divsd  0xe7a(%rip),%xmm0
divsd  %xmm5,%xmm0
addsd  %xmm3,%xmm0
movapd %xmm0,(%rsp)
mov    $0x1,%al
call   1030 <eqeqnx@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
divsd  0xe5f(%rip),%xmm1
divsd  0xe47(%rip),%xmm1
addsd  (%rsp),%xmm1
movsd  0xe52(%rip),%xmm2
addsd  %xmm1,%xmm2
movapd %xmm1,%xmm0
cmpltsd 0x10(%rsp),%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @gst2jd(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 = fptosi double %9 to i32
%11 = sitofp i32 %10 to double
%12 = fadd double %11, 5.000000e-01
store double %12, double* %7
%13 = load double, double* %7
%14 = call i32 (double, ...) bitcast (i32 (...)* @jd2mst to i32 (double, ...)*)(double %13)
%15 = sitofp i32 %14 to double
store double %15, double* %6
%16 = load double, double* %2
%17 = load double, double* %7
%18 = fsub double %16, %17
%19 = fmul double %18, 8.640000e+04
store double %19, double* %4
%20 = load double, double* %4
%21 = fcmp olt double %20, 0.000000e+00
br i1 %21, label %22, label %25
22: ; preds = %1
%23 = load double, double* %4
%24 = fadd double %23, 8.640000e+04
store double %24, double* %4
br label %25
25: ; preds = %22, %1
%26 = load double, double* %4
%27 = load double, double* %6
%28 = fsub double %26, %27
%29 = fdiv double %28, 0x3FF00B36E7EE7256
%30 = fdiv double %29, 8.640000e+04
store double %30, double* %5
%31 = load double, double* %7
%32 = load double, double* %5
%33 = fadd double %31, %32
store double %33, double* %3
%34 = load double, double* %3
%35 = call i32 (double, ...) bitcast (i32 (...)* @eqeqnx to i32 (double, ...)*)(double %34)
%36 = sitofp i32 %35 to double
%37 = fdiv double %36, 0x3FF00B36E7D9D4AE
store double %37, double* %8
%38 = load double, double* %3
%39 = load double, double* %8
%40 = fdiv double %39, 8.640000e+04
%41 = fsub double %38, %40
store double %41, double* %3
%42 = load double, double* %3
%43 = load double, double* %7
%44 = fcmp olt double %42, %43
br i1 %44, label %45, label %48
45: ; preds = %25
%46 = load double, double* %3
%47 = fadd double %46, 1.000000e+00
store double %47, double* %3
br label %48
48: ; preds = %45, %25
%49 = load double, double* %3
ret double %49
}

LLVM IR (-O2):
define double @gst2jd(double %0) {
%2 = fptosi double %0 to i32
%3 = sitofp i32 %2 to double
%4 = fadd double %3, 5.000000e-01
%5 = tail call i32 (double, ...) bitcast (i32 (...)* @jd2mst to i32 (double, ...)*)(double %4)
%6 = sitofp i32 %5 to double
%7 = fsub double %0, %4
%8 = fmul double %7, 8.640000e+04
%9 = fcmp olt double %8, 0.000000e+00
%10 = fadd double %8, 8.640000e+04
%11 = select i1 %9, double %10, double %8
%12 = fsub double %11, %6
%13 = fdiv double %12, 0x3FF00B36E7EE7256
%14 = fdiv double %13, 8.640000e+04
%15 = fadd double %4, %14
%16 = tail call i32 (double, ...) bitcast (i32 (...)* @eqeqnx to i32 (double, ...)*)(double %15)
%17 = sitofp i32 %16 to double
%18 = fdiv double %17, 0x3FF00B36E7D9D4AE
%19 = fdiv double %18, 8.640000e+04
%20 = fsub double %15, %19
%21 = fcmp olt double %20, %4
%22 = fadd double %20, 1.000000e+00
%23 = select i1 %21, double %22, double %20
ret double %23
}