// File: /workspace/github_c_makefile_star2_O1/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 0x3222b
movq (%rsp), %rbx
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x320b3
movq 0x37550(%rip), %rax     # 0x69600
callq *0x48(%rax)
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x320c6
movq 0x3753d(%rip), %rax     # 0x69600
callq *0x40(%rax)
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x320d9
movq 0x3752a(%rip), %rax     # 0x69600
callq *0x40(%rax)
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x320ec
movq 0x37517(%rip), %rax     # 0x69600
callq *0x50(%rax)
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x3210c
cmpb $0x0, (%rdi)
je 0x3210c
callq 0x189e0
cmpq %rbx, %rax
je 0x3210c
movq %rax, %rdi
callq 0x18790
movq 0x80(%rbx), %rbp
testq %rbp, %rbp
je 0x3222b
cmpb $0x0, (%rbp)
je 0x3222b
cmpb $0x0, (%rbp)
je 0x3222b
movq 0x374c9(%rip), %rax     # 0x69600
leaq 0x10(%rsp), %r15
leaq 0x40(%rax), %r13
addq $0x48, %rax
movq %rax, 0x8(%rsp)
movabsq $0x100000000, %rbx      # imm = 0x100000000
movq %rbp, %r12
movl $0xffffffc1, %eax       # imm = 0xFFFFFFC1
xorl %r14d, %r14d
movzbl (%rbp), %ecx
testb $-0x21, %cl
je 0x32171
incq %rbp
addq %rbx, %r14
incl %eax
jmp 0x3215e
cmpl $-0x3b, %eax
ja 0x32190
movq (%rsp), %rax
movq (%rax), %rsi
leaq 0x24e41(%rip), %rdi     # 0x56fc5
xorl %eax, %eax
movq 0x37473(%rip), %rcx     # 0x69600
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 0x2238c(%rip), %rsi     # 0x5454e
callq 0x18b20
movq %r13, %rcx
testl %eax, %eax
je 0x321fc
movq %r14, %rdi
leaq 0x22ab6(%rip), %rsi     # 0x54c8e
callq 0x18b20
movq %r13, %rcx
testl %eax, %eax
je 0x321fc
movq %r14, %rdi
leaq 0x228ff(%rip), %rsi     # 0x54aed
callq 0x18b20
movq 0x8(%rsp), %rcx
testl %eax, %eax
jne 0x32201
movq %r15, %rdi
callq *(%rcx)
movq %r14, %rdi
leaq 0x24de3(%rip), %rsi     # 0x56fee
callq 0x18b20
testl %eax, %eax
jne 0x32221
movq %r15, %rdi
movq 0x373e2(%rip), %rax     # 0x69600
callq *0x50(%rax)
cmpb $0x0, (%rbp)
jne 0x32153
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq