// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/q_shared.c
// Function: Info_SetValueForKey
void Info_SetValueForKey (char *s, char *key, char *value)
{
	char	newi[MAX_INFO_STRING], *v;
	int		c;
	size_t	maxsize = MAX_INFO_STRING;

	if (strstr (key, "\\") || strstr (value, "\\") )
	{
		Com_Printf ("Can't use keys or values with a \\\n");
		return;
	}

	if (strstr (key, ";") )
	{
		Com_Printf ("Can't use keys or values with a semicolon\n");
		return;
	}

	if (strstr (key, "\"") || strstr (value, "\"") )
	{
		Com_Printf ("Can't use keys or values with a \"\n");
		return;
	}

	if (strlen(key) > MAX_INFO_KEY-1 || strlen(value) > MAX_INFO_KEY-1)
	{
		Com_Printf ("Keys and values must be < 64 characters.\n");
		return;
	}
	Info_RemoveKey (s, key);
	if (!value || !strlen(value))
		return;

	Com_sprintf (newi, sizeof(newi), "\\%s\\%s", key, value);

	if (strlen(newi) + strlen(s) > maxsize)
	{
		Com_Printf ("Info string length exceeded\n");
		return;
	}

	// only copy ascii values
	s += strlen(s);
	v = newi;
	while (*v)
	{
		c = *v++;
		c &= 127;		// strip high bits
		if (c >= 32 && c < 127)
			*s++ = c;
	}
	*s = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x200, -0x238(%rbp) # imm = 0x200
movq -0x10(%rbp), %rdi
leaq 0x9448(%rip), %rsi      # 0x77cd5
callq 0x19bf0
cmpq $0x0, %rax
jne 0x6e8ae
movq -0x18(%rbp), %rdi
leaq 0x9432(%rip), %rsi      # 0x77cd5
callq 0x19bf0
cmpq $0x0, %rax
je 0x6e8c1
leaq 0x9426(%rip), %rdi      # 0x77cdb
movb $0x0, %al
callq 0x190b0
jmp 0x6ea75
movq -0x10(%rbp), %rdi
leaq 0x940d(%rip), %rsi      # 0x77cd9
callq 0x19bf0
cmpq $0x0, %rax
je 0x6e8ea
leaq 0x9420(%rip), %rdi      # 0x77cfe
movb $0x0, %al
callq 0x190b0
jmp 0x6ea75
movq -0x10(%rbp), %rdi
leaq 0x93e2(%rip), %rsi      # 0x77cd7
callq 0x19bf0
cmpq $0x0, %rax
jne 0x6e916
movq -0x18(%rbp), %rdi
leaq 0x93cc(%rip), %rsi      # 0x77cd7
callq 0x19bf0
cmpq $0x0, %rax
je 0x6e929
leaq 0x940c(%rip), %rdi      # 0x77d29
movb $0x0, %al
callq 0x190b0
jmp 0x6ea75
movq -0x10(%rbp), %rdi
callq 0x186e0
cmpq $0x3f, %rax
ja 0x6e947
movq -0x18(%rbp), %rdi
callq 0x186e0
cmpq $0x3f, %rax
jbe 0x6e95a
leaq 0x93fe(%rip), %rdi      # 0x77d4c
movb $0x0, %al
callq 0x190b0
jmp 0x6ea75
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x199a0
cmpq $0x0, -0x18(%rbp)
je 0x6e97d
movq -0x18(%rbp), %rdi
callq 0x186e0
cmpq $0x0, %rax
jne 0x6e982
jmp 0x6ea75
leaq -0x220(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
movl $0x200, %esi            # imm = 0x200
leaq 0x93d9(%rip), %rdx      # 0x77d76
movb $0x0, %al
callq 0x18f90
leaq -0x220(%rbp), %rdi
callq 0x186e0
movq %rax, -0x240(%rbp)
movq -0x8(%rbp), %rdi
callq 0x186e0
movq %rax, %rcx
movq -0x240(%rbp), %rax
addq %rcx, %rax
cmpq -0x238(%rbp), %rax
jbe 0x6e9e9
leaq 0x93a0(%rip), %rdi      # 0x77d7d
movb $0x0, %al
callq 0x190b0
jmp 0x6ea75
movq -0x8(%rbp), %rdi
callq 0x186e0
addq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x220(%rbp), %rax
movq %rax, -0x228(%rbp)
movq -0x228(%rbp), %rax
cmpb $0x0, (%rax)
je 0x6ea6e
movq -0x228(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x228(%rbp)
movsbl (%rax), %eax
movl %eax, -0x22c(%rbp)
movl -0x22c(%rbp), %eax
andl $0x7f, %eax
movl %eax, -0x22c(%rbp)
cmpl $0x20, -0x22c(%rbp)
jl 0x6ea6c
cmpl $0x7f, -0x22c(%rbp)
jge 0x6ea6c
movl -0x22c(%rbp), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x8(%rbp)
movb %cl, (%rax)
jmp 0x6ea08
movq -0x8(%rbp), %rax
movb $0x0, (%rax)
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq