#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_mday;
  int tm_mon;
  int tm_year;
  int tm_hour;
  int tm_min;
  int tm_sec;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
char *strptime(char *, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main() {
  char buf[1024];
  struct tm *t;
  time_t T = time(0);
  t = localtime(&T);
  strftime(buf, sizeof(buf), "%c", t);
  printf("%s\n", strptime(buf, "%c", t));
  printf("%s\n",
         strptime("Tue, 31 May 2005 14:16:16 GMT", "%a, %d %b %Y %T", t));
  printf("%2d.%02d.%d %2d:%02d:%02d\n", t->tm_mday, t->tm_mon + 1,
         t->tm_year + 1900, t->tm_hour, t->tm_min, t->tm_sec);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,-0x41c(%rbp)
lea    -0x41c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x418(%rbp),%rcx
mov    $0x400,%esi
lea    0xe64(%rip),%rdx
call   1060 <strftime@plt>
lea    -0x410(%rbp),%rdi
mov    -0x418(%rbp),%rdx
lea    0xe4a(%rip),%rsi
call   1070 <strptime@plt>
mov    %rax,%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x418(%rbp),%rdx
lea    0xe2d(%rip),%rdi
lea    0xe44(%rip),%rsi
call   1070 <strptime@plt>
mov    %rax,%rsi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x418(%rbp),%rax
mov    (%rax),%esi
mov    -0x418(%rbp),%rax
mov    0x4(%rax),%edx
add    $0x1,%edx
mov    -0x418(%rbp),%rax
mov    0x8(%rax),%ecx
add    $0x76c,%ecx
mov    -0x418(%rbp),%rax
mov    0xc(%rax),%r8d
mov    -0x418(%rbp),%rax
mov    0x10(%rax),%r9d
mov    -0x418(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xdf1(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x410,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
lea    0xe75(%rip),%r14
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
mov    %rax,%rcx
call   1070 <strftime@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1080 <strptime@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
lea    0xe43(%rip),%rdi
lea    0xe5a(%rip),%rsi
mov    %rbx,%rdx
call   1080 <strptime@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    (%rbx),%esi
mov    0x4(%rbx),%edx
mov    $0x76c,%ecx
add    0x8(%rbx),%ecx
add    $0x1,%edx
mov    0xc(%rbx),%r8d
mov    0x10(%rbx),%r9d
mov    0x14(%rbx),%eax
mov    %eax,(%rsp)
lea    0xe35(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [30 x i8] c"Tue, 31 May 2005 14:16:16 GMT\00"
@.str.3 = [16 x i8] c"%a, %d %b %Y %T\00"
@.str.4 = [27 x i8] c"%2d.%02d.%d %2d:%02d:%02d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca %struct.tm*
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @time(i32 0)
store i32 %5, i32* %4
%6 = call %struct.tm* @localtime(i32* %4)
store %struct.tm* %6, %struct.tm** %3
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%8 = load %struct.tm*, %struct.tm** %3
%9 = call i32 @strftime(i8* %7, i32 1024, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %struct.tm* %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%11 = load %struct.tm*, %struct.tm** %3
%12 = call i8* @strptime(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %struct.tm* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load %struct.tm*, %struct.tm** %3
%15 = call i8* @strptime(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %struct.tm* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load %struct.tm*, %struct.tm** %3
%18 = getelementptr inbounds %struct.tm, %struct.tm* %17, i32 0, i32 0
%19 = load i32, i32* %18
%20 = load %struct.tm*, %struct.tm** %3
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 1
%22 = load i32, i32* %21
%23 = add nsw i32 %22, 1
%24 = load %struct.tm*, %struct.tm** %3
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 2
%26 = load i32, i32* %25
%27 = add nsw i32 %26, 1900
%28 = load %struct.tm*, %struct.tm** %3
%29 = getelementptr inbounds %struct.tm, %struct.tm* %28, i32 0, i32 3
%30 = load i32, i32* %29
%31 = load %struct.tm*, %struct.tm** %3
%32 = getelementptr inbounds %struct.tm, %struct.tm* %31, i32 0, i32 4
%33 = load i32, i32* %32
%34 = load %struct.tm*, %struct.tm** %3
%35 = getelementptr inbounds %struct.tm, %struct.tm* %34, i32 0, i32 5
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %19, i32 %23, i32 %27, i32 %30, i32 %33, i32 %36)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [3 x i8] c"%c\00"
@.str.2 = [30 x i8] c"Tue, 31 May 2005 14:16:16 GMT\00"
@.str.3 = [16 x i8] c"%a, %d %b %Y %T\00"
@.str.4 = [27 x i8] c"%2d.%02d.%d %2d:%02d:%02d\0A\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @time(i32 0)
store i32 %5, i32* %2
%6 = call %struct.tm* @localtime(i32* %2)
%7 = call i32 @strftime(i8* %3, i32 1024, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
%8 = call i8* @strptime(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
%9 = call i32 @puts(i8* dereferenceable(1) %8)
%10 = call i8* @strptime(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %struct.tm* %6)
%11 = call i32 @puts(i8* dereferenceable(1) %10)
%12 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
%17 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 1900
%20 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 3
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 4
%23 = load i32, i32* %22
%24 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 5
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %13, i32 %16, i32 %19, i32 %21, i32 %23, i32 %25)
ret i32 0
}