#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*/ match(char *, int /*<<< orphan*/, char *,
                         int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int main(void) {
  char text[] = "abcabcababcababxabcabx";
  char key[] = "abcaba";
  match(text, strlen(text), key, strlen(key));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xebf(%rip),%ax
mov    %ax,-0xc(%rbp)
mov    0xeb7(%rip),%al
mov    %al,-0xa(%rbp)
mov    0xeaf(%rip),%eax
mov    %eax,-0x27(%rbp)
mov    0xea9(%rip),%ax
mov    %ax,-0x23(%rbp)
mov    0xea1(%rip),%al
mov    %al,-0x21(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x34(%rbp)
lea    -0x27(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x27(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    %eax,%ecx
call   1040 <match@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x78626163626178,%rax
mov    %rax,0x1f(%rsp)
movl   $0x616261,0xb(%rsp)
movl   $0x61636261,0x8(%rsp)
61
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1040 <match@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.text = [23 x i8] c"abcabcababcababxabcabx\00"
@__const.main.key = [7 x i8] c"abcaba\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [23 x i8]
%3 = alloca [7 x i8]
store i32 0, i32* %1
%4 = bitcast [23 x i8]* %2 to i8*
%5 = bitcast [7 x i8]* %3 to i8*
%6 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 0
%8 = call i32 @strlen(i8* %7)
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @match(i8* %6, i32 %8, i8* %9, i32 %11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.text = [23 x i8] c"abcabcababcababxabcabx\00"
@__const.main.key = [7 x i8] c"abcaba\00"
define i32 @main() {
%1 = alloca [23 x i8]
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [23 x i8], [23 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%5 = call i32 @strlen(i8* %3)
%6 = call i32 @strlen(i8* %4)
%7 = call i32 @match(i8* %3, i32 %5, i8* %4, i32 %6)
ret i32 0
}