#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 getchar();
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ putchar(int);
int main(void) {
  int c, prev_esc = 0;
  while (EOF != (c = getchar())) {
    if ((c & 0x80) ||
        (!(c & ~0x1f) && ('\r' != c) && ('\n' != c) && ('\t' != c)) ||
        (prev_esc && (c >= '0') && (c <= '7'))) {
      printf("\\%d%d%d", (c >> 6), 7 & (c >> 3), 7 & c);
      prev_esc = 1;
    } else {
      putchar(c);
      prev_esc = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
mov    %ecx,-0x8(%rbp)
cmp    %ecx,%eax
je     1212 <main+0xe2>
mov    -0x8(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    11d1 <main+0xa1>
mov    -0x8(%rbp),%eax
and    $0xffffffe0,%eax
cmp    $0x0,%eax
jne    11b3 <main+0x83>
mov    $0xd,%eax
cmp    -0x8(%rbp),%eax
je     11b3 <main+0x83>
mov    $0xa,%eax
cmp    -0x8(%rbp),%eax
je     11b3 <main+0x83>
mov    $0x9,%eax
cmp    -0x8(%rbp),%eax
jne    11d1 <main+0xa1>
cmpl   $0x0,-0xc(%rbp)
je     11fe <main+0xce>
cmpl   $0x30,-0x8(%rbp)
jl     11fe <main+0xce>
cmpl   $0x37,-0x8(%rbp)
jg     11fe <main+0xce>
mov    -0x8(%rbp),%esi
sar    $0x6,%esi
mov    -0x8(%rbp),%edx
sar    $0x3,%edx
and    $0x7,%edx
mov    -0x8(%rbp),%ecx
and    $0x7,%ecx
lea    0xe13(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
jmp    120d <main+0xdd>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2ea9(%rip),%r12
mov    (%r12),%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    %eax,%ebp
jne    1159 <main+0x29>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x2600,%r15d
lea    0xe9a(%rip),%r14
xor    %ebp,%ebp
jmp    119e <main+0x6e>
nopw   0x0(%rax,%rax,1)
mov    %eax,%esi
sar    $0x6,%esi
mov    %eax,%edx
shr    $0x3,%edx
and    $0x7,%edx
and    $0x7,%eax
mov    %r14,%rdi
mov    %eax,%ecx
call   1040 <printf@plt>
mov    $0x1,%ebp
mov    (%r12),%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    %eax,%ebx
je     114e <main+0x1e>
test   $0x80,%al
jne    1170 <main+0x40>
cmp    $0x1f,%eax
ja     11b2 <main+0x82>
cmp    $0xd,%eax
ja     1170 <main+0x40>
bt     %eax,%r15d
jae    1170 <main+0x40>
test   %ebp,%ebp
je     11c0 <main+0x90>
mov    %eax,%ecx
and    $0xfffffff8,%ecx
cmp    $0x30,%ecx
je     1170 <main+0x40>
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
jmp    118f <main+0x5f>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [8 x i8] c"\\%d%d%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %46, %0
%5 = load i32, i32* @EOF
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %47
8: ; preds = %4
%9 = load i32, i32* %2
%10 = and i32 %9, 128
%11 = icmp ne i32 %10, 0
br i1 %11, label %34, label %12
12: ; preds = %8
%13 = load i32, i32* %2
%14 = and i32 %13, -32
%15 = icmp ne i32 %14, 0
br i1 %15, label %25, label %16
16: ; preds = %12
%17 = load i32, i32* %2
%18 = icmp ne i32 13, %17
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i32, i32* %2
%21 = icmp ne i32 10, %20
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %2
%24 = icmp ne i32 9, %23
br i1 %24, label %34, label %25
25: ; preds = %22, %19, %16, %12
%26 = load i32, i32* %3
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %43
28: ; preds = %25
%29 = load i32, i32* %2
%30 = icmp sge i32 %29, 48
br i1 %30, label %31, label %43
31: ; preds = %28
%32 = load i32, i32* %2
%33 = icmp sle i32 %32, 55
br i1 %33, label %34, label %43
34: ; preds = %31, %22, %8
%35 = load i32, i32* %2
%36 = ashr i32 %35, 6
%37 = load i32, i32* %2
%38 = ashr i32 %37, 3
%39 = and i32 7, %38
%40 = load i32, i32* %2
%41 = and i32 7, %40
%42 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %36, i32 %39, i32 %41)
store i32 1, i32* %3
br label %46
43: ; preds = %31, %28, %25
%44 = load i32, i32* %2
%45 = call i32 @putchar(i32 %44)
store i32 0, i32* %3
br label %46
46: ; preds = %43, %34
br label %4
47: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [8 x i8] c"\\%d%d%d\00"
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = tail call i32 (...) @getchar()
%3 = icmp eq i32 %1, %2
br i1 %3, label %30, label %4
4: ; preds = %0, %25
%5 = phi i32 [ %28, %25 ], [ %2, %0 ]
%6 = phi i32 [ %26, %25 ], [ 0, %0 ]
%7 = and i32 %5, 128
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %4
%10 = icmp ult i32 %5, 32
br i1 %10, label %11, label %12
11: ; preds = %9
switch i32 %5, label %17 [
i32 13, label %12
i32 10, label %12
i32 9, label %12
]
12: ; preds = %11, %11, %11, %9
%13 = icmp ne i32 %6, 0
%14 = and i32 %5, -8
%15 = icmp eq i32 %14, 48
%16 = and i1 %13, %15
br i1 %16, label %17, label %23
17: ; preds = %11, %12, %4
%18 = ashr i32 %5, 6
%19 = lshr i32 %5, 3
%20 = and i32 %19, 7
%21 = and i32 %5, 7
%22 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %20, i32 %21)
br label %25
23: ; preds = %12
%24 = tail call i32 @putchar(i32 %5)
br label %25
25: ; preds = %23, %17
%26 = phi i32 [ 1, %17 ], [ 0, %23 ]
%27 = load i32, i32* @EOF
%28 = tail call i32 (...) @getchar()
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %4
30: ; preds = %25, %0
ret i32 0
}