#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 dummy;
};

/* Variables and functions */
scalar_t__ strptime(char *, char *, struct tm **);
int parse_date(char *date, struct tm *tm) {
  char *format;
  char *formats[] = {
      "%F %I",
      "%F %T",
      "%F %R",
      NULL,
  };
  for (format = formats[0]; format; ++format) {
    if (strptime(date, format, &tm)) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<parse_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2cd9(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2cd6(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2cd3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cd0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     119c <parse_date+0x8c>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <strptime@plt>
cmp    $0x0,%rax
je     1186 <parse_date+0x76>
movl   $0x1,-0x4(%rbp)
jmp    11a3 <parse_date+0x93>
jmp    118b <parse_date+0x7b>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1154 <parse_date+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_date>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
mov    %rsi,0x8(%rsp)
lea    0xed8(%rip),%rbx
lea    0x8(%rsp),%r15
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <strptime@plt>
add    $0x1,%rbx
test   %rax,%rax
je     1130 <parse_date+0x20>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [6 x i8] c"%F %I\00"
@.str.1 = [6 x i8] c"%F %T\00"
@.str.2 = [6 x i8] c"%F %R\00"
@__const.parse_date.formats = [4 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* null]
define i32 @parse_date(i8* %0, %struct.tm* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.tm*
%6 = alloca i8*
%7 = alloca [4 x i8*]
store i8* %0, i8** %4
store %struct.tm* %1, %struct.tm** %5
%8 = bitcast [4 x i8*]* %7 to i8*
%9 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 0
%10 = load i8*, i8** %9
store i8* %10, i8** %6
br label %11
11: ; preds = %21, %2
%12 = load i8*, i8** %6
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i8*, i8** %4
%16 = load i8*, i8** %6
%17 = call i64 @strptime(i8* %15, i8* %16, %struct.tm** %5)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %14
store i32 1, i32* %3
br label %25
20: ; preds = %14
br label %21
21: ; preds = %20
%22 = load i8*, i8** %6
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %6
br label %11
24: ; preds = %11
store i32 0, i32* %3
br label %25
25: ; preds = %24, %19
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [6 x i8] c"%F %I\00"
define i32 @parse_date(i8* %0, %struct.tm* %1) {
%3 = alloca %struct.tm*
store %struct.tm* %1, %struct.tm** %3
br label %4
4: ; preds = %4, %2
%5 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %2 ], [ %8, %4 ]
%6 = call i64 @strptime(i8* %0, i8* %5, %struct.tm** %3)
%7 = icmp eq i64 %6, 0
%8 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %7, label %4, label %9
9: ; preds = %4
ret i32 1
}