double dt2ep(date, time)
double date;
double time;
{
  double epoch;
  double dj, dj0, dj1, date0, time0, date1;
  dj = dt2jd(date, time);
  if (date == 0.0)
    epoch = dj / 365.2422;
  else {
    time0 = 0.0;
    date0 = dint(date) + 0.0101;
    date1 = dint(date) + 1.0101;
    dj0 = dt2jd(date0, time0);
    dj1 = dt2jd(date1, time0);
    epoch = dint(date) + ((dj - dj0) / (dj1 - dj0));
  }
  return (epoch);
}


x86 assembly (clang, -O0):
<dt2ep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    $0x2,%al
call   1040 <dt2jd@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    117f <dt2ep+0x5f>
jp     117f <dt2ep+0x5f>
movsd  -0x20(%rbp),%xmm0
movsd  0xe9f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    122e <dt2ep+0x10e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%al
call   1030 <dint@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe69(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%al
call   1030 <dint@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe40(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
mov    $0x2,%al
call   1040 <dt2jd@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
mov    $0x2,%al
call   1040 <dt2jd@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%al
call   1030 <dint@plt>
cvtsi2sd %eax,%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
subsd  -0x28(%rbp),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dt2ep>:
sub    $0x28,%rsp
movsd  %xmm0,0x18(%rsp)
mov    $0x2,%al
call   1040 <dt2jd@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
xorpd  %xmm0,%xmm0
movsd  0x18(%rsp),%xmm3
ucomisd %xmm0,%xmm3
jne    1157 <dt2ep+0x37>
jp     1157 <dt2ep+0x37>
divsd  0xebe(%rip),%xmm1
jmp    1211 <dt2ep+0xf1>
movapd %xmm3,%xmm0
mov    $0x1,%al
movsd  %xmm1,0x20(%rsp)
call   1030 <dint@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xe89(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1030 <dint@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xe6f(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm1,%xmm1
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1040 <dt2jd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm1,%xmm1
movsd  0x8(%rsp),%xmm0
mov    $0x2,%al
call   1040 <dt2jd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1030 <dint@plt>
movsd  0x20(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x10(%rsp),%xmm2
subsd  %xmm2,%xmm1
movsd  0x8(%rsp),%xmm3
subsd  %xmm2,%xmm3
divsd  %xmm3,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @dt2ep(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %3
store double %1, double* %4
%12 = load double, double* %3
%13 = load double, double* %4
%14 = call i32 (double, double, ...) bitcast (i32 (...)* @dt2jd to i32 (double, double, ...)*)(double %12, double %13)
%15 = sitofp i32 %14 to double
store double %15, double* %6
%16 = load double, double* %3
%17 = fcmp oeq double %16, 0.000000e+00
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = load double, double* %6
%20 = fdiv double %19, 0x4076D3E00D1B7176
store double %20, double* %5
br label %49
21: ; preds = %2
store double 0.000000e+00, double* %10
%22 = load double, double* %3
%23 = call i32 (double, ...) bitcast (i32 (...)* @dint to i32 (double, ...)*)(double %22)
%24 = sitofp i32 %23 to double
%25 = fadd double %24, 1.010000e-02
store double %25, double* %9
%26 = load double, double* %3
%27 = call i32 (double, ...) bitcast (i32 (...)* @dint to i32 (double, ...)*)(double %26)
%28 = sitofp i32 %27 to double
%29 = fadd double %28, 1.010100e+00
store double %29, double* %11
%30 = load double, double* %9
%31 = load double, double* %10
%32 = call i32 (double, double, ...) bitcast (i32 (...)* @dt2jd to i32 (double, double, ...)*)(double %30, double %31)
%33 = sitofp i32 %32 to double
store double %33, double* %7
%34 = load double, double* %11
%35 = load double, double* %10
%36 = call i32 (double, double, ...) bitcast (i32 (...)* @dt2jd to i32 (double, double, ...)*)(double %34, double %35)
%37 = sitofp i32 %36 to double
store double %37, double* %8
%38 = load double, double* %3
%39 = call i32 (double, ...) bitcast (i32 (...)* @dint to i32 (double, ...)*)(double %38)
%40 = sitofp i32 %39 to double
%41 = load double, double* %6
%42 = load double, double* %7
%43 = fsub double %41, %42
%44 = load double, double* %8
%45 = load double, double* %7
%46 = fsub double %44, %45
%47 = fdiv double %43, %46
%48 = fadd double %40, %47
store double %48, double* %5
br label %49
49: ; preds = %21, %18
%50 = load double, double* %5
ret double %50
}

LLVM IR (-O2):
define double @dt2ep(double %0, double %1) {
%3 = tail call i32 (double, double, ...) bitcast (i32 (...)* @dt2jd to i32 (double, double, ...)*)(double %0, double %1)
%4 = sitofp i32 %3 to double
%5 = fcmp oeq double %0, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = fdiv double %4, 0x4076D3E00D1B7176
br label %25
8: ; preds = %2
%9 = tail call i32 (double, ...) bitcast (i32 (...)* @dint to i32 (double, ...)*)(double %0)
%10 = sitofp i32 %9 to double
%11 = fadd double %10, 1.010000e-02
%12 = tail call i32 (double, ...) bitcast (i32 (...)* @dint to i32 (double, ...)*)(double %0)
%13 = sitofp i32 %12 to double
%14 = fadd double %13, 1.010100e+00
%15 = tail call i32 (double, double, ...) bitcast (i32 (...)* @dt2jd to i32 (double, double, ...)*)(double %11, double 0.000000e+00)
%16 = sitofp i32 %15 to double
%17 = tail call i32 (double, double, ...) bitcast (i32 (...)* @dt2jd to i32 (double, double, ...)*)(double %14, double 0.000000e+00)
%18 = sitofp i32 %17 to double
%19 = tail call i32 (double, ...) bitcast (i32 (...)* @dint to i32 (double, ...)*)(double %0)
%20 = sitofp i32 %19 to double
%21 = fsub double %4, %16
%22 = fsub double %18, %16
%23 = fdiv double %21, %22
%24 = fadd double %23, %20
br label %25
25: ; preds = %8, %6
%26 = phi double [ %7, %6 ], [ %24, %8 ]
ret double %26
}