// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_phys.c
// Function: SV_Physics_Toss
void SV_Physics_Toss (edict_t *ent)
{
	trace_t		trace;
	vec3_t		move;
	float		backoff;
	edict_t		*slave;
	qboolean	wasinwater;
	qboolean	isinwater;
	vec3_t		old_origin;

// regular thinking
	SV_RunThink (ent);

	// if not a team captain, so movement will be handled elsewhere
	if ( ent->flags & FL_TEAMSLAVE)
		return;

	if (ent->velocity[2] > 0)
		ent->groundentity = NULL;

// check for the groundentity going away
	if (ent->groundentity)
		if (!ent->groundentity->inuse)
			ent->groundentity = NULL;

// if onground, return without moving
	if ( ent->groundentity )
		return;

	VectorCopy (ent->s.origin, old_origin);

	SV_CheckVelocity (ent);

// add gravity
	if (ent->movetype != MOVETYPE_FLY
	&& ent->movetype != MOVETYPE_FLYMISSILE
 	&& ent->movetype != MOVETYPE_REFLECT)	// SKWiD MOD
		SV_AddGravity (ent);

// move angles
	VectorMA (ent->s.angles, FRAMETIME, ent->avelocity, ent->s.angles);

// move origin
	VectorScale (ent->velocity, FRAMETIME, move);
	trace = SV_PushEntity (ent, move);
	if (!ent->inuse)
		return;

	if (trace.fraction < 1)
	{
		if (ent->movetype == MOVETYPE_REFLECT)  // SKWiD MOD
 			backoff = 2.0;	// get out of bsp
		else if (ent->movetype == MOVETYPE_BOUNCE)
			backoff = 1.5;
		else
			backoff = 1;

		ClipVelocity (ent->velocity, trace.plane.normal, ent->velocity, backoff);

	// stop if on ground
 		if (ent->movetype != MOVETYPE_REFLECT) {   // SKWiD MOD
		if (trace.plane.normal[2] > 0.7)
		{		
			if (ent->velocity[2] < 60 || ent->movetype != MOVETYPE_BOUNCE )
			{
				ent->groundentity = trace.ent;
				ent->groundentity_linkcount = trace.ent->linkcount;
				VectorCopy (vec3_origin, ent->velocity);
				VectorCopy (vec3_origin, ent->avelocity);
			}
		}
		} // SKWiD MOD
//		if (ent->touch)
//			ent->touch (ent, trace.ent, &trace.plane, trace.surface);
	}
	
// check for water transition
	wasinwater = (ent->watertype & MASK_WATER);
	ent->watertype = gi.pointcontents (ent->s.origin);
	isinwater = ent->watertype & MASK_WATER;

	if (isinwater)
		ent->waterlevel = 1;
	else
		ent->waterlevel = 0;

	if (!wasinwater && isinwater)
		gi.positioned_sound (old_origin, g_edicts, CHAN_AUTO, gi.soundindex("misc/h2ohit1.wav"), 1, 1, 0);
	else if (wasinwater && !isinwater)
		gi.positioned_sound (ent->s.origin, g_edicts, CHAN_AUTO, gi.soundindex("misc/h2ohit1.wav"), 1, 1, 0);

// move teamslaves
	for (slave = ent->teamchain; slave; slave = slave->teamchain)
	{
		VectorCopy (ent->s.origin, slave->s.origin);
		gi.linkentity (slave);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x18680
movq -0x8(%rbp), %rax
movl 0x11c(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x47641
jmp 0x47ad3
movq -0x8(%rbp), %rax
movss 0x1c8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x47664
movq -0x8(%rbp), %rax
movq $0x0, 0x2b8(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x2b8(%rax)
je 0x47694
movq -0x8(%rbp), %rax
movq 0x2b8(%rax), %rax
cmpl $0x0, 0x60(%rax)
jne 0x47692
movq -0x8(%rbp), %rax
movq $0x0, 0x2b8(%rax)
jmp 0x47694
movq -0x8(%rbp), %rax
cmpq $0x0, 0x2b8(%rax)
je 0x476a7
jmp 0x47ad3
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, -0x7c(%rbp)
movq -0x8(%rbp), %rax
movss 0x8(%rax), %xmm0
movss %xmm0, -0x78(%rbp)
movq -0x8(%rbp), %rax
movss 0xc(%rax), %xmm0
movss %xmm0, -0x74(%rbp)
movq -0x8(%rbp), %rdi
callq 0x19200
movq -0x8(%rbp), %rax
cmpl $0x6, 0x118(%rax)
je 0x4770a
movq -0x8(%rbp), %rax
cmpl $0x8, 0x118(%rax)
je 0x4770a
movq -0x8(%rbp), %rax
cmpl $0xa, 0x118(%rax)
je 0x4770a
movq -0x8(%rbp), %rdi
callq 0x18a60
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
movq -0x8(%rbp), %rsi
addq $0x1cc, %rsi            # imm = 0x1CC
movq -0x8(%rbp), %rdx
addq $0x10, %rdx
movss 0x28b67(%rip), %xmm0    # 0x70294
callq 0x199c0
movq -0x8(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
leaq -0x5c(%rbp), %rsi
movss 0x28b4b(%rip), %xmm0    # 0x70294
callq 0x18a80
movq -0x8(%rbp), %rsi
leaq -0x5c(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
callq 0x18350
leaq -0x50(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
movl $0x48, %edx
callq 0x18dc0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x60(%rax)
jne 0x47786
jmp 0x47ad3
movss 0x2875e(%rip), %xmm0    # 0x6feec
ucomiss -0x48(%rbp), %xmm0
jbe 0x4790d
movq -0x8(%rbp), %rax
cmpl $0xa, 0x118(%rax)
jne 0x477b4
movss 0x2873b(%rip), %xmm0    # 0x6fee8
movss %xmm0, -0x60(%rbp)
jmp 0x477df
movq -0x8(%rbp), %rax
cmpl $0x9, 0x118(%rax)
jne 0x477d0
movss 0x2cf37(%rip), %xmm0    # 0x74700
movss %xmm0, -0x60(%rbp)
jmp 0x477dd
movss 0x28714(%rip), %xmm0    # 0x6feec
movss %xmm0, -0x60(%rbp)
jmp 0x477df
movq -0x8(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
leaq -0x50(%rbp), %rsi
addq $0x18, %rsi
movq -0x8(%rbp), %rdx
addq $0x1c0, %rdx            # imm = 0x1C0
movss -0x60(%rbp), %xmm0
callq 0x18c30
movq -0x8(%rbp), %rax
cmpl $0xa, 0x118(%rax)
je 0x4790b
movss -0x30(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x2cebf(%rip), %xmm1    # 0x746e8
ucomisd %xmm1, %xmm0
jbe 0x47909
movq -0x8(%rbp), %rax
movss 0x2b345(%rip), %xmm0    # 0x72b84
ucomiss 0x1c8(%rax), %xmm0
ja 0x47859
movq -0x8(%rbp), %rax
cmpl $0x9, 0x118(%rax)
je 0x47907
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x2b8(%rax)
movq -0x10(%rbp), %rax
movl 0x64(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x2c0(%rax)
movq 0x3aee8(%rip), %rax     # 0x82768
movss (%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1c0(%rax)
movq 0x3aed1(%rip), %rax     # 0x82768
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1c4(%rax)
movq 0x3aeb9(%rip), %rax     # 0x82768
movss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1c8(%rax)
movq 0x3aea1(%rip), %rax     # 0x82768
movss (%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1cc(%rax)
movq 0x3ae8a(%rip), %rax     # 0x82768
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1d0(%rax)
movq 0x3ae72(%rip), %rax     # 0x82768
movss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1d4(%rax)
jmp 0x47909
jmp 0x4790b
jmp 0x4790d
movq -0x8(%rbp), %rax
movl 0x308(%rax), %eax
andl $0x38, %eax
movl %eax, -0x6c(%rbp)
movq 0x3acdc(%rip), %rax     # 0x82600
movq 0x68(%rax), %rax
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
callq *%rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x308(%rax)
movq -0x8(%rbp), %rax
movl 0x308(%rax), %eax
andl $0x38, %eax
movl %eax, -0x70(%rbp)
cmpl $0x0, -0x70(%rbp)
je 0x47964
movq -0x8(%rbp), %rax
movl $0x1, 0x30c(%rax)
jmp 0x47972
movq -0x8(%rbp), %rax
movl $0x0, 0x30c(%rax)
cmpl $0x0, -0x6c(%rbp)
jne 0x479e8
cmpl $0x0, -0x70(%rbp)
je 0x479e8
movq 0x3ac7b(%rip), %rax     # 0x82600
movq 0x28(%rax), %rax
movq %rax, -0xd0(%rbp)
leaq -0x7c(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq 0x3abb6(%rip), %rax     # 0x82558
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
leaq 0x2cddf(%rip), %rdi     # 0x74792
movq 0x3ac46(%rip), %rax     # 0x82600
callq *0x48(%rax)
movq -0xe0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
movl %eax, %ecx
movq -0xd0(%rbp), %rax
xorl %edx, %edx
movss 0x2850e(%rip), %xmm1    # 0x6feec
xorps %xmm2, %xmm2
movaps %xmm1, %xmm0
callq *%rax
jmp 0x47a62
cmpl $0x0, -0x6c(%rbp)
je 0x47a60
cmpl $0x0, -0x70(%rbp)
jne 0x47a60
movq 0x3ac05(%rip), %rax     # 0x82600
movq 0x28(%rax), %rax
movq %rax, -0xe8(%rbp)
movq -0x8(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xf8(%rbp)
movq 0x3ab3c(%rip), %rax     # 0x82558
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
leaq 0x2cd65(%rip), %rdi     # 0x74792
movq 0x3abcc(%rip), %rax     # 0x82600
callq *0x48(%rax)
movq -0xf8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
movl %eax, %ecx
movq -0xe8(%rbp), %rax
xorl %edx, %edx
movss 0x28494(%rip), %xmm1    # 0x6feec
xorps %xmm2, %xmm2
movaps %xmm1, %xmm0
callq *%rax
jmp 0x47a62
movq -0x8(%rbp), %rax
movq 0x2c8(%rax), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x47ad3
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x68(%rbp), %rax
movss %xmm0, 0x4(%rax)
movq -0x8(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x68(%rbp), %rax
movss %xmm0, 0x8(%rax)
movq -0x8(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x68(%rbp), %rax
movss %xmm0, 0xc(%rax)
movq 0x3ab4b(%rip), %rax     # 0x82600
movq 0x90(%rax), %rax
movq -0x68(%rbp), %rdi
callq *%rax
movq -0x68(%rbp), %rax
movq 0x2c8(%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x47a71
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopl (%rax)