#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*/ printf(char *);
int /*<<< orphan*/ putchar(int);
void escape(int c) {
  switch (c) {
  case '\t':
    printf("\\t");
    break;
  case '\b':
    printf("\\b");
    break;
  case '\n':
    printf("\\n");
    break;
  case '\\':
    printf("\\\\");
    break;
  default:
    putchar(c);
    break;
  }
}


x86 assembly (clang, -O0):
<escape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x8,%eax
je     1183 <escape+0x63>
jmp    113f <escape+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x9,%eax
je     1172 <escape+0x52>
jmp    1150 <escape+0x30>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
je     1194 <escape+0x74>
jmp    1161 <escape+0x41>
mov    -0x8(%rbp),%eax
sub    $0x5c,%eax
je     11a5 <escape+0x85>
jmp    11b6 <escape+0x96>
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
jmp    11be <escape+0x9e>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
jmp    11be <escape+0x9e>
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
jmp    11be <escape+0x9e>
lea    0xe5d(%rip),%rdi
call   1040 <printf@plt>
jmp    11be <escape+0x9e>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<escape>:
cmp    $0x9,%edi
jg     113b <escape+0x1b>
cmp    $0x8,%edi
je     1156 <escape+0x36>
cmp    $0x9,%edi
jne    1151 <escape+0x31>
lea    0xeca(%rip),%rdi
jmp    1040 <printf@plt>
cmp    $0xa,%edi
je     1162 <escape+0x42>
cmp    $0x5c,%edi
jne    1151 <escape+0x31>
lea    0xebd(%rip),%rdi
jmp    1040 <printf@plt>
jmp    1030 <putchar@plt>
lea    0xea6(%rip),%rdi
jmp    1040 <printf@plt>
lea    0xe9d(%rip),%rdi
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"\\t\00"
@.str.1 = [3 x i8] c"\\b\00"
@.str.2 = [3 x i8] c"\\n\00"
@.str.3 = [3 x i8] c"\\\\\00"
define void @escape(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %12 [
i32 9, label %4
i32 8, label %6
i32 10, label %8
i32 92, label %10
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %15
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %15
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %15
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %15
12: ; preds = %1
%13 = load i32, i32* %2
%14 = call i32 @putchar(i32 %13)
br label %15
15: ; preds = %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"\\t\00"
@.str.1 = [3 x i8] c"\\b\00"
@.str.2 = [3 x i8] c"\\n\00"
@.str.3 = [3 x i8] c"\\\\\00"
define void @escape(i32 %0) {
switch i32 %0, label %10 [
i32 9, label %2
i32 8, label %4
i32 10, label %6
i32 92, label %8
]
2: ; preds = %1
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %12
4: ; preds = %1
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %12
6: ; preds = %1
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %12
8: ; preds = %1
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %12
10: ; preds = %1
%11 = tail call i32 @putchar(i32 %0)
br label %12
12: ; preds = %10, %8, %6, %4, %2
ret void
}