#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 ReadWord(char *word, FILE *fin) {
  int a = 0, ch = 0;
  while (!feof(fin)) {
    ch = fgetc(fin);
    if (ch == 13)
      continue;
    if ((ch == ' ') || (ch == '\t') || (ch == '\n')) {
      if (a > 0)
        break;
      else
        continue;
    }
    word[a] = ch;
    a++;
    if (a >= 100 - 1)
      a--;
  }
  word[a] = '\0';
  return ch;
}


x86 assembly (clang, -O0):
<ReadWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    115c <ReadWord+0x3c>
jmp    11da <ReadWord+0xba>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xd,-0x18(%rbp)
jne    1177 <ReadWord+0x57>
jmp    113e <ReadWord+0x1e>
cmpl   $0x20,-0x18(%rbp)
je     1195 <ReadWord+0x75>
cmpl   $0x9,-0x18(%rbp)
je     1195 <ReadWord+0x75>
cmpl   $0xa,-0x18(%rbp)
jne    11a9 <ReadWord+0x89>
cmpl   $0x0,-0x14(%rbp)
jle    11a4 <ReadWord+0x84>
jmp    11da <ReadWord+0xba>
jmp    113e <ReadWord+0x1e>
mov    -0x18(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x63,-0x14(%rbp)
jl     11d5 <ReadWord+0xb5>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    113e <ReadWord+0x1e>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadWord>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <feof@plt>
xor    %ebp,%ebp
mov    $0x0,%ebx
test   %eax,%eax
je     1155 <ReadWord+0x35>
movslq %ebp,%rax
movb   $0x0,(%r14,%rax,1)
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
jmp    1170 <ReadWord+0x50>
nopl   0x0(%rax)
test   %ebp,%ebp
jne    1140 <ReadWord+0x20>
mov    %r15,%rdi
call   1040 <feof@plt>
test   %eax,%eax
jne    1140 <ReadWord+0x20>
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebx
lea    -0x9(%rbx),%eax
cmp    $0x2,%eax
jb     1160 <ReadWord+0x40>
cmp    $0xd,%ebx
je     1164 <ReadWord+0x44>
cmp    $0x20,%ebx
je     1160 <ReadWord+0x40>
mov    %ebp,%eax
mov    %bl,(%r14,%rax,1)
cmp    $0x62,%ebp
adc    $0x0,%ebp
jmp    1164 <ReadWord+0x44>

LLVM IR (-O0):
define i32 @ReadWord(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %46, %31, %17, %2
%8 = load i32*, i32** %4
%9 = call i32 @feof(i32* %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br i1 %11, label %12, label %47
12: ; preds = %7
%13 = load i32*, i32** %4
%14 = call i32 @fgetc(i32* %13)
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 13
br i1 %16, label %17, label %18
17: ; preds = %12
br label %7
18: ; preds = %12
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 32
br i1 %20, label %27, label %21
21: ; preds = %18
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 9
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 10
br i1 %26, label %27, label %32
27: ; preds = %24, %21, %18
%28 = load i32, i32* %5
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %27
br label %47
31: ; preds = %27
br label %7
32: ; preds = %24
%33 = load i32, i32* %6
%34 = trunc i32 %33 to i8
%35 = load i8*, i8** %3
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
store i8 %34, i8* %38
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
%41 = load i32, i32* %5
%42 = icmp sge i32 %41, 99
br i1 %42, label %43, label %46
43: ; preds = %32
%44 = load i32, i32* %5
%45 = add nsw i32 %44, -1
store i32 %45, i32* %5
br label %46
46: ; preds = %43, %32
br label %7
47: ; preds = %30, %7
%48 = load i8*, i8** %3
%49 = load i32, i32* %5
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
store i8 0, i8* %51
%52 = load i32, i32* %6
ret i32 %52
}

LLVM IR (-O2):
define i32 @ReadWord(i8* nocapture writeonly %0, i32* nocapture %1) {
%3 = tail call i32 @feof(i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %23
5: ; preds = %2, %14
%6 = phi i32 [ %20, %14 ], [ 0, %2 ]
%7 = icmp eq i32 %6, 0
br label %8
8: ; preds = %5, %11
%9 = tail call i32 @fgetc(i32* %1)
switch i32 %9, label %14 [
i32 13, label %11
i32 32, label %10
i32 10, label %10
i32 9, label %10
]
10: ; preds = %8, %8, %8
br i1 %7, label %11, label %23
11: ; preds = %10, %8
%12 = tail call i32 @feof(i32* %1)
%13 = icmp eq i32 %12, 0
br i1 %13, label %8, label %23
14: ; preds = %8
%15 = trunc i32 %9 to i8
%16 = zext i32 %6 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 %15, i8* %17
%18 = icmp ult i32 %6, 98
%19 = zext i1 %18 to i32
%20 = add nuw nsw i32 %6, %19
%21 = tail call i32 @feof(i32* %1)
%22 = icmp eq i32 %21, 0
br i1 %22, label %5, label %23
23: ; preds = %14, %11, %10, %2
%24 = phi i32 [ 0, %2 ], [ %6, %10 ], [ %6, %11 ], [ %20, %14 ]
%25 = phi i32 [ 0, %2 ], [ %9, %10 ], [ %9, %11 ], [ %9, %14 ]
%26 = sext i32 %24 to i64
%27 = getelementptr inbounds i8, i8* %0, i64 %26
store i8 0, i8* %27
ret i32 %25
}