char *fd2of(string)
char *string;
{
  int iyr, imon, iday, ihr, imn;
  double sec;
  fd2i(string, &iyr, &imon, &iday, &ihr, &imn, &sec, 3);
  string = (char *)calloc(32, sizeof(char));
  if (iyr < 1900)
    sprintf(string, "*** date out of range ***");
  else if (iyr < 2000)
    sprintf(string, "%02d/%02d/%02d %02d:%02d:%06.3f", iday, imon, iyr - 1900,
            ihr, imn, sec);
  else if (iyr < 2900.0)
    sprintf(string, "%02d/%02d/%3d %02d:%02d:%6.3f", iday, imon, iyr - 1900,
            ihr, imn, sec);
  else
    sprintf(string, "*** date out of range ***");
  return (string);
}


x86 assembly (clang, -O0):
<fd2of>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
lea    -0x1c(%rbp),%r9
lea    -0x28(%rbp),%rax
mov    %rax,(%rsp)
movl   $0x3,0x8(%rsp)
mov    $0x0,%al
call   1050 <fd2i@plt>
mov    $0x20,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,-0x8(%rbp)
cmpl   $0x76c,-0xc(%rbp)
jge    11a2 <fd2of+0x72>
mov    -0x8(%rbp),%rdi
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1250 <fd2of+0x120>
cmpl   $0x7d0,-0xc(%rbp)
jge    11e6 <fd2of+0xb6>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%r8d
sub    $0x76c,%r8d
mov    -0x18(%rbp),%r9d
mov    -0x1c(%rbp),%eax
movsd  -0x28(%rbp),%xmm0
lea    0xe4b(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x1,%al
call   1040 <sprintf@plt>
jmp    124b <fd2of+0x11b>
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xe0d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1234 <fd2of+0x104>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%r8d
sub    $0x76c,%r8d
mov    -0x18(%rbp),%r9d
mov    -0x1c(%rbp),%eax
movsd  -0x28(%rbp),%xmm0
lea    0xe1d(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x1,%al
call   1040 <sprintf@plt>
jmp    1246 <fd2of+0x116>
mov    -0x8(%rbp),%rdi
lea    0xdc9(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    124b <fd2of+0x11b>
jmp    1250 <fd2of+0x120>
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd2of>:
push   %rbx
sub    $0x30,%rsp
lea    0x28(%rsp),%rax
mov    %rax,(%rsp)
movl   $0x3,0x8(%rsp)
lea    0x24(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x1c(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x14(%rsp),%r9
xor    %eax,%eax
call   1050 <fd2i@plt>
mov    $0x20,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,%rbx
mov    0x24(%rsp),%r8d
cmp    $0x76b,%r8d
jle    11f6 <fd2of+0xc6>
cmp    $0x7cf,%r8d
ja     11b9 <fd2of+0x89>
mov    0x1c(%rsp),%edx
mov    0x20(%rsp),%ecx
add    $0xfffff894,%r8d
mov    0x18(%rsp),%r9d
mov    0x14(%rsp),%eax
movsd  0x28(%rsp),%xmm0
mov    %eax,(%rsp)
lea    0xe63(%rip),%rsi
jmp    11ea <fd2of+0xba>
cmp    $0xb53,%r8d
ja     11f6 <fd2of+0xc6>
mov    0x1c(%rsp),%edx
mov    0x20(%rsp),%ecx
add    $0xfffff894,%r8d
mov    0x18(%rsp),%r9d
mov    0x14(%rsp),%eax
movsd  0x28(%rsp),%xmm0
mov    %eax,(%rsp)
lea    0xe50(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <sprintf@plt>
jmp    120b <fd2of+0xdb>
movups 0xe0d(%rip),%xmm0
movups %xmm0,0xa(%rbx)
movups 0xdf8(%rip),%xmm0
movups %xmm0,(%rbx)
mov    %rbx,%rax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"*** date out of range ***\00"
@.str.1 = [32 x i8] c"%02d/%02d/%02d %02d:%02d:%06.3f\00"
@.str.2 = [30 x i8] c"%02d/%02d/%3d %02d:%02d:%6.3f\00"
define i8* @fd2of(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
store i8* %0, i8** %2
%9 = load i8*, i8** %2
%10 = call i32 (i8*, i32*, i32*, i32*, i32*, i32*, double*, i32, ...) bitcast (i32 (...)* @fd2i to i32 (i8*, i32*, i32*, i32*, i32*, i32*, double*, i32, ...)*)(i8* %9, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, double* %8, i32 3)
%11 = call i8* @calloc(i64 32, i64 1)
store i8* %11, i8** %2
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 1900
br i1 %13, label %14, label %17
14: ; preds = %1
%15 = load i8*, i8** %2
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* %15, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %49
17: ; preds = %1
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 2000
br i1 %19, label %20, label %30
20: ; preds = %17
%21 = load i8*, i8** %2
%22 = load i32, i32* %5
%23 = load i32, i32* %4
%24 = load i32, i32* %3
%25 = sub nsw i32 %24, 1900
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = load double, double* %8
%29 = call i32 (i8*, i8*, ...) @sprintf(i8* %21, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %23, i32 %25, i32 %26, i32 %27, double %28)
br label %48
30: ; preds = %17
%31 = load i32, i32* %3
%32 = sitofp i32 %31 to double
%33 = fcmp olt double %32, 2.900000e+03
br i1 %33, label %34, label %44
34: ; preds = %30
%35 = load i8*, i8** %2
%36 = load i32, i32* %5
%37 = load i32, i32* %4
%38 = load i32, i32* %3
%39 = sub nsw i32 %38, 1900
%40 = load i32, i32* %6
%41 = load i32, i32* %7
%42 = load double, double* %8
%43 = call i32 (i8*, i8*, ...) @sprintf(i8* %35, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %36, i32 %37, i32 %39, i32 %40, i32 %41, double %42)
br label %47
44: ; preds = %30
%45 = load i8*, i8** %2
%46 = call i32 (i8*, i8*, ...) @sprintf(i8* %45, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %47
47: ; preds = %44, %34
br label %48
48: ; preds = %47, %20
br label %49
49: ; preds = %48, %14
%50 = load i8*, i8** %2
ret i8* %50
}

LLVM IR (-O2):
@.str = [26 x i8] c"*** date out of range ***\00"
@.str.1 = [32 x i8] c"%02d/%02d/%02d %02d:%02d:%06.3f\00"
@.str.2 = [30 x i8] c"%02d/%02d/%3d %02d:%02d:%6.3f\00"
define i8* @fd2of(i8* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = bitcast double* %7 to i8*
%14 = call i32 (i8*, i32*, i32*, i32*, i32*, i32*, double*, i32, ...) bitcast (i32 (...)* @fd2i to i32 (i8*, i32*, i32*, i32*, i32*, i32*, double*, i32, ...)*)(i8* %0, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, double* %7, i32 3)
%15 = call dereferenceable_or_null(32) i8* @calloc(i64 32, i64 1)
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 1900
br i1 %17, label %18, label %19
18: ; preds = %1
br label %40
19: ; preds = %1
%20 = icmp ult i32 %16, 2000
br i1 %20, label %21, label %29
21: ; preds = %19
%22 = load i32, i32* %4
%23 = load i32, i32* %3
%24 = add nsw i32 %16, -1900
%25 = load i32, i32* %5
%26 = load i32, i32* %6
%27 = load double, double* %7
%28 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %15, i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %23, i32 %24, i32 %25, i32 %26, double %27)
br label %40
29: ; preds = %19
%30 = icmp ult i32 %16, 2900
br i1 %30, label %31, label %39
31: ; preds = %29
%32 = load i32, i32* %4
%33 = load i32, i32* %3
%34 = add nsw i32 %16, -1900
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = load double, double* %7
%38 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %15, i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %32, i32 %33, i32 %34, i32 %35, i32 %36, double %37)
br label %40
39: ; preds = %29
br label %40
40: ; preds = %21, %39, %31, %18
ret i8* %15
}