#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 EXIT_SUCCESS;
int getchar();
scalar_t__ isprint(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int original_char, new_char;
  while ((original_char = getchar()) != EOF) {
    new_char = original_char ^ '\\';
    if (isprint(original_char) && isprint(new_char))
      printf("%c", new_char);
    else
      printf("%c", original_char);
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e98(%rip),%rcx
cmp    (%rcx),%eax
je     11ad <main+0x7d>
mov    -0x8(%rbp),%eax
xor    $0x5c,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <isprint@plt>
cmp    $0x0,%rax
je     1199 <main+0x69>
mov    -0xc(%rbp),%edi
call   1050 <isprint@plt>
cmp    $0x0,%rax
je     1199 <main+0x69>
mov    -0xc(%rbp),%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
jmp    11a8 <main+0x78>
mov    -0x8(%rbp),%esi
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0xf>
mov    0x2e24(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2ea3(%rip),%r15
cmp    (%r15),%eax
jne    115e <main+0x2e>
mov    0x2e87(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
lea    0xe99(%rip),%r14
jmp    118a <main+0x5a>
nopl   0x0(%rax)
mov    %ebx,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r15),%eax
je     114a <main+0x1a>
mov    %ebx,%edi
call   1050 <isprint@plt>
test   %rax,%rax
je     1170 <main+0x40>
mov    %ebx,%ebp
xor    $0x5c,%ebp
mov    %ebp,%edi
call   1050 <isprint@plt>
test   %rax,%rax
jne    1172 <main+0x42>
jmp    1170 <main+0x40>

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

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