#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*/ fgets(char *, int, int /*<<< orphan*/ *);
bool getWord(FILE *dictionary, char *word) {
  fgets(word, 45 + 2, dictionary);
  if (!feof(dictionary)) {
    for (int i = 0; word[i] != '\0'; i++) {
      if (word[i] == '\n')
        word[i] = '\0';
    }
    return true;
  } else
    return false;
}


x86 assembly (clang, -O0):
<getWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2f,%esi
call   1030 <fgets@plt>
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%eax
jne    11b0 <getWord+0x90>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11a4 <getWord+0x84>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1191 <getWord+0x71>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1196 <getWord+0x76>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115b <getWord+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    11b7 <getWord+0x97>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getWord>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    $0x2f,%esi
mov    %r14,%rdx
call   1030 <fgets@plt>
mov    %r14,%rdi
call   1040 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jne    1167 <getWord+0x47>
jmp    1157 <getWord+0x37>
nopl   0x0(%rax)
movb   $0x0,(%rbx)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0xa,%al
je     1150 <getWord+0x30>
test   %al,%al
jne    1153 <getWord+0x33>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @getWord(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fgets(i8* %1, i32 47, i32* %0)
%4 = tail call i32 @feof(i32* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %2, %11
%7 = phi i64 [ %12, %11 ], [ 0, %2 ]
%8 = getelementptr inbounds i8, i8* %1, i64 %7
%9 = load i8, i8* %8
switch i8 %9, label %11 [
i8 0, label %13
i8 10, label %10
]
10: ; preds = %6
store i8 0, i8* %8
br label %11
11: ; preds = %6, %10
%12 = add nuw i64 %7, 1
br label %6
13: ; preds = %6, %2
%14 = phi i32 [ 0, %2 ], [ 1, %6 ]
ret i32 %14
}