#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*/ piece(char *, char, char *, int);
int strlen(char *);
int parse_date_time(char *month, char *day, char *year, char *hour,
                    char *minute, char *date_string, char *time_string) {
  if (!*date_string)
    return 0;
  piece(year, '-', date_string, 0);
  if (!piece(month, '-', date_string, 1))
    return 0;
  if (!piece(day, '-', date_string, 2))
    return 0;
  if (strlen(time_string) != 4)
    return 0;
  *hour = *time_string;
  *(hour + 1) = *(time_string + 1);
  *(hour + 2) = '\0';
  *(minute) = *(time_string + 2);
  *(minute + 1) = *(time_string + 3);
  *(minute + 2) = '\0';
  return 1;
}


x86 assembly (clang, -O0):
<parse_date_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmpb   $0x0,(%rax)
jne    115d <parse_date_time+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    1233 <parse_date_time+0x113>
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    $0x2d,%esi
xor    %ecx,%ecx
call   1040 <piece@plt>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    $0x2d,%esi
mov    $0x1,%ecx
call   1040 <piece@plt>
cmp    $0x0,%eax
jne    119d <parse_date_time+0x7d>
movl   $0x0,-0x4(%rbp)
jmp    1233 <parse_date_time+0x113>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    $0x2d,%esi
mov    $0x2,%ecx
call   1040 <piece@plt>
cmp    $0x0,%eax
jne    11c9 <parse_date_time+0xa9>
movl   $0x0,-0x4(%rbp)
jmp    1233 <parse_date_time+0x113>
mov    0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x4,%eax
je     11e7 <parse_date_time+0xc7>
movl   $0x0,-0x4(%rbp)
jmp    1233 <parse_date_time+0x113>
mov    0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
mov    0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x28(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x28(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    0x10(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x30(%rbp),%rax
mov    %cl,(%rax)
mov    0x10(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x30(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x30(%rbp),%rax
movb   $0x0,0x2(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_date_time>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmpb   $0x0,(%r9)
je     11c8 <parse_date_time+0xa8>
mov    %r9,%rbx
mov    %r8,%r14
mov    %rcx,%r15
mov    %rsi,%r12
mov    %rdi,%rbp
xor    %r13d,%r13d
mov    %rdx,%rdi
mov    $0x2d,%esi
mov    %r9,%rdx
xor    %ecx,%ecx
call   1040 <piece@plt>
mov    %rbp,%rdi
mov    $0x2d,%esi
mov    %rbx,%rdx
mov    $0x1,%ecx
call   1040 <piece@plt>
test   %eax,%eax
je     11cb <parse_date_time+0xab>
mov    %r12,%rdi
mov    $0x2d,%esi
mov    %rbx,%rdx
mov    $0x2,%ecx
call   1040 <piece@plt>
test   %eax,%eax
je     11cb <parse_date_time+0xab>
mov    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x4,%eax
jne    11cb <parse_date_time+0xab>
mov    (%rbx),%al
mov    %al,(%r15)
mov    0x1(%rbx),%al
mov    %al,0x1(%r15)
movb   $0x0,0x2(%r15)
mov    0x2(%rbx),%al
mov    %al,(%r14)
mov    0x3(%rbx),%al
mov    %al,0x1(%r14)
movb   $0x0,0x2(%r14)
mov    $0x1,%r13d
jmp    11cb <parse_date_time+0xab>
xor    %r13d,%r13d
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @parse_date_time(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
store i8* %0, i8** %9
store i8* %1, i8** %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i8* %4, i8** %13
store i8* %5, i8** %14
store i8* %6, i8** %15
%16 = load i8*, i8** %14
%17 = load i8, i8* %16
%18 = icmp ne i8 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %7
store i32 0, i32* %8
br label %62
20: ; preds = %7
%21 = load i8*, i8** %11
%22 = load i8*, i8** %14
%23 = call i32 @piece(i8* %21, i8 signext 45, i8* %22, i32 0)
%24 = load i8*, i8** %9
%25 = load i8*, i8** %14
%26 = call i32 @piece(i8* %24, i8 signext 45, i8* %25, i32 1)
%27 = icmp ne i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %20
store i32 0, i32* %8
br label %62
29: ; preds = %20
%30 = load i8*, i8** %10
%31 = load i8*, i8** %14
%32 = call i32 @piece(i8* %30, i8 signext 45, i8* %31, i32 2)
%33 = icmp ne i32 %32, 0
br i1 %33, label %35, label %34
34: ; preds = %29
store i32 0, i32* %8
br label %62
35: ; preds = %29
%36 = load i8*, i8** %15
%37 = call i32 @strlen(i8* %36)
%38 = icmp ne i32 %37, 4
br i1 %38, label %39, label %40
39: ; preds = %35
store i32 0, i32* %8
br label %62
40: ; preds = %35
%41 = load i8*, i8** %15
%42 = load i8, i8* %41
%43 = load i8*, i8** %12
store i8 %42, i8* %43
%44 = load i8*, i8** %15
%45 = getelementptr inbounds i8, i8* %44, i64 1
%46 = load i8, i8* %45
%47 = load i8*, i8** %12
%48 = getelementptr inbounds i8, i8* %47, i64 1
store i8 %46, i8* %48
%49 = load i8*, i8** %12
%50 = getelementptr inbounds i8, i8* %49, i64 2
store i8 0, i8* %50
%51 = load i8*, i8** %15
%52 = getelementptr inbounds i8, i8* %51, i64 2
%53 = load i8, i8* %52
%54 = load i8*, i8** %13
store i8 %53, i8* %54
%55 = load i8*, i8** %15
%56 = getelementptr inbounds i8, i8* %55, i64 3
%57 = load i8, i8* %56
%58 = load i8*, i8** %13
%59 = getelementptr inbounds i8, i8* %58, i64 1
store i8 %57, i8* %59
%60 = load i8*, i8** %13
%61 = getelementptr inbounds i8, i8* %60, i64 2
store i8 0, i8* %61
store i32 1, i32* %8
br label %62
62: ; preds = %40, %39, %34, %28, %19
%63 = load i32, i32* %8
ret i32 %63
}

LLVM IR (-O2):
define i32 @parse_date_time(i8* %0, i8* %1, i8* %2, i8* nocapture writeonly %3, i8* nocapture writeonly %4, i8* %5, i8* %6) {
%8 = load i8, i8* %5
%9 = icmp eq i8 %8, 0
br i1 %9, label %32, label %10
10: ; preds = %7
%11 = tail call i32 @piece(i8* %2, i8 signext 45, i8* %5, i32 0)
%12 = tail call i32 @piece(i8* %0, i8 signext 45, i8* %5, i32 1)
%13 = icmp eq i32 %12, 0
br i1 %13, label %32, label %14
14: ; preds = %10
%15 = tail call i32 @piece(i8* %1, i8 signext 45, i8* %5, i32 2)
%16 = icmp eq i32 %15, 0
br i1 %16, label %32, label %17
17: ; preds = %14
%18 = tail call i32 @strlen(i8* %6)
%19 = icmp eq i32 %18, 4
br i1 %19, label %20, label %32
20: ; preds = %17
%21 = load i8, i8* %6
store i8 %21, i8* %3
%22 = getelementptr inbounds i8, i8* %6, i64 1
%23 = load i8, i8* %22
%24 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %23, i8* %24
%25 = getelementptr inbounds i8, i8* %3, i64 2
store i8 0, i8* %25
%26 = getelementptr inbounds i8, i8* %6, i64 2
%27 = load i8, i8* %26
store i8 %27, i8* %4
%28 = getelementptr inbounds i8, i8* %6, i64 3
%29 = load i8, i8* %28
%30 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %29, i8* %30
%31 = getelementptr inbounds i8, i8* %4, i64 2
store i8 0, i8* %31
br label %32
32: ; preds = %17, %14, %10, %7, %20
%33 = phi i32 [ 1, %20 ], [ 0, %7 ], [ 0, %10 ], [ 0, %14 ], [ 0, %17 ]
ret i32 %33
}