// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_main.c
// Function: EndDMLevel
void EndDMLevel (void)
{
edict_t		*ent;
int map_count = 0;


	if((matchstate != MATCH_RAILGUN_OVER) && (railtime->value > 0))
	{
		Set_Mode_Railgun_Shootout();
		return;
	}

	KillMatch();
	Write_Highscore_Table();


	// stay on same level flag
	if ((int)dmflags->value & DF_SAME_LEVEL)
	{
		BeginIntermission (CreateTargetChangeLevel (level.mapname) );
		return;
	}

	// CTF CODE -- LM_JORM
	else if (maplistindex != -2) // -2 means no list
	{	// go to a specific map
		ent = G_Spawn ();
		ent->classname = "target_changelevel";
		
		//bat
		while(Maps_Picked[maplistindex] == Last_Map)
		{
			if(maplistindex > -1 && !maplist[maplistindex].mapname) // Did we reach the end of the list?
				maplistindex = 0;

			maplistindex++;

			//if all the maps are the same, this is a precaution.
			if(map_count++ > 30)
				break;
		}

		if((int)ctfflags->value & CTF_RANDOM_MAPS)
		{
			MapInfo *map = getRandomMapByPlayerCount(playerCount());
			ent->map = map->mapname;
			gi.dprintf("Map :  %s\n",  map->mapname);
		}
		else
		{
			ent->map = maplist[maplistindex].mapname;
			gi.dprintf("Map #%d:  %s\n", maplistindex+1, maplist[maplistindex].mapname);
		}

		maplistindex++; 
	}
	// END CTF CODE -- LM_JORM

	else if (level.nextmap[0])
	{	// go to a specific map
		ent = G_Spawn ();
		ent->classname = "target_changelevel";
		ent->map = level.nextmap;
	}
	else
	{	// search for a changeleve
		ent = G_Find (NULL, FOFS(classname), "target_changelevel");
		if (!ent)
		{	// the map designer didn't include a changelevel,
			// so create a fake ent that goes back to the same level
			ent = G_Spawn ();
			ent->classname = "target_changelevel";
			ent->map = level.mapname;
		}
	}
	

	BeginIntermission (ent);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0xc(%rbp)
movq 0x44112(%rip), %rax     # 0x827d8
cmpl $0x7, (%rax)
je 0x3e6ec
movq 0x43f7e(%rip), %rax     # 0x82650
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x3e6ec
callq 0x18a30
jmp 0x3e960
movb $0x0, %al
callq 0x180d0
callq 0x19c60
movq 0x43f19(%rip), %rax     # 0x82618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x3e72c
movq 0x4468a(%rip), %rdi     # 0x82da0
addq $0x48, %rdi
callq 0x199b0
movq %rax, %rdi
callq 0x18fd0
jmp 0x3e960
movq 0x446a5(%rip), %rax     # 0x82dd8
cmpl $-0x2, (%rax)
je 0x3e8b4
callq 0x19950
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
leaq 0x31e12(%rip), %rcx     # 0x70562
movq %rcx, 0x138(%rax)
movq 0x4467a(%rip), %rax     # 0x82dd8
movslq (%rax), %rcx
movq 0x446d0(%rip), %rax     # 0x82e38
movswl (%rax,%rcx,2), %eax
movq 0x441a5(%rip), %rcx     # 0x82918
movswl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x3e7dd
movq 0x44657(%rip), %rax     # 0x82dd8
cmpl $-0x1, (%rax)
jle 0x3e7b1
movq 0x4464b(%rip), %rax     # 0x82dd8
movslq (%rax), %rcx
movq 0x44031(%rip), %rax     # 0x827c8
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
jne 0x3e7b1
movq 0x4462d(%rip), %rax     # 0x82dd8
movl $0x0, (%rax)
movq 0x44620(%rip), %rax     # 0x82dd8
movl (%rax), %ecx
addl $0x1, %ecx
movq 0x44614(%rip), %rax     # 0x82dd8
movl %ecx, (%rax)
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc(%rbp)
cmpl $0x1e, %eax
jle 0x3e7d8
jmp 0x3e7dd
jmp 0x3e757
movq 0x44374(%rip), %rax     # 0x82b58
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x3e837
callq 0x19670
movl %eax, %edi
callq 0x18710
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x270(%rax)
movq 0x43de1(%rip), %rax     # 0x82600
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq (%rax), %rsi
leaq 0x35955(%rip), %rdi     # 0x74186
movb $0x0, %al
callq *%rcx
jmp 0x3e89a
movq 0x4459a(%rip), %rax     # 0x82dd8
movslq (%rax), %rcx
movq 0x43f80(%rip), %rax     # 0x827c8
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x270(%rax)
movq 0x43d9c(%rip), %rax     # 0x82600
movq 0x8(%rax), %rcx
movq 0x44569(%rip), %rax     # 0x82dd8
movl (%rax), %esi
addl $0x1, %esi
movq 0x4455d(%rip), %rax     # 0x82dd8
movslq (%rax), %rdx
movq 0x43f43(%rip), %rax     # 0x827c8
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq (%rax), %rdx
leaq 0x358bc(%rip), %rdi     # 0x74152
movb $0x0, %al
callq *%rcx
movq 0x44537(%rip), %rax     # 0x82dd8
movl (%rax), %ecx
addl $0x1, %ecx
movq 0x4452b(%rip), %rax     # 0x82dd8
movl %ecx, (%rax)
jmp 0x3e955
movq 0x444e5(%rip), %rax     # 0x82da0
cmpb $0x0, 0x88(%rax)
je 0x3e8fa
callq 0x19950
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
leaq 0x31c8a(%rip), %rcx     # 0x70562
movq %rcx, 0x138(%rax)
movq -0x8(%rbp), %rax
movq 0x444b6(%rip), %rcx     # 0x82da0
addq $0x88, %rcx
movq %rcx, 0x270(%rax)
jmp 0x3e953
xorl %eax, %eax
movl %eax, %edi
movq %rdi, %rax
addq $0x138, %rax            # imm = 0x138
movl %eax, %esi
leaq 0x31c52(%rip), %rdx     # 0x70562
callq 0x19660
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x3e951
callq 0x19950
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
leaq 0x31c2e(%rip), %rcx     # 0x70562
movq %rcx, 0x138(%rax)
movq -0x8(%rbp), %rax
movq 0x4445a(%rip), %rcx     # 0x82da0
addq $0x48, %rcx
movq %rcx, 0x270(%rax)
jmp 0x3e953
jmp 0x3e955
jmp 0x3e957
movq -0x8(%rbp), %rdi
callq 0x18fd0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)