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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e95(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11f8 <main+0xc8>
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x8,%eax
je     11c8 <main+0x98>
jmp    1173 <main+0x43>
mov    -0xc(%rbp),%eax
sub    $0x9,%eax
je     11b7 <main+0x87>
jmp    1184 <main+0x54>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
je     11a6 <main+0x76>
jmp    1195 <main+0x65>
mov    -0xc(%rbp),%eax
sub    $0x5c,%eax
je     11d9 <main+0xa9>
jmp    11ea <main+0xba>
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
jmp    11f3 <main+0xc3>
lea    0xe45(%rip),%rdi
call   1040 <printf@plt>
jmp    11f3 <main+0xc3>
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
jmp    11f3 <main+0xc3>
lea    0xe29(%rip),%rdi
call   1040 <printf@plt>
jmp    11f3 <main+0xc3>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    113f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2ea1(%rip),%rbx
cmp    (%rbx),%al
jne    1157 <main+0x27>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xea8(%rip),%r14
lea    0xe9e(%rip),%r15
lea    0xe9d(%rip),%r12
lea    0xe8d(%rip),%r13
jmp    119b <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nop
call   1030 <putchar@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%al
je     114b <main+0x1b>
movsbl %al,%edi
cmp    $0x9,%edi
jg     11c0 <main+0x90>
cmp    $0x8,%edi
je     11e0 <main+0xb0>
cmp    $0x9,%edi
jne    1180 <main+0x50>
mov    %r15,%rdi
call   1040 <printf@plt>
jmp    1190 <main+0x60>
nopw   0x0(%rax,%rax,1)
cmp    $0x5c,%edi
je     11f0 <main+0xc0>
cmp    $0xa,%edi
jne    1180 <main+0x50>
mov    %r13,%rdi
call   1040 <printf@plt>
jmp    1190 <main+0x60>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   1040 <printf@plt>
jmp    1190 <main+0x60>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1040 <printf@plt>
jmp    1190 <main+0x60>

LLVM IR (-O0):
@EOF = global i8 0
@.str = [3 x i8] c"\\n\00"
@.str.1 = [3 x i8] c"\\t\00"
@.str.2 = [3 x i8] c"\\b\00"
@.str.3 = [3 x i8] c"\\\\\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %23, %0
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %2
%5 = sext i8 %4 to i32
%6 = load i8, i8* @EOF
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %5, %7
br i1 %8, label %9, label %24
9: ; preds = %3
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
switch i32 %11, label %20 [
i32 10, label %12
i32 9, label %14
i32 8, label %16
i32 92, label %18
]
12: ; preds = %9
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %23
14: ; preds = %9
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %23
16: ; preds = %9
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %23
18: ; preds = %9
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %23
20: ; preds = %9
%21 = load i8, i8* %2
%22 = call i32 @putchar(i8 signext %21)
br label %23
23: ; preds = %20, %18, %16, %14, %12
br label %3
24: ; preds = %3
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@EOF = global i8 0
@.str = [3 x i8] c"\\n\00"
@.str.1 = [3 x i8] c"\\t\00"
@.str.2 = [3 x i8] c"\\b\00"
@.str.3 = [3 x i8] c"\\\\\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %21, label %4
4: ; preds = %0, %17
%5 = phi i8 [ %18, %17 ], [ %1, %0 ]
%6 = sext i8 %5 to i32
switch i32 %6, label %15 [
i32 10, label %7
i32 9, label %9
i32 8, label %11
i32 92, label %13
]
7: ; preds = %4
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %17
9: ; preds = %4
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %17
11: ; preds = %4
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %17
13: ; preds = %4
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %17
15: ; preds = %4
%16 = tail call i32 @putchar(i8 signext %5)
br label %17
17: ; preds = %15, %13, %11, %9, %7
%18 = tail call signext i8 (...) @getchar()
%19 = load i8, i8* @EOF
%20 = icmp eq i8 %18, %19
br i1 %20, label %21, label %4
21: ; preds = %17, %0
ret i32 0
}