#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 */

/* Variables and functions */
int /*<<< orphan*/ isRightfulDate(char *);
int /*<<< orphan*/ isTime(char *);
int /*<<< orphan*/ memcpy(char *, char const *, int);
int strlen(char const *);
int isDatetime(const char *sDatetime) {
  if (!sDatetime || strlen(sDatetime) != 14)
    return 0;
  char sDate[8 + 1];
  char sTime[6 + 1];
  if (strlen(sDatetime) != 14)
    return 0;
  memcpy(sDate, sDatetime, 8);
  sDate[8] = 0;
  if (!isRightfulDate(sDate))
    return 0;
  memcpy(sTime, &sDatetime[8], 6);
  sTime[6] = 0;
  if (!isTime(sTime))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<isDatetime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1169 <isDatetime+0x29>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xe,%eax
je     1175 <isDatetime+0x35>
movl   $0x0,-0x4(%rbp)
jmp    1206 <isDatetime+0xc6>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xe,%eax
je     1193 <isDatetime+0x53>
movl   $0x0,-0x4(%rbp)
jmp    1206 <isDatetime+0xc6>
lea    -0x19(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
movb   $0x0,-0x11(%rbp)
lea    -0x19(%rbp),%rdi
call   1060 <isRightfulDate@plt>
cmp    $0x0,%eax
jne    11c7 <isDatetime+0x87>
movl   $0x0,-0x4(%rbp)
jmp    1206 <isDatetime+0xc6>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    $0x6,%edx
call   1050 <memcpy@plt>
movb   $0x0,-0x1a(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <isTime@plt>
cmp    $0x0,%eax
jne    11ff <isDatetime+0xbf>
movl   $0x0,-0x4(%rbp)
jmp    1206 <isDatetime+0xc6>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isDatetime>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %ebp,%ebp
test   %rdi,%rdi
je     11bd <isDatetime+0x7d>
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0xe,%eax
jne    11bd <isDatetime+0x7d>
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %ebp,%ebp
cmp    $0xe,%eax
jne    11bd <isDatetime+0x7d>
lea    0x7(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
movb   $0x0,0xf(%rsp)
mov    %r14,%rdi
call   1060 <isRightfulDate@plt>
test   %eax,%eax
je     11bd <isDatetime+0x7d>
add    $0x8,%rbx
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1050 <memcpy@plt>
movb   $0x0,0x6(%rsp)
mov    %rbp,%rdi
call   1040 <isTime@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isDatetime(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [9 x i8]
%5 = alloca [7 x i8]
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
%11 = icmp ne i32 %10, 14
br i1 %11, label %12, label %13
12: ; preds = %8, %1
store i32 0, i32* %2
br label %38
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = call i32 @strlen(i8* %14)
%16 = icmp ne i32 %15, 14
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 0, i32* %2
br label %38
18: ; preds = %13
%19 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%20 = load i8*, i8** %3
%21 = call i32 @memcpy(i8* %19, i8* %20, i32 8)
%22 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 8
store i8 0, i8* %22
%23 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%24 = call i32 @isRightfulDate(i8* %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %18
store i32 0, i32* %2
br label %38
27: ; preds = %18
%28 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i64 8
%31 = call i32 @memcpy(i8* %28, i8* %30, i32 6)
%32 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 6
store i8 0, i8* %32
%33 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%34 = call i32 @isTime(i8* %33)
%35 = icmp ne i32 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %27
store i32 0, i32* %2
br label %38
37: ; preds = %27
store i32 1, i32* %2
br label %38
38: ; preds = %37, %36, %26, %17, %12
%39 = load i32, i32* %2
ret i32 %39
}

LLVM IR (-O2):
define i32 @isDatetime(i8* %0) {
%2 = alloca [9 x i8]
%3 = alloca [7 x i8]
%4 = icmp eq i8* %0, null
br i1 %4, label %27, label %5
5: ; preds = %1
%6 = tail call i32 @strlen(i8* %0)
%7 = icmp eq i32 %6, 14
br i1 %7, label %8, label %27
8: ; preds = %5
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%11 = tail call i32 @strlen(i8* %0)
%12 = icmp eq i32 %11, 14
br i1 %12, label %13, label %25
13: ; preds = %8
%14 = call i32 @memcpy(i8* %9, i8* %0, i32 8)
%15 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 8
store i8 0, i8* %15
%16 = call i32 @isRightfulDate(i8* %9)
%17 = icmp eq i32 %16, 0
br i1 %17, label %25, label %18
18: ; preds = %13
%19 = getelementptr inbounds i8, i8* %0, i64 8
%20 = call i32 @memcpy(i8* %10, i8* %19, i32 6)
%21 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 6
store i8 0, i8* %21
%22 = call i32 @isTime(i8* %10)
%23 = icmp ne i32 %22, 0
%24 = zext i1 %23 to i32
br label %25
25: ; preds = %18, %13, %8
%26 = phi i32 [ 0, %8 ], [ 0, %13 ], [ %24, %18 ]
br label %27
27: ; preds = %1, %5, %25
%28 = phi i32 [ %26, %25 ], [ 0, %5 ], [ 0, %1 ]
ret i32 %28
}