#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 getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int main(int argc, const char **argv) {
  char c;
  while (1) {
    printf(">>> ");
    while ((c = getchar()) != '\n') {
      switch (c) {
      case '\t':
        printf("\\t");
        break;
      case '\b':
        printf("\\b");
        break;
      case '\\':
        printf("\\\\");
        break;
      default:
        putchar(c);
        break;
      }
    }
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     11e0 <main+0xb0>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x8,%eax
je     11b0 <main+0x80>
jmp    117d <main+0x4d>
mov    -0x18(%rbp),%eax
sub    $0x9,%eax
je     119f <main+0x6f>
jmp    118e <main+0x5e>
mov    -0x18(%rbp),%eax
sub    $0x5c,%eax
je     11c1 <main+0x91>
jmp    11d2 <main+0xa2>
lea    0xe5f(%rip),%rdi
call   1040 <printf@plt>
jmp    11db <main+0xab>
lea    0xe51(%rip),%rdi
call   1040 <printf@plt>
jmp    11db <main+0xab>
lea    0xe43(%rip),%rdi
call   1040 <printf@plt>
jmp    11db <main+0xab>
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
jmp    1152 <main+0x22>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1146 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%r14
lea    0xec2(%rip),%r15
lea    0xebe(%rip),%r12
lea    0xeb1(%rip),%rbx
jmp    116a <main+0x3a>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
jmp    1173 <main+0x43>
nop
mov    %r12,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     1160 <main+0x30>
movsbl %al,%edi
cmp    $0x8,%edi
je     11a0 <main+0x70>
cmp    $0x5c,%edi
je     1170 <main+0x40>
cmp    $0x9,%edi
je     11b0 <main+0x80>
call   1030 <putchar@plt>
jmp    1178 <main+0x48>
nopl   0x0(%rax)
mov    %r15,%rdi
jmp    1173 <main+0x43>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
jmp    1173 <main+0x43>

LLVM IR (-O0):
@.str = [5 x i8] c">>> \00"
@.str.1 = [3 x i8] c"\\t\00"
@.str.2 = [3 x i8] c"\\b\00"
@.str.3 = [3 x i8] c"\\\\\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %2, %26
%8 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %25, %7
%10 = call signext i8 (...) @getchar()
store i8 %10, i8* %6
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %26
13: ; preds = %9
%14 = load i8, i8* %6
%15 = sext i8 %14 to i32
switch i32 %15, label %22 [
i32 9, label %16
i32 8, label %18
i32 92, label %20
]
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %25
18: ; preds = %13
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %25
20: ; preds = %13
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %25
22: ; preds = %13
%23 = load i8, i8* %6
%24 = call i32 @putchar(i8 signext %23)
br label %25
25: ; preds = %22, %20, %18, %16
br label %9
26: ; preds = %9
%27 = call i32 @putchar(i8 signext 10)
br label %7
}

LLVM IR (-O2):
@.str = [5 x i8] c">>> \00"
@.str.1 = [3 x i8] c"\\t\00"
@.str.2 = [3 x i8] c"\\b\00"
@.str.3 = [3 x i8] c"\\\\\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %21, %2
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = tail call signext i8 (...) @getchar()
%6 = icmp eq i8 %5, 10
br i1 %6, label %21, label %7
7: ; preds = %3, %18
%8 = phi i8 [ %19, %18 ], [ %5, %3 ]
%9 = sext i8 %8 to i32
switch i32 %9, label %16 [
i32 9, label %10
i32 8, label %12
i32 92, label %14
]
10: ; preds = %7
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %18
12: ; preds = %7
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %18
14: ; preds = %7
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %18
16: ; preds = %7
%17 = tail call i32 @putchar(i8 signext %8)
br label %18
18: ; preds = %16, %14, %12, %10
%19 = tail call signext i8 (...) @getchar()
%20 = icmp eq i8 %19, 10
br i1 %20, label %21, label %7
21: ; preds = %18, %3
%22 = tail call i32 @putchar(i8 signext 10)
br label %3
}