#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 strcasecmp(char const *, char const *);
int find_str_index(char **strArr, int numStr, char *str) {
  int index___0;
  int tmp;
  {
    index___0 = 0;
    while (index___0 < numStr) {
      tmp = strcasecmp((char const *)*(strArr + index___0), (char const *)str);
      if (tmp == 0) {
        return (index___0);
      }
      index___0++;
    }
    return (-1);
  }
}


x86 assembly (clang, -O0):
<find_str_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    1171 <find_str_index+0x61>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcasecmp@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jne    1163 <find_str_index+0x53>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <find_str_index+0x68>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112a <find_str_index+0x1a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_str_index>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xffffffff,%r14d
test   %esi,%esi
jle    114e <find_str_index+0x3e>
mov    %rdx,%r15
mov    %rdi,%r12
mov    %esi,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r12,%rbx,8),%rdi
mov    %r15,%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     114b <find_str_index+0x3b>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1130 <find_str_index+0x20>
jmp    114e <find_str_index+0x3e>
mov    %ebx,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @find_str_index(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 0, i32* %8
br label %10
10: ; preds = %26, %3
%11 = load i32, i32* %8
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %29
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = load i8*, i8** %7
%21 = call i32 @strcasecmp(i8* %19, i8* %20)
store i32 %21, i32* %9
%22 = load i32, i32* %9
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %14
%25 = load i32, i32* %8
store i32 %25, i32* %4
br label %30
26: ; preds = %14
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %10
29: ; preds = %10
store i32 -1, i32* %4
br label %30
30: ; preds = %29, %24
%31 = load i32, i32* %4
ret i32 %31
}

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