double dt2ts(date, time)
double date;
double time;
{
  double tsec;
  double dh, dm, dd;
  int iy, im, id;
  if (time < 0.0)
    tsec = time * -86400.0;
  else {
    dh = (int)(time + 0.0000000001);
    dm = (int)(((time - dh) * 100.0) + 0.0000000001);
    tsec = (time * 10000.0) - (dh * 10000.0) - (dm * 100.0);
    tsec = (int)(tsec * 100000.0 + 0.0001) / 100000.0;
    tsec = tsec + (dm * 60.0) + (dh * 3600.0);
  }
  if (date >= 0.0301) {
    iy = (int)(date + 0.0000000001);
    im = (int)(((date - (double)(iy)) * 10000.0) + 0.00000001);
    id = im % 100;
    im = (im / 100) + 9;
    if (im < 12)
      iy = iy - 1;
    im = im % 12;
    id = id - 1;
    id = id + ((im + 1 + im / 6 + im / 11) / 2 * 31) +
         ((im - im / 6 - im / 11) / 2 * 30) + (iy / 4) - (iy / 100) +
         (iy / 400);
    dd = (double)id + (365.0 * (double)iy) - 712163.0;
    tsec = tsec + (dd * 86400.0);
  }
  return (tsec);
}


x86 assembly (clang, -O0):
<dt2ts>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1133 <dt2ts+0x33>
movsd  0xf14(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1250 <dt2ts+0x150>
movsd  0xef5(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xec1(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec5(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xe9f(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe7b(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe47(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe1d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe19(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
cvtsi2sd %eax,%xmm0
movsd  0xdfd(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xdda(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  0xdbd(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xde3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1407 <dt2ts+0x307>
movsd  0xdc1(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x34(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  0xd97(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdab(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x9,%eax
mov    %eax,-0x38(%rbp)
cmpl   $0xc,-0x38(%rbp)
jge    12da <dt2ts+0x1da>
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x38(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x60(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x38(%rbp),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
add    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
imul   $0x1f,%ecx,%ecx
add    %ecx,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x38(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x50(%rbp)
mov    -0x38(%rbp),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x50(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
imul   $0x1e,%ecx,%ecx
add    %ecx,%eax
mov    %eax,-0x48(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x40(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x3c(%rbp)
cvtsi2sdl -0x3c(%rbp),%xmm1
cvtsi2sdl -0x34(%rbp),%xmm0
movsd  0xc91(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xc79(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  0xc56(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dt2ts>:
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jbe    1277 <dt2ts+0x177>
mulsd  0xf2a(%rip),%xmm1
ucomisd 0xf2a(%rip),%xmm0
jb     1319 <dt2ts+0x219>
movsd  0xed4(%rip),%xmm2
addsd  %xmm0,%xmm2
cvttsd2si %xmm2,%r8d
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
subsd  %xmm2,%xmm0
mulsd  0xecf(%rip),%xmm0
addsd  0xeff(%rip),%xmm0
cvttsd2si %xmm0,%ecx
movslq %ecx,%rcx
imul   $0x51eb851f,%rcx,%rdx
mov    %rdx,%rdi
shr    $0x3f,%rdi
sar    $0x25,%rdx
lea    (%rdx,%rdi,1),%esi
imul   $0x64,%esi,%eax
mov    %ecx,%esi
sub    %eax,%esi
lea    (%rdx,%rdi,1),%eax
add    $0x9,%eax
xor    %edx,%edx
cmp    $0x12c,%ecx
setl   %dl
sub    %edx,%r8d
movslq %eax,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x21,%rax
add    %ecx,%eax
shl    $0x2,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
lea    0x3(%r8),%r9d
test   %r8d,%r8d
cmovns %r8d,%r9d
sar    $0x2,%r9d
add    %esi,%r9d
movsbl %dl,%eax
imul   $0x2b,%eax,%esi
movzwl %si,%esi
mov    %esi,%edi
shr    $0xf,%edi
shr    $0x8,%esi
add    %dil,%sil
imul   $0xffffffbb,%eax,%edi
shr    $0x8,%edi
add    %dl,%dil
mov    %edi,%eax
shr    $0x7,%al
sar    $0x3,%dil
add    %al,%dil
add    %sil,%dil
lea    (%rdi,%rdx,1),%eax
add    $0x1,%al
mov    %eax,%ecx
shr    $0x7,%cl
add    %al,%cl
sar    %cl
movsbl %cl,%eax
mov    %eax,%esi
shl    $0x5,%esi
sub    %eax,%esi
sub    %dil,%dl
mov    %edx,%eax
shr    $0x7,%al
add    %dl,%al
sar    %al
movsbl %al,%eax
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
sub    %eax,%edx
movslq %r8d,%r8
imul   $0xffffffffae147ae1,%r8,%rcx
mov    %rcx,%rdi
shr    $0x3f,%rdi
sar    $0x25,%rcx
add    %edi,%ecx
add    %r9d,%ecx
imul   $0x51eb851f,%r8,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x27,%rdi
add    %eax,%edi
add    %ecx,%edi
add    %esi,%edi
lea    (%rdx,%rdi,1),%eax
add    $0xffffffff,%eax
cvtsi2sd %eax,%xmm2
cvtsi2sd %r8d,%xmm0
mulsd  0xdfa(%rip),%xmm0
addsd  %xmm2,%xmm0
addsd  0xdf6(%rip),%xmm0
mulsd  0xdf6(%rip),%xmm0
addsd  %xmm1,%xmm0
ret
movsd  0xd81(%rip),%xmm3
movapd %xmm1,%xmm2
addsd  %xmm3,%xmm2
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
movapd %xmm1,%xmm4
subsd  %xmm2,%xmm4
movsd  0xd69(%rip),%xmm5
mulsd  %xmm5,%xmm4
addsd  %xmm3,%xmm4
cvttpd2dq %xmm4,%xmm3
cvtdq2pd %xmm3,%xmm3
movsd  0xd59(%rip),%xmm4
mulsd  0xd59(%rip),%xmm1
mulsd  %xmm2,%xmm4
addsd  %xmm4,%xmm1
mulsd  %xmm3,%xmm5
subsd  %xmm5,%xmm1
movsd  0xd49(%rip),%xmm4
mulsd  %xmm4,%xmm1
addsd  0xd45(%rip),%xmm1
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm1
divsd  %xmm4,%xmm1
mulsd  0xd39(%rip),%xmm3
addsd  %xmm1,%xmm3
mulsd  0xd35(%rip),%xmm2
addsd  %xmm3,%xmm2
movapd %xmm2,%xmm1
ucomisd 0xd35(%rip),%xmm0
jae    1124 <dt2ts+0x24>
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dt2ts(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store double %0, double* %3
store double %1, double* %4
%12 = load double, double* %4
%13 = fcmp olt double %12, 0.000000e+00
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load double, double* %4
%16 = fmul double %15, -8.640000e+04
store double %16, double* %5
br label %46
17: ; preds = %2
%18 = load double, double* %4
%19 = fadd double %18, 1.000000e-10
%20 = fptosi double %19 to i32
%21 = sitofp i32 %20 to double
store double %21, double* %6
%22 = load double, double* %4
%23 = load double, double* %6
%24 = fsub double %22, %23
%25 = call double @llvm.fmuladd.f64(double %24, double 1.000000e+02, double 1.000000e-10)
%26 = fptosi double %25 to i32
%27 = sitofp i32 %26 to double
store double %27, double* %7
%28 = load double, double* %4
%29 = load double, double* %6
%30 = fmul double %29, 1.000000e+04
%31 = fneg double %30
%32 = call double @llvm.fmuladd.f64(double %28, double 1.000000e+04, double %31)
%33 = load double, double* %7
%34 = fneg double %33
%35 = call double @llvm.fmuladd.f64(double %34, double 1.000000e+02, double %32)
store double %35, double* %5
%36 = load double, double* %5
%37 = call double @llvm.fmuladd.f64(double %36, double 1.000000e+05, double 1.000000e-04)
%38 = fptosi double %37 to i32
%39 = sitofp i32 %38 to double
%40 = fdiv double %39, 1.000000e+05
store double %40, double* %5
%41 = load double, double* %5
%42 = load double, double* %7
%43 = call double @llvm.fmuladd.f64(double %42, double 6.000000e+01, double %41)
%44 = load double, double* %6
%45 = call double @llvm.fmuladd.f64(double %44, double 3.600000e+03, double %43)
store double %45, double* %5
br label %46
46: ; preds = %17, %14
%47 = load double, double* %3
%48 = fcmp oge double %47, 3.010000e-02
br i1 %48, label %49, label %114
49: ; preds = %46
%50 = load double, double* %3
%51 = fadd double %50, 1.000000e-10
%52 = fptosi double %51 to i32
store i32 %52, i32* %9
%53 = load double, double* %3
%54 = load i32, i32* %9
%55 = sitofp i32 %54 to double
%56 = fsub double %53, %55
%57 = call double @llvm.fmuladd.f64(double %56, double 1.000000e+04, double 1.000000e-08)
%58 = fptosi double %57 to i32
store i32 %58, i32* %10
%59 = load i32, i32* %10
%60 = srem i32 %59, 100
store i32 %60, i32* %11
%61 = load i32, i32* %10
%62 = sdiv i32 %61, 100
%63 = add nsw i32 %62, 9
store i32 %63, i32* %10
%64 = load i32, i32* %10
%65 = icmp slt i32 %64, 12
br i1 %65, label %66, label %69
66: ; preds = %49
%67 = load i32, i32* %9
%68 = sub nsw i32 %67, 1
store i32 %68, i32* %9
br label %69
69: ; preds = %66, %49
%70 = load i32, i32* %10
%71 = srem i32 %70, 12
store i32 %71, i32* %10
%72 = load i32, i32* %11
%73 = sub nsw i32 %72, 1
store i32 %73, i32* %11
%74 = load i32, i32* %11
%75 = load i32, i32* %10
%76 = add nsw i32 %75, 1
%77 = load i32, i32* %10
%78 = sdiv i32 %77, 6
%79 = add nsw i32 %76, %78
%80 = load i32, i32* %10
%81 = sdiv i32 %80, 11
%82 = add nsw i32 %79, %81
%83 = sdiv i32 %82, 2
%84 = mul nsw i32 %83, 31
%85 = add nsw i32 %74, %84
%86 = load i32, i32* %10
%87 = load i32, i32* %10
%88 = sdiv i32 %87, 6
%89 = sub nsw i32 %86, %88
%90 = load i32, i32* %10
%91 = sdiv i32 %90, 11
%92 = sub nsw i32 %89, %91
%93 = sdiv i32 %92, 2
%94 = mul nsw i32 %93, 30
%95 = add nsw i32 %85, %94
%96 = load i32, i32* %9
%97 = sdiv i32 %96, 4
%98 = add nsw i32 %95, %97
%99 = load i32, i32* %9
%100 = sdiv i32 %99, 100
%101 = sub nsw i32 %98, %100
%102 = load i32, i32* %9
%103 = sdiv i32 %102, 400
%104 = add nsw i32 %101, %103
store i32 %104, i32* %11
%105 = load i32, i32* %11
%106 = sitofp i32 %105 to double
%107 = load i32, i32* %9
%108 = sitofp i32 %107 to double
%109 = call double @llvm.fmuladd.f64(double 3.650000e+02, double %108, double %106)
%110 = fsub double %109, 7.121630e+05
store double %110, double* %8
%111 = load double, double* %5
%112 = load double, double* %8
%113 = call double @llvm.fmuladd.f64(double %112, double 8.640000e+04, double %111)
store double %113, double* %5
br label %114
114: ; preds = %69, %46
%115 = load double, double* %5
ret double %115
}

LLVM IR (-O2):
define double @dt2ts(double %0, double %1) {
%3 = fcmp olt double %1, 0.000000e+00
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = fmul double %1, -8.640000e+04
br label %24
6: ; preds = %2
%7 = fadd double %1, 1.000000e-10
%8 = fptosi double %7 to i32
%9 = sitofp i32 %8 to double
%10 = fsub double %1, %9
%11 = tail call double @llvm.fmuladd.f64(double %10, double 1.000000e+02, double 1.000000e-10)
%12 = fptosi double %11 to i32
%13 = sitofp i32 %12 to double
%14 = fmul double %9, -1.000000e+04
%15 = tail call double @llvm.fmuladd.f64(double %1, double 1.000000e+04, double %14)
%16 = fneg double %13
%17 = tail call double @llvm.fmuladd.f64(double %16, double 1.000000e+02, double %15)
%18 = tail call double @llvm.fmuladd.f64(double %17, double 1.000000e+05, double 1.000000e-04)
%19 = fptosi double %18 to i32
%20 = sitofp i32 %19 to double
%21 = fdiv double %20, 1.000000e+05
%22 = tail call double @llvm.fmuladd.f64(double %13, double 6.000000e+01, double %21)
%23 = tail call double @llvm.fmuladd.f64(double %9, double 3.600000e+03, double %22)
br label %24
24: ; preds = %6, %4
%25 = phi double [ %5, %4 ], [ %23, %6 ]
%26 = fcmp ult double %0, 3.010000e-02
br i1 %26, label %68, label %27
27: ; preds = %24
%28 = fadd double %0, 1.000000e-10
%29 = fptosi double %28 to i32
%30 = sitofp i32 %29 to double
%31 = fsub double %0, %30
%32 = tail call double @llvm.fmuladd.f64(double %31, double 1.000000e+04, double 1.000000e-08)
%33 = fptosi double %32 to i32
%34 = srem i32 %33, 100
%35 = sdiv i32 %33, 100
%36 = add nsw i32 %35, 9
%37 = icmp slt i32 %33, 300
%38 = sext i1 %37 to i32
%39 = add nsw i32 %38, %29
%40 = srem i32 %36, 12
%41 = add nsw i32 %34, -1
%42 = trunc i32 %40 to i8
%43 = sdiv i8 %42, 6
%44 = sdiv i8 %42, 11
%45 = add nsw i8 %44, %43
%46 = add nsw i8 %45, 1
%47 = add nsw i8 %46, %42
%48 = sdiv i8 %47, 2
%49 = sext i8 %48 to i32
%50 = mul nsw i32 %49, 31
%51 = sub nsw i8 %42, %45
%52 = sdiv i8 %51, 2
%53 = sext i8 %52 to i32
%54 = mul nsw i32 %53, 30
%55 = sdiv i32 %39, 4
%56 = sdiv i32 %39, -100
%57 = sdiv i32 %39, 400
%58 = add nsw i32 %41, %55
%59 = add nsw i32 %58, %56
%60 = add nsw i32 %59, %57
%61 = add nsw i32 %60, %50
%62 = add nsw i32 %61, %54
%63 = sitofp i32 %62 to double
%64 = sitofp i32 %39 to double
%65 = tail call double @llvm.fmuladd.f64(double %64, double 3.650000e+02, double %63)
%66 = fadd double %65, -7.121630e+05
%67 = tail call double @llvm.fmuladd.f64(double %66, double 8.640000e+04, double %25)
br label %68
68: ; preds = %27, %24
%69 = phi double [ %67, %27 ], [ %25, %24 ]
ret double %69
}