#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 dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
char *strptime(char *, char *, struct tm *);
struct tm *parse_rfc822(char *name, char *rss_datetime) {
  static struct tm datetime;
  if (rss_datetime == NULL)
    return NULL;
  char *zone = strptime(rss_datetime, "%a , %d %b %y %T ", &datetime);
  if (zone == NULL) {
    zone = strptime(rss_datetime, "%d %b %y %T ", &datetime);
  }
  if (zone == NULL) {
    zone = strptime(rss_datetime, "%a , %d %b %Y %T ", &datetime);
  }
  if (zone == NULL) {
    zone = strptime(rss_datetime, "%d %b %Y %T ", &datetime);
  }
  if (zone == NULL) {
    fprintf(stderr, "%s: malformed feed: invalid date/time '%s'\n", name,
            rss_datetime);
    return NULL;
  }
  return &datetime;
}


x86 assembly (clang, -O0):
<parse_rfc822>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1148 <parse_rfc822+0x28>
movq   $0x0,-0x8(%rbp)
jmp    1215 <parse_rfc822+0xf5>
mov    -0x18(%rbp),%rdi
lea    0xead(%rip),%rsi
lea    0x2eda(%rip),%rdx
call   1040 <strptime@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1189 <parse_rfc822+0x69>
mov    -0x18(%rbp),%rdi
lea    0xe8c(%rip),%rsi
lea    0x2eb4(%rip),%rdx
call   1040 <strptime@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11af <parse_rfc822+0x8f>
mov    -0x18(%rbp),%rdi
lea    0xe73(%rip),%rsi
lea    0x2e8e(%rip),%rdx
call   1040 <strptime@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11d5 <parse_rfc822+0xb5>
mov    -0x18(%rbp),%rdi
lea    0xe52(%rip),%rsi
lea    0x2e68(%rip),%rdx
call   1040 <strptime@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    120a <parse_rfc822+0xea>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe2c(%rip),%rsi
call   1030 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
jmp    1215 <parse_rfc822+0xf5>
lea    0x2e23(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_rfc822>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
je     11c7 <parse_rfc822+0xa7>
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xec5(%rip),%rsi
lea    0x2ef2(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rdx
call   1040 <strptime@plt>
test   %rax,%rax
jne    11c9 <parse_rfc822+0xa9>
lea    0xeac(%rip),%rsi
lea    0x2ed4(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rdx
call   1040 <strptime@plt>
test   %rax,%rax
jne    11c9 <parse_rfc822+0xa9>
lea    0xe9b(%rip),%rsi
lea    0x2eb6(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rdx
call   1040 <strptime@plt>
test   %rax,%rax
jne    11c9 <parse_rfc822+0xa9>
lea    0xe82(%rip),%rsi
lea    0x2e98(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rdx
call   1040 <strptime@plt>
test   %rax,%rax
jne    11c9 <parse_rfc822+0xa9>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
mov    %r14,%rdx
mov    %r15,%rcx
call   1030 <fprintf@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@parse_rfc822.datetime = internal global %struct.tm zeroinitializer
@.str = [18 x i8] c"%a , %d %b %y %T \00"
@.str.1 = [13 x i8] c"%d %b %y %T \00"
@.str.2 = [18 x i8] c"%a , %d %b %Y %T \00"
@.str.3 = [13 x i8] c"%d %b %Y %T \00"
@stderr = global i32 0
@.str.4 = [44 x i8] c"%s: malformed feed: invalid date/time '%s'\0A\00"
define %struct.tm* @parse_rfc822(i8* %0, i8* %1) {
%3 = alloca %struct.tm*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %2
store %struct.tm* null, %struct.tm** %3
br label %39
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = call i8* @strptime(i8* %11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* @parse_rfc822.datetime)
store i8* %12, i8** %6
%13 = load i8*, i8** %6
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i8*, i8** %5
%17 = call i8* @strptime(i8* %16, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %struct.tm* @parse_rfc822.datetime)
store i8* %17, i8** %6
br label %18
18: ; preds = %15, %10
%19 = load i8*, i8** %6
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i8*, i8** %5
%23 = call i8* @strptime(i8* %22, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), %struct.tm* @parse_rfc822.datetime)
store i8* %23, i8** %6
br label %24
24: ; preds = %21, %18
%25 = load i8*, i8** %6
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i8*, i8** %5
%29 = call i8* @strptime(i8* %28, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), %struct.tm* @parse_rfc822.datetime)
store i8* %29, i8** %6
br label %30
30: ; preds = %27, %24
%31 = load i8*, i8** %6
%32 = icmp eq i8* %31, null
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load i32, i32* @stderr
%35 = load i8*, i8** %4
%36 = load i8*, i8** %5
%37 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i8* %35, i8* %36)
store %struct.tm* null, %struct.tm** %3
br label %39
38: ; preds = %30
store %struct.tm* @parse_rfc822.datetime, %struct.tm** %3
br label %39
39: ; preds = %38, %33, %9
%40 = load %struct.tm*, %struct.tm** %3
ret %struct.tm* %40
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@parse_rfc822.datetime = internal global %struct.tm zeroinitializer
@.str = [18 x i8] c"%a , %d %b %y %T \00"
@.str.1 = [13 x i8] c"%d %b %y %T \00"
@.str.2 = [18 x i8] c"%a , %d %b %Y %T \00"
@.str.3 = [13 x i8] c"%d %b %Y %T \00"
@stderr = global i32 0
@.str.4 = [44 x i8] c"%s: malformed feed: invalid date/time '%s'\0A\00"
define %struct.tm* @parse_rfc822(i8* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %19, label %4
4: ; preds = %2
%5 = tail call i8* @strptime(i8* %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* @parse_rfc822.datetime)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = tail call i8* @strptime(i8* %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %struct.tm* @parse_rfc822.datetime)
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = tail call i8* @strptime(i8* %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), %struct.tm* @parse_rfc822.datetime)
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = tail call i8* @strptime(i8* %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), %struct.tm* @parse_rfc822.datetime)
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i8* %0, i8* %1)
br label %19
19: ; preds = %4, %7, %10, %16, %13, %2
%20 = phi %struct.tm* [ null, %2 ], [ null, %16 ], [ @parse_rfc822.datetime, %13 ], [ @parse_rfc822.datetime, %10 ], [ @parse_rfc822.datetime, %7 ], [ @parse_rfc822.datetime, %4 ]
ret %struct.tm* %20
}