#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 ReadWord(char *, int /*<<< orphan*/ *);
int SearchCategory(char *);
int SearchVocab(char *);
scalar_t__ feof(int /*<<< orphan*/ *);
int ReadSentence(int *category, int *que, int ans[][300 + 1], FILE *fin) {
  char word[100];
  int a = 0, b = 0, c = 0, id = -1, ch;
  ReadWord(word, fin);
  if (feof(fin))
    return 0;
  c = SearchCategory(word);
  *category = c;
  c = 0;
  while (1) {
    ch = ReadWord(word, fin);
    if (feof(fin))
      return 0;
    a++;
    id = SearchVocab(word);
    if (id != -1 && c < 300) {
      que[c] = id;
      c++;
    }
    if (ch == '\t' || ch == '\n')
      break;
  }
  que[c] = -1;
  if (c == 0)
    *category = -1;
  b = 0;
  while (1) {
    c = 0;
    while (1) {
      ch = ReadWord(word, fin);
      if (feof(fin))
        return 0;
      a++;
      id = SearchVocab(word);
      if (id != -1 && c < 300) {
        ans[b][c] = id;
        c++;
      }
      if (ch == '\t' || ch == '\n')
        break;
    }
    ans[b][c] = -1;
    if (c != 0 && b < 20)
      b++;
    if (ch == '\n')
      break;
  }
  ans[b][0] = -1;
  return a;
}


x86 assembly (clang, -O0):
<ReadSentence>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x94(%rbp)
movl   $0x0,-0x98(%rbp)
movl   $0x0,-0x9c(%rbp)
movl   $0xffffffff,-0xa0(%rbp)
ff ff ff
lea    -0x90(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <ReadWord@plt>
mov    -0x28(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     11b2 <ReadSentence+0x72>
movl   $0x0,-0x4(%rbp)
jmp    1423 <ReadSentence+0x2e3>
lea    -0x90(%rbp),%rdi
call   1030 <SearchCategory@plt>
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x9c(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <ReadWord@plt>
mov    %eax,-0xa4(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     120f <ReadSentence+0xcf>
movl   $0x0,-0x4(%rbp)
jmp    1423 <ReadSentence+0x2e3>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
lea    -0x90(%rbp),%rdi
call   1060 <SearchVocab@plt>
mov    %eax,-0xa0(%rbp)
cmpl   $0xffffffff,-0xa0(%rbp)
je     1270 <ReadSentence+0x130>
cmpl   $0x12c,-0x9c(%rbp)
jge    1270 <ReadSentence+0x130>
mov    -0xa0(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x9c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
cmpl   $0x9,-0xa4(%rbp)
je     128a <ReadSentence+0x14a>
cmpl   $0xa,-0xa4(%rbp)
jne    128f <ReadSentence+0x14f>
jmp    1294 <ReadSentence+0x154>
jmp    11da <ReadSentence+0x9a>
mov    -0x18(%rbp),%rax
movslq -0x9c(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
cmpl   $0x0,-0x9c(%rbp)
jne    12bd <ReadSentence+0x17d>
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0x0,-0x98(%rbp)
movl   $0x0,-0x9c(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <ReadWord@plt>
mov    %eax,-0xa4(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     1306 <ReadSentence+0x1c6>
movl   $0x0,-0x4(%rbp)
jmp    1423 <ReadSentence+0x2e3>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
lea    -0x90(%rbp),%rdi
call   1060 <SearchVocab@plt>
mov    %eax,-0xa0(%rbp)
cmpl   $0xffffffff,-0xa0(%rbp)
je     1378 <ReadSentence+0x238>
cmpl   $0x12c,-0x9c(%rbp)
jge    1378 <ReadSentence+0x238>
mov    -0xa0(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x98(%rbp),%rcx
imul   $0x4b4,%rcx,%rcx
add    %rcx,%rax
movslq -0x9c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
cmpl   $0x9,-0xa4(%rbp)
je     1392 <ReadSentence+0x252>
cmpl   $0xa,-0xa4(%rbp)
jne    1397 <ReadSentence+0x257>
jmp    139c <ReadSentence+0x25c>
jmp    12d1 <ReadSentence+0x191>
mov    -0x20(%rbp),%rax
movslq -0x98(%rbp),%rcx
imul   $0x4b4,%rcx,%rcx
add    %rcx,%rax
movslq -0x9c(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
cmpl   $0x0,-0x9c(%rbp)
je     13e8 <ReadSentence+0x2a8>
cmpl   $0x14,-0x98(%rbp)
jge    13e8 <ReadSentence+0x2a8>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
cmpl   $0xa,-0xa4(%rbp)
jne    13fa <ReadSentence+0x2ba>
jmp    13ff <ReadSentence+0x2bf>
jmp    12c7 <ReadSentence+0x187>
mov    -0x20(%rbp),%rax
movslq -0x98(%rbp),%rcx
imul   $0x4b4,%rcx,%rcx
add    %rcx,%rax
movl   $0xffffffff,(%rax)
mov    -0x94(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadSentence>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rcx,%r13
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0x10(%rsp),%rdi
mov    %rcx,%rsi
call   1050 <ReadWord@plt>
mov    %r13,%rdi
call   1040 <feof@plt>
xor    %ebp,%ebp
test   %rax,%rax
jne    12bd <ReadSentence+0x17d>
mov    %r14,(%rsp)
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1030 <SearchCategory@plt>
mov    %rbx,0x8(%rsp)
mov    %eax,(%rbx)
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    11ad <ReadSentence+0x6d>
nopl   0x0(%rax,%rax,1)
add    $0xfffffff7,%r15d
add    $0x1,%ebp
cmp    $0x1,%r15d
jbe    11ed <ReadSentence+0xad>
mov    %r14,%rdi
mov    %r13,%rsi
call   1050 <ReadWord@plt>
mov    %eax,%r15d
mov    %r13,%rdi
call   1040 <feof@plt>
test   %rax,%rax
jne    12bb <ReadSentence+0x17b>
mov    %r14,%rdi
call   1060 <SearchVocab@plt>
cmp    $0xffffffff,%eax
je     11a0 <ReadSentence+0x60>
cmp    $0x12b,%ebx
jg     11a0 <ReadSentence+0x60>
movslq %ebx,%rcx
mov    %eax,(%r12,%rcx,4)
add    $0x1,%ebx
jmp    11a0 <ReadSentence+0x60>
movslq %ebx,%rax
movl   $0xffffffff,(%r12,%rax,4)
ff
test   %eax,%eax
jne    1207 <ReadSentence+0xc7>
mov    0x8(%rsp),%rax
movl   $0xffffffff,(%rax)
xor    %eax,%eax
lea    0x10(%rsp),%r15
mov    %eax,%r12d
xor    %r14d,%r14d
jmp    122b <ReadSentence+0xeb>
cs nopw 0x0(%rax,%rax,1)
lea    -0x9(%rbx),%eax
add    $0x1,%ebp
cmp    $0x1,%eax
jbe    1272 <ReadSentence+0x132>
mov    %r15,%rdi
mov    %r13,%rsi
call   1050 <ReadWord@plt>
mov    %eax,%ebx
mov    %r13,%rdi
call   1040 <feof@plt>
test   %rax,%rax
jne    12bb <ReadSentence+0x17b>
mov    %r15,%rdi
call   1060 <SearchVocab@plt>
cmp    $0xffffffff,%eax
je     1220 <ReadSentence+0xe0>
cmp    $0x12b,%r14d
jg     1220 <ReadSentence+0xe0>
movslq %r14d,%rcx
imul   $0x4b4,%r12,%rdx
add    (%rsp),%rdx
mov    %eax,(%rdx,%rcx,4)
add    $0x1,%r14d
jmp    1220 <ReadSentence+0xe0>
imul   $0x4b4,%r12,%rcx
add    (%rsp),%rcx
test   %r14d,%r14d
setne  %al
cmp    $0x14,%r12d
setb   %dl
and    %al,%dl
movzbl %dl,%eax
add    %r12d,%eax
movslq %r14d,%rdx
movl   $0xffffffff,(%rcx,%rdx,4)
cmp    $0xa,%ebx
jne    120e <ReadSentence+0xce>
mov    %eax,%eax
imul   $0x4b4,%rax,%rax
mov    (%rsp),%rcx
movl   $0xffffffff,(%rcx,%rax,1)
jmp    12bd <ReadSentence+0x17d>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ReadSentence(i32* %0, i32* %1, [301 x i32]* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [301 x i32]*
%9 = alloca i32*
%10 = alloca [100 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store [301 x i32]* %2, [301 x i32]** %8
store i32* %3, i32** %9
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
store i32 -1, i32* %14
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%17 = load i32*, i32** %9
%18 = call i32 @ReadWord(i8* %16, i32* %17)
%19 = load i32*, i32** %9
%20 = call i64 @feof(i32* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %4
store i32 0, i32* %5
br label %138
23: ; preds = %4
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%25 = call i32 @SearchCategory(i8* %24)
store i32 %25, i32* %13
%26 = load i32, i32* %13
%27 = load i32*, i32** %6
store i32 %26, i32* %27
store i32 0, i32* %13
br label %28
28: ; preds = %23, %61
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%30 = load i32*, i32** %9
%31 = call i32 @ReadWord(i8* %29, i32* %30)
store i32 %31, i32* %15
%32 = load i32*, i32** %9
%33 = call i64 @feof(i32* %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %28
store i32 0, i32* %5
br label %138
36: ; preds = %28
%37 = load i32, i32* %11
%38 = add nsw i32 %37, 1
store i32 %38, i32* %11
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%40 = call i32 @SearchVocab(i8* %39)
store i32 %40, i32* %14
%41 = load i32, i32* %14
%42 = icmp ne i32 %41, -1
br i1 %42, label %43, label %54
43: ; preds = %36
%44 = load i32, i32* %13
%45 = icmp slt i32 %44, 300
br i1 %45, label %46, label %54
46: ; preds = %43
%47 = load i32, i32* %14
%48 = load i32*, i32** %7
%49 = load i32, i32* %13
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i32, i32* %48, i64 %50
store i32 %47, i32* %51
%52 = load i32, i32* %13
%53 = add nsw i32 %52, 1
store i32 %53, i32* %13
br label %54
54: ; preds = %46, %43, %36
%55 = load i32, i32* %15
%56 = icmp eq i32 %55, 9
br i1 %56, label %60, label %57
57: ; preds = %54
%58 = load i32, i32* %15
%59 = icmp eq i32 %58, 10
br i1 %59, label %60, label %61
60: ; preds = %57, %54
br label %62
61: ; preds = %57
br label %28
62: ; preds = %60
%63 = load i32*, i32** %7
%64 = load i32, i32* %13
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %63, i64 %65
store i32 -1, i32* %66
%67 = load i32, i32* %13
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %62
%70 = load i32*, i32** %6
store i32 -1, i32* %70
br label %71
71: ; preds = %69, %62
store i32 0, i32* %12
br label %72
72: ; preds = %71, %130
store i32 0, i32* %13
br label %73
73: ; preds = %72, %109
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%75 = load i32*, i32** %9
%76 = call i32 @ReadWord(i8* %74, i32* %75)
store i32 %76, i32* %15
%77 = load i32*, i32** %9
%78 = call i64 @feof(i32* %77)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %81
80: ; preds = %73
store i32 0, i32* %5
br label %138
81: ; preds = %73
%82 = load i32, i32* %11
%83 = add nsw i32 %82, 1
store i32 %83, i32* %11
%84 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%85 = call i32 @SearchVocab(i8* %84)
store i32 %85, i32* %14
%86 = load i32, i32* %14
%87 = icmp ne i32 %86, -1
br i1 %87, label %88, label %102
88: ; preds = %81
%89 = load i32, i32* %13
%90 = icmp slt i32 %89, 300
br i1 %90, label %91, label %102
91: ; preds = %88
%92 = load i32, i32* %14
%93 = load [301 x i32]*, [301 x i32]** %8
%94 = load i32, i32* %12
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [301 x i32], [301 x i32]* %93, i64 %95
%97 = load i32, i32* %13
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [301 x i32], [301 x i32]* %96, i64 0, i64 %98
store i32 %92, i32* %99
%100 = load i32, i32* %13
%101 = add nsw i32 %100, 1
store i32 %101, i32* %13
br label %102
102: ; preds = %91, %88, %81
%103 = load i32, i32* %15
%104 = icmp eq i32 %103, 9
br i1 %104, label %108, label %105
105: ; preds = %102
%106 = load i32, i32* %15
%107 = icmp eq i32 %106, 10
br i1 %107, label %108, label %109
108: ; preds = %105, %102
br label %110
109: ; preds = %105
br label %73
110: ; preds = %108
%111 = load [301 x i32]*, [301 x i32]** %8
%112 = load i32, i32* %12
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [301 x i32], [301 x i32]* %111, i64 %113
%115 = load i32, i32* %13
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [301 x i32], [301 x i32]* %114, i64 0, i64 %116
store i32 -1, i32* %117
%118 = load i32, i32* %13
%119 = icmp ne i32 %118, 0
br i1 %119, label %120, label %126
120: ; preds = %110
%121 = load i32, i32* %12
%122 = icmp slt i32 %121, 20
br i1 %122, label %123, label %126
123: ; preds = %120
%124 = load i32, i32* %12
%125 = add nsw i32 %124, 1
store i32 %125, i32* %12
br label %126
126: ; preds = %123, %120, %110
%127 = load i32, i32* %15
%128 = icmp eq i32 %127, 10
br i1 %128, label %129, label %130
129: ; preds = %126
br label %131
130: ; preds = %126
br label %72
131: ; preds = %129
%132 = load [301 x i32]*, [301 x i32]** %8
%133 = load i32, i32* %12
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [301 x i32], [301 x i32]* %132, i64 %134
%136 = getelementptr inbounds [301 x i32], [301 x i32]* %135, i64 0, i64 0
store i32 -1, i32* %136
%137 = load i32, i32* %11
store i32 %137, i32* %5
br label %138
138: ; preds = %131, %80, %35, %22
%139 = load i32, i32* %5
ret i32 %139
}

LLVM IR (-O2):
define i32 @ReadSentence(i32* nocapture writeonly %0, i32* nocapture writeonly %1, [301 x i32]* nocapture writeonly %2, i32* %3) {
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%7 = call i32 @ReadWord(i8* %6, i32* %3)
%8 = call i64 @feof(i32* %3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %74
10: ; preds = %4
%11 = call i32 @SearchCategory(i8* %6)
store i32 %11, i32* %0
br label %12
12: ; preds = %28, %10
%13 = phi i32 [ 0, %10 ], [ %19, %28 ]
%14 = phi i32 [ 0, %10 ], [ %29, %28 ]
%15 = call i32 @ReadWord(i8* %6, i32* %3)
%16 = call i64 @feof(i32* %3)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %74
18: ; preds = %12
%19 = add nuw nsw i32 %13, 1
%20 = call i32 @SearchVocab(i8* %6)
%21 = icmp ne i32 %20, -1
%22 = icmp slt i32 %14, 300
%23 = select i1 %21, i1 %22, i1 false
br i1 %23, label %24, label %28
24: ; preds = %18
%25 = sext i32 %14 to i64
%26 = getelementptr inbounds i32, i32* %1, i64 %25
store i32 %20, i32* %26
%27 = add nsw i32 %14, 1
br label %28
28: ; preds = %24, %18
%29 = phi i32 [ %27, %24 ], [ %14, %18 ]
%30 = add i32 %15, -9
%31 = icmp ult i32 %30, 2
br i1 %31, label %32, label %12
32: ; preds = %28
%33 = sext i32 %29 to i64
%34 = getelementptr inbounds i32, i32* %1, i64 %33
store i32 -1, i32* %34
%35 = icmp eq i32 %29, 0
br i1 %35, label %36, label %37
36: ; preds = %32
store i32 -1, i32* %0
br label %37
37: ; preds = %36, %32
br label %38
38: ; preds = %37, %62
%39 = phi i32 [ %49, %62 ], [ %19, %37 ]
%40 = phi i32 [ %70, %62 ], [ 0, %37 ]
%41 = zext i32 %40 to i64
br label %42
42: ; preds = %58, %38
%43 = phi i32 [ %39, %38 ], [ %49, %58 ]
%44 = phi i32 [ 0, %38 ], [ %59, %58 ]
%45 = call i32 @ReadWord(i8* %6, i32* %3)
%46 = call i64 @feof(i32* %3)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %74
48: ; preds = %42
%49 = add nsw i32 %43, 1
%50 = call i32 @SearchVocab(i8* %6)
%51 = icmp ne i32 %50, -1
%52 = icmp slt i32 %44, 300
%53 = select i1 %51, i1 %52, i1 false
br i1 %53, label %54, label %58
54: ; preds = %48
%55 = sext i32 %44 to i64
%56 = getelementptr inbounds [301 x i32], [301 x i32]* %2, i64 %41, i64 %55
store i32 %50, i32* %56
%57 = add nsw i32 %44, 1
br label %58
58: ; preds = %54, %48
%59 = phi i32 [ %57, %54 ], [ %44, %48 ]
%60 = add i32 %45, -9
%61 = icmp ult i32 %60, 2
br i1 %61, label %62, label %42
62: ; preds = %58
%63 = icmp eq i32 %45, 10
%64 = sext i32 %59 to i64
%65 = getelementptr inbounds [301 x i32], [301 x i32]* %2, i64 %41, i64 %64
store i32 -1, i32* %65
%66 = icmp ne i32 %59, 0
%67 = icmp ult i32 %40, 20
%68 = select i1 %66, i1 %67, i1 false
%69 = zext i1 %68 to i32
%70 = add nuw nsw i32 %40, %69
br i1 %63, label %71, label %38
71: ; preds = %62
%72 = zext i32 %70 to i64
%73 = getelementptr inbounds [301 x i32], [301 x i32]* %2, i64 %72, i64 0
store i32 -1, i32* %73
br label %74
74: ; preds = %12, %42, %4, %71
%75 = phi i32 [ %49, %71 ], [ 0, %4 ], [ 0, %42 ], [ 0, %12 ]
ret i32 %75
}