#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 char uint8_t;

/* Variables and functions */
uint8_t wspr_ascii_to_alphanum(uint8_t c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  if (c >= 'A' && c <= 'Z') {
    return c - 'A' + 10;
  }
  if (c == ' ') {
    return 36;
  }
  return 0;
}


x86 assembly (clang, -O0):
<wspr_ascii_to_alphanum>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x30,%eax
jl     1133 <wspr_ascii_to_alphanum+0x33>
movsbl -0x2(%rbp),%eax
cmp    $0x39,%eax
jg     1133 <wspr_ascii_to_alphanum+0x33>
movsbl -0x2(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    1179 <wspr_ascii_to_alphanum+0x79>
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     115f <wspr_ascii_to_alphanum+0x5f>
movsbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jg     115f <wspr_ascii_to_alphanum+0x5f>
movsbl -0x2(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %al,-0x1(%rbp)
jmp    1179 <wspr_ascii_to_alphanum+0x79>
movsbl -0x2(%rbp),%eax
cmp    $0x20,%eax
jne    1175 <wspr_ascii_to_alphanum+0x75>
movb   $0x24,-0x1(%rbp)
jmp    1179 <wspr_ascii_to_alphanum+0x79>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wspr_ascii_to_alphanum>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
jb     1123 <wspr_ascii_to_alphanum+0x23>
lea    -0x41(%rdi),%eax
cmp    $0x19,%al
ja     1115 <wspr_ascii_to_alphanum+0x15>
add    $0xc9,%dil
mov    %edi,%eax
ret
xor    %ecx,%ecx
cmp    $0x20,%dil
mov    $0x24,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @wspr_ascii_to_alphanum(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
%15 = trunc i32 %14 to i8
store i8 %15, i8* %2
br label %36
16: ; preds = %7, %1
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 65
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, 90
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, 65
%28 = add nsw i32 %27, 10
%29 = trunc i32 %28 to i8
store i8 %29, i8* %2
br label %36
30: ; preds = %20, %16
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 32
br i1 %33, label %34, label %35
34: ; preds = %30
store i8 36, i8* %2
br label %36
35: ; preds = %30
store i8 0, i8* %2
br label %36
36: ; preds = %35, %34, %24, %11
%37 = load i8, i8* %2
ret i8 %37
}

LLVM IR (-O2):
define signext i8 @wspr_ascii_to_alphanum(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = add i8 %0, -65
%6 = icmp ult i8 %5, 26
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = add nsw i8 %0, -55
br label %12
9: ; preds = %4
%10 = icmp eq i8 %0, 32
%11 = select i1 %10, i8 36, i8 0
br label %12
12: ; preds = %1, %9, %7
%13 = phi i8 [ %8, %7 ], [ %11, %9 ], [ %2, %1 ]
ret i8 %13
}