#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int getc(int /*<<< orphan*/ *);
scalar_t__ isascii(int);
scalar_t__ isprint(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(int);
void vis(FILE *fp, int strip) {
  int c;
  while ((c = getc(fp)) != EOF)
    if (isascii(c) && (isprint(c) || c == '\n' || c == '\t' || c == ' '))
      putchar(c);
    else if (!strip)
      printf("\\%03o", c);
}


x86 assembly (clang, -O0):
<vis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <getc@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e76(%rip),%rcx
cmp    (%rcx),%eax
je     11ec <vis+0x9c>
mov    -0x10(%rbp),%edi
call   1060 <isascii@plt>
cmp    $0x0,%rax
je     11c9 <vis+0x79>
mov    -0x10(%rbp),%edi
call   1050 <isprint@plt>
cmp    $0x0,%rax
jne    11bc <vis+0x6c>
cmpl   $0xa,-0x10(%rbp)
je     11bc <vis+0x6c>
cmpl   $0x9,-0x10(%rbp)
je     11bc <vis+0x6c>
cmpl   $0x20,-0x10(%rbp)
jne    11c9 <vis+0x79>
mov    -0x10(%rbp),%edi
call   1030 <putchar@plt>
jmp    11e7 <vis+0x97>
cmpl   $0x0,-0xc(%rbp)
jne    11e2 <vis+0x92>
mov    -0x10(%rbp),%esi
lea    0xe23(%rip),%rdi
call   1040 <printf@plt>
jmp    11e7 <vis+0x97>
jmp    115f <vis+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vis>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%rbx
call   1070 <getc@plt>
mov    0x2e7b(%rip),%r12
cmp    (%r12),%eax
jne    1182 <vis+0x32>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
lea    0xe75(%rip),%r14
movabs $0x100000600,%r13
jmp    11b7 <vis+0x67>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1070 <getc@plt>
mov    %eax,%ebp
cmp    (%r12),%eax
je     1173 <vis+0x23>
mov    %ebp,%edi
call   1060 <isascii@plt>
test   %rax,%rax
je     11e0 <vis+0x90>
mov    %ebp,%edi
call   1050 <isprint@plt>
test   %rax,%rax
jne    11a0 <vis+0x50>
cmp    $0x20,%ebp
ja     11e0 <vis+0x90>
mov    %ebp,%eax
bt     %rax,%r13
jb     11a0 <vis+0x50>
nopl   0x0(%rax)
test   %r15d,%r15d
jne    11a7 <vis+0x57>
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
jmp    11a7 <vis+0x57>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [6 x i8] c"\\%03o\00"
define void @vis(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
br label %6
6: ; preds = %38, %2
%7 = load i32*, i32** %3
%8 = call i32 @getc(i32* %7)
store i32 %8, i32* %5
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %39
11: ; preds = %6
%12 = load i32, i32* %5
%13 = call i64 @isascii(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = load i32, i32* %5
%17 = call i64 @isprint(i32 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %28, label %19
19: ; preds = %15
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, 10
br i1 %21, label %28, label %22
22: ; preds = %19
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 9
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* %5
%27 = icmp eq i32 %26, 32
br i1 %27, label %28, label %31
28: ; preds = %25, %22, %19, %15
%29 = load i32, i32* %5
%30 = call i32 @putchar(i32 %29)
br label %38
31: ; preds = %25, %11
%32 = load i32, i32* %4
%33 = icmp ne i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %31
%35 = load i32, i32* %5
%36 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %34, %31
br label %38
38: ; preds = %37, %28
br label %6
39: ; preds = %6
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [6 x i8] c"\\%03o\00"
define void @vis(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @getc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %26, label %6
6: ; preds = %2
%7 = icmp eq i32 %1, 0
br label %8
8: ; preds = %6, %22
%9 = phi i32 [ %3, %6 ], [ %23, %22 ]
%10 = tail call i64 @isascii(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %8
%13 = tail call i64 @isprint(i32 %9)
%14 = freeze i64 %13
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
switch i32 %9, label %19 [
i32 32, label %17
i32 10, label %17
i32 9, label %17
]
17: ; preds = %16, %16, %16, %12
%18 = tail call i32 @putchar(i32 %9)
br label %22
19: ; preds = %16, %8
br i1 %7, label %20, label %22
20: ; preds = %19
%21 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %22
22: ; preds = %19, %20, %17
%23 = tail call i32 @getc(i32* %0)
%24 = load i32, i32* @EOF
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %8
26: ; preds = %22, %2
ret void
}