// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/g_spawn.c
// Function: ED_ParseField
void ED_ParseField (char *key, char *value, edict_t *ent)
{
	field_t	*f;
	byte	*b;
	float	v;
	vec3_t	vec = { 0 };

	for (f=fields ; f->name ; f++)
	{
		if (!(f->flags & FFL_NOSPAWN) && !Q_stricmp(f->name, key))
		{	// found it
			if (f->flags & FFL_SPAWNTEMP)
				b = (byte *)&st;
			else
				b = (byte *)ent;

			switch (f->type)
			{
			case F_LSTRING:
				*(char **)(b+f->ofs) = ED_NewString (value);
				break;
			case F_VECTOR:
				if (sscanf(value, "%f %f %f", &vec[0], &vec[1], &vec[2])) {
					((float*)(b + f->ofs))[0] = vec[0];
					((float*)(b + f->ofs))[1] = vec[1];
					((float*)(b + f->ofs))[2] = vec[2];
				}
				else {
					((float*)(b + f->ofs))[0] = vec[0];	// if we get here, it's an error in the map
					((float*)(b + f->ofs))[1] = vec[1]; // set all zeroes and log a warning.
					((float*)(b + f->ofs))[2] = vec[2];
					gi.dprintf("WARNING: Vector field incomplete in %s, map: %s, field: %s\n", __func__, level.mapname, f->name);
				}
				break;
			case F_INT:
				*(int *)(b+f->ofs) = atoi(value);
				break;
			case F_FLOAT:
				*(float *)(b+f->ofs) = atof(value);
				break;
			case F_ANGLEHACK:
				v = atof(value);
				((float *)(b+f->ofs))[0] = 0;
				((float *)(b+f->ofs))[1] = v;
				((float *)(b+f->ofs))[2] = 0;
				break;
			case F_IGNORE:
				break;
			default:// MJD Added to stop compiler warnings
				break;
			}
			return;
		}
	}
	gi.dprintf ("%s is not a field\n", key);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
movl $0x0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
movq 0x2dcd0(%rip), %r12     # 0x68a40
movq (%r12), %rdi
testq %rdi, %rdi
je 0x3ada4
movq %rdx, %rbx
movq %rsi, %r14
addq $0x18, %r12
testb $0x2, -0x8(%r12)
jne 0x3ad97
movq %r15, %rsi
callq 0x18690
testl %eax, %eax
je 0x3adc8
movq (%r12), %rdi
addq $0x18, %r12
testq %rdi, %rdi
jne 0x3ad83
movq 0x2d855(%rip), %rax     # 0x68600
movq 0x8(%rax), %rcx
leaq 0x1d951(%rip), %rdi     # 0x58707
movq %r15, %rsi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rcx
testb $0x1, -0x8(%r12)
je 0x3add7
movq 0x2d891(%rip), %rbx     # 0x68668
movl -0xc(%r12), %eax
cmpq $0x5, %rax
ja 0x3aecb
leaq 0x1d36f(%rip), %rcx     # 0x5815c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0x195e0
movslq -0x10(%r12), %rcx
movl %eax, (%rbx,%rcx)
jmp 0x3aecb
movq %r14, %rdi
callq 0x18260
movslq -0x10(%r12), %rcx
movq %rax, (%rbx,%rcx)
jmp 0x3aecb
movq %r14, %rdi
callq 0x18410
cvtsd2ss %xmm0, %xmm0
movslq -0x10(%r12), %rax
movss %xmm0, (%rbx,%rax)
jmp 0x3aecb
leaq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %r8
leaq 0x1d867(%rip), %rsi     # 0x586b4
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x18fe0
movslq -0x10(%r12), %rcx
movsd (%r15), %xmm0
movsd %xmm0, (%rbx,%rcx)
movss 0x8(%r15), %xmm0
movss %xmm0, 0x8(%rbx,%rcx)
testl %eax, %eax
jne 0x3aecb
movq 0x2d77b(%rip), %r8      # 0x68600
movq -0x18(%r12), %rcx
movq 0x2df0f(%rip), %rdx     # 0x68da0
addq $0x48, %rdx
leaq 0x1d821(%rip), %rdi     # 0x586bd
leaq 0x1d856(%rip), %rsi     # 0x586f9
xorl %eax, %eax
callq *0x8(%r8)
jmp 0x3aecb
movq %r14, %rdi
callq 0x18410
cvtsd2ss %xmm0, %xmm0
movslq -0x10(%r12), %rax
xorl %ecx, %ecx
movl %ecx, (%rbx,%rax)
movss %xmm0, 0x4(%rbx,%rax)
movl %ecx, 0x8(%rbx,%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq