// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/p_client.c
// Function: ClientOldSetSkin
void ClientOldSetSkin(edict_t *ent, char *input)
{
	char	*s;
	//char *color;
	int 	playernum, err;
	
	char	dir[MAX_INFO_STRING], skin[MAX_INFO_STRING], set[MAX_INFO_STRING] ;
	char	color, gender;
	int 	num, dirvalid, skinvalid;
	int 	skinnum;
	char	*curset;
	
	switch ((int)skinset->value)
	{
	default:
	case 0:
		curset = "rb";
		break;
	case 1:
		curset = "lm";
		break;
	case 2:
		curset = "cr";
		break;
	case 3:
		curset = "w";
		break;
	}
	
	// get skin
	//s = input;
	
	//if (!s)
	s = Info_ValueForKey (ent->client->pers.userinfo, "skin");
	
	//initialize memory
	num = -1;
	gender = 'u'; //unassigned
	color = 'u'; //unassigned
	
	skinvalid = 0;
	dirvalid = 0;
	skinnum = 0;
	set[0] = 0;
	dir[0] = 0;
	skin[0] = 0;
	
	// See if we have only specified a skin number
	if (sscanf(s, "%d", &skinnum))
	{
		// First, check if skin matches proper format MJD Suggest Parens
		err = sscanf(s, "%[^/]/%[^-]-%c%c%d", dir, set, &color, &gender, &num);
		if (err)
		{
			// Next, check if gender matches properly
			if (!strcmp(dir, "female"))
			{
				dirvalid = 2;
				// Check if skin is valid, ignoring color
				if (gender == 'f' && num <= 2 && num >= 1)
				{
					skinvalid = 1;
				}
			}
			else if (!strcmp(dir, "male"))
			{
				dirvalid = 1;
				// Check if skin is valid, ignoring color
				if (gender == 'm' && num <= 3 && num >= 1)
				{
					skinvalid = 1;
				}
			}
		}
	}
	
	// If our skin is valid, only change if our color doesn't match
	if (skinvalid)
	{
		// Check if color doesn't match, or skin set is wrong
		if ((ent->client->ctf.teamnum == CTF_TEAM_RED && color != 'r') ||
			(ent->client->ctf.teamnum == CTF_TEAM_BLUE && color != 'b') ||
			strcmp(set, curset))
		{
			color = (ent->client->ctf.teamnum == CTF_TEAM_RED) ? 'r' : 'b';
			Com_sprintf(skin, sizeof skin, "%s/%s-%c%c%d", dir, curset, color, gender, num);
			s = skin;
		}
	}
	else
	{
		// Did we have a valid gender?
		if (!dirvalid || dirvalid == 1)
		{
			strcpy(dir, "male");
			gender = 'm';
			color = (ent->client->ctf.teamnum == CTF_TEAM_RED) ? 'r' : 'b';
			if (!(skinnum % 4))
				num = (rand() % 3) + 1;
			else
				num = skinnum % 4;
		}
		else // female
		{
			strcpy(dir, "female");
			gender = 'f';
			color = (ent->client->ctf.teamnum == CTF_TEAM_RED) ? 'r' : 'b';
			if (!(skinnum % 3))
				num = (rand() % 2) + 1;
			else
				num = skinnum % 2;
		}
		Com_sprintf(skin, sizeof skin, "%s/%s-%c%c%d", dir, curset, color, gender, num);
		s = skin;
	}
	
	playernum = ent-g_edicts-1;
	
	// combine name and skin into a configstring
	gi.configstring (CS_PLAYERSKINS+playernum, va("%s\\%s", ent->client->pers.netname, s) );
	
	if (s == skin)
	{
		Info_SetValueForKey (ent->client->pers.userinfo, "skin", s);
		ent->client->ctf.goodskin = false; // We need to re-force our skin
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x670, %rsp            # imm = 0x670
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x2590e(%rip), %rax     # 0x828f8
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
movl %eax, %ecx
movq %rcx, -0x648(%rbp)
subl $0x3, %eax
ja 0x5d017
movq -0x648(%rbp), %rax
leaq 0x195ae(%rip), %rcx     # 0x765bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x5d019
leaq 0x1712c(%rip), %rax     # 0x7414c
movq %rax, -0x640(%rbp)
jmp 0x5d057
leaq 0x1a2a9(%rip), %rax     # 0x772d9
movq %rax, -0x640(%rbp)
jmp 0x5d057
leaq 0x17109(%rip), %rax     # 0x74149
movq %rax, -0x640(%rbp)
jmp 0x5d057
leaq 0x179a7(%rip), %rax     # 0x749f7
movq %rax, -0x640(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0xc0, %rdi
leaq 0x122c3(%rip), %rsi     # 0x6f330
callq 0x18cb0
movq %rax, -0x18(%rbp)
movl $0xffffffff, -0x628(%rbp) # imm = 0xFFFFFFFF
movb $0x75, -0x622(%rbp)
movb $0x75, -0x621(%rbp)
movl $0x0, -0x630(%rbp)
movl $0x0, -0x62c(%rbp)
movl $0x0, -0x634(%rbp)
movb $0x0, -0x620(%rbp)
movb $0x0, -0x220(%rbp)
movb $0x0, -0x420(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x127aa(%rip), %rsi     # 0x6f876
leaq -0x634(%rbp), %rdx
movb $0x0, %al
callq 0x19180
cmpl $0x0, %eax
je 0x5d1c7
movq -0x18(%rbp), %rdi
leaq -0x220(%rbp), %rdx
leaq -0x620(%rbp), %rcx
leaq 0x1a1e0(%rip), %rsi     # 0x772dc
leaq -0x621(%rbp), %r8
leaq -0x622(%rbp), %r9
leaq -0x628(%rbp), %rax
movq %rax, (%rsp)
movb $0x0, %al
callq 0x19180
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x5d1c5
leaq -0x220(%rbp), %rdi
leaq 0x1a1b8(%rip), %rsi     # 0x772ef
callq 0x18bf0
cmpl $0x0, %eax
jne 0x5d175
movl $0x2, -0x62c(%rbp)
movsbl -0x622(%rbp), %eax
cmpl $0x66, %eax
jne 0x5d173
cmpl $0x2, -0x628(%rbp)
jg 0x5d173
cmpl $0x1, -0x628(%rbp)
jl 0x5d173
movl $0x1, -0x630(%rbp)
jmp 0x5d1c3
leaq -0x220(%rbp), %rdi
leaq 0x11eed(%rip), %rsi     # 0x6f070
callq 0x18bf0
cmpl $0x0, %eax
jne 0x5d1c1
movl $0x1, -0x62c(%rbp)
movsbl -0x622(%rbp), %eax
cmpl $0x6d, %eax
jne 0x5d1bf
cmpl $0x3, -0x628(%rbp)
jg 0x5d1bf
cmpl $0x1, -0x628(%rbp)
jl 0x5d1bf
movl $0x1, -0x630(%rbp)
jmp 0x5d1c1
jmp 0x5d1c3
jmp 0x5d1c5
jmp 0x5d1c7
cmpl $0x0, -0x630(%rbp)
je 0x5d2a0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x1, 0x1100(%rax)
jne 0x5d1f1
movsbl -0x621(%rbp), %eax
cmpl $0x72, %eax
jne 0x5d226
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x2, 0x1100(%rax)
jne 0x5d20e
movsbl -0x621(%rbp), %eax
cmpl $0x62, %eax
jne 0x5d226
leaq -0x620(%rbp), %rdi
movq -0x640(%rbp), %rsi
callq 0x18bf0
cmpl $0x0, %eax
je 0x5d29b
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl 0x1100(%rax), %edx
movl $0x62, %eax
movl $0x72, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movb %al, -0x621(%rbp)
leaq -0x420(%rbp), %rdi
leaq -0x220(%rbp), %rcx
movq -0x640(%rbp), %r8
movsbl -0x621(%rbp), %r9d
movsbl -0x622(%rbp), %r10d
movl -0x628(%rbp), %eax
movl $0x200, %esi            # imm = 0x200
leaq 0x1a075(%rip), %rdx     # 0x772f6
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x18f90
leaq -0x420(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x5d401
cmpl $0x0, -0x62c(%rbp)
je 0x5d2b2
cmpl $0x1, -0x62c(%rbp)
jne 0x5d331
leaq -0x220(%rbp), %rdi
leaq 0x11db0(%rip), %rsi     # 0x6f070
callq 0x182c0
movb $0x6d, -0x622(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl 0x1100(%rax), %edx
movl $0x62, %eax
movl $0x72, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movb %al, -0x621(%rbp)
movl -0x634(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x5d31b
callq 0x19c80
movl $0x3, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x628(%rbp)
jmp 0x5d32f
movl -0x634(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %edx, -0x628(%rbp)
jmp 0x5d3b0
leaq -0x220(%rbp), %rdi
leaq 0x19fb0(%rip), %rsi     # 0x772ef
callq 0x182c0
movb $0x66, -0x622(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl 0x1100(%rax), %edx
movl $0x62, %eax
movl $0x72, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movb %al, -0x621(%rbp)
movl -0x634(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x5d39a
callq 0x19c80
movl $0x2, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x628(%rbp)
jmp 0x5d3ae
movl -0x634(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %edx, -0x628(%rbp)
jmp 0x5d3b0
leaq -0x420(%rbp), %rdi
leaq -0x220(%rbp), %rcx
movq -0x640(%rbp), %r8
movsbl -0x621(%rbp), %r9d
movsbl -0x622(%rbp), %r10d
movl -0x628(%rbp), %eax
movl $0x200, %esi            # imm = 0x200
leaq 0x19f0f(%rip), %rdx     # 0x772f6
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x18f90
leaq -0x420(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x2514c(%rip), %rcx     # 0x82558
movq (%rcx), %rcx
subq %rcx, %rax
movl $0x4a8, %ecx            # imm = 0x4A8
cqto
idivq %rcx
subq $0x1, %rax
movl %eax, -0x1c(%rbp)
movq 0x251d6(%rip), %rax     # 0x82600
movq 0x30(%rax), %rax
movq %rax, -0x650(%rbp)
movl -0x1c(%rbp), %eax
addl $0x520, %eax            # imm = 0x520
movl %eax, -0x654(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rsi
addq $0xc0, %rsi
addq $0x200, %rsi            # imm = 0x200
movq -0x18(%rbp), %rdx
leaq 0x1a913(%rip), %rdi     # 0x77d77
movb $0x0, %al
callq 0x19560
movl -0x654(%rbp), %edi
movq %rax, %rsi
movq -0x650(%rbp), %rax
callq *%rax
movq -0x18(%rbp), %rax
leaq -0x420(%rbp), %rcx
cmpq %rcx, %rax
jne 0x5d4be
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0xc0, %rdi
movq -0x18(%rbp), %rdx
leaq 0x11e89(%rip), %rsi     # 0x6f330
callq 0x185b0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl $0x0, 0x110c(%rax)
addq $0x670, %rsp            # imm = 0x670
popq %rbp
retq
nopw (%rax,%rax)