char *pS(char *s) {
  static char buff[1024];
  char *p = buff;
  while (*s != '\0') {
    if (*s == '$' || *s == '_' || *s == '#' || *s == '&' || *s == '%') {
      *p++ = '\\';
      *p++ = *s++;
    } else if (*s == ' ' || *s == '^' || *s == '&') {
      *p++ = '\\';
      *p++ = 'c';
      *p++ = 'h';
      *p++ = 'a';
      *p++ = 'r';
      *p++ = '`';
      *p++ = '\\';
      *p++ = *s++;
    } else if (*s == '~') {
      *p++ = '\\';
      *p++ = 't';
      *p++ = 'i';
      *p++ = 'l';
      *p++ = 'd';
      *p++ = 'a';
      *p++ = '{';
      *p++ = '}';
      s++;
    } else if (*s == '\\') {
      *p++ = '\\';
      *p++ = 'c';
      *p++ = 'h';
      *p++ = 'a';
      *p++ = 'r';
      *p++ = '\'';
      *p++ = '1';
      *p++ = '3';
      *p++ = '4';
      s++;
    } else
      *p++ = *s++;
  }
  *p++ = '\0';
  return buff;
}


x86 assembly (clang, -O0):
<pS>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0x2f21(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     142b <pS+0x32b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x24,%eax
je     1173 <pS+0x73>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     1173 <pS+0x73>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
je     1173 <pS+0x73>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x26,%eax
je     1173 <pS+0x73>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    11ac <pS+0xac>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x5c,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1426 <pS+0x326>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     11dc <pS+0xdc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5e,%eax
je     11dc <pS+0xdc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x26,%eax
jne    1281 <pS+0x181>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x5c,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x63,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x68,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x61,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x72,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x60,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x5c,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1421 <pS+0x321>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7e,%eax
jne    1332 <pS+0x232>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x5c,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x74,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x69,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x6c,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x64,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x61,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x7b,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x7d,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    141c <pS+0x31c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    13f5 <pS+0x2f5>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x5c,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x63,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x68,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x61,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x72,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x27,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x31,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x33,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x34,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1417 <pS+0x317>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    141c <pS+0x31c>
jmp    1421 <pS+0x321>
jmp    1426 <pS+0x326>
jmp    1113 <pS+0x13>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
lea    0x2bec(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pS>:
lea    0x2f29(%rip),%rax
lea    0xef2(%rip),%rcx
movabs $0x333127726168635c,%r8
27 31 33
movabs $0x7d7b61646c69745c,%r9
61 7b 7d
jmp    114a <pS+0x4a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x23(%rdx),%esi
cmp    $0x4,%sil
jae    1179 <pS+0x79>
movb   $0x5c,(%rax)
movzbl (%rdi),%edx
mov    %dl,0x1(%rax)
add    $0x2,%rax
add    $0x1,%rdi
movzbl (%rdi),%edx
cmp    $0x5b,%dl
jle    1130 <pS+0x30>
lea    -0x5c(%rdx),%esi
cmp    $0x22,%sil
ja     11a7 <pS+0xa7>
movzbl %sil,%esi
movslq (%rcx,%rsi,4),%rsi
add    %rcx,%rsi
jmp    *%rsi
mov    %r8,(%rax)
movb   $0x34,0x8(%rax)
add    $0x9,%rax
add    $0x1,%rdi
jmp    114a <pS+0x4a>
cmp    $0x20,%dl
jne    11a3 <pS+0xa3>
movl   $0x6168635c,(%rax)
movw   $0x6072,0x4(%rax)
movb   $0x5c,0x6(%rax)
movzbl (%rdi),%edx
mov    %dl,0x7(%rax)
jmp    1199 <pS+0x99>
mov    %r9,(%rax)
add    $0x8,%rax
add    $0x1,%rdi
jmp    114a <pS+0x4a>
test   %dl,%dl
je     11b3 <pS+0xb3>
mov    %dl,(%rax)
add    $0x1,%rax
add    $0x1,%rdi
jmp    114a <pS+0x4a>
movb   $0x0,(%rax)
lea    0x2e73(%rip),%rax
ret

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

LLVM IR (-O2):
@pS.buff = internal global [1024 x i8] zeroinitializer
define i8* @pS(i8* nocapture %0) {
br label %2
2: ; preds = %41, %1
%3 = phi i8* [ %0, %1 ], [ %43, %41 ]
%4 = phi i8* [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @pS.buff, i64 0, i64 0), %1 ], [ %42, %41 ]
%5 = load i8, i8* %3
switch i8 %5, label %39 [
i8 0, label %44
i8 36, label %6
i8 95, label %6
i8 35, label %6
i8 38, label %6
i8 37, label %6
i8 32, label %10
i8 94, label %10
i8 126, label %20
i8 92, label %29
]
6: ; preds = %2, %2, %2, %2, %2
%7 = getelementptr inbounds i8, i8* %4, i64 1
store i8 92, i8* %4
%8 = load i8, i8* %3
%9 = getelementptr inbounds i8, i8* %4, i64 2
store i8 %8, i8* %7
br label %41
10: ; preds = %2, %2
%11 = getelementptr inbounds i8, i8* %4, i64 1
store i8 92, i8* %4
%12 = getelementptr inbounds i8, i8* %4, i64 2
store i8 99, i8* %11
%13 = getelementptr inbounds i8, i8* %4, i64 3
store i8 104, i8* %12
%14 = getelementptr inbounds i8, i8* %4, i64 4
store i8 97, i8* %13
%15 = getelementptr inbounds i8, i8* %4, i64 5
store i8 114, i8* %14
%16 = getelementptr inbounds i8, i8* %4, i64 6
store i8 96, i8* %15
%17 = getelementptr inbounds i8, i8* %4, i64 7
store i8 92, i8* %16
%18 = load i8, i8* %3
%19 = getelementptr inbounds i8, i8* %4, i64 8
store i8 %18, i8* %17
br label %41
20: ; preds = %2
%21 = getelementptr inbounds i8, i8* %4, i64 1
store i8 92, i8* %4
%22 = getelementptr inbounds i8, i8* %4, i64 2
store i8 116, i8* %21
%23 = getelementptr inbounds i8, i8* %4, i64 3
store i8 105, i8* %22
%24 = getelementptr inbounds i8, i8* %4, i64 4
store i8 108, i8* %23
%25 = getelementptr inbounds i8, i8* %4, i64 5
store i8 100, i8* %24
%26 = getelementptr inbounds i8, i8* %4, i64 6
store i8 97, i8* %25
%27 = getelementptr inbounds i8, i8* %4, i64 7
store i8 123, i8* %26
%28 = getelementptr inbounds i8, i8* %4, i64 8
store i8 125, i8* %27
br label %41
29: ; preds = %2
%30 = getelementptr inbounds i8, i8* %4, i64 1
store i8 92, i8* %4
%31 = getelementptr inbounds i8, i8* %4, i64 2
store i8 99, i8* %30
%32 = getelementptr inbounds i8, i8* %4, i64 3
store i8 104, i8* %31
%33 = getelementptr inbounds i8, i8* %4, i64 4
store i8 97, i8* %32
%34 = getelementptr inbounds i8, i8* %4, i64 5
store i8 114, i8* %33
%35 = getelementptr inbounds i8, i8* %4, i64 6
store i8 39, i8* %34
%36 = getelementptr inbounds i8, i8* %4, i64 7
store i8 49, i8* %35
%37 = getelementptr inbounds i8, i8* %4, i64 8
store i8 51, i8* %36
%38 = getelementptr inbounds i8, i8* %4, i64 9
store i8 52, i8* %37
br label %41
39: ; preds = %2
%40 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %5, i8* %4
br label %41
41: ; preds = %10, %29, %39, %20, %6
%42 = phi i8* [ %9, %6 ], [ %19, %10 ], [ %28, %20 ], [ %38, %29 ], [ %40, %39 ]
%43 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
44: ; preds = %2
store i8 0, i8* %4
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @pS.buff, i64 0, i64 0)
}