// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
callq 0x18470
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x20b67
movq 0x61c98(%rip), %rax     # 0x827f8
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x20d40
movl -0x4(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0xf, %eax
ja 0x20c5e
movq -0x38(%rbp), %rax
leaq 0x4f767(%rip), %rcx     # 0x702f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x4f797(%rip), %rax     # 0x70338
movq %rax, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
leaq 0x4f7b9(%rip), %rax     # 0x70373
movq %rax, -0x28(%rbp)
jmp 0x20c71
leaq 0x4f77a(%rip), %rax     # 0x70344
movq %rax, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
leaq 0x4f7ab(%rip), %rax     # 0x7038e
movq %rax, -0x28(%rbp)
jmp 0x20c71
leaq 0x4f75c(%rip), %rax     # 0x7034f
movq %rax, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
leaq 0x4f79c(%rip), %rax     # 0x703a8
movq %rax, -0x28(%rbp)
jmp 0x20c71
leaq 0x4f742(%rip), %rax     # 0x7035b
movq %rax, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
leaq 0x4f791(%rip), %rax     # 0x703c3
movq %rax, -0x28(%rbp)
jmp 0x20c71
leaq 0x4f727(%rip), %rax     # 0x70366
movq %rax, -0x20(%rbp)
movl $0x400, -0x2c(%rbp)     # imm = 0x400
movl $0x400, -0x30(%rbp)     # imm = 0x400
leaq 0x4f750(%rip), %rax     # 0x703a8
movq %rax, -0x28(%rbp)
jmp 0x20c71
leaq 0x4f778(%rip), %rdi     # 0x703dd
movq 0x61994(%rip), %rcx     # 0x82600
movb $0x0, %al
callq *0x8(%rcx)
callq 0x19950
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rdi
callq 0x18280
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x138(%rax)
movq -0x10(%rbp), %rdi
callq 0x19520
movq -0x18(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x4(%rax)
movq -0x18(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x8(%rax)
movq -0x18(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0xc(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x27c(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x49c(%rax)
leaq 0x53220(%rip), %rdi     # 0x73f13
movq 0x61906(%rip), %rax     # 0x82600
callq *0x48(%rax)
movl -0x2c(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0x40(%rax), %ecx
movl %ecx, 0x40(%rax)
movl -0x30(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0x44(%rax), %ecx
movl %ecx, 0x44(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x120(%rax)
movl -0x4(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x478(%rax)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x20710
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)