int house_to_index(char house) {
  if (house == 'A')
    return 0;
  else if (house == 'D')
    return 1;
  else if (house == 'H')
    return 2;
  else if (house == 'J')
    return 3;
  else if (house == 'L')
    return 4;
  else if (house == 'M')
    return 5;
  return -1;
}


x86 assembly (clang, -O0):
<house_to_index>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jne    1123 <house_to_index+0x23>
movl   $0x0,-0x4(%rbp)
jmp    11c0 <house_to_index+0xc0>
movsbl -0x5(%rbp),%eax
cmp    $0x44,%eax
jne    113c <house_to_index+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    11c0 <house_to_index+0xc0>
movsbl -0x5(%rbp),%eax
cmp    $0x48,%eax
jne    1155 <house_to_index+0x55>
movl   $0x2,-0x4(%rbp)
jmp    11c0 <house_to_index+0xc0>
movsbl -0x5(%rbp),%eax
cmp    $0x4a,%eax
jne    116e <house_to_index+0x6e>
movl   $0x3,-0x4(%rbp)
jmp    11c0 <house_to_index+0xc0>
movsbl -0x5(%rbp),%eax
cmp    $0x4c,%eax
jne    1187 <house_to_index+0x87>
movl   $0x4,-0x4(%rbp)
jmp    11c0 <house_to_index+0xc0>
movsbl -0x5(%rbp),%eax
cmp    $0x4d,%eax
jne    11a0 <house_to_index+0xa0>
movl   $0x5,-0x4(%rbp)
jmp    11c0 <house_to_index+0xc0>
jmp    11a5 <house_to_index+0xa5>
jmp    11aa <house_to_index+0xaa>
jmp    11af <house_to_index+0xaf>
jmp    11b4 <house_to_index+0xb4>
jmp    11b9 <house_to_index+0xb9>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<house_to_index>:
add    $0xbf,%dil
mov    $0xffffffff,%eax
cmp    $0xc,%dil
ja     111d <house_to_index+0x1d>
movsbq %dil,%rax
lea    0xee6(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @house_to_index(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 65
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %39
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 68
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 1, i32* %2
br label %39
13: ; preds = %8
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 72
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 2, i32* %2
br label %39
18: ; preds = %13
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 74
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 3, i32* %2
br label %39
23: ; preds = %18
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 76
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 4, i32* %2
br label %39
28: ; preds = %23
%29 = load i8, i8* %3
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 77
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 5, i32* %2
br label %39
33: ; preds = %28
br label %34
34: ; preds = %33
br label %35
35: ; preds = %34
br label %36
36: ; preds = %35
br label %37
37: ; preds = %36
br label %38
38: ; preds = %37
store i32 -1, i32* %2
br label %39
39: ; preds = %38, %32, %27, %22, %17, %12, %7
%40 = load i32, i32* %2
ret i32 %40
}

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