search(name) char *name;
{
  static struct kword {
    char *word;
    int val;
  } kwt[] = {"no",       261, "frame",   268, "draw",      262, "file",  269,
             "nodes",    274, "labels",  266, "component", 267, "off",   272,
             "format",   276, "plot",    280, "on",        271, "x",     263,
             "y",        264, "to",      273, "yes",       270, "auto",  278,
             "summary",  265, "xp",      277, "size",      275, "shift", 279,
             "diamonds", 258, "squares", 259, "triangles", 260};
  int i, last = sizeof(kwt) / sizeof(struct kword) - 1;
  register char *s, *t;
  for (i = 0; i <= last; i++) {
    s = kwt[i].word;
    t = name;
    for (; *t == *s; t++, s++) {
      if (*t == '\0')
        return (kwt[i].val);
    }
    if (*t == '\0')
      return (kwt[i].val);
  }
  return (281);
}


x86 assembly (clang, -O0):
<search>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x16,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11e8 <search+0xe8>
movslq -0x14(%rbp),%rcx
lea    0x2f03(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
mov    -0x20(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11a8 <search+0xa8>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1186 <search+0x86>
movslq -0x14(%rbp),%rcx
lea    0x2ebc(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ef <search+0xef>
jmp    118b <search+0x8b>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1143 <search+0x43>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11d5 <search+0xd5>
movslq -0x14(%rbp),%rcx
lea    0x2e6d(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ef <search+0xef>
jmp    11da <search+0xda>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1116 <search+0x16>
movl   $0x119,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<search>:
mov    (%rdi),%r9b
xor    %r10d,%r10d
lea    0x2bd3(%rip),%r8
mov    %r10,%rax
shl    $0x4,%rax
mov    (%rax,%r8,1),%rsi
mov    %r9d,%edx
cmp    (%rsi),%r9b
jne    1144 <search+0x44>
mov    $0x1,%eax
mov    %r9d,%edx
nopl   0x0(%rax,%rax,1)
test   %dl,%dl
je     1158 <search+0x58>
movzbl (%rdi,%rax,1),%edx
lea    0x1(%rax),%rcx
cmp    (%rsi,%rax,1),%dl
mov    %rcx,%rax
je     1130 <search+0x30>
test   %dl,%dl
je     1158 <search+0x58>
add    $0x1,%r10
cmp    $0x17,%r10
jne    110d <search+0xd>
mov    $0x119,%eax
ret
mov    %r10d,%eax
shl    $0x4,%rax
mov    0x8(%rax,%r8,1),%eax
ret

LLVM IR (-O0):
%struct.kword = type { i8*, i32 }
@search.kwt = internal global [23 x %struct.kword] [%struct.kword { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i32 261 }, %struct.kword { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i32 268 }, %struct.kword { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i32 262 }, %struct.kword { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i32 269 }, %struct.kword { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i32 274 }, %struct.kword { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i32 266 }, %struct.kword { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i32 267 }, %struct.kword { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i32 272 }, %struct.kword { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i32 276 }, %struct.kword { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i32 280 }, %struct.kword { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i32 271 }, %struct.kword { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i32 0, i32 0), i32 263 }, %struct.kword { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i32 264 }, %struct.kword { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i32 0, i32 0), i32 273 }, %struct.kword { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i32 0, i32 0), i32 270 }, %struct.kword { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i32 0, i32 0), i32 278 }, %struct.kword { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i32 0, i32 0), i32 265 }, %struct.kword { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i32 0, i32 0), i32 277 }, %struct.kword { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i32 0, i32 0), i32 275 }, %struct.kword { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i32 0, i32 0), i32 279 }, %struct.kword { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.20, i32 0, i32 0), i32 258 }, %struct.kword { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i32 0, i32 0), i32 259 }, %struct.kword { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.22, i32 0, i32 0), i32 260 }]
@.str = [3 x i8] c"no\00"
@.str.1 = [6 x i8] c"frame\00"
@.str.2 = [5 x i8] c"draw\00"
@.str.3 = [5 x i8] c"file\00"
@.str.4 = [6 x i8] c"nodes\00"
@.str.5 = [7 x i8] c"labels\00"
@.str.6 = [10 x i8] c"component\00"
@.str.7 = [4 x i8] c"off\00"
@.str.8 = [7 x i8] c"format\00"
@.str.9 = [5 x i8] c"plot\00"
@.str.10 = [3 x i8] c"on\00"
@.str.11 = [2 x i8] c"x\00"
@.str.12 = [2 x i8] c"y\00"
@.str.13 = [3 x i8] c"to\00"
@.str.14 = [4 x i8] c"yes\00"
@.str.15 = [5 x i8] c"auto\00"
@.str.16 = [8 x i8] c"summary\00"
@.str.17 = [3 x i8] c"xp\00"
@.str.18 = [5 x i8] c"size\00"
@.str.19 = [6 x i8] c"shift\00"
@.str.20 = [9 x i8] c"diamonds\00"
@.str.21 = [8 x i8] c"squares\00"
@.str.22 = [10 x i8] c"triangles\00"
define i32 @search(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
store i32 22, i32* %5
store i32 0, i32* %4
br label %8
8: ; preds = %56, %1
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %59
12: ; preds = %8
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [23 x %struct.kword], [23 x %struct.kword]* @search.kwt, i64 0, i64 %14
%16 = getelementptr inbounds %struct.kword, %struct.kword* %15, i32 0, i32 0
%17 = load i8*, i8** %16
store i8* %17, i8** %6
%18 = load i8*, i8** %3
store i8* %18, i8** %7
br label %19
19: ; preds = %39, %12
%20 = load i8*, i8** %7
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = load i8*, i8** %6
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %22, %25
br i1 %26, label %27, label %44
27: ; preds = %19
%28 = load i8*, i8** %7
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %27
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [23 x %struct.kword], [23 x %struct.kword]* @search.kwt, i64 0, i64 %34
%36 = getelementptr inbounds %struct.kword, %struct.kword* %35, i32 0, i32 1
%37 = load i32, i32* %36
store i32 %37, i32* %2
br label %60
38: ; preds = %27
br label %39
39: ; preds = %38
%40 = load i8*, i8** %7
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %7
%42 = load i8*, i8** %6
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %6
br label %19
44: ; preds = %19
%45 = load i8*, i8** %7
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %55
49: ; preds = %44
%50 = load i32, i32* %4
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [23 x %struct.kword], [23 x %struct.kword]* @search.kwt, i64 0, i64 %51
%53 = getelementptr inbounds %struct.kword, %struct.kword* %52, i32 0, i32 1
%54 = load i32, i32* %53
store i32 %54, i32* %2
br label %60
55: ; preds = %44
br label %56
56: ; preds = %55
%57 = load i32, i32* %4
%58 = add nsw i32 %57, 1
store i32 %58, i32* %4
br label %8
59: ; preds = %8
store i32 281, i32* %2
br label %60
60: ; preds = %59, %49, %32
%61 = load i32, i32* %2
ret i32 %61
}

LLVM IR (-O2):
%struct.kword = type { i8*, i32 }
@search.kwt = internal unnamed_addr constant [23 x %struct.kword] [%struct.kword { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i32 261 }, %struct.kword { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i32 268 }, %struct.kword { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i32 262 }, %struct.kword { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i32 269 }, %struct.kword { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i32 274 }, %struct.kword { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i32 266 }, %struct.kword { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i32 267 }, %struct.kword { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i32 272 }, %struct.kword { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i32 276 }, %struct.kword { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i32 280 }, %struct.kword { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i32 271 }, %struct.kword { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i32 0, i32 0), i32 263 }, %struct.kword { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i32 264 }, %struct.kword { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i32 0, i32 0), i32 273 }, %struct.kword { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i32 0, i32 0), i32 270 }, %struct.kword { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i32 0, i32 0), i32 278 }, %struct.kword { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i32 0, i32 0), i32 265 }, %struct.kword { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i32 0, i32 0), i32 277 }, %struct.kword { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i32 0, i32 0), i32 275 }, %struct.kword { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i32 0, i32 0), i32 279 }, %struct.kword { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.20, i32 0, i32 0), i32 258 }, %struct.kword { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i32 0, i32 0), i32 259 }, %struct.kword { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.22, i32 0, i32 0), i32 260 }]
@.str = [3 x i8] c"no\00"
@.str.1 = [6 x i8] c"frame\00"
@.str.2 = [5 x i8] c"draw\00"
@.str.3 = [5 x i8] c"file\00"
@.str.4 = [6 x i8] c"nodes\00"
@.str.5 = [7 x i8] c"labels\00"
@.str.6 = [10 x i8] c"component\00"
@.str.7 = [4 x i8] c"off\00"
@.str.8 = [7 x i8] c"format\00"
@.str.9 = [5 x i8] c"plot\00"
@.str.10 = [3 x i8] c"on\00"
@.str.11 = [2 x i8] c"x\00"
@.str.12 = [2 x i8] c"y\00"
@.str.13 = [3 x i8] c"to\00"
@.str.14 = [4 x i8] c"yes\00"
@.str.15 = [5 x i8] c"auto\00"
@.str.16 = [8 x i8] c"summary\00"
@.str.17 = [3 x i8] c"xp\00"
@.str.18 = [5 x i8] c"size\00"
@.str.19 = [6 x i8] c"shift\00"
@.str.20 = [9 x i8] c"diamonds\00"
@.str.21 = [8 x i8] c"squares\00"
@.str.22 = [10 x i8] c"triangles\00"
define i32 @search(i8* nocapture %0) {
%2 = load i8, i8* %0
br label %3
3: ; preds = %1, %23
%4 = phi i64 [ 0, %1 ], [ %24, %23 ]
%5 = getelementptr inbounds [23 x %struct.kword], [23 x %struct.kword]* @search.kwt, i64 0, i64 %4, i32 0
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %2, %7
br i1 %8, label %9, label %20
9: ; preds = %3, %14
%10 = phi i8 [ %17, %14 ], [ %2, %3 ]
%11 = phi i8* [ %15, %14 ], [ %0, %3 ]
%12 = phi i8* [ %16, %14 ], [ %6, %3 ]
%13 = icmp eq i8 %10, 0
br i1 %13, label %26, label %14
14: ; preds = %9
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = getelementptr inbounds i8, i8* %12, i64 1
%17 = load i8, i8* %15
%18 = load i8, i8* %16
%19 = icmp eq i8 %17, %18
br i1 %19, label %9, label %20
20: ; preds = %14, %3
%21 = phi i8 [ %2, %3 ], [ %17, %14 ]
%22 = icmp eq i8 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = add nuw nsw i64 %4, 1
%25 = icmp eq i64 %24, 23
br i1 %25, label %30, label %3
26: ; preds = %20, %9
%27 = and i64 %4, 4294967295
%28 = getelementptr inbounds [23 x %struct.kword], [23 x %struct.kword]* @search.kwt, i64 0, i64 %27, i32 1
%29 = load i32, i32* %28
br label %30
30: ; preds = %23, %26
%31 = phi i32 [ %29, %26 ], [ 281, %23 ]
ret i32 %31
}