#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 len(char *);
int isSourceInStr(char *str, char *source, int n) {
  for (int i = 0; i < len(source); i++)
    if (str[i + n] != source[i])
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<isSourceInStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <len@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jge    118a <isSourceInStr+0x7a>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1177 <isSourceInStr+0x67>
movl   $0x0,-0x4(%rbp)
jmp    1191 <isSourceInStr+0x81>
jmp    117c <isSourceInStr+0x6c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112a <isSourceInStr+0x1a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isSourceInStr>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%r12
mov    %rsi,%rdi
call   1030 <len@plt>
mov    $0x1,%r14d
test   %eax,%eax
jle    1162 <isSourceInStr+0x52>
movslq %r15d,%rax
add    %rax,%r12
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movzbl (%r12,%rbp,1),%eax
cmp    (%rbx,%rbp,1),%al
jne    115f <isSourceInStr+0x4f>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1030 <len@plt>
cltq
cmp    %rax,%rbp
jl     1140 <isSourceInStr+0x30>
jmp    1162 <isSourceInStr+0x52>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isSourceInStr(i8* nocapture %0, i8* %1, i32 %2) {
%4 = tail call i32 @len(i8* %1)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = sext i32 %2 to i64
br label %12
8: ; preds = %12
%9 = tail call i32 @len(i8* %1)
%10 = sext i32 %9 to i64
%11 = icmp slt i64 %20, %10
br i1 %11, label %12, label %21
12: ; preds = %6, %8
%13 = phi i64 [ 0, %6 ], [ %20, %8 ]
%14 = add nsw i64 %13, %7
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = getelementptr inbounds i8, i8* %1, i64 %13
%18 = load i8, i8* %17
%19 = icmp eq i8 %16, %18
%20 = add nuw nsw i64 %13, 1
br i1 %19, label %8, label %21
21: ; preds = %8, %12, %3
%22 = phi i32 [ 1, %3 ], [ 0, %12 ], [ 1, %8 ]
ret i32 %22
}