void ts2dt(tsec, date, time) double tsec;
double *date;
double *time;
{
  int iyr, imon, iday, ihr, imn;
  double sec;
  ts2i(tsec, &iyr, &imon, &iday, &ihr, &imn, &sec, 4);
  if (iyr < 0) {
    *date = (double)(-iyr) + 0.01 * (double)imon + 0.0001 * (double)iday;
    *date = -(*date);
  } else
    *date = (double)iyr + 0.01 * (double)imon + 0.0001 * (double)iday;
  *time = (double)ihr + 0.01 * (double)imn + 0.0001 * sec;
  return;
}


x86 assembly (clang, -O0):
<ts2dt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x1c(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x2c(%rbp),%r8
lea    -0x38(%rbp),%r9
movl   $0x4,(%rsp)
mov    $0x1,%al
call   1030 <ts2i@plt>
cmpl   $0x0,-0x1c(%rbp)
jge    11c1 <ts2dt+0xb1>
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
cvtsi2sd %eax,%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
movsd  0xe98(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  0xe7b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11f8 <ts2dt+0xe8>
cvtsi2sdl -0x1c(%rbp),%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
movsd  0xe35(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  0xe18(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
cvtsi2sdl -0x28(%rbp),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
movsd  0xdfe(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  0xde1(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts2dt>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movl   $0x4,(%rsp)
lea    0x1c(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x14(%rsp),%r8
lea    0x20(%rsp),%r9
mov    $0x1,%al
call   1030 <ts2i@plt>
mov    0x1c(%rsp),%eax
test   %eax,%eax
js     117e <ts2dt+0x6e>
cvtsi2sd %eax,%xmm1
cvtsi2sdl 0x10(%rsp),%xmm2
mulsd  0xe9d(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtsi2sdl 0xc(%rsp),%xmm0
addsd  %xmm1,%xmm2
mulsd  0xe90(%rip),%xmm0
addsd  %xmm2,%xmm0
jmp    11b3 <ts2dt+0xa3>
neg    %eax
cvtsi2sd %eax,%xmm1
cvtsi2sdl 0x10(%rsp),%xmm2
mulsd  0xe6e(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtsi2sdl 0xc(%rsp),%xmm0
mulsd  0xe65(%rip),%xmm0
addsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
xorpd  0xe5d(%rip),%xmm0
movsd  %xmm0,(%rbx)
xorps  %xmm0,%xmm0
cvtsi2sdl 0x18(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x14(%rsp),%xmm1
mulsd  0xe2f(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0x20(%rsp),%xmm0
mulsd  0xe25(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ts2dt(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
%13 = load double, double* %4
%14 = call i32 (double, i32*, i32*, i32*, i32*, i32*, double*, i32, ...) bitcast (i32 (...)* @ts2i to i32 (double, i32*, i32*, i32*, i32*, i32*, double*, i32, ...)*)(double %13, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, double* %12, i32 4)
%15 = load i32, i32* %7
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %32
17: ; preds = %3
%18 = load i32, i32* %7
%19 = sub nsw i32 0, %18
%20 = sitofp i32 %19 to double
%21 = load i32, i32* %8
%22 = sitofp i32 %21 to double
%23 = call double @llvm.fmuladd.f64(double 1.000000e-02, double %22, double %20)
%24 = load i32, i32* %9
%25 = sitofp i32 %24 to double
%26 = call double @llvm.fmuladd.f64(double 1.000000e-04, double %25, double %23)
%27 = load double*, double** %5
store double %26, double* %27
%28 = load double*, double** %5
%29 = load double, double* %28
%30 = fneg double %29
%31 = load double*, double** %5
store double %30, double* %31
br label %42
32: ; preds = %3
%33 = load i32, i32* %7
%34 = sitofp i32 %33 to double
%35 = load i32, i32* %8
%36 = sitofp i32 %35 to double
%37 = call double @llvm.fmuladd.f64(double 1.000000e-02, double %36, double %34)
%38 = load i32, i32* %9
%39 = sitofp i32 %38 to double
%40 = call double @llvm.fmuladd.f64(double 1.000000e-04, double %39, double %37)
%41 = load double*, double** %5
store double %40, double* %41
br label %42
42: ; preds = %32, %17
%43 = load i32, i32* %10
%44 = sitofp i32 %43 to double
%45 = load i32, i32* %11
%46 = sitofp i32 %45 to double
%47 = call double @llvm.fmuladd.f64(double 1.000000e-02, double %46, double %44)
%48 = load double, double* %12
%49 = call double @llvm.fmuladd.f64(double 1.000000e-04, double %48, double %47)
%50 = load double*, double** %6
store double %49, double* %50
ret void
}

LLVM IR (-O2):
define void @ts2dt(double %0, double* nocapture writeonly %1, double* nocapture writeonly %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = bitcast i32* %7 to i8*
%14 = bitcast i32* %8 to i8*
%15 = bitcast double* %9 to i8*
%16 = call i32 (double, i32*, i32*, i32*, i32*, i32*, double*, i32, ...) bitcast (i32 (...)* @ts2i to i32 (double, i32*, i32*, i32*, i32*, i32*, double*, i32, ...)*)(double %0, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, double* %9, i32 4)
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %3
%20 = sub nsw i32 0, %17
%21 = sitofp i32 %20 to double
%22 = load i32, i32* %5
%23 = sitofp i32 %22 to double
%24 = call double @llvm.fmuladd.f64(double %23, double 1.000000e-02, double %21)
%25 = load i32, i32* %6
%26 = sitofp i32 %25 to double
%27 = call double @llvm.fmuladd.f64(double %26, double 1.000000e-04, double %24)
%28 = fneg double %27
br label %37
29: ; preds = %3
%30 = sitofp i32 %17 to double
%31 = load i32, i32* %5
%32 = sitofp i32 %31 to double
%33 = call double @llvm.fmuladd.f64(double %32, double 1.000000e-02, double %30)
%34 = load i32, i32* %6
%35 = sitofp i32 %34 to double
%36 = call double @llvm.fmuladd.f64(double %35, double 1.000000e-04, double %33)
br label %37
37: ; preds = %29, %19
%38 = phi double [ %36, %29 ], [ %28, %19 ]
store double %38, double* %1
%39 = load i32, i32* %7
%40 = sitofp i32 %39 to double
%41 = load i32, i32* %8
%42 = sitofp i32 %41 to double
%43 = call double @llvm.fmuladd.f64(double %42, double 1.000000e-02, double %40)
%44 = load double, double* %9
%45 = call double @llvm.fmuladd.f64(double %44, double 1.000000e-04, double %43)
store double %45, double* %2
ret void
}