#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 /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ quick_search(char *, char *);
int main() {
  char P[] = "abc";
  {
    printf("TEXT: '%s'\n", "abcgaaabbbabbbc");
    printf("PATTERN: '%s'\n", P);
    quick_search("abcgaaabbbabbbc", P);
    puts("");
  };
  {
    printf("TEXT: '%s'\n", "accgaaabbbabbabc");
    printf("PATTERN: '%s'\n", P);
    quick_search("accgaaabbbabbabc", P);
    puts("");
  };
  {
    printf("TEXT: '%s'\n", "accgaaabcbbabbab");
    printf("PATTERN: '%s'\n", P);
    quick_search("accgaaabcbbabbab", P);
    puts("");
  };
  {
    printf("TEXT: '%s'\n", "abcgaaabcabcbababc");
    printf("PATTERN: '%s'\n", P);
    quick_search("abcgaaabcabcbababc", P);
    puts("");
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xf1e(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    0xeb8(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1040 <printf@plt>
lea    -0x4(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    -0x4(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1050 <quick_search@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xe79(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1040 <printf@plt>
lea    -0x4(%rbp),%rsi
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
lea    -0x4(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1050 <quick_search@plt>
lea    0xe70(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3a(%rip),%rdi
lea    0xe6f(%rip),%rsi
call   1040 <printf@plt>
lea    -0x4(%rbp),%rsi
lea    0xe3f(%rip),%rdi
call   1040 <printf@plt>
lea    -0x4(%rbp),%rsi
lea    0xe4f(%rip),%rdi
call   1050 <quick_search@plt>
lea    0xe31(%rip),%rdi
call   1030 <puts@plt>
lea    0xdfb(%rip),%rdi
lea    0xe41(%rip),%rsi
call   1040 <printf@plt>
lea    -0x4(%rbp),%rsi
lea    0xe00(%rip),%rdi
call   1040 <printf@plt>
lea    -0x4(%rbp),%rsi
lea    0xe21(%rip),%rdi
call   1050 <quick_search@plt>
lea    0xdf2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x636261,0x4(%rsp)
lea    0xeb9(%rip),%r14
lea    0xebe(%rip),%r12
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <printf@plt>
lea    0xebc(%rip),%r15
lea    0x4(%rsp),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <quick_search@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe9f(%rip),%r12
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <quick_search@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe7e(%rip),%r12
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <quick_search@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe5d(%rip),%r12
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <quick_search@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.P = [4 x i8] c"abc\00"
@.str = [12 x i8] c"TEXT: '%s'\0A\00"
@.str.1 = [16 x i8] c"abcgaaabbbabbbc\00"
@.str.2 = [15 x i8] c"PATTERN: '%s'\0A\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [17 x i8] c"accgaaabbbabbabc\00"
@.str.5 = [17 x i8] c"accgaaabcbbabbab\00"
@.str.6 = [19 x i8] c"abcgaaabcabcbababc\00"
define i32 @main() {
%1 = alloca [4 x i8]
%2 = bitcast [4 x i8]* %1 to i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%7 = call i32 @quick_search(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%13 = call i32 @quick_search(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %12)
%14 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%19 = call i32 @quick_search(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %18)
%20 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%23 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%25 = call i32 @quick_search(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %24)
%26 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"TEXT: '%s'\0A\00"
@.str.1 = [16 x i8] c"abcgaaabbbabbbc\00"
@.str.2 = [15 x i8] c"PATTERN: '%s'\0A\00"
@.str.4 = [17 x i8] c"accgaaabbbabbabc\00"
@.str.5 = [17 x i8] c"accgaaabcbbabbab\00"
@.str.6 = [19 x i8] c"abcgaaabcabcbababc\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 6513249, i32* %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%5 = call i32 @quick_search(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i32 @putchar(i32 10)
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%9 = call i32 @quick_search(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%10 = call i32 @putchar(i32 10)
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%13 = call i32 @quick_search(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%14 = call i32 @putchar(i32 10)
%15 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%17 = call i32 @quick_search(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %2)
%18 = call i32 @putchar(i32 10)
ret i32 0
}