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

/* Variables and functions */
int /*<<< orphan*/ croak_usage();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ stderr;
char *strptime(char const *, char *, struct tm *);
time_t parse_time(const char *input) {
  struct tm t;
  char *p;
  p = strptime(input, "%Y-%m-%d %H:%M:%S", &t);
  if ((!p) || (*p != '\0')) {
    fprintf(stderr, "error while processing time spec!\n");
    croak_usage();
  }
  return mktime(&t);
}


x86 assembly (clang, -O0):
<parse_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
lea    -0x10(%rbp),%rdx
call   1060 <strptime@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     117f <parse_time+0x3f>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     119b <parse_time+0x5b>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
lea    0xe83(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <croak_usage@plt>
lea    -0x10(%rbp),%rdi
call   1050 <mktime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_time>:
push   %rax
lea    0xeb8(%rip),%rsi
mov    %rsp,%rdx
call   1060 <strptime@plt>
test   %rax,%rax
je     115a <parse_time+0x1a>
cmpb   $0x0,(%rax)
je     1176 <parse_time+0x36>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <croak_usage@plt>
mov    %rsp,%rdi
call   1050 <mktime@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%Y-%m-%d %H:%M:%S\00"
@stderr = global i32 0
@.str.1 = [35 x i8] c"error while processing time spec!\0A\00"
define i32 @parse_time(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.tm
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strptime(i8* %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %3)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %9, %1
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 (...) @croak_usage()
br label %18
18: ; preds = %14, %9
%19 = call i32 @mktime(%struct.tm* %3)
ret i32 %19
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%Y-%m-%d %H:%M:%S\00"
@stderr = global i32 0
@.str.1 = [35 x i8] c"error while processing time spec!\0A\00"
define i32 @parse_time(i8* %0) {
%2 = alloca %struct.tm
%3 = bitcast %struct.tm* %2 to i8*
%4 = call i8* @strptime(i8* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i8, i8* %4
%8 = icmp eq i8 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6, %1
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (...) @croak_usage()
br label %13
13: ; preds = %9, %6
%14 = call i32 @mktime(%struct.tm* %2)
ret i32 %14
}