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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    0x2eaf(%rip),%rcx
cmp    (%rcx),%eax
je     11ad <main+0x8d>
cmpl   $0x9,-0x4(%rbp)
jne    115f <main+0x3f>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x74,%edi
call   1030 <putchar@plt>
cmpl   $0x8,-0x4(%rbp)
jne    117d <main+0x5d>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x62,%edi
call   1030 <putchar@plt>
cmpl   $0x5c,-0x4(%rbp)
jne    11a0 <main+0x80>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x5c,%edi
call   1030 <putchar@plt>
jmp    11a8 <main+0x88>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
jmp    1128 <main+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%eax
jne    113c <main+0x1c>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %eax,%ebx
jmp    116b <main+0x4b>
mov    $0x74,%ebp
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
je     1137 <main+0x17>
mov    %ebx,%ebp
cmp    $0x5c,%ebx
je     114f <main+0x2f>
cmp    $0x9,%ebx
je     1140 <main+0x20>
cmp    $0x8,%ebx
jne    1156 <main+0x36>
mov    $0x62,%ebp
jmp    1145 <main+0x25>

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

LLVM IR (-O2):
@EOF = global i32 0
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, %13
%5 = phi i32 [ %15, %13 ], [ %1, %0 ]
switch i32 %5, label %13 [
i32 9, label %7
i32 8, label %6
i32 92, label %10
]
6: ; preds = %4
br label %7
7: ; preds = %4, %6
%8 = phi i32 [ 98, %6 ], [ 116, %4 ]
%9 = tail call i32 @putchar(i32 92)
br label %10
10: ; preds = %4, %7
%11 = phi i32 [ %8, %7 ], [ %5, %4 ]
%12 = tail call i32 @putchar(i32 %11)
br label %13
13: ; preds = %10, %4
%14 = tail call i32 @putchar(i32 %5)
%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 = %13, %0
ret void
}