int legal_pdf_encoded_byte(int c) {
  int k;
  const unsigned short wpdfdoc_encoding_table[256] = {
      0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,   0x08,
      0x09,   0x0A,   0x0B,   0x0C,   0x0D,   0x0E,   0x0F,   0x10,   0x11,
      0x12,   0x13,   0x14,   0x15,   0x16,   0x17,   0x02d8, 0x02c7, 0x02c6,
      0x02d9, 0x02dd, 0x02db, 0x02da, 0x02dc, 0x0020, 0x0021, 0x0022, 0x0023,
      0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c,
      0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035,
      0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e,
      0x003f, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
      0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050,
      0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059,
      0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x0060, 0x0061, 0x0062,
      0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b,
      0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074,
      0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d,
      0x007e, 0x0000, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x0192,
      0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018,
      0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x0141, 0x0152, 0x0160, 0x0178,
      0x017d, 0x0131, 0x0142, 0x0153, 0x0161, 0x017e, 0x0000, 0x20ac, 0x00a1,
      0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa,
      0x00ab, 0x00ac, 0x0000, 0x00ae, 0x00af, 0x00b0, 0x00b1, 0x00b2, 0x00b3,
      0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc,
      0x00bd, 0x00be, 0x00bf, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5,
      0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce,
      0x00cf, 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
      0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, 0x00e0,
      0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9,
      0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x00f0, 0x00f1, 0x00f2,
      0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb,
      0x00fc, 0x00fd, 0x00fe, 0x00ff};
  for (k = 1; k < 256; k++)
    if (c == wpdfdoc_encoding_table[k])
      return (k);
  return (0);
}


x86 assembly (clang, -O0):
<legal_pdf_encoded_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x210(%rbp),%rdi
lea    0xed4(%rip),%rsi
mov    $0x200,%edx
call   1030 <memcpy@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x100,-0xc(%rbp)
jge    117f <legal_pdf_encoded_byte+0x6f>
mov    -0x8(%rbp),%eax
movslq -0xc(%rbp),%rcx
movzwl -0x210(%rbp,%rcx,2),%ecx
ff
cmp    %ecx,%eax
jne    116c <legal_pdf_encoded_byte+0x5c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1186 <legal_pdf_encoded_byte+0x76>
jmp    1171 <legal_pdf_encoded_byte+0x61>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <legal_pdf_encoded_byte+0x2d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<legal_pdf_encoded_byte>:
mov    $0x5,%eax
lea    0xef4(%rip),%rcx
nopl   0x0(%rax)
movzwl -0x8(%rcx,%rax,2),%edx
cmp    %edi,%edx
je     114b <legal_pdf_encoded_byte+0x4b>
movzwl -0x6(%rcx,%rax,2),%edx
cmp    %edi,%edx
je     1150 <legal_pdf_encoded_byte+0x50>
movzwl -0x4(%rcx,%rax,2),%edx
cmp    %edi,%edx
je     1155 <legal_pdf_encoded_byte+0x55>
movzwl -0x2(%rcx,%rax,2),%edx
cmp    %edi,%edx
je     115a <legal_pdf_encoded_byte+0x5a>
movzwl (%rcx,%rax,2),%edx
cmp    %edi,%edx
je     115e <legal_pdf_encoded_byte+0x5e>
add    $0x5,%rax
cmp    $0x104,%rax
jne    1110 <legal_pdf_encoded_byte+0x10>
xor    %eax,%eax
ret
add    $0xfffffffffffffffc,%rax
ret
add    $0xfffffffffffffffd,%rax
ret
add    $0xfffffffffffffffe,%rax
ret
add    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
@__const.legal_pdf_encoded_byte.wpdfdoc_encoding_table = [256 x i16] [i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19, i16 20, i16 21, i16 22, i16 23, i16 728, i16 711, i16 710, i16 729, i16 733, i16 731, i16 730, i16 732, i16 32, i16 33, i16 34, i16 35, i16 36, i16 37, i16 38, i16 39, i16 40, i16 41, i16 42, i16 43, i16 44, i16 45, i16 46, i16 47, i16 48, i16 49, i16 50, i16 51, i16 52, i16 53, i16 54, i16 55, i16 56, i16 57, i16 58, i16 59, i16 60, i16 61, i16 62, i16 63, i16 64, i16 65, i16 66, i16 67, i16 68, i16 69, i16 70, i16 71, i16 72, i16 73, i16 74, i16 75, i16 76, i16 77, i16 78, i16 79, i16 80, i16 81, i16 82, i16 83, i16 84, i16 85, i16 86, i16 87, i16 88, i16 89, i16 90, i16 91, i16 92, i16 93, i16 94, i16 95, i16 96, i16 97, i16 98, i16 99, i16 100, i16 101, i16 102, i16 103, i16 104, i16 105, i16 106, i16 107, i16 108, i16 109, i16 110, i16 111, i16 112, i16 113, i16 114, i16 115, i16 116, i16 117, i16 118, i16 119, i16 120, i16 121, i16 122, i16 123, i16 124, i16 125, i16 126, i16 0, i16 8226, i16 8224, i16 8225, i16 8230, i16 8212, i16 8211, i16 402, i16 8260, i16 8249, i16 8250, i16 8722, i16 8240, i16 8222, i16 8220, i16 8221, i16 8216, i16 8217, i16 8218, i16 8482, i16 -1279, i16 -1278, i16 321, i16 338, i16 352, i16 376, i16 381, i16 305, i16 322, i16 339, i16 353, i16 382, i16 0, i16 8364, i16 161, i16 162, i16 163, i16 164, i16 165, i16 166, i16 167, i16 168, i16 169, i16 170, i16 171, i16 172, i16 0, i16 174, i16 175, i16 176, i16 177, i16 178, i16 179, i16 180, i16 181, i16 182, i16 183, i16 184, i16 185, i16 186, i16 187, i16 188, i16 189, i16 190, i16 191, i16 192, i16 193, i16 194, i16 195, i16 196, i16 197, i16 198, i16 199, i16 200, i16 201, i16 202, i16 203, i16 204, i16 205, i16 206, i16 207, i16 208, i16 209, i16 210, i16 211, i16 212, i16 213, i16 214, i16 215, i16 216, i16 217, i16 218, i16 219, i16 220, i16 221, i16 222, i16 223, i16 224, i16 225, i16 226, i16 227, i16 228, i16 229, i16 230, i16 231, i16 232, i16 233, i16 234, i16 235, i16 236, i16 237, i16 238, i16 239, i16 240, i16 241, i16 242, i16 243, i16 244, i16 245, i16 246, i16 247, i16 248, i16 249, i16 250, i16 251, i16 252, i16 253, i16 254, i16 255]
define i32 @legal_pdf_encoded_byte(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [256 x i16]
store i32 %0, i32* %3
%6 = bitcast [256 x i16]* %5 to i8*
store i32 1, i32* %4
br label %7
7: ; preds = %21, %1
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 256
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [256 x i16], [256 x i16]* %5, i64 0, i64 %13
%15 = load i16, i16* %14
%16 = zext i16 %15 to i32
%17 = icmp eq i32 %11, %16
br i1 %17, label %18, label %20
18: ; preds = %10
%19 = load i32, i32* %4
store i32 %19, i32* %2
br label %25
20: ; preds = %10
br label %21
21: ; preds = %20
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %7
24: ; preds = %7
store i32 0, i32* %2
br label %25
25: ; preds = %24, %18
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@__const.legal_pdf_encoded_byte.wpdfdoc_encoding_table = [256 x i16] [i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19, i16 20, i16 21, i16 22, i16 23, i16 728, i16 711, i16 710, i16 729, i16 733, i16 731, i16 730, i16 732, i16 32, i16 33, i16 34, i16 35, i16 36, i16 37, i16 38, i16 39, i16 40, i16 41, i16 42, i16 43, i16 44, i16 45, i16 46, i16 47, i16 48, i16 49, i16 50, i16 51, i16 52, i16 53, i16 54, i16 55, i16 56, i16 57, i16 58, i16 59, i16 60, i16 61, i16 62, i16 63, i16 64, i16 65, i16 66, i16 67, i16 68, i16 69, i16 70, i16 71, i16 72, i16 73, i16 74, i16 75, i16 76, i16 77, i16 78, i16 79, i16 80, i16 81, i16 82, i16 83, i16 84, i16 85, i16 86, i16 87, i16 88, i16 89, i16 90, i16 91, i16 92, i16 93, i16 94, i16 95, i16 96, i16 97, i16 98, i16 99, i16 100, i16 101, i16 102, i16 103, i16 104, i16 105, i16 106, i16 107, i16 108, i16 109, i16 110, i16 111, i16 112, i16 113, i16 114, i16 115, i16 116, i16 117, i16 118, i16 119, i16 120, i16 121, i16 122, i16 123, i16 124, i16 125, i16 126, i16 0, i16 8226, i16 8224, i16 8225, i16 8230, i16 8212, i16 8211, i16 402, i16 8260, i16 8249, i16 8250, i16 8722, i16 8240, i16 8222, i16 8220, i16 8221, i16 8216, i16 8217, i16 8218, i16 8482, i16 -1279, i16 -1278, i16 321, i16 338, i16 352, i16 376, i16 381, i16 305, i16 322, i16 339, i16 353, i16 382, i16 0, i16 8364, i16 161, i16 162, i16 163, i16 164, i16 165, i16 166, i16 167, i16 168, i16 169, i16 170, i16 171, i16 172, i16 0, i16 174, i16 175, i16 176, i16 177, i16 178, i16 179, i16 180, i16 181, i16 182, i16 183, i16 184, i16 185, i16 186, i16 187, i16 188, i16 189, i16 190, i16 191, i16 192, i16 193, i16 194, i16 195, i16 196, i16 197, i16 198, i16 199, i16 200, i16 201, i16 202, i16 203, i16 204, i16 205, i16 206, i16 207, i16 208, i16 209, i16 210, i16 211, i16 212, i16 213, i16 214, i16 215, i16 216, i16 217, i16 218, i16 219, i16 220, i16 221, i16 222, i16 223, i16 224, i16 225, i16 226, i16 227, i16 228, i16 229, i16 230, i16 231, i16 232, i16 233, i16 234, i16 235, i16 236, i16 237, i16 238, i16 239, i16 240, i16 241, i16 242, i16 243, i16 244, i16 245, i16 246, i16 247, i16 248, i16 249, i16 250, i16 251, i16 252, i16 253, i16 254, i16 255]
define i32 @legal_pdf_encoded_byte(i32 %0) {
br label %2
2: ; preds = %32, %1
%3 = phi i64 [ 1, %1 ], [ %33, %32 ]
%4 = getelementptr inbounds [256 x i16], [256 x i16]* @__const.legal_pdf_encoded_byte.wpdfdoc_encoding_table, i64 0, i64 %3
%5 = load i16, i16* %4
%6 = zext i16 %5 to i32
%7 = icmp eq i32 %6, %0
br i1 %7, label %35, label %8
8: ; preds = %2
%9 = add nuw nsw i64 %3, 1
%10 = getelementptr inbounds [256 x i16], [256 x i16]* @__const.legal_pdf_encoded_byte.wpdfdoc_encoding_table, i64 0, i64 %9
%11 = load i16, i16* %10
%12 = zext i16 %11 to i32
%13 = icmp eq i32 %12, %0
br i1 %13, label %35, label %14
14: ; preds = %8
%15 = add nuw nsw i64 %3, 2
%16 = getelementptr inbounds [256 x i16], [256 x i16]* @__const.legal_pdf_encoded_byte.wpdfdoc_encoding_table, i64 0, i64 %15
%17 = load i16, i16* %16
%18 = zext i16 %17 to i32
%19 = icmp eq i32 %18, %0
br i1 %19, label %35, label %20
20: ; preds = %14
%21 = add nuw nsw i64 %3, 3
%22 = getelementptr inbounds [256 x i16], [256 x i16]* @__const.legal_pdf_encoded_byte.wpdfdoc_encoding_table, i64 0, i64 %21
%23 = load i16, i16* %22
%24 = zext i16 %23 to i32
%25 = icmp eq i32 %24, %0
br i1 %25, label %35, label %26
26: ; preds = %20
%27 = add nuw nsw i64 %3, 4
%28 = getelementptr inbounds [256 x i16], [256 x i16]* @__const.legal_pdf_encoded_byte.wpdfdoc_encoding_table, i64 0, i64 %27
%29 = load i16, i16* %28
%30 = zext i16 %29 to i32
%31 = icmp eq i32 %30, %0
br i1 %31, label %35, label %32
32: ; preds = %26
%33 = add nuw nsw i64 %3, 5
%34 = icmp eq i64 %33, 256
br i1 %34, label %38, label %2
35: ; preds = %26, %20, %14, %8, %2
%36 = phi i64 [ %3, %2 ], [ %9, %8 ], [ %15, %14 ], [ %21, %20 ], [ %27, %26 ]
%37 = trunc i64 %36 to i32
br label %38
38: ; preds = %32, %35
%39 = phi i32 [ %37, %35 ], [ 0, %32 ]
ret i32 %39
}