#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_sec;
  int tm_min;
  int tm_hour;
  int tm_mday;
  int tm_mon;
  int tm_year;
  scalar_t__ tm_wday;
  int tm_yday;
  scalar_t__ tm_isdst;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ memset(struct tm *, int /*<<< orphan*/, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strptime(char *, char *, struct tm *);
void strptime_test(void) {
  struct tm tm;
  memset(&tm, 0, sizeof(struct tm));
  strptime("2015-11-08 07:42:31", "%Y-%m-%d %H:%M:%S", &tm);
  assert(tm.tm_sec == 31);
  assert(tm.tm_min == 42);
  assert(tm.tm_hour == 7);
  assert(tm.tm_mday == 8);
  assert(tm.tm_mon == 10);
  assert(tm.tm_year == 115);
  assert(tm.tm_wday == 0);
  assert(tm.tm_yday == 311);
  assert(tm.tm_isdst == 0);
  puts("strptime ok");
}


x86 assembly (clang, -O0):
<strptime_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
lea    0xea1(%rip),%rdi
lea    0xeae(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1060 <strptime@plt>
cmpl   $0x1f,-0x30(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x2a,-0x2c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x7,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x8,-0x24(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0xa,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x73,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x137,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpq   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe12(%rip),%rdi
call   1030 <puts@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strptime_test>:
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
lea    0xea2(%rip),%rdi
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdx
call   1060 <strptime@plt>
xor    %edi,%edi
cmpl   $0x1f,(%rsp)
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0x2a,0x4(%rsp)
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0x7,0x8(%rsp)
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0x8,0xc(%rsp)
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0xa,0x10(%rsp)
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0x73,0x14(%rsp)
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpq   $0x0,0x18(%rsp)
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0x137,0x20(%rsp)
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpq   $0x0,0x28(%rsp)
sete   %dil
call   1050 <assert@plt>
lea    0xe1e(%rip),%rdi
call   1030 <puts@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i64, i32, i64 }
@.str = [20 x i8] c"2015-11-08 07:42:31\00"
@.str.1 = [18 x i8] c"%Y-%m-%d %H:%M:%S\00"
@.str.2 = [12 x i8] c"strptime ok\00"
define void @strptime_test() {
%1 = alloca %struct.tm
%2 = call i32 @memset(%struct.tm* %1, i32 0, i32 48)
%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, i32 0, i32 0
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 31
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 1
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 42
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 2
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 7
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 3
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 8
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 4
%25 = load i32, i32* %24
%26 = icmp eq i32 %25, 10
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 5
%30 = load i32, i32* %29
%31 = icmp eq i32 %30, 115
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 6
%35 = load i64, i64* %34
%36 = icmp eq i64 %35, 0
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 7
%40 = load i32, i32* %39
%41 = icmp eq i32 %40, 311
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 8
%45 = load i64, i64* %44
%46 = icmp eq i64 %45, 0
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
%49 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i64, i32, i64 }
@.str = [20 x i8] c"2015-11-08 07:42:31\00"
@.str.1 = [18 x i8] c"%Y-%m-%d %H:%M:%S\00"
@.str.2 = [12 x i8] c"strptime ok\00"
define void @strptime_test() {
%1 = alloca %struct.tm
%2 = bitcast %struct.tm* %1 to i8*
%3 = call i32 @memset(%struct.tm* %1, i32 0, i32 48)
%4 = 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)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 31
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 1
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 42
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 2
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 7
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 3
%21 = load i32, i32* %20
%22 = icmp eq i32 %21, 8
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 4
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 10
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 5
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 115
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 6
%36 = load i64, i64* %35
%37 = icmp eq i64 %36, 0
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 7
%41 = load i32, i32* %40
%42 = icmp eq i32 %41, 311
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 8
%46 = load i64, i64* %45
%47 = icmp eq i64 %46, 0
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret void
}