// File: /workspace/github_c_makefile_star2_O2/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 0x210d1(%rip), %xmm0    # 0x4f450
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x196c0
movss (%rax), %xmm0
movss %xmm0, 0xcc(%rbx)
movss 0x4(%rax), %xmm0
movss %xmm0, 0xd0(%rbx)
movss 0x8(%rax), %xmm0
movss %xmm0, 0xd4(%rbx)
movss 0x2109c(%rip), %xmm0    # 0x4f454
movss 0x21098(%rip), %xmm2    # 0x4f458
movaps %xmm0, %xmm1
callq 0x196c0
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 0x381f3(%rip), %rbp     # 0x66600
movq 0x58(%rbp), %rax
testq %rsi, %rsi
jne 0x2e421
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 0x38431(%rip), %rax     # 0x66880
movq %rax, 0x220(%rbx)
leaq 0x4(%rbx), %r12
movsd 0x4(%rbx), %xmm0
movsd %xmm0, 0x10(%rsp)
movss 0xc(%rbx), %xmm0
movss %xmm0, 0x18(%rsp)
andl $0x0, 0x18(%rbx)
andq $0x0, 0x10(%rbx)
testq %r13, %r13
je 0x2e50f
movss (%r13), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x2e492
jnp 0x2e50f
movss 0x20a7e(%rip), %xmm0    # 0x4ef18
movq %r13, %rdi
movq %r13, %rsi
callq 0x18a70
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 0x20a2b(%rip), %xmm0    # 0x4ef08
movq %r13, %rdi
movq %r13, %rsi
callq 0x18a70
movss (%r13), %xmm0
movss %xmm0, 0x1c0(%rbx)
movss 0x4(%r13), %xmm0
movss %xmm0, 0x1c4(%rbx)
movss 0x8(%r13), %xmm0
jmp 0x2e5b4
movss 0x20d81(%rip), %xmm2    # 0x4f298
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x196c0
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 0x19bf0
movl $0x7fff, %r13d          # imm = 0x7FFF
andl %r13d, %eax
cvtsi2ss %eax, %xmm0
divss 0x20d20(%rip), %xmm0    # 0x4f288
mulss 0x209a0(%rip), %xmm0    # 0x4ef10
addss 0x23a28(%rip), %xmm0    # 0x51fa0
movss %xmm0, 0x1c0(%rbx)
callq 0x19bf0
andl %r13d, %eax
cvtsi2ss %eax, %xmm0
divss 0x20cf4(%rip), %xmm0    # 0x4f288
mulss 0x20974(%rip), %xmm0    # 0x4ef10
addss 0x239fc(%rip), %xmm0    # 0x51fa0
movss %xmm0, 0x1c4(%rbx)
movss 0x239f0(%rip), %xmm0    # 0x51fa4
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 0x20941(%rip), %xmm0    # 0x4ef28
ucomiss 0x8(%r13), %xmm0
ja 0x2e5f5
cmpl $0x0, 0x20(%rsp)
je 0x2e60b
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x4(%rbx)
movss 0x18(%rsp), %xmm0
movss %xmm0, 0xc(%rbx)
movq 0x3878e(%rip), %rax     # 0x66da0
movss 0x4(%rax), %xmm0
movss 0x20c71(%rip), %xmm1    # 0x4f290
addss %xmm0, %xmm1
movss %xmm1, 0x200(%rbx)
movq 0x37f8e(%rip), %rax     # 0x665c0
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