#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*/ cistrcmp(char *, char *, int);
int findkeys(char *str, char keyw[][32], int mode) {
  int i;
  for (i = 0; keyw[i][0]; i++)
    if (!cistrcmp(str, keyw[i], mode))
      return i;
  return (-1);
}


x86 assembly (clang, -O0):
<findkeys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
cmpb   $0x0,(%rax)
je     1184 <findkeys+0x74>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x20(%rbp),%rax
shl    $0x5,%rax
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
call   1030 <cistrcmp@plt>
cmp    $0x0,%eax
jne    1171 <findkeys+0x61>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118b <findkeys+0x7b>
jmp    1176 <findkeys+0x66>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112a <findkeys+0x1a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findkeys>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xffffffff,%r14d
cmpb   $0x0,(%rsi)
je     1154 <findkeys+0x44>
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%r12
xor    %ebp,%ebp
xchg   %ax,%ax
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1030 <cistrcmp@plt>
test   %eax,%eax
je     1151 <findkeys+0x41>
add    $0x1,%ebp
cmpb   $0x0,0x20(%rbx)
lea    0x20(%rbx),%rbx
jne    1130 <findkeys+0x20>
jmp    1154 <findkeys+0x44>
mov    %ebp,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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