#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 EOF;
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int getWord(FILE *inptr, char word[]) {
  int noofchar = 0;
  int c = 0;
  if (feof(inptr)) {
    return EOF;
  } else {
    while ((c = getc(inptr)) != EOF && c != ' ') {
      if (!(c > 0 && c < 256))
        fprintf(stderr, "\nnot in char range");
      if (noofchar >= 200) {
        fprintf(stderr, "\nbuffer memory overflow in getWord");
        break;
      }
      word[noofchar++] = (char)c;
    }
    word[noofchar] = '\0';
    return noofchar;
  }
}


x86 assembly (clang, -O0):
<getWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     1172 <getWord+0x42>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1237 <getWord+0x107>
jmp    1177 <getWord+0x47>
mov    -0x10(%rbp),%rdi
call   1050 <getc@plt>
mov    %eax,%ecx
mov    %ecx,-0x20(%rbp)
xor    %eax,%eax
mov    0x2e5a(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x21(%rbp)
je     11a3 <getWord+0x73>
cmpl   $0x20,-0x20(%rbp)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11b3 <getWord+0x83>
jmp    1225 <getWord+0xf5>
cmpl   $0x0,-0x20(%rbp)
jle    11ca <getWord+0x9a>
cmpl   $0x100,-0x20(%rbp)
jl     11df <getWord+0xaf>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
lea    0xe26(%rip),%rsi
call   1030 <fprintf@plt>
cmpl   $0xc8,-0x1c(%rbp)
jl     1206 <getWord+0xd6>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
lea    0xe17(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1225 <getWord+0xf5>
mov    -0x20(%rbp),%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x1c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1177 <getWord+0x47>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getWord>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <feof@plt>
test   %rax,%rax
je     115a <getWord+0x2a>
mov    0x2e96(%rip),%rax
mov    (%rax),%r12d
jmp    11ef <getWord+0xbf>
mov    %r15,%rdi
call   1050 <getc@plt>
xor    %r12d,%r12d
cmp    $0x20,%eax
je     11e7 <getWord+0xb7>
mov    %eax,%ebx
mov    0x2e75(%rip),%rbp
cmp    0x0(%rbp),%eax
je     11e7 <getWord+0xb7>
xor    %r12d,%r12d
mov    0x2e56(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%rbx),%eax
cmp    $0xff,%eax
jb     11aa <getWord+0x7a>
mov    0x0(%r13),%edi
lea    0xe5b(%rip),%rsi
call   1030 <fprintf@plt>
cmp    $0xc8,%r12
je     11d1 <getWord+0xa1>
mov    %bl,(%r14,%r12,1)
add    $0x1,%r12
mov    %r15,%rdi
call   1050 <getc@plt>
cmp    $0x20,%eax
je     11e7 <getWord+0xb7>
mov    %eax,%ebx
cmp    0x0(%rbp),%eax
jne    1190 <getWord+0x60>
jmp    11e7 <getWord+0xb7>
mov    0x0(%r13),%edi
lea    0xe37(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xc8,%r12d
mov    %r12d,%eax
movb   $0x0,(%r14,%rax,1)
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@stderr = global i32 0
@.str = [19 x i8] c"\0Anot in char range\00"
@.str.1 = [35 x i8] c"\0Abuffer memory overflow in getWord\00"
define i32 @getWord(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load i32*, i32** %4
%9 = call i64 @feof(i32* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32, i32* @EOF
store i32 %12, i32* %3
br label %53
13: ; preds = %2
br label %14
14: ; preds = %39, %13
%15 = load i32*, i32** %4
%16 = call i32 @getc(i32* %15)
store i32 %16, i32* %7
%17 = load i32, i32* @EOF
%18 = icmp ne i32 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i32, i32* %7
%21 = icmp ne i32 %20, 32
br label %22
22: ; preds = %19, %14
%23 = phi i1 [ false, %14 ], [ %21, %19 ]
br i1 %23, label %24, label %47
24: ; preds = %22
%25 = load i32, i32* %7
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %7
%29 = icmp slt i32 %28, 256
br i1 %29, label %33, label %30
30: ; preds = %27, %24
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %33
33: ; preds = %30, %27
%34 = load i32, i32* %6
%35 = icmp sge i32 %34, 200
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %47
39: ; preds = %33
%40 = load i32, i32* %7
%41 = trunc i32 %40 to i8
%42 = load i8*, i8** %5
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
%45 = sext i32 %43 to i64
%46 = getelementptr inbounds i8, i8* %42, i64 %45
store i8 %41, i8* %46
br label %14
47: ; preds = %36, %22
%48 = load i8*, i8** %5
%49 = load i32, i32* %6
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
store i8 0, i8* %51
%52 = load i32, i32* %6
store i32 %52, i32* %3
br label %53
53: ; preds = %47, %11
%54 = load i32, i32* %3
ret i32 %54
}

LLVM IR (-O2):
@EOF = global i32 0
@stderr = global i32 0
@.str = [19 x i8] c"\0Anot in char range\00"
@.str.1 = [35 x i8] c"\0Abuffer memory overflow in getWord\00"
define i32 @getWord(i32* nocapture %0, i8* nocapture writeonly %1) {
%3 = tail call i64 @feof(i32* %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = tail call i32 @getc(i32* %0)
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
%9 = icmp ne i32 %6, 32
%10 = and i1 %9, %8
br i1 %10, label %13, label %37
11: ; preds = %2
%12 = load i32, i32* @EOF
br label %41
13: ; preds = %5, %26
%14 = phi i64 [ %28, %26 ], [ 0, %5 ]
%15 = phi i32 [ %30, %26 ], [ %6, %5 ]
%16 = add i32 %15, -1
%17 = icmp ult i32 %16, 255
br i1 %17, label %21, label %18
18: ; preds = %13
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %13, %18
%22 = icmp eq i64 %14, 200
br i1 %22, label %23, label %26
23: ; preds = %21
%24 = load i32, i32* @stderr
%25 = tail call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %37
26: ; preds = %21
%27 = trunc i32 %15 to i8
%28 = add nuw nsw i64 %14, 1
%29 = getelementptr inbounds i8, i8* %1, i64 %14
store i8 %27, i8* %29
%30 = tail call i32 @getc(i32* %0)
%31 = load i32, i32* @EOF
%32 = icmp ne i32 %30, %31
%33 = icmp ne i32 %30, 32
%34 = and i1 %33, %32
br i1 %34, label %13, label %35
35: ; preds = %26
%36 = trunc i64 %28 to i32
br label %37
37: ; preds = %35, %5, %23
%38 = phi i32 [ 200, %23 ], [ 0, %5 ], [ %36, %35 ]
%39 = zext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %1, i64 %39
store i8 0, i8* %40
br label %41
41: ; preds = %37, %11
%42 = phi i32 [ %12, %11 ], [ %38, %37 ]
ret i32 %42
}