int check_clicks(char input) {
  if (input >= 'a' && input <= 'o') {
    switch ((input - 97) % 3) {
    case 0:
      return 1;
      break;
    case 1:
      return 2;
      break;
    case 2:
      return 3;
      break;
    }
  } else {
    switch (input) {
    case 'p':
    case 't':
    case 'w':
    case ' ':
      return 1;
      break;
    case 'q':
    case 'u':
    case 'x':
      return 2;
      break;
    case 'r':
    case 'v':
    case 'y':
      return 3;
      break;
    case 's':
    case 'z':
      return 4;
      break;
    }
  }
}


x86 assembly (clang, -O0):
<check_clicks>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     11a2 <check_clicks+0xa2>
movsbl -0x5(%rbp),%eax
cmp    $0x6f,%eax
jg     11a2 <check_clicks+0xa2>
movsbl -0x5(%rbp),%eax
add    $0xffffff9f,%eax
movslq %eax,%rcx
imul   $0x55555556,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
je     1179 <check_clicks+0x79>
jmp    1157 <check_clicks+0x57>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1185 <check_clicks+0x85>
jmp    1168 <check_clicks+0x68>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1191 <check_clicks+0x91>
jmp    119d <check_clicks+0x9d>
movl   $0x1,-0x4(%rbp)
jmp    1201 <check_clicks+0x101>
movl   $0x2,-0x4(%rbp)
jmp    1201 <check_clicks+0x101>
movl   $0x3,-0x4(%rbp)
jmp    1201 <check_clicks+0x101>
jmp    1201 <check_clicks+0x101>
movsbl -0x5(%rbp),%eax
add    $0xffffffe0,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5a,%eax
ja     11fc <check_clicks+0xfc>
mov    -0x18(%rbp),%rax
lea    0xe3d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    1201 <check_clicks+0x101>
movl   $0x2,-0x4(%rbp)
jmp    1201 <check_clicks+0x101>
movl   $0x3,-0x4(%rbp)
jmp    1201 <check_clicks+0x101>
movl   $0x4,-0x4(%rbp)
jmp    1201 <check_clicks+0x101>
jmp    1201 <check_clicks+0x101>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_clicks>:
lea    -0x61(%rdi),%eax
cmp    $0xe,%al
ja     112d <check_clicks+0x2d>
movzbl %al,%ecx
imul   $0xab,%ecx,%ecx
shr    $0x9,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %cl,%al
xor    %ecx,%ecx
cmp    $0x1,%al
sete   %cl
add    $0x1,%ecx
cmp    $0x2,%al
mov    $0x3,%eax
cmovne %ecx,%eax
ret
movsbl %dil,%ecx
add    $0xffffff8f,%ecx
mov    $0x1,%eax
cmp    $0x9,%ecx
ja     114b <check_clicks+0x4b>
movslq %ecx,%rax
lea    0xeb8(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @check_clicks(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 %20
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 111
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 97
%15 = srem i32 %14, 3
switch i32 %15, label %19 [
i32 0, label %16
i32 1, label %17
i32 2, label %18
]
16: ; preds = %11
store i32 1, i32* %2
br label %28
17: ; preds = %11
store i32 2, i32* %2
br label %28
18: ; preds = %11
store i32 3, i32* %2
br label %28
19: ; preds = %11
br label %28
20: ; preds = %7, %1
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
switch i32 %22, label %27 [
i32 112, label %23
i32 116, label %23
i32 119, label %23
i32 32, label %23
i32 113, label %24
i32 117, label %24
i32 120, label %24
i32 114, label %25
i32 118, label %25
i32 121, label %25
i32 115, label %26
i32 122, label %26
]
23: ; preds = %20, %20, %20, %20
store i32 1, i32* %2
br label %28
24: ; preds = %20, %20, %20
store i32 2, i32* %2
br label %28
25: ; preds = %20, %20, %20
store i32 3, i32* %2
br label %28
26: ; preds = %20, %20
store i32 4, i32* %2
br label %28
27: ; preds = %20
br label %28
28: ; preds = %16, %17, %18, %23, %24, %25, %26, %27, %19
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@switch.table.check_clicks = [10 x i32] [i32 2, i32 3, i32 4, i32 1, i32 2, i32 3, i32 1, i32 2, i32 3, i32 4]
define i32 @check_clicks(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 15
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = add i8 %0, -97
%6 = urem i8 %5, 3
%7 = icmp eq i8 %6, 1
%8 = select i1 %7, i32 2, i32 1
%9 = icmp eq i8 %6, 2
%10 = select i1 %9, i32 3, i32 %8
br label %19
11: ; preds = %1
%12 = sext i8 %0 to i32
%13 = add nsw i32 %12, -113
%14 = icmp ult i32 %13, 10
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = sext i32 %13 to i64
%17 = getelementptr inbounds [10 x i32], [10 x i32]* @switch.table.check_clicks, i64 0, i64 %16
%18 = load i32, i32* %17
br label %19
19: ; preds = %15, %11, %4
%20 = phi i32 [ 1, %11 ], [ %10, %4 ], [ %18, %15 ]
ret i32 %20
}