// File: /workspace/github_c_makefile_star2_O2/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 0x1ce6e(%rip), %r15     # 0x66600
leaq 0xd709(%rip), %rdi      # 0x56ea2
callq *0x48(%r15)
movq 0x58(%rbx), %rcx
movl %eax, 0xf20(%rcx)
testb $0x1, 0xe3c(%rcx)
jne 0x497c6
movl 0x5c(%rcx), %eax
incl %eax
movl %eax, 0x5c(%rcx)
cmpl $0xc, %eax
je 0x49974
jmp 0x499a6
movslq 0xe38(%rcx), %rax
cmpl $0x0, 0x318(%rcx,%rax,4)
je 0x498da
cvtsi2sdl 0x5c(%rcx), %xmm0
addsd 0xd650(%rip), %xmm0     # 0x56e38
addsd %xmm0, %xmm0
mulsd 0xbc24(%rip), %xmm0     # 0x55418
divsd 0xd644(%rip), %xmm0     # 0x56e40
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
callq 0x19700
mulsd 0xd632(%rip), %xmm0     # 0x56e48
cvtsd2ss %xmm0, %xmm0
leaq 0xc(%rsp), %r14
movss %xmm0, (%r14)
andl $0x0, 0x4(%r14)
movsd (%rsp), %xmm0
callq 0x18a20
mulsd 0xd615(%rip), %xmm0     # 0x56e50
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 0x1d65b(%rip), %rax     # 0x66ec0
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
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x19b70
movq 0x1cd81(%rip), %rax     # 0x66618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xd, %eax
movq 0x58(%rbx), %rax
jb 0x498b7
movslq 0xe38(%rax), %rcx
decl 0x318(%rax,%rcx,4)
movl $0x4, 0xef8(%rax)
testb $0x1, 0x10(%rax)
jne 0x4993c
movl $0x2d, 0x38(%rbx)
movl $0x35, 0xef4(%rax)
jmp 0x4994d
movq 0x1d4bf(%rip), %r14     # 0x66da0
movss 0x4(%r14), %xmm0
ucomiss 0x244(%rbx), %xmm0
jb 0x4992e
movq 0x20(%r15), %r12
leaq 0x6434(%rip), %rdi      # 0x4fd2f
callq *0x48(%r15)
pushq $0x2
popq %rsi
movss 0x561e(%rip), %xmm0     # 0x4ef28
xorps %xmm2, %xmm2
movq %rbx, %rdi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r12
movss 0x5608(%rip), %xmm0     # 0x4ef28
addss 0x4(%r14), %xmm0
movss %xmm0, 0x244(%rbx)
movq %rbx, %rdi
callq 0x19430
movq 0x58(%rbx), %rax
jmp 0x4994d
movl $0x9f, 0x38(%rbx)
movl $0xa8, 0xef4(%rax)
movl 0x5c(%rax), %ecx
incl %ecx
movl %ecx, 0x5c(%rax)
cmpl $0xc, %ecx
jne 0x499a6
movslq 0xe38(%rax), %rcx
cmpl $0x0, 0x318(%rax,%rcx,4)
je 0x49974
movl $0x6, 0x5c(%rax)
jmp 0x499a6
movq 0x20(%r15), %r14
leaq 0xd538(%rip), %rdi      # 0x56eb7
callq *0x48(%r15)
movss 0x559d(%rip), %xmm0     # 0x4ef28
xorps %xmm2, %xmm2
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r14
movq 0x58(%rbx), %rax
andl $0x0, 0xf20(%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq