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

/* Variables and functions */
int _ttime_century(char **, int /*<<< orphan*/ *);
int _ttime_day(char **, int /*<<< orphan*/ *);
int _ttime_hour(char **, int /*<<< orphan*/ *);
int _ttime_minut(char **, int /*<<< orphan*/ *);
int _ttime_month(char **, int /*<<< orphan*/ *);
int _ttime_second(char **, int /*<<< orphan*/ *);
int _ttime_year(char **, int /*<<< orphan*/ *);
int strlen(char *);
int _prefs_ttime(char *string, time_t *time) {
  time_t t = 0;
  char **p = &string;
  int ret = 0;
  int len;
  switch ((len = strlen(string))) {
  case 15:
  case 12:
    ret += _ttime_century(p, &t);
  case 13:
  case 10:
    ret += _ttime_year(p, &t);
  case 11:
  case 8:
    ret += _ttime_month(p, &t);
    ret += _ttime_day(p, &t);
    ret += _ttime_hour(p, &t);
    ret += _ttime_minut(p, &t);
    if (len % 2)
      ret += _ttime_second(p, &t);
    break;
  default:
    return 1;
  }
  if (ret != 0)
    return 1;
  *time = t;
  return 0;
}


x86 assembly (clang, -O0):
<_prefs_ttime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x30(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x34(%rbp)
sub    $0x8,%eax
je     1240 <_prefs_ttime+0xc0>
jmp    11c5 <_prefs_ttime+0x45>
mov    -0x34(%rbp),%eax
sub    $0xa,%eax
je     122d <_prefs_ttime+0xad>
jmp    11d6 <_prefs_ttime+0x56>
mov    -0x34(%rbp),%eax
sub    $0xb,%eax
je     1240 <_prefs_ttime+0xc0>
jmp    11e7 <_prefs_ttime+0x67>
mov    -0x34(%rbp),%eax
sub    $0xc,%eax
je     121a <_prefs_ttime+0x9a>
jmp    11f8 <_prefs_ttime+0x78>
mov    -0x34(%rbp),%eax
sub    $0xd,%eax
je     122d <_prefs_ttime+0xad>
jmp    1209 <_prefs_ttime+0x89>
mov    -0x34(%rbp),%eax
sub    $0xf,%eax
jne    12b8 <_prefs_ttime+0x138>
jmp    121a <_prefs_ttime+0x9a>
mov    -0x28(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <_ttime_century@plt>
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   10a0 <_ttime_year@plt>
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1070 <_ttime_month@plt>
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <_ttime_day@plt>
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <_ttime_hour@plt>
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1090 <_ttime_minut@plt>
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     12b3 <_prefs_ttime+0x133>
mov    -0x28(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1080 <_ttime_second@plt>
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    12c4 <_prefs_ttime+0x144>
movl   $0x1,-0x4(%rbp)
jmp    12ea <_prefs_ttime+0x16a>
cmpl   $0x0,-0x2c(%rbp)
je     12da <_prefs_ttime+0x15a>
movl   $0x1,-0x4(%rbp)
jmp    12ea <_prefs_ttime+0x16a>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_prefs_ttime>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,0x8(%rsp)
movl   $0x0,0x4(%rsp)
call   1040 <strlen@plt>
mov    %eax,%r15d
mov    $0x1,%eax
cmp    $0xf,%r15d
ja     1279 <_prefs_ttime+0xf9>
mov    %rbx,0x10(%rsp)
xor    %ebp,%ebp
mov    $0x900,%ecx
bt     %r15d,%ecx
jb     1203 <_prefs_ttime+0x83>
mov    $0x2400,%ecx
bt     %r15d,%ecx
jb     11f2 <_prefs_ttime+0x72>
mov    $0x9000,%ecx
bt     %r15d,%ecx
jae    1279 <_prefs_ttime+0xf9>
lea    0x8(%rsp),%rdi
lea    0x4(%rsp),%rsi
call   1060 <_ttime_century@plt>
mov    %eax,%ebp
lea    0x8(%rsp),%rdi
lea    0x4(%rsp),%rsi
call   10a0 <_ttime_year@plt>
add    %eax,%ebp
lea    0x8(%rsp),%r12
lea    0x4(%rsp),%r13
mov    %r12,%rdi
mov    %r13,%rsi
call   1070 <_ttime_month@plt>
mov    %eax,%r14d
add    %ebp,%r14d
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <_ttime_day@plt>
mov    %eax,%ebp
add    %r14d,%ebp
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <_ttime_hour@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r12,%rdi
mov    %r13,%rsi
call   1090 <_ttime_minut@plt>
mov    %eax,%ebp
add    %ebx,%ebp
test   $0x1,%r15b
je     1263 <_prefs_ttime+0xe3>
lea    0x8(%rsp),%rdi
lea    0x4(%rsp),%rsi
call   1080 <_ttime_second@plt>
add    %eax,%ebp
mov    $0x1,%eax
test   %ebp,%ebp
jne    1279 <_prefs_ttime+0xf9>
mov    0x4(%rsp),%eax
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @_prefs_ttime(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 0, i32* %6
store i8** %4, i8*** %7
store i32 0, i32* %8
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %9
switch i32 %11, label %48 [
i32 15, label %12
i32 12, label %12
i32 13, label %17
i32 10, label %17
i32 11, label %22
i32 8, label %22
]
12: ; preds = %2, %2
%13 = load i8**, i8*** %7
%14 = call i32 @_ttime_century(i8** %13, i32* %6)
%15 = load i32, i32* %8
%16 = add nsw i32 %15, %14
store i32 %16, i32* %8
br label %17
17: ; preds = %2, %2, %12
%18 = load i8**, i8*** %7
%19 = call i32 @_ttime_year(i8** %18, i32* %6)
%20 = load i32, i32* %8
%21 = add nsw i32 %20, %19
store i32 %21, i32* %8
br label %22
22: ; preds = %2, %2, %17
%23 = load i8**, i8*** %7
%24 = call i32 @_ttime_month(i8** %23, i32* %6)
%25 = load i32, i32* %8
%26 = add nsw i32 %25, %24
store i32 %26, i32* %8
%27 = load i8**, i8*** %7
%28 = call i32 @_ttime_day(i8** %27, i32* %6)
%29 = load i32, i32* %8
%30 = add nsw i32 %29, %28
store i32 %30, i32* %8
%31 = load i8**, i8*** %7
%32 = call i32 @_ttime_hour(i8** %31, i32* %6)
%33 = load i32, i32* %8
%34 = add nsw i32 %33, %32
store i32 %34, i32* %8
%35 = load i8**, i8*** %7
%36 = call i32 @_ttime_minut(i8** %35, i32* %6)
%37 = load i32, i32* %8
%38 = add nsw i32 %37, %36
store i32 %38, i32* %8
%39 = load i32, i32* %9
%40 = srem i32 %39, 2
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %22
%43 = load i8**, i8*** %7
%44 = call i32 @_ttime_second(i8** %43, i32* %6)
%45 = load i32, i32* %8
%46 = add nsw i32 %45, %44
store i32 %46, i32* %8
br label %47
47: ; preds = %42, %22
br label %49
48: ; preds = %2
store i32 1, i32* %3
br label %56
49: ; preds = %47
%50 = load i32, i32* %8
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %53
52: ; preds = %49
store i32 1, i32* %3
br label %56
53: ; preds = %49
%54 = load i32, i32* %6
%55 = load i32*, i32** %5
store i32 %54, i32* %55
store i32 0, i32* %3
br label %56
56: ; preds = %53, %52, %48
%57 = load i32, i32* %3
ret i32 %57
}

LLVM IR (-O2):
define i32 @_prefs_ttime(i8* %0, i32* nocapture writeonly %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%6 = tail call i32 @strlen(i8* %0)
switch i32 %6, label %33 [
i32 15, label %7
i32 12, label %7
i32 13, label %9
i32 10, label %9
i32 11, label %13
i32 8, label %13
]
7: ; preds = %2, %2
%8 = call i32 @_ttime_century(i8** %3, i32* %4)
br label %9
9: ; preds = %2, %2, %7
%10 = phi i32 [ 0, %2 ], [ 0, %2 ], [ %8, %7 ]
%11 = call i32 @_ttime_year(i8** %3, i32* %4)
%12 = add nsw i32 %11, %10
br label %13
13: ; preds = %2, %2, %9
%14 = phi i32 [ 0, %2 ], [ 0, %2 ], [ %12, %9 ]
%15 = call i32 @_ttime_month(i8** %3, i32* %4)
%16 = add nsw i32 %15, %14
%17 = call i32 @_ttime_day(i8** %3, i32* %4)
%18 = add nsw i32 %16, %17
%19 = call i32 @_ttime_hour(i8** %3, i32* %4)
%20 = add nsw i32 %18, %19
%21 = call i32 @_ttime_minut(i8** %3, i32* %4)
%22 = add nsw i32 %20, %21
%23 = and i32 %6, 1
%24 = icmp eq i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %13
%26 = call i32 @_ttime_second(i8** %3, i32* %4)
%27 = add nsw i32 %26, %22
br label %28
28: ; preds = %13, %25
%29 = phi i32 [ %27, %25 ], [ %22, %13 ]
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = load i32, i32* %4
store i32 %32, i32* %1
br label %33
33: ; preds = %28, %2, %31
%34 = phi i32 [ 0, %31 ], [ 1, %2 ], [ 1, %28 ]
ret i32 %34
}