#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 */
scalar_t__ strncmp(char *, char *, size_t);
int seek_match(char *sp, size_t sp_len, char *l, unsigned int ll) {
  int i = 0;
  int flag = 1;
  for (i = 0; i < ll - sp_len; i++) {
    if (l[i] == sp[0]) {
      if (strncmp(&l[i], &sp[0], sp_len) == 0) {
        flag = 0;
        break;
      }
    }
  }
  return flag;
}


x86 assembly (clang, -O0):
<seek_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
movslq -0x20(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    -0x10(%rbp),%rcx
cmp    %rcx,%rax
jae    11b1 <seek_match+0xa1>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    119e <seek_match+0x8e>
mov    -0x18(%rbp),%rdi
movslq -0x20(%rbp),%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1199 <seek_match+0x89>
movl   $0x0,-0x24(%rbp)
jmp    11b1 <seek_match+0xa1>
jmp    119e <seek_match+0x8e>
jmp    11a3 <seek_match+0x93>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113c <seek_match+0x2c>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seek_match>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%ebp
mov    $0x1,%r14d
cmp    %rsi,%rbp
je     115b <seek_match+0x4b>
mov    %rdx,%rbx
mov    %rsi,%r12
mov    %rdi,%r15
jmp    113d <seek_match+0x2d>
add    $0x1,%rbx
add    $0xffffffffffffffff,%rbp
cmp    %rbp,%r12
je     115b <seek_match+0x4b>
movzbl (%rbx),%eax
cmp    (%r15),%al
jne    1130 <seek_match+0x20>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1130 <seek_match+0x20>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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