#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*/ strcmp(char const *, char *);
int ILLutil_array_index(char *list[], int n, const char *name) {
  int i;
  for (i = 0; i < n; i++) {
    if ((list[i] != NULL) && !strcmp(name, list[i])) {
      return i;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<ILLutil_array_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1185 <ILLutil_array_index+0x75>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1172 <ILLutil_array_index+0x62>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1172 <ILLutil_array_index+0x62>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118c <ILLutil_array_index+0x7c>
jmp    1177 <ILLutil_array_index+0x67>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112a <ILLutil_array_index+0x1a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ILLutil_array_index>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xffffffff,%r14d
test   %esi,%esi
jle    1151 <ILLutil_array_index+0x41>
mov    %rdx,%r15
mov    %rdi,%r12
mov    %esi,%ebp
xor    %ebx,%ebx
jmp    1139 <ILLutil_array_index+0x29>
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1151 <ILLutil_array_index+0x41>
mov    (%r12,%rbx,8),%rsi
test   %rsi,%rsi
je     1130 <ILLutil_array_index+0x20>
mov    %r15,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1130 <ILLutil_array_index+0x20>
mov    %ebx,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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