#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 */
int /*<<< orphan*/ strcpy(char *, char *);
void getname(int year, int div, char *divname) {
  char *(dn0[5]) = {"Premiership", "Division 1", "Division 2", "Division 3",
                    "Conference"};
  char *(dn1[5]) = {"Premiership", "Championship", "League 1", "League 2",
                    "Conference"};
  char *(dn2[5]) = {"Premier League", "Championship", "League 1", "League 2",
                    "Conference"};
  if (year < 2004)
    strcpy(divname, dn0[div]);
  else if (year < 2007)
    strcpy(divname, dn1[div]);
  else
    strcpy(divname, dn2[div]);
}


x86 assembly (clang, -O0):
<getname>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    0xeb4(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xeb5(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xeb5(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xeb5(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xeb5(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    0xe6d(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xe9a(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xe9c(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xe9a(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xe6e(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    0xe7a(%rip),%rax
mov    %rax,-0xa0(%rbp)
lea    0xe4d(%rip),%rax
mov    %rax,-0x98(%rbp)
lea    0xe4c(%rip),%rax
mov    %rax,-0x90(%rbp)
lea    0xe47(%rip),%rax
mov    %rax,-0x88(%rbp)
lea    0xe18(%rip),%rax
mov    %rax,-0x80(%rbp)
cmpl   $0x7d4,-0x4(%rbp)
jge    123d <getname+0x11d>
mov    -0x10(%rbp),%rdi
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
call   1030 <strcpy@plt>
jmp    127b <getname+0x15b>
cmpl   $0x7d7,-0x4(%rbp)
jge    1261 <getname+0x141>
mov    -0x10(%rbp),%rdi
movslq -0x8(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rsi
call   1030 <strcpy@plt>
jmp    1276 <getname+0x156>
mov    -0x10(%rbp),%rdi
movslq -0x8(%rbp),%rax
mov    -0xa0(%rbp,%rax,8),%rsi
ff
call   1030 <strcpy@plt>
jmp    127b <getname+0x15b>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getname>:
push   %rax
mov    %rdx,%r8
lea    0xee5(%rip),%rax
mov    %rax,-0x20(%rsp)
lea    0xee5(%rip),%rcx
mov    %rcx,-0x18(%rsp)
lea    0xee4(%rip),%rcx
mov    %rcx,-0x10(%rsp)
lea    0xee3(%rip),%rcx
mov    %rcx,-0x8(%rsp)
lea    0xee2(%rip),%rcx
mov    %rcx,(%rsp)
mov    %rax,-0x50(%rsp)
lea    0xedd(%rip),%r9
mov    %r9,-0x48(%rsp)
lea    0xede(%rip),%r10
mov    %r10,-0x40(%rsp)
lea    0xedb(%rip),%rax
mov    %rax,-0x38(%rsp)
mov    %rcx,-0x30(%rsp)
lea    0xed3(%rip),%rdx
mov    %rdx,-0x80(%rsp)
mov    %r9,-0x78(%rsp)
mov    %r10,-0x70(%rsp)
mov    %rax,-0x68(%rsp)
mov    %rcx,-0x60(%rsp)
movslq %esi,%rax
cmp    $0x7d3,%edi
jg     11b2 <getname+0xa2>
lea    (%rsp,%rax,8),%rax
add    $0xffffffffffffffe0,%rax
jmp    11cc <getname+0xbc>
cmp    $0x7d6,%edi
ja     11c4 <getname+0xb4>
lea    (%rsp,%rax,8),%rax
add    $0xffffffffffffffb0,%rax
jmp    11cc <getname+0xbc>
lea    (%rsp,%rax,8),%rax
add    $0xffffffffffffff80,%rax
mov    (%rax),%rsi
mov    %r8,%rdi
pop    %rax
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Premiership\00"
@.str.1 = [11 x i8] c"Division 1\00"
@.str.2 = [11 x i8] c"Division 2\00"
@.str.3 = [11 x i8] c"Division 3\00"
@.str.4 = [11 x i8] c"Conference\00"
@.str.5 = [13 x i8] c"Championship\00"
@.str.6 = [9 x i8] c"League 1\00"
@.str.7 = [9 x i8] c"League 2\00"
@.str.8 = [15 x i8] c"Premier League\00"
define void @getname(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [5 x i8*]
%8 = alloca [5 x i8*]
%9 = alloca [5 x i8*]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%10 = bitcast [5 x i8*]* %7 to i8*
%11 = bitcast i8* %10 to [5 x i8*]*
%12 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i8** %12
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i32 0, i32 0), i8** %13
%14 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 2
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i32 0, i32 0), i8** %14
%15 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 3
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8** %15
%16 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 4
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i32 0, i32 0), i8** %16
%17 = bitcast [5 x i8*]* %8 to i8*
%18 = bitcast i8* %17 to [5 x i8*]*
%19 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i8** %19
%20 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i32 0, i32 0), i8** %20
%21 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i32 0, i32 0), i8** %21
%22 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 3
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i32 0, i32 0), i8** %22
%23 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 4
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i32 0, i32 0), i8** %23
%24 = bitcast [5 x i8*]* %9 to i8*
%25 = bitcast i8* %24 to [5 x i8*]*
%26 = getelementptr inbounds [5 x i8*], [5 x i8*]* %25, i32 0, i32 0
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i32 0, i32 0), i8** %26
%27 = getelementptr inbounds [5 x i8*], [5 x i8*]* %25, i32 0, i32 1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i32 0, i32 0), i8** %27
%28 = getelementptr inbounds [5 x i8*], [5 x i8*]* %25, i32 0, i32 2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i32 0, i32 0), i8** %28
%29 = getelementptr inbounds [5 x i8*], [5 x i8*]* %25, i32 0, i32 3
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i32 0, i32 0), i8** %29
%30 = getelementptr inbounds [5 x i8*], [5 x i8*]* %25, i32 0, i32 4
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i32 0, i32 0), i8** %30
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 2004
br i1 %32, label %33, label %40
33: ; preds = %3
%34 = load i8*, i8** %6
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i64 0, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 @strcpy(i8* %34, i8* %38)
br label %58
40: ; preds = %3
%41 = load i32, i32* %4
%42 = icmp slt i32 %41, 2007
br i1 %42, label %43, label %50
43: ; preds = %40
%44 = load i8*, i8** %6
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 %46
%48 = load i8*, i8** %47
%49 = call i32 @strcpy(i8* %44, i8* %48)
br label %57
50: ; preds = %40
%51 = load i8*, i8** %6
%52 = load i32, i32* %5
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 @strcpy(i8* %51, i8* %55)
br label %57
57: ; preds = %50, %43
br label %58
58: ; preds = %57, %33
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Premiership\00"
@.str.1 = [11 x i8] c"Division 1\00"
@.str.2 = [11 x i8] c"Division 2\00"
@.str.3 = [11 x i8] c"Division 3\00"
@.str.4 = [11 x i8] c"Conference\00"
@.str.5 = [13 x i8] c"Championship\00"
@.str.6 = [9 x i8] c"League 1\00"
@.str.7 = [9 x i8] c"League 2\00"
@.str.8 = [15 x i8] c"Premier League\00"
define void @getname(i32 %0, i32 %1, i8* %2) {
%4 = alloca [5 x i8*]
%5 = alloca [5 x i8*]
%6 = alloca [5 x i8*]
%7 = bitcast [5 x i8*]* %4 to i8*
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 2
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 3
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %11
%12 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 4
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %12
%13 = bitcast [5 x i8*]* %5 to i8*
%14 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i64 0, i64 0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %14
%15 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i64 0, i64 1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8** %15
%16 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i64 0, i64 2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8** %16
%17 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i64 0, i64 3
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8** %17
%18 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i64 0, i64 4
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %18
%19 = bitcast [5 x i8*]* %6 to i8*
%20 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i64 0, i64 0
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8** %20
%21 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i64 0, i64 1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8** %21
%22 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i64 0, i64 2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8** %22
%23 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i64 0, i64 3
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8** %23
%24 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i64 0, i64 4
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %24
%25 = icmp slt i32 %0, 2004
br i1 %25, label %26, label %29
26: ; preds = %3
%27 = sext i32 %1 to i64
%28 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 %27
br label %36
29: ; preds = %3
%30 = icmp ult i32 %0, 2007
%31 = sext i32 %1 to i64
br i1 %30, label %32, label %34
32: ; preds = %29
%33 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i64 0, i64 %31
br label %36
34: ; preds = %29
%35 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i64 0, i64 %31
br label %36
36: ; preds = %32, %34, %26
%37 = phi i8** [ %33, %32 ], [ %35, %34 ], [ %28, %26 ]
%38 = load i8*, i8** %37
%39 = tail call i32 @strcpy(i8* %2, i8* %38)
ret void
}