#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 curr;
  while ((curr = getchar()) != EOF) {
    if (curr == '\t') {
      putchar('\\');
      putchar('t');
    } else if (curr == '\b') {
      putchar('\\');
      putchar('b');
    } else if (curr == '\\') {
      putchar('\\');
      putchar('\\');
    } else {
      putchar(curr);
    }
  }
  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     11d8 <main+0xb8>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    1174 <main+0x54>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x74,%edi
call   1030 <putchar@plt>
jmp    11d3 <main+0xb3>
movsbl -0x5(%rbp),%eax
cmp    $0x8,%eax
jne    119a <main+0x7a>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x62,%edi
call   1030 <putchar@plt>
jmp    11ce <main+0xae>
movsbl -0x5(%rbp),%eax
cmp    $0x5c,%eax
jne    11c0 <main+0xa0>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x5c,%edi
call   1030 <putchar@plt>
jmp    11c9 <main+0xa9>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    11ce <main+0xae>
jmp    11d3 <main+0xb3>
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 = %35, %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 %36
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 %16
13: ; preds = %9
%14 = call i32 @putchar(i8 signext 92)
%15 = call i32 @putchar(i8 signext 116)
br label %35
16: ; preds = %9
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 8
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = call i32 @putchar(i8 signext 92)
%22 = call i32 @putchar(i8 signext 98)
br label %34
23: ; preds = %16
%24 = load i8, i8* %2
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 92
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = call i32 @putchar(i8 signext 92)
%29 = call i32 @putchar(i8 signext 92)
br label %33
30: ; preds = %23
%31 = load i8, i8* %2
%32 = call i32 @putchar(i8 signext %31)
br label %33
33: ; preds = %30, %27
br label %34
34: ; preds = %33, %20
br label %35
35: ; preds = %34, %13
br label %3
36: ; 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 [ 92, %7 ], [ 98, %6 ], [ 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
}