#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 */
typedef int /*<<< orphan*/ keys;

/* Variables and functions */
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int gps_player_info_key(char *s, char *end) {
  static char *keys[] = {"frags_",   "team_",    "ping_",     "species_",
                         "race_",    "deaths_",  "score_",    "enemy_",
                         "player_",  "keyhash_", "teamname_", "playername_",
                         "keyhash_", "kills_",   "queryid"};
  int i;
  for (i = 0; i < sizeof(keys) / sizeof(char *); i++) {
    int len = strlen(keys[i]);
    if (s + len < end && strncmp(s, keys[i], len) == 0) {
      return len;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<gps_player_info_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0xf,%rax
jae    11b4 <gps_player_info_key+0x94>
movslq -0x1c(%rbp),%rcx
lea    0x2ef0(%rip),%rax
mov    (%rax,%rcx,8),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
add    %rcx,%rax
cmp    -0x18(%rbp),%rax
jae    11a1 <gps_player_info_key+0x81>
mov    -0x10(%rbp),%rdi
movslq -0x1c(%rbp),%rcx
lea    0x2ec0(%rip),%rax
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11a1 <gps_player_info_key+0x81>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11bb <gps_player_info_key+0x9b>
jmp    11a6 <gps_player_info_key+0x86>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1137 <gps_player_info_key+0x17>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gps_player_info_key>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebp,%ebp
lea    0x2c66(%rip),%r13
jmp    114a <gps_player_info_key+0x2a>
nopl   0x0(%rax)
add    $0x8,%rbp
cmp    $0x78,%rbp
je     1179 <gps_player_info_key+0x59>
mov    0x0(%rbp,%r13,1),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r12d
cltq
add    %r15,%rax
cmp    %r14,%rax
jae    1140 <gps_player_info_key+0x20>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1140 <gps_player_info_key+0x20>
jmp    117c <gps_player_info_key+0x5c>
xor    %r12d,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@gps_player_info_key.keys = internal global [15 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i32 0, i32 0)]
@.str = [7 x i8] c"frags_\00"
@.str.1 = [6 x i8] c"team_\00"
@.str.2 = [6 x i8] c"ping_\00"
@.str.3 = [9 x i8] c"species_\00"
@.str.4 = [6 x i8] c"race_\00"
@.str.5 = [8 x i8] c"deaths_\00"
@.str.6 = [7 x i8] c"score_\00"
@.str.7 = [7 x i8] c"enemy_\00"
@.str.8 = [8 x i8] c"player_\00"
@.str.9 = [9 x i8] c"keyhash_\00"
@.str.10 = [10 x i8] c"teamname_\00"
@.str.11 = [12 x i8] c"playername_\00"
@.str.12 = [7 x i8] c"kills_\00"
@.str.13 = [8 x i8] c"queryid\00"
define i32 @gps_player_info_key(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
br label %8
8: ; preds = %36, %2
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 15
br i1 %11, label %12, label %39
12: ; preds = %8
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [15 x i8*], [15 x i8*]* @gps_player_info_key.keys, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @strlen(i8* %16)
store i32 %17, i32* %7
%18 = load i8*, i8** %4
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8*, i8** %5
%23 = icmp ult i8* %21, %22
br i1 %23, label %24, label %35
24: ; preds = %12
%25 = load i8*, i8** %4
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [15 x i8*], [15 x i8*]* @gps_player_info_key.keys, i64 0, i64 %27
%29 = load i8*, i8** %28
%30 = load i32, i32* %7
%31 = call i64 @strncmp(i8* %25, i8* %29, i32 %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %24
%34 = load i32, i32* %7
store i32 %34, i32* %3
br label %40
35: ; preds = %24, %12
br label %36
36: ; preds = %35
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %8
39: ; preds = %8
store i32 0, i32* %3
br label %40
40: ; preds = %39, %33
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@gps_player_info_key.keys = internal unnamed_addr constant [15 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i32 0, i32 0)]
@.str = [7 x i8] c"frags_\00"
@.str.1 = [6 x i8] c"team_\00"
@.str.2 = [6 x i8] c"ping_\00"
@.str.3 = [9 x i8] c"species_\00"
@.str.4 = [6 x i8] c"race_\00"
@.str.5 = [8 x i8] c"deaths_\00"
@.str.6 = [7 x i8] c"score_\00"
@.str.7 = [7 x i8] c"enemy_\00"
@.str.8 = [8 x i8] c"player_\00"
@.str.9 = [9 x i8] c"keyhash_\00"
@.str.10 = [10 x i8] c"teamname_\00"
@.str.11 = [12 x i8] c"playername_\00"
@.str.12 = [7 x i8] c"kills_\00"
@.str.13 = [8 x i8] c"queryid\00"
define i32 @gps_player_info_key(i8* %0, i8* readnone %1) {
br label %3
3: ; preds = %2, %14
%4 = phi i64 [ 0, %2 ], [ %15, %14 ]
%5 = getelementptr inbounds [15 x i8*], [15 x i8*]* @gps_player_info_key.keys, i64 0, i64 %4
%6 = load i8*, i8** %5
%7 = tail call i32 @strlen(i8* %6)
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = icmp ult i8* %9, %1
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = tail call i64 @strncmp(i8* %0, i8* %6, i32 %7)
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %3, %11
%15 = add nuw nsw i64 %4, 1
%16 = icmp eq i64 %15, 15
br i1 %16, label %17, label %3
17: ; preds = %11, %14
%18 = phi i32 [ 0, %14 ], [ %7, %11 ]
ret i32 %18
}