#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 */
scalar_t__ strcmp(char *, char *);
int find_in_unsorted_vocabulary(char *vocabulary[], int vocabulary_size,
                                char *found_name) {
  int i, res = -1;
  if ((found_name == NULL) || (vocabulary_size <= 0) || (vocabulary == NULL)) {
    return -1;
  }
  for (i = 0; i < vocabulary_size; i++) {
    if (vocabulary[i] != NULL) {
      if (strcmp(vocabulary[i], found_name) == 0) {
        res = i;
        break;
      }
    }
  }
  return res;
}


x86 assembly (clang, -O0):
<find_in_unsorted_vocabulary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0xffffffff,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     114a <find_in_unsorted_vocabulary+0x3a>
cmpl   $0x0,-0x14(%rbp)
jle    114a <find_in_unsorted_vocabulary+0x3a>
cmpq   $0x0,-0x10(%rbp)
jne    1156 <find_in_unsorted_vocabulary+0x46>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c4 <find_in_unsorted_vocabulary+0xb4>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11be <find_in_unsorted_vocabulary+0xae>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11ab <find_in_unsorted_vocabulary+0x9b>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11a6 <find_in_unsorted_vocabulary+0x96>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    11be <find_in_unsorted_vocabulary+0xae>
jmp    11ab <find_in_unsorted_vocabulary+0x9b>
jmp    11b0 <find_in_unsorted_vocabulary+0xa0>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115d <find_in_unsorted_vocabulary+0x4d>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_in_unsorted_vocabulary>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xffffffff,%r14d
test   %rdi,%rdi
je     1162 <find_in_unsorted_vocabulary+0x52>
test   %esi,%esi
jle    1162 <find_in_unsorted_vocabulary+0x52>
mov    %rdx,%r15
test   %rdx,%rdx
je     1162 <find_in_unsorted_vocabulary+0x52>
mov    %rdi,%r12
mov    %esi,%ebp
xor    %ebx,%ebx
jmp    1149 <find_in_unsorted_vocabulary+0x39>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1162 <find_in_unsorted_vocabulary+0x52>
mov    (%r12,%rbx,8),%rdi
test   %rdi,%rdi
je     1140 <find_in_unsorted_vocabulary+0x30>
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1140 <find_in_unsorted_vocabulary+0x30>
mov    %ebx,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @find_in_unsorted_vocabulary(i8** %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8** %0, i8*** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 -1, i32* %9
%10 = load i8*, i8** %7
%11 = icmp eq i8* %10, null
br i1 %11, label %18, label %12
12: ; preds = %3
%13 = load i32, i32* %6
%14 = icmp sle i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i8**, i8*** %5
%17 = icmp eq i8** %16, null
br i1 %17, label %18, label %19
18: ; preds = %15, %12, %3
store i32 -1, i32* %4
br label %49
19: ; preds = %15
store i32 0, i32* %8
br label %20
20: ; preds = %44, %19
%21 = load i32, i32* %8
%22 = load i32, i32* %6
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %47
24: ; preds = %20
%25 = load i8**, i8*** %5
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %43
31: ; preds = %24
%32 = load i8**, i8*** %5
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = load i8*, i8** %7
%38 = call i64 @strcmp(i8* %36, i8* %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %31
%41 = load i32, i32* %8
store i32 %41, i32* %9
br label %47
42: ; preds = %31
br label %43
43: ; preds = %42, %24
br label %44
44: ; preds = %43
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %20
47: ; preds = %40, %20
%48 = load i32, i32* %9
store i32 %48, i32* %4
br label %49
49: ; preds = %47, %18
%50 = load i32, i32* %4
ret i32 %50
}

LLVM IR (-O2):
define i32 @find_in_unsorted_vocabulary(i8** %0, i32 %1, i8* %2) {
%4 = icmp eq i8* %2, null
%5 = icmp slt i32 %1, 1
%6 = or i1 %5, %4
%7 = icmp eq i8** %0, null
%8 = or i1 %7, %6
br i1 %8, label %24, label %9
9: ; preds = %3
%10 = zext i32 %1 to i64
br label %11
11: ; preds = %9, %19
%12 = phi i64 [ 0, %9 ], [ %20, %19 ]
%13 = getelementptr inbounds i8*, i8** %0, i64 %12
%14 = load i8*, i8** %13
%15 = icmp eq i8* %14, null
br i1 %15, label %19, label %16
16: ; preds = %11
%17 = tail call i64 @strcmp(i8* %14, i8* %2)
%18 = icmp eq i64 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %11, %16
%20 = add nuw nsw i64 %12, 1
%21 = icmp eq i64 %20, %10
br i1 %21, label %24, label %11
22: ; preds = %16
%23 = trunc i64 %12 to i32
br label %24
24: ; preds = %19, %22, %3
%25 = phi i32 [ -1, %3 ], [ %23, %22 ], [ -1, %19 ]
ret i32 %25
}