// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_phys.c
// Function: SV_FlyMove
int SV_FlyMove (edict_t *ent, float time, int mask)
{
	edict_t		*hit;
	int			bumpcount, numbumps;
	vec3_t		dir;
	float		d;
	int			numplanes;
	vec3_t		planes[MAX_CLIP_PLANES];
	vec3_t		primal_velocity, original_velocity, new_velocity;
	int			i, j;
	trace_t		trace;
	vec3_t		end;
	float		time_left;
	int			blocked;
	
	numbumps = 4;
	
	blocked = 0;
	VectorCopy (ent->velocity, original_velocity);
	VectorCopy (ent->velocity, primal_velocity);
	numplanes = 0;
	
	time_left = time;

	ent->groundentity = NULL;
	for (bumpcount=0 ; bumpcount<numbumps ; bumpcount++)
	{
		for (i=0 ; i<3 ; i++)
			end[i] = ent->s.origin[i] + time_left * ent->velocity[i];

		trace = gi.trace (ent->s.origin, ent->mins, ent->maxs, end, ent, mask);

		if (trace.allsolid)
		{	// entity is trapped in another solid
			VectorCopy (vec3_origin, ent->velocity);
			return 3;
		}

		if (trace.fraction > 0)
		{	// actually covered some distance
			VectorCopy (trace.endpos, ent->s.origin);
			VectorCopy (ent->velocity, original_velocity);
			numplanes = 0;
		}

		if (trace.fraction == 1)
			 break;		// moved the entire distance

		hit = trace.ent;

		if (trace.plane.normal[2] > 0.7)
		{
			blocked |= 1;		// floor
			if ( hit->solid == SOLID_BSP)
			{
				ent->groundentity = hit;
				ent->groundentity_linkcount = hit->linkcount;
			}
		}
		if (!trace.plane.normal[2])
		{
			blocked |= 2;		// step
		}

//
// run the impact function
//
		SV_Impact (ent, &trace);
		if (!ent->inuse)
			break;		// removed by the impact function

		
		time_left -= time_left * trace.fraction;
		
	// cliped to another plane
		if (numplanes >= MAX_CLIP_PLANES)
		{	// this shouldn't really happen
			VectorCopy (vec3_origin, ent->velocity);
			return 3;
		}

		VectorCopy (trace.plane.normal, planes[numplanes]);
		numplanes++;

//
// modify original_velocity so it parallels all of the clip planes
//
		for (i=0 ; i<numplanes ; i++)
		{
			ClipVelocity (original_velocity, planes[i], new_velocity, 1);

			for (j=0 ; j<numplanes ; j++)
				if ((j != i) && !VectorCompare (planes[i], planes[j]))
				{
					if (DotProduct (new_velocity, planes[j]) < 0)
						break;	// not ok
				}
			if (j == numplanes)
				break;
		}
		
		if (i != numplanes)
		{	// go along this plane
			VectorCopy (new_velocity, ent->velocity);
		}
		else
		{	// go along the crease
			if (numplanes != 2)
			{
//				gi.dprintf ("clip velocity, numplanes == %i\n",numplanes);
				VectorCopy (vec3_origin, ent->velocity);
				return 7;
			}
			CrossProduct (planes[0], planes[1], dir);
			d = DotProduct (dir, ent->velocity);
			VectorScale (dir, d, ent->velocity);
		}

//
// if original velocity is against the original velocity, stop dead
// to avoid tiny occilations in sloping corners
//
		if (DotProduct (ent->velocity, primal_velocity) <= 0)
		{
			VectorCopy (vec3_origin, ent->velocity);
			return blocked;
		}
	}

	return blocked;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x10(%rbp)
movss %xmm0, -0x14(%rbp)
movl %esi, -0x18(%rbp)
movl $0x4, -0x28(%rbp)
movl $0x0, -0x10c(%rbp)
movq -0x10(%rbp), %rax
movss 0x1c0(%rax), %xmm0
movss %xmm0, -0x98(%rbp)
movq -0x10(%rbp), %rax
movss 0x1c4(%rax), %xmm0
movss %xmm0, -0x94(%rbp)
movq -0x10(%rbp), %rax
movss 0x1c8(%rax), %xmm0
movss %xmm0, -0x90(%rbp)
movq -0x10(%rbp), %rax
movss 0x1c0(%rax), %xmm0
movss %xmm0, -0x8c(%rbp)
movq -0x10(%rbp), %rax
movss 0x1c4(%rax), %xmm0
movss %xmm0, -0x88(%rbp)
movq -0x10(%rbp), %rax
movss 0x1c8(%rax), %xmm0
movss %xmm0, -0x84(%rbp)
movl $0x0, -0x3c(%rbp)
movss -0x14(%rbp), %xmm0
movss %xmm0, -0x108(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x2b8(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x46708
movl $0x0, -0xa8(%rbp)
cmpl $0x3, -0xa8(%rbp)
jge 0x460ff
movq -0x10(%rbp), %rax
movslq -0xa8(%rbp), %rcx
movss 0x4(%rax,%rcx,4), %xmm1
movss -0x108(%rbp), %xmm0
movq -0x10(%rbp), %rax
movslq -0xa8(%rbp), %rcx
movss 0x1c0(%rax,%rcx,4), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movslq -0xa8(%rbp), %rax
movss %xmm0, -0x104(%rbp,%rax,4)
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x460a0
movq 0x3c4fa(%rip), %rax     # 0x82600
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rsi
addq $0x4, %rsi
movq -0x10(%rbp), %rdx
addq $0xcc, %rdx
movq -0x10(%rbp), %rcx
addq $0xd8, %rcx
leaq -0x104(%rbp), %r8
movq -0x10(%rbp), %r9
movl -0x18(%rbp), %r10d
leaq -0x158(%rbp), %rdi
movl %r10d, (%rsp)
callq *%rax
leaq -0xf8(%rbp), %rdi
leaq -0x158(%rbp), %rsi
movl $0x48, %edx
callq 0x18dc0
cmpl $0x0, -0xf8(%rbp)
je 0x461b8
movq 0x3c5fc(%rip), %rax     # 0x82768
movss (%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c0(%rax)
movq 0x3c5e5(%rip), %rax     # 0x82768
movss 0x4(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c4(%rax)
movq 0x3c5cd(%rip), %rax     # 0x82768
movss 0x8(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c8(%rax)
movl $0x3, -0x4(%rbp)
jmp 0x46711
movss -0xf0(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x4623e
movss -0xec(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x4(%rax)
movss -0xe8(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x8(%rax)
movss -0xe4(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0xc(%rax)
movq -0x10(%rbp), %rax
movss 0x1c0(%rax), %xmm0
movss %xmm0, -0x98(%rbp)
movq -0x10(%rbp), %rax
movss 0x1c4(%rax), %xmm0
movss %xmm0, -0x94(%rbp)
movq -0x10(%rbp), %rax
movss 0x1c8(%rax), %xmm0
movss %xmm0, -0x90(%rbp)
movl $0x0, -0x3c(%rbp)
movss -0xf0(%rbp), %xmm0
movss 0x29c9e(%rip), %xmm1    # 0x6feec
ucomiss %xmm1, %xmm0
jne 0x4625a
jp 0x4625a
jmp 0x46708
movq -0xb8(%rbp), %rax
movq %rax, -0x20(%rbp)
movss -0xd8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x2e46f(%rip), %xmm1    # 0x746e8
ucomisd %xmm1, %xmm0
jbe 0x462bd
movl -0x10c(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x10c(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x3, 0x108(%rax)
jne 0x462bb
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x2b8(%rax)
movq -0x20(%rbp), %rax
movl 0x64(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2c0(%rax)
jmp 0x462bd
movss -0xd8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x462de
jp 0x462de
movl -0x10c(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x10c(%rbp)
movq -0x10(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x18b50
movq -0x10(%rbp), %rax
cmpl $0x0, 0x60(%rax)
jne 0x462fd
jmp 0x46708
movss -0x108(%rbp), %xmm0
movss -0xf0(%rbp), %xmm2
movss -0x108(%rbp), %xmm1
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x108(%rbp)
cmpl $0x5, -0x3c(%rbp)
jl 0x4638b
movq 0x3c429(%rip), %rax     # 0x82768
movss (%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c0(%rax)
movq 0x3c412(%rip), %rax     # 0x82768
movss 0x4(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c4(%rax)
movq 0x3c3fa(%rip), %rax     # 0x82768
movss 0x8(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c8(%rax)
movl $0x3, -0x4(%rbp)
jmp 0x46711
movss -0xe0(%rbp), %xmm0
movslq -0x3c(%rbp), %rcx
leaq -0x80(%rbp), %rax
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
movss -0xdc(%rbp), %xmm0
movslq -0x3c(%rbp), %rcx
leaq -0x80(%rbp), %rax
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movss -0xd8(%rbp), %xmm0
movslq -0x3c(%rbp), %rcx
leaq -0x80(%rbp), %rax
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x8(%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x46537
leaq -0x98(%rbp), %rdi
movslq -0xa8(%rbp), %rax
leaq -0x80(%rbp), %rsi
imulq $0xc, %rax, %rax
addq %rax, %rsi
leaq -0xa4(%rbp), %rdx
movss 0x29ac4(%rip), %xmm0    # 0x6feec
callq 0x18c30
movl $0x0, -0xac(%rbp)
movl -0xac(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x46514
movl -0xac(%rbp), %eax
cmpl -0xa8(%rbp), %eax
je 0x464fe
movslq -0xa8(%rbp), %rax
leaq -0x80(%rbp), %rdi
imulq $0xc, %rax, %rax
addq %rax, %rdi
movslq -0xac(%rbp), %rax
leaq -0x80(%rbp), %rsi
imulq $0xc, %rax, %rax
addq %rax, %rsi
callq 0x18c60
cmpl $0x0, %eax
jne 0x464fe
movss -0xa4(%rbp), %xmm0
movslq -0xac(%rbp), %rcx
leaq -0x80(%rbp), %rax
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm2
movss -0xa0(%rbp), %xmm1
movslq -0xac(%rbp), %rcx
leaq -0x80(%rbp), %rax
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
mulss 0x4(%rax), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss -0x9c(%rbp), %xmm1
movslq -0xac(%rbp), %rcx
leaq -0x80(%rbp), %rax
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm2
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x464fc
jmp 0x46514
jmp 0x464fe
jmp 0x46500
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x46437
movl -0xac(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jne 0x46521
jmp 0x46537
jmp 0x46523
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x463f1
movl -0xa8(%rbp), %eax
cmpl -0x3c(%rbp), %eax
je 0x46583
movss -0xa4(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c0(%rax)
movss -0xa0(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c4(%rax)
movss -0x9c(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c8(%rax)
jmp 0x46652
cmpl $0x2, -0x3c(%rbp)
je 0x465dc
movq 0x3c1d8(%rip), %rax     # 0x82768
movss (%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c0(%rax)
movq 0x3c1c1(%rip), %rax     # 0x82768
movss 0x4(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c4(%rax)
movq 0x3c1a9(%rip), %rax     # 0x82768
movss 0x8(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c8(%rax)
movl $0x7, -0x4(%rbp)
jmp 0x46711
leaq -0x80(%rbp), %rdi
leaq -0x80(%rbp), %rsi
addq $0xc, %rsi
leaq -0x34(%rbp), %rdx
callq 0x18ca0
movss -0x34(%rbp), %xmm1
movq -0x10(%rbp), %rax
movss 0x1c0(%rax), %xmm2
movss -0x30(%rbp), %xmm0
movq -0x10(%rbp), %rax
mulss 0x1c4(%rax), %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movss -0x2c(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss 0x1c8(%rax), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x38(%rbp)
leaq -0x34(%rbp), %rdi
movss -0x38(%rbp), %xmm0
movq -0x10(%rbp), %rsi
addq $0x1c0, %rsi            # imm = 0x1C0
callq 0x18a80
movq -0x10(%rbp), %rax
movss 0x1c0(%rax), %xmm0
movss -0x8c(%rbp), %xmm2
movq -0x10(%rbp), %rax
movss 0x1c4(%rax), %xmm1
mulss -0x88(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq -0x10(%rbp), %rax
movss 0x1c8(%rax), %xmm1
movss -0x84(%rbp), %xmm2
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm1, %xmm0
jb 0x466f8
movq 0x3c0bb(%rip), %rax     # 0x82768
movss (%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c0(%rax)
movq 0x3c0a4(%rip), %rax     # 0x82768
movss 0x4(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c4(%rax)
movq 0x3c08c(%rip), %rax     # 0x82768
movss 0x8(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c8(%rax)
movl -0x10c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x46711
jmp 0x466fa
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x4608a
movl -0x10c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
nopl (%rax)