#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
void main() {
  int c;
  while ((c = getchar()) != EOF) {
    if (c == '\t')
      printf("\\t");
    else if (c == '\b')
      printf("\\b");
    else if (c == '\\')
      printf("\\\\");
    else
      putchar(c);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e9f(%rip),%rcx
cmp    (%rcx),%eax
je     11b9 <main+0x89>
cmpl   $0x9,-0x4(%rbp)
jne    116c <main+0x3c>
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
jmp    11b4 <main+0x84>
cmpl   $0x8,-0x4(%rbp)
jne    1187 <main+0x57>
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
jmp    11af <main+0x7f>
cmpl   $0x5c,-0x4(%rbp)
jne    11a2 <main+0x72>
lea    0xe6e(%rip),%rdi
call   1040 <printf@plt>
jmp    11aa <main+0x7a>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
jmp    11af <main+0x7f>
jmp    11b4 <main+0x84>
jmp    1138 <main+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2ea2(%rip),%rbx
cmp    (%rbx),%eax
jne    1156 <main+0x26>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xea6(%rip),%r14
lea    0xea2(%rip),%r12
lea    0xe95(%rip),%r15
jmp    1183 <main+0x53>
nopl   (%rax)
mov    %r12,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     114a <main+0x1a>
cmp    $0x8,%eax
je     11a0 <main+0x70>
cmp    $0x5c,%eax
je     1170 <main+0x40>
cmp    $0x9,%eax
jne    11b0 <main+0x80>
mov    %r15,%rdi
jmp    1173 <main+0x43>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
jmp    1173 <main+0x43>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    1178 <main+0x48>

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

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