int b64_byte_to_char(unsigned x) {
  return (((((unsigned)(x) - (unsigned)(26)) >> 8) & 0xFF) & (x + 'A')) |
         ((((((unsigned)(x) - (unsigned)(26)) >> 8) & 0xFF) ^ 0xFF) &
          ((((unsigned)(x) - (unsigned)(52)) >> 8) & 0xFF) & (x + ('a' - 26))) |
         ((((((unsigned)(x) - (unsigned)(52)) >> 8) & 0xFF) ^ 0xFF) &
          ((((unsigned)(x) - (unsigned)(62)) >> 8) & 0xFF) & (x + ('0' - 52))) |
         (((((0U - ((unsigned)(x) ^ (unsigned)(62))) >> 8) & 0xFF) ^ 0xFF) &
          '+') |
         (((((0U - ((unsigned)(x) ^ (unsigned)(63))) >> 8) & 0xFF) ^ 0xFF) &
          '/');
}


x86 assembly (clang, -O0):
<b64_byte_to_char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1a,%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    -0x4(%rbp),%ecx
add    $0x41,%ecx
and    %ecx,%eax
mov    -0x4(%rbp),%ecx
sub    $0x1a,%ecx
shr    $0x8,%ecx
and    $0xff,%ecx
xor    $0xff,%ecx
mov    -0x4(%rbp),%edx
sub    $0x34,%edx
shr    $0x8,%edx
and    $0xff,%edx
and    %edx,%ecx
mov    -0x4(%rbp),%edx
add    $0x47,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
sub    $0x34,%ecx
shr    $0x8,%ecx
and    $0xff,%ecx
xor    $0xff,%ecx
mov    -0x4(%rbp),%edx
sub    $0x3e,%edx
shr    $0x8,%edx
and    $0xff,%edx
and    %edx,%ecx
mov    -0x4(%rbp),%edx
add    $0xfffffffc,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
xor    $0x3e,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
shr    $0x8,%ecx
and    $0xff,%ecx
xor    $0xff,%ecx
and    $0x2b,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
xor    $0x3f,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
shr    $0x8,%ecx
and    $0xff,%ecx
xor    $0xff,%ecx
and    $0x2f,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b64_byte_to_char>:
lea    0xffe6(%rdi),%eax
movzbl %ah,%ecx
lea    0x41(%rdi),%r8d
and    %ecx,%r8d
xor    $0xff,%ecx
lea    0xffcc(%rdi),%edx
shr    $0x8,%edx
lea    0x47(%rdi),%esi
and    %edx,%esi
not    %edx
and    %ecx,%esi
lea    0xffc2(%rdi),%ecx
shr    $0x8,%ecx
lea    0xfc(%rdi),%eax
and    %ecx,%eax
and    %edx,%eax
movzbl %al,%ecx
movd   %edi,%xmm0
pshufd $0x50,%xmm0,%xmm0
pxor   0xeb1(%rip),%xmm0
or     %esi,%ecx
pcmpeqd %xmm1,%xmm1
psubd  %xmm1,%xmm0
psrld  $0x8,%xmm0
pandn  0xeaa(%rip),%xmm0
movd   %xmm0,%edx
or     %r8d,%edx
pshufd $0x55,%xmm0,%xmm0
movd   %xmm0,%eax
or     %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @b64_byte_to_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub i32 %3, 26
%5 = lshr i32 %4, 8
%6 = and i32 %5, 255
%7 = load i32, i32* %2
%8 = add i32 %7, 65
%9 = and i32 %6, %8
%10 = load i32, i32* %2
%11 = sub i32 %10, 26
%12 = lshr i32 %11, 8
%13 = and i32 %12, 255
%14 = xor i32 %13, 255
%15 = load i32, i32* %2
%16 = sub i32 %15, 52
%17 = lshr i32 %16, 8
%18 = and i32 %17, 255
%19 = and i32 %14, %18
%20 = load i32, i32* %2
%21 = add i32 %20, 71
%22 = and i32 %19, %21
%23 = or i32 %9, %22
%24 = load i32, i32* %2
%25 = sub i32 %24, 52
%26 = lshr i32 %25, 8
%27 = and i32 %26, 255
%28 = xor i32 %27, 255
%29 = load i32, i32* %2
%30 = sub i32 %29, 62
%31 = lshr i32 %30, 8
%32 = and i32 %31, 255
%33 = and i32 %28, %32
%34 = load i32, i32* %2
%35 = add i32 %34, -4
%36 = and i32 %33, %35
%37 = or i32 %23, %36
%38 = load i32, i32* %2
%39 = xor i32 %38, 62
%40 = sub i32 0, %39
%41 = lshr i32 %40, 8
%42 = and i32 %41, 255
%43 = xor i32 %42, 255
%44 = and i32 %43, 43
%45 = or i32 %37, %44
%46 = load i32, i32* %2
%47 = xor i32 %46, 63
%48 = sub i32 0, %47
%49 = lshr i32 %48, 8
%50 = and i32 %49, 255
%51 = xor i32 %50, 255
%52 = and i32 %51, 47
%53 = or i32 %45, %52
ret i32 %53
}

LLVM IR (-O2):
define i32 @b64_byte_to_char(i32 %0) {
%2 = add i32 %0, 65510
%3 = lshr i32 %2, 8
%4 = and i32 %3, 255
%5 = add i32 %0, 65
%6 = and i32 %4, %5
%7 = xor i32 %4, 255
%8 = add i32 %0, 65484
%9 = lshr i32 %8, 8
%10 = and i32 %9, 255
%11 = add i32 %0, 71
%12 = and i32 %9, %11
%13 = and i32 %12, %7
%14 = xor i32 %10, 255
%15 = add i32 %0, 65474
%16 = lshr i32 %15, 8
%17 = add i32 %0, 252
%18 = and i32 %16, %17
%19 = and i32 %18, %14
%20 = insertelement <2 x i32> poison, i32 %0, i64 0
%21 = shufflevector <2 x i32> %20, <2 x i32> poison, <2 x i32> zeroinitializer
%22 = xor <2 x i32> %21, <i32 16321, i32 16320>
%23 = add <2 x i32> %22, <i32 1, i32 1>
%24 = lshr <2 x i32> %23, <i32 8, i32 8>
%25 = and <2 x i32> %24, <i32 43, i32 47>
%26 = xor <2 x i32> %25, <i32 43, i32 47>
%27 = extractelement <2 x i32> %26, i64 0
%28 = or i32 %27, %6
%29 = extractelement <2 x i32> %26, i64 1
%30 = or i32 %28, %29
%31 = or i32 %30, %13
%32 = or i32 %31, %19
ret i32 %32
}