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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e95(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11d0 <main+0xa0>
movsbl -0x5(%rbp),%eax
cmp    $0x8,%eax
jne    117c <main+0x4c>
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
jmp    11cb <main+0x9b>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    119a <main+0x6a>
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
jmp    11c6 <main+0x96>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    11b8 <main+0x88>
lea    0xe58(%rip),%rdi
call   1040 <printf@plt>
jmp    11c1 <main+0x91>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    11c6 <main+0x96>
jmp    11cb <main+0x9b>
jmp    113f <main+0xf>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
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),%al
jne    1162 <main+0x32>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe9d(%rip),%r14
lea    0xe93(%rip),%r12
lea    0xe89(%rip),%r15
jmp    1193 <main+0x63>
nopl   0x0(%rax)
mov    %r12,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%al
je     114a <main+0x1a>
cmp    $0xa,%al
je     11b0 <main+0x80>
cmp    $0x9,%al
je     1180 <main+0x50>
cmp    $0x8,%al
jne    11c0 <main+0x90>
mov    %r15,%rdi
jmp    1183 <main+0x53>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
jmp    1183 <main+0x53>
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1188 <main+0x58>

LLVM IR (-O0):
@EOF = global i8 0
@.str = [3 x i8] c"\\b\00"
@.str.1 = [3 x i8] c"\\t\00"
@.str.2 = [3 x i8] c"\\n\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %32, %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 %33
9: ; preds = %3
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 8
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %32
15: ; preds = %9
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 9
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %31
21: ; preds = %15
%22 = load i8, i8* %2
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 10
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %30
27: ; preds = %21
%28 = load i8, i8* %2
%29 = call i32 @putchar(i8 signext %28)
br label %30
30: ; preds = %27, %25
br label %31
31: ; preds = %30, %19
br label %32
32: ; preds = %31, %13
br label %3
33: ; preds = %3
%34 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
@.str = [3 x i8] c"\\b\00"
@.str.1 = [3 x i8] c"\\t\00"
@.str.2 = [3 x i8] c"\\n\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %18, label %4
4: ; preds = %0, %14
%5 = phi i8 [ %15, %14 ], [ %1, %0 ]
switch i8 %5, label %12 [
i8 8, label %6
i8 9, label %8
i8 10, 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(i8 signext %5)
br label %14
14: ; preds = %8, %12, %10, %6
%15 = tail call signext i8 (...) @getchar()
%16 = load i8, i8* @EOF
%17 = icmp eq i8 %15, %16
br i1 %17, label %18, label %4
18: ; preds = %14, %0
%19 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}