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

/* Variables and functions */
char *out_str(char *, char *, char *);
char *full_month_name(char *buf, char *end, const struct tm *t) {
  if (t->tm_mon < 0 || t->tm_mon > 11)
    return NULL;
  static char *names[] = {"January",   "February", "March",    "April",
                          "May",       "June",     "July",     "August",
                          "September", "October",  "November", "December"};
  return out_str(buf, end, names[t->tm_mon]);
}


x86 assembly (clang, -O0):
<full_month_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jl     113e <full_month_name+0x2e>
mov    -0x20(%rbp),%rax
cmpl   $0xb,(%rax)
jle    114b <full_month_name+0x3b>
movq   $0x0,-0x8(%rbp)
jmp    116e <full_month_name+0x5e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rax
movslq (%rax),%rcx
lea    0x2ecf(%rip),%rax
mov    (%rax,%rcx,8),%rdx
call   1030 <out_str@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<full_month_name>:
mov    (%rdx),%eax
cmp    $0xb,%rax
jbe    111b <full_month_name+0xb>
xor    %eax,%eax
ret
lea    0xede(%rip),%rcx
movslq (%rcx,%rax,4),%rdx
add    %rcx,%rdx
jmp    1030 <out_str@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
@full_month_name.names = internal global [12 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i32 0, i32 0)]
@.str = [8 x i8] c"January\00"
@.str.1 = [9 x i8] c"February\00"
@.str.2 = [6 x i8] c"March\00"
@.str.3 = [6 x i8] c"April\00"
@.str.4 = [4 x i8] c"May\00"
@.str.5 = [5 x i8] c"June\00"
@.str.6 = [5 x i8] c"July\00"
@.str.7 = [7 x i8] c"August\00"
@.str.8 = [10 x i8] c"September\00"
@.str.9 = [8 x i8] c"October\00"
@.str.10 = [9 x i8] c"November\00"
@.str.11 = [9 x i8] c"December\00"
define i8* @full_month_name(i8* %0, i8* %1, %struct.tm* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.tm*
store i8* %0, i8** %5
store i8* %1, i8** %6
store %struct.tm* %2, %struct.tm** %7
%8 = load %struct.tm*, %struct.tm** %7
%9 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = icmp slt i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %3
%13 = load %struct.tm*, %struct.tm** %7
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = icmp sgt i32 %15, 11
br i1 %16, label %17, label %18
17: ; preds = %12, %3
store i8* null, i8** %4
br label %28
18: ; preds = %12
%19 = load i8*, i8** %5
%20 = load i8*, i8** %6
%21 = load %struct.tm*, %struct.tm** %7
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 0
%23 = load i32, i32* %22
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [12 x i8*], [12 x i8*]* @full_month_name.names, i64 0, i64 %24
%26 = load i8*, i8** %25
%27 = call i8* @out_str(i8* %19, i8* %20, i8* %26)
store i8* %27, i8** %4
br label %28
28: ; preds = %18, %17
%29 = load i8*, i8** %4
ret i8* %29
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@reltable.full_month_name = internal unnamed_addr constant [12 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str to i64), i64 ptrtoint ([12 x i32]* @reltable.full_month_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.1 to i64), i64 ptrtoint ([12 x i32]* @reltable.full_month_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([12 x i32]* @reltable.full_month_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([12 x i32]* @reltable.full_month_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([12 x i32]* @reltable.full_month_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([12 x i32]* @reltable.full_month_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.6 to i64), i64 ptrtoint ([12 x i32]* @reltable.full_month_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.full_month_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.8 to i64), i64 ptrtoint ([12 x i32]* @reltable.full_month_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.9 to i64), i64 ptrtoint ([12 x i32]* @reltable.full_month_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.10 to i64), i64 ptrtoint ([12 x i32]* @reltable.full_month_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.11 to i64), i64 ptrtoint ([12 x i32]* @reltable.full_month_name to i64)) to i32)]
@.str = [8 x i8] c"January\00"
@.str.1 = [9 x i8] c"February\00"
@.str.2 = [6 x i8] c"March\00"
@.str.3 = [6 x i8] c"April\00"
@.str.4 = [4 x i8] c"May\00"
@.str.5 = [5 x i8] c"June\00"
@.str.6 = [5 x i8] c"July\00"
@.str.7 = [7 x i8] c"August\00"
@.str.8 = [10 x i8] c"September\00"
@.str.9 = [8 x i8] c"October\00"
@.str.10 = [9 x i8] c"November\00"
@.str.11 = [9 x i8] c"December\00"
define i8* @full_month_name(i8* %0, i8* %1, %struct.tm* nocapture %2) {
%4 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
%5 = load i32, i32* %4
%6 = icmp ugt i32 %5, 11
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = zext i32 %5 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([12 x i32]* @reltable.full_month_name to i8*), i64 %9)
%11 = tail call i8* @out_str(i8* %0, i8* %1, i8* %10)
br label %12
12: ; preds = %3, %7
%13 = phi i8* [ %11, %7 ], [ null, %3 ]
ret i8* %13
}