// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/g_runes.c
// Function: SpawnRune
void SpawnRune (int type)
{
	edict_t		*ent, *spot; 
	char *name = NULL, *model = NULL; //MJD Uninitialized
	int effects = 0, renderfx = 0;    //MJD Uninitialized
	
	
	//	if (!deathmatch->value)
	//		return;
	//surt single player runes support
	
	spot = SelectFarthestRuneSpawnPoint();
	if (!spot)
		spot = redflag;
	
	if (spot)
	{
		switch (type)
		{
		case RUNE_DAMAGE:
			name = "damage_rune";
			effects = 0; //EF_COLOR_SHELL;
			renderfx = 0; //RF_SHELL_RED;
			model = "models/ctf/damage/tris.md2";
			break;
			
		case RUNE_HASTE:
			name = "haste_rune";
			effects = 0;//EF_COLOR_SHELL;
			renderfx = 0;//RF_SHELL_BLUE;
			model = "models/ctf/haste/tris.md2";
			break;
			
		case RUNE_RESIST:
			name = "resist_rune";
			effects = 0;//EF_COLOR_SHELL;
			renderfx = 0;//RF_SHELL_RED | RF_SHELL_BLUE;
			model = "models/ctf/resist/tris.md2";
			break;
			
		case RUNE_REGEN:
			name = "regen_rune";
			effects = 0;//EF_COLOR_SHELL;
			renderfx = 0;//RF_SHELL_GREEN;
			model = "models/ctf/regen/tris.md2";
			break;
			
		case RUNE_VAMP:                                   //added by Vampire
			name = "vampire_rune";
			//effects = EF_TELEPORTER | EF_ANIM01;//EF_COLOR_SHELL;
			effects = EF_ANIM01;//EF_COLOR_SHELL;
			renderfx = RF_SHELL_RED;
			model = "models/ctf/resist/tris.md2";
			break;
			
		default:
			gi.dprintf("Bad rune model selected.\n");
			break;  // MJD If we hit this line, then name,
			// effects, renderfx, and model would
			// stay uninitialized, which would be
			// a bad thing, I think.
		}
		
		ent = G_Spawn();
		ent->classname = ED_NewString (name);
		ED_CallSpawn(ent);
		
		VectorCopy (spot->s.origin, ent->s.origin);
		ent->takedamage = DAMAGE_NO; //no damage on runes
		ent->dontfree = 1;
		gi.soundindex ("items/m_health.wav");
		ent->s.effects |= effects;
		ent->s.renderfx |= renderfx;
		ent->model = model;
		ent->runetype = type; // We store our rune type here
		tossrune(ent, 0);
		//		gi.dprintf("Spawned rune.\n");
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
callq 0x18430
movq %rax, %r14
testq %rax, %rax
jne 0x1faa3
movq 0x48d58(%rip), %rax     # 0x687f8
movq (%rax), %r14
testq %r14, %r14
je 0x1fad2
leal -0x1(%rbx), %eax
cmpl $0x7, %eax
ja 0x1fae1
xorl %ebp, %ebp
leaq 0x33817(%rip), %rcx     # 0x532d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x33882(%rip), %r13     # 0x5334b
leaq 0x33840(%rip), %r15     # 0x53310
jmp 0x1fb46
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x10, %ebx
jne 0x1fafb
movl $0x400, %ebp            # imm = 0x400
leaq 0x3388e(%rip), %r13     # 0x53380
leaq 0x33845(%rip), %r15     # 0x5333e
jmp 0x1fb46
movq 0x48afe(%rip), %rcx     # 0x68600
leaq 0x338ac(%rip), %rdi     # 0x533b5
xorl %r15d, %r15d
xorl %eax, %eax
callq *0x8(%rcx)
xorl %r13d, %r13d
xorl %ebp, %ebp
jmp 0x1fb46
leaq 0x33847(%rip), %r13     # 0x53366
leaq 0x337f6(%rip), %r15     # 0x5331c
jmp 0x1fb46
leaq 0x3386c(%rip), %r13     # 0x5339b
leaq 0x337fd(%rip), %r15     # 0x53333
jmp 0x1fb46
leaq 0x33841(%rip), %r13     # 0x53380
leaq 0x337e1(%rip), %r15     # 0x53327
callq 0x19700
movq %rax, %r12
movq %r15, %rdi
callq 0x18260
movq %rax, 0x138(%r12)
movq %r12, %rdi
callq 0x19310
movss 0x4(%r14), %xmm0
movss %xmm0, 0x4(%r12)
movss 0x8(%r14), %xmm0
movss %xmm0, 0x8(%r12)
movss 0xc(%r14), %xmm0
movss %xmm0, 0xc(%r12)
movl $0x0, 0x27c(%r12)
movl $0x1, 0x49c(%r12)
movq 0x48a54(%rip), %rax     # 0x68600
leaq 0x374cc(%rip), %rdi     # 0x5707f
callq *0x48(%rax)
movq 0x40(%r12), %xmm0
movd %ebp, %xmm1
pshufd $0x50, %xmm1, %xmm1     # xmm1 = xmm1[0,0,1,1]
por %xmm0, %xmm1
movq %xmm1, 0x40(%r12)
movq %r13, 0x120(%r12)
movl %ebx, 0x478(%r12)
movq %r12, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1f86d