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

/* Variables and functions */
char *gentime_string_from_tm(struct tm *);
char *utctime_string_from_tm(struct tm *);
char *rfc5280_string_from_tm(struct tm *tm) {
  char *ret = NULL;
  int year;
  year = tm->tm_year + 1900;
  if (year < 1950 || year > 9999)
    return (NULL);
  if (year < 2050)
    ret = utctime_string_from_tm(tm);
  else
    ret = gentime_string_from_tm(tm);
  return (ret);
}


x86 assembly (clang, -O0):
<rfc5280_string_from_tm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x76c,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x79e,-0x1c(%rbp)
jl     115c <rfc5280_string_from_tm+0x3c>
cmpl   $0x270f,-0x1c(%rbp)
jle    1169 <rfc5280_string_from_tm+0x49>
movq   $0x0,-0x8(%rbp)
jmp    119d <rfc5280_string_from_tm+0x7d>
cmpl   $0x802,-0x1c(%rbp)
jge    1188 <rfc5280_string_from_tm+0x68>
mov    -0x10(%rbp),%rdi
call   1040 <utctime_string_from_tm@plt>
mov    %rax,-0x18(%rbp)
jmp    1195 <rfc5280_string_from_tm+0x75>
mov    -0x10(%rbp),%rdi
call   1030 <gentime_string_from_tm@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rfc5280_string_from_tm>:
mov    (%rdi),%eax
lea    -0x1fa4(%rax),%ecx
cmp    $0xffffe08e,%ecx
jae    1133 <rfc5280_string_from_tm+0x13>
xor    %eax,%eax
ret
cmp    $0x95,%eax
ja     113f <rfc5280_string_from_tm+0x1f>
jmp    1040 <utctime_string_from_tm@plt>
jmp    1030 <gentime_string_from_tm@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
define i8* @rfc5280_string_from_tm(%struct.tm* %0) {
%2 = alloca i8*
%3 = alloca %struct.tm*
%4 = alloca i8*
%5 = alloca i32
store %struct.tm* %0, %struct.tm** %3
store i8* null, i8** %4
%6 = load %struct.tm*, %struct.tm** %3
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1900
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 1950
br i1 %11, label %15, label %12
12: ; preds = %1
%13 = load i32, i32* %5
%14 = icmp sgt i32 %13, 9999
br i1 %14, label %15, label %16
15: ; preds = %12, %1
store i8* null, i8** %2
br label %27
16: ; preds = %12
%17 = load i32, i32* %5
%18 = icmp slt i32 %17, 2050
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load %struct.tm*, %struct.tm** %3
%21 = call i8* @utctime_string_from_tm(%struct.tm* %20)
store i8* %21, i8** %4
br label %25
22: ; preds = %16
%23 = load %struct.tm*, %struct.tm** %3
%24 = call i8* @gentime_string_from_tm(%struct.tm* %23)
store i8* %24, i8** %4
br label %25
25: ; preds = %22, %19
%26 = load i8*, i8** %4
store i8* %26, i8** %2
br label %27
27: ; preds = %25, %15
%28 = load i8*, i8** %2
ret i8* %28
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i8* @rfc5280_string_from_tm(%struct.tm* %0) {
%2 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = add i32 %3, -8100
%5 = icmp ult i32 %4, -8050
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = icmp ult i32 %3, 150
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i8* @utctime_string_from_tm(%struct.tm* %0)
br label %12
10: ; preds = %6
%11 = tail call i8* @gentime_string_from_tm(%struct.tm* %0)
br label %12
12: ; preds = %8, %10, %1
%13 = phi i8* [ null, %1 ], [ %9, %8 ], [ %11, %10 ]
ret i8* %13
}