#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 /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ isgraph(int);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
void VFilterAscii(FILE *fp_in, FILE *fp_out) {
  int buf;
  rewind(fp_in);
  rewind(fp_out);
  while (!feof(fp_in)) {
    buf = fgetc(fp_in);
    if ((!isgraph(buf)) && (buf != '\n') && (buf != '\r') && (buf != '\0')) {
      buf = ' ';
    }
    if (buf == '\v')
      buf = ' ';
    if (buf == '\t')
      buf = ' ';
    fputc(buf, fp_out);
  }
  return;
}


x86 assembly (clang, -O0):
<VFilterAscii>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rewind@plt>
mov    -0x10(%rbp),%rdi
call   1030 <rewind@plt>
mov    -0x8(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1190 <VFilterAscii+0x40>
jmp    1205 <VFilterAscii+0xb5>
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <isgraph@plt>
cmp    $0x0,%eax
jne    11d2 <VFilterAscii+0x82>
cmpl   $0xa,-0x14(%rbp)
je     11d2 <VFilterAscii+0x82>
cmpl   $0xd,-0x14(%rbp)
je     11d2 <VFilterAscii+0x82>
cmpl   $0x0,-0x14(%rbp)
je     11d2 <VFilterAscii+0x82>
movl   $0x20,-0x14(%rbp)
cmpl   $0xb,-0x14(%rbp)
jne    11e3 <VFilterAscii+0x93>
movl   $0x20,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jne    11f4 <VFilterAscii+0xa4>
movl   $0x20,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <fputc@plt>
jmp    1172 <VFilterAscii+0x22>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VFilterAscii>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <rewind@plt>
mov    %r14,%rdi
call   1030 <rewind@plt>
jmp    1178 <VFilterAscii+0x28>
nopl   0x0(%rax)
mov    %r14,%rsi
call   1050 <fputc@plt>
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    11cb <VFilterAscii+0x7b>
mov    %rbx,%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1070 <isgraph@plt>
mov    $0x20,%edi
mov    $0x20,%ecx
test   %eax,%eax
je     11a5 <VFilterAscii+0x55>
mov    %ebp,%ecx
cmp    $0xa,%ebp
cmove  %ebp,%ecx
cmp    $0xd,%ebp
cmove  %ebp,%ecx
test   %ebp,%ebp
cmove  %ebp,%ecx
mov    $0x20,%eax
cmp    $0xb,%ecx
je     11c2 <VFilterAscii+0x72>
mov    %ecx,%eax
cmp    $0x9,%eax
je     1170 <VFilterAscii+0x20>
mov    %eax,%edi
jmp    1170 <VFilterAscii+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @VFilterAscii(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = call i32 @rewind(i32* %6)
%8 = load i32*, i32** %4
%9 = call i32 @rewind(i32* %8)
br label %10
10: ; preds = %39, %2
%11 = load i32*, i32** %3
%12 = call i32 @feof(i32* %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %15, label %43
15: ; preds = %10
%16 = load i32*, i32** %3
%17 = call i32 @fgetc(i32* %16)
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = call i32 @isgraph(i32 %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %31, label %21
21: ; preds = %15
%22 = load i32, i32* %5
%23 = icmp ne i32 %22, 10
br i1 %23, label %24, label %31
24: ; preds = %21
%25 = load i32, i32* %5
%26 = icmp ne i32 %25, 13
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* %5
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 32, i32* %5
br label %31
31: ; preds = %30, %27, %24, %21, %15
%32 = load i32, i32* %5
%33 = icmp eq i32 %32, 11
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 32, i32* %5
br label %35
35: ; preds = %34, %31
%36 = load i32, i32* %5
%37 = icmp eq i32 %36, 9
br i1 %37, label %38, label %39
38: ; preds = %35
store i32 32, i32* %5
br label %39
39: ; preds = %38, %35
%40 = load i32, i32* %5
%41 = load i32*, i32** %4
%42 = call i32 @fputc(i32 %40, i32* %41)
br label %10
43: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @VFilterAscii(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call i32 @rewind(i32* %0)
%4 = tail call i32 @rewind(i32* %1)
%5 = tail call i32 @feof(i32* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %25
7: ; preds = %2, %7
%8 = tail call i32 @fgetc(i32* %0)
%9 = tail call i32 @isgraph(i32 %8)
%10 = icmp eq i32 %9, 0
%11 = icmp ne i32 %8, 10
%12 = and i1 %11, %10
%13 = icmp ne i32 %8, 13
%14 = and i1 %13, %12
%15 = icmp ne i32 %8, 0
%16 = and i1 %15, %14
%17 = select i1 %16, i32 32, i32 %8
%18 = icmp eq i32 %17, 11
%19 = select i1 %18, i32 32, i32 %17
%20 = icmp eq i32 %19, 9
%21 = select i1 %20, i32 32, i32 %19
%22 = tail call i32 @fputc(i32 %21, i32* %1)
%23 = tail call i32 @feof(i32* %0)
%24 = icmp eq i32 %23, 0
br i1 %24, label %7, label %25
25: ; preds = %7, %2
ret void
}