char ascii_to_raw(char a) {
  const unsigned char raw_to_ascii[] =
      "\000\0331234567890-=\177\t"
      "qwertyuiop[]\r\000as"
      "dfghjkl;'`\000\\zxcv"
      "bnm,./\000*\000 \000\201\202\203\204\205"
      "\206\207\210\211\212\000\000789-456+1"
      "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000"
      "\r\000/";
  static unsigned char ascii_to_raw[sizeof(raw_to_ascii)];
  static int ascii_to_raw_built = 0;
  if (!ascii_to_raw_built) {
    int i;
    memset(ascii_to_raw, 0, sizeof(ascii_to_raw));
    for (i = 0; i < sizeof(raw_to_ascii); i++)
      if (raw_to_ascii[i])
        ascii_to_raw[tolower(raw_to_ascii[i])] = i;
    ascii_to_raw_built = 1;
  }
  return ascii_to_raw[(int)a];
}


x86 assembly (clang, -O0):
<ascii_to_raw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeb4(%rip),%rsi
mov    $0x66,%edx
call   1040 <memcpy@plt>
cmpl   $0x0,0x2f5b(%rip)
jne    11db <ascii_to_raw+0xab>
lea    0x2ee6(%rip),%rdi
xor    %esi,%esi
mov    $0x66,%edx
call   1030 <memset@plt>
movl   $0x0,-0x74(%rbp)
movslq -0x74(%rbp),%rax
cmp    $0x66,%rax
jae    11d1 <ascii_to_raw+0xa1>
movslq -0x74(%rbp),%rax
cmpb   $0x0,-0x70(%rbp,%rax,1)
je     11be <ascii_to_raw+0x8e>
mov    -0x74(%rbp),%eax
mov    %al,-0x75(%rbp)
movslq -0x74(%rbp),%rax
movzbl -0x70(%rbp,%rax,1),%edi
call   1050 <tolower@plt>
mov    -0x75(%rbp),%dl
movslq %eax,%rcx
lea    0x2e95(%rip),%rax
mov    %dl,(%rax,%rcx,1)
jmp    11c3 <ascii_to_raw+0x93>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    117d <ascii_to_raw+0x4d>
movl   $0x1,0x2edd(%rip)
movsbl -0x1(%rbp),%eax
movslq %eax,%rcx
lea    0x2e67(%rip),%rax
movsbl (%rax,%rcx,1),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascii_to_raw>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
cmpb   $0x0,0x2f87(%rip)
jne    1196 <ascii_to_raw+0x86>
xorps  %xmm0,%xmm0
movaps %xmm0,0x2f63(%rip)
movaps %xmm0,0x2f4c(%rip)
movaps %xmm0,0x2f35(%rip)
movaps %xmm0,0x2f1e(%rip)
movaps %xmm0,0x2f07(%rip)
movaps %xmm0,0x2ef0(%rip)
movq   $0x0,0x2f43(%rip)
xor    %ebx,%ebx
lea    0xe9c(%rip),%rbp
lea    0x2ed5(%rip),%r15
jmp    117a <ascii_to_raw+0x6a>
nopl   (%rax)
add    $0x1,%rbx
cmp    $0x66,%rbx
je     118f <ascii_to_raw+0x7f>
movzbl (%rbx,%rbp,1),%edi
test   %edi,%edi
je     1170 <ascii_to_raw+0x60>
call   1030 <tolower@plt>
cltq
mov    %bl,(%rax,%r15,1)
jmp    1170 <ascii_to_raw+0x60>
movb   $0x1,0x2f12(%rip)
movsbq %r14b,%rax
lea    0x2e9f(%rip),%rcx
mov    (%rax,%rcx,1),%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.ascii_to_raw.raw_to_ascii = [102 x i8] c"\00\1B1234567890-=\7F\09qwertyuiop[]\0D\00asdfghjkl;'`\00\\zxcvbnm,./\00*\00 \00\81\82\83\84\85\86\87\88\89\8A\00\00789-456+1230\7F\00\00\8B\8C\00\00\00\00\00\00\00\00\00\00\0D\00/\00"
@ascii_to_raw.ascii_to_raw = internal global [102 x i8] zeroinitializer
@ascii_to_raw.ascii_to_raw_built = internal global i32 0
define signext i8 @ascii_to_raw(i8 signext %0) {
%2 = alloca i8
%3 = alloca [102 x i8]
%4 = alloca i32
store i8 %0, i8* %2
%5 = bitcast [102 x i8]* %3 to i8*
%6 = load i32, i32* @ascii_to_raw.ascii_to_raw_built
%7 = icmp ne i32 %6, 0
br i1 %7, label %35, label %8
8: ; preds = %1
store i32 0, i32* %4
br label %9
9: ; preds = %31, %8
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = icmp ult i64 %11, 102
br i1 %12, label %13, label %34
13: ; preds = %9
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [102 x i8], [102 x i8]* %3, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = icmp ne i8 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %13
%20 = load i32, i32* %4
%21 = trunc i32 %20 to i8
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [102 x i8], [102 x i8]* %3, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = call i32 @tolower(i32 %26)
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [102 x i8], [102 x i8]* @ascii_to_raw.ascii_to_raw, i64 0, i64 %28
store i8 %21, i8* %29
br label %30
30: ; preds = %19, %13
br label %31
31: ; preds = %30
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %9
34: ; preds = %9
store i32 1, i32* @ascii_to_raw.ascii_to_raw_built
br label %35
35: ; preds = %34, %1
%36 = load i8, i8* %2
%37 = sext i8 %36 to i32
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [102 x i8], [102 x i8]* @ascii_to_raw.ascii_to_raw, i64 0, i64 %38
%40 = load i8, i8* %39
ret i8 %40
}

LLVM IR (-O2):
@__const.ascii_to_raw.raw_to_ascii = [102 x i8] c"\00\1B1234567890-=\7F\09qwertyuiop[]\0D\00asdfghjkl;'`\00\\zxcvbnm,./\00*\00 \00\81\82\83\84\85\86\87\88\89\8A\00\00789-456+1230\7F\00\00\8B\8C\00\00\00\00\00\00\00\00\00\00\0D\00/\00"
@ascii_to_raw.ascii_to_raw = internal unnamed_addr global [102 x i8] zeroinitializer
@ascii_to_raw.ascii_to_raw_built = internal unnamed_addr global i1 false
define signext i8 @ascii_to_raw(i8 signext %0) {
%2 = load i1, i1* @ascii_to_raw.ascii_to_raw_built
br i1 %2, label %19, label %3
3: ; preds = %1
tail call void @llvm.memset.p0i8.i64(i8* align 16 dereferenceable(102) getelementptr inbounds ([102 x i8], [102 x i8]* @ascii_to_raw.ascii_to_raw, i64 0, i64 0), i8 0, i64 102, i1 false)
br label %4
4: ; preds = %3, %15
%5 = phi i64 [ 0, %3 ], [ %16, %15 ]
%6 = getelementptr inbounds [102 x i8], [102 x i8]* @__const.ascii_to_raw.raw_to_ascii, i64 0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %4
%10 = trunc i64 %5 to i8
%11 = zext i8 %7 to i32
%12 = tail call i32 @tolower(i32 %11)
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [102 x i8], [102 x i8]* @ascii_to_raw.ascii_to_raw, i64 0, i64 %13
store i8 %10, i8* %14
br label %15
15: ; preds = %4, %9
%16 = add nuw nsw i64 %5, 1
%17 = icmp eq i64 %16, 102
br i1 %17, label %18, label %4
18: ; preds = %15
store i1 true, i1* @ascii_to_raw.ascii_to_raw_built
br label %19
19: ; preds = %18, %1
%20 = sext i8 %0 to i64
%21 = getelementptr inbounds [102 x i8], [102 x i8]* @ascii_to_raw.ascii_to_raw, i64 0, i64 %20
%22 = load i8, i8* %21
ret i8 %22
}