#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 */
char *c_escape_char(char ch) {
  switch (ch) {
  case 0:
    return ("\\x00");
  case 1:
    return ("\\x01");
  case 0x1b:
    return ("\\e");
  case '\a':
    return ("\\a");
  case '\b':
    return ("\\b");
  case '\f':
    return ("\\f");
  case '\n':
    return ("\\n");
  case '\r':
    return ("\\r");
  case '\t':
    return ("\\t");
  case '\v':
    return ("\\v");
  case '\\':
    return ("\\\\");
  case '\"':
    return ("\\\"");
  case '\'':
    return ("\\'");
  }
  return (NULL);
}


x86 assembly (clang, -O0):
<c_escape_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5c,%eax
ja     1201 <c_escape_char+0x101>
mov    -0x18(%rbp),%rax
lea    0xed8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x103c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
lea    0x1031(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
lea    0x1026(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
lea    0x1019(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
lea    0x100c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
lea    0xfff(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
lea    0xff2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
lea    0xfe5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
lea    0xfd8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
lea    0xfcb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
lea    0xfbe(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
lea    0xfb1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
lea    0xfa4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1209 <c_escape_char+0x109>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_escape_char>:
cmp    $0x5c,%edi
ja     1126 <c_escape_char+0x26>
lea    0x1068(%rip),%rax
mov    %edi,%ecx
lea    0xeeb(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0x1054(%rip),%rax
ret
xor    %eax,%eax
ret
lea    0x1051(%rip),%rax
ret
lea    0x104c(%rip),%rax
ret
lea    0x1050(%rip),%rax
ret
lea    0x1042(%rip),%rax
ret
lea    0x1043(%rip),%rax
ret
lea    0x102f(%rip),%rax
ret
lea    0x102d(%rip),%rax
ret
lea    0x1016(%rip),%rax
ret
lea    0x1029(%rip),%rax
ret
lea    0x1024(%rip),%rax
ret
lea    0x1016(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\\x00\00"
@.str.1 = [5 x i8] c"\\x01\00"
@.str.2 = [3 x i8] c"\\e\00"
@.str.3 = [3 x i8] c"\\a\00"
@.str.4 = [3 x i8] c"\\b\00"
@.str.5 = [3 x i8] c"\\f\00"
@.str.6 = [3 x i8] c"\\n\00"
@.str.7 = [3 x i8] c"\\r\00"
@.str.8 = [3 x i8] c"\\t\00"
@.str.9 = [3 x i8] c"\\v\00"
@.str.10 = [3 x i8] c"\\\\\00"
@.str.11 = [3 x i8] c"\\\22\00"
@.str.12 = [3 x i8] c"\\'\00"
define i8* @c_escape_char(i8 signext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %19 [
i32 0, label %6
i32 1, label %7
i32 27, label %8
i32 7, label %9
i32 8, label %10
i32 12, label %11
i32 10, label %12
i32 13, label %13
i32 9, label %14
i32 11, label %15
i32 92, label %16
i32 34, label %17
i32 39, label %18
]
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %20
7: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %20
8: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %20
9: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %20
10: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %20
11: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %20
12: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %20
13: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %20
14: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %20
15: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %20
16: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %20
17: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %20
18: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %20
19: ; preds = %1
store i8* null, i8** %2
br label %20
20: ; preds = %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@.str = [5 x i8] c"\\x00\00"
@.str.1 = [5 x i8] c"\\x01\00"
@.str.2 = [3 x i8] c"\\e\00"
@.str.3 = [3 x i8] c"\\a\00"
@.str.4 = [3 x i8] c"\\b\00"
@.str.5 = [3 x i8] c"\\f\00"
@.str.6 = [3 x i8] c"\\n\00"
@.str.7 = [3 x i8] c"\\r\00"
@.str.8 = [3 x i8] c"\\t\00"
@.str.9 = [3 x i8] c"\\v\00"
@.str.10 = [3 x i8] c"\\\\\00"
@.str.11 = [3 x i8] c"\\\22\00"
@.str.12 = [3 x i8] c"\\'\00"
define i8* @c_escape_char(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %15 [
i32 0, label %16
i32 1, label %3
i32 27, label %4
i32 7, label %5
i32 8, label %6
i32 12, label %7
i32 10, label %8
i32 13, label %9
i32 9, label %10
i32 11, label %11
i32 92, label %12
i32 34, label %13
i32 39, label %14
]
3: ; preds = %1
br label %16
4: ; preds = %1
br label %16
5: ; preds = %1
br label %16
6: ; preds = %1
br label %16
7: ; preds = %1
br label %16
8: ; preds = %1
br label %16
9: ; preds = %1
br label %16
10: ; preds = %1
br label %16
11: ; preds = %1
br label %16
12: ; preds = %1
br label %16
13: ; preds = %1
br label %16
14: ; preds = %1
br label %16
15: ; preds = %1
br label %16
16: ; preds = %1, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3
%17 = phi i8* [ null, %15 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), %14 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), %13 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), %12 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), %11 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), %10 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), %9 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %17
}