// File: /workspace/github_cpp_makefile_star2_O1/lotuskip[P]yuxtapa/server/game.cpp
// Function: (anonymous namespace)::spawn_team(e_Team)
bool spawn_team(const e_Team t)
{
	// If there are no flags, this means the other team has won!
	if(team_flags[t].empty())
		return true;

	// Do the check for boulder destruction:
	if(gamemode == GM_DESTR && t == T_PURPLE)
	{
		unsigned short obl = boulders_left;
		upd_num_boulders();
		if(!boulders_left)
		{
			team_flags[T_PURPLE].clear();
			return true; // Green has won!
		}
		if(obl != boulders_left) // amount changed!
			Game::send_team_upds(cur_players.end());
	}

	list<list<NOccEnt>::iterator>::const_iterator fit
		= --(team_flags[t].end());
	char spawned = 0;

	nearby_set_dim(Game::curmap->get_size());
	Coords c = (*fit)->getpos();
	init_nearby(c);

	for(list<Player>::iterator it = cur_players.begin();
		it != cur_players.end(); ++it)
	{
		// Player is to spawn if she is in this team and dead:
		if(it->team == t && !it->is_alive())
		{
			// Spawn this player around 'c';
			// For spawning, must be unoccupied & walkthru
			while(Game::curmap->get_tile(c).flags
				& (TF_OCCUPIED|TF_KILLS|TF_DROWNS)
				|| !(Game::curmap->get_tile(c).flags & TF_WALKTHRU))
				c = next_nearby();
			Game::curmap->mod_tile(c)->flags |= TF_OCCUPIED;
			PCs.push_back(PCEnt(c, it));
			it->own_pc = &(*(--PCs.end()));
			it->own_vp->set_pos(c);
			it->sector = Game::curmap->coords_in_sector(c);
			follow_change(it, it);

			it->action_queue.clear();
			it->set_class();
			it->own_vp->set_losr(it->cl_props.losr);
			it->init_torch();
			send_state_upd(it);

			// After placing 9 players, place the next 9 at the next spawn
			// place, if any:
			if(++spawned == 9)
			{
				if(fit == team_flags[t].begin())
					fit = --(team_flags[t].end());
				else
					--fit;
				c = (*fit)->getpos();
				init_nearby(c);
				spawned = 0;
			}
			else
				c = next_nearby();
		} // player in this team and dead
	} // go through players
	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edi, %eax
leaq (%rax,%rax,2), %rax
leaq 0x2a191(%rip), %r15     # 0x45f00
leaq (%r15,%rax,8), %rax
movb $0x1, %r14b
movq %rax, -0x48(%rbp)
cmpq %rax, (%rax)
je 0x1bfb6
movl %edi, %r13d
cmpl $0x1, %edi
jne 0x1bdd6
cmpl $0x3, 0x28492(%rip)     # 0x44224
jne 0x1bdd6
movzwl 0x296f4(%rip), %r12d    # 0x45490
callq 0x1b004
movzwl 0x296e8(%rip), %ebx     # 0x45490
testw %bx, %bx
je 0x1bdc1
cmpw %bx, %r12w
je 0x1bdcd
leaq 0x27306(%rip), %rdi     # 0x430c0
callq 0x19f7b
jmp 0x1bdcd
addq $0x18, %r15
movq %r15, %rdi
callq 0x1d8ba
testw %bx, %bx
je 0x1bfb6
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rbx
movq 0x28e83(%rip), %rax     # 0x44c68
movswl (%rax), %edi
callq 0x22bbc
movq %rbx, -0x40(%rbp)
movq 0x10(%rbx), %rax
movl 0x18(%rax), %eax
leaq -0x2c(%rbp), %rdi
movl %eax, (%rdi)
callq 0x22bc9
leaq 0x272b6(%rip), %rax     # 0x430c0
movq (%rax), %r14
cmpq %rax, %r14
je 0x1bfaa
movl $0x0, -0x30(%rbp)
leaq -0x70(%rbp), %r15
leaq 0x2a0b8(%rip), %rbx     # 0x45ee0
movl %r13d, -0x34(%rbp)
cmpl %r13d, 0xbc(%r14)
jne 0x1bf9e
leaq 0x10(%r14), %r13
movq %r13, %rdi
callq 0x125e6
testb %al, %al
jne 0x1bf93
movq 0x28e14(%rip), %rax     # 0x44c68
movswq -0x2a(%rbp), %rcx
movq 0x8(%rax), %rdx
leaq (%rcx,%rcx,2), %rcx
movswq -0x2c(%rbp), %rax
movq (%rdx,%rcx,8), %rcx
movl (%rcx,%rax,4), %edx
movl $0x641, %esi            # imm = 0x641
andl %esi, %edx
cmpl $0x1, %edx
je 0x1be91
movq %r15, %rdi
callq 0x22bf2
movl -0x70(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq %r15, %rdi
callq 0x2bbf6
jmp 0x1be4d
orb $0x40, (%rcx,%rax,4)
movq %r15, %rdi
leaq -0x2c(%rbp), %rsi
movq %r14, %rdx
callq 0x220e2
movq %rbx, %r12
movq %rbx, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x1d8f6
movq %r15, %rdi
callq 0x21f6c
movq 0x8(%r12), %rax
addq $0x10, %rax
movq %rax, 0x148(%r14)
movq 0xd0(%r14), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x1ecfc
movq 0x28d84(%rip), %rdi     # 0x44c68
leaq -0x2c(%rbp), %rsi
callq 0x17406
movl %eax, 0x16c(%r14)
movq %r14, %rdi
movq %r14, %rsi
callq 0x1c631
leaq 0xe8(%r14), %rdi
callq 0x1d788
movq %r13, %rdi
callq 0x12602
movq 0xd0(%r14), %rax
movb 0x15a(%r14), %cl
movb %cl, (%rax)
movq %r13, %rdi
callq 0x12658
movq %r14, %rdi
callq 0x1c2d7
movl -0x30(%rbp), %eax
incb %al
cmpb $0x9, %al
je 0x1bf57
movl %eax, -0x30(%rbp)
movq %r15, %rdi
callq 0x22bf2
movl -0x70(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq %r15, %rdi
callq 0x2bbf6
jmp 0x1bf93
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq (%rax), %rcx
cmoveq %rax, %rcx
movq 0x8(%rcx), %rcx
movq %rcx, -0x40(%rbp)
movq 0x10(%rcx), %rax
movl 0x18(%rax), %eax
movl %eax, -0x70(%rbp)
movl %eax, -0x2c(%rbp)
movq %r15, %rdi
callq 0x2bbf6
leaq -0x2c(%rbp), %rdi
callq 0x22bc9
movl $0x0, -0x30(%rbp)
movl -0x34(%rbp), %r13d
leaq 0x27122(%rip), %rax     # 0x430c0
movq (%r14), %r14
cmpq %rax, %r14
jne 0x1be2c
leaq -0x2c(%rbp), %rdi
callq 0x2bbf6
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1bfde
jmp 0x1bfde
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x21f6c
jmp 0x1bfe1
jmp 0x1bfde
jmp 0x1bfde
movq %rax, %rbx
leaq -0x2c(%rbp), %rdi
callq 0x2bbf6
movq %rbx, %rdi
callq 0x4750