#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 */
scalar_t__ feof(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int getNextWord(FILE *inputFile, char *nextWord) {
  char tempChar;
  long curCount = 0;
  tempChar = fgetc(inputFile);
  while (!feof(inputFile) && (tempChar != '\n') && (tempChar != '\r')) {
    if (curCount < (50)) {
      nextWord[curCount] = tempChar;
      curCount++;
    } else {
      return -1;
    }
    tempChar = fgetc(inputFile);
  }
  nextWord[curCount] = '\0';
  if (feof(inputFile)) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<getNextWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x19(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
jne    117e <getNextWord+0x5e>
movsbl -0x19(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x29(%rbp)
je     117e <getNextWord+0x5e>
movsbl -0x19(%rbp),%eax
cmp    $0xd,%eax
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    118e <getNextWord+0x6e>
jmp    11d5 <getNextWord+0xb5>
cmpq   $0x32,-0x28(%rbp)
jge    11b8 <getNextWord+0x98>
mov    -0x19(%rbp),%dl
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11c4 <getNextWord+0xa4>
movl   $0xffffffff,-0x4(%rbp)
jmp    1207 <getNextWord+0xe7>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x19(%rbp)
jmp    1144 <getNextWord+0x24>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     1200 <getNextWord+0xe0>
movl   $0x1,-0x4(%rbp)
jmp    1207 <getNextWord+0xe7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNextWord>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1040 <feof@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    1174 <getNextWord+0x54>
cmp    $0xa,%bpl
je     1174 <getNextWord+0x54>
cmp    $0xd,%bpl
je     1174 <getNextWord+0x54>
cmp    $0x32,%rbx
je     1197 <getNextWord+0x77>
mov    %bpl,(%r14,%rbx,1)
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1040 <feof@plt>
test   %rax,%rax
je     1143 <getNextWord+0x23>
movb   $0x0,(%r14,%rbx,1)
mov    %r15,%rdi
call   1040 <feof@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffffff,%eax
jmp    118c <getNextWord+0x6c>

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

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