// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/p_weapon.c
// Function: Weapon_HyperBlaster_Fire
void Weapon_HyperBlaster_Fire (edict_t *ent)
{
	float	rotation;
	vec3_t	offset;
	int		effect;
	int		damage;

	ent->client->weapon_sound = gi.soundindex("weapons/hyprbl1a.wav");

	if (!(ent->client->buttons & BUTTON_ATTACK))
	{
		ent->client->ps.gunframe++;
	}
	else
	{
		if (! ent->client->pers.inventory[ent->client->ammo_index] )
		{
			if (level.time >= ent->pain_debounce_time)
			{
				gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
				ent->pain_debounce_time = level.time + 1;
			}
			NoAmmoWeaponChange (ent);
		}
		else
		{
			rotation = (ent->client->ps.gunframe - 5.0) * 2.0 * M_PI / 6.0;
			offset[0] = -4 * sin(rotation);
			offset[1] = 0;
			offset[2] = 4 * cos(rotation);

			if ((ent->client->ps.gunframe == 6) || (ent->client->ps.gunframe == 9))
				effect = EF_HYPERBLASTER;
			else
				effect = 0;
			if (deathmatch->value)
				damage = 15;
			else
				damage = 20;

#ifdef WEAP_BALANCE_OK	
			if ((int)ctfflags->value & CTF_WEAP_BALANCE) //surt, a little less damage
				damage = 12; //these things come out pretty fast
#endif

			Blaster_Fire (ent, offset, damage, true, effect);
			if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
				ent->client->pers.inventory[ent->client->ammo_index]--;

			ent->client->anim_priority = ANIM_ATTACK;
			if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
			{
				ent->s.frame = FRAME_crattak1 - 1;
				ent->client->anim_end = FRAME_crattak9;
			}
			else
			{
				ent->s.frame = FRAME_attack1 - 1;
				ent->client->anim_end = FRAME_attack8;
			}
		}

		ent->client->ps.gunframe++;
		if (ent->client->ps.gunframe == 12 && ent->client->pers.inventory[ent->client->ammo_index])
			ent->client->ps.gunframe = 6;
	}

	if (ent->client->ps.gunframe == 12)
	{
		gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/hyprbd1a.wav"), 1, ATTN_NORM, 0);
		ent->client->weapon_sound = 0;
	}

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x1af1a(%rip), %r15     # 0x69600
leaq 0xd4a5(%rip), %rdi      # 0x5bb92
callq *0x48(%r15)
movq 0x58(%rbx), %rcx
movl %eax, 0xf20(%rcx)
testb $0x1, 0xe3c(%rcx)
jne 0x4e70c
incl 0x5c(%rcx)
jmp 0x4e8c3
movslq 0xe38(%rcx), %rax
cmpl $0x0, 0x318(%rcx,%rax,4)
je 0x4e829
cvtsi2sdl 0x5c(%rcx), %xmm0
addsd 0xd3ea(%rip), %xmm0     # 0x5bb18
addsd %xmm0, %xmm0
mulsd 0xbaee(%rip), %xmm0     # 0x5a228
divsd 0xd3de(%rip), %xmm0     # 0x5bb20
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
callq 0x19550
mulsd 0xd3cc(%rip), %xmm0     # 0x5bb28
cvtsd2ss %xmm0, %xmm0
leaq 0xc(%rsp), %r14
movss %xmm0, (%r14)
movl $0x0, 0x4(%r14)
movsd (%rsp), %xmm0
callq 0x18990
mulsd 0xd3ac(%rip), %xmm0     # 0x5bb30
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8(%r14)
movq 0x58(%rbx), %rax
movl 0x5c(%rax), %eax
cmpl $0x6, %eax
sete %cl
cmpl $0x9, %eax
sete %al
orb %cl, %al
movzbl %al, %r8d
movq 0x1b712(%rip), %rax     # 0x69ec0
movq (%rax), %rax
xorps %xmm0, %xmm0
cmpeqss 0x20(%rax), %xmm0
shll $0x6, %r8d
movd %xmm0, %eax
andl $0x1, %eax
leal (%rax,%rax,4), %edx
addl $0xf, %edx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %ecx
callq 0x199a0
movq 0x1ae36(%rip), %rax     # 0x69618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xd, %eax
jb 0x4e802
movq 0x58(%rbx), %rax
movslq 0xe38(%rax), %rcx
decl 0x318(%rax,%rcx,4)
movq 0x58(%rbx), %rax
movl $0x4, 0xef8(%rax)
testb $0x1, 0x10(%rax)
jne 0x4e889
movl $0x2d, 0x38(%rbx)
movl $0x35, 0xef4(%rax)
jmp 0x4e89a
movq 0x1b570(%rip), %r14     # 0x69da0
movss 0x4(%r14), %xmm0
ucomiss 0x244(%rbx), %xmm0
jb 0x4e87f
movq 0x20(%r15), %r12
leaq 0x64a5(%rip), %rdi      # 0x54cef
callq *0x48(%r15)
movss 0x56d2(%rip), %xmm0     # 0x53f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
movl $0x2, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r12
movss 0x56b7(%rip), %xmm0     # 0x53f28
addss 0x4(%r14), %xmm0
movss %xmm0, 0x244(%rbx)
movq %rbx, %rdi
callq 0x192b0
jmp 0x4e89a
movl $0x9f, 0x38(%rbx)
movl $0xa8, 0xef4(%rax)
movq 0x58(%rbx), %rax
movl 0x5c(%rax), %ecx
incl %ecx
movl %ecx, 0x5c(%rax)
cmpl $0xc, %ecx
jne 0x4e8c3
movslq 0xe38(%rax), %rcx
cmpl $0x0, 0x318(%rax,%rcx,4)
je 0x4e8c3
movl $0x6, 0x5c(%rax)
movq 0x58(%rbx), %rax
cmpl $0xc, 0x5c(%rax)
jne 0x4e902
movq 0x20(%r15), %r14
leaq 0xd2cf(%rip), %rdi      # 0x5bba7
callq *0x48(%r15)
movss 0x5644(%rip), %xmm0     # 0x53f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r14
movq 0x58(%rbx), %rax
movl $0x0, 0xf20(%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq