int getButtonIndex(char ch) {
  if (ch >= 'a' && ch <= 'c')
    return 1;
  else if (ch >= 'd' && ch <= 'f')
    return 2;
  else if (ch >= 'g' && ch <= 'i')
    return 3;
  else if (ch >= 'j' && ch <= 'l')
    return 4;
  else if (ch >= 'm' && ch <= 'o')
    return 5;
  else if (ch >= 'p' && ch <= 's')
    return 6;
  else if (ch >= 't' && ch <= 'v')
    return 7;
  else
    return 8;
}


x86 assembly (clang, -O0):
<getButtonIndex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1130 <getButtonIndex+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x63,%eax
jg     1130 <getButtonIndex+0x30>
movl   $0x1,-0x4(%rbp)
jmp    121b <getButtonIndex+0x11b>
movsbl -0x5(%rbp),%eax
cmp    $0x64,%eax
jl     1156 <getButtonIndex+0x56>
movsbl -0x5(%rbp),%eax
cmp    $0x66,%eax
jg     1156 <getButtonIndex+0x56>
movl   $0x2,-0x4(%rbp)
jmp    121b <getButtonIndex+0x11b>
movsbl -0x5(%rbp),%eax
cmp    $0x67,%eax
jl     117c <getButtonIndex+0x7c>
movsbl -0x5(%rbp),%eax
cmp    $0x69,%eax
jg     117c <getButtonIndex+0x7c>
movl   $0x3,-0x4(%rbp)
jmp    121b <getButtonIndex+0x11b>
movsbl -0x5(%rbp),%eax
cmp    $0x6a,%eax
jl     11a2 <getButtonIndex+0xa2>
movsbl -0x5(%rbp),%eax
cmp    $0x6c,%eax
jg     11a2 <getButtonIndex+0xa2>
movl   $0x4,-0x4(%rbp)
jmp    121b <getButtonIndex+0x11b>
movsbl -0x5(%rbp),%eax
cmp    $0x6d,%eax
jl     11c8 <getButtonIndex+0xc8>
movsbl -0x5(%rbp),%eax
cmp    $0x6f,%eax
jg     11c8 <getButtonIndex+0xc8>
movl   $0x5,-0x4(%rbp)
jmp    121b <getButtonIndex+0x11b>
movsbl -0x5(%rbp),%eax
cmp    $0x70,%eax
jl     11ee <getButtonIndex+0xee>
movsbl -0x5(%rbp),%eax
cmp    $0x73,%eax
jg     11ee <getButtonIndex+0xee>
movl   $0x6,-0x4(%rbp)
jmp    121b <getButtonIndex+0x11b>
movsbl -0x5(%rbp),%eax
cmp    $0x74,%eax
jl     1214 <getButtonIndex+0x114>
movsbl -0x5(%rbp),%eax
cmp    $0x76,%eax
jg     1214 <getButtonIndex+0x114>
movl   $0x7,-0x4(%rbp)
jmp    121b <getButtonIndex+0x11b>
movl   $0x8,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getButtonIndex>:
lea    -0x61(%rdi),%ecx
mov    $0x1,%eax
cmp    $0x3,%cl
jb     1160 <getButtonIndex+0x60>
lea    -0x64(%rdi),%ecx
mov    $0x2,%eax
cmp    $0x3,%cl
jb     1160 <getButtonIndex+0x60>
lea    -0x67(%rdi),%ecx
mov    $0x3,%eax
cmp    $0x3,%cl
jb     1160 <getButtonIndex+0x60>
lea    -0x6a(%rdi),%ecx
mov    $0x4,%eax
cmp    $0x3,%cl
jb     1160 <getButtonIndex+0x60>
lea    -0x6d(%rdi),%ecx
mov    $0x5,%eax
cmp    $0x3,%cl
jb     1160 <getButtonIndex+0x60>
mov    %edi,%ecx
and    $0xfc,%cl
mov    $0x6,%eax
cmp    $0x70,%cl
je     1160 <getButtonIndex+0x60>
add    $0x8c,%dil
cmp    $0x3,%dil
mov    $0x8,%eax
sbb    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @getButtonIndex(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 sge i32 %5, 97
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 99
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %67
12: ; preds = %7, %1
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp sge i32 %14, 100
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp sle i32 %18, 102
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 2, i32* %2
br label %67
21: ; preds = %16, %12
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp sge i32 %23, 103
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = icmp sle i32 %27, 105
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 3, i32* %2
br label %67
30: ; preds = %25, %21
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
%33 = icmp sge i32 %32, 106
br i1 %33, label %34, label %39
34: ; preds = %30
%35 = load i8, i8* %3
%36 = sext i8 %35 to i32
%37 = icmp sle i32 %36, 108
br i1 %37, label %38, label %39
38: ; preds = %34
store i32 4, i32* %2
br label %67
39: ; preds = %34, %30
%40 = load i8, i8* %3
%41 = sext i8 %40 to i32
%42 = icmp sge i32 %41, 109
br i1 %42, label %43, label %48
43: ; preds = %39
%44 = load i8, i8* %3
%45 = sext i8 %44 to i32
%46 = icmp sle i32 %45, 111
br i1 %46, label %47, label %48
47: ; preds = %43
store i32 5, i32* %2
br label %67
48: ; preds = %43, %39
%49 = load i8, i8* %3
%50 = sext i8 %49 to i32
%51 = icmp sge i32 %50, 112
br i1 %51, label %52, label %57
52: ; preds = %48
%53 = load i8, i8* %3
%54 = sext i8 %53 to i32
%55 = icmp sle i32 %54, 115
br i1 %55, label %56, label %57
56: ; preds = %52
store i32 6, i32* %2
br label %67
57: ; preds = %52, %48
%58 = load i8, i8* %3
%59 = sext i8 %58 to i32
%60 = icmp sge i32 %59, 116
br i1 %60, label %61, label %66
61: ; preds = %57
%62 = load i8, i8* %3
%63 = sext i8 %62 to i32
%64 = icmp sle i32 %63, 118
br i1 %64, label %65, label %66
65: ; preds = %61
store i32 7, i32* %2
br label %67
66: ; preds = %61, %57
store i32 8, i32* %2
br label %67
67: ; preds = %66, %65, %56, %47, %38, %29, %20, %11
%68 = load i32, i32* %2
ret i32 %68
}

LLVM IR (-O2):
define i32 @getButtonIndex(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 3
br i1 %3, label %23, label %4
4: ; preds = %1
%5 = add i8 %0, -100
%6 = icmp ult i8 %5, 3
br i1 %6, label %23, label %7
7: ; preds = %4
%8 = add i8 %0, -103
%9 = icmp ult i8 %8, 3
br i1 %9, label %23, label %10
10: ; preds = %7
%11 = add i8 %0, -106
%12 = icmp ult i8 %11, 3
br i1 %12, label %23, label %13
13: ; preds = %10
%14 = add i8 %0, -109
%15 = icmp ult i8 %14, 3
br i1 %15, label %23, label %16
16: ; preds = %13
%17 = and i8 %0, -4
%18 = icmp eq i8 %17, 112
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = add i8 %0, -116
%21 = icmp ult i8 %20, 3
%22 = select i1 %21, i32 7, i32 8
br label %23
23: ; preds = %19, %16, %13, %10, %7, %4, %1
%24 = phi i32 [ 1, %1 ], [ 2, %4 ], [ 3, %7 ], [ 4, %10 ], [ 5, %13 ], [ 6, %16 ], [ %22, %19 ]
ret i32 %24
}