#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*/ abort();
int /*<<< orphan*/ puts(int /*<<< orphan*/ *);
int /*<<< orphan*/ *strstr(char const *, char *);
int main() {
  puts(strstr("", ""));
  if (strstr("asdf", "asdfg") != NULL) {
    abort();
  }
  if (strstr("", "asdf") != NULL) {
    abort();
  }
  const char *haystack = "The quick brown fox jumps over the lazy dog";
  puts(strstr(haystack, ""));
  puts(strstr(haystack, "the"));
  puts(strstr(haystack, "he"));
  puts(strstr(haystack, "quick "));
  puts(strstr(haystack, "over the"));
  puts(strstr(haystack, " lazy"));
  if (strstr(haystack, " lazz") != NULL) {
    abort();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xefe(%rip),%rsi
mov    %rsi,%rdi
call   1050 <strstr@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
lea    0xeaa(%rip),%rdi
lea    0xea8(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     1173 <main+0x43>
mov    $0x0,%al
call   1030 <abort@plt>
lea    0xec3(%rip),%rdi
lea    0xe7f(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     1197 <main+0x67>
mov    $0x0,%al
call   1030 <abort@plt>
lea    0xe6d(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    -0x8(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    -0x8(%rbp),%rdi
lea    0xe42(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    -0x8(%rbp),%rdi
lea    0xe31(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    -0x8(%rbp),%rdi
lea    0xe22(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    -0x8(%rbp),%rdi
lea    0xe10(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     1253 <main+0x123>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
lea    0xee1(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
lea    0xeae(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb4(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"asdf\00"
@.str.2 = [6 x i8] c"asdfg\00"
@.str.3 = [44 x i8] c"The quick brown fox jumps over the lazy dog\00"
@.str.4 = [4 x i8] c"the\00"
@.str.5 = [3 x i8] c"he\00"
@.str.6 = [7 x i8] c"quick \00"
@.str.7 = [9 x i8] c"over the\00"
@.str.8 = [6 x i8] c" lazy\00"
@.str.9 = [6 x i8] c" lazz\00"
define i32 @main() {
%1 = alloca i8*
%2 = call i32* @strstr(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @puts(i32* %2)
%4 = call i32* @strstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = call i32* @strstr(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %8
store i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i8** %1
%14 = load i8*, i8** %1
%15 = call i32* @strstr(i8* %14, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @puts(i32* %15)
%17 = load i8*, i8** %1
%18 = call i32* @strstr(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @puts(i32* %18)
%20 = load i8*, i8** %1
%21 = call i32* @strstr(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 @puts(i32* %21)
%23 = load i8*, i8** %1
%24 = call i32* @strstr(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 @puts(i32* %24)
%26 = load i8*, i8** %1
%27 = call i32* @strstr(i8* %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%28 = call i32 @puts(i32* %27)
%29 = load i8*, i8** %1
%30 = call i32* @strstr(i8* %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%31 = call i32 @puts(i32* %30)
%32 = load i8*, i8** %1
%33 = call i32* @strstr(i8* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%34 = icmp ne i32* %33, null
br i1 %34, label %35, label %37
35: ; preds = %13
%36 = call i32 (...) @abort()
unreachable
37: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [44 x i8] c"The quick brown fox jumps over the lazy dog\00"
define i32 @main() {
%1 = tail call i32 @putchar(i32 10)
%2 = tail call i32 @puts(i32* dereferenceable(1) bitcast ([44 x i8]* @.str.3 to i32*))
%3 = tail call i32 @puts(i32* dereferenceable(1) bitcast (i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 31) to i32*))
%4 = tail call i32 @puts(i32* dereferenceable(1) bitcast (i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 1) to i32*))
%5 = tail call i32 @puts(i32* dereferenceable(1) bitcast (i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 4) to i32*))
%6 = tail call i32 @puts(i32* dereferenceable(1) bitcast (i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 26) to i32*))
%7 = tail call i32 @puts(i32* dereferenceable(1) bitcast (i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 34) to i32*))
ret i32 0
}