#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 */
void *octchar(unsigned char);
int cescape_char(char c, char *buf) {
  char *buf_old = buf;
  switch (c) {
  case '\a':
    *(buf++) = '\\';
    *(buf++) = 'a';
    break;
  case '\b':
    *(buf++) = '\\';
    *(buf++) = 'b';
    break;
  case '\f':
    *(buf++) = '\\';
    *(buf++) = 'f';
    break;
  case '\n':
    *(buf++) = '\\';
    *(buf++) = 'n';
    break;
  case '\r':
    *(buf++) = '\\';
    *(buf++) = 'r';
    break;
  case '\t':
    *(buf++) = '\\';
    *(buf++) = 't';
    break;
  case '\v':
    *(buf++) = '\\';
    *(buf++) = 'v';
    break;
  case '\\':
    *(buf++) = '\\';
    *(buf++) = '\\';
    break;
  case '"':
    *(buf++) = '\\';
    *(buf++) = '"';
    break;
  case '\'':
    *(buf++) = '\\';
    *(buf++) = '\'';
    break;
  default:
    if ((c < ' ') || (c >= 127)) {
      *(buf++) = '\\';
      *(buf++) = octchar((unsigned char)c >> 6);
      *(buf++) = octchar((unsigned char)c >> 3);
      *(buf++) = octchar((unsigned char)c);
    } else
      *(buf++) = c;
    break;
  }
  return buf - buf_old;
}


x86 assembly (clang, -O0):
<cescape_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xfffffff9,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x55,%eax
ja     12ee <cescape_char+0x1de>
mov    -0x20(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
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   $0x61,(%rax)
jmp    1398 <cescape_char+0x288>
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   $0x62,(%rax)
jmp    1398 <cescape_char+0x288>
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   $0x66,(%rax)
jmp    1398 <cescape_char+0x288>
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   $0x6e,(%rax)
jmp    1398 <cescape_char+0x288>
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   $0x72,(%rax)
jmp    1398 <cescape_char+0x288>
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)
jmp    1398 <cescape_char+0x288>
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   $0x76,(%rax)
jmp    1398 <cescape_char+0x288>
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   $0x5c,(%rax)
jmp    1398 <cescape_char+0x288>
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   $0x22,(%rax)
jmp    1398 <cescape_char+0x288>
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   $0x27,(%rax)
jmp    1398 <cescape_char+0x288>
movsbl -0x1(%rbp),%eax
cmp    $0x20,%eax
jl     1308 <cescape_char+0x1f8>
movsbl -0x1(%rbp),%eax
cmp    $0x7f,%eax
jl     137f <cescape_char+0x26f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x5c,(%rax)
movzbl -0x1(%rbp),%eax
sar    $0x6,%eax
movzbl %al,%edi
call   1030 <octchar@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
movzbl -0x1(%rbp),%eax
sar    $0x3,%eax
movzbl %al,%edi
call   1030 <octchar@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
movzbl -0x1(%rbp),%edi
call   1030 <octchar@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1393 <cescape_char+0x283>
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1398 <cescape_char+0x288>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cescape_char>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
lea    -0x7(%rbx),%eax
cmp    $0x55,%eax
ja     117c <cescape_char+0x6c>
lea    0xed8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movw   $0x615c,(%r14)
lea    0x2(%r14),%rax
jmp    1201 <cescape_char+0xf1>
movw   $0x625c,(%r14)
lea    0x2(%r14),%rax
jmp    1201 <cescape_char+0xf1>
movw   $0x745c,(%r14)
lea    0x2(%r14),%rax
jmp    1201 <cescape_char+0xf1>
movw   $0x665c,(%r14)
lea    0x2(%r14),%rax
jmp    1201 <cescape_char+0xf1>
movw   $0x725c,(%r14)
lea    0x2(%r14),%rax
jmp    1201 <cescape_char+0xf1>
lea    -0x7f(%rbx),%eax
cmp    $0xa0,%al
ja     11fa <cescape_char+0xea>
movb   $0x5c,(%r14)
mov    %ebx,%eax
shr    $0x6,%al
movzbl %al,%edi
call   1030 <octchar@plt>
mov    %al,0x1(%r14)
mov    %ebx,%eax
shr    $0x3,%al
movzbl %al,%edi
call   1030 <octchar@plt>
mov    %al,0x2(%r14)
movzbl %bl,%edi
call   1030 <octchar@plt>
mov    %rax,%rcx
lea    0x4(%r14),%rax
mov    %cl,0x3(%r14)
jmp    1201 <cescape_char+0xf1>
movw   $0x225c,(%r14)
lea    0x2(%r14),%rax
jmp    1201 <cescape_char+0xf1>
movw   $0x6e5c,(%r14)
lea    0x2(%r14),%rax
jmp    1201 <cescape_char+0xf1>
movw   $0x765c,(%r14)
lea    0x2(%r14),%rax
jmp    1201 <cescape_char+0xf1>
movw   $0x275c,(%r14)
lea    0x2(%r14),%rax
jmp    1201 <cescape_char+0xf1>
movw   $0x5c5c,(%r14)
lea    0x2(%r14),%rax
jmp    1201 <cescape_char+0xf1>
lea    0x1(%r14),%rax
mov    %bl,(%r14)
sub    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @cescape_char(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i8*
store i8 %0, i8* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
store i8* %6, i8** %5
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
switch i32 %8, label %59 [
i32 7, label %9
i32 8, label %14
i32 12, label %19
i32 10, label %24
i32 13, label %29
i32 9, label %34
i32 11, label %39
i32 92, label %44
i32 34, label %49
i32 39, label %54
]
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %4
store i8 92, i8* %10
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %4
store i8 97, i8* %12
br label %96
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %4
store i8 92, i8* %15
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %4
store i8 98, i8* %17
br label %96
19: ; preds = %2
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
store i8 92, i8* %20
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
store i8 102, i8* %22
br label %96
24: ; preds = %2
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %4
store i8 92, i8* %25
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %4
store i8 110, i8* %27
br label %96
29: ; preds = %2
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %4
store i8 92, i8* %30
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %4
store i8 114, i8* %32
br label %96
34: ; preds = %2
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %4
store i8 92, i8* %35
%37 = load i8*, i8** %4
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %4
store i8 116, i8* %37
br label %96
39: ; preds = %2
%40 = load i8*, i8** %4
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %4
store i8 92, i8* %40
%42 = load i8*, i8** %4
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %4
store i8 118, i8* %42
br label %96
44: ; preds = %2
%45 = load i8*, i8** %4
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %4
store i8 92, i8* %45
%47 = load i8*, i8** %4
%48 = getelementptr inbounds i8, i8* %47, i32 1
store i8* %48, i8** %4
store i8 92, i8* %47
br label %96
49: ; preds = %2
%50 = load i8*, i8** %4
%51 = getelementptr inbounds i8, i8* %50, i32 1
store i8* %51, i8** %4
store i8 92, i8* %50
%52 = load i8*, i8** %4
%53 = getelementptr inbounds i8, i8* %52, i32 1
store i8* %53, i8** %4
store i8 34, i8* %52
br label %96
54: ; preds = %2
%55 = load i8*, i8** %4
%56 = getelementptr inbounds i8, i8* %55, i32 1
store i8* %56, i8** %4
store i8 92, i8* %55
%57 = load i8*, i8** %4
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %4
store i8 39, i8* %57
br label %96
59: ; preds = %2
%60 = load i8, i8* %3
%61 = sext i8 %60 to i32
%62 = icmp slt i32 %61, 32
br i1 %62, label %67, label %63
63: ; preds = %59
%64 = load i8, i8* %3
%65 = sext i8 %64 to i32
%66 = icmp sge i32 %65, 127
br i1 %66, label %67, label %91
67: ; preds = %63, %59
%68 = load i8*, i8** %4
%69 = getelementptr inbounds i8, i8* %68, i32 1
store i8* %69, i8** %4
store i8 92, i8* %68
%70 = load i8, i8* %3
%71 = zext i8 %70 to i32
%72 = ashr i32 %71, 6
%73 = trunc i32 %72 to i8
%74 = call i8* @octchar(i8 zeroext %73)
%75 = ptrtoint i8* %74 to i8
%76 = load i8*, i8** %4
%77 = getelementptr inbounds i8, i8* %76, i32 1
store i8* %77, i8** %4
store i8 %75, i8* %76
%78 = load i8, i8* %3
%79 = zext i8 %78 to i32
%80 = ashr i32 %79, 3
%81 = trunc i32 %80 to i8
%82 = call i8* @octchar(i8 zeroext %81)
%83 = ptrtoint i8* %82 to i8
%84 = load i8*, i8** %4
%85 = getelementptr inbounds i8, i8* %84, i32 1
store i8* %85, i8** %4
store i8 %83, i8* %84
%86 = load i8, i8* %3
%87 = call i8* @octchar(i8 zeroext %86)
%88 = ptrtoint i8* %87 to i8
%89 = load i8*, i8** %4
%90 = getelementptr inbounds i8, i8* %89, i32 1
store i8* %90, i8** %4
store i8 %88, i8* %89
br label %95
91: ; preds = %63
%92 = load i8, i8* %3
%93 = load i8*, i8** %4
%94 = getelementptr inbounds i8, i8* %93, i32 1
store i8* %94, i8** %4
store i8 %92, i8* %93
br label %95
95: ; preds = %91, %67
br label %96
96: ; preds = %95, %54, %49, %44, %39, %34, %29, %24, %19, %14, %9
%97 = load i8*, i8** %4
%98 = load i8*, i8** %5
%99 = ptrtoint i8* %97 to i64
%100 = ptrtoint i8* %98 to i64
%101 = sub i64 %99, %100
%102 = trunc i64 %101 to i32
ret i32 %102
}

LLVM IR (-O2):
define i32 @cescape_char(i8 signext %0, i8* %1) {
%3 = sext i8 %0 to i32
switch i32 %3, label %34 [
i32 7, label %4
i32 8, label %7
i32 12, label %10
i32 10, label %13
i32 13, label %16
i32 9, label %19
i32 11, label %22
i32 92, label %25
i32 34, label %28
i32 39, label %31
]
4: ; preds = %2
%5 = getelementptr inbounds i8, i8* %1, i64 1
store i8 92, i8* %1
%6 = getelementptr inbounds i8, i8* %1, i64 2
store i8 97, i8* %5
br label %54
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %1, i64 1
store i8 92, i8* %1
%9 = getelementptr inbounds i8, i8* %1, i64 2
store i8 98, i8* %8
br label %54
10: ; preds = %2
%11 = getelementptr inbounds i8, i8* %1, i64 1
store i8 92, i8* %1
%12 = getelementptr inbounds i8, i8* %1, i64 2
store i8 102, i8* %11
br label %54
13: ; preds = %2
%14 = getelementptr inbounds i8, i8* %1, i64 1
store i8 92, i8* %1
%15 = getelementptr inbounds i8, i8* %1, i64 2
store i8 110, i8* %14
br label %54
16: ; preds = %2
%17 = getelementptr inbounds i8, i8* %1, i64 1
store i8 92, i8* %1
%18 = getelementptr inbounds i8, i8* %1, i64 2
store i8 114, i8* %17
br label %54
19: ; preds = %2
%20 = getelementptr inbounds i8, i8* %1, i64 1
store i8 92, i8* %1
%21 = getelementptr inbounds i8, i8* %1, i64 2
store i8 116, i8* %20
br label %54
22: ; preds = %2
%23 = getelementptr inbounds i8, i8* %1, i64 1
store i8 92, i8* %1
%24 = getelementptr inbounds i8, i8* %1, i64 2
store i8 118, i8* %23
br label %54
25: ; preds = %2
%26 = getelementptr inbounds i8, i8* %1, i64 1
store i8 92, i8* %1
%27 = getelementptr inbounds i8, i8* %1, i64 2
store i8 92, i8* %26
br label %54
28: ; preds = %2
%29 = getelementptr inbounds i8, i8* %1, i64 1
store i8 92, i8* %1
%30 = getelementptr inbounds i8, i8* %1, i64 2
store i8 34, i8* %29
br label %54
31: ; preds = %2
%32 = getelementptr inbounds i8, i8* %1, i64 1
store i8 92, i8* %1
%33 = getelementptr inbounds i8, i8* %1, i64 2
store i8 39, i8* %32
br label %54
34: ; preds = %2
%35 = add i8 %0, -127
%36 = icmp ult i8 %35, -95
%37 = getelementptr inbounds i8, i8* %1, i64 1
br i1 %36, label %38, label %53
38: ; preds = %34
store i8 92, i8* %1
%39 = lshr i8 %0, 6
%40 = tail call i8* @octchar(i8 zeroext %39)
%41 = ptrtoint i8* %40 to i64
%42 = trunc i64 %41 to i8
%43 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %42, i8* %37
%44 = lshr i8 %0, 3
%45 = tail call i8* @octchar(i8 zeroext %44)
%46 = ptrtoint i8* %45 to i64
%47 = trunc i64 %46 to i8
%48 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %47, i8* %43
%49 = tail call i8* @octchar(i8 zeroext %0)
%50 = ptrtoint i8* %49 to i64
%51 = trunc i64 %50 to i8
%52 = getelementptr inbounds i8, i8* %1, i64 4
store i8 %51, i8* %48
br label %54
53: ; preds = %34
store i8 %0, i8* %1
br label %54
54: ; preds = %38, %53, %31, %28, %25, %22, %19, %16, %13, %10, %7, %4
%55 = phi i8* [ %52, %38 ], [ %37, %53 ], [ %33, %31 ], [ %30, %28 ], [ %27, %25 ], [ %24, %22 ], [ %21, %19 ], [ %18, %16 ], [ %15, %13 ], [ %12, %10 ], [ %9, %7 ], [ %6, %4 ]
%56 = ptrtoint i8* %55 to i64
%57 = ptrtoint i8* %1 to i64
%58 = sub i64 %56, %57
%59 = trunc i64 %58 to i32
ret i32 %59
}