#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 /*<<< orphan*/ EXIT_SUCCESS;
char *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ PROT_READ;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
size_t get_file_size(char *);
int /*<<< orphan*/ isalpha(char);
int /*<<< orphan*/ isspace(char);
char *mmap(int /*<<< orphan*/ *, size_t, int /*<<< orphan*/, int /*<<< orphan*/,
           int, int /*<<< orphan*/);
int /*<<< orphan*/ munmap(char *, size_t);
int open(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ write(int, char *, size_t);
int main(int argc, char **argv) {
  int fd;
  int i;
  size_t file_size;
  char *projection;
  file_size = get_file_size(argv[1]);
  fd = open(argv[1], O_RDONLY, 0);
  projection = mmap(NULL, file_size, PROT_READ, MAP_SHARED, fd, 0);
  assert(projection != MAP_FAILED);
  write(1, projection, file_size);
  for (i = 0; i < file_size; i++) {
    char c;
    c = projection[i];
    printf("%c", c);
    if (!isalpha(c) && !isspace(c)) {
      putchar(c);
    }
    if (i % 80 == 79) {
      putchar('\n');
    }
  }
  munmap(projection, file_size);
  close(fd);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10c0 <get_file_size@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2de2(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10d0 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rsi
mov    0x2deb(%rip),%rax
mov    (%rax),%edx
mov    0x2dd2(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2d89(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x1,%edi
call   1040 <write@plt>
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    12ea <main+0x12a>
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x29(%rbp)
lea    0xd7d(%rip),%rdi
movsbl -0x29(%rbp),%esi
call   1060 <printf@plt>
movsbl -0x29(%rbp),%edi
call   10a0 <isalpha@plt>
cmp    $0x0,%eax
jne    12b9 <main+0xf9>
movsbl -0x29(%rbp),%edi
call   1080 <isspace@plt>
cmp    $0x0,%eax
jne    12b9 <main+0xf9>
movsbl -0x29(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
mov    $0x50,%ecx
cltd
idiv   %ecx
cmp    $0x4f,%edx
jne    12d7 <main+0x117>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    12dc <main+0x11c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1260 <main+0xa0>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10b0 <munmap@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   10c0 <get_file_size@plt>
mov    %rax,%r12
mov    0x8(%rbx),%rdi
mov    0x2df3(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10d0 <open@plt>
mov    %eax,%r8d
mov    0x2e00(%rip),%rax
mov    (%rax),%edx
mov    0x2de7(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r12,%rsi
mov    %r8d,0x4(%rsp)
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    %rax,%r13
mov    0x2da1(%rip),%rax
xor    %edi,%edi
cmp    (%rax),%r13
setne  %dil
call   1090 <assert@plt>
mov    $0x1,%edi
mov    %r13,%rsi
mov    %r12,%rdx
call   1040 <write@plt>
test   %r12,%r12
jne    1264 <main+0xa4>
mov    %r13,%rdi
mov    %r12,%rsi
call   10b0 <munmap@plt>
mov    0x4(%rsp),%edi
call   1070 <close@plt>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
xor    %ebp,%ebp
lea    0xd93(%rip),%r15
jmp    1279 <main+0xb9>
nop
add    $0x1,%rbp
cmp    %rbp,%r12
je     1242 <main+0x82>
mov    %ebp,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x26,%rax
lea    (%rax,%rax,4),%r14d
shl    $0x4,%r14d
add    $0x40,%r14d
or     $0xf,%r14
movsbl 0x0(%r13,%rbp,1),%ebx
mov    %r15,%rdi
mov    %ebx,%esi
call   1060 <printf@plt>
mov    %ebx,%edi
call   10a0 <isalpha@plt>
test   %eax,%eax
jne    12be <main+0xfe>
mov    %ebx,%edi
call   1080 <isspace@plt>
test   %eax,%eax
je     12cf <main+0x10f>
cmp    %ebp,%r14d
jne    1270 <main+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1270 <main+0xb0>
mov    %ebx,%edi
call   1030 <putchar@plt>
cmp    %ebp,%r14d
jne    1270 <main+0xb0>
jmp    12c3 <main+0x103>

LLVM IR (-O0):
@O_RDONLY = global i32 0
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str = [3 x i8] c"%c\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @get_file_size(i8* %13)
store i64 %14, i64* %8
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = load i32, i32* @O_RDONLY
%19 = call i32 @open(i8* %17, i32 %18, i32 0)
store i32 %19, i32* %6
%20 = load i64, i64* %8
%21 = load i32, i32* @PROT_READ
%22 = load i32, i32* @MAP_SHARED
%23 = load i32, i32* %6
%24 = call i8* @mmap(i32* null, i64 %20, i32 %21, i32 %22, i32 %23, i32 0)
store i8* %24, i8** %9
%25 = load i8*, i8** %9
%26 = load i8*, i8** @MAP_FAILED
%27 = icmp ne i8* %25, %26
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = load i8*, i8** %9
%31 = load i64, i64* %8
%32 = call i32 @write(i32 1, i8* %30, i64 %31)
store i32 0, i32* %7
br label %33
33: ; preds = %63, %2
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = load i64, i64* %8
%37 = icmp ult i64 %35, %36
br i1 %37, label %38, label %66
38: ; preds = %33
%39 = load i8*, i8** %9
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
%43 = load i8, i8* %42
store i8 %43, i8* %10
%44 = load i8, i8* %10
%45 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %44)
%46 = load i8, i8* %10
%47 = call i32 @isalpha(i8 signext %46)
%48 = icmp ne i32 %47, 0
br i1 %48, label %56, label %49
49: ; preds = %38
%50 = load i8, i8* %10
%51 = call i32 @isspace(i8 signext %50)
%52 = icmp ne i32 %51, 0
br i1 %52, label %56, label %53
53: ; preds = %49
%54 = load i8, i8* %10
%55 = call i32 @putchar(i8 signext %54)
br label %56
56: ; preds = %53, %49, %38
%57 = load i32, i32* %7
%58 = srem i32 %57, 80
%59 = icmp eq i32 %58, 79
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = call i32 @putchar(i8 signext 10)
br label %62
62: ; preds = %60, %56
br label %63
63: ; preds = %62
%64 = load i32, i32* %7
%65 = add nsw i32 %64, 1
store i32 %65, i32* %7
br label %33
66: ; preds = %33
%67 = load i8*, i8** %9
%68 = load i64, i64* %8
%69 = call i32 @munmap(i8* %67, i64 %68)
%70 = load i32, i32* %6
%71 = call i32 @close(i32 %70)
%72 = load i32, i32* @EXIT_SUCCESS
%73 = call i32 @exit(i32 %72)
unreachable
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str = [3 x i8] c"%c\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @get_file_size(i8* %4)
%6 = load i8*, i8** %3
%7 = load i32, i32* @O_RDONLY
%8 = tail call i32 @open(i8* %6, i32 %7, i32 0)
%9 = load i32, i32* @PROT_READ
%10 = load i32, i32* @MAP_SHARED
%11 = tail call i8* @mmap(i32* null, i64 %5, i32 %9, i32 %10, i32 %8, i32 0)
%12 = load i8*, i8** @MAP_FAILED
%13 = icmp ne i8* %11, %12
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call i32 @write(i32 1, i8* %11, i64 %5)
%17 = icmp eq i64 %5, 0
br i1 %17, label %39, label %18
18: ; preds = %2, %36
%19 = phi i64 [ %37, %36 ], [ 0, %2 ]
%20 = getelementptr inbounds i8, i8* %11, i64 %19
%21 = load i8, i8* %20
%22 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %21)
%23 = tail call i32 @isalpha(i8 signext %21)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %18
%26 = tail call i32 @isspace(i8 signext %21)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 @putchar(i8 signext %21)
br label %30
30: ; preds = %28, %25, %18
%31 = trunc i64 %19 to i32
%32 = urem i32 %31, 80
%33 = icmp eq i32 %32, 79
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = tail call i32 @putchar(i8 signext 10)
br label %36
36: ; preds = %34, %30
%37 = add nuw i64 %19, 1
%38 = icmp eq i64 %37, %5
br i1 %38, label %39, label %18
39: ; preds = %36, %2
%40 = tail call i32 @munmap(i8* %11, i64 %5)
%41 = tail call i32 @close(i32 %8)
%42 = load i32, i32* @EXIT_SUCCESS
%43 = tail call i32 @exit(i32 %42)
unreachable
}