#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 */

/* Variables and functions */
unsigned long ULONG_MAX;
int strtol(char const *, char **, int);
unsigned long strtoul(char const *, char **, int);
int match_object_header_date(const char *date, unsigned long *timestamp,
                             int *offset) {
  char *end;
  unsigned long stamp;
  int ofs;
  if (*date < '0' || '9' < *date)
    return -1;
  stamp = strtoul(date, &end, 10);
  if (*end != ' ' || stamp == ULONG_MAX || (end[1] != '+' && end[1] != '-'))
    return -1;
  date = end + 2;
  ofs = strtol(date, &end, 10);
  if ((*end != '\0' && (*end != '\n')) || end != date + 4)
    return -1;
  ofs = (ofs / 100) * 60 + (ofs % 100);
  if (date[-1] == '-')
    ofs = -ofs;
  *timestamp = stamp;
  *offset = ofs;
  return 0;
}


x86 assembly (clang, -O0):
<match_object_header_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     1158 <match_object_header_date+0x38>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x39,%eax
cmp    %ecx,%eax
jge    1164 <match_object_header_date+0x44>
movl   $0xffffffff,-0x4(%rbp)
jmp    1286 <match_object_header_date+0x166>
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    11c0 <match_object_header_date+0xa0>
mov    -0x30(%rbp),%rax
mov    0x2e43(%rip),%rcx
cmp    (%rcx),%rax
je     11c0 <match_object_header_date+0xa0>
mov    -0x28(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2b,%eax
je     11cc <match_object_header_date+0xac>
mov    -0x28(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2d,%eax
je     11cc <match_object_header_date+0xac>
movl   $0xffffffff,-0x4(%rbp)
jmp    1286 <match_object_header_date+0x166>
mov    -0x28(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     120d <match_object_header_date+0xed>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1222 <match_object_header_date+0x102>
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rcx
add    $0x4,%rcx
cmp    %rcx,%rax
je     122e <match_object_header_date+0x10e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1286 <match_object_header_date+0x166>
mov    -0x34(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
imul   $0x3c,%eax,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    -0x38(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x2d,%eax
jne    126b <match_object_header_date+0x14b>
xor    %eax,%eax
sub    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x34(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_object_header_date>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    (%rdi),%al
add    $0xc6,%al
mov    $0xffffffff,%ebp
cmp    $0xf6,%al
jae    1148 <match_object_header_date+0x28>
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rdx,%r14
mov    %rsi,%r15
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    0x8(%rsp),%rbx
cmpb   $0x20,(%rbx)
jne    1139 <match_object_header_date+0x19>
mov    %rax,%r12
mov    0x2e67(%rip),%rax
cmp    (%rax),%r12
je     1139 <match_object_header_date+0x19>
mov    0x1(%rbx),%al
cmp    $0x2d,%al
je     1181 <match_object_header_date+0x61>
cmp    $0x2b,%al
jne    1139 <match_object_header_date+0x19>
lea    0x2(%rbx),%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    0x8(%rsp),%rcx
mov    (%rcx),%dl
cmp    $0xa,%dl
je     11a4 <match_object_header_date+0x84>
test   %dl,%dl
jne    1139 <match_object_header_date+0x19>
lea    0x6(%rbx),%rdx
cmp    %rdx,%rcx
jne    1139 <match_object_header_date+0x19>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x3c,%ecx,%edx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
add    %edx,%eax
mov    %eax,%ecx
neg    %ecx
cmpb   $0x2d,0x1(%rbx)
cmovne %eax,%ecx
mov    %r12,(%r15)
mov    %ecx,(%r14)
xor    %ebp,%ebp
jmp    1139 <match_object_header_date+0x19>

LLVM IR (-O0):
@ULONG_MAX = global i64 0
define i32 @match_object_header_date(i8* %0, i64* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store i8* %0, i8** %5
store i64* %1, i64** %6
store i32* %2, i32** %7
%11 = load i8*, i8** %5
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp slt i32 %13, 48
br i1 %14, label %20, label %15
15: ; preds = %3
%16 = load i8*, i8** %5
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp slt i32 57, %18
br i1 %19, label %20, label %21
20: ; preds = %15, %3
store i32 -1, i32* %4
br label %85
21: ; preds = %15
%22 = load i8*, i8** %5
%23 = call i64 @strtoul(i8* %22, i8** %8, i32 10)
store i64 %23, i64* %9
%24 = load i8*, i8** %8
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 32
br i1 %27, label %44, label %28
28: ; preds = %21
%29 = load i64, i64* %9
%30 = load i64, i64* @ULONG_MAX
%31 = icmp eq i64 %29, %30
br i1 %31, label %44, label %32
32: ; preds = %28
%33 = load i8*, i8** %8
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 43
br i1 %37, label %38, label %45
38: ; preds = %32
%39 = load i8*, i8** %8
%40 = getelementptr inbounds i8, i8* %39, i64 1
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp ne i32 %42, 45
br i1 %43, label %44, label %45
44: ; preds = %38, %28, %21
store i32 -1, i32* %4
br label %85
45: ; preds = %38, %32
%46 = load i8*, i8** %8
%47 = getelementptr inbounds i8, i8* %46, i64 2
store i8* %47, i8** %5
%48 = load i8*, i8** %5
%49 = call i32 @strtol(i8* %48, i8** %8, i32 10)
store i32 %49, i32* %10
%50 = load i8*, i8** %8
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %59
54: ; preds = %45
%55 = load i8*, i8** %8
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp ne i32 %57, 10
br i1 %58, label %64, label %59
59: ; preds = %54, %45
%60 = load i8*, i8** %8
%61 = load i8*, i8** %5
%62 = getelementptr inbounds i8, i8* %61, i64 4
%63 = icmp ne i8* %60, %62
br i1 %63, label %64, label %65
64: ; preds = %59, %54
store i32 -1, i32* %4
br label %85
65: ; preds = %59
%66 = load i32, i32* %10
%67 = sdiv i32 %66, 100
%68 = mul nsw i32 %67, 60
%69 = load i32, i32* %10
%70 = srem i32 %69, 100
%71 = add nsw i32 %68, %70
store i32 %71, i32* %10
%72 = load i8*, i8** %5
%73 = getelementptr inbounds i8, i8* %72, i64 -1
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %75, 45
br i1 %76, label %77, label %80
77: ; preds = %65
%78 = load i32, i32* %10
%79 = sub nsw i32 0, %78
store i32 %79, i32* %10
br label %80
80: ; preds = %77, %65
%81 = load i64, i64* %9
%82 = load i64*, i64** %6
store i64 %81, i64* %82
%83 = load i32, i32* %10
%84 = load i32*, i32** %7
store i32 %83, i32* %84
store i32 0, i32* %4
br label %85
85: ; preds = %80, %64, %44, %20
%86 = load i32, i32* %4
ret i32 %86
}

LLVM IR (-O2):
@ULONG_MAX = global i64 0
define i32 @match_object_header_date(i8* %0, i64* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = load i8, i8* %0
%7 = add i8 %6, -58
%8 = icmp ult i8 %7, -10
br i1 %8, label %37, label %9
9: ; preds = %3
%10 = call i64 @strtoul(i8* %0, i8** %4, i32 10)
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 32
%14 = load i64, i64* @ULONG_MAX
%15 = icmp eq i64 %10, %14
%16 = select i1 %13, i1 true, i1 %15
br i1 %16, label %37, label %17
17: ; preds = %9
%18 = getelementptr inbounds i8, i8* %11, i64 1
%19 = load i8, i8* %18
switch i8 %19, label %37 [
i8 43, label %20
i8 45, label %20
]
20: ; preds = %17, %17
%21 = getelementptr inbounds i8, i8* %11, i64 2
%22 = call i32 @strtol(i8* %21, i8** %4, i32 10)
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
switch i8 %24, label %37 [
i8 0, label %25
i8 10, label %25
]
25: ; preds = %20, %20
%26 = getelementptr inbounds i8, i8* %11, i64 6
%27 = icmp eq i8* %23, %26
br i1 %27, label %28, label %37
28: ; preds = %25
%29 = sdiv i32 %22, 100
%30 = mul nsw i32 %29, 60
%31 = srem i32 %22, 100
%32 = add nsw i32 %30, %31
%33 = load i8, i8* %18
%34 = icmp eq i8 %33, 45
%35 = sub nsw i32 0, %32
%36 = select i1 %34, i32 %35, i32 %32
store i64 %10, i64* %1
store i32 %36, i32* %2
br label %37
37: ; preds = %25, %20, %9, %17, %3, %28
%38 = phi i32 [ 0, %28 ], [ -1, %3 ], [ -1, %17 ], [ -1, %9 ], [ -1, %20 ], [ -1, %25 ]
ret i32 %38
}