// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/g_chase.c
// Function: UpdateChaseCam
void UpdateChaseCam(edict_t *ent)
{
	vec3_t goal, forward, right, angles;
	edict_t *targ;
	trace_t trace;
	int i;

	// is our chase target gone?
	if (!ent->client->chase_target->inuse
		|| ent->client->chase_target->client->resp.spectator) {
		edict_t *old = ent->client->chase_target;
		ChaseNext(ent);
		if (ent->client->chase_target == old) {
			ent->client->chase_target = NULL;
			ent->client->ps.pmove.pm_flags &= ~PMF_NO_PREDICTION;
			return;
		}
	}

	targ = ent->client->chase_target;
	VectorCopy(targ->client->v_angle, angles);
	VectorCopy (targ->s.origin, goal);
	goal[2] += targ->viewheight;

	vec3_t	targorigin;

	VectorCopy (goal, targorigin);

	AngleVectors (angles, forward, right, NULL);
	VectorMA (goal, 30, forward, goal);

	// trace from targorigin to final chase origin goal
	trace = gi.trace (targorigin, vec3_origin, vec3_origin, goal, targ, MASK_SOLID);

	// test for hit so we don't go out of the map!
	if (trace.fraction < 1) {
		vec3_t	temp;

		// we hit something, need to do a bit of avoidance

		// take real end point
		VectorCopy (trace.endpos, goal);

		// real dir vector
		VectorSubtract (goal, targorigin, temp);

		// scale it back bit more
		VectorMA (targorigin, 0.9f, temp, goal);
	}

	VectorCopy(goal, ent->s.origin);
	for (i=0 ; i<3 ; i++) {
		ent->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(targ->client->v_angle[i] - ent->client->resp.cmd_angles[i]);
	}

	if (targ->deadflag) {
		ent->client->ps.viewangles[ROLL] = 40;
		ent->client->ps.viewangles[PITCH] = -15;
		ent->client->ps.viewangles[YAW] = targ->client->killer_yaw;
		ent->client->ps.pmove.pm_type = PM_DEAD;
	} else {
		VectorCopy(targ->client->v_angle, ent->client->ps.viewangles);
		VectorCopy(targ->client->v_angle, ent->client->v_angle);
		ent->client->ps.pmove.pm_type = PM_FREEZE;
	}

	ent->viewheight = 0;
	ent->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION;
	gi.linkentity(ent);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
movq 0x58(%rdi), %rax
movq 0xf30(%rax), %r14
cmpl $0x0, 0x60(%r14)
je 0x24b9b
movq 0x58(%r14), %rax
cmpl $0x0, 0xe04(%rax)
je 0x24bb4
movq %rbx, %rdi
callq 0x19570
movq 0x58(%rbx), %rax
cmpq %r14, 0xf30(%rax)
je 0x24d98
movq 0x58(%rbx), %rax
movq 0xf30(%rax), %r14
movq 0x58(%r14), %rax
movss 0xebc(%rax), %xmm0
leaq 0x2c(%rsp), %rdi
movss %xmm0, (%rdi)
movss 0xec0(%rax), %xmm0
movss %xmm0, 0x4(%rdi)
movss 0xec4(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
movss 0x4(%r14), %xmm0
leaq 0x14(%rsp), %r15
movss %xmm0, (%r15)
movss 0x8(%r14), %xmm1
movss %xmm1, 0x4(%r15)
movss 0xc(%r14), %xmm2
movss %xmm2, 0x8(%r15)
cvtsi2ssl 0x278(%r14), %xmm3
addss %xmm2, %xmm3
movss %xmm3, 0x8(%r15)
leaq 0x20(%rsp), %r12
movss %xmm0, (%r12)
movss %xmm1, 0x4(%r12)
movss %xmm3, 0x8(%r12)
leaq 0x44(%rsp), %r13
leaq 0x38(%rsp), %rdx
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x183a0
movss 0x2f636(%rip), %xmm0    # 0x54294
movq %r15, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x19770
movq 0x4498d(%rip), %rbp     # 0x69600
movl $0x3, (%rsp)
movq 0x44ae7(%rip), %rcx     # 0x69768
leaq 0x50(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %rcx, %rdx
movq %r15, %r8
movq %r14, %r9
callq *0x60(%rbp)
movss 0x2f288(%rip), %xmm0    # 0x53f28
ucomiss 0x8(%r13), %xmm0
jbe 0x24cfc
leaq 0x50(%rsp), %rsi
movss 0xc(%rsi), %xmm0
movss 0x10(%rsi), %xmm1
movss 0x14(%rsi), %xmm2
leaq 0x14(%rsp), %rdx
movss %xmm0, (%rdx)
movss %xmm1, 0x4(%rdx)
leaq 0x20(%rsp), %rdi
subss (%rdi), %xmm0
movss %xmm2, 0x8(%rdx)
movss %xmm0, (%rsi)
subss 0x4(%rdi), %xmm1
movss %xmm1, 0x4(%rsi)
subss 0x8(%rdi), %xmm2
movss %xmm2, 0x8(%rsi)
movss 0x30025(%rip), %xmm0    # 0x54d1c
callq 0x19770
movss 0x14(%rsp), %xmm0
movss %xmm0, 0x4(%rbx)
movss 0x18(%rsp), %xmm0
movss %xmm0, 0x8(%rbx)
movss 0x1c(%rsp), %xmm0
movss %xmm0, 0xc(%rbx)
movq 0x58(%r14), %rax
movq 0x58(%rbx), %rcx
xorl %edx, %edx
movss 0x2fff1(%rip), %xmm0    # 0x54d20
movss 0x2ffed(%rip), %xmm1    # 0x54d24
movss 0xebc(%rax,%rdx,4), %xmm2
subss 0xdf8(%rcx,%rdx,4), %xmm2
mulss %xmm0, %xmm2
divss %xmm1, %xmm2
cvttss2si %xmm2, %esi
movw %si, 0x14(%rcx,%rdx,2)
incq %rdx
cmpq $0x3, %rdx
jne 0x24d37
cmpl $0x0, 0x260(%r14)
je 0x24dac
movq 0x58(%rbx), %rax
movl $0x42200000, 0x24(%rax) # imm = 0x42200000
movl $0xc1700000, 0x1c(%rax) # imm = 0xC1700000
movq 0x58(%r14), %rcx
movss 0xe74(%rcx), %xmm0
movss %xmm0, 0x20(%rax)
movl $0x2, (%rax)
jmp 0x24e11
movq $0x0, 0xf30(%rax)
andb $-0x41, 0x10(%rax)
jmp 0x24e2c
movq 0x58(%r14), %rax
movss 0xebc(%rax), %xmm0
movq 0x58(%rbx), %rcx
movss %xmm0, 0x1c(%rcx)
movss 0xec0(%rax), %xmm0
movss %xmm0, 0x20(%rcx)
movss 0xec4(%rax), %xmm0
movss %xmm0, 0x24(%rcx)
movss 0xebc(%rax), %xmm0
movss %xmm0, 0xebc(%rcx)
movss 0xec0(%rax), %xmm0
movss %xmm0, 0xec0(%rcx)
movss 0xec4(%rax), %xmm0
movss %xmm0, 0xec4(%rcx)
movl $0x4, (%rcx)
movl $0x0, 0x278(%rbx)
movq 0x58(%rbx), %rax
orb $0x40, 0x10(%rax)
movq %rbx, %rdi
callq *0x90(%rbp)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq