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

/* Variables and functions */
int /*<<< orphan*/ memset(struct tm *, char, int);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ strptime(char const *, char *, struct tm *);
time_t strtotime(const char *s_time) {
  struct tm tm;
  memset(&tm, '\0', sizeof(struct tm));
  if (s_time[0] == ' ' || s_time[0] == '\0')
    return (time_t)0;
  strptime(s_time, "%a %b %d %T %Y", &tm);
  if (s_time[26] == 'D')
    tm.tm_isdst = 1;
  return mktime(&tm);
}


x86 assembly (clang, -O0):
<strtotime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     116c <strtotime+0x3c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1178 <strtotime+0x48>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <strtotime+0x80>
mov    -0x10(%rbp),%rdi
lea    0xe7d(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <strptime@plt>
mov    -0x10(%rbp),%rax
movsbl 0x1a(%rax),%eax
cmp    $0x44,%eax
jne    11a4 <strtotime+0x74>
movl   $0x1,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1040 <mktime@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtotime>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsp,%rdi
xor    %ebp,%ebp
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
testb  $0xdf,(%rbx)
je     1175 <strtotime+0x45>
lea    0xead(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1050 <strptime@plt>
cmpb   $0x44,0x1a(%rbx)
jne    116b <strtotime+0x3b>
movl   $0x1,(%rsp)
mov    %rsp,%rdi
call   1040 <mktime@plt>
mov    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [15 x i8] c"%a %b %d %T %Y\00"
define i32 @strtotime(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.tm
store i8* %0, i8** %3
%5 = call i32 @memset(%struct.tm* %4, i8 signext 0, i32 4)
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 32
br i1 %10, label %17, label %11
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11, %1
store i32 0, i32* %2
br label %30
18: ; preds = %11
%19 = load i8*, i8** %3
%20 = call i32 @strptime(i8* %19, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %struct.tm* %4)
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 26
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 68
br i1 %25, label %26, label %28
26: ; preds = %18
%27 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 0
store i32 1, i32* %27
br label %28
28: ; preds = %26, %18
%29 = call i32 @mktime(%struct.tm* %4)
store i32 %29, i32* %2
br label %30
30: ; preds = %28, %17
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [15 x i8] c"%a %b %d %T %Y\00"
define i32 @strtotime(i8* %0) {
%2 = alloca %struct.tm
%3 = bitcast %struct.tm* %2 to i8*
%4 = call i32 @memset(%struct.tm* %2, i8 signext 0, i32 4)
%5 = load i8, i8* %0
switch i8 %5, label %6 [
i8 32, label %15
i8 0, label %15
]
6: ; preds = %1
%7 = call i32 @strptime(i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %struct.tm* %2)
%8 = getelementptr inbounds i8, i8* %0, i64 26
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 68
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
store i32 1, i32* %12
br label %13
13: ; preds = %11, %6
%14 = call i32 @mktime(%struct.tm* %2)
br label %15
15: ; preds = %1, %1, %13
%16 = phi i32 [ %14, %13 ], [ 0, %1 ], [ 0, %1 ]
ret i32 %16
}