#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 *, unsigned char, unsigned char);
int base_hash(unsigned char a, int b) {
  int base_status = 0;
  switch (a) {
  case 'A':
  case 'M':
  case 'R':
    base_status = 1;
  case 'W':
    a = 0;
    break;
  case 'C':
  case 'Y':
    base_status = 1;
  case 'S':
    a = 1;
    break;
  case 'G':
    a = 2;
    break;
  case 'T':
    base_status = 1;
  case 'K':
    a = 3;
    break;
  case 'N':
    base_status = 1;
    a = 0;
    break;
  default:
    printf(" the base is error --%c--%d--\n", a, a);
    base_status = 2;
    a = 0;
  }
  b = b << 2;
  b = b + a;
  return b;
}


x86 assembly (clang, -O0):
<base_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x18,%eax
ja     119b <base_hash+0x8b>
mov    -0x18(%rbp),%rax
lea    0xeb7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0xc(%rbp)
movb   $0x0,-0x1(%rbp)
jmp    11bc <base_hash+0xac>
movl   $0x1,-0xc(%rbp)
movb   $0x1,-0x1(%rbp)
jmp    11bc <base_hash+0xac>
movb   $0x2,-0x1(%rbp)
jmp    11bc <base_hash+0xac>
movl   $0x1,-0xc(%rbp)
movb   $0x3,-0x1(%rbp)
jmp    11bc <base_hash+0xac>
movl   $0x1,-0xc(%rbp)
movb   $0x0,-0x1(%rbp)
jmp    11bc <base_hash+0xac>
mov    -0x1(%rbp),%al
lea    0xebf(%rip),%rdi
movzbl %al,%esi
movzbl -0x1(%rbp),%edx
call   1030 <printf@plt>
movl   $0x2,-0xc(%rbp)
movb   $0x0,-0x1(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movzbl -0x1(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base_hash>:
push   %rbx
mov    %esi,%ebx
lea    -0x41(%rdi),%eax
cmp    $0x19,%al
jae    1127 <base_hash+0x17>
movzbl %al,%ecx
mov    $0x14e3445,%edx
bt     %ecx,%edx
jb     113d <base_hash+0x2d>
movzbl %dil,%edx
lea    0xece(%rip),%rdi
mov    %edx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
jmp    114b <base_hash+0x3b>
movsbq %al,%rax
lea    0xed8(%rip),%rcx
mov    (%rcx,%rax,4),%eax
shl    $0x2,%ebx
or     %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c" the base is error --%c--%d--\0A\00"
define i32 @base_hash(i8 zeroext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
switch i32 %7, label %16 [
i32 65, label %8
i32 77, label %8
i32 82, label %8
i32 87, label %9
i32 67, label %10
i32 89, label %10
i32 83, label %11
i32 71, label %12
i32 84, label %13
i32 75, label %14
i32 78, label %15
]
8: ; preds = %2, %2, %2
store i32 1, i32* %5
br label %9
9: ; preds = %2, %8
store i8 0, i8* %3
br label %20
10: ; preds = %2, %2
store i32 1, i32* %5
br label %11
11: ; preds = %2, %10
store i8 1, i8* %3
br label %20
12: ; preds = %2
store i8 2, i8* %3
br label %20
13: ; preds = %2
store i32 1, i32* %5
br label %14
14: ; preds = %2, %13
store i8 3, i8* %3
br label %20
15: ; preds = %2
store i32 1, i32* %5
store i8 0, i8* %3
br label %20
16: ; preds = %2
%17 = load i8, i8* %3
%18 = load i8, i8* %3
%19 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8 zeroext %17, i8 zeroext %18)
store i32 2, i32* %5
store i8 0, i8* %3
br label %20
20: ; preds = %16, %15, %14, %12, %11, %9
%21 = load i32, i32* %4
%22 = shl i32 %21, 2
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = load i8, i8* %3
%25 = zext i8 %24 to i32
%26 = add nsw i32 %23, %25
store i32 %26, i32* %4
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
@.str = [31 x i8] c" the base is error --%c--%d--\0A\00"
@switch.table.base_hash = [25 x i32] [i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 2, i32 0, i32 0, i32 0, i32 3, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 0, i32 1]
define i32 @base_hash(i8 zeroext %0, i32 %1) {
%3 = add i8 %0, -65
%4 = icmp ult i8 %3, 25
br i1 %4, label %7, label %5
5: ; preds = %7, %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8 zeroext %0, i8 zeroext %0)
br label %16
7: ; preds = %2
%8 = zext i8 %3 to i32
%9 = lshr i32 21902405, %8
%10 = and i32 %9, 1
%11 = icmp eq i32 %10, 0
br i1 %11, label %5, label %12
12: ; preds = %7
%13 = sext i8 %3 to i64
%14 = getelementptr inbounds [25 x i32], [25 x i32]* @switch.table.base_hash, i64 0, i64 %13
%15 = load i32, i32* %14
br label %16
16: ; preds = %12, %5
%17 = phi i32 [ 0, %5 ], [ %15, %12 ]
%18 = shl i32 %1, 2
%19 = or i32 %17, %18
ret i32 %19
}