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

/* Variables and functions */
int /*<<< orphan*/ init_search(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ putchar(char);
char *strsearch(char *);
int main() {
  char *here;
  char *find_strings[] = {"abb", "you", "not", "it", "dad", "yoo", "hoo",
                          "oo",  "oh",  "xx",  "xx", "x",   "x",   NULL};
  char *search_strings[] = {
      "cabbie", "your",   "It isn't here", "But it is here", "hodad", "yoohoo",
      "yoohoo", "yoohoo", "yoohoo",        "yoohoo",         "xx",    "x",
      "."};
  int i;
  for (i = 0; find_strings[i]; i++) {
    init_search(find_strings[i]);
    here = strsearch(search_strings[i]);
    printf("\"%s\" is%s in \"%s\"", find_strings[i], here ? "" : " not",
           search_strings[i]);
    if (here)
      printf(" [\"%s\"]", here);
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x80(%rbp),%rdi
lea    0x2bd3(%rip),%rsi
mov    $0x70,%edx
call   1050 <memcpy@plt>
lea    -0xf0(%rbp),%rdi
lea    0x2c2b(%rip),%rsi
mov    $0x68,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0xf4(%rbp)
movslq -0xf4(%rbp),%rax
cmpq   $0x0,-0x80(%rbp,%rax,8)
je     1253 <main+0x103>
movslq -0xf4(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rdi
call   1070 <init_search@plt>
movslq -0xf4(%rbp),%rax
mov    -0xf0(%rbp,%rax,8),%rdi
ff
call   1060 <strsearch@plt>
mov    %rax,-0x10(%rbp)
movslq -0xf4(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rsi
mov    -0x10(%rbp),%rcx
lea    0xe73(%rip),%rdx
lea    0xe6b(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
movslq -0xf4(%rbp),%rax
mov    -0xf0(%rbp,%rax,8),%rcx
ff
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
je     1235 <main+0xe5>
mov    -0x10(%rbp),%rsi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0xf4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4(%rbp)
jmp    1199 <main+0x49>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf0c(%rip),%r14
lea    0xef4(%rip),%r15
xor    %ebp,%ebp
jmp    1174 <main+0x34>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x8,%rbp
cmp    $0x68,%rbp
je     11d8 <main+0x98>
lea    0x2bc5(%rip),%rax
mov    0x0(%rbp,%rax,1),%r12
mov    %r12,%rdi
call   1060 <init_search@plt>
lea    0x2c21(%rip),%rax
mov    0x0(%rbp,%rax,1),%r13
mov    %r13,%rdi
call   1050 <strsearch@plt>
mov    %rax,%rbx
test   %rax,%rax
mov    %r14,%rdx
lea    0xeb3(%rip),%rax
cmove  %rax,%rdx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
test   %rbx,%rbx
je     1160 <main+0x20>
lea    0xe98(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1160 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"abb\00"
@.str.1 = [4 x i8] c"you\00"
@.str.2 = [4 x i8] c"not\00"
@.str.3 = [3 x i8] c"it\00"
@.str.4 = [4 x i8] c"dad\00"
@.str.5 = [4 x i8] c"yoo\00"
@.str.6 = [4 x i8] c"hoo\00"
@.str.7 = [3 x i8] c"oo\00"
@.str.8 = [3 x i8] c"oh\00"
@.str.9 = [3 x i8] c"xx\00"
@.str.10 = [2 x i8] c"x\00"
@__const.main.find_strings = [14 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 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 ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 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 ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i32 0, i32 0), i8* null]
@.str.11 = [7 x i8] c"cabbie\00"
@.str.12 = [5 x i8] c"your\00"
@.str.13 = [14 x i8] c"It isn't here\00"
@.str.14 = [15 x i8] c"But it is here\00"
@.str.15 = [6 x i8] c"hodad\00"
@.str.16 = [7 x i8] c"yoohoo\00"
@.str.17 = [2 x i8] c".\00"
@__const.main.search_strings = [13 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i32 0, i32 0)]
@.str.18 = [18 x i8] c"\22%s\22 is%s in \22%s\22\00"
@.str.19 = [1 x i8] zeroinitializer
@.str.20 = [5 x i8] c" not\00"
@.str.21 = [8 x i8] c" [\22%s\22]\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [14 x i8*]
%4 = alloca [13 x i8*]
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [14 x i8*]* %3 to i8*
%7 = bitcast [13 x i8*]* %4 to i8*
store i32 0, i32* %5
br label %8
8: ; preds = %45, %0
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [14 x i8*], [14 x i8*]* %3, i64 0, i64 %10
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %48
14: ; preds = %8
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [14 x i8*], [14 x i8*]* %3, i64 0, i64 %16
%18 = load i8*, i8** %17
%19 = call i32 @init_search(i8* %18)
%20 = load i32, i32* %5
%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 i8* @strsearch(i8* %23)
store i8* %24, i8** %2
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [14 x i8*], [14 x i8*]* %3, i64 0, i64 %26
%28 = load i8*, i8** %27
%29 = load i8*, i8** %2
%30 = icmp ne i8* %29, null
%31 = zext i1 %30 to i64
%32 = select i1 %30, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0)
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [13 x i8*], [13 x i8*]* %4, i64 0, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i8* %28, i8* %32, i8* %36)
%38 = load i8*, i8** %2
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %43
40: ; preds = %14
%41 = load i8*, i8** %2
%42 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i64 0, i64 0), i8* %41)
br label %43
43: ; preds = %40, %14
%44 = call i32 @putchar(i8 signext 10)
br label %45
45: ; preds = %43
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
store i32 %47, i32* %5
br label %8
48: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"abb\00"
@.str.1 = [4 x i8] c"you\00"
@.str.2 = [4 x i8] c"not\00"
@.str.3 = [3 x i8] c"it\00"
@.str.4 = [4 x i8] c"dad\00"
@.str.5 = [4 x i8] c"yoo\00"
@.str.6 = [4 x i8] c"hoo\00"
@.str.7 = [3 x i8] c"oo\00"
@.str.8 = [3 x i8] c"oh\00"
@.str.9 = [3 x i8] c"xx\00"
@.str.10 = [2 x i8] c"x\00"
@__const.main.find_strings = [14 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 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 ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 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 ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i32 0, i32 0), i8* null]
@.str.11 = [7 x i8] c"cabbie\00"
@.str.12 = [5 x i8] c"your\00"
@.str.13 = [14 x i8] c"It isn't here\00"
@.str.14 = [15 x i8] c"But it is here\00"
@.str.15 = [6 x i8] c"hodad\00"
@.str.16 = [7 x i8] c"yoohoo\00"
@.str.17 = [2 x i8] c".\00"
@__const.main.search_strings = [13 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i32 0, i32 0)]
@.str.18 = [18 x i8] c"\22%s\22 is%s in \22%s\22\00"
@.str.19 = [1 x i8] zeroinitializer
@.str.20 = [5 x i8] c" not\00"
@.str.21 = [8 x i8] c" [\22%s\22]\00"
define i32 @main() {
br label %1
1: ; preds = %0, %14
%2 = phi i64 [ 0, %0 ], [ %16, %14 ]
%3 = getelementptr inbounds [14 x i8*], [14 x i8*]* @__const.main.find_strings, i64 0, i64 %2
%4 = load i8*, i8** %3
%5 = tail call i32 @init_search(i8* %4)
%6 = getelementptr inbounds [13 x i8*], [13 x i8*]* @__const.main.search_strings, i64 0, i64 %2
%7 = load i8*, i8** %6
%8 = tail call i8* @strsearch(i8* %7)
%9 = icmp eq i8* %8, null
%10 = select i1 %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.19, i64 0, i64 0)
%11 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i8* %4, i8* %10, i8* %7)
br i1 %9, label %14, label %12
12: ; preds = %1
%13 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i64 0, i64 0), i8* %8)
br label %14
14: ; preds = %12, %1
%15 = tail call i32 @putchar(i8 signext 10)
%16 = add nuw nsw i64 %2, 1
%17 = icmp eq i64 %16, 13
br i1 %17, label %18, label %1
18: ; preds = %14
ret i32 0
}