#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void print_clean_quote(FILE *out, char *s) {
  static int in_quotes = 0;
  for (; s && *s; ++s) {
    if (s[0] == '[' && s[1] == '[') {
      in_quotes = 1;
      fprintf(out, "{\\tt ");
      for (++s; s[1] == '['; ++s)
        fputc('[', out);
    } else if (s[0] == ']' && s[1] == ']') {
      in_quotes = 0;
      for (++s; s[1] == ']'; ++s)
        fputc(']', out);
      fprintf(out, "}");
    } else if (*s == '\t') {
      fprintf(out, "        ");
    } else if (in_quotes && (*s == '#' || *s == '$' || *s == '%' || *s == '&' ||
                             *s == '_' || *s == '{' || *s == '}')) {
      fputc('\\', out);
      fputc(*s, out);
    } else if (in_quotes && *s == '~') {
      fprintf(out, "\\~{}");
    } else
      fputc(*s, out);
  }
}


x86 assembly (clang, -O0):
<print_clean_quote>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1150 <print_clean_quote+0x30>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1160 <print_clean_quote+0x40>
jmp    138d <print_clean_quote+0x26d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5b,%eax
jne    11dc <print_clean_quote+0xbc>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x5b,%eax
jne    11dc <print_clean_quote+0xbc>
movl   $0x1,0x2ea9(%rip)
mov    -0x8(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x5b,%eax
jne    11d7 <print_clean_quote+0xb7>
mov    -0x8(%rbp),%rsi
mov    $0x5b,%edi
call   1030 <fputc@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11a7 <print_clean_quote+0x87>
jmp    1377 <print_clean_quote+0x257>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5d,%eax
jne    1258 <print_clean_quote+0x138>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x5d,%eax
jne    1258 <print_clean_quote+0x138>
movl   $0x0,0x2e2d(%rip)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x5d,%eax
jne    1243 <print_clean_quote+0x123>
mov    -0x8(%rbp),%rsi
mov    $0x5d,%edi
call   1030 <fputc@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1213 <print_clean_quote+0xf3>
mov    -0x8(%rbp),%rdi
lea    0xdc4(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1372 <print_clean_quote+0x252>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
jne    127d <print_clean_quote+0x15d>
mov    -0x8(%rbp),%rdi
lea    0xd93(%rip),%rsi
call   1040 <fprintf@plt>
jmp    136d <print_clean_quote+0x24d>
cmpl   $0x0,0x2db0(%rip)
je     131f <print_clean_quote+0x1ff>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
je     12fa <print_clean_quote+0x1da>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x24,%eax
je     12fa <print_clean_quote+0x1da>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
je     12fa <print_clean_quote+0x1da>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x26,%eax
je     12fa <print_clean_quote+0x1da>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     12fa <print_clean_quote+0x1da>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7b,%eax
je     12fa <print_clean_quote+0x1da>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7d,%eax
jne    131f <print_clean_quote+0x1ff>
mov    -0x8(%rbp),%rsi
mov    $0x5c,%edi
call   1030 <fputc@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
jmp    1368 <print_clean_quote+0x248>
cmpl   $0x0,0x2d0e(%rip)
je     1351 <print_clean_quote+0x231>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7e,%eax
jne    1351 <print_clean_quote+0x231>
mov    -0x8(%rbp),%rdi
lea    0xcc8(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1363 <print_clean_quote+0x243>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
jmp    1368 <print_clean_quote+0x248>
jmp    136d <print_clean_quote+0x24d>
jmp    1372 <print_clean_quote+0x252>
jmp    1377 <print_clean_quote+0x257>
jmp    137c <print_clean_quote+0x25c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1130 <print_clean_quote+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_clean_quote>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     12cc <print_clean_quote+0x1ac>
mov    %rsi,%r15
mov    %rdi,%r13
lea    0xf45(%rip),%r14
lea    0xeb8(%rip),%rbp
lea    0xf31(%rip),%r12
jmp    116f <print_clean_quote+0x4f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
mov    %r13,%rsi
call   1030 <fputc@plt>
add    $0x1,%r15
mov    (%r15),%al
cmp    $0x5a,%al
jle    11e0 <print_clean_quote+0xc0>
cmp    $0x5d,%al
je     1210 <print_clean_quote+0xf0>
cmp    $0x5b,%al
jne    1258 <print_clean_quote+0x138>
cmpb   $0x5b,0x1(%r15)
jne    1258 <print_clean_quote+0x138>
lea    0x1(%r15),%rbx
movb   $0x1,0x2e98(%rip)
mov    $0x5,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %r13,%rcx
call   1040 <fwrite@plt>
cmpb   $0x5b,0x2(%r15)
jne    129d <print_clean_quote+0x17d>
nopl   0x0(%rax)
mov    $0x5b,%edi
mov    %r13,%rsi
call   1030 <fputc@plt>
lea    0x1(%rbx),%r15
cmpb   $0x5b,0x2(%rbx)
mov    %r15,%rbx
je     11c0 <print_clean_quote+0xa0>
jmp    116b <print_clean_quote+0x4b>
nopl   0x0(%rax)
cmp    $0x9,%al
jne    1254 <print_clean_quote+0x134>
mov    $0x8,%esi
mov    $0x1,%edx
mov    %r14,%rdi
mov    %r13,%rcx
call   1040 <fwrite@plt>
add    $0x1,%r15
jmp    116f <print_clean_quote+0x4f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x5d,0x1(%r15)
jne    1258 <print_clean_quote+0x138>
lea    0x1(%r15),%rbx
movb   $0x0,0x2e12(%rip)
cmpb   $0x5d,0x2(%r15)
jne    12a9 <print_clean_quote+0x189>
nopl   (%rax)
mov    $0x5d,%edi
mov    %r13,%rsi
call   1030 <fputc@plt>
lea    0x1(%rbx),%r15
cmpb   $0x5d,0x2(%rbx)
mov    %r15,%rbx
je     1230 <print_clean_quote+0x110>
mov    $0x7d,%edi
jmp    1163 <print_clean_quote+0x43>
test   %al,%al
je     12cc <print_clean_quote+0x1ac>
cmpb   $0x1,0x2dd5(%rip)
jne    1160 <print_clean_quote+0x40>
lea    -0x5f(%rax),%ecx
cmp    $0x1f,%cl
jbe    127a <print_clean_quote+0x15a>
lea    -0x23(%rax),%ecx
cmp    $0x4,%cl
jb     1287 <print_clean_quote+0x167>
jmp    1160 <print_clean_quote+0x40>
movzbl %cl,%ecx
movslq 0x0(%rbp,%rcx,4),%rcx
add    %rbp,%rcx
jmp    *%rcx
mov    $0x5c,%edi
mov    %r13,%rsi
call   1030 <fputc@plt>
movsbl (%r15),%edi
jmp    1163 <print_clean_quote+0x43>
mov    %rbx,%r15
add    $0x1,%r15
jmp    116f <print_clean_quote+0x4f>
mov    %rbx,%r15
mov    $0x7d,%edi
jmp    1163 <print_clean_quote+0x43>
mov    $0x4,%esi
mov    $0x1,%edx
lea    0xdc8(%rip),%rdi
jmp    11f1 <print_clean_quote+0xd1>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@print_clean_quote.in_quotes = internal global i32 0
@.str = [6 x i8] c"{\\tt \00"
@.str.1 = [2 x i8] c"}\00"
@.str.2 = [9 x i8] c" \00"
@.str.3 = [5 x i8] c"\\~{}\00"
define void @print_clean_quote(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %149, %2
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br label %13
13: ; preds = %8, %5
%14 = phi i1 [ false, %5 ], [ %12, %8 ]
br i1 %14, label %15, label %152
15: ; preds = %13
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 91
br i1 %20, label %21, label %45
21: ; preds = %15
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 91
br i1 %26, label %27, label %45
27: ; preds = %21
store i32 1, i32* @print_clean_quote.in_quotes
%28 = load i32*, i32** %3
%29 = call i32 @fprintf(i32* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %4
br label %32
32: ; preds = %41, %27
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 91
br i1 %37, label %38, label %44
38: ; preds = %32
%39 = load i32*, i32** %3
%40 = call i32 @fputc(i8 signext 91, i32* %39)
br label %41
41: ; preds = %38
%42 = load i8*, i8** %4
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %4
br label %32
44: ; preds = %32
br label %148
45: ; preds = %21, %15
%46 = load i8*, i8** %4
%47 = getelementptr inbounds i8, i8* %46, i64 0
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 93
br i1 %50, label %51, label %75
51: ; preds = %45
%52 = load i8*, i8** %4
%53 = getelementptr inbounds i8, i8* %52, i64 1
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 93
br i1 %56, label %57, label %75
57: ; preds = %51
store i32 0, i32* @print_clean_quote.in_quotes
%58 = load i8*, i8** %4
%59 = getelementptr inbounds i8, i8* %58, i32 1
store i8* %59, i8** %4
br label %60
60: ; preds = %69, %57
%61 = load i8*, i8** %4
%62 = getelementptr inbounds i8, i8* %61, i64 1
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 93
br i1 %65, label %66, label %72
66: ; preds = %60
%67 = load i32*, i32** %3
%68 = call i32 @fputc(i8 signext 93, i32* %67)
br label %69
69: ; preds = %66
%70 = load i8*, i8** %4
%71 = getelementptr inbounds i8, i8* %70, i32 1
store i8* %71, i8** %4
br label %60
72: ; preds = %60
%73 = load i32*, i32** %3
%74 = call i32 @fprintf(i32* %73, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %147
75: ; preds = %51, %45
%76 = load i8*, i8** %4
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 9
br i1 %79, label %80, label %83
80: ; preds = %75
%81 = load i32*, i32** %3
%82 = call i32 @fprintf(i32* %81, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %146
83: ; preds = %75
%84 = load i32, i32* @print_clean_quote.in_quotes
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %128
86: ; preds = %83
%87 = load i8*, i8** %4
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = icmp eq i32 %89, 35
br i1 %90, label %121, label %91
91: ; preds = %86
%92 = load i8*, i8** %4
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
%95 = icmp eq i32 %94, 36
br i1 %95, label %121, label %96
96: ; preds = %91
%97 = load i8*, i8** %4
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = icmp eq i32 %99, 37
br i1 %100, label %121, label %101
101: ; preds = %96
%102 = load i8*, i8** %4
%103 = load i8, i8* %102
%104 = sext i8 %103 to i32
%105 = icmp eq i32 %104, 38
br i1 %105, label %121, label %106
106: ; preds = %101
%107 = load i8*, i8** %4
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = icmp eq i32 %109, 95
br i1 %110, label %121, label %111
111: ; preds = %106
%112 = load i8*, i8** %4
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = icmp eq i32 %114, 123
br i1 %115, label %121, label %116
116: ; preds = %111
%117 = load i8*, i8** %4
%118 = load i8, i8* %117
%119 = sext i8 %118 to i32
%120 = icmp eq i32 %119, 125
br i1 %120, label %121, label %128
121: ; preds = %116, %111, %106, %101, %96, %91, %86
%122 = load i32*, i32** %3
%123 = call i32 @fputc(i8 signext 92, i32* %122)
%124 = load i8*, i8** %4
%125 = load i8, i8* %124
%126 = load i32*, i32** %3
%127 = call i32 @fputc(i8 signext %125, i32* %126)
br label %145
128: ; preds = %116, %83
%129 = load i32, i32* @print_clean_quote.in_quotes
%130 = icmp ne i32 %129, 0
br i1 %130, label %131, label %139
131: ; preds = %128
%132 = load i8*, i8** %4
%133 = load i8, i8* %132
%134 = sext i8 %133 to i32
%135 = icmp eq i32 %134, 126
br i1 %135, label %136, label %139
136: ; preds = %131
%137 = load i32*, i32** %3
%138 = call i32 @fprintf(i32* %137, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %144
139: ; preds = %131, %128
%140 = load i8*, i8** %4
%141 = load i8, i8* %140
%142 = load i32*, i32** %3
%143 = call i32 @fputc(i8 signext %141, i32* %142)
br label %144
144: ; preds = %139, %136
br label %145
145: ; preds = %144, %121
br label %146
146: ; preds = %145, %80
br label %147
147: ; preds = %146, %72
br label %148
148: ; preds = %147, %44
br label %149
149: ; preds = %148
%150 = load i8*, i8** %4
%151 = getelementptr inbounds i8, i8* %150, i32 1
store i8* %151, i8** %4
br label %5
152: ; preds = %13
ret void
}

LLVM IR (-O2):
@print_clean_quote.in_quotes = internal unnamed_addr global i1 false
@.str = [6 x i8] c"{\\tt \00"
@.str.2 = [9 x i8] c" \00"
@.str.3 = [5 x i8] c"\\~{}\00"
define void @print_clean_quote(i32* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %57, label %4
4: ; preds = %2, %54
%5 = phi i8* [ %56, %54 ], [ %1, %2 ]
%6 = load i8, i8* %5
switch i8 %6, label %43 [
i8 0, label %57
i8 91, label %7
i8 93, label %23
i8 9, label %41
]
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 91
br i1 %10, label %11, label %43
11: ; preds = %7
store i1 true, i1* @print_clean_quote.in_quotes
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 5, i64 1, i32* %0)
%13 = getelementptr inbounds i8, i8* %5, i64 2
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 91
br i1 %15, label %16, label %54
16: ; preds = %11, %16
%17 = phi i8* [ %19, %16 ], [ %8, %11 ]
%18 = tail call i32 @fputc(i8 signext 91, i32* %0)
%19 = getelementptr inbounds i8, i8* %17, i64 1
%20 = getelementptr inbounds i8, i8* %17, i64 2
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 91
br i1 %22, label %16, label %54
23: ; preds = %4
%24 = getelementptr inbounds i8, i8* %5, i64 1
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 93
br i1 %26, label %27, label %43
27: ; preds = %23
store i1 false, i1* @print_clean_quote.in_quotes
%28 = getelementptr inbounds i8, i8* %5, i64 2
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 93
br i1 %30, label %31, label %38
31: ; preds = %27, %31
%32 = phi i8* [ %34, %31 ], [ %24, %27 ]
%33 = tail call i32 @fputc(i8 signext 93, i32* %0)
%34 = getelementptr inbounds i8, i8* %32, i64 1
%35 = getelementptr inbounds i8, i8* %32, i64 2
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 93
br i1 %37, label %31, label %38
38: ; preds = %31, %27
%39 = phi i8* [ %24, %27 ], [ %34, %31 ]
%40 = tail call i32 bitcast (i32 (i8, i32*)* @fputc to i32 (i32, i32*)*)(i32 125, i32* %0)
br label %54
41: ; preds = %4
%42 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 8, i64 1, i32* %0)
br label %54
43: ; preds = %4, %7, %23
%44 = load i1, i1* @print_clean_quote.in_quotes
br i1 %44, label %45, label %52
45: ; preds = %43
switch i8 %6, label %52 [
i8 35, label %46
i8 36, label %46
i8 37, label %46
i8 38, label %46
i8 95, label %46
i8 123, label %46
i8 125, label %46
i8 126, label %50
]
46: ; preds = %45, %45, %45, %45, %45, %45, %45
%47 = tail call i32 @fputc(i8 signext 92, i32* %0)
%48 = load i8, i8* %5
%49 = tail call i32 @fputc(i8 signext %48, i32* %0)
br label %54
50: ; preds = %45
%51 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 4, i64 1, i32* %0)
br label %54
52: ; preds = %45, %43
%53 = tail call i32 @fputc(i8 signext %6, i32* %0)
br label %54
54: ; preds = %16, %11, %41, %50, %52, %46, %38
%55 = phi i8* [ %39, %38 ], [ %5, %41 ], [ %5, %46 ], [ %5, %50 ], [ %5, %52 ], [ %8, %11 ], [ %19, %16 ]
%56 = getelementptr inbounds i8, i8* %55, i64 1
br label %4
57: ; preds = %4, %2
ret void
}