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


x86 assembly (clang, -O0):
<get_characters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1155 <get_characters+0x35>
jmp    11a3 <get_characters+0x83>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x20,-0x18(%rbp)
je     117f <get_characters+0x5f>
cmpl   $0x9,-0x18(%rbp)
je     117f <get_characters+0x5f>
cmpl   $0xa,-0x18(%rbp)
jne    1184 <get_characters+0x64>
jmp    11a3 <get_characters+0x83>
mov    -0x18(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1137 <get_characters+0x17>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_characters>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <feof@plt>
xor    %ebx,%ebx
test   %eax,%eax
jne    1179 <get_characters+0x59>
xor    %ebx,%ebx
movabs $0x100000600,%r12
jmp    1164 <get_characters+0x44>
nopw   0x0(%rax,%rax,1)
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <feof@plt>
test   %eax,%eax
jne    1179 <get_characters+0x59>
mov    %r15,%rdi
call   1030 <fgetc@plt>
cmp    $0x20,%eax
ja     1150 <get_characters+0x30>
mov    %eax,%ecx
bt     %rcx,%r12
jae    1150 <get_characters+0x30>
mov    %ebx,%eax
movb   $0x0,(%r14,%rax,1)
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @get_characters(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
br label %7
7: ; preds = %24, %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 %32
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, 32
br i1 %16, label %23, label %17
17: ; preds = %12
%18 = load i32, i32* %6
%19 = icmp eq i32 %18, 9
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load i32, i32* %6
%22 = icmp eq i32 %21, 10
br i1 %22, label %23, label %24
23: ; preds = %20, %17, %12
br label %32
24: ; preds = %20
%25 = load i32, i32* %6
%26 = trunc i32 %25 to i8
%27 = load i8*, i8** %3
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
%30 = sext i32 %28 to i64
%31 = getelementptr inbounds i8, i8* %27, i64 %30
store i8 %26, i8* %31
br label %7
32: ; preds = %23, %7
%33 = load i8*, i8** %3
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
store i8 0, i8* %36
%37 = load i32, i32* %5
ret i32 %37
}

LLVM IR (-O2):
define i32 @get_characters(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 %17
5: ; preds = %2, %8
%6 = phi i64 [ %10, %8 ], [ 0, %2 ]
%7 = tail call i32 @fgetc(i32* %1)
switch i32 %7, label %8 [
i32 32, label %14
i32 10, label %14
i32 9, label %14
]
8: ; preds = %5
%9 = trunc i32 %7 to i8
%10 = add nuw i64 %6, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %9, i8* %11
%12 = tail call i32 @feof(i32* %1)
%13 = icmp eq i32 %12, 0
br i1 %13, label %5, label %14
14: ; preds = %5, %5, %5, %8
%15 = phi i64 [ %10, %8 ], [ %6, %5 ], [ %6, %5 ], [ %6, %5 ]
%16 = trunc i64 %15 to i32
br label %17
17: ; preds = %14, %2
%18 = phi i32 [ 0, %2 ], [ %16, %14 ]
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %0, i64 %19
store i8 0, i8* %20
ret i32 %18
}