void makedate_(nchars, sdate, iarr) int *nchars;
char *sdate;
int *iarr;
{
  int i, nc;
  if (datestyle_(0) || iarr[2] >= 2000) {
    sprintf(sdate, "%04d-%02d-%02d", iarr[2], iarr[1], iarr[0]);
    nc = 10;
  } else {
    sprintf(sdate, "%02d/%02d/%02d", iarr[0], iarr[1], (iarr[2] - 1900));
    nc = 8;
  }
  for (i = nc; i < *nchars; i++)
    sdate[i] = ' ';
}


x86 assembly (clang, -O0):
<makedate_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %edi,%edi
mov    $0x0,%al
call   1030 <datestyle_@plt>
cmp    $0x0,%eax
jne    1157 <makedate_+0x37>
mov    -0x18(%rbp),%rax
cmpl   $0x7d0,0x8(%rax)
jl     118a <makedate_+0x6a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    (%rax),%r8d
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0xa,-0x20(%rbp)
jmp    11bf <makedate_+0x9f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%r8d
sub    $0x76c,%r8d
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x8,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jge    11ee <makedate_+0xce>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c5 <makedate_+0xa5>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makedate_>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
xor    %eax,%eax
call   1030 <datestyle_@plt>
mov    0x8(%r15),%r9d
test   %eax,%eax
jne    1175 <makedate_+0x55>
cmp    $0x7d0,%r9d
jge    1175 <makedate_+0x55>
mov    (%r15),%edx
mov    0x4(%r15),%ecx
add    $0xfffff894,%r9d
lea    0xeb2(%rip),%rsi
mov    %r14,%rdi
mov    %r9d,%r8d
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    $0x8,%eax
cmp    (%rbx),%eax
jl     1199 <makedate_+0x79>
jmp    11b1 <makedate_+0x91>
mov    (%r15),%r8d
mov    0x4(%r15),%ecx
lea    0xe7d(%rip),%rsi
mov    %r14,%rdi
mov    %r9d,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    $0xa,%eax
cmp    (%rbx),%eax
jge    11b1 <makedate_+0x91>
mov    %eax,%eax
nopl   0x0(%rax,%rax,1)
movb   $0x20,(%r14,%rax,1)
add    $0x1,%rax
movslq (%rbx),%rcx
cmp    %rcx,%rax
jl     11a0 <makedate_+0x80>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%04d-%02d-%02d\00"
@.str.1 = [15 x i8] c"%02d/%02d/%02d\00"
define void @makedate_(i32* %0, i8* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%9 = call i32 (i32, ...) bitcast (i32 (...)* @datestyle_ to i32 (i32, ...)*)(i32 0)
%10 = icmp ne i32 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %3
%12 = load i32*, i32** %6
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = icmp sge i32 %14, 2000
br i1 %15, label %16, label %28
16: ; preds = %11, %3
%17 = load i8*, i8** %5
%18 = load i32*, i32** %6
%19 = getelementptr inbounds i32, i32* %18, i64 2
%20 = load i32, i32* %19
%21 = load i32*, i32** %6
%22 = getelementptr inbounds i32, i32* %21, i64 1
%23 = load i32, i32* %22
%24 = load i32*, i32** %6
%25 = getelementptr inbounds i32, i32* %24, i64 0
%26 = load i32, i32* %25
%27 = call i32 (i8*, i8*, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %23, i32 %26)
store i32 10, i32* %8
br label %41
28: ; preds = %11
%29 = load i8*, i8** %5
%30 = load i32*, i32** %6
%31 = getelementptr inbounds i32, i32* %30, i64 0
%32 = load i32, i32* %31
%33 = load i32*, i32** %6
%34 = getelementptr inbounds i32, i32* %33, i64 1
%35 = load i32, i32* %34
%36 = load i32*, i32** %6
%37 = getelementptr inbounds i32, i32* %36, i64 2
%38 = load i32, i32* %37
%39 = sub nsw i32 %38, 1900
%40 = call i32 (i8*, i8*, ...) @sprintf(i8* %29, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %32, i32 %35, i32 %39)
store i32 8, i32* %8
br label %41
41: ; preds = %28, %16
%42 = load i32, i32* %8
store i32 %42, i32* %7
br label %43
43: ; preds = %53, %41
%44 = load i32, i32* %7
%45 = load i32*, i32** %4
%46 = load i32, i32* %45
%47 = icmp slt i32 %44, %46
br i1 %47, label %48, label %56
48: ; preds = %43
%49 = load i8*, i8** %5
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
store i8 32, i8* %52
br label %53
53: ; preds = %48
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %43
56: ; preds = %43
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%04d-%02d-%02d\00"
@.str.1 = [15 x i8] c"%02d/%02d/%02d\00"
define void @makedate_(i32* nocapture %0, i8* nocapture writeonly %1, i32* nocapture %2) {
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @datestyle_ to i32 (i32, ...)*)(i32 0)
%5 = icmp ne i32 %4, 0
%6 = getelementptr inbounds i32, i32* %2, i64 2
%7 = load i32, i32* %6
%8 = icmp sgt i32 %7, 1999
%9 = select i1 %5, i1 true, i1 %8
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = getelementptr inbounds i32, i32* %2, i64 1
%12 = load i32, i32* %11
%13 = load i32, i32* %2
%14 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %12, i32 %13)
br label %21
15: ; preds = %3
%16 = load i32, i32* %2
%17 = getelementptr inbounds i32, i32* %2, i64 1
%18 = load i32, i32* %17
%19 = add nsw i32 %7, -1900
%20 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %18, i32 %19)
br label %21
21: ; preds = %15, %10
%22 = phi i32 [ 10, %10 ], [ 8, %15 ]
%23 = load i32, i32* %0
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %34
25: ; preds = %21
%26 = zext i32 %22 to i64
br label %27
27: ; preds = %25, %27
%28 = phi i64 [ %26, %25 ], [ %30, %27 ]
%29 = getelementptr inbounds i8, i8* %1, i64 %28
store i8 32, i8* %29
%30 = add nuw nsw i64 %28, 1
%31 = load i32, i32* %0
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %30, %32
br i1 %33, label %27, label %34
34: ; preds = %27, %21
ret void
}