char *cityvector(int i) {
  char *cityvector[] = {"Aberdin", "Edinburg", "Fort Yilyam",
                        "Glazgo",  "Invers",   "Pert"};
  return cityvector[i];
}


x86 assembly (clang, -O0):
<cityvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
lea    0xece(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xecb(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xec9(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xec6(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xec2(%rip),%rax
mov    %rax,-0x18(%rbp)
movslq -0x4(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cityvector>:
lea    0xef9(%rip),%rax
mov    %rax,-0x38(%rsp)
lea    0xef5(%rip),%rax
mov    %rax,-0x30(%rsp)
lea    0xef2(%rip),%rax
mov    %rax,-0x28(%rsp)
lea    0xef2(%rip),%rax
mov    %rax,-0x20(%rsp)
lea    0xeed(%rip),%rax
mov    %rax,-0x18(%rsp)
lea    0xee8(%rip),%rax
mov    %rax,-0x10(%rsp)
movslq %edi,%rax
mov    -0x38(%rsp,%rax,8),%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Aberdin\00"
@.str.1 = [9 x i8] c"Edinburg\00"
@.str.2 = [12 x i8] c"Fort Yilyam\00"
@.str.3 = [7 x i8] c"Glazgo\00"
@.str.4 = [7 x i8] c"Invers\00"
@.str.5 = [5 x i8] c"Pert\00"
define i8* @cityvector(i32 %0) {
%2 = alloca i32
%3 = alloca [6 x i8*]
store i32 %0, i32* %2
%4 = bitcast [6 x i8*]* %3 to i8*
%5 = bitcast i8* %4 to [6 x i8*]*
%6 = getelementptr inbounds [6 x i8*], [6 x i8*]* %5, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8** %6
%7 = getelementptr inbounds [6 x i8*], [6 x i8*]* %5, i32 0, i32 1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8** %7
%8 = getelementptr inbounds [6 x i8*], [6 x i8*]* %5, i32 0, i32 2
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds [6 x i8*], [6 x i8*]* %5, i32 0, i32 3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [6 x i8*], [6 x i8*]* %5, i32 0, i32 4
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [6 x i8*], [6 x i8*]* %5, i32 0, i32 5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8** %11
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [6 x i8*], [6 x i8*]* %3, i64 0, i64 %13
%15 = load i8*, i8** %14
ret i8* %15
}

LLVM IR (-O2):
@.str = [8 x i8] c"Aberdin\00"
@.str.1 = [9 x i8] c"Edinburg\00"
@.str.2 = [12 x i8] c"Fort Yilyam\00"
@.str.3 = [7 x i8] c"Glazgo\00"
@.str.4 = [7 x i8] c"Invers\00"
@.str.5 = [5 x i8] c"Pert\00"
define i8* @cityvector(i32 %0) {
%2 = alloca [6 x i8*]
%3 = bitcast [6 x i8*]* %2 to i8*
%4 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %4
%5 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 2
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 4
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8** %9
%10 = sext i32 %0 to i64
%11 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 %10
%12 = load i8*, i8** %11
ret i8* %12
}