// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_weapon.c
// Function: fire_blaster
void fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int effect, qboolean hyper)
{
	edict_t	*bolt;
	trace_t	tr;

	VectorNormalize (dir);


#ifdef WEAP_BALANCE_OK	
	
	// Only change hand blaster effect
	if (((int)ctfflags->value & CTF_WEAP_BALANCE) &&
		effect & EF_BLASTER)
	{
		bolt = G_Spawn();
		bolt->svflags = SVF_DEADMONSTER;
		VectorCopy (start, bolt->s.origin);
		vectoangles (dir, bolt->s.angles);
		VectorScale (dir, speed, bolt->velocity);
		VectorAdd (start, bolt->velocity, bolt->s.old_origin);
		bolt->clipmask = MASK_SHOT;

		bolt->movetype = MOVETYPE_FLYMISSILE;
		bolt->solid = SOLID_BBOX;
		bolt->s.renderfx |= RF_BEAM | RF_FULLBRIGHT;
		bolt->s.modelindex = 1;			// must be non-zero
		bolt->owner = self;

		// set the beam diameter
		bolt->s.frame = 3;

		// set the color
		if (self->client && self->client->ctf.teamnum == CTF_TEAM_RED)		// on red team
			bolt->s.skinnum = 0xf2f2f0f0;		// red
		else												// on blue team
			bolt->s.skinnum = 0xf3f3f1f1;		// sorta blue


		VectorSet (bolt->mins, -8, -8, -8);
		VectorSet (bolt->maxs, 8, 8, 8);

		bolt->touch = blaster_touch;
		bolt->nextthink = level.time + 4;
		bolt->think = G_FreeEdict;
		bolt->dmg = damage;
		bolt->svflags |= SVF_DEADMONSTER;
		
		gi.linkentity (bolt);

		//bolt->spawnflags |= 0x80000001;
		//bolt->svflags &= ~SVF_NOCLIENT;
		if (self->client)
			check_dodge (self, bolt->s.origin, dir, speed);

		tr = gi.trace (self->s.origin, NULL, NULL, bolt->s.origin, bolt, MASK_SHOT);
		if (tr.fraction < 1.0)
		{
			VectorMA (bolt->s.origin, -10, dir, bolt->s.origin);
			bolt->touch (bolt, tr.ent, NULL, NULL);
		}

		return;
	}
#endif


	bolt = G_Spawn();
	bolt->svflags = SVF_DEADMONSTER;
	// yes, I know it looks weird that projectiles are deadmonsters
	// what this means is that when prediction is used against the object
	// (blaster/hyperblaster shots), the player won't be solid clipped against
	// the object.  Right now trying to run into a firing hyperblaster
	// is very jerky since you are predicted 'against' the shots.
	VectorCopy (start, bolt->s.origin);
	VectorCopy (start, bolt->s.old_origin);
	vectoangles (dir, bolt->s.angles);
	VectorScale (dir, speed, bolt->velocity);
	bolt->movetype = MOVETYPE_FLYMISSILE;
	bolt->clipmask = MASK_SHOT;
	bolt->solid = SOLID_BBOX;
	bolt->s.effects |= effect;
	VectorClear (bolt->mins);
	VectorClear (bolt->maxs);
	bolt->s.modelindex = gi.modelindex ("models/objects/laser/tris.md2");
	bolt->s.sound = gi.soundindex ("misc/lasfly.wav");
	bolt->owner = self;
	bolt->touch = blaster_touch;
	bolt->nextthink = level.time + 2;
	bolt->think = G_FreeEdict;
	bolt->dmg = damage;
	bolt->classname = "bolt";
	if (hyper)
		bolt->spawnflags = 1;
	gi.linkentity (bolt);

	if (self->client)
		check_dodge (self, bolt->s.origin, dir, speed);

	tr = gi.trace (self->s.origin, NULL, NULL, bolt->s.origin, bolt, MASK_SHOT);
	if (tr.fraction < 1.0)
	{
		VectorMA (bolt->s.origin, -10, dir, bolt->s.origin);
		bolt->touch (bolt, tr.ent, NULL, NULL);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movq -0x18(%rbp), %rdi
callq 0x183d0
callq 0x19950
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl $0x2, 0xc8(%rax)
movq -0x10(%rbp), %rax
movss (%rax), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x4(%rax)
movq -0x10(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x8(%rax)
movq -0x10(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0xc(%rax)
movq -0x10(%rbp), %rax
movss (%rax), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x1c(%rax)
movq -0x10(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x20(%rax)
movq -0x10(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x24(%rax)
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x10, %rsi
callq 0x192a0
movq -0x18(%rbp), %rdi
cvtsi2ssl -0x20(%rbp), %xmm0
movq -0x30(%rbp), %rsi
addq $0x1c0, %rsi            # imm = 0x1C0
callq 0x18a80
movq -0x30(%rbp), %rax
movl $0x8, 0x118(%rax)
movq -0x30(%rbp), %rax
movl $0x6000003, 0x10c(%rax) # imm = 0x6000003
movq -0x30(%rbp), %rax
movl $0x2, 0x108(%rax)
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %rax
orl 0x40(%rax), %ecx
movl %ecx, 0x40(%rax)
movq -0x30(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xd4(%rax)
movq -0x30(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xd0(%rax)
movq -0x30(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xcc(%rax)
movq -0x30(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xe0(%rax)
movq -0x30(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xdc(%rax)
movq -0x30(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xd8(%rax)
leaq 0x23bef(%rip), %rdi     # 0x76260
movq 0x2ff88(%rip), %rax     # 0x82600
callq *0x40(%rax)
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x28(%rax)
leaq 0x2109c(%rip), %rdi     # 0x73727
movq 0x2ff6e(%rip), %rax     # 0x82600
callq *0x48(%rax)
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x4c(%rax)
movq -0x8(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x110(%rax)
movq -0x30(%rbp), %rax
movq 0x304a8(%rip), %rcx     # 0x82b60
movq %rcx, 0x220(%rax)
movss 0x1d821(%rip), %xmm0    # 0x6fee8
movq 0x306d2(%rip), %rax     # 0x82da0
addss 0x4(%rax), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x200(%rax)
movq -0x30(%rbp), %rax
movq 0x2fd46(%rip), %rcx     # 0x82430
movq %rcx, 0x210(%rax)
movl -0x1c(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x280(%rax)
movq -0x30(%rbp), %rax
leaq 0x23b75(%rip), %rcx     # 0x7627e
movq %rcx, 0x138(%rax)
cmpl $0x0, 0x10(%rbp)
je 0x52724
movq -0x30(%rbp), %rax
movl $0x1, 0x140(%rax)
movq 0x2fed5(%rip), %rax     # 0x82600
movq 0x90(%rax), %rax
movq -0x30(%rbp), %rdi
callq *%rax
movq -0x8(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x5275b
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x4, %rsi
movq -0x18(%rbp), %rdx
movl -0x20(%rbp), %ecx
callq 0x52800
movq 0x2fe9e(%rip), %rax     # 0x82600
movq 0x60(%rax), %rax
movq -0x8(%rbp), %rsi
addq $0x4, %rsi
movq -0x30(%rbp), %r8
addq $0x4, %r8
movq -0x30(%rbp), %r9
leaq -0xc0(%rbp), %rdi
xorl %ecx, %ecx
movq %rcx, %rdx
movl $0x6000003, (%rsp)      # imm = 0x6000003
callq *%rax
leaq -0x78(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
movl $0x48, %edx
callq 0x18dc0
movss -0x70(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x1d78b(%rip), %xmm0    # 0x6ff40
ucomisd %xmm1, %xmm0
jbe 0x527f6
movq -0x30(%rbp), %rdi
addq $0x4, %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
addq $0x4, %rdx
movss 0x23a71(%rip), %xmm0    # 0x76248
callq 0x199c0
movq -0x30(%rbp), %rax
movq 0x220(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
xorl %ecx, %ecx
movq %rcx, %rdx
callq *%rax
addq $0xd0, %rsp
popq %rbp
retq
nop