#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ file_print(char *, int /*<<< orphan*/);
int hexify(char, int);
int /*<<< orphan*/ stderr;
int escape_lookup(char *c) {
  if ('\\' != c[0])
    return c[0];
  if (c[1] == 'x') {
    int t1 = hexify(c[2], 1);
    int t2 = hexify(c[3], 0);
    return t1 + t2;
  } else if (c[1] == 't')
    return 9;
  else if (c[1] == 'n')
    return 10;
  else if (c[1] == 'v')
    return 11;
  else if (c[1] == 'f')
    return 12;
  else if (c[1] == 'r')
    return 13;
  else if (c[1] == 'e')
    return 27;
  else if (c[1] == '"')
    return 34;
  else if (c[1] == '\'')
    return 39;
  else if (c[1] == '\\')
    return 92;
  file_print("Unknown escape received: ", stderr);
  file_print(c, stderr);
  file_print(" Unable to process\n", stderr);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<escape_lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x5c,%eax
cmp    %ecx,%eax
je     115f <escape_lookup+0x2f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1321 <escape_lookup+0x1f1>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
jne    11a5 <escape_lookup+0x75>
mov    -0x10(%rbp),%rax
mov    $0x1,%esi
movsbl 0x2(%rax),%edi
call   1030 <hexify@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
xor    %esi,%esi
movsbl 0x3(%rax),%edi
call   1030 <hexify@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1321 <escape_lookup+0x1f1>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x74,%eax
jne    11c2 <escape_lookup+0x92>
movl   $0x9,-0x4(%rbp)
jmp    1321 <escape_lookup+0x1f1>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x6e,%eax
jne    11df <escape_lookup+0xaf>
movl   $0xa,-0x4(%rbp)
jmp    1321 <escape_lookup+0x1f1>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x76,%eax
jne    11fc <escape_lookup+0xcc>
movl   $0xb,-0x4(%rbp)
jmp    1321 <escape_lookup+0x1f1>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x66,%eax
jne    1219 <escape_lookup+0xe9>
movl   $0xc,-0x4(%rbp)
jmp    1321 <escape_lookup+0x1f1>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x72,%eax
jne    1236 <escape_lookup+0x106>
movl   $0xd,-0x4(%rbp)
jmp    1321 <escape_lookup+0x1f1>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x65,%eax
jne    1253 <escape_lookup+0x123>
movl   $0x1b,-0x4(%rbp)
jmp    1321 <escape_lookup+0x1f1>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x22,%eax
jne    1270 <escape_lookup+0x140>
movl   $0x22,-0x4(%rbp)
jmp    1321 <escape_lookup+0x1f1>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x27,%eax
jne    128d <escape_lookup+0x15d>
movl   $0x27,-0x4(%rbp)
jmp    1321 <escape_lookup+0x1f1>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x5c,%eax
jne    12aa <escape_lookup+0x17a>
movl   $0x5c,-0x4(%rbp)
jmp    1321 <escape_lookup+0x1f1>
jmp    12af <escape_lookup+0x17f>
jmp    12b4 <escape_lookup+0x184>
jmp    12b9 <escape_lookup+0x189>
jmp    12be <escape_lookup+0x18e>
jmp    12c3 <escape_lookup+0x193>
jmp    12c8 <escape_lookup+0x198>
jmp    12cd <escape_lookup+0x19d>
jmp    12d2 <escape_lookup+0x1a2>
jmp    12d7 <escape_lookup+0x1a7>
mov    0x2d02(%rip),%rax
mov    (%rax),%esi
lea    0xd19(%rip),%rdi
call   1050 <file_print@plt>
mov    -0x10(%rbp),%rdi
mov    0x2ce9(%rip),%rax
mov    (%rax),%esi
call   1050 <file_print@plt>
mov    0x2cdb(%rip),%rax
mov    (%rax),%esi
lea    0xd0c(%rip),%rdi
call   1050 <file_print@plt>
mov    0x2cbe(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<escape_lookup>:
push   %rbp
push   %rbx
push   %rax
movsbl (%rdi),%eax
cmp    $0x5c,%eax
jne    11b6 <escape_lookup+0x86>
mov    %rdi,%rbx
mov    0x1(%rdi),%cl
add    $0xde,%cl
cmp    $0x56,%cl
ja     11bd <escape_lookup+0x8d>
mov    $0x9,%eax
movzbl %cl,%ecx
lea    0xea8(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x22,%eax
jmp    11b6 <escape_lookup+0x86>
mov    $0x27,%eax
jmp    11b6 <escape_lookup+0x86>
mov    $0x5c,%eax
jmp    11b6 <escape_lookup+0x86>
mov    $0x1b,%eax
jmp    11b6 <escape_lookup+0x86>
mov    $0xc,%eax
jmp    11b6 <escape_lookup+0x86>
mov    $0xa,%eax
jmp    11b6 <escape_lookup+0x86>
mov    $0xd,%eax
jmp    11b6 <escape_lookup+0x86>
mov    $0xb,%eax
jmp    11b6 <escape_lookup+0x86>
movsbl 0x2(%rbx),%edi
mov    $0x1,%esi
call   1030 <hexify@plt>
mov    %eax,%ebp
movsbl 0x3(%rbx),%edi
xor    %esi,%esi
call   1030 <hexify@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e1c(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0xf8e(%rip),%rdi
call   1050 <file_print@plt>
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1050 <file_print@plt>
mov    0x0(%rbp),%esi
lea    0xf8e(%rip),%rdi
call   1050 <file_print@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Unknown escape received: \00"
@stderr = global i32 0
@.str.1 = [20 x i8] c" Unable to process\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @escape_lookup(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 92, %9
br i1 %10, label %11, label %16
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
store i32 %15, i32* %2
br label %116
16: ; preds = %1
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 120
br i1 %21, label %22, label %34
22: ; preds = %16
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 2
%25 = load i8, i8* %24
%26 = call i32 @hexify(i8 signext %25, i32 1)
store i32 %26, i32* %4
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i64 3
%29 = load i8, i8* %28
%30 = call i32 @hexify(i8 signext %29, i32 0)
store i32 %30, i32* %5
%31 = load i32, i32* %4
%32 = load i32, i32* %5
%33 = add nsw i32 %31, %32
store i32 %33, i32* %2
br label %116
34: ; preds = %16
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i64 1
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 116
br i1 %39, label %40, label %41
40: ; preds = %34
store i32 9, i32* %2
br label %116
41: ; preds = %34
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i64 1
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 110
br i1 %46, label %47, label %48
47: ; preds = %41
store i32 10, i32* %2
br label %116
48: ; preds = %41
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i64 1
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 118
br i1 %53, label %54, label %55
54: ; preds = %48
store i32 11, i32* %2
br label %116
55: ; preds = %48
%56 = load i8*, i8** %3
%57 = getelementptr inbounds i8, i8* %56, i64 1
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 102
br i1 %60, label %61, label %62
61: ; preds = %55
store i32 12, i32* %2
br label %116
62: ; preds = %55
%63 = load i8*, i8** %3
%64 = getelementptr inbounds i8, i8* %63, i64 1
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 114
br i1 %67, label %68, label %69
68: ; preds = %62
store i32 13, i32* %2
br label %116
69: ; preds = %62
%70 = load i8*, i8** %3
%71 = getelementptr inbounds i8, i8* %70, i64 1
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp eq i32 %73, 101
br i1 %74, label %75, label %76
75: ; preds = %69
store i32 27, i32* %2
br label %116
76: ; preds = %69
%77 = load i8*, i8** %3
%78 = getelementptr inbounds i8, i8* %77, i64 1
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = icmp eq i32 %80, 34
br i1 %81, label %82, label %83
82: ; preds = %76
store i32 34, i32* %2
br label %116
83: ; preds = %76
%84 = load i8*, i8** %3
%85 = getelementptr inbounds i8, i8* %84, i64 1
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = icmp eq i32 %87, 39
br i1 %88, label %89, label %90
89: ; preds = %83
store i32 39, i32* %2
br label %116
90: ; preds = %83
%91 = load i8*, i8** %3
%92 = getelementptr inbounds i8, i8* %91, i64 1
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
%95 = icmp eq i32 %94, 92
br i1 %95, label %96, label %97
96: ; preds = %90
store i32 92, i32* %2
br label %116
97: ; preds = %90
br label %98
98: ; preds = %97
br label %99
99: ; preds = %98
br label %100
100: ; preds = %99
br label %101
101: ; preds = %100
br label %102
102: ; preds = %101
br label %103
103: ; preds = %102
br label %104
104: ; preds = %103
br label %105
105: ; preds = %104
br label %106
106: ; preds = %105
%107 = load i32, i32* @stderr
%108 = call i32 @file_print(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %107)
%109 = load i8*, i8** %3
%110 = load i32, i32* @stderr
%111 = call i32 @file_print(i8* %109, i32 %110)
%112 = load i32, i32* @stderr
%113 = call i32 @file_print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %112)
%114 = load i32, i32* @EXIT_FAILURE
%115 = call i32 @exit(i32 %114)
unreachable
116: ; preds = %96, %89, %82, %75, %68, %61, %54, %47, %40, %22, %11
%117 = load i32, i32* %2
ret i32 %117
}

LLVM IR (-O2):
@.str = [26 x i8] c"Unknown escape received: \00"
@stderr = global i32 0
@.str.1 = [20 x i8] c" Unable to process\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @escape_lookup(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 92
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = sext i8 %2 to i32
br label %34
6: ; preds = %1
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
switch i8 %8, label %25 [
i8 120, label %9
i8 116, label %34
i8 110, label %17
i8 118, label %18
i8 102, label %19
i8 114, label %20
i8 101, label %21
i8 34, label %22
i8 39, label %23
i8 92, label %24
]
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = tail call i32 @hexify(i8 signext %11, i32 1)
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = load i8, i8* %13
%15 = tail call i32 @hexify(i8 signext %14, i32 0)
%16 = add nsw i32 %15, %12
br label %34
17: ; preds = %6
br label %34
18: ; preds = %6
br label %34
19: ; preds = %6
br label %34
20: ; preds = %6
br label %34
21: ; preds = %6
br label %34
22: ; preds = %6
br label %34
23: ; preds = %6
br label %34
24: ; preds = %6
br label %34
25: ; preds = %6
%26 = load i32, i32* @stderr
%27 = tail call i32 @file_print(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = load i32, i32* @stderr
%29 = tail call i32 @file_print(i8* %0, i32 %28)
%30 = load i32, i32* @stderr
%31 = tail call i32 @file_print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = load i32, i32* @EXIT_FAILURE
%33 = tail call i32 @exit(i32 %32)
unreachable
34: ; preds = %6, %24, %23, %22, %21, %20, %19, %18, %17, %9, %4
%35 = phi i32 [ %5, %4 ], [ %16, %9 ], [ 10, %17 ], [ 11, %18 ], [ 12, %19 ], [ 13, %20 ], [ 27, %21 ], [ 34, %22 ], [ 39, %23 ], [ 92, %24 ], [ 9, %6 ]
ret i32 %35
}