char AA2char(short x) {
  switch (x) {
  case 0:
    return 'C';
  case 1:
    return 'G';
  case 2:
    return 'P';
  case 3:
    return 'S';
  case 4:
    return 'A';
  case 5:
    return 'T';
  case 6:
    return 'D';
  case 7:
    return 'E';
  case 8:
    return 'N';
  case 9:
    return 'Q';
  case 10:
    return 'H';
  case 11:
    return 'K';
  case 12:
    return 'R';
  case 13:
    return 'V';
  case 14:
    return 'M';
  case 15:
    return 'I';
  case 16:
    return 'L';
  case 17:
    return 'F';
  case 18:
    return 'Y';
  case 19:
    return 'W';
  default:
    return 'C';
  }
}


x86 assembly (clang, -O0):
<AA2char>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x4(%rbp)
movswl -0x4(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x13,%eax
ja     11e6 <AA2char+0xe6>
mov    -0x10(%rbp),%rax
lea    0xed7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x43,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x47,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x50,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x53,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x41,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x54,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x44,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x45,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x4e,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x51,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x48,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x4b,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x52,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x56,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x4d,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x49,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x4c,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x46,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x59,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x57,-0x1(%rbp)
jmp    11ea <AA2char+0xea>
movb   $0x43,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AA2char>:
movslq %edi,%rcx
add    $0xffffffffffffffff,%rcx
mov    $0x43,%al
cmp    $0x12,%ecx
ja     1118 <AA2char+0x18>
lea    0xeeb(%rip),%rax
mov    (%rcx,%rax,1),%al
ret

LLVM IR (-O0):
define signext i8 @AA2char(i16 signext %0) {
%2 = alloca i8
%3 = alloca i16
store i16 %0, i16* %3
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
switch i32 %5, label %26 [
i32 0, label %6
i32 1, label %7
i32 2, label %8
i32 3, label %9
i32 4, label %10
i32 5, label %11
i32 6, label %12
i32 7, label %13
i32 8, label %14
i32 9, label %15
i32 10, label %16
i32 11, label %17
i32 12, label %18
i32 13, label %19
i32 14, label %20
i32 15, label %21
i32 16, label %22
i32 17, label %23
i32 18, label %24
i32 19, label %25
]
6: ; preds = %1
store i8 67, i8* %2
br label %27
7: ; preds = %1
store i8 71, i8* %2
br label %27
8: ; preds = %1
store i8 80, i8* %2
br label %27
9: ; preds = %1
store i8 83, i8* %2
br label %27
10: ; preds = %1
store i8 65, i8* %2
br label %27
11: ; preds = %1
store i8 84, i8* %2
br label %27
12: ; preds = %1
store i8 68, i8* %2
br label %27
13: ; preds = %1
store i8 69, i8* %2
br label %27
14: ; preds = %1
store i8 78, i8* %2
br label %27
15: ; preds = %1
store i8 81, i8* %2
br label %27
16: ; preds = %1
store i8 72, i8* %2
br label %27
17: ; preds = %1
store i8 75, i8* %2
br label %27
18: ; preds = %1
store i8 82, i8* %2
br label %27
19: ; preds = %1
store i8 86, i8* %2
br label %27
20: ; preds = %1
store i8 77, i8* %2
br label %27
21: ; preds = %1
store i8 73, i8* %2
br label %27
22: ; preds = %1
store i8 76, i8* %2
br label %27
23: ; preds = %1
store i8 70, i8* %2
br label %27
24: ; preds = %1
store i8 89, i8* %2
br label %27
25: ; preds = %1
store i8 87, i8* %2
br label %27
26: ; preds = %1
store i8 67, i8* %2
br label %27
27: ; preds = %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6
%28 = load i8, i8* %2
ret i8 %28
}

LLVM IR (-O2):
@switch.table.AA2char = [19 x i8] c"GPSATDENQHKRVMILFYW"
define signext i8 @AA2char(i16 signext %0) {
%2 = sext i16 %0 to i32
%3 = add nsw i32 %2, -1
%4 = icmp ult i32 %3, 19
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [19 x i8], [19 x i8]* @switch.table.AA2char, i64 0, i64 %6
%8 = load i8, i8* %7
br label %9
9: ; preds = %5, %1
%10 = phi i8 [ 67, %1 ], [ %8, %5 ]
ret i8 %10
}