// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/g_items.c
// Function: tossflag
void tossflag (edict_t *ent, vec3_t dir)
{	
	float		*v;
	vec3_t		temp;
	trace_t	tr;
		
	v = tv(-15,-15,-15);
	VectorCopy (v, ent->mins);
	v = tv(15,15,33);
	VectorCopy (v, ent->maxs);
	
	ent->flags |= FL_RESPAWN;
	ent->spawnflags = DROPPED_ITEM;

	if (ent->model)
		gi.setmodel (ent, ent->model);
	else
		gi.setmodel (ent, ent->item->world_model);
	//ent->solid = SOLID_BBOX;
	ent->solid = SOLID_TRIGGER;
	ent->movetype = MOVETYPE_TOSS;  
	ent->touch = Touch_Item;

	VectorCopy(ent->s.origin, temp);
	VectorClear (ent->s.angles);

	if (!dir || !dir[0] ) // Random toss
	{
		
		v = tv(0, 0, 48);
		VectorAdd (ent->s.origin, v, ent->s.origin);
		ent->velocity[0] = -500 + (random() * 1000);
		ent->velocity[1] = -500 + (random() * 1000);
		ent->velocity[2] = 400;
		
	}
	else
	{
		VectorScale(dir, 64, dir);
		VectorAdd (ent->s.origin, dir, ent->s.origin);
		VectorScale(dir, 4, dir);
		VectorCopy(dir, ent->velocity);
	}

	tr = gi.trace (temp, ent->mins, ent->maxs, ent->s.origin, ent, MASK_SOLID);
	if (tr.fraction < 1.0 || tr.allsolid)
	{
		VectorCopy(temp, ent->s.origin);
	}

	// FLAG MODEL SUPPORT
	ent->nextthink = level.time + FRAMETIME;
	ent->think = ctf_flagwave;

	ent->droptime = level.time;

	gi.linkentity (ent);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r13
movq %rdi, %rbx
movss 0x22713(%rip), %xmm0    # 0x53450
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x19510
movss (%rax), %xmm0
movss %xmm0, 0xcc(%rbx)
movss 0x4(%rax), %xmm0
movss %xmm0, 0xd0(%rbx)
movss 0x8(%rax), %xmm0
movss %xmm0, 0xd4(%rbx)
movss 0x226de(%rip), %xmm0    # 0x53454
movss 0x226da(%rip), %xmm2    # 0x53458
movaps %xmm0, %xmm1
callq 0x19510
movss (%rax), %xmm0
movss %xmm0, 0xd8(%rbx)
movss 0x4(%rax), %xmm0
movss %xmm0, 0xdc(%rbx)
movss 0x8(%rax), %xmm0
movss %xmm0, 0xe0(%rbx)
orb $-0x80, 0x11f(%rbx)
movl $0x10000, 0x140(%rbx)   # imm = 0x10000
movq 0x120(%rbx), %rsi
movq 0x37835(%rip), %rbp     # 0x68600
movq 0x58(%rbp), %rax
testq %rsi, %rsi
jne 0x30ddf
movq 0x330(%rbx), %rcx
movq 0x30(%rcx), %rsi
movq %rbx, %rdi
callq *%rax
leaq 0xcc(%rbx), %r14
leaq 0xd8(%rbx), %r15
movl $0x1, 0x108(%rbx)
movl $0x7, 0x118(%rbx)
movq 0x37a73(%rip), %rax     # 0x68880
movq %rax, 0x220(%rbx)
leaq 0x4(%rbx), %r12
movsd 0x4(%rbx), %xmm0
movsd %xmm0, 0x10(%rsp)
movss 0xc(%rbx), %xmm0
movss %xmm0, 0x18(%rsp)
movl $0x0, 0x18(%rbx)
movq $0x0, 0x10(%rbx)
testq %r13, %r13
je 0x30ed3
movss (%r13), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x30e56
jnp 0x30ed3
movss 0x220ba(%rip), %xmm0    # 0x52f18
movq %r13, %rdi
movq %r13, %rsi
callq 0x189d0
movss 0x4(%rbx), %xmm0
movss 0x8(%rbx), %xmm1
addss (%r13), %xmm0
movss %xmm0, 0x4(%rbx)
addss 0x4(%r13), %xmm1
movss %xmm1, 0x8(%rbx)
movss 0xc(%rbx), %xmm0
addss 0x8(%r13), %xmm0
movss %xmm0, 0xc(%rbx)
movss 0x2206b(%rip), %xmm0    # 0x52f0c
movq %r13, %rdi
movq %r13, %rsi
callq 0x189d0
movss (%r13), %xmm0
movss %xmm0, 0x1c0(%rbx)
movss 0x4(%r13), %xmm0
movss %xmm0, 0x1c4(%rbx)
movss 0x8(%r13), %xmm0
jmp 0x30f7e
movss 0x223bd(%rip), %xmm2    # 0x53298
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x19510
movss 0x4(%rbx), %xmm0
movss 0x8(%rbx), %xmm1
addss (%rax), %xmm0
movss %xmm0, 0x4(%rbx)
addss 0x4(%rax), %xmm1
movss %xmm1, 0x8(%rbx)
movss 0xc(%rbx), %xmm0
addss 0x8(%rax), %xmm0
movss %xmm0, 0xc(%rbx)
callq 0x19a10
movl $0x7fff, %r13d          # imm = 0x7FFF
andl %r13d, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x22359(%rip), %xmm0    # 0x53288
mulss 0x21fc1(%rip), %xmm0    # 0x52ef8
addss 0x25081(%rip), %xmm0    # 0x55fc0
movss %xmm0, 0x1c0(%rbx)
callq 0x19a10
andl %r13d, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x2232a(%rip), %xmm0    # 0x53288
mulss 0x21f92(%rip), %xmm0    # 0x52ef8
addss 0x25052(%rip), %xmm0    # 0x55fc0
movss %xmm0, 0x1c4(%rbx)
movss 0x25046(%rip), %xmm0    # 0x55fc4
movss %xmm0, 0x1c8(%rbx)
movl $0x3, (%rsp)
leaq 0x20(%rsp), %r13
leaq 0x10(%rsp), %rsi
movq %r13, %rdi
movq %r14, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %rbx, %r9
callq *0x60(%rbp)
movss 0x21f77(%rip), %xmm0    # 0x52f28
ucomiss 0x8(%r13), %xmm0
ja 0x30fbf
cmpl $0x0, 0x20(%rsp)
je 0x30fd5
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x4(%rbx)
movss 0x18(%rsp), %xmm0
movss %xmm0, 0xc(%rbx)
movq 0x37dc4(%rip), %rax     # 0x68da0
movss 0x4(%rax), %xmm0
movss 0x222a7(%rip), %xmm1    # 0x53290
addss %xmm0, %xmm1
movss %xmm1, 0x200(%rbx)
movq 0x375c4(%rip), %rax     # 0x685c0
movq %rax, 0x210(%rbx)
movss %xmm0, 0x4a0(%rbx)
movq %rbx, %rdi
callq *0x90(%rbp)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq