#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);
ln_3(void) {
  char c;
  while ((c = getchar()) != EOF) {
    switch (c) {
    case '\t':
      printf("\\t");
      break;
    case '\b':
      printf("\\b");
      break;
    case '\\':
      printf("\\\\");
      break;
    default:
      putchar(c);
    }
  }
}


x86 assembly (clang, -O0):
<ln_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e9c(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11cf <ln_3+0x9f>
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x8,%eax
je     119f <ln_3+0x6f>
jmp    116c <ln_3+0x3c>
mov    -0xc(%rbp),%eax
sub    $0x9,%eax
je     118e <ln_3+0x5e>
jmp    117d <ln_3+0x4d>
mov    -0xc(%rbp),%eax
sub    $0x5c,%eax
je     11b0 <ln_3+0x80>
jmp    11c1 <ln_3+0x91>
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
jmp    11ca <ln_3+0x9a>
lea    0xe5d(%rip),%rdi
call   1040 <printf@plt>
jmp    11ca <ln_3+0x9a>
lea    0xe4f(%rip),%rdi
call   1040 <printf@plt>
jmp    11ca <ln_3+0x9a>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    1138 <ln_3+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln_3>:
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    1156 <ln_3+0x26>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xea6(%rip),%r14
lea    0xea2(%rip),%r12
lea    0xe95(%rip),%r15
jmp    1183 <ln_3+0x53>
nopl   (%rax)
mov    %r12,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%al
je     114a <ln_3+0x1a>
movsbl %al,%edi
cmp    $0x8,%edi
je     11a0 <ln_3+0x70>
cmp    $0x5c,%edi
je     1170 <ln_3+0x40>
cmp    $0x9,%edi
jne    11b0 <ln_3+0x80>
mov    %r15,%rdi
jmp    1173 <ln_3+0x43>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
jmp    1173 <ln_3+0x43>
cs nopw 0x0(%rax,%rax,1)
nop
call   1030 <putchar@plt>
jmp    1178 <ln_3+0x48>

LLVM IR (-O0):
@EOF = global i8 0
@.str = [3 x i8] c"\\t\00"
@.str.1 = [3 x i8] c"\\b\00"
@.str.2 = [3 x i8] c"\\\\\00"
define i32 @ln_3() {
%1 = alloca i32
%2 = alloca i8
br label %3
3: ; preds = %21, %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 %22
9: ; preds = %3
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
switch i32 %11, label %18 [
i32 9, label %12
i32 8, label %14
i32 92, label %16
]
12: ; preds = %9
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %21
14: ; preds = %9
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %21
16: ; preds = %9
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %21
18: ; preds = %9
%19 = load i8, i8* %2
%20 = call i32 @putchar(i8 signext %19)
br label %21
21: ; preds = %18, %16, %14, %12
br label %3
22: ; preds = %3
%23 = load i32, i32* %1
ret i32 %23
}

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