#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 */
struct tm *malloc(int);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ strptime(char const *, char *, struct tm *);
time_t strtotime(const char *s_time) {
  struct tm *tm = malloc(sizeof(*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)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     116a <strtotime+0x3a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1176 <strtotime+0x46>
movl   $0x0,-0x4(%rbp)
jmp    11b1 <strtotime+0x81>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe7b(%rip),%rsi
call   1050 <strptime@plt>
mov    -0x10(%rbp),%rax
movsbl 0x1a(%rax),%eax
cmp    $0x44,%eax
jne    11a5 <strtotime+0x75>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -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   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x4,%edi
call   1030 <malloc@plt>
testb  $0xdf,(%rbx)
jne    1150 <strtotime+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rax,%r14
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
call   1050 <strptime@plt>
cmpb   $0x44,0x1a(%rbx)
jne    1172 <strtotime+0x42>
movl   $0x1,(%r14)
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <mktime@plt>

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 %struct.tm* @malloc(i32 4)
store %struct.tm* %5, %struct.tm** %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 %33
18: ; preds = %11
%19 = load i8*, i8** %3
%20 = load %struct.tm*, %struct.tm** %4
%21 = call i32 @strptime(i8* %19, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %struct.tm* %20)
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 26
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 68
br i1 %26, label %27, label %30
27: ; preds = %18
%28 = load %struct.tm*, %struct.tm** %4
%29 = getelementptr inbounds %struct.tm, %struct.tm* %28, i32 0, i32 0
store i32 1, i32* %29
br label %30
30: ; preds = %27, %18
%31 = load %struct.tm*, %struct.tm** %4
%32 = call i32 @mktime(%struct.tm* %31)
store i32 %32, i32* %2
br label %33
33: ; preds = %30, %17
%34 = load i32, i32* %2
ret i32 %34
}

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