#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 */
scalar_t__ islower(char);
scalar_t__ isnum(char);
scalar_t__ isupper(char);
int ctoi(char c) {
  if (isnum(c))
    return c - '0';
  else if (islower(c))
    return c - 'a' + 10;
  else if (isupper(c))
    return c - 'A' + 36;
  else if (c == '+')
    return 62;
  else if (c == '/')
    return 63;
  return -1;
}


x86 assembly (clang, -O0):
<ctoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1050 <isnum@plt>
cmp    $0x0,%rax
je     1160 <ctoi+0x30>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    11f7 <ctoi+0xc7>
movsbl -0x5(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     1185 <ctoi+0x55>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    11f7 <ctoi+0xc7>
movsbl -0x5(%rbp),%edi
call   1040 <isupper@plt>
cmp    $0x0,%rax
je     11aa <ctoi+0x7a>
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
add    $0x24,%eax
mov    %eax,-0x4(%rbp)
jmp    11f7 <ctoi+0xc7>
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
jne    11c3 <ctoi+0x93>
movl   $0x3e,-0x4(%rbp)
jmp    11f7 <ctoi+0xc7>
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
jne    11dc <ctoi+0xac>
movl   $0x3f,-0x4(%rbp)
jmp    11f7 <ctoi+0xc7>
jmp    11e1 <ctoi+0xb1>
jmp    11e6 <ctoi+0xb6>
jmp    11eb <ctoi+0xbb>
jmp    11f0 <ctoi+0xc0>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctoi>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1050 <isnum@plt>
test   %rax,%rax
je     1147 <ctoi+0x17>
movsbl %bl,%ebp
add    $0xffffffd0,%ebp
jmp    1185 <ctoi+0x55>
movsbl %bl,%ebp
mov    %ebp,%edi
call   1030 <islower@plt>
test   %rax,%rax
je     115b <ctoi+0x2b>
add    $0xffffffa9,%ebp
jmp    1185 <ctoi+0x55>
mov    %ebp,%edi
call   1040 <isupper@plt>
test   %rax,%rax
je     116c <ctoi+0x3c>
add    $0xffffffe3,%ebp
jmp    1185 <ctoi+0x55>
xor    %eax,%eax
cmp    $0x2f,%bl
sete   %al
shl    $0x6,%eax
add    $0xffffffff,%eax
cmp    $0x2b,%bl
mov    $0x3e,%ebp
cmovne %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ctoi(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i64 @isnum(i8 signext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 48
store i32 %10, i32* %2
br label %44
11: ; preds = %1
%12 = load i8, i8* %3
%13 = call i64 @islower(i8 signext %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = sub nsw i32 %17, 97
%19 = add nsw i32 %18, 10
store i32 %19, i32* %2
br label %44
20: ; preds = %11
%21 = load i8, i8* %3
%22 = call i64 @isupper(i8 signext %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = sub nsw i32 %26, 65
%28 = add nsw i32 %27, 36
store i32 %28, i32* %2
br label %44
29: ; preds = %20
%30 = load i8, i8* %3
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 43
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 62, i32* %2
br label %44
34: ; preds = %29
%35 = load i8, i8* %3
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 47
br i1 %37, label %38, label %39
38: ; preds = %34
store i32 63, i32* %2
br label %44
39: ; preds = %34
br label %40
40: ; preds = %39
br label %41
41: ; preds = %40
br label %42
42: ; preds = %41
br label %43
43: ; preds = %42
store i32 -1, i32* %2
br label %44
44: ; preds = %43, %38, %33, %24, %15, %7
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
define i32 @ctoi(i8 signext %0) {
%2 = tail call i64 @isnum(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = sext i8 %0 to i32
%6 = add nsw i32 %5, -48
br label %24
7: ; preds = %1
%8 = tail call i64 @islower(i8 signext %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = sext i8 %0 to i32
%12 = add nsw i32 %11, -87
br label %24
13: ; preds = %7
%14 = tail call i64 @isupper(i8 signext %0)
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = sext i8 %0 to i32
%18 = add nsw i32 %17, -29
br label %24
19: ; preds = %13
%20 = icmp eq i8 %0, 47
%21 = select i1 %20, i32 63, i32 -1
%22 = icmp eq i8 %0, 43
%23 = select i1 %22, i32 62, i32 %21
br label %24
24: ; preds = %19, %16, %10, %4
%25 = phi i32 [ %6, %4 ], [ %12, %10 ], [ %18, %16 ], [ %23, %19 ]
ret i32 %25
}