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

/* Variables and functions */
int /*<<< orphan*/ memset(struct tm *, int, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ *strptime(char *, char *, struct tm *);
int main(void) {
  int result = 0;
  struct tm tm;
  memset(&tm, 0xaa, sizeof(tm));
  if (strptime("2007", "%Y", &tm) == NULL ||
      strptime("12", "%d", &tm) == NULL || strptime("Feb", "%b", &tm) == NULL ||
      strptime("13", "%M", &tm) == NULL || strptime("21", "%S", &tm) == NULL ||
      strptime("16", "%H", &tm) == NULL) {
    puts("strptimes failed");
    result = 1;
  }
  if (tm.tm_sec != 21 || tm.tm_min != 13 || tm.tm_hour != 16 ||
      tm.tm_mday != 12 || tm.tm_mon != 1 || tm.tm_year != 107 ||
      tm.tm_wday != 1 || tm.tm_yday != 42) {
    puts("unexpected tm content");
    result = 1;
  }
  if (strptime("8", "%d", &tm) == NULL) {
    puts("strptime failed");
    result = 1;
  }
  if (tm.tm_sec != 21 || tm.tm_min != 13 || tm.tm_hour != 16 ||
      tm.tm_mday != 8 || tm.tm_mon != 1 || tm.tm_year != 107 ||
      tm.tm_wday != 4 || tm.tm_yday != 38) {
    puts("unexpected tm content");
    result = 1;
  }
  if (result == 0)
    puts("all OK");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x28(%rbp),%rdi
mov    $0xaa,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
lea    0xea0(%rip),%rdi
lea    0xe9e(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <strptime@plt>
cmp    $0x0,%rax
je     121f <main+0xef>
lea    0xe87(%rip),%rdi
lea    0xe83(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <strptime@plt>
cmp    $0x0,%rax
je     121f <main+0xef>
lea    0xe6c(%rip),%rdi
lea    0xe69(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <strptime@plt>
cmp    $0x0,%rax
je     121f <main+0xef>
lea    0xe52(%rip),%rdi
lea    0xe4e(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <strptime@plt>
cmp    $0x0,%rax
je     121f <main+0xef>
lea    0xe37(%rip),%rdi
lea    0xe33(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <strptime@plt>
cmp    $0x0,%rax
je     121f <main+0xef>
lea    0xe1c(%rip),%rdi
lea    0xe18(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <strptime@plt>
cmp    $0x0,%rax
jne    1232 <main+0x102>
lea    0xe01(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x15,-0x28(%rbp)
jne    1282 <main+0x152>
cmpl   $0xd,-0x24(%rbp)
jne    1282 <main+0x152>
cmpl   $0x10,-0x20(%rbp)
jne    1282 <main+0x152>
cmpl   $0xc,-0x1c(%rbp)
jne    1282 <main+0x152>
cmpl   $0x1,-0x18(%rbp)
jne    1282 <main+0x152>
cmpl   $0x6b,-0x14(%rbp)
jne    1282 <main+0x152>
cmpl   $0x1,-0x10(%rbp)
jne    1282 <main+0x152>
cmpl   $0x2a,-0xc(%rbp)
je     1295 <main+0x165>
lea    0xdaf(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x8(%rbp)
lea    0xdb2(%rip),%rdi
lea    0xd68(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <strptime@plt>
cmp    $0x0,%rax
jne    12c9 <main+0x199>
lea    0xd93(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x15,-0x28(%rbp)
jne    1319 <main+0x1e9>
cmpl   $0xd,-0x24(%rbp)
jne    1319 <main+0x1e9>
cmpl   $0x10,-0x20(%rbp)
jne    1319 <main+0x1e9>
cmpl   $0x8,-0x1c(%rbp)
jne    1319 <main+0x1e9>
cmpl   $0x1,-0x18(%rbp)
jne    1319 <main+0x1e9>
cmpl   $0x6b,-0x14(%rbp)
jne    1319 <main+0x1e9>
cmpl   $0x4,-0x10(%rbp)
jne    1319 <main+0x1e9>
cmpl   $0x26,-0xc(%rbp)
je     132c <main+0x1fc>
lea    0xd18(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1342 <main+0x212>
lea    0xd23(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xaa,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
lea    0xeef(%rip),%rdi
lea    0xeed(%rip),%rsi
mov    %rbx,%rdx
call   1050 <strptime@plt>
test   %rax,%rax
je     11f2 <main+0xc2>
lea    0xed8(%rip),%rdi
lea    0xed4(%rip),%rsi
mov    %rsp,%rdx
call   1050 <strptime@plt>
test   %rax,%rax
je     11f2 <main+0xc2>
lea    0xec3(%rip),%rdi
lea    0xec0(%rip),%rsi
mov    %rsp,%rdx
call   1050 <strptime@plt>
test   %rax,%rax
je     11f2 <main+0xc2>
lea    0xeaf(%rip),%rdi
lea    0xeab(%rip),%rsi
mov    %rsp,%rdx
call   1050 <strptime@plt>
test   %rax,%rax
je     11f2 <main+0xc2>
lea    0xe9a(%rip),%rdi
lea    0xe96(%rip),%rsi
mov    %rsp,%rdx
call   1050 <strptime@plt>
test   %rax,%rax
je     11f2 <main+0xc2>
lea    0xe85(%rip),%rdi
lea    0xe81(%rip),%rsi
mov    %rsp,%rdx
call   1050 <strptime@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    1203 <main+0xd3>
lea    0xe6e(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
movdqa (%rsp),%xmm0
movdqa 0x10(%rsp),%xmm1
pcmpeqd 0xdea(%rip),%xmm1
pcmpeqd %xmm2,%xmm2
pxor   %xmm2,%xmm1
pcmpeqd 0xdea(%rip),%xmm0
pxor   %xmm2,%xmm0
packssdw %xmm1,%xmm0
pmovmskb %xmm0,%eax
test   %eax,%eax
je     1247 <main+0x117>
lea    0xe3b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
lea    0xe40(%rip),%rdi
lea    0xdf6(%rip),%rsi
mov    %rsp,%rdx
call   1050 <strptime@plt>
test   %rax,%rax
jne    1273 <main+0x143>
lea    0xe27(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
movdqa (%rsp),%xmm0
movdqa 0x10(%rsp),%xmm1
pcmpeqd 0xd9a(%rip),%xmm1
pcmpeqd %xmm2,%xmm2
pxor   %xmm2,%xmm1
pcmpeqd 0xd9a(%rip),%xmm0
pxor   %xmm2,%xmm0
packssdw %xmm1,%xmm0
pmovmskb %xmm0,%eax
test   %eax,%eax
je     12b4 <main+0x184>
lea    0xdcb(%rip),%rdi
call   1030 <puts@plt>
jmp    12b8 <main+0x188>
test   %ebx,%ebx
je     12c0 <main+0x190>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret
lea    0xdd9(%rip),%rdi
jmp    12ad <main+0x17d>

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [5 x i8] c"2007\00"
@.str.1 = [3 x i8] c"%Y\00"
@.str.2 = [3 x i8] c"12\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"Feb\00"
@.str.5 = [3 x i8] c"%b\00"
@.str.6 = [3 x i8] c"13\00"
@.str.7 = [3 x i8] c"%M\00"
@.str.8 = [3 x i8] c"21\00"
@.str.9 = [3 x i8] c"%S\00"
@.str.10 = [3 x i8] c"16\00"
@.str.11 = [3 x i8] c"%H\00"
@.str.12 = [17 x i8] c"strptimes failed\00"
@.str.13 = [22 x i8] c"unexpected tm content\00"
@.str.14 = [2 x i8] c"8\00"
@.str.15 = [16 x i8] c"strptime failed\00"
@.str.16 = [7 x i8] c"all OK\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm
store i32 0, i32* %1
store i32 0, i32* %2
%4 = call i32 @memset(%struct.tm* %3, i32 170, i32 32)
%5 = call i32* @strptime(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %3)
%6 = icmp eq i32* %5, null
br i1 %6, label %22, label %7
7: ; preds = %0
%8 = call i32* @strptime(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %struct.tm* %3)
%9 = icmp eq i32* %8, null
br i1 %9, label %22, label %10
10: ; preds = %7
%11 = call i32* @strptime(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %struct.tm* %3)
%12 = icmp eq i32* %11, null
br i1 %12, label %22, label %13
13: ; preds = %10
%14 = call i32* @strptime(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), %struct.tm* %3)
%15 = icmp eq i32* %14, null
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = call i32* @strptime(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), %struct.tm* %3)
%18 = icmp eq i32* %17, null
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = call i32* @strptime(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), %struct.tm* %3)
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %24
22: ; preds = %19, %16, %13, %10, %7, %0
%23 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
store i32 1, i32* %2
br label %24
24: ; preds = %22, %19
%25 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
%26 = load i32, i32* %25
%27 = icmp ne i32 %26, 21
br i1 %27, label %56, label %28
28: ; preds = %24
%29 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 1
%30 = load i32, i32* %29
%31 = icmp ne i32 %30, 13
br i1 %31, label %56, label %32
32: ; preds = %28
%33 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 2
%34 = load i32, i32* %33
%35 = icmp ne i32 %34, 16
br i1 %35, label %56, label %36
36: ; preds = %32
%37 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 3
%38 = load i32, i32* %37
%39 = icmp ne i32 %38, 12
br i1 %39, label %56, label %40
40: ; preds = %36
%41 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 4
%42 = load i32, i32* %41
%43 = icmp ne i32 %42, 1
br i1 %43, label %56, label %44
44: ; preds = %40
%45 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 5
%46 = load i32, i32* %45
%47 = icmp ne i32 %46, 107
br i1 %47, label %56, label %48
48: ; preds = %44
%49 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 6
%50 = load i32, i32* %49
%51 = icmp ne i32 %50, 1
br i1 %51, label %56, label %52
52: ; preds = %48
%53 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 7
%54 = load i32, i32* %53
%55 = icmp ne i32 %54, 42
br i1 %55, label %56, label %58
56: ; preds = %52, %48, %44, %40, %36, %32, %28, %24
%57 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %2
br label %58
58: ; preds = %56, %52
%59 = call i32* @strptime(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %struct.tm* %3)
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0))
store i32 1, i32* %2
br label %63
63: ; preds = %61, %58
%64 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
%65 = load i32, i32* %64
%66 = icmp ne i32 %65, 21
br i1 %66, label %95, label %67
67: ; preds = %63
%68 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 1
%69 = load i32, i32* %68
%70 = icmp ne i32 %69, 13
br i1 %70, label %95, label %71
71: ; preds = %67
%72 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 2
%73 = load i32, i32* %72
%74 = icmp ne i32 %73, 16
br i1 %74, label %95, label %75
75: ; preds = %71
%76 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 3
%77 = load i32, i32* %76
%78 = icmp ne i32 %77, 8
br i1 %78, label %95, label %79
79: ; preds = %75
%80 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 4
%81 = load i32, i32* %80
%82 = icmp ne i32 %81, 1
br i1 %82, label %95, label %83
83: ; preds = %79
%84 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 5
%85 = load i32, i32* %84
%86 = icmp ne i32 %85, 107
br i1 %86, label %95, label %87
87: ; preds = %83
%88 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 6
%89 = load i32, i32* %88
%90 = icmp ne i32 %89, 4
br i1 %90, label %95, label %91
91: ; preds = %87
%92 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 7
%93 = load i32, i32* %92
%94 = icmp ne i32 %93, 38
br i1 %94, label %95, label %97
95: ; preds = %91, %87, %83, %79, %75, %71, %67, %63
%96 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %2
br label %97
97: ; preds = %95, %91
%98 = load i32, i32* %2
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %102
100: ; preds = %97
%101 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0))
br label %102
102: ; preds = %100, %97
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [5 x i8] c"2007\00"
@.str.1 = [3 x i8] c"%Y\00"
@.str.2 = [3 x i8] c"12\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"Feb\00"
@.str.5 = [3 x i8] c"%b\00"
@.str.6 = [3 x i8] c"13\00"
@.str.7 = [3 x i8] c"%M\00"
@.str.8 = [3 x i8] c"21\00"
@.str.9 = [3 x i8] c"%S\00"
@.str.10 = [3 x i8] c"16\00"
@.str.11 = [3 x i8] c"%H\00"
@.str.12 = [17 x i8] c"strptimes failed\00"
@.str.13 = [22 x i8] c"unexpected tm content\00"
@.str.14 = [2 x i8] c"8\00"
@.str.15 = [16 x i8] c"strptime failed\00"
@.str.16 = [7 x i8] c"all OK\00"
define i32 @main() {
%1 = alloca <8 x i32>
%2 = bitcast <8 x i32>* %1 to %struct.tm*
%3 = bitcast <8 x i32>* %1 to i8*
%4 = call i32 @memset(%struct.tm* %2, i32 170, i32 32)
%5 = call i32* @strptime(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %2)
%6 = icmp eq i32* %5, null
br i1 %6, label %22, label %7
7: ; preds = %0
%8 = call i32* @strptime(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %struct.tm* %2)
%9 = icmp eq i32* %8, null
br i1 %9, label %22, label %10
10: ; preds = %7
%11 = call i32* @strptime(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %struct.tm* %2)
%12 = icmp eq i32* %11, null
br i1 %12, label %22, label %13
13: ; preds = %10
%14 = call i32* @strptime(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), %struct.tm* %2)
%15 = icmp eq i32* %14, null
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = call i32* @strptime(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), %struct.tm* %2)
%18 = icmp eq i32* %17, null
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = call i32* @strptime(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), %struct.tm* %2)
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %24
22: ; preds = %19, %16, %13, %10, %7, %0
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
%25 = phi i32 [ 1, %22 ], [ 0, %19 ]
%26 = load <8 x i32>, <8 x i32>* %1
%27 = freeze <8 x i32> %26
%28 = icmp ne <8 x i32> %27, <i32 21, i32 13, i32 16, i32 12, i32 1, i32 107, i32 1, i32 42>
%29 = bitcast <8 x i1> %28 to i8
%30 = icmp eq i8 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %24
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
br label %33
33: ; preds = %24, %31
%34 = phi i32 [ 1, %31 ], [ %25, %24 ]
%35 = call i32* @strptime(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %struct.tm* %2)
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0))
br label %39
39: ; preds = %37, %33
%40 = phi i32 [ 1, %37 ], [ %34, %33 ]
%41 = load <8 x i32>, <8 x i32>* %1
%42 = freeze <8 x i32> %41
%43 = icmp ne <8 x i32> %42, <i32 21, i32 13, i32 16, i32 8, i32 1, i32 107, i32 4, i32 38>
%44 = bitcast <8 x i1> %43 to i8
%45 = icmp eq i8 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %39
%47 = icmp eq i32 %40, 0
br i1 %47, label %48, label %51
48: ; preds = %46, %39
%49 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0), %39 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), %46 ]
%50 = call i32 @puts(i8* dereferenceable(1) %49)
br label %51
51: ; preds = %48, %46
ret i32 0
}