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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x9(%rbp)
je     117e <main+0x4e>
mov    -0x8(%rbp),%eax
mov    0x2e6a(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    118e <main+0x5e>
jmp    11ff <main+0xcf>
cmpl   $0x9,-0x8(%rbp)
jne    11a9 <main+0x79>
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
jmp    11fa <main+0xca>
cmpl   $0x8,-0x8(%rbp)
jne    11c4 <main+0x94>
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
jmp    11f5 <main+0xc5>
cmpl   $0x5c,-0x8(%rbp)
jne    11df <main+0xaf>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
jmp    11f0 <main+0xc0>
mov    -0x8(%rbp),%edi
mov    0x2de7(%rip),%rax
mov    (%rax),%esi
call   1050 <fputc@plt>
jmp    11f5 <main+0xc5>
jmp    11fa <main+0xca>
jmp    114b <main+0x1b>
lea    0xe03(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e8a(%rip),%r13
mov    0x0(%r13),%edi
call   1050 <fgetc@plt>
cmp    $0xa,%eax
je     11fc <main+0xbc>
mov    0x2e69(%rip),%rbx
cmp    (%rbx),%eax
je     11fc <main+0xbc>
lea    0xe7d(%rip),%r14
lea    0xe79(%rip),%r15
lea    0xe6c(%rip),%r12
mov    0x2e35(%rip),%rbp
nopl   0x0(%rax,%rax,1)
cmp    $0x8,%eax
je     11c0 <main+0x80>
cmp    $0x5c,%eax
je     11d0 <main+0x90>
cmp    $0x9,%eax
jne    11e0 <main+0xa0>
mov    %r12,%rdi
call   1040 <printf@plt>
jmp    11ea <main+0xaa>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <printf@plt>
jmp    11ea <main+0xaa>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <printf@plt>
jmp    11ea <main+0xaa>
nopw   0x0(%rax,%rax,1)
mov    0x0(%rbp),%esi
mov    %eax,%edi
call   1060 <fputc@plt>
mov    0x0(%r13),%edi
call   1050 <fgetc@plt>
cmp    $0xa,%eax
je     11fc <main+0xbc>
cmp    (%rbx),%eax
jne    11a0 <main+0x60>
lea    0xe06(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"--------------------\0A\00"
@stdin = global i32 0
@EOF = global i32 0
@.str.1 = [3 x i8] c"\\t\00"
@.str.2 = [3 x i8] c"\\b\00"
@.str.3 = [3 x i8] c"\\\\\00"
@stdout = global i32 0
@.str.4 = [23 x i8] c"\0A--------------------\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %35, %0
%5 = load i32, i32* @stdin
%6 = call i32 @fgetc(i32 %5)
store i32 %6, i32* %2
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = load i32, i32* %2
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br label %12
12: ; preds = %8, %4
%13 = phi i1 [ false, %4 ], [ %11, %8 ]
br i1 %13, label %14, label %36
14: ; preds = %12
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 9
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %35
19: ; preds = %14
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 8
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %34
24: ; preds = %19
%25 = load i32, i32* %2
%26 = icmp eq i32 %25, 92
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %33
29: ; preds = %24
%30 = load i32, i32* %2
%31 = load i32, i32* @stdout
%32 = call i32 @fputc(i32 %30, i32 %31)
br label %33
33: ; preds = %29, %27
br label %34
34: ; preds = %33, %22
br label %35
35: ; preds = %34, %17
br label %4
36: ; preds = %12
%37 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i32 0
@.str.1 = [3 x i8] c"\\t\00"
@.str.2 = [3 x i8] c"\\b\00"
@.str.3 = [3 x i8] c"\\\\\00"
@stdout = global i32 0
@str = [21 x i8] c"--------------------\00"
@str.5 = [22 x i8] c"\0A--------------------\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @stdin
%3 = tail call i32 @fgetc(i32 %2)
%4 = icmp ne i32 %3, 10
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %3, %5
%7 = select i1 %4, i1 %6, i1 false
br i1 %7, label %8, label %26
8: ; preds = %0, %19
%9 = phi i32 [ %21, %19 ], [ %3, %0 ]
switch i32 %9, label %16 [
i32 9, label %10
i32 8, label %12
i32 92, label %14
]
10: ; preds = %8
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %19
12: ; preds = %8
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %19
14: ; preds = %8
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %19
16: ; preds = %8
%17 = load i32, i32* @stdout
%18 = tail call i32 @fputc(i32 %9, i32 %17)
br label %19
19: ; preds = %12, %16, %14, %10
%20 = load i32, i32* @stdin
%21 = tail call i32 @fgetc(i32 %20)
%22 = icmp ne i32 %21, 10
%23 = load i32, i32* @EOF
%24 = icmp ne i32 %21, %23
%25 = select i1 %22, i1 %24, i1 false
br i1 %25, label %8, label %26
26: ; preds = %19, %0
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}