#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 */
char EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
scalar_t__ ispunct(char);
int main(void) {
  char c;
  FILE *fp = fopen("big1.txt", "r");
  FILE *fr = fopen("words.txt", "w");
  while ((c = fgetc(fp)) != EOF) {
    if (ispunct(c) && c != '\'')
      continue;
    else
      fputc(c, fr);
  }
  fclose(fp);
  fclose(fr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe8e(%rip),%rdi
lea    0xe91(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e45(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11e7 <main+0x97>
movsbl -0x5(%rbp),%edi
call   1050 <ispunct@plt>
cmp    $0x0,%rax
je     11d3 <main+0x83>
movsbl -0x5(%rbp),%eax
cmp    $0x27,%eax
je     11d3 <main+0x83>
jmp    118d <main+0x3d>
mov    -0x5(%rbp),%al
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1060 <fputc@plt>
jmp    118d <main+0x3d>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xea2(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xe97(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <fgetc@plt>
mov    0x2e56(%rip),%r15
jmp    11b2 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    (%r15),%al
je     11ce <main+0x7e>
movsbl %al,%ebp
mov    %ebp,%edi
call   1050 <ispunct@plt>
cmp    $0x27,%bpl
je     11a0 <main+0x50>
test   %rax,%rax
jne    11aa <main+0x5a>
jmp    11a0 <main+0x50>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"big1.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"words.txt\00"
@.str.3 = [2 x i8] c"w\00"
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %3
%6 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %6, i32** %4
br label %7
7: ; preds = %27, %22, %0
%8 = load i32*, i32** %3
%9 = call signext i8 @fgetc(i32* %8)
store i8 %9, i8* %2
%10 = sext i8 %9 to i32
%11 = load i8, i8* @EOF
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %10, %12
br i1 %13, label %14, label %28
14: ; preds = %7
%15 = load i8, i8* %2
%16 = call i64 @ispunct(i8 signext %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 39
br i1 %21, label %22, label %23
22: ; preds = %18
br label %7
23: ; preds = %18, %14
%24 = load i8, i8* %2
%25 = load i32*, i32** %4
%26 = call i32 @fputc(i8 signext %24, i32* %25)
br label %27
27: ; preds = %23
br label %7
28: ; preds = %7
%29 = load i32*, i32** %3
%30 = call i32 @fclose(i32* %29)
%31 = load i32*, i32** %4
%32 = call i32 @fclose(i32* %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"big1.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"words.txt\00"
@.str.3 = [2 x i8] c"w\00"
@EOF = global i8 0
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call signext i8 @fgetc(i32* %1)
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %3, %4
br i1 %5, label %18, label %6
6: ; preds = %0, %14
%7 = phi i8 [ %15, %14 ], [ %3, %0 ]
%8 = tail call i64 @ispunct(i8 signext %7)
%9 = icmp ne i64 %8, 0
%10 = icmp ne i8 %7, 39
%11 = and i1 %10, %9
br i1 %11, label %14, label %12
12: ; preds = %6
%13 = tail call i32 @fputc(i8 signext %7, i32* %2)
br label %14
14: ; preds = %12, %6
%15 = tail call signext i8 @fgetc(i32* %1)
%16 = load i8, i8* @EOF
%17 = icmp eq i8 %15, %16
br i1 %17, label %18, label %6
18: ; preds = %14, %0
%19 = tail call i32 @fclose(i32* %1)
%20 = tail call i32 @fclose(i32* %2)
ret i32 0
}