#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 /*<<< orphan*/ assert(int);
int decode_char(unsigned char c) {
  char retval = -1;
  if (c >= 'A' && c <= 'Z')
    retval = c - 'A';
  if (c >= '2' && c <= '7')
    retval = c - '2' + 26;
  assert(retval == -1 || ((retval & 0x1F) == retval));
  return retval;
}


x86 assembly (clang, -O0):
<decode_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0xff,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1146 <decode_char+0x36>
movzbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     1146 <decode_char+0x36>
movzbl -0x1(%rbp),%eax
sub    $0x41,%eax
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x32,%eax
jl     116d <decode_char+0x5d>
movzbl -0x1(%rbp),%eax
cmp    $0x37,%eax
jg     116d <decode_char+0x5d>
movzbl -0x1(%rbp),%eax
sub    $0x32,%eax
add    $0x1a,%eax
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%ecx
mov    $0x1,%al
cmp    $0xffffffff,%ecx
mov    %al,-0x3(%rbp)
je     1192 <decode_char+0x82>
movsbl -0x2(%rbp),%eax
and    $0x1f,%eax
movsbl -0x2(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsbl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_char>:
push   %rbx
lea    -0x41(%rdi),%eax
lea    -0x41(%rdi),%ecx
cmp    $0x1a,%al
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
lea    -0x32(%rdi),%ecx
add    $0xffffffe8,%edi
cmp    $0x6,%cl
cmovae %eax,%edi
mov    %edi,%eax
shl    $0x18,%eax
movsbl %dil,%ebx
cmp    $0xff000000,%eax
sete   %al
and    $0x1f,%edi
cmp    %ebx,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @decode_char(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
store i8 -1, i8* %3
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = icmp sge i32 %5, 65
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = icmp sle i32 %9, 90
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %2
%13 = zext i8 %12 to i32
%14 = sub nsw i32 %13, 65
%15 = trunc i32 %14 to i8
store i8 %15, i8* %3
br label %16
16: ; preds = %11, %7, %1
%17 = load i8, i8* %2
%18 = zext i8 %17 to i32
%19 = icmp sge i32 %18, 50
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = load i8, i8* %2
%22 = zext i8 %21 to i32
%23 = icmp sle i32 %22, 55
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = load i8, i8* %2
%26 = zext i8 %25 to i32
%27 = sub nsw i32 %26, 50
%28 = add nsw i32 %27, 26
%29 = trunc i32 %28 to i8
store i8 %29, i8* %3
br label %30
30: ; preds = %24, %20, %16
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, -1
br i1 %33, label %41, label %34
34: ; preds = %30
%35 = load i8, i8* %3
%36 = sext i8 %35 to i32
%37 = and i32 %36, 31
%38 = load i8, i8* %3
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %37, %39
br label %41
41: ; preds = %34, %30
%42 = phi i1 [ true, %30 ], [ %40, %34 ]
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = load i8, i8* %3
%46 = sext i8 %45 to i32
ret i32 %46
}

LLVM IR (-O2):
define i32 @decode_char(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = add i8 %0, -65
%4 = icmp ult i8 %3, 26
%5 = add nsw i32 %2, -65
%6 = select i1 %4, i32 %5, i32 -1
%7 = add i8 %0, -50
%8 = icmp ult i8 %7, 6
%9 = add nsw i32 %2, -24
%10 = select i1 %8, i32 %9, i32 %6
%11 = shl i32 %10, 24
%12 = ashr exact i32 %11, 24
%13 = icmp eq i32 %11, -16777216
%14 = and i32 %10, 31
%15 = icmp eq i32 %14, %12
%16 = select i1 %13, i1 true, i1 %15
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
ret i32 %12
}