// File: /workspace/github_c_makefile_star2_O3/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 0x1ac4f(%rip), %r15     # 0x68600
leaq 0xd52a(%rip), %rdi      # 0x5aee2
callq *0x48(%r15)
movq 0x58(%rbx), %rcx
movl %eax, 0xf20(%rcx)
testb $0x1, 0xe3c(%rcx)
jne 0x4d9e5
movl 0x5c(%rcx), %eax
incl %eax
movl %eax, 0x5c(%rcx)
cmpl $0xc, %eax
je 0x4db9a
jmp 0x4dbcf
movslq 0xe38(%rcx), %rax
cmpl $0x0, 0x318(%rcx,%rax,4)
je 0x4dafe
cvtsi2sdl 0x5c(%rcx), %xmm0
addsd 0xd471(%rip), %xmm0     # 0x5ae78
addsd %xmm0, %xmm0
mulsd 0xba25(%rip), %xmm0     # 0x59438
divsd 0xd465(%rip), %xmm0     # 0x5ae80
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
callq 0x19550
mulsd 0xd453(%rip), %xmm0     # 0x5ae88
cvtsd2ss %xmm0, %xmm0
leaq 0xc(%rsp), %r14
movss %xmm0, (%r14)
movl $0x0, 0x4(%r14)
movsd (%rsp), %xmm0
callq 0x18990
mulsd 0xd433(%rip), %xmm0     # 0x5ae90
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 0x1b439(%rip), %rax     # 0x68ec0
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 0x19990
movq 0x1ab5d(%rip), %rax     # 0x68618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xd, %eax
movq 0x58(%rbx), %rax
jb 0x4dadb
movslq 0xe38(%rax), %rcx
decl 0x318(%rax,%rcx,4)
movl $0x4, 0xef8(%rax)
testb $0x1, 0x10(%rax)
jne 0x4db62
movl $0x2d, 0x38(%rbx)
movl $0x35, 0xef4(%rax)
jmp 0x4db73
movq 0x1b29b(%rip), %r14     # 0x68da0
movss 0x4(%r14), %xmm0
ucomiss 0x244(%rbx), %xmm0
jb 0x4db54
movq 0x20(%r15), %r12
leaq 0x6210(%rip), %rdi      # 0x53d2f
callq *0x48(%r15)
movss 0x53fd(%rip), %xmm0     # 0x52f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
movl $0x2, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r12
movss 0x53e2(%rip), %xmm0     # 0x52f28
addss 0x4(%r14), %xmm0
movss %xmm0, 0x244(%rbx)
movq %rbx, %rdi
callq 0x192b0
movq 0x58(%rbx), %rax
jmp 0x4db73
movl $0x9f, 0x38(%rbx)
movl $0xa8, 0xef4(%rax)
movl 0x5c(%rax), %ecx
incl %ecx
movl %ecx, 0x5c(%rax)
cmpl $0xc, %ecx
jne 0x4dbcf
movslq 0xe38(%rax), %rcx
cmpl $0x0, 0x318(%rax,%rcx,4)
je 0x4db9a
movl $0x6, 0x5c(%rax)
jmp 0x4dbcf
movq 0x20(%r15), %r14
leaq 0xd352(%rip), %rdi      # 0x5aef7
callq *0x48(%r15)
movss 0x5377(%rip), %xmm0     # 0x52f28
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