#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 __radixval(char c) {
  static char val_radix_upper[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8',
                                   '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
                                   'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
                                   'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
  static char val_radix_lower[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8',
                                   '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
                                   'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
                                   'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
  for (int i = 0; i < 36; i++)
    if (c == val_radix_upper[i] || c == val_radix_lower[i])
      return i;
  return 0;
}


x86 assembly (clang, -O0):
<__radixval>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x24,-0xc(%rbp)
jge    116f <__radixval+0x6f>
movsbl -0x5(%rbp),%eax
movslq -0xc(%rbp),%rdx
lea    0x2f06(%rip),%rcx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1151 <__radixval+0x51>
movsbl -0x5(%rbp),%eax
movslq -0xc(%rbp),%rdx
lea    0x2f1b(%rip),%rcx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    115c <__radixval+0x5c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1176 <__radixval+0x76>
jmp    1161 <__radixval+0x61>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <__radixval+0x11>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__radixval>:
mov    $0x2,%eax
lea    0xef4(%rip),%rcx
lea    0xf1d(%rip),%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %dil,-0x2(%rax,%rcx,1)
je     1155 <__radixval+0x55>
cmp    %dil,-0x2(%rax,%rdx,1)
je     1155 <__radixval+0x55>
cmp    %dil,-0x1(%rax,%rcx,1)
je     115a <__radixval+0x5a>
cmp    %dil,-0x1(%rax,%rdx,1)
je     115a <__radixval+0x5a>
cmp    %dil,(%rax,%rcx,1)
je     1159 <__radixval+0x59>
cmp    %dil,(%rax,%rdx,1)
je     1159 <__radixval+0x59>
add    $0x3,%rax
cmp    $0x26,%rax
jne    1120 <__radixval+0x20>
xor    %eax,%eax
ret
add    $0xfffffffffffffffe,%rax
ret
add    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
@__radixval.val_radix_upper = internal global [36 x i8] c"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@__radixval.val_radix_lower = internal global [36 x i8] c"0123456789abcdefghijklmnopqrstuvwxyz"
define i32 @__radixval(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
store i32 0, i32* %4
br label %5
5: ; preds = %29, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 36
br i1 %7, label %8, label %32
8: ; preds = %5
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [36 x i8], [36 x i8]* @__radixval.val_radix_upper, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %10, %15
br i1 %16, label %26, label %17
17: ; preds = %8
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [36 x i8], [36 x i8]* @__radixval.val_radix_lower, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %19, %24
br i1 %25, label %26, label %28
26: ; preds = %17, %8
%27 = load i32, i32* %4
store i32 %27, i32* %2
br label %33
28: ; preds = %17
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %5
32: ; preds = %5
store i32 0, i32* %2
br label %33
33: ; preds = %32, %26
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@__radixval.val_radix_upper = internal unnamed_addr constant [36 x i8] c"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@__radixval.val_radix_lower = internal unnamed_addr constant [36 x i8] c"0123456789abcdefghijklmnopqrstuvwxyz"
define i32 @__radixval(i8 signext %0) {
br label %2
2: ; preds = %29, %1
%3 = phi i64 [ 0, %1 ], [ %30, %29 ]
%4 = getelementptr inbounds [36 x i8], [36 x i8]* @__radixval.val_radix_upper, i64 0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, %0
br i1 %6, label %32, label %7
7: ; preds = %2
%8 = getelementptr inbounds [36 x i8], [36 x i8]* @__radixval.val_radix_lower, i64 0, i64 %3
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, %0
br i1 %10, label %35, label %11
11: ; preds = %7
%12 = add nuw nsw i64 %3, 1
%13 = getelementptr inbounds [36 x i8], [36 x i8]* @__radixval.val_radix_upper, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, %0
br i1 %15, label %32, label %16
16: ; preds = %11
%17 = getelementptr inbounds [36 x i8], [36 x i8]* @__radixval.val_radix_lower, i64 0, i64 %12
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, %0
br i1 %19, label %35, label %20
20: ; preds = %16
%21 = add nuw nsw i64 %3, 2
%22 = getelementptr inbounds [36 x i8], [36 x i8]* @__radixval.val_radix_upper, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, %0
br i1 %24, label %32, label %25
25: ; preds = %20
%26 = getelementptr inbounds [36 x i8], [36 x i8]* @__radixval.val_radix_lower, i64 0, i64 %21
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, %0
br i1 %28, label %35, label %29
29: ; preds = %25
%30 = add nuw nsw i64 %3, 3
%31 = icmp eq i64 %30, 36
br i1 %31, label %38, label %2
32: ; preds = %20, %11, %2
%33 = phi i64 [ %3, %2 ], [ %12, %11 ], [ %21, %20 ]
%34 = trunc i64 %33 to i32
br label %38
35: ; preds = %25, %16, %7
%36 = phi i64 [ %3, %7 ], [ %12, %16 ], [ %21, %25 ]
%37 = trunc i64 %36 to i32
br label %38
38: ; preds = %29, %35, %32
%39 = phi i32 [ %34, %32 ], [ %37, %35 ], [ 0, %29 ]
ret i32 %39
}