#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 HORSPOOL(char *, int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strlen(char *);
int main() {
  char x[] = "abc";
  char y[] = "ajfisafjsjnfricjmfiswhcismhcgiabcsfisrj,"
             "fiserhfisefieshabcabcjeiofsjifwabckabcjdfsjfsrm";
  int r;
  printf("%s\n", y);
  r = HORSPOOL(x, strlen(x), y, strlen(y));
  if (r < 1)
    printf("String pattern not found.\n");
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xea8(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xeca(%rip),%rsi
mov    $0x58,%edx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rsi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x8(%rbp),%rax
mov    %rax,-0x80(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x74(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x70(%rbp)
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x80(%rbp),%rdi
mov    -0x74(%rbp),%esi
mov    -0x70(%rbp),%rdx
mov    %eax,%ecx
call   1060 <HORSPOOL@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0x1,-0x64(%rbp)
jge    11d4 <main+0x94>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
movl   $0x636261,0xc(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe95(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe79(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x6d7273666a7366,%rax
mov    %rax,0x60(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1060 <HORSPOOL@plt>
test   %eax,%eax
jg     11de <main+0x9e>
lea    0xe7f(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.x = [4 x i8] c"abc\00"
@__const.main.y = [88 x i8] c"ajfisafjsjnfricjmfiswhcismhcgiabcsfisrj,fiserhfisefieshabcabcjeiofsjifwabckabcjdfsjfsrm\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [27 x i8] c"String pattern not found.\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca [88 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [4 x i8]* %2 to i8*
%6 = bitcast [88 x i8]* %3 to i8*
%7 = getelementptr inbounds [88 x i8], [88 x i8]* %3, i64 0, i64 0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = getelementptr inbounds [88 x i8], [88 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [88 x i8], [88 x i8]* %3, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @HORSPOOL(i8* %9, i32 %11, i8* %12, i32 %14)
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.y = [88 x i8] c"ajfisafjsjnfricjmfiswhcismhcgiabcsfisrj,fiserhfisefieshabcabcjeiofsjifwabckabcjdfsjfsrm\00"
@str = [26 x i8] c"String pattern not found.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [88 x i8]
%3 = bitcast i32* %1 to i8*
store i32 6513249, i32* %1
%4 = getelementptr inbounds [88 x i8], [88 x i8]* %2, i64 0, i64 0
%5 = call i32 @puts(i8* %4)
%6 = call i32 @strlen(i8* %3)
%7 = call i32 @strlen(i8* %4)
%8 = call i32 @HORSPOOL(i8* %3, i32 %6, i8* %4, i32 %7)
%9 = icmp slt i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = call i32 @putchar(i32 10)
ret i32 0
}