// File: /workspace/github_cpp_makefile_star2_O3/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 0x2a317(%rip), %r15     # 0x45f00
leaq (%r15,%rax,8), %r13
movb $0x1, %r14b
cmpq %r13, (%r13)
je 0x1be58
movl %edi, -0x30(%rbp)
cmpl $0x1, %edi
jne 0x1bc3a
cmpl $0x3, 0x2861b(%rip)     # 0x44224
jne 0x1bc3a
movzwl 0x2987d(%rip), %r12d    # 0x45490
callq 0x1aeaa
movzwl 0x29871(%rip), %eax     # 0x45490
testw %ax, %ax
je 0x1be6a
cmpw %ax, %r12w
je 0x1bc3a
leaq 0x2748b(%rip), %rdi     # 0x430c0
callq 0x19e31
movq %r13, -0x40(%rbp)
movq 0x8(%r13), %rbx
movq 0x2901f(%rip), %rax     # 0x44c68
movswl (%rax), %edi
callq 0x22918
movq %rbx, -0x38(%rbp)
movq 0x10(%rbx), %rax
movl 0x18(%rax), %eax
leaq -0x2c(%rbp), %rdi
movl %eax, (%rdi)
callq 0x22925
leaq 0x27452(%rip), %rdx     # 0x430c0
movq (%rdx), %r14
cmpq %rdx, %r14
movl -0x30(%rbp), %eax
je 0x1be4c
xorl %r13d, %r13d
leaq -0x70(%rbp), %r15
leaq 0x23f9d(%rip), %rcx     # 0x3fc28
addq $0x10, %rcx
movq %rcx, -0x48(%rbp)
cmpl %eax, 0xbc(%r14)
jne 0x1be40
leaq 0x10(%r14), %rbx
movq %rbx, %rdi
callq 0x12496
testb %al, %al
jne 0x1be36
movq 0x28fad(%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 %edx, %esi
andl $0x641, %esi            # imm = 0x641
cmpl $0x1, %esi
je 0x1bcf9
movq %r15, %rdi
callq 0x2294e
movl -0x70(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq %r15, %rdi
callq 0x2b7a6
jmp 0x1bcb4
orl $0x40, %edx
movw %dx, (%rcx,%rax,4)
movq %r15, %rdi
leaq -0x2c(%rbp), %rsi
movq %r14, %rdx
callq 0x21e72
movl $0x38, %edi
callq 0x43e0
leaq -0x68(%rbp), %rsi
movl (%rsi), %ecx
movl 0x3(%rsi), %edx
movl %edx, 0x1b(%rax)
movl %ecx, 0x18(%rax)
movq -0x60(%rbp), %rcx
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rcx
movq %rcx, 0x10(%rax)
movzwl 0x18(%rsi), %ecx
movw %cx, 0x30(%rax)
movq 0x10(%rsi), %rcx
movq %rcx, 0x28(%rax)
movq %rax, %rdi
leaq 0x2a18e(%rip), %r12     # 0x45ee0
movq %r12, %rsi
callq 0x4060
incq 0x10(%r12)
movq %r15, %rdi
callq 0x21cfc
movq 0x8(%r12), %rax
addq $0x10, %rax
movq %rax, 0x148(%r14)
movq 0xd0(%r14), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x1eb62
movq 0x28eda(%rip), %rdi     # 0x44c68
leaq -0x2c(%rbp), %rsi
callq 0x172ce
movl %eax, 0x16c(%r14)
movq %r14, %rdi
movq %r14, %rsi
callq 0x1c4fa
leaq 0xe8(%r14), %rdi
callq 0x1d668
movq %rbx, %rdi
callq 0x124b2
movq 0xd0(%r14), %rax
movb 0x15a(%r14), %cl
movb %cl, (%rax)
movq %rbx, %rdi
callq 0x12508
movq %r14, %rdi
callq 0x1c187
incb %r13b
cmpb $0x9, %r13b
je 0x1bdfe
movq %r15, %rdi
callq 0x2294e
movl -0x70(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq %r15, %rdi
callq 0x2b7a6
jmp 0x1be36
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq (%rax), %rcx
cmoveq %rax, %rcx
movq 0x8(%rcx), %rcx
movq %rcx, -0x38(%rbp)
movq 0x10(%rcx), %rax
movl 0x18(%rax), %eax
movl %eax, -0x70(%rbp)
movl %eax, -0x2c(%rbp)
movq %r15, %rdi
callq 0x2b7a6
leaq -0x2c(%rbp), %rdi
callq 0x22925
xorl %r13d, %r13d
leaq 0x27283(%rip), %rdx     # 0x430c0
movl -0x30(%rbp), %eax
movq (%r14), %r14
cmpq %rdx, %r14
jne 0x1bc93
leaq -0x2c(%rbp), %rdi
callq 0x2b7a6
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x18, %r15
movq %r15, %rdi
callq 0x1d79a
jmp 0x1be58
jmp 0x1be8e
jmp 0x1be8e
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x21cfc
jmp 0x1be91
jmp 0x1be8e
jmp 0x1be8e
movq %rax, %rbx
leaq -0x2c(%rbp), %rdi
callq 0x2b7a6
movq %rbx, %rdi
callq 0x4740