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

/* Variables and functions */
int /*<<< orphan*/ escape(char **);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char *argv[]) {
  char *buffer = "\\b\\f\\n\\r\\s\\t\\e\\007\\x64\\^M";
  char *input = buffer;
  int expected[] = {'\b', '\f',   '\n',   '\r',   ' ',
                    '\t', '\033', '\007', '\x64', '\x0d'};
  int len = sizeof(expected) / sizeof(expected[0]);
  int result[200];
  int *p = result;
  while (*input) {
    *p++ = escape(&input);
  }
  int i;
  for (i = 0; i < len; ++i) {
    if (result[i] != expected[i]) {
      printf("Case %d: Expected '%c', got '%c'\n", i, expected[i], result[i]);
    } else {
      printf("Case %d: OK\n", i);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x390,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb0(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xee9(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0xa,-0x54(%rbp)
lea    -0x380(%rbp),%rax
mov    %rax,-0x388(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     11ba <main+0x8a>
lea    -0x20(%rbp),%rdi
call   1050 <escape@plt>
mov    %eax,%ecx
mov    -0x388(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x388(%rbp)
mov    %ecx,(%rax)
jmp    1186 <main+0x56>
movl   $0x0,-0x38c(%rbp)
mov    -0x38c(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    1251 <main+0x121>
movslq -0x38c(%rbp),%rax
mov    -0x380(%rbp,%rax,4),%eax
movslq -0x38c(%rbp),%rcx
cmp    -0x50(%rbp,%rcx,4),%eax
je     1224 <main+0xf4>
mov    -0x38c(%rbp),%esi
movslq -0x38c(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
movslq -0x38c(%rbp),%rax
mov    -0x380(%rbp,%rax,4),%ecx
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1238 <main+0x108>
mov    -0x38c(%rbp),%esi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123d <main+0x10d>
mov    -0x38c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38c(%rbp)
jmp    11c4 <main+0x94>
xor    %eax,%eax
add    $0x390,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x338,%rsp
lea    0xecf(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r14
mov    %r14,%rdi
call   1040 <escape@plt>
mov    %eax,(%rbx)
add    $0x4,%rbx
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
jne    1140 <main+0x20>
mov    0x10(%rsp),%ecx
cmp    $0x8,%ecx
jne    1173 <main+0x53>
lea    0xed4(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1188 <main+0x68>
lea    0xea0(%rip),%rdi
xor    %esi,%esi
mov    $0x8,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x14(%rsp),%ecx
cmp    $0xc,%ecx
jne    11a6 <main+0x86>
lea    0xea4(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11be <main+0x9e>
lea    0xe6d(%rip),%rdi
mov    $0x1,%esi
mov    $0xc,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%ecx
cmp    $0xa,%ecx
jne    11dc <main+0xbc>
lea    0xe6e(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11f4 <main+0xd4>
lea    0xe37(%rip),%rdi
mov    $0x2,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x1c(%rsp),%ecx
cmp    $0xd,%ecx
jne    1212 <main+0xf2>
lea    0xe38(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    122a <main+0x10a>
lea    0xe01(%rip),%rdi
mov    $0x3,%esi
mov    $0xd,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x20(%rsp),%ecx
cmp    $0x20,%ecx
jne    1248 <main+0x128>
lea    0xe02(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1260 <main+0x140>
lea    0xdcb(%rip),%rdi
mov    $0x4,%esi
mov    $0x20,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x24(%rsp),%ecx
cmp    $0x9,%ecx
jne    127e <main+0x15e>
lea    0xdcc(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1296 <main+0x176>
lea    0xd95(%rip),%rdi
mov    $0x5,%esi
mov    $0x9,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x28(%rsp),%ecx
cmp    $0x1b,%ecx
jne    12b4 <main+0x194>
lea    0xd96(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    12cc <main+0x1ac>
lea    0xd5f(%rip),%rdi
mov    $0x6,%esi
mov    $0x1b,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2c(%rsp),%ecx
cmp    $0x7,%ecx
jne    12ea <main+0x1ca>
lea    0xd60(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1302 <main+0x1e2>
lea    0xd29(%rip),%rdi
mov    $0x7,%esi
mov    $0x7,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x30(%rsp),%ecx
cmp    $0x64,%ecx
jne    1320 <main+0x200>
lea    0xd2a(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1338 <main+0x218>
lea    0xcf3(%rip),%rdi
mov    $0x8,%esi
mov    $0x64,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x34(%rsp),%ecx
cmp    $0xd,%ecx
jne    1356 <main+0x236>
lea    0xcf4(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    136e <main+0x24e>
lea    0xcbd(%rip),%rdi
mov    $0x9,%esi
mov    $0xd,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x338,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\\b\\f\\n\\r\\s\\t\\e\\007\\x64\\^M\00"
@__const.main.expected = [10 x i32] [i32 8, i32 12, i32 10, i32 13, i32 32, i32 9, i32 27, i32 7, i32 100, i32 13]
@.str.1 = [34 x i8] c"Case %d: Expected '%c', got '%c'\0A\00"
@.str.2 = [13 x i8] c"Case %d: OK\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca [10 x i32]
%9 = alloca i32
%10 = alloca [200 x i32]
%11 = alloca i32*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8** %6
%13 = load i8*, i8** %6
store i8* %13, i8** %7
%14 = bitcast [10 x i32]* %8 to i8*
store i32 10, i32* %9
%15 = getelementptr inbounds [200 x i32], [200 x i32]* %10, i64 0, i64 0
store i32* %15, i32** %11
br label %16
16: ; preds = %20, %2
%17 = load i8*, i8** %7
%18 = load i8, i8* %17
%19 = icmp ne i8 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = call i32 @escape(i8** %7)
%22 = load i32*, i32** %11
%23 = getelementptr inbounds i32, i32* %22, i32 1
store i32* %23, i32** %11
store i32 %21, i32* %22
br label %16
24: ; preds = %16
store i32 0, i32* %12
br label %25
25: ; preds = %54, %24
%26 = load i32, i32* %12
%27 = load i32, i32* %9
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %57
29: ; preds = %25
%30 = load i32, i32* %12
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [200 x i32], [200 x i32]* %10, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = load i32, i32* %12
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = icmp ne i32 %33, %37
br i1 %38, label %39, label %50
39: ; preds = %29
%40 = load i32, i32* %12
%41 = load i32, i32* %12
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = load i32, i32* %12
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [200 x i32], [200 x i32]* %10, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %40, i32 %44, i32 %48)
br label %53
50: ; preds = %29
%51 = load i32, i32* %12
%52 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %50, %39
br label %54
54: ; preds = %53
%55 = load i32, i32* %12
%56 = add nsw i32 %55, 1
store i32 %56, i32* %12
br label %25
57: ; preds = %25
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"\\b\\f\\n\\r\\s\\t\\e\\007\\x64\\^M\00"
@.str.1 = [34 x i8] c"Case %d: Expected '%c', got '%c'\0A\00"
@.str.2 = [13 x i8] c"Case %d: OK\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = alloca [200 x i32]
%5 = bitcast i8** %3 to i8*
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8** %3
%6 = bitcast [200 x i32]* %4 to i8*
%7 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 0
br label %11
8: ; preds = %11
%9 = load i32, i32* %7
%10 = icmp eq i32 %9, 8
br i1 %10, label %20, label %18
11: ; preds = %2, %11
%12 = phi i32* [ %14, %11 ], [ %7, %2 ]
%13 = call i32 @escape(i8** %3)
%14 = getelementptr inbounds i32, i32* %12, i64 1
store i32 %13, i32* %12
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %8, label %11
18: ; preds = %8
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 8, i32 %9)
br label %22
20: ; preds = %8
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 0)
br label %22
22: ; preds = %18, %20
%23 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 1
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 12
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 12, i32 %24)
br label %30
28: ; preds = %22
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %30
30: ; preds = %28, %26
%31 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 2
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 10
br i1 %33, label %36, label %34
34: ; preds = %30
%35 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 10, i32 %32)
br label %38
36: ; preds = %30
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 2)
br label %38
38: ; preds = %36, %34
%39 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 3
%40 = load i32, i32* %39
%41 = icmp eq i32 %40, 13
br i1 %41, label %44, label %42
42: ; preds = %38
%43 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 13, i32 %40)
br label %46
44: ; preds = %38
%45 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 3)
br label %46
46: ; preds = %44, %42
%47 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 4
%48 = load i32, i32* %47
%49 = icmp eq i32 %48, 32
br i1 %49, label %52, label %50
50: ; preds = %46
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 32, i32 %48)
br label %54
52: ; preds = %46
%53 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 4)
br label %54
54: ; preds = %52, %50
%55 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 5
%56 = load i32, i32* %55
%57 = icmp eq i32 %56, 9
br i1 %57, label %60, label %58
58: ; preds = %54
%59 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 9, i32 %56)
br label %62
60: ; preds = %54
%61 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 5)
br label %62
62: ; preds = %60, %58
%63 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 6
%64 = load i32, i32* %63
%65 = icmp eq i32 %64, 27
br i1 %65, label %68, label %66
66: ; preds = %62
%67 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 27, i32 %64)
br label %70
68: ; preds = %62
%69 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 6)
br label %70
70: ; preds = %68, %66
%71 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 7
%72 = load i32, i32* %71
%73 = icmp eq i32 %72, 7
br i1 %73, label %76, label %74
74: ; preds = %70
%75 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 7, i32 %72)
br label %78
76: ; preds = %70
%77 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 7)
br label %78
78: ; preds = %76, %74
%79 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 8
%80 = load i32, i32* %79
%81 = icmp eq i32 %80, 100
br i1 %81, label %84, label %82
82: ; preds = %78
%83 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 100, i32 %80)
br label %86
84: ; preds = %78
%85 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 8)
br label %86
86: ; preds = %84, %82
%87 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 9
%88 = load i32, i32* %87
%89 = icmp eq i32 %88, 13
br i1 %89, label %92, label %90
90: ; preds = %86
%91 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 9, i32 13, i32 %88)
br label %94
92: ; preds = %86
%93 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 9)
br label %94
94: ; preds = %92, %90
ret i32 0
}