void dt2doy(date, time, year, doy) double date;
double time;
int *year;
double *doy;
{
  double dj;
  double dj0;
  double date0;
  double dyear;
  dyear = floor(date);
  date0 = dyear + 0.0101;
  dj0 = dt2jd(date0, 0.0);
  dj = dt2jd(date, time);
  *year = (int)(dyear + 0.00000001);
  *doy = dj - dj0 + 1.0;
  return;
}


x86 assembly (clang, -O0):
<dt2doy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  0xebf(%rip),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
mov    $0x2,%al
call   1030 <dt2jd@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    $0x2,%al
call   1030 <dt2jd@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe73(%rip),%xmm0
addsd  -0x40(%rbp),%xmm0
cvttsd2si %xmm0,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x28(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  0xe4a(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dt2doy>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x10(%rsp)
call   1040 <floor@plt>
movapd %xmm0,%xmm1
movsd  %xmm0,0x18(%rsp)
movsd  0xeb0(%rip),%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
mov    $0x2,%al
call   1030 <dt2jd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mov    $0x2,%al
call   1030 <dt2jd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
addsd  0xe6e(%rip),%xmm1
cvttsd2si %xmm1,%eax
mov    %eax,(%rbx)
addsd  0xe68(%rip),%xmm0
movsd  %xmm0,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @dt2doy(double %0, double %1, i32* %2, double* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca i32*
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %5
store double %1, double* %6
store i32* %2, i32** %7
store double* %3, double** %8
%13 = load double, double* %5
%14 = call double @llvm.floor.f64(double %13)
store double %14, double* %12
%15 = load double, double* %12
%16 = fadd double %15, 1.010000e-02
store double %16, double* %11
%17 = load double, double* %11
%18 = call i32 (double, double, ...) bitcast (i32 (...)* @dt2jd to i32 (double, double, ...)*)(double %17, double 0.000000e+00)
%19 = sitofp i32 %18 to double
store double %19, double* %10
%20 = load double, double* %5
%21 = load double, double* %6
%22 = call i32 (double, double, ...) bitcast (i32 (...)* @dt2jd to i32 (double, double, ...)*)(double %20, double %21)
%23 = sitofp i32 %22 to double
store double %23, double* %9
%24 = load double, double* %12
%25 = fadd double %24, 1.000000e-08
%26 = fptosi double %25 to i32
%27 = load i32*, i32** %7
store i32 %26, i32* %27
%28 = load double, double* %9
%29 = load double, double* %10
%30 = fsub double %28, %29
%31 = fadd double %30, 1.000000e+00
%32 = load double*, double** %8
store double %31, double* %32
ret void
}

LLVM IR (-O2):
define void @dt2doy(double %0, double %1, i32* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = tail call double @llvm.floor.f64(double %0)
%6 = fadd double %5, 1.010000e-02
%7 = tail call i32 (double, double, ...) bitcast (i32 (...)* @dt2jd to i32 (double, double, ...)*)(double %6, double 0.000000e+00)
%8 = sitofp i32 %7 to double
%9 = tail call i32 (double, double, ...) bitcast (i32 (...)* @dt2jd to i32 (double, double, ...)*)(double %0, double %1)
%10 = sitofp i32 %9 to double
%11 = fadd double %5, 1.000000e-08
%12 = fptosi double %11 to i32
store i32 %12, i32* %2
%13 = fsub double %10, %8
%14 = fadd double %13, 1.000000e+00
store double %14, double* %3
ret void
}