// File: /workspace/github_c_makefile_star2_O2/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
andl $0x0, 0x10(%rsp)
movq %rdx, %rbx
andq $0x0, 0x8(%rsp)
movq %rsi, %r14
movq %rdi, %r15
movq 0x2eead(%rip), %r12     # 0x66a40
addq $0x10, %r12
movq -0x10(%r12), %rdi
testq %rdi, %rdi
je 0x37bba
testb $0x2, (%r12)
jne 0x37bb4
movq %r15, %rsi
callq 0x186d0
testl %eax, %eax
je 0x37bde
addq $0x18, %r12
jmp 0x37b97
movq 0x2ea3f(%rip), %rax     # 0x66600
movq 0x8(%rax), %rcx
leaq 0x1cb1b(%rip), %rdi     # 0x546e7
movq %r15, %rsi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rcx
testb $0x1, (%r12)
je 0x37bec
movq 0x2ea7c(%rip), %rbx     # 0x66668
movl -0x4(%r12), %eax
cmpq $0x5, %rax
ja 0x37ce0
leaq 0x1c53a(%rip), %rcx     # 0x5413c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0x197a0
movslq -0x8(%r12), %rcx
movl %eax, (%rbx,%rcx)
jmp 0x37ce0
movq %r14, %rdi
callq 0x18280
movslq -0x8(%r12), %rcx
movq %rax, (%rbx,%rcx)
jmp 0x37ce0
movq %r14, %rdi
callq 0x18440
cvtsd2ss %xmm0, %xmm0
movslq -0x8(%r12), %rax
movss %xmm0, (%rbx,%rax)
jmp 0x37ce0
leaq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %r8
leaq 0x1ca32(%rip), %rsi     # 0x54694
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x19110
movslq -0x8(%r12), %rcx
movsd (%r15), %xmm0
movsd %xmm0, (%rbx,%rcx)
movss 0x8(%r15), %xmm0
movss %xmm0, 0x8(%rbx,%rcx)
testl %eax, %eax
jne 0x37ce0
movq 0x2e966(%rip), %r8      # 0x66600
movq -0x10(%r12), %rcx
movq 0x2f0fa(%rip), %rdx     # 0x66da0
addq $0x48, %rdx
leaq 0x1c9ec(%rip), %rdi     # 0x5469d
leaq 0x1ca21(%rip), %rsi     # 0x546d9
xorl %eax, %eax
callq *0x8(%r8)
jmp 0x37ce0
movq %r14, %rdi
callq 0x18440
cvtsd2ss %xmm0, %xmm0
movslq -0x8(%r12), %rax
andl $0x0, (%rbx,%rax)
movss %xmm0, 0x4(%rbx,%rax)
andl $0x0, 0x8(%rbx,%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq