#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__ words_imatch(char **, char *);
int words_member(char **keys, int len, char *check) {
  int x;
  for (x = 0; x < len; ++x) {
    char *ch = check;
    if (words_imatch(&ch, keys[x]))
      if (!*ch)
        return x;
  }
  return -1;
}


x86 assembly (clang, -O0):
<words_member>:
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    118d <words_member+0x7d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    -0x30(%rbp),%rdi
call   1030 <words_imatch@plt>
cmp    $0x0,%rax
je     117a <words_member+0x6a>
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1175 <words_member+0x65>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1194 <words_member+0x84>
jmp    117a <words_member+0x6a>
jmp    117f <words_member+0x6f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112a <words_member+0x1a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<words_member>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0xffffffff,%r14d
test   %esi,%esi
jle    116b <words_member+0x5b>
mov    %rdx,%r12
mov    %rdi,%r13
mov    %esi,%ebp
xor    %ebx,%ebx
mov    %rsp,%r15
jmp    1149 <words_member+0x39>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%rbp
je     116b <words_member+0x5b>
mov    %r12,(%rsp)
mov    0x0(%r13,%rbx,8),%rsi
mov    %r15,%rdi
call   1030 <words_imatch@plt>
test   %rax,%rax
je     1140 <words_member+0x30>
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
jne    1140 <words_member+0x30>
mov    %ebx,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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