#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*/ nw;

/* Variables and functions */
int strcmp(char *, char *);
int noiseword(char *s) {
  char *nw[] = {"a",  "an", "and",  "are", "is",   "in", "of",
                "on", "or", "that", "the", "this", "to"};
  int cond, mid;
  int high = sizeof(nw) / sizeof(char *) - 1;
  int low = 0;
  while (low <= high) {
    mid = (low + high) / 2;
    if ((cond = strcmp(s, nw[mid])) < 0)
      high = mid - 1;
    else if (cond > 0)
      low = mid + 1;
    else
      return mid;
  }
  return -1;
}


x86 assembly (clang, -O0):
<noiseword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
lea    0x2c76(%rip),%rsi
mov    $0x68,%edx
call   1040 <memcpy@plt>
movl   $0xc,-0x8c(%rbp)
movl   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%eax
cmp    -0x8c(%rbp),%eax
jg     11f5 <noiseword+0xd5>
mov    -0x90(%rbp),%eax
add    -0x8c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x88(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x88(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x84(%rbp)
cmp    $0x0,%eax
jge    11bc <noiseword+0x9c>
mov    -0x88(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    11f0 <noiseword+0xd0>
cmpl   $0x0,-0x84(%rbp)
jle    11dd <noiseword+0xbd>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    11eb <noiseword+0xcb>
mov    -0x88(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11fc <noiseword+0xdc>
jmp    11f0 <noiseword+0xd0>
jmp    1158 <noiseword+0x38>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<noiseword>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
mov    $0xc,%r12d
xor    %ebx,%ebx
lea    0xf02(%rip),%r15
jmp    113b <noiseword+0x2b>
nopl   0x0(%rax)
add    $0xffffffff,%ebp
mov    %ebp,%r12d
cmp    %r12d,%ebx
jg     116a <noiseword+0x5a>
lea    (%rbx,%r12,1),%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
movslq %ebp,%rax
movslq (%r15,%rax,4),%rsi
add    %r15,%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
js     1130 <noiseword+0x20>
je     116f <noiseword+0x5f>
add    $0x1,%ebp
mov    %ebp,%ebx
cmp    %r12d,%ebx
jle    113b <noiseword+0x2b>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [3 x i8] c"an\00"
@.str.2 = [4 x i8] c"and\00"
@.str.3 = [4 x i8] c"are\00"
@.str.4 = [3 x i8] c"is\00"
@.str.5 = [3 x i8] c"in\00"
@.str.6 = [3 x i8] c"of\00"
@.str.7 = [3 x i8] c"on\00"
@.str.8 = [3 x i8] c"or\00"
@.str.9 = [5 x i8] c"that\00"
@.str.10 = [4 x i8] c"the\00"
@.str.11 = [5 x i8] c"this\00"
@.str.12 = [3 x i8] c"to\00"
@__const.noiseword.nw = [13 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0)]
define i32 @noiseword(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [13 x i8*]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
%9 = bitcast [13 x i8*]* %4 to i8*
store i32 12, i32* %7
store i32 0, i32* %8
br label %10
10: ; preds = %38, %1
%11 = load i32, i32* %8
%12 = load i32, i32* %7
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %39
14: ; preds = %10
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = add nsw i32 %15, %16
%18 = sdiv i32 %17, 2
store i32 %18, i32* %6
%19 = load i8*, i8** %3
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [13 x i8*], [13 x i8*]* %4, i64 0, i64 %21
%23 = load i8*, i8** %22
%24 = call i32 @strcmp(i8* %19, i8* %23)
store i32 %24, i32* %5
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %14
%27 = load i32, i32* %6
%28 = sub nsw i32 %27, 1
store i32 %28, i32* %7
br label %38
29: ; preds = %14
%30 = load i32, i32* %5
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %37
35: ; preds = %29
%36 = load i32, i32* %6
store i32 %36, i32* %2
br label %40
37: ; preds = %32
br label %38
38: ; preds = %37, %26
br label %10
39: ; preds = %10
store i32 -1, i32* %2
br label %40
40: ; preds = %39, %35
%41 = load i32, i32* %2
ret i32 %41
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
@.str.1 = [3 x i8] c"an\00"
@.str.2 = [4 x i8] c"and\00"
@.str.3 = [4 x i8] c"are\00"
@.str.4 = [3 x i8] c"is\00"
@.str.5 = [3 x i8] c"in\00"
@.str.6 = [3 x i8] c"of\00"
@.str.7 = [3 x i8] c"on\00"
@.str.8 = [3 x i8] c"or\00"
@.str.9 = [5 x i8] c"that\00"
@.str.10 = [4 x i8] c"the\00"
@.str.11 = [5 x i8] c"this\00"
@.str.12 = [3 x i8] c"to\00"
@reltable.noiseword = [13 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.4 to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.5 to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.6 to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.7 to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.8 to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.9 to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.10 to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.11 to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.12 to i64), i64 ptrtoint ([13 x i32]* @reltable.noiseword to i64)) to i32)]
define i32 @noiseword(i8* nocapture %0) {
br label %2
2: ; preds = %1, %18
%3 = phi i32 [ 0, %1 ], [ %20, %18 ]
%4 = phi i32 [ 12, %1 ], [ %19, %18 ]
%5 = add nsw i32 %3, %4
%6 = sdiv i32 %5, 2
%7 = sext i32 %6 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([13 x i32]* @reltable.noiseword to i8*), i64 %8)
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %9)
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = add nsw i32 %6, -1
br label %18
14: ; preds = %2
%15 = icmp eq i32 %10, 0
br i1 %15, label %22, label %16
16: ; preds = %14
%17 = add nsw i32 %6, 1
br label %18
18: ; preds = %16, %12
%19 = phi i32 [ %13, %12 ], [ %4, %16 ]
%20 = phi i32 [ %3, %12 ], [ %17, %16 ]
%21 = icmp sgt i32 %20, %19
br i1 %21, label %22, label %2
22: ; preds = %18, %14
%23 = phi i32 [ %6, %14 ], [ -1, %18 ]
ret i32 %23
}