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

/* Variables and functions */
void *atoi(char *);
int /*<<< orphan*/ memset(struct tm *, int /*<<< orphan*/, int);
int strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
int /*<<< orphan*/ timegm(struct tm *);
time_t gentime_to_time_t(const char *gentime) {
  int len;
  struct tm tm;
  char buf[10];
  len = strlen(gentime);
  if (len < 15 || gentime[len - 1] != 'Z')
    return (time_t)-1;
  memset(&tm, 0, sizeof(struct tm));
  {
    strncpy(buf, &gentime[0], 4);
    buf[4] = '\0';
    tm.tm_year = atoi(buf);
  };
  {
    strncpy(buf, &gentime[4], 2);
    buf[2] = '\0';
    tm.tm_mon = atoi(buf);
  };
  {
    strncpy(buf, &gentime[6], 2);
    buf[2] = '\0';
    tm.tm_mday = atoi(buf);
  };
  {
    strncpy(buf, &gentime[8], 2);
    buf[2] = '\0';
    tm.tm_hour = atoi(buf);
  };
  {
    strncpy(buf, &gentime[10], 2);
    buf[2] = '\0';
    tm.tm_min = atoi(buf);
  };
  {
    strncpy(buf, &gentime[12], 2);
    buf[2] = '\0';
    tm.tm_sec = atoi(buf);
  };
  tm.tm_year -= 1900;
  tm.tm_mon--;
  tm.tm_isdst = -1;
  return timegm(&tm);
}


x86 assembly (clang, -O0):
<gentime_to_time_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xf,-0x14(%rbp)
jl     118c <gentime_to_time_t+0x3c>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5a,%eax
je     1198 <gentime_to_time_t+0x48>
movl   $0xffffffff,-0x4(%rbp)
jmp    12b7 <gentime_to_time_t+0x167>
lea    -0x48(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1050 <memset@plt>
lea    -0x52(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x4e(%rbp)
lea    -0x52(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x48(%rbp)
lea    -0x52(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x50(%rbp)
lea    -0x52(%rbp),%rdi
call   1070 <atoi@plt>
mov    %rax,-0x40(%rbp)
lea    -0x52(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x6,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x50(%rbp)
lea    -0x52(%rbp),%rdi
call   1070 <atoi@plt>
mov    %rax,-0x20(%rbp)
lea    -0x52(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x50(%rbp)
lea    -0x52(%rbp),%rdi
call   1070 <atoi@plt>
mov    %rax,-0x28(%rbp)
lea    -0x52(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0xa,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x50(%rbp)
lea    -0x52(%rbp),%rdi
call   1070 <atoi@plt>
mov    %rax,-0x30(%rbp)
lea    -0x52(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0xc,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x50(%rbp)
lea    -0x52(%rbp),%rdi
call   1070 <atoi@plt>
mov    %rax,-0x38(%rbp)
mov    -0x48(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x40(%rbp)
movl   $0xffffffff,-0x44(%rbp)
lea    -0x48(%rbp),%rdi
call   1060 <timegm@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gentime_to_time_t>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0xf,%ecx
jl     1288 <gentime_to_time_t+0x138>
add    $0xffffffff,%ecx
cmpb   $0x5a,(%rbx,%rcx,1)
jne    1288 <gentime_to_time_t+0x138>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1050 <memset@plt>
lea    0x6(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
movb   $0x0,0xa(%rsp)
mov    %r15,%rdi
call   1070 <atoi@plt>
mov    %eax,0x10(%rsp)
lea    0x4(%rbx),%rsi
mov    %r15,%rdi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x8(%rsp)
mov    %r15,%rdi
call   1070 <atoi@plt>
mov    %rax,0x18(%rsp)
lea    0x6(%rbx),%rsi
mov    %r15,%rdi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x8(%rsp)
mov    %r15,%rdi
call   1070 <atoi@plt>
mov    %rax,0x38(%rsp)
lea    0x8(%rbx),%rsi
mov    %r15,%rdi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x8(%rsp)
mov    %r15,%rdi
call   1070 <atoi@plt>
mov    %rax,0x30(%rsp)
lea    0xa(%rbx),%rsi
mov    %r15,%rdi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x8(%rsp)
mov    %r15,%rdi
call   1070 <atoi@plt>
mov    %rax,0x28(%rsp)
add    $0xc,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x8(%rsp)
mov    %r15,%rdi
call   1070 <atoi@plt>
mov    %rax,0x20(%rsp)
addl   $0xfffff894,0x10(%rsp)
ff
addq   $0xffffffffffffffff,0x18(%rsp)
movl   $0xffffffff,0x14(%rsp)
ff
mov    %r14,%rdi
call   1060 <timegm@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i8*, i8*, i8*, i8*, i8* }
define i32 @gentime_to_time_t(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.tm
%6 = alloca [10 x i8]
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 15
br i1 %10, label %20, label %11
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %12, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 90
br i1 %19, label %20, label %21
20: ; preds = %11, %1
store i32 -1, i32* %2
br label %80
21: ; preds = %11
%22 = call i32 @memset(%struct.tm* %5, i32 0, i32 48)
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i64 0
%26 = call i32 @strncpy(i8* %23, i8* %25, i32 4)
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 4
store i8 0, i8* %27
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%29 = call i8* @atoi(i8* %28)
%30 = ptrtoint i8* %29 to i32
%31 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
store i32 %30, i32* %31
%32 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%33 = load i8*, i8** %3
%34 = getelementptr inbounds i8, i8* %33, i64 4
%35 = call i32 @strncpy(i8* %32, i8* %34, i32 2)
%36 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 2
store i8 0, i8* %36
%37 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%38 = call i8* @atoi(i8* %37)
%39 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 2
store i8* %38, i8** %39
%40 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%41 = load i8*, i8** %3
%42 = getelementptr inbounds i8, i8* %41, i64 6
%43 = call i32 @strncpy(i8* %40, i8* %42, i32 2)
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 2
store i8 0, i8* %44
%45 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%46 = call i8* @atoi(i8* %45)
%47 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 6
store i8* %46, i8** %47
%48 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i64 8
%51 = call i32 @strncpy(i8* %48, i8* %50, i32 2)
%52 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 2
store i8 0, i8* %52
%53 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%54 = call i8* @atoi(i8* %53)
%55 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 5
store i8* %54, i8** %55
%56 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%57 = load i8*, i8** %3
%58 = getelementptr inbounds i8, i8* %57, i64 10
%59 = call i32 @strncpy(i8* %56, i8* %58, i32 2)
%60 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 2
store i8 0, i8* %60
%61 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%62 = call i8* @atoi(i8* %61)
%63 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 4
store i8* %62, i8** %63
%64 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%65 = load i8*, i8** %3
%66 = getelementptr inbounds i8, i8* %65, i64 12
%67 = call i32 @strncpy(i8* %64, i8* %66, i32 2)
%68 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 2
store i8 0, i8* %68
%69 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%70 = call i8* @atoi(i8* %69)
%71 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 3
store i8* %70, i8** %71
%72 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%73 = load i32, i32* %72
%74 = sub nsw i32 %73, 1900
store i32 %74, i32* %72
%75 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 2
%76 = load i8*, i8** %75
%77 = getelementptr inbounds i8, i8* %76, i32 -1
store i8* %77, i8** %75
%78 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 1
store i32 -1, i32* %78
%79 = call i32 @timegm(%struct.tm* %5)
store i32 %79, i32* %2
br label %80
80: ; preds = %21, %20
%81 = load i32, i32* %2
ret i32 %81
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i8*, i8*, i8*, i8*, i8* }
define i32 @gentime_to_time_t(i8* %0) {
%2 = alloca %struct.tm
%3 = alloca [10 x i8]
%4 = bitcast %struct.tm* %2 to i8*
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%6 = tail call i32 @strlen(i8* %0)
%7 = icmp slt i32 %6, 15
br i1 %7, label %49, label %8
8: ; preds = %1
%9 = add nsw i32 %6, -1
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 90
br i1 %13, label %14, label %49
14: ; preds = %8
%15 = call i32 @memset(%struct.tm* %2, i32 0, i32 48)
%16 = call i32 @strncpy(i8* %5, i8* %0, i32 4)
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 4
store i8 0, i8* %17
%18 = call i8* @atoi(i8* %5)
%19 = ptrtoint i8* %18 to i64
%20 = trunc i64 %19 to i32
%21 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
store i32 %20, i32* %21
%22 = getelementptr inbounds i8, i8* %0, i64 4
%23 = call i32 @strncpy(i8* %5, i8* %22, i32 2)
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 2
store i8 0, i8* %24
%25 = call i8* @atoi(i8* %5)
%26 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 2
store i8* %25, i8** %26
%27 = getelementptr inbounds i8, i8* %0, i64 6
%28 = call i32 @strncpy(i8* %5, i8* %27, i32 2)
store i8 0, i8* %24
%29 = call i8* @atoi(i8* %5)
%30 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 6
store i8* %29, i8** %30
%31 = getelementptr inbounds i8, i8* %0, i64 8
%32 = call i32 @strncpy(i8* %5, i8* %31, i32 2)
store i8 0, i8* %24
%33 = call i8* @atoi(i8* %5)
%34 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 5
store i8* %33, i8** %34
%35 = getelementptr inbounds i8, i8* %0, i64 10
%36 = call i32 @strncpy(i8* %5, i8* %35, i32 2)
store i8 0, i8* %24
%37 = call i8* @atoi(i8* %5)
%38 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 4
store i8* %37, i8** %38
%39 = getelementptr inbounds i8, i8* %0, i64 12
%40 = call i32 @strncpy(i8* %5, i8* %39, i32 2)
store i8 0, i8* %24
%41 = call i8* @atoi(i8* %5)
%42 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 3
store i8* %41, i8** %42
%43 = load i32, i32* %21
%44 = add nsw i32 %43, -1900
store i32 %44, i32* %21
%45 = load i8*, i8** %26
%46 = getelementptr inbounds i8, i8* %45, i64 -1
store i8* %46, i8** %26
%47 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 1
store i32 -1, i32* %47
%48 = call i32 @timegm(%struct.tm* %2)
br label %49
49: ; preds = %1, %8, %14
%50 = phi i32 [ %48, %14 ], [ -1, %8 ], [ -1, %1 ]
ret i32 %50
}