#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__ isdigit(char);
char reverse(char c) {
  char *re = "A   3  HIL JM O   2TUVWXY51SE Z  8 ";
  if (c >= 'A' && c <= 'Z')
    return re[c - 'A'];
  if (isdigit(c))
    return re[c - '0' + 25];
  return 0;
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
lea    0xedb(%rip),%rax
mov    %rax,-0x10(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     115c <reverse+0x4c>
movsbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jg     115c <reverse+0x4c>
mov    -0x10(%rbp),%rax
movsbl -0x2(%rbp),%ecx
sub    $0x41,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1(%rbp)
jmp    118f <reverse+0x7f>
movsbl -0x2(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     118b <reverse+0x7b>
mov    -0x10(%rbp),%rax
movsbl -0x2(%rbp),%ecx
sub    $0x30,%ecx
add    $0x19,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1(%rbp)
jmp    118f <reverse+0x7f>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %rbx
mov    %edi,%ebx
lea    -0x41(%rbx),%eax
cmp    $0x19,%al
ja     111f <reverse+0xf>
add    $0xffffffbf,%ebx
jmp    1132 <reverse+0x22>
movsbl %bl,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     113e <reverse+0x2e>
add    $0xffffffe9,%ebx
movslq %ebx,%rbx
lea    0xec7(%rip),%rax
mov    (%rbx,%rax,1),%al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"A 3 HIL JM O 2TUVWXY51SE Z 8 \00"
define signext i8 @reverse(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8*
store i8 %0, i8* %3
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8** %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = icmp sge i32 %6, 65
br i1 %7, label %8, label %20
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp sle i32 %10, 90
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = sub nsw i32 %15, 65
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %13, i64 %17
%19 = load i8, i8* %18
store i8 %19, i8* %2
br label %34
20: ; preds = %8, %1
%21 = load i8, i8* %3
%22 = call i64 @isdigit(i8 signext %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %33
24: ; preds = %20
%25 = load i8*, i8** %4
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = sub nsw i32 %27, 48
%29 = add nsw i32 %28, 25
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %25, i64 %30
%32 = load i8, i8* %31
store i8 %32, i8* %2
br label %34
33: ; preds = %20
store i8 0, i8* %2
br label %34
34: ; preds = %33, %24, %12
%35 = load i8, i8* %2
ret i8 %35
}

LLVM IR (-O2):
@.str = [36 x i8] c"A 3 HIL JM O 2TUVWXY51SE Z 8 \00"
define signext i8 @reverse(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -65
%4 = icmp ult i8 %3, 26
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = add nsw i32 %2, -65
%7 = zext i32 %6 to i64
br label %14
8: ; preds = %1
%9 = tail call i64 @isdigit(i8 signext %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %8
%12 = add nsw i32 %2, -23
%13 = sext i32 %12 to i64
br label %14
14: ; preds = %5, %11
%15 = phi i64 [ %13, %11 ], [ %7, %5 ]
%16 = getelementptr inbounds [36 x i8], [36 x i8]* @.str, i64 0, i64 %15
%17 = load i8, i8* %16
br label %18
18: ; preds = %14, %8
%19 = phi i8 [ 0, %8 ], [ %17, %14 ]
ret i8 %19
}