#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 unsigned long long time_t;

/* Variables and functions */
int /*<<< orphan*/ isspace(char);
unsigned long long strtoull(char const *, char **, int);
int str2time(const char *s, time_t *pt, int base) {
  unsigned long long ul;
  char *endp;
  ul = strtoull(s, &endp, base);
  if (!isspace(*endp) && *endp != '\0')
    return 0;
  if (endp == s)
    return 0;
  *pt = ul;
  return 1;
}


x86 assembly (clang, -O0):
<str2time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    -0x30(%rbp),%rsi
call   1040 <strtoull@plt>
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    1178 <str2time+0x58>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1178 <str2time+0x58>
movl   $0x0,-0x4(%rbp)
jmp    11a4 <str2time+0x84>
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1192 <str2time+0x72>
movl   $0x0,-0x4(%rbp)
jmp    11a4 <str2time+0x84>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str2time>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
mov    %rsp,%rsi
call   1040 <strtoull@plt>
mov    %rax,%r15
mov    (%rsp),%rbx
movsbl (%rbx),%edi
call   1030 <isspace@plt>
test   %eax,%eax
je     1152 <str2time+0x32>
cmp    %r12,%rbx
jne    115e <str2time+0x3e>
xor    %eax,%eax
jmp    1166 <str2time+0x46>
xor    %eax,%eax
cmp    %r12,%rbx
je     1166 <str2time+0x46>
cmpb   $0x0,(%rbx)
jne    1166 <str2time+0x46>
mov    %r15,(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @str2time(i8* %0, i64* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i32
%8 = alloca i64
%9 = alloca i8*
store i8* %0, i8** %5
store i64* %1, i64** %6
store i32 %2, i32* %7
%10 = load i8*, i8** %5
%11 = load i32, i32* %7
%12 = call i64 @strtoull(i8* %10, i8** %9, i32 %11)
store i64 %12, i64* %8
%13 = load i8*, i8** %9
%14 = load i8, i8* %13
%15 = call i32 @isspace(i8 signext %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %3
%18 = load i8*, i8** %9
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
store i32 0, i32* %4
br label %31
23: ; preds = %17, %3
%24 = load i8*, i8** %9
%25 = load i8*, i8** %5
%26 = icmp eq i8* %24, %25
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 0, i32* %4
br label %31
28: ; preds = %23
%29 = load i64, i64* %8
%30 = load i64*, i64** %6
store i64 %29, i64* %30
store i32 1, i32* %4
br label %31
31: ; preds = %28, %27, %22
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
define i32 @str2time(i8* %0, i64* nocapture writeonly %1, i32 %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = call i64 @strtoull(i8* %0, i8** %4, i32 %2)
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = tail call i32 @isspace(i8 signext %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %3
%12 = load i8, i8* %7
%13 = icmp ne i8 %12, 0
%14 = icmp eq i8* %7, %0
%15 = or i1 %14, %13
br i1 %15, label %19, label %18
16: ; preds = %3
%17 = icmp eq i8* %7, %0
br i1 %17, label %19, label %18
18: ; preds = %11, %16
store i64 %6, i64* %1
br label %19
19: ; preds = %16, %11, %18
%20 = phi i32 [ 1, %18 ], [ 0, %11 ], [ 0, %16 ]
ret i32 %20
}