#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 getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
int main(void) {
  int ret = 0;
  int c = 0;
  printf("This program make tabs and backspaces visible in an unambiguos "
         "way.\nPress q to quit writing.\n");
  while ((c = getchar()) != 'q') {
    if (c == '\t') {
      putchar('\\');
      putchar('t');
    } else {
      if (c == '\b') {
        putchar('\\');
        putchar('b');
      } else {
        if (c == '\\') {
          putchar('\\');
          putchar('\\');
        } else {
          putchar(c);
        }
      }
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x71,%eax
je     11ec <main+0xbc>
cmpl   $0x9,-0xc(%rbp)
jne    118f <main+0x5f>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x74,%edi
call   1030 <putchar@plt>
jmp    11e7 <main+0xb7>
cmpl   $0x8,-0xc(%rbp)
jne    11b2 <main+0x82>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x62,%edi
call   1030 <putchar@plt>
jmp    11e2 <main+0xb2>
cmpl   $0x5c,-0xc(%rbp)
jne    11d5 <main+0xa5>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x5c,%edi
call   1030 <putchar@plt>
jmp    11dd <main+0xad>
mov    -0xc(%rbp),%edi
call   1030 <putchar@plt>
jmp    11e2 <main+0xb2>
jmp    11e7 <main+0xb7>
jmp    1159 <main+0x29>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
jmp    1158 <main+0x28>
nop
mov    $0x62,%ebx
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x5b,%eax
jg     1180 <main+0x50>
cmp    $0x8,%eax
je     1140 <main+0x10>
mov    $0x74,%ebx
cmp    $0x9,%eax
je     1145 <main+0x15>
jmp    1151 <main+0x21>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x5c,%eax
jne    118c <main+0x5c>
mov    $0x5c,%ebx
jmp    1145 <main+0x15>
cmp    $0x71,%eax
jne    1151 <main+0x21>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [94 x i8] c"This program make tabs and backspaces visible in an unambiguos way.\0APress q to quit writing.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %31, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %3
%7 = icmp ne i32 %6, 113
br i1 %7, label %8, label %32
8: ; preds = %5
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 9
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = call i32 @putchar(i32 92)
%13 = call i32 @putchar(i32 116)
br label %31
14: ; preds = %8
%15 = load i32, i32* %3
%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* %3
%22 = icmp eq i32 %21, 92
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = call i32 @putchar(i32 92)
%25 = call i32 @putchar(i32 92)
br label %29
26: ; preds = %20
%27 = load i32, i32* %3
%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 %5
32: ; preds = %5
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
@str = [93 x i8] c"This program make tabs and backspaces visible in an unambiguos way.\0APress q to quit writing.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %9, %0
%3 = tail call i32 (...) @getchar()
switch i32 %3, label %9 [
i32 113, label %12
i32 9, label %6
i32 8, label %4
i32 92, label %5
]
4: ; preds = %2
br label %6
5: ; preds = %2
br label %6
6: ; preds = %2, %5, %4
%7 = phi i32 [ 92, %5 ], [ 98, %4 ], [ 116, %2 ]
%8 = tail call i32 @putchar(i32 92)
br label %9
9: ; preds = %6, %2
%10 = phi i32 [ %3, %2 ], [ %7, %6 ]
%11 = tail call i32 @putchar(i32 %10)
br label %2
12: ; preds = %2
ret i32 0
}