long DayNum(m, d, y)
int m, d, y;
{
  long dn;
  double mm, yy;
  if (m < 3) {
    y--;
    m += 12;
  }
  if (y < 57)
    y += 100;
  yy = (double)y;
  mm = (double)m;
  dn = (long)(floor(365.25 * (yy - 80.0)) - floor(19.0 + yy / 100.0) +
              floor(4.75 + yy / 400.0) - 16.0);
  dn += d + 30 * m + (long)floor(0.6 * mm - 0.3);
  return dn;
}


x86 assembly (clang, -O0):
<DayNum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    113d <DayNum+0x2d>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x39,-0xc(%rbp)
jge    1150 <DayNum+0x40>
mov    -0xc(%rbp),%eax
add    $0x64,%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  0xecf(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xebb(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <floor@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  0xe98(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe84(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  0xe55(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe41(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe1c(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
imul   $0x1e,-0x4(%rbp),%ecx
add    %ecx,%eax
cltq
mov    %rax,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xde3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xddf(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <floor@plt>
mov    -0x30(%rbp),%rax
cvttsd2si %xmm0,%rcx
add    %rcx,%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DayNum>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %esi,%r14d
lea    0xc(%rdi),%ebp
xor    %eax,%eax
cmp    $0x3,%edi
setl   %al
cmovge %edi,%ebp
sub    %eax,%edx
lea    0x64(%rdx),%eax
cmp    $0x39,%edx
cmovge %edx,%eax
cvtsi2sd %eax,%xmm1
movsd  %xmm1,0x10(%rsp)
cvtsi2sd %ebp,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0xeb0(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xeac(%rip),%xmm0
call   1030 <floor@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
divsd  0xe9b(%rip),%xmm0
addsd  0xe9b(%rip),%xmm0
call   1030 <floor@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
divsd  0xe80(%rip),%xmm0
addsd  0xe80(%rip),%xmm0
call   1030 <floor@plt>
addsd  0x8(%rsp),%xmm0
addsd  0xe75(%rip),%xmm0
cvttsd2si %xmm0,%rbx
mov    %ebp,%eax
shl    $0x5,%eax
sub    %ebp,%eax
sub    %ebp,%eax
add    %r14d,%eax
movslq %eax,%rbp
movsd  0x18(%rsp),%xmm0
mulsd  0xe5b(%rip),%xmm0
addsd  0xe5b(%rip),%xmm0
call   1030 <floor@plt>
cvttsd2si %xmm0,%rax
add    %rbp,%rax
add    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i64 @DayNum(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca double
%9 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i32, i32* %6
%14 = add nsw i32 %13, -1
store i32 %14, i32* %6
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 12
store i32 %16, i32* %4
br label %17
17: ; preds = %12, %3
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 57
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 100
store i32 %22, i32* %6
br label %23
23: ; preds = %20, %17
%24 = load i32, i32* %6
%25 = sitofp i32 %24 to double
store double %25, double* %9
%26 = load i32, i32* %4
%27 = sitofp i32 %26 to double
store double %27, double* %8
%28 = load double, double* %9
%29 = fsub double %28, 8.000000e+01
%30 = fmul double 3.652500e+02, %29
%31 = call double @llvm.floor.f64(double %30)
%32 = load double, double* %9
%33 = fdiv double %32, 1.000000e+02
%34 = fadd double 1.900000e+01, %33
%35 = call double @llvm.floor.f64(double %34)
%36 = fsub double %31, %35
%37 = load double, double* %9
%38 = fdiv double %37, 4.000000e+02
%39 = fadd double 4.750000e+00, %38
%40 = call double @llvm.floor.f64(double %39)
%41 = fadd double %36, %40
%42 = fsub double %41, 1.600000e+01
%43 = fptosi double %42 to i64
store i64 %43, i64* %7
%44 = load i32, i32* %5
%45 = load i32, i32* %4
%46 = mul nsw i32 30, %45
%47 = add nsw i32 %44, %46
%48 = sext i32 %47 to i64
%49 = load double, double* %8
%50 = call double @llvm.fmuladd.f64(double 6.000000e-01, double %49, double -3.000000e-01)
%51 = call double @llvm.floor.f64(double %50)
%52 = fptosi double %51 to i64
%53 = add nsw i64 %48, %52
%54 = load i64, i64* %7
%55 = add nsw i64 %54, %53
store i64 %55, i64* %7
%56 = load i64, i64* %7
ret i64 %56
}

LLVM IR (-O2):
define i64 @DayNum(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, 3
%5 = add nsw i32 %0, 12
%6 = sext i1 %4 to i32
%7 = add nsw i32 %6, %2
%8 = select i1 %4, i32 %5, i32 %0
%9 = icmp slt i32 %7, 57
%10 = add nsw i32 %7, 100
%11 = select i1 %9, i32 %10, i32 %7
%12 = sitofp i32 %11 to double
%13 = sitofp i32 %8 to double
%14 = fadd double %12, -8.000000e+01
%15 = fmul double %14, 3.652500e+02
%16 = tail call double @llvm.floor.f64(double %15)
%17 = fdiv double %12, 1.000000e+02
%18 = fadd double %17, 1.900000e+01
%19 = tail call double @llvm.floor.f64(double %18)
%20 = fsub double %16, %19
%21 = fdiv double %12, 4.000000e+02
%22 = fadd double %21, 4.750000e+00
%23 = tail call double @llvm.floor.f64(double %22)
%24 = fadd double %23, %20
%25 = fadd double %24, -1.600000e+01
%26 = fptosi double %25 to i64
%27 = mul nsw i32 %8, 30
%28 = add nsw i32 %27, %1
%29 = sext i32 %28 to i64
%30 = tail call double @llvm.fmuladd.f64(double %13, double 6.000000e-01, double -3.000000e-01)
%31 = tail call double @llvm.floor.f64(double %30)
%32 = fptosi double %31 to i64
%33 = add nsw i64 %32, %29
%34 = add nsw i64 %33, %26
ret i64 %34
}