// File: /workspace/github_c_makefile_star2_O1/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 0x20e57
movl 0x30(%rax), %eax
movl %eax, 0x28(%rbx)
movq 0x120(%rbx), %rsi
movq 0x4879b(%rip), %r13     # 0x69600
movq 0x58(%r13), %rax
testq %rsi, %rsi
jne 0x20e79
movq 0x330(%rbx), %rcx
movq 0x30(%rcx), %rsi
movq %rbx, %rdi
callq *%rax
movss 0x335ba(%rip), %xmm0    # 0x54440
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 0x3357e(%rip), %xmm0    # 0x54444
movss 0x3357a(%rip), %xmm2    # 0x54448
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 0x48958(%rip), %rax     # 0x69880
movq %rax, 0x220(%rbx)
xorl %ebp, %ebp
movq %rbp, 0x110(%rbx)
movl %ebp, 0x4a0(%rbx)
movss 0x33506(%rip), %xmm2    # 0x5444c
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x19510
leaq 0x4(%rbx), %rsi
movss 0x4(%rbx), %xmm0
addss (%rax), %xmm0
leaq 0x14(%rsp), %r8
movss %xmm0, (%r8)
movss 0x8(%rbx), %xmm0
addss 0x4(%rax), %xmm0
movss %xmm0, 0x4(%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)
movq 0xc(%r12), %rax
movss 0x14(%r12), %xmm0
movq %rax, 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 0x48dc5(%rip), %rax     # 0x69da0
movss 0x4(%rax), %xmm0
addss 0x332a8(%rip), %xmm0    # 0x54290
movss %xmm0, 0x200(%rbx)
movq 0x485c9(%rip), %rax     # 0x695c0
movq %rax, 0x210(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq