#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*/ Com_Printf(char *);
int /*<<< orphan*/ Q_bstrcpy(char *, char *);
scalar_t__ strchr(char const *, char);
int /*<<< orphan*/ strcmp(char const *, char *);
int strlen(char *);
void Info_RemoveKey(char *s, const char *key) {
  char *start;
  char pkey[1024];
  char value[1024];
  char *o;
  if (strlen(s) >= 1024) {
    Com_Printf("Error: Info_RemoveKey: oversize infostring");
  }
  if (strchr(key, '\\')) {
    return;
  }
  while (1) {
    start = s;
    if (*s == '\\')
      s++;
    o = pkey;
    while (*s != '\\') {
      if (!*s)
        return;
      *o++ = *s++;
    }
    *o = 0;
    s++;
    o = value;
    while (*s != '\\' && *s) {
      if (!*s)
        return;
      *o++ = *s++;
    }
    *o = 0;
    if (!strcmp(key, pkey)) {
      Q_bstrcpy(start, s);
      return;
    }
    if (!*s)
      return;
  }
}


x86 assembly (clang, -O0):
<Info_RemoveKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x400,%eax
jl     1183 <Info_RemoveKey+0x33>
lea    0xe82(%rip),%rdi
call   1070 <Com_Printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5c,%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     11a0 <Info_RemoveKey+0x50>
jmp    1313 <Info_RemoveKey+0x1c3>
jmp    11a5 <Info_RemoveKey+0x55>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    11c9 <Info_RemoveKey+0x79>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x828(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     1226 <Info_RemoveKey+0xd6>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11f9 <Info_RemoveKey+0xa9>
jmp    1313 <Info_RemoveKey+0x1c3>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x828(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x828(%rbp)
mov    %cl,(%rax)
jmp    11d7 <Info_RemoveKey+0x87>
mov    -0x828(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
lea    -0x820(%rbp),%rax
mov    %rax,-0x828(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x5c,%ecx
mov    %al,-0x829(%rbp)
je     1275 <Info_RemoveKey+0x125>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x829(%rbp)
mov    -0x829(%rbp),%al
test   $0x1,%al
jne    1288 <Info_RemoveKey+0x138>
jmp    12c7 <Info_RemoveKey+0x177>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    129a <Info_RemoveKey+0x14a>
jmp    1313 <Info_RemoveKey+0x1c3>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x828(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x828(%rbp)
mov    %cl,(%rax)
jmp    124a <Info_RemoveKey+0xfa>
mov    -0x828(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    12fc <Info_RemoveKey+0x1ac>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <Q_bstrcpy@plt>
jmp    1313 <Info_RemoveKey+0x1c3>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    130e <Info_RemoveKey+0x1be>
jmp    1313 <Info_RemoveKey+0x1c3>
jmp    11a5 <Info_RemoveKey+0x55>
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Info_RemoveKey>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x800,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
cmp    $0x400,%eax
jl     117e <Info_RemoveKey+0x2e>
lea    0xe87(%rip),%rdi
call   1070 <Com_Printf@plt>
mov    %r14,%rdi
mov    $0x5c,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     11a1 <Info_RemoveKey+0x51>
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    (%r12),%al
lea    0x400(%rsp),%r15
xor    %ebx,%ebx
cmp    $0x5c,%al
sete   %bl
add    %r12,%rbx
mov    %r15,%rax
nopw   0x0(%rax,%rax,1)
movzbl (%rbx),%ecx
test   %cl,%cl
je     1190 <Info_RemoveKey+0x40>
cmp    $0x5c,%cl
je     11e0 <Info_RemoveKey+0x90>
add    $0x1,%rbx
mov    %cl,(%rax)
add    $0x1,%rax
jmp    11c0 <Info_RemoveKey+0x70>
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rax)
mov    $0x1,%r13d
nopl   0x0(%rax)
movzbl (%rbx,%r13,1),%eax
test   %al,%al
je     1210 <Info_RemoveKey+0xc0>
cmp    $0x5c,%al
je     1210 <Info_RemoveKey+0xc0>
mov    %al,-0x1(%rsp,%r13,1)
add    $0x1,%r13
jmp    11f0 <Info_RemoveKey+0xa0>
nopl   0x0(%rax,%rax,1)
movb   $0x0,-0x1(%rsp,%r13,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
add    %r13,%rbx
test   %eax,%eax
je     123a <Info_RemoveKey+0xea>
mov    (%rbx),%al
mov    %rbx,%r12
test   %al,%al
jne    11ad <Info_RemoveKey+0x5d>
jmp    1190 <Info_RemoveKey+0x40>
mov    %r12,%rdi
mov    %rbx,%rsi
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <Q_bstrcpy@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"Error: Info_RemoveKey: oversize infostring\00"
define void @Info_RemoveKey(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
%11 = icmp sge i32 %10, 1024
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @Com_Printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
%15 = load i8*, i8** %4
%16 = call i64 @strchr(i8* %15, i8 signext 92)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
br label %91
19: ; preds = %14
br label %20
20: ; preds = %19, %90
%21 = load i8*, i8** %3
store i8* %21, i8** %5
%22 = load i8*, i8** %3
%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 = %20
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %3
br label %29
29: ; preds = %26, %20
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
store i8* %30, i8** %8
br label %31
31: ; preds = %41, %29
%32 = load i8*, i8** %3
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 92
br i1 %35, label %36, label %47
36: ; preds = %31
%37 = load i8*, i8** %3
%38 = load i8, i8* %37
%39 = icmp ne i8 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %36
br label %91
41: ; preds = %36
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %3
%44 = load i8, i8* %42
%45 = load i8*, i8** %8
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %8
store i8 %44, i8* %45
br label %31
47: ; preds = %31
%48 = load i8*, i8** %8
store i8 0, i8* %48
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %3
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
store i8* %51, i8** %8
br label %52
52: ; preds = %69, %47
%53 = load i8*, i8** %3
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp ne i32 %55, 92
br i1 %56, label %57, label %62
57: ; preds = %52
%58 = load i8*, i8** %3
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp ne i32 %60, 0
br label %62
62: ; preds = %57, %52
%63 = phi i1 [ false, %52 ], [ %61, %57 ]
br i1 %63, label %64, label %75
64: ; preds = %62
%65 = load i8*, i8** %3
%66 = load i8, i8* %65
%67 = icmp ne i8 %66, 0
br i1 %67, label %69, label %68
68: ; preds = %64
br label %91
69: ; preds = %64
%70 = load i8*, i8** %3
%71 = getelementptr inbounds i8, i8* %70, i32 1
store i8* %71, i8** %3
%72 = load i8, i8* %70
%73 = load i8*, i8** %8
%74 = getelementptr inbounds i8, i8* %73, i32 1
store i8* %74, i8** %8
store i8 %72, i8* %73
br label %52
75: ; preds = %62
%76 = load i8*, i8** %8
store i8 0, i8* %76
%77 = load i8*, i8** %4
%78 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%79 = call i32 @strcmp(i8* %77, i8* %78)
%80 = icmp ne i32 %79, 0
br i1 %80, label %85, label %81
81: ; preds = %75
%82 = load i8*, i8** %5
%83 = load i8*, i8** %3
%84 = call i32 @Q_bstrcpy(i8* %82, i8* %83)
br label %91
85: ; preds = %75
%86 = load i8*, i8** %3
%87 = load i8, i8* %86
%88 = icmp ne i8 %87, 0
br i1 %88, label %90, label %89
89: ; preds = %85
br label %91
90: ; preds = %85
br label %20
91: ; preds = %89, %81, %68, %40, %18
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c"Error: Info_RemoveKey: oversize infostring\00"
define void @Info_RemoveKey(i8* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @strlen(i8* %0)
%8 = icmp sgt i32 %7, 1023
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 @Com_Printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = tail call i64 @strchr(i8* %1, i8 signext 92)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %45
14: ; preds = %11
%15 = load i8, i8* %0
br label %16
16: ; preds = %14, %42
%17 = phi i8 [ %43, %42 ], [ %15, %14 ]
%18 = phi i8* [ %33, %42 ], [ %0, %14 ]
%19 = icmp eq i8 %17, 92
%20 = zext i1 %19 to i64
%21 = getelementptr i8, i8* %18, i64 %20
br label %22
22: ; preds = %26, %16
%23 = phi i8* [ %21, %16 ], [ %27, %26 ]
%24 = phi i8* [ %5, %16 ], [ %28, %26 ]
%25 = load i8, i8* %23
switch i8 %25, label %26 [
i8 92, label %29
i8 0, label %45
]
26: ; preds = %22
%27 = getelementptr inbounds i8, i8* %23, i64 1
%28 = getelementptr inbounds i8, i8* %24, i64 1
store i8 %25, i8* %24
br label %22
29: ; preds = %22
store i8 0, i8* %24
br label %30
30: ; preds = %35, %29
%31 = phi i8* [ %23, %29 ], [ %33, %35 ]
%32 = phi i8* [ %6, %29 ], [ %36, %35 ]
%33 = getelementptr inbounds i8, i8* %31, i64 1
%34 = load i8, i8* %33
switch i8 %34, label %35 [
i8 92, label %37
i8 0, label %37
]
35: ; preds = %30
%36 = getelementptr inbounds i8, i8* %32, i64 1
store i8 %34, i8* %32
br label %30
37: ; preds = %30, %30
store i8 0, i8* %32
%38 = call i32 @strcmp(i8* dereferenceable(1) %1, i8* %5)
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = tail call i32 @Q_bstrcpy(i8* %18, i8* %33)
br label %45
42: ; preds = %37
%43 = load i8, i8* %33
%44 = icmp eq i8 %43, 0
br i1 %44, label %45, label %16
45: ; preds = %42, %22, %11, %40
ret void
}