#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*/ strcat(char *, char *);
void expand_esc_seq(char str[], const char c) {
  switch (c) {
  case '\0':
    strcat(str, "NULL");
    break;
  case '\a':
    strcat(str, "\\a");
    break;
  case '\b':
    strcat(str, "\\b");
    break;
  case '\f':
    strcat(str, "\\f");
    break;
  case '\n':
    strcat(str, "\\n");
    break;
  case '\r':
    strcat(str, "\\r");
    break;
  case '\t':
    strcat(str, "\\t");
    break;
  case '\v':
    strcat(str, "\\v");
    break;
  case '\\':
    strcat(str, "\\\\");
    break;
  case '\'':
    strcat(str, "\\'");
    break;
  case '\"':
    strcat(str, "\\\"");
    break;
  case '\?':
    strcat(str, "\\?");
    break;
  default:
    str[0] = c;
    str[1] = '\0';
  }
  return;
}


x86 assembly (clang, -O0):
<expand_esc_seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5c,%eax
ja     1245 <expand_esc_seq+0x135>
mov    -0x18(%rbp),%rax
lea    0xec0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
lea    0x1020(%rip),%rsi
call   1030 <strcat@plt>
jmp    1256 <expand_esc_seq+0x146>
mov    -0x8(%rbp),%rdi
lea    0x1010(%rip),%rsi
call   1030 <strcat@plt>
jmp    1256 <expand_esc_seq+0x146>
mov    -0x8(%rbp),%rdi
lea    0xffe(%rip),%rsi
call   1030 <strcat@plt>
jmp    1256 <expand_esc_seq+0x146>
mov    -0x8(%rbp),%rdi
lea    0xfec(%rip),%rsi
call   1030 <strcat@plt>
jmp    1256 <expand_esc_seq+0x146>
mov    -0x8(%rbp),%rdi
lea    0xfda(%rip),%rsi
call   1030 <strcat@plt>
jmp    1256 <expand_esc_seq+0x146>
mov    -0x8(%rbp),%rdi
lea    0xfc8(%rip),%rsi
call   1030 <strcat@plt>
jmp    1256 <expand_esc_seq+0x146>
mov    -0x8(%rbp),%rdi
lea    0xfb6(%rip),%rsi
call   1030 <strcat@plt>
jmp    1256 <expand_esc_seq+0x146>
mov    -0x8(%rbp),%rdi
lea    0xfa4(%rip),%rsi
call   1030 <strcat@plt>
jmp    1256 <expand_esc_seq+0x146>
mov    -0x8(%rbp),%rdi
lea    0xf92(%rip),%rsi
call   1030 <strcat@plt>
jmp    1256 <expand_esc_seq+0x146>
mov    -0x8(%rbp),%rdi
lea    0xf80(%rip),%rsi
call   1030 <strcat@plt>
jmp    1256 <expand_esc_seq+0x146>
mov    -0x8(%rbp),%rdi
lea    0xf6e(%rip),%rsi
call   1030 <strcat@plt>
jmp    1256 <expand_esc_seq+0x146>
mov    -0x8(%rbp),%rdi
lea    0xf5c(%rip),%rsi
call   1030 <strcat@plt>
jmp    1256 <expand_esc_seq+0x146>
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x1(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expand_esc_seq>:
cmp    $0x5c,%esi
ja     1133 <expand_esc_seq+0x23>
mov    %esi,%eax
lea    0xee2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1046(%rip),%rsi
jmp    1030 <strcat@plt>
mov    %sil,(%rdi)
movb   $0x0,0x1(%rdi)
ret
lea    0x1037(%rip),%rsi
jmp    1030 <strcat@plt>
lea    0x102e(%rip),%rsi
jmp    1030 <strcat@plt>
lea    0x102e(%rip),%rsi
jmp    1030 <strcat@plt>
lea    0x101c(%rip),%rsi
jmp    1030 <strcat@plt>
lea    0x1019(%rip),%rsi
jmp    1030 <strcat@plt>
lea    0x1001(%rip),%rsi
jmp    1030 <strcat@plt>
lea    0xffb(%rip),%rsi
jmp    1030 <strcat@plt>
lea    0xffe(%rip),%rsi
jmp    1030 <strcat@plt>
lea    0xfef(%rip),%rsi
jmp    1030 <strcat@plt>
lea    0xfe9(%rip),%rsi
jmp    1030 <strcat@plt>
lea    0xfd4(%rip),%rsi
jmp    1030 <strcat@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"NULL\00"
@.str.1 = [3 x i8] c"\\a\00"
@.str.2 = [3 x i8] c"\\b\00"
@.str.3 = [3 x i8] c"\\f\00"
@.str.4 = [3 x i8] c"\\n\00"
@.str.5 = [3 x i8] c"\\r\00"
@.str.6 = [3 x i8] c"\\t\00"
@.str.7 = [3 x i8] c"\\v\00"
@.str.8 = [3 x i8] c"\\\\\00"
@.str.9 = [3 x i8] c"\\'\00"
@.str.10 = [3 x i8] c"\\\22\00"
@.str.11 = [3 x i8] c"\\?\00"
define void @expand_esc_seq(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
switch i32 %6, label %43 [
i32 0, label %7
i32 7, label %10
i32 8, label %13
i32 12, label %16
i32 10, label %19
i32 13, label %22
i32 9, label %25
i32 11, label %28
i32 92, label %31
i32 39, label %34
i32 34, label %37
i32 63, label %40
]
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %49
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %49
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %49
16: ; preds = %2
%17 = load i8*, i8** %3
%18 = call i32 @strcat(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %49
19: ; preds = %2
%20 = load i8*, i8** %3
%21 = call i32 @strcat(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %49
22: ; preds = %2
%23 = load i8*, i8** %3
%24 = call i32 @strcat(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %49
25: ; preds = %2
%26 = load i8*, i8** %3
%27 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %49
28: ; preds = %2
%29 = load i8*, i8** %3
%30 = call i32 @strcat(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %49
31: ; preds = %2
%32 = load i8*, i8** %3
%33 = call i32 @strcat(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %49
34: ; preds = %2
%35 = load i8*, i8** %3
%36 = call i32 @strcat(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br label %49
37: ; preds = %2
%38 = load i8*, i8** %3
%39 = call i32 @strcat(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
br label %49
40: ; preds = %2
%41 = load i8*, i8** %3
%42 = call i32 @strcat(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
br label %49
43: ; preds = %2
%44 = load i8, i8* %4
%45 = load i8*, i8** %3
%46 = getelementptr inbounds i8, i8* %45, i64 0
store i8 %44, i8* %46
%47 = load i8*, i8** %3
%48 = getelementptr inbounds i8, i8* %47, i64 1
store i8 0, i8* %48
br label %49
49: ; preds = %43, %40, %37, %34, %31, %28, %25, %22, %19, %16, %13, %10, %7
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"NULL\00"
@.str.1 = [3 x i8] c"\\a\00"
@.str.2 = [3 x i8] c"\\b\00"
@.str.3 = [3 x i8] c"\\f\00"
@.str.4 = [3 x i8] c"\\n\00"
@.str.5 = [3 x i8] c"\\r\00"
@.str.6 = [3 x i8] c"\\t\00"
@.str.7 = [3 x i8] c"\\v\00"
@.str.8 = [3 x i8] c"\\\\\00"
@.str.9 = [3 x i8] c"\\'\00"
@.str.10 = [3 x i8] c"\\\22\00"
@.str.11 = [3 x i8] c"\\?\00"
define void @expand_esc_seq(i8* %0, i8 signext %1) {
%3 = sext i8 %1 to i32
switch i32 %3, label %28 [
i32 0, label %4
i32 7, label %6
i32 8, label %8
i32 12, label %10
i32 10, label %12
i32 13, label %14
i32 9, label %16
i32 11, label %18
i32 92, label %20
i32 39, label %22
i32 34, label %24
i32 63, label %26
]
4: ; preds = %2
%5 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %30
6: ; preds = %2
%7 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %30
8: ; preds = %2
%9 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %30
10: ; preds = %2
%11 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %30
12: ; preds = %2
%13 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %30
14: ; preds = %2
%15 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %30
16: ; preds = %2
%17 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %30
18: ; preds = %2
%19 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %30
20: ; preds = %2
%21 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %30
22: ; preds = %2
%23 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br label %30
24: ; preds = %2
%25 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
br label %30
26: ; preds = %2
%27 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
br label %30
28: ; preds = %2
store i8 %1, i8* %0
%29 = getelementptr inbounds i8, i8* %0, i64 1
store i8 0, i8* %29
br label %30
30: ; preds = %28, %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4
ret void
}