#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 */
typedef int uint8_t;

/* Variables and functions */
uint8_t ascii2bit6(char a) {
  int r;
  switch (a >> 4) {
  case 0x5:
  case 0x4:
    r = a - 'A';
    if (r < 0 || r > 25) {
      return -1;
    } else {
      return r;
    }
  case 0x7:
  case 0x6:
    r = a - 'a';
    if (r < 0 || r > 25) {
      return -1;
    } else {
      return r + 26;
    }
    break;
  case 0x3:
    if (a > '9')
      return -1;
    return a - '0' + 52;
  default:
    break;
  }
  switch (a) {
  case '+':
  case '-':
    return 62;
  case '/':
  case '_':
    return 63;
  default:
    return 0xff;
  }
}


x86 assembly (clang, -O0):
<ascii2bit6>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
sar    $0x4,%eax
mov    %eax,-0x10(%rbp)
sub    $0x3,%eax
je     11b7 <ascii2bit6+0xb7>
jmp    1122 <ascii2bit6+0x22>
mov    -0x10(%rbp),%eax
add    $0xfffffffc,%eax
sub    $0x2,%eax
jb     114a <ascii2bit6+0x4a>
jmp    1136 <ascii2bit6+0x36>
mov    -0x10(%rbp),%eax
add    $0xfffffffa,%eax
sub    $0x2,%eax
jb     117f <ascii2bit6+0x7f>
jmp    11e2 <ascii2bit6+0xe2>
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1168 <ascii2bit6+0x68>
cmpl   $0x19,-0xc(%rbp)
jle    1174 <ascii2bit6+0x74>
movl   $0xffffffff,-0x4(%rbp)
jmp    124e <ascii2bit6+0x14e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    124e <ascii2bit6+0x14e>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     119d <ascii2bit6+0x9d>
cmpl   $0x19,-0xc(%rbp)
jle    11a9 <ascii2bit6+0xa9>
movl   $0xffffffff,-0x4(%rbp)
jmp    124e <ascii2bit6+0x14e>
mov    -0xc(%rbp),%eax
add    $0x1a,%eax
mov    %eax,-0x4(%rbp)
jmp    124e <ascii2bit6+0x14e>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jle    11d0 <ascii2bit6+0xd0>
movl   $0xffffffff,-0x4(%rbp)
jmp    124e <ascii2bit6+0x14e>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
add    $0x34,%eax
mov    %eax,-0x4(%rbp)
jmp    124e <ascii2bit6+0x14e>
jmp    11e7 <ascii2bit6+0xe7>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x2b,%eax
je     122f <ascii2bit6+0x12f>
jmp    11fc <ascii2bit6+0xfc>
mov    -0x14(%rbp),%eax
sub    $0x2d,%eax
je     122f <ascii2bit6+0x12f>
jmp    120d <ascii2bit6+0x10d>
mov    -0x14(%rbp),%eax
sub    $0x2f,%eax
je     123b <ascii2bit6+0x13b>
jmp    121e <ascii2bit6+0x11e>
mov    -0x14(%rbp),%eax
sub    $0x5f,%eax
je     123b <ascii2bit6+0x13b>
jmp    1247 <ascii2bit6+0x147>
movl   $0x3e,-0x4(%rbp)
jmp    124e <ascii2bit6+0x14e>
movl   $0x3f,-0x4(%rbp)
jmp    124e <ascii2bit6+0x14e>
movl   $0xff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascii2bit6>:
mov    %edi,%eax
sar    $0x4,%eax
lea    -0x4(%rax),%ecx
cmp    $0x2,%ecx
jb     111d <ascii2bit6+0x1d>
lea    -0x6(%rax),%ecx
cmp    $0x2,%ecx
jae    112e <ascii2bit6+0x2e>
lea    -0x7b(%rdi),%eax
add    $0xffffffb9,%edi
jmp    1123 <ascii2bit6+0x23>
lea    -0x5b(%rdi),%eax
add    $0xffffffbf,%edi
cmp    $0xe6,%al
mov    $0xffffffff,%eax
cmovae %edi,%eax
ret
cmp    $0x3,%eax
jne    1145 <ascii2bit6+0x45>
mov    %edi,%ecx
add    $0x4,%ecx
cmp    $0x3a,%dil
mov    $0xffffffff,%eax
cmovl  %ecx,%eax
ret
cmp    $0x2e,%edi
jg     115a <ascii2bit6+0x5a>
mov    $0x3e,%eax
cmp    $0x2b,%edi
je     1159 <ascii2bit6+0x59>
cmp    $0x2d,%edi
jne    116a <ascii2bit6+0x6a>
ret
cmp    $0x5f,%edi
je     1164 <ascii2bit6+0x64>
cmp    $0x2f,%edi
jne    116a <ascii2bit6+0x6a>
mov    $0x3f,%eax
ret
mov    $0xff,%eax
ret

LLVM IR (-O0):
define i32 @ascii2bit6(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = ashr i32 %6, 4
switch i32 %7, label %43 [
i32 5, label %8
i32 4, label %8
i32 7, label %20
i32 6, label %20
i32 3, label %33
]
8: ; preds = %1, %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %10, 65
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %8
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 25
br i1 %16, label %17, label %18
17: ; preds = %14, %8
store i32 -1, i32* %2
br label %50
18: ; preds = %14
%19 = load i32, i32* %4
store i32 %19, i32* %2
br label %50
20: ; preds = %1, %1
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = sub nsw i32 %22, 97
store i32 %23, i32* %4
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %20
%27 = load i32, i32* %4
%28 = icmp sgt i32 %27, 25
br i1 %28, label %29, label %30
29: ; preds = %26, %20
store i32 -1, i32* %2
br label %50
30: ; preds = %26
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 26
store i32 %32, i32* %2
br label %50
33: ; preds = %1
%34 = load i8, i8* %3
%35 = sext i8 %34 to i32
%36 = icmp sgt i32 %35, 57
br i1 %36, label %37, label %38
37: ; preds = %33
store i32 -1, i32* %2
br label %50
38: ; preds = %33
%39 = load i8, i8* %3
%40 = sext i8 %39 to i32
%41 = sub nsw i32 %40, 48
%42 = add nsw i32 %41, 52
store i32 %42, i32* %2
br label %50
43: ; preds = %1
br label %44
44: ; preds = %43
%45 = load i8, i8* %3
%46 = sext i8 %45 to i32
switch i32 %46, label %49 [
i32 43, label %47
i32 45, label %47
i32 47, label %48
i32 95, label %48
]
47: ; preds = %44, %44
store i32 62, i32* %2
br label %50
48: ; preds = %44, %44
store i32 63, i32* %2
br label %50
49: ; preds = %44
store i32 255, i32* %2
br label %50
50: ; preds = %49, %48, %47, %38, %37, %30, %29, %18, %17
%51 = load i32, i32* %2
ret i32 %51
}

LLVM IR (-O2):
define i32 @ascii2bit6(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = ashr i32 %2, 4
switch i32 %3, label %18 [
i32 5, label %4
i32 4, label %4
i32 7, label %9
i32 6, label %9
i32 3, label %14
]
4: ; preds = %1, %1
%5 = add i8 %0, -91
%6 = icmp ult i8 %5, -26
%7 = add nsw i32 %2, -65
%8 = select i1 %6, i32 -1, i32 %7
br label %21
9: ; preds = %1, %1
%10 = add i8 %0, -123
%11 = icmp ult i8 %10, -26
%12 = add nsw i32 %2, -71
%13 = select i1 %11, i32 -1, i32 %12
br label %21
14: ; preds = %1
%15 = icmp sgt i8 %0, 57
%16 = add nsw i32 %2, 4
%17 = select i1 %15, i32 -1, i32 %16
br label %21
18: ; preds = %1
switch i32 %2, label %20 [
i32 43, label %21
i32 45, label %21
i32 47, label %19
i32 95, label %19
]
19: ; preds = %18, %18
br label %21
20: ; preds = %18
br label %21
21: ; preds = %14, %9, %4, %18, %18, %20, %19
%22 = phi i32 [ 255, %20 ], [ 63, %19 ], [ 62, %18 ], [ 62, %18 ], [ %8, %4 ], [ %13, %9 ], [ %17, %14 ]
ret i32 %22
}