#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*/ isalnum(unsigned int);
scalar_t__ iscntrl(unsigned int);
int /*<<< orphan*/ isprint(unsigned int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strchr(char *, unsigned int);
int main(int argc, char *argv[]) {
  unsigned c;
  unsigned char flags;
  printf("/* this file is automatically generated by gen_test_char, "
         "do not edit. \"make include/private/apr_escape_test_char.h\" to "
         "regenerate. */\n"
         "#define T_ESCAPE_SHELL_CMD     (%u)\n"
         "#define T_ESCAPE_PATH_SEGMENT  (%u)\n"
         "#define T_OS_ESCAPE_PATH       (%u)\n"
         "#define T_ESCAPE_ECHO          (%u)\n"
         "#define T_ESCAPE_URLENCODED    (%u)\n"
         "#define T_ESCAPE_XML           (%u)\n"
         "\n"
         "static const unsigned char test_char_table[256] = {",
         (0x01), (0x02), (0x04), (0x08), (0x10), (0x20));
  for (c = 0; c < 256; ++c) {
    flags = 0;
    if (c % 20 == 0)
      printf("\n    ");
    if (c && strchr("&;`'\"|*?~<>^()[]{}$\\\n", c)) {
      flags |= (0x01);
    }
    if (!isalnum(c) && !strchr("$-_.+!*'(),:@&=~", c)) {
      flags |= (0x02);
    }
    if (!isalnum(c) && !strchr("$-_.+!*'(),:@&=/~", c)) {
      flags |= (0x04);
    }
    if (!isalnum(c) && !strchr(".-*_ ", c)) {
      flags |= (0x10);
    }
    if (c && (!isprint(c) || c == '"' || c == '\\' || iscntrl(c))) {
      flags |= (0x08);
    }
    if (strchr("<>&\"", c)) {
      flags |= (0x20);
    }
    printf("%u%c", flags, (c < 255) ? ',' : ' ');
  }
  printf("\n};\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x4,%ecx
mov    $0x8,%r8d
mov    $0x10,%r9d
movl   $0x20,(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jae    133e <main+0x1ee>
movb   $0x0,-0x15(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x14,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
jne    11d1 <main+0x81>
lea    0xfca(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
je     11fe <main+0xae>
mov    -0x14(%rbp),%esi
lea    0xfb5(%rip),%rdi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     11fe <main+0xae>
movzbl -0x15(%rbp),%eax
or     $0x1,%eax
mov    %al,-0x15(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <isalnum@plt>
cmp    $0x0,%eax
jne    1232 <main+0xe2>
mov    -0x14(%rbp),%esi
lea    0xf97(%rip),%rdi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    1232 <main+0xe2>
movzbl -0x15(%rbp),%eax
or     $0x2,%eax
mov    %al,-0x15(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <isalnum@plt>
cmp    $0x0,%eax
jne    1266 <main+0x116>
mov    -0x14(%rbp),%esi
lea    0xf74(%rip),%rdi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    1266 <main+0x116>
movzbl -0x15(%rbp),%eax
or     $0x4,%eax
mov    %al,-0x15(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <isalnum@plt>
cmp    $0x0,%eax
jne    129a <main+0x14a>
mov    -0x14(%rbp),%esi
lea    0xf52(%rip),%rdi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    129a <main+0x14a>
movzbl -0x15(%rbp),%eax
or     $0x10,%eax
mov    %al,-0x15(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     12e5 <main+0x195>
mov    -0x14(%rbp),%edi
call   1070 <isprint@plt>
cmp    $0x0,%eax
je     12db <main+0x18b>
cmpl   $0x22,-0x14(%rbp)
je     12db <main+0x18b>
cmpl   $0x5c,-0x14(%rbp)
je     12db <main+0x18b>
mov    -0x14(%rbp),%edi
call   1030 <iscntrl@plt>
cmp    $0x0,%rax
je     12e5 <main+0x195>
movzbl -0x15(%rbp),%eax
or     $0x8,%eax
mov    %al,-0x15(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeea(%rip),%rdi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     1308 <main+0x1b8>
movzbl -0x15(%rbp),%eax
or     $0x20,%eax
mov    %al,-0x15(%rbp)
movzbl -0x15(%rbp),%esi
mov    -0x14(%rbp),%ecx
mov    $0x20,%edx
mov    $0x2c,%eax
cmp    $0xff,%ecx
cmovb  %eax,%edx
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119d <main+0x4d>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x20,(%rsp)
lea    0xe87(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x4,%ecx
mov    $0x8,%r8d
mov    $0x10,%r9d
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x1037(%rip),%rbx
mov    $0x2c,%r12d
lea    0x102f(%rip),%rbp
xor    %r15d,%r15d
jmp    120e <main+0xae>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
or     $0x8,%r13b
mov    %rbx,%rdi
mov    %r15d,%esi
call   1050 <strchr@plt>
lea    0x20(%r13),%ecx
test   %rax,%rax
movzbl %r13b,%eax
movzbl %cl,%ecx
cmove  %eax,%ecx
movzbl %cl,%esi
cmp    $0xff,%r15d
mov    $0x20,%edx
cmovb  %r12d,%edx
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r15d
cmp    $0x100,%r15d
je     1350 <main+0x1f0>
movzbl %r15b,%eax
imul   $0xcd,%eax,%ecx
shr    $0xa,%ecx
and    $0xfffffffc,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %cl,%al
je     1230 <main+0xd0>
test   %r15d,%r15d
sete   %r14b
jmp    124a <main+0xea>
xor    %r14d,%r14d
lea    0xf5a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
test   %r15d,%r15d
je     1345 <main+0x1e5>
lea    0xf49(%rip),%rdi
mov    %r15d,%esi
call   1050 <strchr@plt>
test   %rax,%rax
setne  %r13b
mov    %r15d,%edi
call   1070 <isalnum@plt>
test   %eax,%eax
jne    128e <main+0x12e>
lea    0xf3d(%rip),%rdi
mov    %r15d,%esi
call   1050 <strchr@plt>
lea    0x2(%r13),%ecx
test   %rax,%rax
movzbl %r13b,%eax
movzbl %cl,%r13d
cmovne %eax,%r13d
mov    %r15d,%edi
call   1070 <isalnum@plt>
test   %eax,%eax
jne    12bc <main+0x15c>
lea    0xf20(%rip),%rdi
mov    %r15d,%esi
call   1050 <strchr@plt>
lea    0x4(%r13),%ecx
test   %rax,%rax
movzbl %r13b,%eax
movzbl %cl,%r13d
cmovne %eax,%r13d
mov    %r15d,%edi
call   1070 <isalnum@plt>
test   %eax,%eax
je     12e0 <main+0x180>
test   %r14b,%r14b
jne    11c4 <main+0x64>
jmp    130b <main+0x1ab>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xeec(%rip),%rdi
mov    %r15d,%esi
call   1050 <strchr@plt>
lea    0x10(%r13),%ecx
test   %rax,%rax
movzbl %r13b,%eax
movzbl %cl,%r13d
cmovne %eax,%r13d
test   %r14b,%r14b
jne    11c4 <main+0x64>
mov    %r15d,%edi
call   1080 <isprint@plt>
test   %eax,%eax
je     11c0 <main+0x60>
cmp    $0x22,%r15d
je     11c0 <main+0x60>
cmp    $0x5c,%r15d
je     11c0 <main+0x60>
mov    %r15d,%edi
call   1040 <iscntrl@plt>
test   %rax,%rax
jne    11c0 <main+0x60>
jmp    11c4 <main+0x64>
mov    $0x1,%r14b
xor    %r13d,%r13d
jmp    1260 <main+0x100>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [404 x i8] c"/* this file is automatically generated by gen_test_char, do not edit. \22make include/private/apr_escape_test_char.h\22 to regenerate. */\0A#define T_ESCAPE_SHELL_CMD (%u)\0A#define T_ESCAPE_PATH_SEGMENT (%u)\0A#define T_OS_ESCAPE_PATH (%u)\0A#define T_ESCAPE_ECHO (%u)\0A#define T_ESCAPE_URLENCODED (%u)\0A#define T_ESCAPE_XML (%u)\0A\0Astatic const unsigned char test_char_table[256] = {\00"
@.str.1 = [6 x i8] c"\0A \00"
@.str.2 = [22 x i8] c"&;`'\22|*?~<>^()[]{}$\\\0A\00"
@.str.3 = [17 x i8] c"$-_.+!*'(),:@&=~\00"
@.str.4 = [18 x i8] c"$-_.+!*'(),:@&=/~\00"
@.str.5 = [6 x i8] c".-*_ \00"
@.str.6 = [5 x i8] c"<>&\22\00"
@.str.7 = [5 x i8] c"%u%c\00"
@.str.8 = [5 x i8] c"\0A};\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([404 x i8], [404 x i8]* @.str, i64 0, i64 0), i32 1, i32 2, i32 4, i32 8, i32 16, i32 32)
store i32 0, i32* %6
br label %9
9: ; preds = %108, %2
%10 = load i32, i32* %6
%11 = icmp ult i32 %10, 256
br i1 %11, label %12, label %111
12: ; preds = %9
store i8 0, i8* %7
%13 = load i32, i32* %6
%14 = urem i32 %13, 20
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %12
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %18
%22 = load i32, i32* %6
%23 = call i64 @strchr(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = load i8, i8* %7
%27 = zext i8 %26 to i32
%28 = or i32 %27, 1
%29 = trunc i32 %28 to i8
store i8 %29, i8* %7
br label %30
30: ; preds = %25, %21, %18
%31 = load i32, i32* %6
%32 = call i32 @isalnum(i32 %31)
%33 = icmp ne i32 %32, 0
br i1 %33, label %43, label %34
34: ; preds = %30
%35 = load i32, i32* %6
%36 = call i64 @strchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %43, label %38
38: ; preds = %34
%39 = load i8, i8* %7
%40 = zext i8 %39 to i32
%41 = or i32 %40, 2
%42 = trunc i32 %41 to i8
store i8 %42, i8* %7
br label %43
43: ; preds = %38, %34, %30
%44 = load i32, i32* %6
%45 = call i32 @isalnum(i32 %44)
%46 = icmp ne i32 %45, 0
br i1 %46, label %56, label %47
47: ; preds = %43
%48 = load i32, i32* %6
%49 = call i64 @strchr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %56, label %51
51: ; preds = %47
%52 = load i8, i8* %7
%53 = zext i8 %52 to i32
%54 = or i32 %53, 4
%55 = trunc i32 %54 to i8
store i8 %55, i8* %7
br label %56
56: ; preds = %51, %47, %43
%57 = load i32, i32* %6
%58 = call i32 @isalnum(i32 %57)
%59 = icmp ne i32 %58, 0
br i1 %59, label %69, label %60
60: ; preds = %56
%61 = load i32, i32* %6
%62 = call i64 @strchr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %61)
%63 = icmp ne i64 %62, 0
br i1 %63, label %69, label %64
64: ; preds = %60
%65 = load i8, i8* %7
%66 = zext i8 %65 to i32
%67 = or i32 %66, 16
%68 = trunc i32 %67 to i8
store i8 %68, i8* %7
br label %69
69: ; preds = %64, %60, %56
%70 = load i32, i32* %6
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %91
72: ; preds = %69
%73 = load i32, i32* %6
%74 = call i32 @isprint(i32 %73)
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %86
76: ; preds = %72
%77 = load i32, i32* %6
%78 = icmp eq i32 %77, 34
br i1 %78, label %86, label %79
79: ; preds = %76
%80 = load i32, i32* %6
%81 = icmp eq i32 %80, 92
br i1 %81, label %86, label %82
82: ; preds = %79
%83 = load i32, i32* %6
%84 = call i64 @iscntrl(i32 %83)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %91
86: ; preds = %82, %79, %76, %72
%87 = load i8, i8* %7
%88 = zext i8 %87 to i32
%89 = or i32 %88, 8
%90 = trunc i32 %89 to i8
store i8 %90, i8* %7
br label %91
91: ; preds = %86, %82, %69
%92 = load i32, i32* %6
%93 = call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %92)
%94 = icmp ne i64 %93, 0
br i1 %94, label %95, label %100
95: ; preds = %91
%96 = load i8, i8* %7
%97 = zext i8 %96 to i32
%98 = or i32 %97, 32
%99 = trunc i32 %98 to i8
store i8 %99, i8* %7
br label %100
100: ; preds = %95, %91
%101 = load i8, i8* %7
%102 = zext i8 %101 to i32
%103 = load i32, i32* %6
%104 = icmp ult i32 %103, 255
%105 = zext i1 %104 to i64
%106 = select i1 %104, i32 44, i32 32
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %102, i32 %106)
br label %108
108: ; preds = %100
%109 = load i32, i32* %6
%110 = add i32 %109, 1
store i32 %110, i32* %6
br label %9
111: ; preds = %9
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [404 x i8] c"/* this file is automatically generated by gen_test_char, do not edit. \22make include/private/apr_escape_test_char.h\22 to regenerate. */\0A#define T_ESCAPE_SHELL_CMD (%u)\0A#define T_ESCAPE_PATH_SEGMENT (%u)\0A#define T_OS_ESCAPE_PATH (%u)\0A#define T_ESCAPE_ECHO (%u)\0A#define T_ESCAPE_URLENCODED (%u)\0A#define T_ESCAPE_XML (%u)\0A\0Astatic const unsigned char test_char_table[256] = {\00"
@.str.1 = [6 x i8] c"\0A \00"
@.str.2 = [22 x i8] c"&;`'\22|*?~<>^()[]{}$\\\0A\00"
@.str.3 = [17 x i8] c"$-_.+!*'(),:@&=~\00"
@.str.4 = [18 x i8] c"$-_.+!*'(),:@&=/~\00"
@.str.5 = [6 x i8] c".-*_ \00"
@.str.6 = [5 x i8] c"<>&\22\00"
@.str.7 = [5 x i8] c"%u%c\00"
@str = [4 x i8] c"\0A};\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([404 x i8], [404 x i8]* @.str, i64 0, i64 0), i32 1, i32 2, i32 4, i32 8, i32 16, i32 32)
br label %4
4: ; preds = %2, %61
%5 = phi i32 [ 0, %2 ], [ %71, %61 ]
%6 = trunc i32 %5 to i8
%7 = urem i8 %6, 20
%8 = icmp eq i8 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = icmp eq i32 %5, 0
br label %14
11: ; preds = %4
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32 %5, 0
br i1 %13, label %19, label %14
14: ; preds = %9, %11
%15 = phi i1 [ %10, %9 ], [ false, %11 ]
%16 = tail call i64 @strchr(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%17 = icmp ne i64 %16, 0
%18 = zext i1 %17 to i8
br label %19
19: ; preds = %14, %11
%20 = phi i1 [ true, %11 ], [ %15, %14 ]
%21 = phi i8 [ 0, %11 ], [ %18, %14 ]
%22 = tail call i32 @isalnum(i32 %5)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %19
%25 = tail call i64 @strchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %5)
%26 = icmp eq i64 %25, 0
%27 = or i8 %21, 2
%28 = select i1 %26, i8 %27, i8 %21
br label %29
29: ; preds = %24, %19
%30 = phi i8 [ %21, %19 ], [ %28, %24 ]
%31 = tail call i32 @isalnum(i32 %5)
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %29
%34 = tail call i64 @strchr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %5)
%35 = icmp eq i64 %34, 0
%36 = or i8 %30, 4
%37 = select i1 %35, i8 %36, i8 %30
br label %38
38: ; preds = %33, %29
%39 = phi i8 [ %30, %29 ], [ %37, %33 ]
%40 = tail call i32 @isalnum(i32 %5)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %38
%43 = tail call i64 @strchr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %5)
%44 = icmp eq i64 %43, 0
%45 = or i8 %39, 16
%46 = select i1 %44, i8 %45, i8 %39
br label %47
47: ; preds = %42, %38
%48 = phi i8 [ %39, %38 ], [ %46, %42 ]
br i1 %20, label %61, label %49
49: ; preds = %47
%50 = tail call i32 @isprint(i32 %5)
%51 = icmp eq i32 %50, 0
%52 = icmp eq i32 %5, 34
%53 = select i1 %51, i1 true, i1 %52
%54 = icmp eq i32 %5, 92
%55 = select i1 %53, i1 true, i1 %54
br i1 %55, label %59, label %56
56: ; preds = %49
%57 = tail call i64 @iscntrl(i32 %5)
%58 = icmp eq i64 %57, 0
br i1 %58, label %61, label %59
59: ; preds = %56, %49
%60 = or i8 %48, 8
br label %61
61: ; preds = %59, %56, %47
%62 = phi i8 [ %60, %59 ], [ %48, %56 ], [ %48, %47 ]
%63 = tail call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %5)
%64 = icmp eq i64 %63, 0
%65 = or i8 %62, 32
%66 = select i1 %64, i8 %62, i8 %65
%67 = zext i8 %66 to i32
%68 = icmp ult i32 %5, 255
%69 = select i1 %68, i32 44, i32 32
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %67, i32 %69)
%71 = add nuw nsw i32 %5, 1
%72 = icmp eq i32 %71, 256
br i1 %72, label %73, label %4
73: ; preds = %61
%74 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}