#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 EINVAL;
int unbase64char(char c) {
  unsigned offset;
  if (c >= 'A' && c <= 'Z')
    return c - 'A';
  offset = 'Z' - 'A' + 1;
  if (c >= 'a' && c <= 'z')
    return c - 'a' + offset;
  offset += 'z' - 'a' + 1;
  if (c >= '0' && c <= '9')
    return c - '0' + offset;
  offset += '9' - '0' + 1;
  if (c == '+')
    return offset;
  offset++;
  if (c == '/')
    return offset;
  return -EINVAL;
}


x86 assembly (clang, -O0):
<unbase64char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1133 <unbase64char+0x33>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1133 <unbase64char+0x33>
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    11eb <unbase64char+0xeb>
movl   $0x1a,-0xc(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1166 <unbase64char+0x66>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     1166 <unbase64char+0x66>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11eb <unbase64char+0xeb>
mov    -0xc(%rbp),%eax
add    $0x1a,%eax
mov    %eax,-0xc(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     119b <unbase64char+0x9b>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     119b <unbase64char+0x9b>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11eb <unbase64char+0xeb>
mov    -0xc(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0xc(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
jne    11bc <unbase64char+0xbc>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11eb <unbase64char+0xeb>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
jne    11dd <unbase64char+0xdd>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11eb <unbase64char+0xeb>
xor    %eax,%eax
mov    0x2dfa(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unbase64char>:
mov    %edi,%eax
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     110e <unbase64char+0xe>
add    $0xffffffbf,%eax
ret
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     111a <unbase64char+0x1a>
add    $0xffffffb9,%eax
ret
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     1126 <unbase64char+0x26>
add    $0x4,%eax
ret
cmp    $0x2b,%al
je     1134 <unbase64char+0x34>
cmp    $0x2f,%al
jne    113a <unbase64char+0x3a>
mov    $0x3f,%eax
ret
mov    $0x3e,%eax
ret
mov    0x2e9f(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @unbase64char(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 = icmp sge i32 %6, 65
br i1 %7, label %8, label %16
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp sle i32 %10, 90
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = sub nsw i32 %14, 65
store i32 %15, i32* %2
br label %65
16: ; preds = %8, %1
store i32 26, i32* %4
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 97
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 122
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = sub nsw i32 %26, 97
%28 = load i32, i32* %4
%29 = add i32 %27, %28
store i32 %29, i32* %2
br label %65
30: ; preds = %20, %16
%31 = load i32, i32* %4
%32 = add i32 %31, 26
store i32 %32, i32* %4
%33 = load i8, i8* %3
%34 = sext i8 %33 to i32
%35 = icmp sge i32 %34, 48
br i1 %35, label %36, label %46
36: ; preds = %30
%37 = load i8, i8* %3
%38 = sext i8 %37 to i32
%39 = icmp sle i32 %38, 57
br i1 %39, label %40, label %46
40: ; preds = %36
%41 = load i8, i8* %3
%42 = sext i8 %41 to i32
%43 = sub nsw i32 %42, 48
%44 = load i32, i32* %4
%45 = add i32 %43, %44
store i32 %45, i32* %2
br label %65
46: ; preds = %36, %30
%47 = load i32, i32* %4
%48 = add i32 %47, 10
store i32 %48, i32* %4
%49 = load i8, i8* %3
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 43
br i1 %51, label %52, label %54
52: ; preds = %46
%53 = load i32, i32* %4
store i32 %53, i32* %2
br label %65
54: ; preds = %46
%55 = load i32, i32* %4
%56 = add i32 %55, 1
store i32 %56, i32* %4
%57 = load i8, i8* %3
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 47
br i1 %59, label %60, label %62
60: ; preds = %54
%61 = load i32, i32* %4
store i32 %61, i32* %2
br label %65
62: ; preds = %54
%63 = load i32, i32* @EINVAL
%64 = sub nsw i32 0, %63
store i32 %64, i32* %2
br label %65
65: ; preds = %62, %60, %52, %40, %24, %12
%66 = load i32, i32* %2
ret i32 %66
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @unbase64char(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -65
%4 = icmp ult i8 %3, 26
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = add nsw i32 %2, -65
br label %22
7: ; preds = %1
%8 = add i8 %0, -97
%9 = icmp ult i8 %8, 26
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = add nsw i32 %2, -71
br label %22
12: ; preds = %7
%13 = add i8 %0, -48
%14 = icmp ult i8 %13, 10
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = add nsw i32 %2, 4
br label %22
17: ; preds = %12
switch i8 %0, label %19 [
i8 43, label %22
i8 47, label %18
]
18: ; preds = %17
br label %22
19: ; preds = %17
%20 = load i32, i32* @EINVAL
%21 = sub nsw i32 0, %20
br label %22
22: ; preds = %17, %19, %18, %15, %10, %5
%23 = phi i32 [ %6, %5 ], [ %11, %10 ], [ %16, %15 ], [ 63, %18 ], [ %21, %19 ], [ 62, %17 ]
ret i32 %23
}