#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);
int main(void) {
  int c;
  printf("enter some words with tabs backspaces and \\ inside:\n");
  while ((c = getchar()) != EOF) {
    if (c == '\\') {
      putchar('\\');
      putchar('\\');
    } else if (c == '\b') {
      putchar('\\');
      putchar('b');
    } else if (c == '\t') {
      putchar('\\');
      putchar('t');
    } else
      putchar(c);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%eax
je     11e4 <main+0xb4>
cmpl   $0x5c,-0x8(%rbp)
jne    1187 <main+0x57>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x5c,%edi
call   1030 <putchar@plt>
jmp    11df <main+0xaf>
cmpl   $0x8,-0x8(%rbp)
jne    11aa <main+0x7a>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x62,%edi
call   1030 <putchar@plt>
jmp    11da <main+0xaa>
cmpl   $0x9,-0x8(%rbp)
jne    11cd <main+0x9d>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x74,%edi
call   1030 <putchar@plt>
jmp    11d5 <main+0xa5>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11da <main+0xaa>
jmp    11df <main+0xaf>
jmp    114b <main+0x1b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e9a(%rip),%r14
cmp    (%r14),%eax
jne    115d <main+0x2d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %eax,%ebx
jmp    1194 <main+0x64>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x74,%ebx
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
je     1153 <main+0x23>
cmp    $0x5c,%ebx
je     1175 <main+0x45>
cmp    $0x9,%ebx
je     1170 <main+0x40>
cmp    $0x8,%ebx
jne    117f <main+0x4f>
mov    $0x62,%ebx
jmp    1175 <main+0x45>

LLVM IR (-O0):
@.str = [53 x i8] c"enter some words with tabs backspaces and \\ inside:\0A\00"
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %31, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %32
8: ; preds = %4
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 92
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = call i32 @putchar(i32 92)
%13 = call i32 @putchar(i32 92)
br label %31
14: ; preds = %8
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 8
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = call i32 @putchar(i32 92)
%19 = call i32 @putchar(i32 98)
br label %30
20: ; preds = %14
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 9
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = call i32 @putchar(i32 92)
%25 = call i32 @putchar(i32 116)
br label %29
26: ; preds = %20
%27 = load i32, i32* %2
%28 = call i32 @putchar(i32 %27)
br label %29
29: ; preds = %26, %23
br label %30
30: ; preds = %29, %17
br label %31
31: ; preds = %30, %11
br label %4
32: ; preds = %4
ret i32 0
}

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