#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 */
struct tm {
  int tm_year;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
  void *tm_mon;
  void *tm_wday;
};

/* Variables and functions */
void *find_month(char *);
void *find_weekday(char *);
void *find_wkday(char *);
int sscanf(char *, char *, char *, ...);
void parse_date(char *str, struct tm *t) {
  char wkday[(256)];
  char weekday[(256)];
  char month[(256)];
  int day;
  int year;
  int h;
  int m;
  int s;
  if (sscanf(str, "%400[a-zA-Z] %400[a-zA-Z] %d %d:%d:%d %d", wkday, month,
             &day, &h, &m, &s, &year) == 7) {
    t->tm_wday = find_wkday(wkday);
    t->tm_year = year - 1900;
    t->tm_mon = find_month(month);
    t->tm_mday = day;
    t->tm_hour = h;
    t->tm_min = m;
    t->tm_sec = s;
  } else if (sscanf(str, "%400[a-zA-Z], %d-%400[a-zA-Z]-%d %d:%d:%d GMT",
                    weekday, &day, month, &year, &h, &m, &s) == 7) {
    t->tm_wday = find_weekday(wkday);
    t->tm_year = year;
    t->tm_mon = find_month(month);
    t->tm_mday = day;
    t->tm_hour = h;
    t->tm_min = m;
    t->tm_sec = s;
  } else if (sscanf(str, "%400[a-zA-Z], %d %400[a-zA-Z] %d %d:%d:%d GMT", wkday,
                    &day, month, &year, &h, &m, &s) == 7) {
    t->tm_wday = find_wkday(wkday);
    t->tm_year = year - 1900;
    t->tm_mon = find_month(month);
    t->tm_mday = day;
    t->tm_hour = h;
    t->tm_min = m;
    t->tm_sec = s;
  } else {
    t = NULL;
  }
}


x86 assembly (clang, -O0):
<parse_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rdx
lea    -0x310(%rbp),%rcx
lea    0xe94(%rip),%rsi
lea    -0x314(%rbp),%r8
lea    -0x31c(%rbp),%r9
lea    -0x320(%rbp),%r11
lea    -0x324(%rbp),%r10
lea    -0x318(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x7,%eax
jne    1226 <parse_date+0xe6>
lea    -0x110(%rbp),%rdi
call   1060 <find_wkday@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x318(%rbp),%ecx
sub    $0x76c,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x310(%rbp),%rdi
call   1040 <find_month@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x314(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x31c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x320(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x324(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
jmp    13d8 <parse_date+0x298>
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rdx
lea    -0x310(%rbp),%r8
lea    0xdea(%rip),%rsi
lea    -0x314(%rbp),%rcx
lea    -0x318(%rbp),%r9
lea    -0x31c(%rbp),%r11
lea    -0x320(%rbp),%r10
lea    -0x324(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x7,%eax
jne    12f3 <parse_date+0x1b3>
lea    -0x110(%rbp),%rdi
call   1030 <find_weekday@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x318(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x310(%rbp),%rdi
call   1040 <find_month@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x314(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x31c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x320(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x324(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
jmp    13d3 <parse_date+0x293>
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rdx
lea    -0x310(%rbp),%r8
lea    0xd4b(%rip),%rsi
lea    -0x314(%rbp),%rcx
lea    -0x318(%rbp),%r9
lea    -0x31c(%rbp),%r11
lea    -0x320(%rbp),%r10
lea    -0x324(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x7,%eax
jne    13c6 <parse_date+0x286>
lea    -0x110(%rbp),%rdi
call   1060 <find_wkday@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x318(%rbp),%ecx
sub    $0x76c,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x310(%rbp),%rdi
call   1040 <find_month@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x314(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x31c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x320(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x324(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
jmp    13ce <parse_date+0x28e>
movq   $0x0,-0x10(%rbp)
jmp    13d3 <parse_date+0x293>
jmp    13d8 <parse_date+0x298>
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_date>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x320,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
sub    $0x8,%rsp
lea    0x14(%rsp),%r10
lea    0x20(%rsp),%r13
lea    0x24(%rsp),%r12
lea    0xe90(%rip),%rsi
lea    0x128(%rsp),%rdx
lea    0x28(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x1c(%rsp),%r15
mov    %r15,%r9
xor    %eax,%eax
push   %r10
push   %r13
push   %r12
call   1050 <sscanf@plt>
add    $0x20,%rsp
cmp    $0x7,%eax
je     1231 <parse_date+0xf1>
sub    $0x8,%rsp
lea    0xe7a(%rip),%rsi
lea    0x228(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x28(%rsp),%r8
lea    0x14(%rsp),%r9
mov    %r14,%rdi
xor    %eax,%eax
push   %r13
push   %r12
push   %r15
call   1050 <sscanf@plt>
add    $0x20,%rsp
cmp    $0x7,%eax
jne    11f6 <parse_date+0xb6>
lea    0x120(%rsp),%rdi
call   1030 <find_weekday@plt>
mov    %rax,0x20(%rbx)
mov    0xc(%rsp),%eax
jmp    124b <parse_date+0x10b>
sub    $0x8,%rsp
lea    0xe56(%rip),%rsi
lea    0x128(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x28(%rsp),%r8
lea    0x14(%rsp),%r9
mov    %r14,%rdi
xor    %eax,%eax
push   %r13
push   %r12
push   %r15
call   1050 <sscanf@plt>
add    $0x20,%rsp
cmp    $0x7,%eax
jne    1277 <parse_date+0x137>
lea    0x120(%rsp),%rdi
call   1060 <find_wkday@plt>
mov    %rax,0x20(%rbx)
mov    $0xfffff894,%eax
add    0xc(%rsp),%eax
mov    %eax,(%rbx)
lea    0x20(%rsp),%rdi
call   1040 <find_month@plt>
mov    %rax,0x18(%rbx)
mov    0x10(%rsp),%eax
mov    %eax,0x4(%rbx)
mov    0x14(%rsp),%eax
mov    %eax,0x8(%rbx)
mov    0x1c(%rsp),%eax
mov    %eax,0xc(%rbx)
mov    0x18(%rsp),%eax
mov    %eax,0x10(%rbx)
add    $0x320,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i8*, i8* }
@.str = [41 x i8] c"%400[a-zA-Z] %400[a-zA-Z] %d %d:%d:%d %d\00"
@.str.1 = [46 x i8] c"%400[a-zA-Z], %d-%400[a-zA-Z]-%d %d:%d:%d GMT\00"
@.str.2 = [46 x i8] c"%400[a-zA-Z], %d %400[a-zA-Z] %d %d:%d:%d GMT\00"
define void @parse_date(i8* %0, %struct.tm* %1) {
%3 = alloca i8*
%4 = alloca %struct.tm*
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %3
store %struct.tm* %1, %struct.tm** %4
%13 = load i8*, i8** %3
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%16 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %13, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15, i32* %8, i32* %10, i32* %11, i32* %12, i32* %9)
%17 = icmp eq i32 %16, 7
br i1 %17, label %18, label %43
18: ; preds = %2
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%20 = call i8* @find_wkday(i8* %19)
%21 = load %struct.tm*, %struct.tm** %4
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 6
store i8* %20, i8** %22
%23 = load i32, i32* %9
%24 = sub nsw i32 %23, 1900
%25 = load %struct.tm*, %struct.tm** %4
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 0
store i32 %24, i32* %26
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%28 = call i8* @find_month(i8* %27)
%29 = load %struct.tm*, %struct.tm** %4
%30 = getelementptr inbounds %struct.tm, %struct.tm* %29, i32 0, i32 5
store i8* %28, i8** %30
%31 = load i32, i32* %8
%32 = load %struct.tm*, %struct.tm** %4
%33 = getelementptr inbounds %struct.tm, %struct.tm* %32, i32 0, i32 1
store i32 %31, i32* %33
%34 = load i32, i32* %10
%35 = load %struct.tm*, %struct.tm** %4
%36 = getelementptr inbounds %struct.tm, %struct.tm* %35, i32 0, i32 2
store i32 %34, i32* %36
%37 = load i32, i32* %11
%38 = load %struct.tm*, %struct.tm** %4
%39 = getelementptr inbounds %struct.tm, %struct.tm* %38, i32 0, i32 3
store i32 %37, i32* %39
%40 = load i32, i32* %12
%41 = load %struct.tm*, %struct.tm** %4
%42 = getelementptr inbounds %struct.tm, %struct.tm* %41, i32 0, i32 4
store i32 %40, i32* %42
br label %107
43: ; preds = %2
%44 = load i8*, i8** %3
%45 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%46 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%47 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %44, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %45, i32* %8, i8* %46, i32* %9, i32* %10, i32* %11, i32* %12)
%48 = icmp eq i32 %47, 7
br i1 %48, label %49, label %73
49: ; preds = %43
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%51 = call i8* @find_weekday(i8* %50)
%52 = load %struct.tm*, %struct.tm** %4
%53 = getelementptr inbounds %struct.tm, %struct.tm* %52, i32 0, i32 6
store i8* %51, i8** %53
%54 = load i32, i32* %9
%55 = load %struct.tm*, %struct.tm** %4
%56 = getelementptr inbounds %struct.tm, %struct.tm* %55, i32 0, i32 0
store i32 %54, i32* %56
%57 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%58 = call i8* @find_month(i8* %57)
%59 = load %struct.tm*, %struct.tm** %4
%60 = getelementptr inbounds %struct.tm, %struct.tm* %59, i32 0, i32 5
store i8* %58, i8** %60
%61 = load i32, i32* %8
%62 = load %struct.tm*, %struct.tm** %4
%63 = getelementptr inbounds %struct.tm, %struct.tm* %62, i32 0, i32 1
store i32 %61, i32* %63
%64 = load i32, i32* %10
%65 = load %struct.tm*, %struct.tm** %4
%66 = getelementptr inbounds %struct.tm, %struct.tm* %65, i32 0, i32 2
store i32 %64, i32* %66
%67 = load i32, i32* %11
%68 = load %struct.tm*, %struct.tm** %4
%69 = getelementptr inbounds %struct.tm, %struct.tm* %68, i32 0, i32 3
store i32 %67, i32* %69
%70 = load i32, i32* %12
%71 = load %struct.tm*, %struct.tm** %4
%72 = getelementptr inbounds %struct.tm, %struct.tm* %71, i32 0, i32 4
store i32 %70, i32* %72
br label %106
73: ; preds = %43
%74 = load i8*, i8** %3
%75 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%76 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%77 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %74, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i8* %75, i32* %8, i8* %76, i32* %9, i32* %10, i32* %11, i32* %12)
%78 = icmp eq i32 %77, 7
br i1 %78, label %79, label %104
79: ; preds = %73
%80 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%81 = call i8* @find_wkday(i8* %80)
%82 = load %struct.tm*, %struct.tm** %4
%83 = getelementptr inbounds %struct.tm, %struct.tm* %82, i32 0, i32 6
store i8* %81, i8** %83
%84 = load i32, i32* %9
%85 = sub nsw i32 %84, 1900
%86 = load %struct.tm*, %struct.tm** %4
%87 = getelementptr inbounds %struct.tm, %struct.tm* %86, i32 0, i32 0
store i32 %85, i32* %87
%88 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%89 = call i8* @find_month(i8* %88)
%90 = load %struct.tm*, %struct.tm** %4
%91 = getelementptr inbounds %struct.tm, %struct.tm* %90, i32 0, i32 5
store i8* %89, i8** %91
%92 = load i32, i32* %8
%93 = load %struct.tm*, %struct.tm** %4
%94 = getelementptr inbounds %struct.tm, %struct.tm* %93, i32 0, i32 1
store i32 %92, i32* %94
%95 = load i32, i32* %10
%96 = load %struct.tm*, %struct.tm** %4
%97 = getelementptr inbounds %struct.tm, %struct.tm* %96, i32 0, i32 2
store i32 %95, i32* %97
%98 = load i32, i32* %11
%99 = load %struct.tm*, %struct.tm** %4
%100 = getelementptr inbounds %struct.tm, %struct.tm* %99, i32 0, i32 3
store i32 %98, i32* %100
%101 = load i32, i32* %12
%102 = load %struct.tm*, %struct.tm** %4
%103 = getelementptr inbounds %struct.tm, %struct.tm* %102, i32 0, i32 4
store i32 %101, i32* %103
br label %105
104: ; preds = %73
store %struct.tm* null, %struct.tm** %4
br label %105
105: ; preds = %104, %79
br label %106
106: ; preds = %105, %49
br label %107
107: ; preds = %106, %18
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i8*, i8* }
@.str = [41 x i8] c"%400[a-zA-Z] %400[a-zA-Z] %d %d:%d:%d %d\00"
@.str.1 = [46 x i8] c"%400[a-zA-Z], %d-%400[a-zA-Z]-%d %d:%d:%d GMT\00"
@.str.2 = [46 x i8] c"%400[a-zA-Z], %d %400[a-zA-Z] %d %d:%d:%d GMT\00"
define void @parse_date(i8* nocapture %0, %struct.tm* writeonly %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = bitcast i32* %8 to i8*
%17 = bitcast i32* %9 to i8*
%18 = bitcast i32* %10 to i8*
%19 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %13, i32* %6, i32* %8, i32* %9, i32* %10, i32* %7)
%20 = icmp eq i32 %19, 7
br i1 %20, label %21, label %33
21: ; preds = %2
%22 = call i8* @find_wkday(i8* %11)
%23 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 6
store i8* %22, i8** %23
%24 = load i32, i32* %7
%25 = add nsw i32 %24, -1900
%26 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 0
store i32 %25, i32* %26
%27 = call i8* @find_month(i8* %13)
%28 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 5
store i8* %27, i8** %28
%29 = load i32, i32* %6
%30 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 1
store i32 %29, i32* %30
%31 = load i32, i32* %8
%32 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 2
store i32 %31, i32* %32
br label %62
33: ; preds = %2
%34 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %0, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %12, i32* %6, i8* %13, i32* %7, i32* %8, i32* %9, i32* %10)
%35 = icmp eq i32 %34, 7
br i1 %35, label %36, label %47
36: ; preds = %33
%37 = call i8* @find_weekday(i8* %11)
%38 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 6
store i8* %37, i8** %38
%39 = load i32, i32* %7
%40 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 0
store i32 %39, i32* %40
%41 = call i8* @find_month(i8* %13)
%42 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 5
store i8* %41, i8** %42
%43 = load i32, i32* %6
%44 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 1
store i32 %43, i32* %44
%45 = load i32, i32* %8
%46 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 2
store i32 %45, i32* %46
br label %62
47: ; preds = %33
%48 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %0, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i8* %11, i32* %6, i8* %13, i32* %7, i32* %8, i32* %9, i32* %10)
%49 = icmp eq i32 %48, 7
br i1 %49, label %50, label %67
50: ; preds = %47
%51 = call i8* @find_wkday(i8* %11)
%52 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 6
store i8* %51, i8** %52
%53 = load i32, i32* %7
%54 = add nsw i32 %53, -1900
%55 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 0
store i32 %54, i32* %55
%56 = call i8* @find_month(i8* %13)
%57 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 5
store i8* %56, i8** %57
%58 = load i32, i32* %6
%59 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 1
store i32 %58, i32* %59
%60 = load i32, i32* %8
%61 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 2
store i32 %60, i32* %61
br label %62
62: ; preds = %21, %50, %36
%63 = load i32, i32* %9
%64 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 3
store i32 %63, i32* %64
%65 = load i32, i32* %10
%66 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 4
store i32 %65, i32* %66
br label %67
67: ; preds = %62, %47
ret void
}