#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*/ Q_stricmp(char const *, char *);
int strlen(char const *);
char *Info_ValueForKey(const char *s, const char *key) {
  char pkey[8192];
  static char value[2][8192];
  static int valueindex = 0;
  char *o;
  if (!s || !key) {
    return "";
  }
  if (strlen(s) >= 8192) {
    ;
    return "";
  }
  valueindex ^= 1;
  if (*s == '\\')
    s++;
  while (1) {
    o = pkey;
    while (*s != '\\') {
      if (!*s)
        return "";
      *o++ = *s++;
    }
    *o = 0;
    s++;
    o = value[valueindex];
    while (*s != '\\' && *s) {
      *o++ = *s++;
    }
    *o = 0;
    if (!Q_stricmp(key, pkey))
      return value[valueindex];
    if (!*s)
      break;
    s++;
  }
  return "";
}


x86 assembly (clang, -O0):
<Info_ValueForKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2030,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1149 <Info_ValueForKey+0x29>
cmpq   $0x0,-0x18(%rbp)
jne    1159 <Info_ValueForKey+0x39>
lea    0xeb0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1321 <Info_ValueForKey+0x201>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2000,%eax
jl     117d <Info_ValueForKey+0x5d>
lea    0xe8c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1321 <Info_ValueForKey+0x201>
mov    0x6ebd(%rip),%eax
xor    $0x1,%eax
mov    %eax,0x6eb4(%rip)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    11a8 <Info_ValueForKey+0x88>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11ad <Info_ValueForKey+0x8d>
lea    -0x2020(%rbp),%rax
mov    %rax,-0x2028(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     1215 <Info_ValueForKey+0xf5>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11e8 <Info_ValueForKey+0xc8>
lea    0xe21(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1321 <Info_ValueForKey+0x201>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x2028(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x2028(%rbp)
mov    %cl,(%rax)
jmp    11bb <Info_ValueForKey+0x9b>
mov    -0x2028(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
movslq 0x6e0e(%rip),%rcx
lea    0x2e07(%rip),%rax
shl    $0xd,%rcx
add    %rcx,%rax
mov    %rax,-0x2028(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x5c,%ecx
mov    %al,-0x2029(%rbp)
je     1272 <Info_ValueForKey+0x152>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x2029(%rbp)
mov    -0x2029(%rbp),%al
test   $0x1,%al
jne    1285 <Info_ValueForKey+0x165>
jmp    12b2 <Info_ValueForKey+0x192>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x2028(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x2028(%rbp)
mov    %cl,(%rax)
jmp    1247 <Info_ValueForKey+0x127>
mov    -0x2028(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
lea    -0x2020(%rbp),%rsi
call   1040 <Q_stricmp@plt>
cmp    $0x0,%eax
jne    12f3 <Info_ValueForKey+0x1d3>
movslq 0x6d64(%rip),%rcx
lea    0x2d5d(%rip),%rax
shl    $0xd,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1321 <Info_ValueForKey+0x201>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1305 <Info_ValueForKey+0x1e5>
jmp    1316 <Info_ValueForKey+0x1f6>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11ad <Info_ValueForKey+0x8d>
lea    0xce3(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x2030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Info_ValueForKey>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2000,%rsp
lea    0xec9(%rip),%r14
test   %rdi,%rdi
je     120e <Info_ValueForKey+0xee>
mov    %rsi,%r12
test   %rsi,%rsi
je     120e <Info_ValueForKey+0xee>
mov    %rdi,%r13
call   1030 <strlen@plt>
cmp    $0x1fff,%eax
jg     120e <Info_ValueForKey+0xee>
xorb   $0x1,0x6eda(%rip)
xor    %ebx,%ebx
cmpb   $0x5c,0x0(%r13)
mov    %rsp,%r15
sete   %bl
add    %r13,%rbx
lea    0x2ec3(%rip),%r13
mov    %r15,%rax
mov    (%rbx),%cl
cmp    $0x5c,%cl
je     11a0 <Info_ValueForKey+0x80>
test   %cl,%cl
je     120e <Info_ValueForKey+0xee>
add    $0x1,%rbx
mov    %cl,(%rax)
add    $0x1,%rax
jmp    1180 <Info_ValueForKey+0x60>
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rax)
movslq 0x6e96(%rip),%rax
shl    $0xd,%rax
add    %r13,%rax
add    $0x2,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl -0x1(%rbx),%ecx
test   %cl,%cl
je     11e0 <Info_ValueForKey+0xc0>
cmp    $0x5c,%cl
je     11e0 <Info_ValueForKey+0xc0>
mov    %cl,(%rax)
add    $0x1,%rax
add    $0x1,%rbx
jmp    11c0 <Info_ValueForKey+0xa0>
nopl   0x0(%rax)
movb   $0x0,(%rax)
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <Q_stricmp@plt>
test   %eax,%eax
je     11fd <Info_ValueForKey+0xdd>
cmpb   $0x0,-0x1(%rbx)
mov    %r15,%rax
jne    1180 <Info_ValueForKey+0x60>
jmp    120e <Info_ValueForKey+0xee>
movslq 0x6e3c(%rip),%rax
shl    $0xd,%rax
add    %rax,%r13
mov    %r13,%r14
mov    %r14,%rax
add    $0x2000,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@Info_ValueForKey.value = internal global [2 x [8192 x i8]] zeroinitializer
@Info_ValueForKey.valueindex = internal global i32 0
@.str = [1 x i8] zeroinitializer
define i8* @Info_ValueForKey(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [8192 x i8]
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %14, label %13
13: ; preds = %10, %2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %3
br label %94
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = call i32 @strlen(i8* %15)
%17 = icmp sge i32 %16, 8192
br i1 %17, label %18, label %19
18: ; preds = %14
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %3
br label %94
19: ; preds = %14
%20 = load i32, i32* @Info_ValueForKey.valueindex
%21 = xor i32 %20, 1
store i32 %21, i32* @Info_ValueForKey.valueindex
%22 = load i8*, i8** %4
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 92
br i1 %25, label %26, label %29
26: ; preds = %19
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %4
br label %29
29: ; preds = %26, %19
br label %30
30: ; preds = %29, %90
%31 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
store i8* %31, i8** %7
br label %32
32: ; preds = %42, %30
%33 = load i8*, i8** %4
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp ne i32 %35, 92
br i1 %36, label %37, label %48
37: ; preds = %32
%38 = load i8*, i8** %4
%39 = load i8, i8* %38
%40 = icmp ne i8 %39, 0
br i1 %40, label %42, label %41
41: ; preds = %37
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %3
br label %94
42: ; preds = %37
%43 = load i8*, i8** %4
%44 = getelementptr inbounds i8, i8* %43, i32 1
store i8* %44, i8** %4
%45 = load i8, i8* %43
%46 = load i8*, i8** %7
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %7
store i8 %45, i8* %46
br label %32
48: ; preds = %32
%49 = load i8*, i8** %7
store i8 0, i8* %49
%50 = load i8*, i8** %4
%51 = getelementptr inbounds i8, i8* %50, i32 1
store i8* %51, i8** %4
%52 = load i32, i32* @Info_ValueForKey.valueindex
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [2 x [8192 x i8]], [2 x [8192 x i8]]* @Info_ValueForKey.value, i64 0, i64 %53
%55 = getelementptr inbounds [8192 x i8], [8192 x i8]* %54, i64 0, i64 0
store i8* %55, i8** %7
br label %56
56: ; preds = %68, %48
%57 = load i8*, i8** %4
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp ne i32 %59, 92
br i1 %60, label %61, label %66
61: ; preds = %56
%62 = load i8*, i8** %4
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp ne i32 %64, 0
br label %66
66: ; preds = %61, %56
%67 = phi i1 [ false, %56 ], [ %65, %61 ]
br i1 %67, label %68, label %74
68: ; preds = %66
%69 = load i8*, i8** %4
%70 = getelementptr inbounds i8, i8* %69, i32 1
store i8* %70, i8** %4
%71 = load i8, i8* %69
%72 = load i8*, i8** %7
%73 = getelementptr inbounds i8, i8* %72, i32 1
store i8* %73, i8** %7
store i8 %71, i8* %72
br label %56
74: ; preds = %66
%75 = load i8*, i8** %7
store i8 0, i8* %75
%76 = load i8*, i8** %5
%77 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%78 = call i32 @Q_stricmp(i8* %76, i8* %77)
%79 = icmp ne i32 %78, 0
br i1 %79, label %85, label %80
80: ; preds = %74
%81 = load i32, i32* @Info_ValueForKey.valueindex
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [2 x [8192 x i8]], [2 x [8192 x i8]]* @Info_ValueForKey.value, i64 0, i64 %82
%84 = getelementptr inbounds [8192 x i8], [8192 x i8]* %83, i64 0, i64 0
store i8* %84, i8** %3
br label %94
85: ; preds = %74
%86 = load i8*, i8** %4
%87 = load i8, i8* %86
%88 = icmp ne i8 %87, 0
br i1 %88, label %90, label %89
89: ; preds = %85
br label %93
90: ; preds = %85
%91 = load i8*, i8** %4
%92 = getelementptr inbounds i8, i8* %91, i32 1
store i8* %92, i8** %4
br label %30
93: ; preds = %89
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %3
br label %94
94: ; preds = %93, %80, %41, %18, %13
%95 = load i8*, i8** %3
ret i8* %95
}

LLVM IR (-O2):
@Info_ValueForKey.value = internal global [2 x [8192 x i8]] zeroinitializer
@Info_ValueForKey.valueindex = internal unnamed_addr global i32 0
@.str = [1 x i8] zeroinitializer
define i8* @Info_ValueForKey(i8* %0, i8* %1) {
%3 = alloca [8192 x i8]
%4 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%5 = icmp ne i8* %0, null
%6 = icmp ne i8* %1, null
%7 = and i1 %5, %6
br i1 %7, label %8, label %50
8: ; preds = %2
%9 = tail call i32 @strlen(i8* %0)
%10 = icmp sgt i32 %9, 8191
br i1 %10, label %50, label %11
11: ; preds = %8
%12 = load i32, i32* @Info_ValueForKey.valueindex
%13 = xor i32 %12, 1
store i32 %13, i32* @Info_ValueForKey.valueindex
%14 = load i8, i8* %0
%15 = icmp eq i8 %14, 92
%16 = zext i1 %15 to i64
%17 = getelementptr i8, i8* %0, i64 %16
br label %18
18: ; preds = %25, %11
%19 = phi i8* [ %17, %11 ], [ %26, %25 ]
%20 = phi i8* [ %4, %11 ], [ %27, %25 ]
%21 = load i8, i8* %19
switch i8 %21, label %22 [
i8 92, label %28
i8 0, label %50
]
22: ; preds = %18
%23 = getelementptr inbounds i8, i8* %19, i64 1
%24 = getelementptr inbounds i8, i8* %20, i64 1
store i8 %21, i8* %20
br label %25
25: ; preds = %22, %46
%26 = phi i8* [ %23, %22 ], [ %49, %46 ]
%27 = phi i8* [ %24, %22 ], [ %4, %46 ]
br label %18
28: ; preds = %18
store i8 0, i8* %20
%29 = load i32, i32* @Info_ValueForKey.valueindex
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [2 x [8192 x i8]], [2 x [8192 x i8]]* @Info_ValueForKey.value, i64 0, i64 %30, i64 0
br label %32
32: ; preds = %37, %28
%33 = phi i8* [ %19, %28 ], [ %35, %37 ]
%34 = phi i8* [ %31, %28 ], [ %38, %37 ]
%35 = getelementptr inbounds i8, i8* %33, i64 1
%36 = load i8, i8* %35
switch i8 %36, label %37 [
i8 92, label %39
i8 0, label %39
]
37: ; preds = %32
%38 = getelementptr inbounds i8, i8* %34, i64 1
store i8 %36, i8* %34
br label %32
39: ; preds = %32, %32
store i8 0, i8* %34
%40 = call i32 @Q_stricmp(i8* %1, i8* %4)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %39
%43 = load i32, i32* @Info_ValueForKey.valueindex
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [2 x [8192 x i8]], [2 x [8192 x i8]]* @Info_ValueForKey.value, i64 0, i64 %44, i64 0
br label %50
46: ; preds = %39
%47 = load i8, i8* %35
%48 = icmp eq i8 %47, 0
%49 = getelementptr inbounds i8, i8* %33, i64 2
br i1 %48, label %50, label %25
50: ; preds = %46, %18, %8, %2, %42
%51 = phi i8* [ %45, %42 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %8 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %18 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %46 ]
ret i8* %51
}