#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 */
scalar_t__ _date(char *, char const *, char const *);
int main(int argc, char *argv[]) {
  int ret = 0;
  char const expected[] = "10/11/2011 10:11:12";
  ret += _date(argv[0], expected, expected);
  ret += _date(argv[0], expected, "10 Nov 2011 10:11:12 -0000");
  ret += _date(argv[0], expected, "Thu, 10 Nov 2011 10:11:12 -0000 (CET)");
  ret += _date(argv[0], expected, "Thu, 10 Nov 2011 10:11:12 +0000");
  ret += _date(argv[0], NULL, "");
  ret += _date(argv[0], NULL, NULL);
  return (ret == 0) ? 0 : ret + 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0xecc(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec9(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec7(%rip),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <_date@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x30(%rbp),%rsi
lea    0xe95(%rip),%rdx
call   1030 <_date@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x30(%rbp),%rsi
lea    0xe8c(%rip),%rdx
call   1030 <_date@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x30(%rbp),%rsi
lea    0xe8e(%rip),%rdx
call   1030 <_date@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
lea    0xe69(%rip),%rdx
call   1030 <_date@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1030 <_date@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1231 <main+0x121>
xor    %eax,%eax
mov    %eax,-0x34(%rbp)
jmp    123a <main+0x12a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
movaps 0xedb(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x32313a,0x10(%rsp)
mov    (%rsi),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
mov    %r14,%rdx
call   1030 <_date@plt>
mov    %rax,%r12
mov    (%r15),%rdi
lea    0xec5(%rip),%rdx
mov    %r14,%rsi
call   1030 <_date@plt>
add    %eax,%r12d
mov    (%r15),%rdi
lea    0xecb(%rip),%rdx
mov    %r14,%rsi
call   1030 <_date@plt>
mov    %rax,%rbx
add    %r12d,%ebx
mov    (%r15),%rdi
lea    0xed9(%rip),%rdx
mov    %r14,%rsi
call   1030 <_date@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    (%r15),%rdi
lea    0xec0(%rip),%rdx
xor    %esi,%esi
call   1030 <_date@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    (%r15),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <_date@plt>
mov    %ebx,%ecx
add    %eax,%ecx
lea    0x1(%rax,%rbx,1),%eax
cmove  %ecx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.expected = [20 x i8] c"10/11/2011 10:11:12\00"
@.str = [27 x i8] c"10 Nov 2011 10:11:12 -0000\00"
@.str.1 = [38 x i8] c"Thu, 10 Nov 2011 10:11:12 -0000 (CET)\00"
@.str.2 = [32 x i8] c"Thu, 10 Nov 2011 10:11:12 +0000\00"
@.str.3 = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [20 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%8 = bitcast [20 x i8]* %7 to i8*
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%14 = call i64 @_date(i8* %11, i8* %12, i8* %13)
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = add nsw i64 %16, %14
%18 = trunc i64 %17 to i32
store i32 %18, i32* %6
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%23 = call i64 @_date(i8* %21, i8* %22, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = add nsw i64 %25, %23
%27 = trunc i64 %26 to i32
store i32 %27, i32* %6
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%32 = call i64 @_date(i8* %30, i8* %31, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = add nsw i64 %34, %32
%36 = trunc i64 %35 to i32
store i32 %36, i32* %6
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 0
%39 = load i8*, i8** %38
%40 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%41 = call i64 @_date(i8* %39, i8* %40, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = add nsw i64 %43, %41
%45 = trunc i64 %44 to i32
store i32 %45, i32* %6
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 0
%48 = load i8*, i8** %47
%49 = call i64 @_date(i8* %48, i8* null, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = add nsw i64 %51, %49
%53 = trunc i64 %52 to i32
store i32 %53, i32* %6
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 0
%56 = load i8*, i8** %55
%57 = call i64 @_date(i8* %56, i8* null, i8* null)
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = add nsw i64 %59, %57
%61 = trunc i64 %60 to i32
store i32 %61, i32* %6
%62 = load i32, i32* %6
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %65
64: ; preds = %2
br label %68
65: ; preds = %2
%66 = load i32, i32* %6
%67 = add nsw i32 %66, 1
br label %68
68: ; preds = %65, %64
%69 = phi i32 [ 0, %64 ], [ %67, %65 ]
ret i32 %69
}

LLVM IR (-O2):
@__const.main.expected = [20 x i8] c"10/11/2011 10:11:12\00"
@.str = [27 x i8] c"10 Nov 2011 10:11:12 -0000\00"
@.str.1 = [38 x i8] c"Thu, 10 Nov 2011 10:11:12 -0000 (CET)\00"
@.str.2 = [32 x i8] c"Thu, 10 Nov 2011 10:11:12 +0000\00"
@.str.3 = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %1
%6 = call i64 @_date(i8* %5, i8* %4, i8* %4)
%7 = load i8*, i8** %1
%8 = call i64 @_date(i8* %7, i8* %4, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%9 = add i64 %8, %6
%10 = load i8*, i8** %1
%11 = call i64 @_date(i8* %10, i8* %4, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%12 = add i64 %9, %11
%13 = load i8*, i8** %1
%14 = call i64 @_date(i8* %13, i8* %4, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%15 = add i64 %12, %14
%16 = load i8*, i8** %1
%17 = call i64 @_date(i8* %16, i8* null, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%18 = add i64 %15, %17
%19 = load i8*, i8** %1
%20 = call i64 @_date(i8* %19, i8* null, i8* null)
%21 = add i64 %18, %20
%22 = trunc i64 %21 to i32
%23 = icmp eq i32 %22, 0
%24 = add nsw i32 %22, 1
%25 = select i1 %23, i32 0, i32 %24
ret i32 %25
}