// File: /workspace/github_c_makefile_star2_O1/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 0x2e3cc(%rip), %r12     # 0x69a40
movq (%r12), %rdi
testq %rdi, %rdi
je 0x3b6a8
movq %rdx, %rbx
movq %rsi, %r14
addq $0x18, %r12
testb $0x2, -0x8(%r12)
jne 0x3b69b
movq %r15, %rsi
callq 0x18690
testl %eax, %eax
je 0x3b6cc
movq (%r12), %rdi
addq $0x18, %r12
testq %rdi, %rdi
jne 0x3b687
movq 0x2df51(%rip), %rax     # 0x69600
movq 0x8(%rax), %rcx
leaq 0x1de39(%rip), %rdi     # 0x594f3
movq %r15, %rsi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rcx
testb $0x1, -0x8(%r12)
je 0x3b6db
movq 0x2df8d(%rip), %rbx     # 0x69668
movl -0xc(%r12), %eax
cmpq $0x5, %rax
ja 0x3b7db
leaq 0x1d857(%rip), %rcx     # 0x58f48
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0x195e0
movslq -0x10(%r12), %rcx
movl %eax, (%rbx,%rcx)
jmp 0x3b7db
movq %r14, %rdi
callq 0x18260
movslq -0x10(%r12), %rcx
movq %rax, (%rbx,%rcx)
jmp 0x3b7db
movq %r14, %rdi
callq 0x18410
cvtsd2ss %xmm0, %xmm0
movslq -0x10(%r12), %rax
movss %xmm0, (%rbx,%rax)
jmp 0x3b7db
leaq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %r8
leaq 0x1dd4f(%rip), %rsi     # 0x594a0
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x18fe0
movss (%r15), %xmm0
movslq -0x10(%r12), %rcx
movss %xmm0, (%rbx,%rcx)
movss 0x4(%r15), %xmm0
movss %xmm0, 0x4(%rbx,%rcx)
movss 0x8(%r15), %xmm0
movss %xmm0, 0x8(%rbx,%rcx)
testl %eax, %eax
jne 0x3b7db
movq 0x2de6b(%rip), %r8      # 0x69600
movq -0x18(%r12), %rcx
movq 0x2e5ff(%rip), %rdx     # 0x69da0
addq $0x48, %rdx
leaq 0x1dcfd(%rip), %rdi     # 0x594a9
leaq 0x1dd32(%rip), %rsi     # 0x594e5
xorl %eax, %eax
callq *0x8(%r8)
jmp 0x3b7db
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