// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x3d1cb
jmp 0x3d436
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x3d1eb
movq 0x45423(%rip), %rax     # 0x82600
movq 0x48(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rdi
callq *%rax
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x3d20b
movq 0x45403(%rip), %rax     # 0x82600
movq 0x40(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x30(%rcx), %rdi
callq *%rax
movq -0x8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x3d22b
movq 0x453e3(%rip), %rax     # 0x82600
movq 0x40(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x40(%rcx), %rdi
callq *%rax
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x3d24b
movq 0x453c3(%rip), %rax     # 0x82600
movq 0x50(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rdi
callq *%rax
movq -0x8(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x3d28c
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x3d28c
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x18a90
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x8(%rbp), %rax
je 0x3d28a
movq -0x70(%rbp), %rdi
callq 0x18810
jmp 0x3d28c
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3d2ab
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x3d2b0
jmp 0x3d436
jmp 0x3d2b2
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
je 0x3d436
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x71(%rbp)
je 0x3d2e8
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
setne %al
movb %al, -0x71(%rbp)
movb -0x71(%rbp), %al
testb $0x1, %al
jne 0x3d2f1
jmp 0x3d2ff
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x3d2c7
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x64(%rbp)
cmpl $0x3f, -0x64(%rbp)
jge 0x3d319
cmpl $0x5, -0x64(%rbp)
jge 0x3d336
movq 0x452e0(%rip), %rax     # 0x82600
movq 0x38(%rax), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x35c1b(%rip), %rdi     # 0x72f4d
movb $0x0, %al
callq *%rcx
leaq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
movslq -0x64(%rbp), %rdx
callq 0x18dc0
movslq -0x64(%rbp), %rax
movb $0x0, -0x60(%rbp,%rax)
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
je 0x3d365
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
movslq -0x64(%rbp), %rax
addq %rax, %rdi
addq $-0x3, %rdi
leaq 0x331e3(%rip), %rsi     # 0x7055e
callq 0x18bf0
cmpl $0x0, %eax
jne 0x3d398
movq 0x45274(%rip), %rax     # 0x82600
movq 0x40(%rax), %rax
leaq -0x60(%rbp), %rdi
callq *%rax
jmp 0x3d400
leaq -0x60(%rbp), %rdi
movslq -0x64(%rbp), %rax
addq %rax, %rdi
addq $-0x3, %rdi
leaq 0x338e0(%rip), %rsi     # 0x70c8e
callq 0x18bf0
cmpl $0x0, %eax
jne 0x3d3cb
movq 0x45241(%rip), %rax     # 0x82600
movq 0x40(%rax), %rax
leaq -0x60(%rbp), %rdi
callq *%rax
jmp 0x3d3fe
leaq -0x60(%rbp), %rdi
movslq -0x64(%rbp), %rax
addq %rax, %rdi
addq $-0x3, %rdi
leaq 0x33722(%rip), %rsi     # 0x70b03
callq 0x18bf0
cmpl $0x0, %eax
jne 0x3d3fc
movq 0x4520e(%rip), %rax     # 0x82600
movq 0x48(%rax), %rax
leaq -0x60(%rbp), %rdi
callq *%rax
jmp 0x3d3fe
jmp 0x3d400
leaq -0x60(%rbp), %rdi
movslq -0x64(%rbp), %rax
addq %rax, %rdi
addq $-0x3, %rdi
leaq 0x35b60(%rip), %rsi     # 0x72f76
callq 0x18bf0
cmpl $0x0, %eax
jne 0x3d431
movq 0x451d9(%rip), %rax     # 0x82600
movq 0x50(%rax), %rax
leaq -0x60(%rbp), %rdi
callq *%rax
jmp 0x3d2b2
addq $0x80, %rsp
popq %rbp
retq
nop