#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*/ printf(char *, char const *);
int /*<<< orphan*/ *strstr(char const *, char *);
int main(int argc, char const *argv[]) {
  int i;
  const char *string[7] = {"hello",  "hi",  "played", "chips",
                           "lovely", "ted", "enjoyed"};
  for (i = 0; i < 7; i++) {
    if (strstr(string[i], "ed") != NULL) {
      printf("%s\n", string[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2c8f(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    11b3 <main+0x83>
movslq -0x14(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdi
lea    0xea2(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     11a0 <main+0x70>
movslq -0x14(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
jmp    11a5 <main+0x75>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <main+0x32>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xefb(%rip),%rbx
lea    0xee1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@.str.1 = [3 x i8] c"hi\00"
@.str.2 = [7 x i8] c"played\00"
@.str.3 = [6 x i8] c"chips\00"
@.str.4 = [7 x i8] c"lovely\00"
@.str.5 = [4 x i8] c"ted\00"
@.str.6 = [8 x i8] c"enjoyed\00"
@__const.main.string = [7 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 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 ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 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 ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [3 x i8] c"ed\00"
@.str.8 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [7 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [7 x i8*]* %7 to i8*
store i32 0, i32* %6
br label %9
9: ; preds = %26, %2
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 7
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [7 x i8*], [7 x i8*]* %7, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = call i32* @strstr(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %25
19: ; preds = %12
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [7 x i8*], [7 x i8*]* %7, i64 0, i64 %21
%23 = load i8*, i8** %22
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %19, %12
br label %26
26: ; preds = %25
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %9
29: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [7 x i8] c"played\00"
@.str.5 = [4 x i8] c"ted\00"
@.str.6 = [8 x i8] c"enjoyed\00"
@.str.8 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}