// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/g_ctffunc.c
// Function: ctf_ResetFlagProps
void ctf_ResetFlagProps(edict_t * whichflag)
{
	float		*v;
	trace_t		tr;
	vec3_t		dest;

	if (whichflag->owner)
	{
		whichflag->s.modelindex = whichflag->owner->s.modelindex3; // Turn on model
	}
	if (whichflag->model)
		gi.setmodel (whichflag, whichflag->model);
	else
		gi.setmodel (whichflag, whichflag->item->world_model);
	
	v = tv(-15,-15,-15);
	VectorCopy (v, whichflag->mins);
	v = tv(15,15,33);
	VectorCopy (v, whichflag->maxs);
	
	whichflag->solid = SOLID_TRIGGER;
	gi.linkentity(whichflag); //we changed solidity

	whichflag->movetype = MOVETYPE_TOSS;
	whichflag->touch = Touch_Item; //this then calls the pickup function as a wrapper
	whichflag->owner = NULL;
	whichflag->droptime = 0;
	v = tv(0,0,-128);
	VectorAdd (whichflag->s.origin, v, dest);
	
	tr = gi.trace (whichflag->s.origin, whichflag->mins, whichflag->maxs, dest, whichflag, MASK_SOLID);
	
	VectorCopy (tr.endpos, whichflag->s.origin);
	VectorClear (whichflag->s.angles);
	
	//surt, a flag caught moving can land off the pedastal if you don't clear the velocity
	VectorClear(whichflag->velocity);
	whichflag->flags |= FL_RESPAWN;
	
	whichflag->nextthink = level.time + FRAMETIME;	
	whichflag->think = ctf_flagwave;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movq 0x110(%rdi), %rax
testq %rax, %rax
je 0x20d6a
movl 0x30(%rax), %eax
movl %eax, 0x28(%rbx)
movq 0x120(%rbx), %rsi
movq 0x47888(%rip), %r13     # 0x68600
movq 0x58(%r13), %rax
testq %rsi, %rsi
jne 0x20d8c
movq 0x330(%rbx), %rcx
movq 0x30(%rcx), %rsi
movq %rbx, %rdi
callq *%rax
movss 0x326b7(%rip), %xmm0    # 0x53450
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x19510
movss (%rax), %xmm0
leaq 0xcc(%rbx), %r14
movss %xmm0, 0xcc(%rbx)
movss 0x4(%rax), %xmm0
movss %xmm0, 0xd0(%rbx)
movss 0x8(%rax), %xmm0
movss %xmm0, 0xd4(%rbx)
movss 0x3267b(%rip), %xmm0    # 0x53454
movss 0x32677(%rip), %xmm2    # 0x53458
movaps %xmm0, %xmm1
callq 0x19510
movss (%rax), %xmm0
leaq 0xd8(%rbx), %r15
movss %xmm0, 0xd8(%rbx)
movss 0x4(%rax), %xmm0
movss %xmm0, 0xdc(%rbx)
movss 0x8(%rax), %xmm0
movss %xmm0, 0xe0(%rbx)
movl $0x1, 0x108(%rbx)
movq %rbx, %rdi
callq *0x90(%r13)
movl $0x7, 0x118(%rbx)
movq 0x47a45(%rip), %rax     # 0x68880
movq %rax, 0x220(%rbx)
xorl %ebp, %ebp
movq %rbp, 0x110(%rbx)
movl %ebp, 0x4a0(%rbx)
movss 0x32603(%rip), %xmm2    # 0x5345c
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x19510
leaq 0x4(%rbx), %rsi
movsd 0x4(%rbx), %xmm0
movsd (%rax), %xmm1
addps %xmm0, %xmm1
leaq 0x10(%rsp), %r8
movlps %xmm1, (%r8)
movss 0xc(%rbx), %xmm0
addss 0x8(%rax), %xmm0
movss %xmm0, 0x8(%r8)
movl $0x3, (%rsp)
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r14, %rdx
movq %r15, %rcx
movq %rbx, %r9
callq *0x60(%r13)
movss 0x14(%r12), %xmm0
movsd 0xc(%r12), %xmm1
movsd %xmm1, 0x4(%rbx)
movss %xmm0, 0xc(%rbx)
movl %ebp, 0x18(%rbx)
movq %rbp, 0x10(%rbx)
movl %ebp, 0x1c8(%rbx)
movq %rbp, 0x1c0(%rbx)
orb $-0x80, 0x11f(%rbx)
movq 0x47ebd(%rip), %rax     # 0x68da0
movss 0x4(%rax), %xmm0
addss 0x323a0(%rip), %xmm0    # 0x53290
movss %xmm0, 0x200(%rbx)
movq 0x476c1(%rip), %rax     # 0x685c0
movq %rax, 0x210(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq