#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 findString(char **, char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char *arr[11] = {"abc", "", "bcc", "", "", "cda", "cdf", "", "", "", "fdc"};
  printf("Array of strings: \n");
  for (int i = 0; i < 11; i++) {
    printf("[%i] => %s\n", i, arr[i]);
  }
  printf("Index of %s string in the array is: %i\n", "\"abc\"",
         findString(arr, "abc", 0, 10));
  printf("Index of %s string in the array is: %i\n", "\"bcc\"",
         findString(arr, "bcc", 0, 10));
  printf("Index of %s string in the array is: %i\n", "\"cda\"",
         findString(arr, "cda", 0, 10));
  printf("Index of %s string in the array is: %i\n", "\"cdf\"",
         findString(arr, "cdf", 0, 10));
  printf("Index of %s string in the array is: %i\n", "\"fdc\"",
         findString(arr, "fdc", 0, 10));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
lea    0x2c76(%rip),%rsi
mov    $0x58,%edx
call   1050 <memcpy@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0xb,-0x64(%rbp)
jge    119b <main+0x6b>
mov    -0x64(%rbp),%esi
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rdx
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1169 <main+0x39>
lea    -0x60(%rbp),%rdi
lea    0xe5a(%rip),%rsi
xor    %edx,%edx
mov    $0xa,%ecx
call   1040 <findString@plt>
mov    %eax,%edx
lea    0xe79(%rip),%rdi
lea    0xe9a(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    0xe30(%rip),%rsi
xor    %edx,%edx
mov    $0xa,%ecx
call   1040 <findString@plt>
mov    %eax,%edx
lea    0xe4b(%rip),%rdi
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    0xe06(%rip),%rsi
xor    %edx,%edx
mov    $0xa,%ecx
call   1040 <findString@plt>
mov    %eax,%edx
lea    0xe1d(%rip),%rdi
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    0xddc(%rip),%rsi
xor    %edx,%edx
mov    $0xa,%ecx
call   1040 <findString@plt>
mov    %eax,%edx
lea    0xdef(%rip),%rdi
lea    0xe22(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    0xdb2(%rip),%rsi
xor    %edx,%edx
mov    $0xa,%ecx
call   1040 <findString@plt>
mov    %eax,%edx
lea    0xdc1(%rip),%rdi
lea    0xdfa(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    0x2ccb(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0x2caf(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0x2c93(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0x2c77(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2c5b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2c3f(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7c(%rip),%rbx
lea    0xe61(%rip),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe95(%rip),%rbp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe39(%rip),%r15
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe00(%rip),%r13
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %r13,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdeb(%rip),%r12
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xda0(%rip),%r14
mov    %rbx,%rdi
mov    $0xa,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
lea    0xd71(%rip),%rsi
xor    %edx,%edx
mov    $0xa,%ecx
call   1050 <findString@plt>
lea    0xd7e(%rip),%rbp
lea    0xd9f(%rip),%rsi
mov    %rbp,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
mov    $0xa,%ecx
call   1050 <findString@plt>
lea    0xd80(%rip),%rsi
mov    %rbp,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %edx,%edx
mov    $0xa,%ecx
call   1050 <findString@plt>
lea    0xd61(%rip),%rsi
mov    %rbp,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %edx,%edx
mov    $0xa,%ecx
call   1050 <findString@plt>
lea    0xd42(%rip),%rsi
mov    %rbp,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    $0xa,%ecx
call   1050 <findString@plt>
lea    0xd23(%rip),%rsi
mov    %rbp,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [4 x i8] c"bcc\00"
@.str.3 = [4 x i8] c"cda\00"
@.str.4 = [4 x i8] c"cdf\00"
@.str.5 = [4 x i8] c"fdc\00"
@__const.main.arr = [11 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 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 ([4 x i8], [4 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 ([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), 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.5, i32 0, i32 0)]
@.str.6 = [20 x i8] c"Array of strings: \0A\00"
@.str.7 = [12 x i8] c"[%i] => %s\0A\00"
@.str.8 = [40 x i8] c"Index of %s string in the array is: %i\0A\00"
@.str.9 = [6 x i8] c"\22abc\22\00"
@.str.10 = [6 x i8] c"\22bcc\22\00"
@.str.11 = [6 x i8] c"\22cda\22\00"
@.str.12 = [6 x i8] c"\22cdf\22\00"
@.str.13 = [6 x i8] c"\22fdc\22\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8*]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [11 x i8*]* %2 to i8*
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %3
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 11
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %3
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [11 x i8*], [11 x i8*]* %2, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 %10, i8* %14)
br label %16
16: ; preds = %9
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %6
19: ; preds = %6
%20 = getelementptr inbounds [11 x i8*], [11 x i8*]* %2, i64 0, i64 0
%21 = call i32 @findString(i8** %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0, i32 10)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [11 x i8*], [11 x i8*]* %2, i64 0, i64 0
%24 = call i32 @findString(i8** %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 10)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [11 x i8*], [11 x i8*]* %2, i64 0, i64 0
%27 = call i32 @findString(i8** %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 10)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [11 x i8*], [11 x i8*]* %2, i64 0, i64 0
%30 = call i32 @findString(i8** %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 10)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds [11 x i8*], [11 x i8*]* %2, i64 0, i64 0
%33 = call i32 @findString(i8** %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 0, i32 10)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [4 x i8] c"bcc\00"
@.str.3 = [4 x i8] c"cda\00"
@.str.4 = [4 x i8] c"cdf\00"
@.str.5 = [4 x i8] c"fdc\00"
@__const.main.arr = [11 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 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 ([4 x i8], [4 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 ([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), 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.5, i32 0, i32 0)]
@.str.7 = [12 x i8] c"[%i] => %s\0A\00"
@.str.8 = [40 x i8] c"Index of %s string in the array is: %i\0A\00"
@.str.9 = [6 x i8] c"\22abc\22\00"
@.str.10 = [6 x i8] c"\22bcc\22\00"
@.str.11 = [6 x i8] c"\22cda\22\00"
@.str.12 = [6 x i8] c"\22cdf\22\00"
@.str.13 = [6 x i8] c"\22fdc\22\00"
@str = [19 x i8] c"Array of strings: \00"
define i32 @main() {
%1 = alloca [11 x i8*]
%2 = bitcast [11 x i8*]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [11 x i8*], [11 x i8*]* %1, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @findString(i8** %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0, i32 10)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 %16)
%18 = call i32 @findString(i8** %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 10)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 %18)
%20 = call i32 @findString(i8** %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 10)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %20)
%22 = call i32 @findString(i8** %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 10)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 %22)
%24 = call i32 @findString(i8** %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 0, i32 10)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 %24)
ret i32 0
}