int conv_to_number(unsigned char inbyte) {
  if (inbyte >= (unsigned char)'A' && inbyte <= (unsigned char)'Z')
    return (inbyte - (unsigned char)'A');
  if (inbyte >= (unsigned char)'a' && inbyte <= (unsigned char)'z')
    return ((inbyte - (unsigned char)'a') + 26);
  if (inbyte >= '0' && inbyte <= '9')
    return ((inbyte - (unsigned char)'0') + 52);
  if (inbyte == (unsigned char)'+')
    return 62;
  if (inbyte == '/')
    return 63;
  return -1;
}


x86 assembly (clang, -O0):
<conv_to_number>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1133 <conv_to_number+0x33>
movzbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1133 <conv_to_number+0x33>
movzbl -0x5(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    11c4 <conv_to_number+0xc4>
movzbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     115f <conv_to_number+0x5f>
movzbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     115f <conv_to_number+0x5f>
movzbl -0x5(%rbp),%eax
sub    $0x61,%eax
add    $0x1a,%eax
mov    %eax,-0x4(%rbp)
jmp    11c4 <conv_to_number+0xc4>
movzbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     118b <conv_to_number+0x8b>
movzbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     118b <conv_to_number+0x8b>
movzbl -0x5(%rbp),%eax
sub    $0x30,%eax
add    $0x34,%eax
mov    %eax,-0x4(%rbp)
jmp    11c4 <conv_to_number+0xc4>
movzbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
jne    11a4 <conv_to_number+0xa4>
movl   $0x3e,-0x4(%rbp)
jmp    11c4 <conv_to_number+0xc4>
movzbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
jne    11bd <conv_to_number+0xbd>
movl   $0x3f,-0x4(%rbp)
jmp    11c4 <conv_to_number+0xc4>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<conv_to_number>:
mov    %edi,%eax
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     110e <conv_to_number+0xe>
add    $0xffffffbf,%eax
ret
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     111a <conv_to_number+0x1a>
add    $0xffffffb9,%eax
ret
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     1126 <conv_to_number+0x26>
add    $0x4,%eax
ret
xor    %ecx,%ecx
cmp    $0x2f,%al
sete   %cl
shl    $0x6,%ecx
add    $0xffffffff,%ecx
cmp    $0x2b,%al
mov    $0x3e,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @conv_to_number(i8 zeroext %0) {
%2 = zext 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 nuw nsw i32 %2, 4
br label %22
17: ; preds = %12
%18 = icmp eq i8 %0, 47
%19 = select i1 %18, i32 63, i32 -1
%20 = icmp eq i8 %0, 43
%21 = select i1 %20, i32 62, i32 %19
br label %22
22: ; preds = %17, %15, %10, %5
%23 = phi i32 [ %6, %5 ], [ %11, %10 ], [ %16, %15 ], [ %21, %17 ]
ret i32 %23
}