#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 strlen(char const *);
char *strstr(char const *, char const *);
int isInString(const char *string, const char *model) {
  char *occurence;
  int length;
  occurence = strstr(string, model);
  length = strlen(model);
  if (occurence != NULL &&
      (occurence[length] == ' ' || occurence[length] == '\n' ||
       occurence[length] == '\0'))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isInString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11a3 <isInString+0x83>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     1197 <isInString+0x77>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     1197 <isInString+0x77>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    11a3 <isInString+0x83>
movl   $0x1,-0x4(%rbp)
jmp    11aa <isInString+0x8a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isInString>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1040 <strstr@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %r14,%r14
je     115e <isInString+0x3e>
cltq
movzbl (%r14,%rax,1),%ecx
cmp    $0x20,%rcx
ja     115e <isInString+0x3e>
mov    $0x1,%eax
movabs $0x100000401,%rdx
bt     %rcx,%rdx
jb     1160 <isInString+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @isInString(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i8* @strstr(i8* %8, i8* %9)
store i8* %10, i8** %6
%11 = load i8*, i8** %5
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %7
%13 = load i8*, i8** %6
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %40
15: ; preds = %2
%16 = load i8*, i8** %6
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 32
br i1 %22, label %39, label %23
23: ; preds = %15
%24 = load i8*, i8** %6
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 10
br i1 %30, label %39, label %31
31: ; preds = %23
%32 = load i8*, i8** %6
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %31, %23, %15
store i32 1, i32* %3
br label %41
40: ; preds = %31, %2
store i32 0, i32* %3
br label %41
41: ; preds = %40, %39
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
define i32 @isInString(i8* %0, i8* %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp eq i8* %3, null
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = sext i32 %4 to i64
%8 = getelementptr inbounds i8, i8* %3, i64 %7
%9 = load i8, i8* %8
switch i8 %9, label %10 [
i8 32, label %11
i8 10, label %11
i8 0, label %11
]
10: ; preds = %6, %2
br label %11
11: ; preds = %6, %6, %6, %10
%12 = phi i32 [ 0, %10 ], [ 1, %6 ], [ 1, %6 ], [ 1, %6 ]
ret i32 %12
}