#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 EXIT_SUCCESS;
int /*<<< orphan*/ GetNext(char *, int *);
int KMPIndex(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char str[81];
  int next[81];
  strcpy(str, "abaabcac");
  GetNext(str, next);
  strcpy(str, "aaac");
  GetNext(str, next);
  strcpy(str, "abab");
  GetNext(str, next);
  printf("%d\n", KMPIndex("aaaaacefghij", "aaac", 0));
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x70(%rbp),%rdi
lea    -0x1c0(%rbp),%rsi
call   1060 <GetNext@plt>
lea    -0x70(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x70(%rbp),%rdi
lea    -0x1c0(%rbp),%rsi
call   1060 <GetNext@plt>
lea    -0x70(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x70(%rbp),%rdi
lea    -0x1c0(%rbp),%rsi
call   1060 <GetNext@plt>
lea    0xe57(%rip),%rdi
lea    0xe42(%rip),%rsi
xor    %edx,%edx
call   1030 <KMPIndex@plt>
mov    %eax,%esi
lea    0xe3c(%rip),%rdi
call   1050 <printf@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1b0,%rsp
lea    0xead(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
lea    0x60(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <GetNext@plt>
lea    0xe94(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <GetNext@plt>
lea    0xe7c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <GetNext@plt>
lea    0xe6b(%rip),%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1030 <KMPIndex@plt>
lea    0xe56(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
add    $0x1b0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"abaabcac\00"
@.str.1 = [5 x i8] c"aaac\00"
@.str.2 = [5 x i8] c"abab\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [13 x i8] c"aaaaacefghij\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [81 x i8]
%7 = alloca [81 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [81 x i32], [81 x i32]* %7, i64 0, i64 0
%12 = call i32 @GetNext(i8* %10, i32* %11)
%13 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%16 = getelementptr inbounds [81 x i32], [81 x i32]* %7, i64 0, i64 0
%17 = call i32 @GetNext(i8* %15, i32* %16)
%18 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%19 = call i32 @strcpy(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%20 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%21 = getelementptr inbounds [81 x i32], [81 x i32]* %7, i64 0, i64 0
%22 = call i32 @GetNext(i8* %20, i32* %21)
%23 = call i32 @KMPIndex(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %23)
%25 = load i32, i32* @EXIT_SUCCESS
ret i32 %25
}

LLVM IR (-O2):
@.str = [9 x i8] c"abaabcac\00"
@.str.1 = [5 x i8] c"aaac\00"
@.str.2 = [5 x i8] c"abab\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [13 x i8] c"aaaaacefghij\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [81 x i8]
%4 = alloca [81 x i32]
%5 = getelementptr inbounds [81 x i8], [81 x i8]* %3, i64 0, i64 0
%6 = bitcast [81 x i32]* %4 to i8*
%7 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [81 x i32], [81 x i32]* %4, i64 0, i64 0
%9 = call i32 @GetNext(i8* %5, i32* %8)
%10 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @GetNext(i8* %5, i32* %8)
%12 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @GetNext(i8* %5, i32* %8)
%14 = call i32 @KMPIndex(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @EXIT_SUCCESS
ret i32 %16
}