#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__ str_ident(char *, char *);
int which_string_member(char *string, char **strings, int n) {
  int i;
  for (i = 1; i < n; i++)
    if (str_ident(strings[i], string))
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<which_string_member>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1173 <which_string_member+0x63>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <str_ident@plt>
cmp    $0x0,%rax
je     1160 <which_string_member+0x50>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117a <which_string_member+0x6a>
jmp    1165 <which_string_member+0x55>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112a <which_string_member+0x1a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<which_string_member>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xffffffff,%r14d
cmp    $0x2,%edx
jl     114f <which_string_member+0x3f>
mov    %rsi,%r15
mov    %rdi,%r12
mov    %edx,%ebp
mov    $0x1,%ebx
mov    (%r15,%rbx,8),%rdi
mov    %r12,%rsi
call   1030 <str_ident@plt>
test   %rax,%rax
jne    114c <which_string_member+0x3c>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1130 <which_string_member+0x20>
jmp    114f <which_string_member+0x3f>
mov    %ebx,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @which_string_member(i8* %0, i8** %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store i32 1, i32* %8
br label %9
9: ; preds = %25, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %9
%14 = load i8**, i8*** %6
%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 = load i8*, i8** %5
%20 = call i64 @str_ident(i8* %18, i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %13
%23 = load i32, i32* %8
store i32 %23, i32* %4
br label %29
24: ; preds = %13
br label %25
25: ; preds = %24
%26 = load i32, i32* %8
%27 = add nsw i32 %26, 1
store i32 %27, i32* %8
br label %9
28: ; preds = %9
store i32 -1, i32* %4
br label %29
29: ; preds = %28, %22
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
define i32 @which_string_member(i8* %0, i8** nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 1
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %13
%8 = phi i64 [ 1, %5 ], [ %14, %13 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i64 @str_ident(i8* %10, i8* %0)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
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
}