// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/g_items.c
// Function: PrecacheItem
void PrecacheItem (gitem_t *it)
{
	char	*s, *start;
	char	data[MAX_QPATH];
	int		len;
	gitem_t	*ammo;

	if (!it)
		return;

	if (it->pickup_sound)
		gi.soundindex (it->pickup_sound);
	if (it->world_model)
		gi.modelindex (it->world_model);
	if (it->view_model)
		gi.modelindex (it->view_model);
	if (it->icon)
		gi.imageindex (it->icon);

	// parse everything for its ammo
	if (it->ammo && it->ammo[0])
	{
		ammo = FindItem (it->ammo);
		if (ammo != it)
			PrecacheItem (ammo);
	}

	// parse the space seperated precache string for other items
	s = it->precaches;
	if (!s || !s[0])
		return;

	while (*s)
	{
		start = s;
		while (*s && *s != ' ')
			s++;

		len = s-start;
		if (len >= MAX_QPATH - 1 || len < 5)
			gi.error ("PrecacheItem: %s has bad precache string", it->classname);
		memcpy (data, start, len);
		data[len] = 0;
		if (*s)
			s++;

		// determine type based on extension
		if (!strcmp(data+len-3, "md2"))
			gi.modelindex (data);
		else if (!strcmp(data+len-3, "sp2"))
			gi.modelindex (data);
		else if (!strcmp(data+len-3, "wav"))
			gi.soundindex (data);
		if (!strcmp(data+len-3, "pcx"))
			gi.imageindex (data);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, (%rsp)
testq %rdi, %rdi
je 0x31cb9
movq (%rsp), %rax
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x31b36
movq 0x36acd(%rip), %rax     # 0x68600
callq *0x48(%rax)
movq (%rsp), %rax
movq 0x30(%rax), %rdi
testq %rdi, %rdi
je 0x31b4d
movq 0x36ab6(%rip), %rax     # 0x68600
callq *0x40(%rax)
movq (%rsp), %rax
movq 0x40(%rax), %rdi
testq %rdi, %rdi
je 0x31b64
movq 0x36a9f(%rip), %rax     # 0x68600
callq *0x40(%rax)
movq (%rsp), %rax
movq 0x48(%rax), %rdi
testq %rdi, %rdi
je 0x31b7b
movq 0x36a88(%rip), %rax     # 0x68600
callq *0x50(%rax)
movq (%rsp), %rax
movq 0x60(%rax), %rdi
testq %rdi, %rdi
je 0x31ba0
cmpb $0x0, (%rdi)
je 0x31ba0
callq 0x189e0
cmpq (%rsp), %rax
je 0x31ba0
movq %rax, %rdi
callq 0x18790
movq (%rsp), %rax
movq 0x80(%rax), %rbp
testq %rbp, %rbp
je 0x31cb9
movb (%rbp), %al
testb %al, %al
je 0x31cb9
movq 0x36a3a(%rip), %rcx     # 0x68600
leaq 0x10(%rsp), %r15
leaq 0x40(%rcx), %r13
addq $0x48, %rcx
movq %rcx, 0x8(%rsp)
movabsq $0x100000000, %rbx      # imm = 0x100000000
movq %rbp, %r12
movl $0xffffffc1, %ecx       # imm = 0xFFFFFFC1
xorl %r14d, %r14d
testb $-0x21, %al
je 0x31bfe
movb 0x1(%rbp), %al
incq %rbp
addq %rbx, %r14
incl %ecx
jmp 0x31bed
cmpl $-0x3b, %ecx
ja 0x31c1d
movq (%rsp), %rax
movq (%rax), %rsi
leaq 0x244a8(%rip), %rdi     # 0x560b9
xorl %eax, %eax
movq 0x369e6(%rip), %rcx     # 0x68600
callq *0x38(%rcx)
sarq $0x20, %r14
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x18c80
movb $0x0, 0x10(%rsp,%r14)
cmpb $0x1, (%rbp)
sbbq $-0x1, %rbp
leaq 0xd(%rsp), %rax
addq %rax, %r14
movq %r14, %rdi
leaq 0x2192f(%rip), %rsi     # 0x5357e
callq 0x18b20
movq %r13, %rcx
testl %eax, %eax
je 0x31c89
movq %r14, %rdi
leaq 0x22069(%rip), %rsi     # 0x53cce
callq 0x18b20
movq %r13, %rcx
testl %eax, %eax
je 0x31c89
movq %r14, %rdi
leaq 0x21ea2(%rip), %rsi     # 0x53b1d
callq 0x18b20
movq 0x8(%rsp), %rcx
testl %eax, %eax
jne 0x31c8e
movq %r15, %rdi
callq *(%rcx)
movq %r14, %rdi
leaq 0x2444a(%rip), %rsi     # 0x560e2
callq 0x18b20
testl %eax, %eax
jne 0x31cae
movq %r15, %rdi
movq 0x36955(%rip), %rax     # 0x68600
callq *0x50(%rax)
movb (%rbp), %al
testb %al, %al
jne 0x31be2
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq