char *parselocaltime(date_buf)
char *date_buf;
{
  static char buffer[40];
  char week[30], mon[30], day[30], time[30], year[30];
  if (strlen(date_buf) > 30)
    date_buf[30] = '\0';
  sscanf(date_buf, "%s %s %s %s %s", week, mon, day, time, year);
  sprintf(buffer, "%.4s %.4s %.4s %.10s", day, mon, year, time);
  return buffer;
}


x86 assembly (clang, -O0):
<parselocaltime>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x1e,%rax
jbe    115a <parselocaltime+0x2a>
mov    -0x8(%rbp),%rax
movb   $0x0,0x1e(%rax)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    -0x50(%rbp),%rcx
lea    -0x70(%rbp),%r8
lea    -0x90(%rbp),%r9
lea    -0xb0(%rbp),%rax
lea    0xe81(%rip),%rsi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <sscanf@plt>
lea    -0x70(%rbp),%rdx
lea    -0x50(%rbp),%rcx
lea    -0xb0(%rbp),%r8
lea    -0x90(%rbp),%r9
lea    0x2ea9(%rip),%rdi
lea    0xe61(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    0x2e94(%rip),%rax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parselocaltime>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb0,%rsp
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x1f,%rax
jb     1152 <parselocaltime+0x22>
movb   $0x0,0x1e(%rbx)
lea    0x10(%rsp),%r14
mov    %r14,(%rsp)
lea    0xe9e(%rip),%rsi
lea    0x90(%rsp),%rdx
lea    0x70(%rsp),%r15
lea    0x50(%rsp),%r12
lea    0x30(%rsp),%r13
mov    %rbx,%rdi
mov    %r15,%rcx
mov    %r12,%r8
mov    %r13,%r9
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0x2ebd(%rip),%rbx
lea    0xe75(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
mov    %r13,%r9
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0xb0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@parselocaltime.buffer = internal global [40 x i8] zeroinitializer
@.str = [15 x i8] c"%s %s %s %s %s\00"
@.str.1 = [21 x i8] c"%.4s %.4s %.4s %.10s\00"
define i8* @parselocaltime(i8* %0) {
%2 = alloca i8*
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = alloca [30 x i8]
%6 = alloca [30 x i8]
%7 = alloca [30 x i8]
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = call i64 @strlen(i8* %8)
%10 = icmp ugt i64 %9, 30
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 30
store i8 0, i8* %13
br label %14
14: ; preds = %11, %1
%15 = load i8*, i8** %2
%16 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%17 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%18 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%19 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%20 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%21 = call i32 (i8*, i8*, ...) @sscanf(i8* %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %17, i8* %18, i8* %19, i8* %20)
%22 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%23 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%24 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%25 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%26 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @parselocaltime.buffer, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %22, i8* %23, i8* %24, i8* %25)
ret i8* getelementptr inbounds ([40 x i8], [40 x i8]* @parselocaltime.buffer, i64 0, i64 0)
}

LLVM IR (-O2):
@parselocaltime.buffer = internal global [40 x i8] zeroinitializer
@.str = [15 x i8] c"%s %s %s %s %s\00"
@.str.1 = [21 x i8] c"%.4s %.4s %.4s %.10s\00"
define i8* @parselocaltime(i8* nocapture %0) {
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = alloca [30 x i8]
%6 = alloca [30 x i8]
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%12 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%13 = icmp ugt i64 %12, 30
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = getelementptr inbounds i8, i8* %0, i64 30
store i8 0, i8* %15
br label %16
16: ; preds = %14, %1
%17 = call i32 (i8*, i8*, ...) @sscanf(i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i8* %9, i8* %10, i8* %11)
%18 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @parselocaltime.buffer, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %8, i8* %11, i8* %10)
ret i8* getelementptr inbounds ([40 x i8], [40 x i8]* @parselocaltime.buffer, i64 0, i64 0)
}