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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2ea5(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11ad <main+0x8d>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    1169 <main+0x49>
mov    $0x5c,%edi
call   1030 <putchar@plt>
movb   $0x74,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x8,%eax
jne    1184 <main+0x64>
mov    $0x5c,%edi
call   1030 <putchar@plt>
movb   $0x62,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x5c,%eax
jne    119f <main+0x7f>
mov    $0x5c,%edi
call   1030 <putchar@plt>
movb   $0x5c,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%al
jne    1141 <main+0x21>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %eax,%ebx
jmp    1172 <main+0x52>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x74,%bl
mov    $0x5c,%edi
call   1030 <putchar@plt>
movsbl %bl,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%al
je     1137 <main+0x17>
cmp    $0x5c,%bl
je     1190 <main+0x70>
cmp    $0x9,%bl
je     1150 <main+0x30>
cmp    $0x8,%bl
jne    115c <main+0x3c>
mov    $0x62,%bl
jmp    1152 <main+0x32>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x5c,%bl
jmp    1152 <main+0x32>

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %27, %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 %30
9: ; preds = %3
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 9
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @putchar(i8 signext 92)
store i8 116, i8* %2
br label %15
15: ; preds = %13, %9
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 8
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @putchar(i8 signext 92)
store i8 98, i8* %2
br label %21
21: ; preds = %19, %15
%22 = load i8, i8* %2
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 92
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @putchar(i8 signext 92)
store i8 92, i8* %2
br label %27
27: ; preds = %25, %21
%28 = load i8, i8* %2
%29 = call i32 @putchar(i8 signext %28)
br label %3
30: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %17, label %4
4: ; preds = %0, %11
%5 = phi i8 [ %14, %11 ], [ %1, %0 ]
switch i8 %5, label %11 [
i8 9, label %8
i8 8, label %6
i8 92, label %7
]
6: ; preds = %4
br label %8
7: ; preds = %4
br label %8
8: ; preds = %4, %7, %6
%9 = phi i8 [ 98, %6 ], [ 92, %7 ], [ 116, %4 ]
%10 = tail call i32 @putchar(i8 signext 92)
br label %11
11: ; preds = %8, %4
%12 = phi i8 [ %5, %4 ], [ %9, %8 ]
%13 = tail call i32 @putchar(i8 signext %12)
%14 = tail call signext i8 (...) @getchar()
%15 = load i8, i8* @EOF
%16 = icmp eq i8 %14, %15
br i1 %16, label %17, label %4
17: ; preds = %11, %0
ret i32 0
}