#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 /*<<< orphan*/ fflush(int /*<<< orphan*/);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void ReadWord(char *word, FILE *fin, int MAX_STRING) {
  int a = 0, ch;
  while (!feof(fin)) {
    ch = fgetc(fin);
    if (ch == 13)
      continue;
    if ((ch == ' ') || (ch == '\t') || (ch == '\n')) {
      if (a > 0)
        break;
      else
        continue;
    }
    if (ch < 33 && ch > 126)
      continue;
    word[a] = ch;
    a++;
    if (a >= MAX_STRING - 2) {
      a--;
    }
  }
  if (a == 0) {
    printf("none words\n");
    word[a] = '@';
    a++;
    fflush(stdout);
  }
  word[a] = 0;
}


x86 assembly (clang, -O0):
<ReadWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1178 <ReadWord+0x38>
jmp    1216 <ReadWord+0xd6>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xd,-0x1c(%rbp)
jne    1193 <ReadWord+0x53>
jmp    115a <ReadWord+0x1a>
cmpl   $0x20,-0x1c(%rbp)
je     11b1 <ReadWord+0x71>
cmpl   $0x9,-0x1c(%rbp)
je     11b1 <ReadWord+0x71>
cmpl   $0xa,-0x1c(%rbp)
jne    11c5 <ReadWord+0x85>
cmpl   $0x0,-0x18(%rbp)
jle    11c0 <ReadWord+0x80>
jmp    1216 <ReadWord+0xd6>
jmp    115a <ReadWord+0x1a>
cmpl   $0x21,-0x1c(%rbp)
jge    11de <ReadWord+0x9e>
cmpl   $0x7e,-0x1c(%rbp)
jle    11de <ReadWord+0x9e>
jmp    115a <ReadWord+0x1a>
mov    -0x1c(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jl     1211 <ReadWord+0xd1>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    115a <ReadWord+0x1a>
cmpl   $0x0,-0x18(%rbp)
jne    124f <ReadWord+0x10f>
lea    0xdd9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x40,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    0x2d98(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadWord>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %rdi,%r15
mov    %rsi,%rdi
call   1050 <feof@plt>
test   %eax,%eax
je     1192 <ReadWord+0x52>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
movb   $0x40,(%r15)
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    $0x1,%ebx
movslq %ebx,%rax
movb   $0x0,(%r15,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0xfffffffe,%r14d
xor    %ebx,%ebx
jmp    11b0 <ReadWord+0x70>
nopw   0x0(%rax,%rax,1)
test   %ebx,%ebx
jg     117f <ReadWord+0x3f>
mov    %rbp,%rdi
call   1050 <feof@plt>
test   %eax,%eax
jne    11dc <ReadWord+0x9c>
mov    %rbp,%rdi
call   1040 <fgetc@plt>
lea    -0x9(%rax),%ecx
cmp    $0x2,%ecx
jb     11a0 <ReadWord+0x60>
cmp    $0xd,%eax
je     11a4 <ReadWord+0x64>
cmp    $0x20,%eax
je     11a0 <ReadWord+0x60>
movslq %ebx,%rcx
mov    %al,(%r15,%rcx,1)
lea    0x1(%rbx),%eax
cmp    %r14d,%eax
cmovl  %eax,%ebx
jmp    11a4 <ReadWord+0x64>
test   %ebx,%ebx
jne    117f <ReadWord+0x3f>
jmp    115c <ReadWord+0x1c>

LLVM IR (-O0):
@.str = [12 x i8] c"none words\0A\00"
@stdout = global i32 0
define void @ReadWord(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %57, %40, %33, %19, %3
%10 = load i32*, i32** %5
%11 = call i32 @feof(i32* %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
br i1 %13, label %14, label %58
14: ; preds = %9
%15 = load i32*, i32** %5
%16 = call i32 @fgetc(i32* %15)
store i32 %16, i32* %8
%17 = load i32, i32* %8
%18 = icmp eq i32 %17, 13
br i1 %18, label %19, label %20
19: ; preds = %14
br label %9
20: ; preds = %14
%21 = load i32, i32* %8
%22 = icmp eq i32 %21, 32
br i1 %22, label %29, label %23
23: ; preds = %20
%24 = load i32, i32* %8
%25 = icmp eq i32 %24, 9
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load i32, i32* %8
%28 = icmp eq i32 %27, 10
br i1 %28, label %29, label %34
29: ; preds = %26, %23, %20
%30 = load i32, i32* %7
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %29
br label %58
33: ; preds = %29
br label %9
34: ; preds = %26
%35 = load i32, i32* %8
%36 = icmp slt i32 %35, 33
br i1 %36, label %37, label %41
37: ; preds = %34
%38 = load i32, i32* %8
%39 = icmp sgt i32 %38, 126
br i1 %39, label %40, label %41
40: ; preds = %37
br label %9
41: ; preds = %37, %34
%42 = load i32, i32* %8
%43 = trunc i32 %42 to i8
%44 = load i8*, i8** %4
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
store i8 %43, i8* %47
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
%50 = load i32, i32* %7
%51 = load i32, i32* %6
%52 = sub nsw i32 %51, 2
%53 = icmp sge i32 %50, %52
br i1 %53, label %54, label %57
54: ; preds = %41
%55 = load i32, i32* %7
%56 = add nsw i32 %55, -1
store i32 %56, i32* %7
br label %57
57: ; preds = %54, %41
br label %9
58: ; preds = %32, %9
%59 = load i32, i32* %7
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %71
61: ; preds = %58
%62 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%63 = load i8*, i8** %4
%64 = load i32, i32* %7
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %63, i64 %65
store i8 64, i8* %66
%67 = load i32, i32* %7
%68 = add nsw i32 %67, 1
store i32 %68, i32* %7
%69 = load i32, i32* @stdout
%70 = call i32 @fflush(i32 %69)
br label %71
71: ; preds = %61, %58
%72 = load i8*, i8** %4
%73 = load i32, i32* %7
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8, i8* %72, i64 %74
store i8 0, i8* %75
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@str = [11 x i8] c"none words\00"
define void @ReadWord(i8* nocapture writeonly %0, i32* nocapture %1, i32 %2) {
%4 = tail call i32 @feof(i32* %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %29
6: ; preds = %3
%7 = add nsw i32 %2, -2
br label %8
8: ; preds = %6, %17
%9 = phi i32 [ 0, %6 ], [ %23, %17 ]
%10 = icmp sgt i32 %9, 0
br label %11
11: ; preds = %8, %14
%12 = tail call i32 @fgetc(i32* %1)
switch i32 %12, label %17 [
i32 13, label %14
i32 32, label %13
i32 10, label %13
i32 9, label %13
]
13: ; preds = %11, %11, %11
br i1 %10, label %33, label %14
14: ; preds = %13, %11
%15 = tail call i32 @feof(i32* %1)
%16 = icmp eq i32 %15, 0
br i1 %16, label %11, label %26
17: ; preds = %11
%18 = trunc i32 %12 to i8
%19 = sext i32 %9 to i64
%20 = getelementptr inbounds i8, i8* %0, i64 %19
store i8 %18, i8* %20
%21 = add nsw i32 %9, 1
%22 = icmp slt i32 %21, %7
%23 = select i1 %22, i32 %21, i32 %9
%24 = tail call i32 @feof(i32* %1)
%25 = icmp eq i32 %24, 0
br i1 %25, label %8, label %26
26: ; preds = %17, %14
%27 = phi i32 [ %9, %14 ], [ %23, %17 ]
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %3, %26
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
store i8 64, i8* %0
%31 = load i32, i32* @stdout
%32 = tail call i32 @fflush(i32 %31)
br label %33
33: ; preds = %13, %29, %26
%34 = phi i32 [ 1, %29 ], [ %27, %26 ], [ %9, %13 ]
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %0, i64 %35
store i8 0, i8* %36
ret void
}