#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 uint32_t;
typedef int /*<<< orphan*/ data;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
uint32_t pn_decode_char6(uint32_t value) {
  const char data[] =
      "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._";
  if (value >= (sizeof(data) / sizeof((data)[0]))) {
    do {
      fprintf(stderr, "Invalid char6 value: %u\n", value);
      exit(1);
    } while (0);
  }
  return data[value];
}


x86 assembly (clang, -O0):
<pn_decode_char6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeba(%rip),%rsi
mov    $0x41,%edx
call   1040 <memcpy@plt>
movslq -0x4(%rbp),%rax
cmp    $0x41,%rax
jb     1185 <pn_decode_char6+0x55>
jmp    1163 <pn_decode_char6+0x33>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xecb(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movslq -0x4(%rbp),%rax
movsbl -0x50(%rbp,%rax,1),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pn_decode_char6>:
push   %rax
mov    %edi,%edx
cmp    $0x41,%edi
jae    1137 <pn_decode_char6+0x17>
mov    %edx,%eax
lea    0xecf(%rip),%rcx
movsbl (%rax,%rcx,1),%eax
pop    %rcx
ret
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xefa(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@__const.pn_decode_char6.data = [65 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._\00"
@stderr = global i32 0
@.str = [25 x i8] c"Invalid char6 value: %u\0A\00"
define i32 @pn_decode_char6(i32 %0) {
%2 = alloca i32
%3 = alloca [65 x i8]
store i32 %0, i32* %2
%4 = bitcast [65 x i8]* %3 to i8*
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = icmp uge i64 %6, 65
br i1 %7, label %8, label %15
8: ; preds = %1
br label %9
9: ; preds = %8
%10 = load i32, i32* @stderr
%11 = load i32, i32* %2
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; No predecessors!
br label %15
15: ; preds = %14, %1
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
@__const.pn_decode_char6.data = [65 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._\00"
@stderr = global i32 0
@.str = [25 x i8] c"Invalid char6 value: %u\0A\00"
define i32 @pn_decode_char6(i32 %0) {
%2 = icmp ugt i32 %0, 64
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
%8 = zext i32 %0 to i64
%9 = getelementptr inbounds [65 x i8], [65 x i8]* @__const.pn_decode_char6.data, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
ret i32 %11
}