#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 */
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int);
int /*<<< orphan*/ strptime(char const *, char *, struct tm *);
int main(void) {
  struct tm stm;
  const char *str = "2015/06/01 12:00:00";
  strptime(str, "%Y/%m/%d %H:%M:%S", &stm);
  printf("%4d/%02d/%02d %2d:%02d:%02d\n", stm.tm_year + 1900, stm.tm_mon + 1,
         stm.tm_mday, stm.tm_hour, stm.tm_min, stm.tm_sec);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xecf(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <strptime@plt>
mov    -0x20(%rbp),%esi
add    $0x76c,%esi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    -0xc(%rbp),%eax
lea    0xeb4(%rip),%rdi
mov    %eax,(%rsp)
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0xed5(%rip),%rdi
lea    0xee2(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1040 <strptime@plt>
mov    $0x76c,%esi
add    0x10(%rsp),%esi
mov    0x14(%rsp),%edx
mov    0x18(%rsp),%ecx
add    $0x1,%edx
mov    0x1c(%rsp),%r8d
mov    0x20(%rsp),%r9d
mov    0x24(%rsp),%eax
mov    %eax,(%rsp)
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [20 x i8] c"2015/06/01 12:00:00\00"
@.str.1 = [18 x i8] c"%Y/%m/%d %H:%M:%S\00"
@.str.2 = [29 x i8] c"%4d/%02d/%02d %2d:%02d:%02d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strptime(i8* %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %2)
%6 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
%7 = load i32, i32* %6
%8 = add nsw i32 %7, 1900
%9 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 1
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1
%12 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 2
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 3
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 4
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 5
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %11, i32 %13, i32 %15, i32 %17, i32 %19)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [20 x i8] c"2015/06/01 12:00:00\00"
@.str.1 = [18 x i8] c"%Y/%m/%d %H:%M:%S\00"
@.str.2 = [29 x i8] c"%4d/%02d/%02d %2d:%02d:%02d\0A\00"
define i32 @main() {
%1 = alloca %struct.tm
%2 = bitcast %struct.tm* %1 to i8*
%3 = call i32 @strptime(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %1)
%4 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = add nsw i32 %5, 1900
%7 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1
%10 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 2
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 3
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 4
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 5
%17 = load i32, i32* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %9, i32 %11, i32 %13, i32 %15, i32 %17)
ret i32 0
}