#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 array_find(char **, int, char *);
int /*<<< orphan*/ fail_test(int);
void test_find() {
  char *empty_words[] = {};
  char *three_words[] = {"a", "b", "c"};
  char *four_words[] = {"a", "b", "c", "d"};
  if (array_find(empty_words, 0, "does not exist") != -1)
    fail_test(44);
  ;
  if (array_find(three_words, 3, "new_id") != -1)
    fail_test(47);
  ;
  if (array_find(four_words, 4, "a") != 0)
    fail_test(50);
  ;
  if (array_find(four_words, 4, "b") != 1)
    fail_test(52);
  ;
  if (array_find(four_words, 4, "c") != 2)
    fail_test(54);
  ;
  if (array_find(four_words, 4, "d") != 3)
    fail_test(56);
  ;
  if (array_find(four_words, 4, "does not exist") != -1)
    fail_test(58);
  ;
}


x86 assembly (clang, -O0):
<test_find>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x2cb1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cae(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cab(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2cb0(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2cad(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2caa(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2ca7(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
lea    0xe84(%rip),%rdx
call   1040 <array_find@plt>
cmp    $0xffffffff,%eax
je     119a <test_find+0x7a>
mov    $0x2c,%edi
call   1030 <fail_test@plt>
lea    -0x20(%rbp),%rdi
mov    $0x3,%esi
lea    0xe6b(%rip),%rdx
call   1040 <array_find@plt>
cmp    $0xffffffff,%eax
je     11c2 <test_find+0xa2>
mov    $0x2f,%edi
call   1030 <fail_test@plt>
lea    -0x40(%rbp),%rdi
mov    $0x4,%esi
lea    0xe2e(%rip),%rdx
call   1040 <array_find@plt>
cmp    $0x0,%eax
je     11ea <test_find+0xca>
mov    $0x32,%edi
call   1030 <fail_test@plt>
lea    -0x40(%rbp),%rdi
mov    $0x4,%esi
lea    0xe08(%rip),%rdx
call   1040 <array_find@plt>
cmp    $0x1,%eax
je     1212 <test_find+0xf2>
mov    $0x34,%edi
call   1030 <fail_test@plt>
lea    -0x40(%rbp),%rdi
mov    $0x4,%esi
lea    0xde2(%rip),%rdx
call   1040 <array_find@plt>
cmp    $0x2,%eax
je     123a <test_find+0x11a>
mov    $0x36,%edi
call   1030 <fail_test@plt>
lea    -0x40(%rbp),%rdi
mov    $0x4,%esi
lea    0xdd0(%rip),%rdx
call   1040 <array_find@plt>
cmp    $0x3,%eax
je     1262 <test_find+0x142>
mov    $0x38,%edi
call   1030 <fail_test@plt>
lea    -0x40(%rbp),%rdi
mov    $0x4,%esi
lea    0xd94(%rip),%rdx
call   1040 <array_find@plt>
cmp    $0xffffffff,%eax
je     128a <test_find+0x16a>
mov    $0x3a,%edi
call   1030 <fail_test@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_find>:
sub    $0x48,%rsp
mov    0x2cc5(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0x2ca9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0x2ccd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2cb1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xeab(%rip),%rdx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <array_find@plt>
cmp    $0xffffffff,%eax
je     1176 <test_find+0x56>
mov    $0x2c,%edi
call   1030 <fail_test@plt>
lea    0xe98(%rip),%rdx
lea    0x30(%rsp),%rdi
mov    $0x3,%esi
call   1040 <array_find@plt>
cmp    $0xffffffff,%eax
je     119b <test_find+0x7b>
mov    $0x2f,%edi
call   1030 <fail_test@plt>
lea    0xe5e(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1040 <array_find@plt>
test   %eax,%eax
je     11bf <test_find+0x9f>
mov    $0x32,%edi
call   1030 <fail_test@plt>
lea    0xe3c(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1040 <array_find@plt>
cmp    $0x1,%eax
je     11e4 <test_find+0xc4>
mov    $0x34,%edi
call   1030 <fail_test@plt>
lea    0xe19(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1040 <array_find@plt>
cmp    $0x2,%eax
je     1209 <test_find+0xe9>
mov    $0x36,%edi
call   1030 <fail_test@plt>
lea    0xe0a(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1040 <array_find@plt>
cmp    $0x3,%eax
je     122e <test_find+0x10e>
mov    $0x38,%edi
call   1030 <fail_test@plt>
lea    0xdd1(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1040 <array_find@plt>
cmp    $0xffffffff,%eax
je     1253 <test_find+0x133>
mov    $0x3a,%edi
call   1030 <fail_test@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [2 x i8] c"b\00"
@.str.2 = [2 x i8] c"c\00"
@__const.test_find.three_words = [3 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [2 x i8] c"d\00"
@__const.test_find.four_words = [4 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [15 x i8] c"does not exist\00"
@.str.5 = [7 x i8] c"new_id\00"
define void @test_find() {
%1 = alloca [0 x i8*]
%2 = alloca [3 x i8*]
%3 = alloca [4 x i8*]
%4 = bitcast [0 x i8*]* %1 to i8*
%5 = bitcast [3 x i8*]* %2 to i8*
%6 = bitcast [4 x i8*]* %3 to i8*
%7 = getelementptr inbounds [0 x i8*], [0 x i8*]* %1, i64 0, i64 0
%8 = call i32 @array_find(i8** %7, i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%9 = icmp ne i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @fail_test(i32 44)
br label %12
12: ; preds = %10, %0
%13 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 0
%14 = call i32 @array_find(i8** %13, i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @fail_test(i32 47)
br label %18
18: ; preds = %16, %12
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%20 = call i32 @array_find(i8** %19, i32 4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @fail_test(i32 50)
br label %24
24: ; preds = %22, %18
%25 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%26 = call i32 @array_find(i8** %25, i32 4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp ne i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @fail_test(i32 52)
br label %30
30: ; preds = %28, %24
%31 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%32 = call i32 @array_find(i8** %31, i32 4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp ne i32 %32, 2
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = call i32 @fail_test(i32 54)
br label %36
36: ; preds = %34, %30
%37 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%38 = call i32 @array_find(i8** %37, i32 4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp ne i32 %38, 3
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 @fail_test(i32 56)
br label %42
42: ; preds = %40, %36
%43 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%44 = call i32 @array_find(i8** %43, i32 4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp ne i32 %44, -1
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 @fail_test(i32 58)
br label %48
48: ; preds = %46, %42
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
@.str.1 = [2 x i8] c"b\00"
@.str.2 = [2 x i8] c"c\00"
@__const.test_find.three_words = [3 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [2 x i8] c"d\00"
@__const.test_find.four_words = [4 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [15 x i8] c"does not exist\00"
@.str.5 = [7 x i8] c"new_id\00"
define void @test_find() {
%1 = alloca [0 x i8*]
%2 = alloca [3 x i8*]
%3 = alloca [4 x i8*]
%4 = bitcast [0 x i8*]* %1 to i8*
%5 = bitcast [3 x i8*]* %2 to i8*
%6 = bitcast [4 x i8*]* %3 to i8*
%7 = getelementptr inbounds [0 x i8*], [0 x i8*]* %1, i64 0, i64 0
%8 = call i32 @array_find(i8** %7, i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%9 = icmp eq i32 %8, -1
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 @fail_test(i32 44)
br label %12
12: ; preds = %10, %0
%13 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 0
%14 = call i32 @array_find(i8** %13, i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%15 = icmp eq i32 %14, -1
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = call i32 @fail_test(i32 47)
br label %18
18: ; preds = %16, %12
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%20 = call i32 @array_find(i8** %19, i32 4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %18
%23 = call i32 @fail_test(i32 50)
br label %24
24: ; preds = %22, %18
%25 = call i32 @array_find(i8** %19, i32 4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i32 %25, 1
br i1 %26, label %29, label %27
27: ; preds = %24
%28 = call i32 @fail_test(i32 52)
br label %29
29: ; preds = %27, %24
%30 = call i32 @array_find(i8** %19, i32 4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%31 = icmp eq i32 %30, 2
br i1 %31, label %34, label %32
32: ; preds = %29
%33 = call i32 @fail_test(i32 54)
br label %34
34: ; preds = %32, %29
%35 = call i32 @array_find(i8** %19, i32 4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%36 = icmp eq i32 %35, 3
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = call i32 @fail_test(i32 56)
br label %39
39: ; preds = %37, %34
%40 = call i32 @array_find(i8** %19, i32 4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp eq i32 %40, -1
br i1 %41, label %44, label %42
42: ; preds = %39
%43 = call i32 @fail_test(i32 58)
br label %44
44: ; preds = %42, %39
ret void
}