#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 int atoi(char *);
unsigned int secs(char *s) {
  unsigned int m, y;
  unsigned int mm[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
  y = atoi(s);
  if (y < 1970 || y > 2106)
    return 0;
  m = atoi(s + 5) - 1;
  return ((y - 1970) * 365 + (y - 1969) / 4 + mm[m] + (m >= 2 && (y & 3) == 0) +
          atoi(s + 8) - 1) *
         24 * 60 * 60;
}


x86 assembly (clang, -O0):
<secs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xec9(%rip),%rsi
mov    $0x30,%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x7b2,-0x18(%rbp)
jb     1167 <secs+0x47>
cmpl   $0x83a,-0x18(%rbp)
jbe    1173 <secs+0x53>
movl   $0x0,-0x4(%rbp)
jmp    11fe <secs+0xde>
mov    -0x10(%rbp),%rdi
add    $0x5,%rdi
call   1040 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x7b2,%eax
imul   $0x16d,%eax,%eax
mov    -0x18(%rbp),%ecx
sub    $0x7b1,%ecx
shr    $0x2,%ecx
add    %ecx,%eax
mov    -0x14(%rbp),%ecx
add    -0x50(%rbp,%rcx,4),%eax
mov    %eax,-0x58(%rbp)
xor    %eax,%eax
cmpl   $0x2,-0x14(%rbp)
mov    %al,-0x51(%rbp)
jb     11ca <secs+0xaa>
mov    -0x18(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x51(%rbp)
mov    -0x58(%rbp),%eax
mov    -0x51(%rbp),%cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
add    %ecx,%eax
sub    $0x1,%eax
imul   $0x18,%eax,%eax
imul   $0x3c,%eax,%eax
imul   $0x3c,%eax,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<secs>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <atoi@plt>
mov    %eax,%r14d
lea    -0x83b(%r14),%ecx
xor    %eax,%eax
cmp    $0xffffff77,%ecx
jb     1191 <secs+0x81>
lea    0x5(%rbx),%rdi
call   1030 <atoi@plt>
mov    %eax,%r15d
add    $0xffffffff,%r15d
imul   $0x16d,%r14d,%eax
mov    %r14d,%ebp
add    $0xfffff84f,%ebp
shr    $0x2,%ebp
add    %eax,%ebp
lea    0xea1(%rip),%rax
add    (%rax,%r15,4),%ebp
add    $0x8,%rbx
mov    %rbx,%rdi
call   1030 <atoi@plt>
add    %ebp,%eax
cmp    $0x2,%r15d
setae  %cl
test   $0x3,%r14b
sete   %dl
and    %cl,%dl
movzbl %dl,%ecx
add    %eax,%ecx
imul   $0x15180,%ecx,%eax
add    $0x89005f80,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.secs.mm = [12 x i32] [i32 0, i32 31, i32 59, i32 90, i32 120, i32 151, i32 181, i32 212, i32 243, i32 273, i32 304, i32 334]
define i32 @secs(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [12 x i32]
store i8* %0, i8** %3
%7 = bitcast [12 x i32]* %6 to i8*
%8 = load i8*, i8** %3
%9 = call i32 @atoi(i8* %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp ult i32 %10, 1970
br i1 %11, label %15, label %12
12: ; preds = %1
%13 = load i32, i32* %5
%14 = icmp ugt i32 %13, 2106
br i1 %14, label %15, label %16
15: ; preds = %12, %1
store i32 0, i32* %2
br label %51
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 5
%19 = call i32 @atoi(i8* %18)
%20 = sub i32 %19, 1
store i32 %20, i32* %4
%21 = load i32, i32* %5
%22 = sub i32 %21, 1970
%23 = mul i32 %22, 365
%24 = load i32, i32* %5
%25 = sub i32 %24, 1969
%26 = udiv i32 %25, 4
%27 = add i32 %23, %26
%28 = load i32, i32* %4
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds [12 x i32], [12 x i32]* %6, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = add i32 %27, %31
%33 = load i32, i32* %4
%34 = icmp uge i32 %33, 2
br i1 %34, label %35, label %39
35: ; preds = %16
%36 = load i32, i32* %5
%37 = and i32 %36, 3
%38 = icmp eq i32 %37, 0
br label %39
39: ; preds = %35, %16
%40 = phi i1 [ false, %16 ], [ %38, %35 ]
%41 = zext i1 %40 to i32
%42 = add i32 %32, %41
%43 = load i8*, i8** %3
%44 = getelementptr inbounds i8, i8* %43, i64 8
%45 = call i32 @atoi(i8* %44)
%46 = add i32 %42, %45
%47 = sub i32 %46, 1
%48 = mul i32 %47, 24
%49 = mul i32 %48, 60
%50 = mul i32 %49, 60
store i32 %50, i32* %2
br label %51
51: ; preds = %39, %15
%52 = load i32, i32* %2
ret i32 %52
}

LLVM IR (-O2):
@__const.secs.mm = [12 x i32] [i32 0, i32 31, i32 59, i32 90, i32 120, i32 151, i32 181, i32 212, i32 243, i32 273, i32 304, i32 334]
define i32 @secs(i8* nocapture %0) {
%2 = tail call i32 @atoi(i8* %0)
%3 = add i32 %2, -2107
%4 = icmp ult i32 %3, -137
br i1 %4, label %29, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 5
%7 = tail call i32 @atoi(i8* %6)
%8 = add i32 %7, -1
%9 = mul nuw nsw i32 %2, 365
%10 = add nsw i32 %9, -719050
%11 = add nsw i32 %2, -1969
%12 = lshr i32 %11, 2
%13 = add nuw nsw i32 %10, %12
%14 = zext i32 %8 to i64
%15 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.secs.mm, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = add i32 %13, %16
%18 = icmp ugt i32 %8, 1
%19 = and i32 %2, 3
%20 = icmp eq i32 %19, 0
%21 = select i1 %18, i1 %20, i1 false
%22 = zext i1 %21 to i32
%23 = getelementptr inbounds i8, i8* %0, i64 8
%24 = tail call i32 @atoi(i8* %23)
%25 = add i32 %17, %24
%26 = add i32 %25, %22
%27 = mul i32 %26, 86400
%28 = add i32 %27, -86400
br label %29
29: ; preds = %1, %5
%30 = phi i32 [ %28, %5 ], [ 0, %1 ]
ret i32 %30
}