#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int board_col_to_matrix_idx(char col) {
  int col_int;
  switch (col) {
  case 'a':
  case 'A':
    col_int = 0;
    break;
  case 'b':
  case 'B':
    col_int = 1;
    break;
  case 'c':
  case 'C':
    col_int = 2;
    break;
  case 'd':
  case 'D':
    col_int = 3;
    break;
  case 'e':
  case 'E':
    col_int = 4;
    break;
  case 'f':
  case 'F':
    col_int = 5;
    break;
  case 'g':
  case 'G':
    col_int = 6;
    break;
  case 'h':
  case 'H':
    col_int = 7;
    break;
  case 'i':
  case 'I':
    col_int = 8;
    break;
  case 'j':
  case 'J':
    col_int = 9;
    break;
  case 'k':
  case 'K':
    col_int = 10;
    break;
  case 'l':
  case 'L':
    col_int = 11;
    break;
  default:
    col_int = -1;
    printf("Invalid column!");
  }
  return col_int;
}


x86 assembly (clang, -O0):
<board_col_to_matrix_idx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x2b,%eax
ja     11d8 <board_col_to_matrix_idx+0xc8>
mov    -0x10(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x8(%rbp)
jmp    11eb <board_col_to_matrix_idx+0xdb>
movl   $0x1,-0x8(%rbp)
jmp    11eb <board_col_to_matrix_idx+0xdb>
movl   $0x2,-0x8(%rbp)
jmp    11eb <board_col_to_matrix_idx+0xdb>
movl   $0x3,-0x8(%rbp)
jmp    11eb <board_col_to_matrix_idx+0xdb>
movl   $0x4,-0x8(%rbp)
jmp    11eb <board_col_to_matrix_idx+0xdb>
movl   $0x5,-0x8(%rbp)
jmp    11eb <board_col_to_matrix_idx+0xdb>
movl   $0x6,-0x8(%rbp)
jmp    11eb <board_col_to_matrix_idx+0xdb>
movl   $0x7,-0x8(%rbp)
jmp    11eb <board_col_to_matrix_idx+0xdb>
movl   $0x8,-0x8(%rbp)
jmp    11eb <board_col_to_matrix_idx+0xdb>
movl   $0x9,-0x8(%rbp)
jmp    11eb <board_col_to_matrix_idx+0xdb>
movl   $0xa,-0x8(%rbp)
jmp    11eb <board_col_to_matrix_idx+0xdb>
movl   $0xb,-0x8(%rbp)
jmp    11eb <board_col_to_matrix_idx+0xdb>
movl   $0xffffffff,-0x8(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<board_col_to_matrix_idx>:
push   %rax
add    $0xffffffbf,%edi
cmp    $0x2c,%edi
jae    1129 <board_col_to_matrix_idx+0x19>
movabs $0xfff00000fff,%rax
bt     %rdi,%rax
jb     113c <board_col_to_matrix_idx+0x2c>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret
movslq %edi,%rax
lea    0xeca(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Invalid column!\00"
define i32 @board_col_to_matrix_idx(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
switch i32 %5, label %18 [
i32 97, label %6
i32 65, label %6
i32 98, label %7
i32 66, label %7
i32 99, label %8
i32 67, label %8
i32 100, label %9
i32 68, label %9
i32 101, label %10
i32 69, label %10
i32 102, label %11
i32 70, label %11
i32 103, label %12
i32 71, label %12
i32 104, label %13
i32 72, label %13
i32 105, label %14
i32 73, label %14
i32 106, label %15
i32 74, label %15
i32 107, label %16
i32 75, label %16
i32 108, label %17
i32 76, label %17
]
6: ; preds = %1, %1
store i32 0, i32* %3
br label %20
7: ; preds = %1, %1
store i32 1, i32* %3
br label %20
8: ; preds = %1, %1
store i32 2, i32* %3
br label %20
9: ; preds = %1, %1
store i32 3, i32* %3
br label %20
10: ; preds = %1, %1
store i32 4, i32* %3
br label %20
11: ; preds = %1, %1
store i32 5, i32* %3
br label %20
12: ; preds = %1, %1
store i32 6, i32* %3
br label %20
13: ; preds = %1, %1
store i32 7, i32* %3
br label %20
14: ; preds = %1, %1
store i32 8, i32* %3
br label %20
15: ; preds = %1, %1
store i32 9, i32* %3
br label %20
16: ; preds = %1, %1
store i32 10, i32* %3
br label %20
17: ; preds = %1, %1
store i32 11, i32* %3
br label %20
18: ; preds = %1
store i32 -1, i32* %3
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [16 x i8] c"Invalid column!\00"
@switch.table.board_col_to_matrix_idx = [44 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11]
define i32 @board_col_to_matrix_idx(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -65
%4 = icmp ult i32 %3, 44
br i1 %4, label %7, label %5
5: ; preds = %7, %1
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %16
7: ; preds = %1
%8 = zext i32 %3 to i64
%9 = lshr i64 17587891081215, %8
%10 = and i64 %9, 1
%11 = icmp eq i64 %10, 0
br i1 %11, label %5, label %12
12: ; preds = %7
%13 = sext i32 %3 to i64
%14 = getelementptr inbounds [44 x i32], [44 x i32]* @switch.table.board_col_to_matrix_idx, i64 0, i64 %13
%15 = load i32, i32* %14
br label %16
16: ; preds = %12, %5
%17 = phi i32 [ -1, %5 ], [ %15, %12 ]
ret i32 %17
}