#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 BF(char *, int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strlen(char *);
int main() {
  char x[] = "ello";
  char y[] = "Hello world! Hello world! Hello world!";
  int r;
  printf("%s\n", y);
  r = BF(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    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeab(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xea6(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xec4(%rip),%rsi
mov    $0x27,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rsi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x9(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x9(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x44(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    %eax,%ecx
call   1060 <BF@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
jge    11da <main+0x9a>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
movb   $0x0,0xc(%rsp)
movl   $0x6f6c6c65,0x8(%rsp)
6f
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x21646c726f7720,%rax
mov    %rax,0x2f(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x8(%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 <BF@plt>
test   %eax,%eax
jg     11bf <main+0x7f>
lea    0xe4b(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.x = [5 x i8] c"ello\00"
@__const.main.y = [39 x i8] c"Hello world! Hello world! Hello world!\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 [5 x i8]
%3 = alloca [39 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [5 x i8]* %2 to i8*
%6 = bitcast [39 x i8]* %3 to i8*
%7 = getelementptr inbounds [39 x i8], [39 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 [5 x i8], [5 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = getelementptr inbounds [39 x i8], [39 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [39 x i8], [39 x i8]* %3, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @BF(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.x = [5 x i8] c"ello\00"
@__const.main.y = [39 x i8] c"Hello world! Hello world! Hello world!\00"
@str = [26 x i8] c"String pattern not found.\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca [39 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [39 x i8], [39 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 @BF(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
}