#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 *, int);
int search(char **, char *, int /*<<< orphan*/, int);
main() {
  char *s[] = {"at", "", "", "", "ball", "", "", "car", "", "", "dad", "", ""};
  printf("%d\n", search(s, "ball", 0, 12));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0x2c66(%rip),%rsi
mov    $0x68,%edx
call   1050 <memcpy@plt>
lea    -0x70(%rbp),%rdi
lea    0xea4(%rip),%rsi
xor    %edx,%edx
mov    $0xc,%ecx
call   1040 <search@plt>
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
mov    0x2ce5(%rip),%rax
mov    %rax,0x60(%rsp)
movaps 0x2cc9(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0x2cad(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0x2c91(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0x2c75(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2c59(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2c3d(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xe85(%rip),%rsi
mov    %rsp,%rdi
xor    %edx,%edx
mov    $0xc,%ecx
call   1040 <search@plt>
lea    0xe7c(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"at\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c"ball\00"
@.str.3 = [4 x i8] c"car\00"
@.str.4 = [4 x i8] c"dad\00"
@__const.main.s = [13 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0)]
@.str.5 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i8*]
store i32 0, i32* %1
%3 = bitcast [13 x i8*]* %2 to i8*
%4 = getelementptr inbounds [13 x i8*], [13 x i8*]* %2, i64 0, i64 0
%5 = call i32 @search(i8** %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 12)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"at\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c"ball\00"
@.str.3 = [4 x i8] c"car\00"
@.str.4 = [4 x i8] c"dad\00"
@__const.main.s = [13 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0)]
@.str.5 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [13 x i8*]
%2 = bitcast [13 x i8*]* %1 to i8*
%3 = getelementptr inbounds [13 x i8*], [13 x i8*]* %1, i64 0, i64 0
%4 = call i32 @search(i8** %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 12)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %4)
ret i32 0
}