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

/* Variables and functions */
scalar_t__ strstr(char *, char const *);
bool has_bad_strings(char *text) {
  const char *bad_strings[] = {"ab", "cd", "pq", "xy"};
  int i = 0;
  for (i = 0; i < sizeof(bad_strings) / sizeof(bad_strings[0]); i++) {
    if (strstr(text, bad_strings[i])) {
      return true;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<has_bad_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2cdd(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cda(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cd7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cd4(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    $0x4,%rax
jae    119f <has_bad_strings+0x8f>
mov    -0x10(%rbp),%rdi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     118c <has_bad_strings+0x7c>
movl   $0x1,-0x4(%rbp)
jmp    11a6 <has_bad_strings+0x96>
jmp    1191 <has_bad_strings+0x81>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1156 <has_bad_strings+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_bad_strings>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee3(%rip),%rsi
call   1030 <strstr@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    116c <has_bad_strings+0x5c>
lea    0xed0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strstr@plt>
test   %rax,%rax
jne    116c <has_bad_strings+0x5c>
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strstr@plt>
test   %rax,%rax
jne    116c <has_bad_strings+0x5c>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strstr@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"ab\00"
@.str.1 = [3 x i8] c"cd\00"
@.str.2 = [3 x i8] c"pq\00"
@.str.3 = [3 x i8] c"xy\00"
@__const.has_bad_strings.bad_strings = [4 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 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 ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0)]
define i32 @has_bad_strings(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [4 x i8*]
%5 = alloca i32
store i8* %0, i8** %3
%6 = bitcast [4 x i8*]* %4 to i8*
store i32 0, i32* %5
store i32 0, i32* %5
br label %7
7: ; preds = %21, %1
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = icmp ult i64 %9, 4
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = call i64 @strstr(i8* %12, i8* %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %11
store i32 1, i32* %2
br label %25
20: ; preds = %11
br label %21
21: ; preds = %20
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %7
24: ; preds = %7
store i32 0, i32* %2
br label %25
25: ; preds = %24, %19
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@.str = [3 x i8] c"ab\00"
@.str.1 = [3 x i8] c"cd\00"
@.str.2 = [3 x i8] c"pq\00"
@.str.3 = [3 x i8] c"xy\00"
define i32 @has_bad_strings(i8* %0) {
%2 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %14
4: ; preds = %1
%5 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %10, %7, %4, %1
%15 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 1, %7 ], [ %13, %10 ]
ret i32 %15
}