#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*/ newv;

/* Variables and functions */
int /*<<< orphan*/ Info_RemoveKey(char *, char const *);
char *Info_ValueForKey(char *, char const *, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char const *);
int strlen(char const *);
scalar_t__ strstr(char const *, char *);
void Info_SetValueForStarKey(char *s, const char *key, const char *value,
                             int maxsize) {
  char newv[1024], *v;
  int c;
  if (strstr(key, "\\") || strstr(value, "\\")) {
    return;
  }
  if (strstr(key, "\"") || strstr(value, "\"")) {
    return;
  }
  if (strlen(key) >= 64 || strlen(value) >= 64) {
    return;
  }
  if (*(v = Info_ValueForKey(s, key, newv, sizeof(newv)))) {
    if (strlen(value) - strlen(v) + strlen(s) + 1 > maxsize) {
      return;
    }
  }
  Info_RemoveKey(s, key);
  if (!value || !strlen(value))
    return;
  snprintf(newv, sizeof(newv), "\\%s\\%s", key, value);
  if ((int)(strlen(newv) + strlen(s) + 1) > maxsize) {
    return;
  }
  s += strlen(s);
  v = newv;
  while (*v) {
    c = (unsigned char)*v++;
    if (c > 13)
      *s++ = c;
  }
  *s = 0;
}


x86 assembly (clang, -O0):
<Info_SetValueForStarKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
jne    119e <Info_SetValueForStarKey+0x4e>
mov    -0x18(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
je     11a3 <Info_SetValueForStarKey+0x53>
jmp    138e <Info_SetValueForStarKey+0x23e>
mov    -0x10(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
jne    11d7 <Info_SetValueForStarKey+0x87>
mov    -0x18(%rbp),%rdi
lea    0xe3a(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
je     11dc <Info_SetValueForStarKey+0x8c>
jmp    138e <Info_SetValueForStarKey+0x23e>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x40,%eax
jge    1200 <Info_SetValueForStarKey+0xb0>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x40,%eax
jl     1205 <Info_SetValueForStarKey+0xb5>
jmp    138e <Info_SetValueForStarKey+0x23e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x420(%rbp),%rdx
mov    $0x400,%ecx
call   1050 <Info_ValueForKey@plt>
mov    %rax,-0x428(%rbp)
cmpb   $0x0,(%rax)
je     1282 <Info_SetValueForStarKey+0x132>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x434(%rbp)
mov    -0x428(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x434(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x430(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x430(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
cmp    -0x1c(%rbp),%eax
jle    127d <Info_SetValueForStarKey+0x12d>
jmp    138e <Info_SetValueForStarKey+0x23e>
jmp    1282 <Info_SetValueForStarKey+0x132>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <Info_RemoveKey@plt>
cmpq   $0x0,-0x18(%rbp)
je     12ac <Info_SetValueForStarKey+0x15c>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
jne    12b1 <Info_SetValueForStarKey+0x161>
jmp    138e <Info_SetValueForStarKey+0x23e>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    $0x400,%esi
lea    0xd38(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x420(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x438(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x438(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
cmp    -0x1c(%rbp),%eax
jle    1307 <Info_SetValueForStarKey+0x1b7>
jmp    138e <Info_SetValueForStarKey+0x23e>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x428(%rbp)
mov    -0x428(%rbp),%rax
cmpb   $0x0,(%rax)
je     1387 <Info_SetValueForStarKey+0x237>
mov    -0x428(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x428(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x42c(%rbp)
cmpl   $0xd,-0x42c(%rbp)
jle    1382 <Info_SetValueForStarKey+0x232>
mov    -0x42c(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    132e <Info_SetValueForStarKey+0x1de>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Info_SetValueForStarKey>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %ecx,%r15d
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rdi,%r14
lea    0xe8c(%rip),%rsi
mov    %rbp,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
jne    12bc <Info_SetValueForStarKey+0x16c>
lea    0xe74(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
jne    12bc <Info_SetValueForStarKey+0x16c>
lea    0xe5e(%rip),%rsi
mov    %rbp,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
jne    12bc <Info_SetValueForStarKey+0x16c>
lea    0xe46(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
jne    12bc <Info_SetValueForStarKey+0x16c>
mov    %rbp,%rdi
call   1030 <strlen@plt>
cmp    $0x3f,%eax
jg     12bc <Info_SetValueForStarKey+0x16c>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x3f,%eax
jg     12bc <Info_SetValueForStarKey+0x16c>
mov    %rsp,%rdx
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0x400,%ecx
call   1050 <Info_ValueForKey@plt>
cmpb   $0x0,(%rax)
je     1234 <Info_SetValueForStarKey+0xe4>
mov    %rax,%r12
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%r13d
mov    %r12,%rdi
call   1030 <strlen@plt>
sub    %eax,%r13d
mov    %r14,%rdi
call   1030 <strlen@plt>
add    %r13d,%eax
cmp    %r15d,%eax
jge    12bc <Info_SetValueForStarKey+0x16c>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <Info_RemoveKey@plt>
test   %rbx,%rbx
je     12bc <Info_SetValueForStarKey+0x16c>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
je     12bc <Info_SetValueForStarKey+0x16c>
lea    0xdad(%rip),%rdx
mov    %rsp,%r12
mov    %r12,%rdi
mov    $0x400,%esi
mov    %rbp,%rcx
mov    %rbx,%r8
call   1040 <snprintf@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
add    %ebx,%eax
cmp    %r15d,%eax
jge    12bc <Info_SetValueForStarKey+0x16c>
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
add    %r14,%rax
mov    (%rsp),%dl
test   %dl,%dl
je     12b9 <Info_SetValueForStarKey+0x169>
lea    0x1(%rsp),%rcx
jmp    12ac <Info_SetValueForStarKey+0x15c>
movzbl (%rcx),%edx
add    $0x1,%rcx
test   %dl,%dl
je     12b9 <Info_SetValueForStarKey+0x169>
cmp    $0xe,%dl
jb     12a1 <Info_SetValueForStarKey+0x151>
mov    %dl,(%rax)
add    $0x1,%rax
jmp    12a1 <Info_SetValueForStarKey+0x151>
movb   $0x0,(%rax)
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\\\00"
@.str.1 = [2 x i8] c"\22\00"
@.str.2 = [7 x i8] c"\\%s\\%s\00"
define void @Info_SetValueForStarKey(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [1024 x i8]
%10 = alloca i8*
%11 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%12 = load i8*, i8** %6
%13 = call i64 @strstr(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %4
%16 = load i8*, i8** %7
%17 = call i64 @strstr(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15, %4
br label %110
20: ; preds = %15
%21 = load i8*, i8** %6
%22 = call i64 @strstr(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %20
%25 = load i8*, i8** %7
%26 = call i64 @strstr(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %24, %20
br label %110
29: ; preds = %24
%30 = load i8*, i8** %6
%31 = call i32 @strlen(i8* %30)
%32 = icmp sge i32 %31, 64
br i1 %32, label %37, label %33
33: ; preds = %29
%34 = load i8*, i8** %7
%35 = call i32 @strlen(i8* %34)
%36 = icmp sge i32 %35, 64
br i1 %36, label %37, label %38
37: ; preds = %33, %29
br label %110
38: ; preds = %33
%39 = load i8*, i8** %5
%40 = load i8*, i8** %6
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%42 = call i8* @Info_ValueForKey(i8* %39, i8* %40, i8* %41, i32 1024)
store i8* %42, i8** %10
%43 = load i8, i8* %42
%44 = icmp ne i8 %43, 0
br i1 %44, label %45, label %59
45: ; preds = %38
%46 = load i8*, i8** %7
%47 = call i32 @strlen(i8* %46)
%48 = load i8*, i8** %10
%49 = call i32 @strlen(i8* %48)
%50 = sub nsw i32 %47, %49
%51 = load i8*, i8** %5
%52 = call i32 @strlen(i8* %51)
%53 = add nsw i32 %50, %52
%54 = add nsw i32 %53, 1
%55 = load i32, i32* %8
%56 = icmp sgt i32 %54, %55
br i1 %56, label %57, label %58
57: ; preds = %45
br label %110
58: ; preds = %45
br label %59
59: ; preds = %58, %38
%60 = load i8*, i8** %5
%61 = load i8*, i8** %6
%62 = call i32 @Info_RemoveKey(i8* %60, i8* %61)
%63 = load i8*, i8** %7
%64 = icmp ne i8* %63, null
br i1 %64, label %65, label %69
65: ; preds = %59
%66 = load i8*, i8** %7
%67 = call i32 @strlen(i8* %66)
%68 = icmp ne i32 %67, 0
br i1 %68, label %70, label %69
69: ; preds = %65, %59
br label %110
70: ; preds = %65
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%72 = load i8*, i8** %6
%73 = load i8*, i8** %7
%74 = call i32 @snprintf(i8* %71, i32 1024, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %72, i8* %73)
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%76 = call i32 @strlen(i8* %75)
%77 = load i8*, i8** %5
%78 = call i32 @strlen(i8* %77)
%79 = add nsw i32 %76, %78
%80 = add nsw i32 %79, 1
%81 = load i32, i32* %8
%82 = icmp sgt i32 %80, %81
br i1 %82, label %83, label %84
83: ; preds = %70
br label %110
84: ; preds = %70
%85 = load i8*, i8** %5
%86 = call i32 @strlen(i8* %85)
%87 = load i8*, i8** %5
%88 = sext i32 %86 to i64
%89 = getelementptr inbounds i8, i8* %87, i64 %88
store i8* %89, i8** %5
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
store i8* %90, i8** %10
br label %91
91: ; preds = %107, %84
%92 = load i8*, i8** %10
%93 = load i8, i8* %92
%94 = icmp ne i8 %93, 0
br i1 %94, label %95, label %108
95: ; preds = %91
%96 = load i8*, i8** %10
%97 = getelementptr inbounds i8, i8* %96, i32 1
store i8* %97, i8** %10
%98 = load i8, i8* %96
%99 = zext i8 %98 to i32
store i32 %99, i32* %11
%100 = load i32, i32* %11
%101 = icmp sgt i32 %100, 13
br i1 %101, label %102, label %107
102: ; preds = %95
%103 = load i32, i32* %11
%104 = trunc i32 %103 to i8
%105 = load i8*, i8** %5
%106 = getelementptr inbounds i8, i8* %105, i32 1
store i8* %106, i8** %5
store i8 %104, i8* %105
br label %107
107: ; preds = %102, %95
br label %91
108: ; preds = %91
%109 = load i8*, i8** %5
store i8 0, i8* %109
br label %110
110: ; preds = %108, %83, %69, %57, %37, %28, %19
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\\\00"
@.str.1 = [2 x i8] c"\22\00"
@.str.2 = [7 x i8] c"\\%s\\%s\00"
define void @Info_SetValueForStarKey(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = tail call i64 @strstr(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %67
9: ; preds = %4
%10 = tail call i64 @strstr(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %67
12: ; preds = %9
%13 = tail call i64 @strstr(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %67
15: ; preds = %12
%16 = tail call i64 @strstr(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %67
18: ; preds = %15
%19 = tail call i32 @strlen(i8* %1)
%20 = icmp sgt i32 %19, 63
br i1 %20, label %67, label %21
21: ; preds = %18
%22 = tail call i32 @strlen(i8* %2)
%23 = icmp sgt i32 %22, 63
br i1 %23, label %67, label %24
24: ; preds = %21
%25 = call i8* @Info_ValueForKey(i8* %0, i8* %1, i8* %6, i32 1024)
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 0
br i1 %27, label %35, label %28
28: ; preds = %24
%29 = call i32 @strlen(i8* %2)
%30 = call i32 @strlen(i8* %25)
%31 = sub i32 %29, %30
%32 = call i32 @strlen(i8* %0)
%33 = add nsw i32 %31, %32
%34 = icmp slt i32 %33, %3
br i1 %34, label %35, label %67
35: ; preds = %28, %24
%36 = call i32 @Info_RemoveKey(i8* %0, i8* %1)
%37 = icmp eq i8* %2, null
br i1 %37, label %67, label %38
38: ; preds = %35
%39 = call i32 @strlen(i8* %2)
%40 = icmp eq i32 %39, 0
br i1 %40, label %67, label %41
41: ; preds = %38
%42 = call i32 @snprintf(i8* %6, i32 1024, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %1, i8* %2)
%43 = call i32 @strlen(i8* %6)
%44 = call i32 @strlen(i8* %0)
%45 = add nsw i32 %44, %43
%46 = icmp slt i32 %45, %3
br i1 %46, label %47, label %67
47: ; preds = %41
%48 = call i32 @strlen(i8* %0)
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %0, i64 %49
%51 = load i8, i8* %6
%52 = icmp eq i8 %51, 0
br i1 %52, label %65, label %53
53: ; preds = %47, %61
%54 = phi i8 [ %63, %61 ], [ %51, %47 ]
%55 = phi i8* [ %62, %61 ], [ %50, %47 ]
%56 = phi i8* [ %57, %61 ], [ %6, %47 ]
%57 = getelementptr inbounds i8, i8* %56, i64 1
%58 = icmp ugt i8 %54, 13
br i1 %58, label %59, label %61
59: ; preds = %53
%60 = getelementptr inbounds i8, i8* %55, i64 1
store i8 %54, i8* %55
br label %61
61: ; preds = %59, %53
%62 = phi i8* [ %60, %59 ], [ %55, %53 ]
%63 = load i8, i8* %57
%64 = icmp eq i8 %63, 0
br i1 %64, label %65, label %53
65: ; preds = %61, %47
%66 = phi i8* [ %50, %47 ], [ %62, %61 ]
store i8 0, i8* %66
br label %67
67: ; preds = %41, %35, %38, %28, %18, %21, %12, %15, %4, %9, %65
ret void
}