#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*/ mktime(struct tm *);
char *strptime(char *, char *, struct tm *);
time_t unctime(char *str) {
  struct tm then;
  str = strptime(str, "%a %b %e %T %Y", &then);
  if (str == NULL || (*str != '\n' && *str != '\0'))
    return ((time_t)-1);
  then.tm_isdst = -1;
  return (mktime(&then));
}


x86 assembly (clang, -O0):
<unctime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <strptime@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116f <unctime+0x4f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     117b <unctime+0x5b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     117b <unctime+0x5b>
movl   $0xffffffff,-0x4(%rbp)
jmp    118e <unctime+0x6e>
movl   $0xffffffff,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1030 <mktime@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unctime>:
push   %rax
lea    0xed8(%rip),%rsi
mov    %rsp,%rdx
call   1040 <strptime@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
je     1157 <unctime+0x37>
mov    (%rcx),%cl
cmp    $0xa,%cl
je     1148 <unctime+0x28>
test   %cl,%cl
jne    1157 <unctime+0x37>
movl   $0xffffffff,(%rsp)
mov    %rsp,%rdi
call   1030 <mktime@plt>
pop    %rcx
ret

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

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