// File: /workspace/github_cpp_makefile_star2_O2/lotuskip[P]yuxtapa/server/actives.cpp
// Function: (anonymous namespace)::add_noccent(Coords const&, e_Noccent, short)
void add_noccent(const Coords &c, const e_Noccent type, const short m = 0)
{
	noccents[type].push_back(NOccEnt(c, noccent_symbol[type-1],
		noccent_cpair[type-1], m));
	Tile* tp = Game::curmap->mod_tile(c);
	// A non-occupying entity can be placed in almost any square, but we should
	// ensure that that square won't have "hidden effects":
	if(tp->symbol != '.') // Some "special" tile; replace with ever-safe floor:
		*tp = T_FLOOR;
	tp->flags |= TF_NOCCENT;

	// Special things when placing flags:
	if(type == NOE_FLAG)
	{
		if(m != T_NO_TEAM)
		{
			noccents[NOE_FLAG].back().set_col(team_colour[m]);
			team_flags[m].push_back(--(noccents[NOE_FLAG].end()));
		}
		// The surroundings of a flag should be open enough:
		e_Dir d = D_N;
		char obss = 0; // 'obstructions', unpassable or water or chasm
		do {
			tp = Game::curmap->mod_tile(c.in(d));
			if(!(tp->flags & TF_WALKTHRU) || (tp->flags & (TF_KILLS|TF_DROWNS)))
				++obss;
			++d;
		} while(d != D_N);
		if(obss > 3) // too many!
		{
			// Replace them all with floor:
			d = D_N;
			Coords cn;
			short msize = Game::curmap->get_size();
			do {
				cn = c.in(d);
				// Do not replace outer wall, though:
				if(cn.x > 1 && cn.y > 1 && cn.x < msize-1 && cn.y < msize-1)
					*(Game::curmap->mod_tile(cn)) = T_FLOOR;
				++d;
			} while(d != D_N);
			// Need to update BY_WALL for neighbours of all cns:
			for(cn.y = max(1, c.y-2); cn.y <= min(msize-2, c.y+2); ++cn.y)
			{
				for(cn.x = max(1, c.x-2); cn.x <= min(msize-2, c.x+2); ++cn.x)
					Game::curmap->upd_by_wall_flag(cn);
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
movl %esi, %eax
imulq $0x18, %rax, %rax
leaq 0x27f4b(%rip), %r12     # 0x42db0
addq %rax, %r12
leal -0x1(%r15), %eax
leaq 0x1031d(%rip), %rcx     # 0x2b190
movsbl (%rax,%rcx), %edx
leaq 0x10318(%rip), %rcx     # 0x2b196
movsbl (%rax,%rcx), %ecx
movzbl %r14b, %r8d
leaq -0x40(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1ca04
movq %r12, %rdi
movq %r13, %rsi
callq 0x1c222
leaq -0x40(%rbp), %rdi
callq 0x1c9c8
leaq 0x26da8(%rip), %r12     # 0x41c58
movq (%r12), %rax
movswq 0x2(%rbx), %rcx
movq 0x8(%rax), %rdx
imulq $0x18, %rcx, %rcx
movswq (%rbx), %rax
movq (%rdx,%rcx), %rcx
cmpb $0x2e, 0x2(%rcx,%rax,4)
jne 0x1aed9
movzwl (%rcx,%rax,4), %edx
orl $0x20, %edx
jmp 0x1aee4
movl $0x1c2e0005, (%rcx,%rax,4) # imm = 0x1C2E0005
movw $0x25, %dx
movw %dx, (%rcx,%rax,4)
cmpl $0x5, %r15d
jne 0x1b0ce
movq %rbx, -0x50(%rbp)
cmpw $0x3, %r14w
je 0x1af2f
movq 0x27f2c(%rip), %rax     # 0x42e30
movzwl %r14w, %ecx
leaq 0x1028d(%rip), %rdx     # 0x2b19c
movb (%rcx,%rdx), %dl
movb %dl, 0x1d(%rax)
imulq $0x18, %rcx, %rcx
leaq 0x27fd0(%rip), %rdi     # 0x42ef0
addq %rcx, %rdi
leaq -0x40(%rbp), %rsi
movq %rax, (%rsi)
callq 0x1c232
leaq -0x40(%rbp), %rax
andl $0x0, (%rax)
xorl %edx, %edx
xorl %r13d, %r13d
movq (%r12), %r14
movq %r12, %rbx
leaq -0x2c(%rbp), %r12
movq %r12, %rdi
movq -0x50(%rbp), %rsi
callq 0x24e0c
movswq -0x2a(%rbp), %rax
movq 0x8(%r14), %rcx
imulq $0x18, %rax, %rax
movswq -0x2c(%rbp), %r14
movq (%rcx,%rax), %r15
movq %r12, %rdi
movq %rbx, %r12
callq 0x24d9e
movzwl (%r15,%r14,4), %eax
andl $0x601, %eax            # imm = 0x601
cmpw $0x1, %ax
setne %al
addb %al, %r13b
leaq -0x40(%rbp), %rdi
callq 0x24d4c
movl -0x40(%rbp), %edx
testl %edx, %edx
jne 0x1af3b
cmpb $0x4, %r13b
jl 0x1b0ce
leaq -0x40(%rbp), %r15
andl $0x0, (%r15)
leaq -0x2c(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x24d90
movq (%r12), %rax
movswl (%rax), %r13d
leal -0x1(%r13), %r14d
movl (%r15), %edx
leaq -0x44(%rbp), %r15
movq -0x50(%rbp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x24e0c
movl -0x44(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq %r15, %rdi
callq 0x24d9e
movswl -0x2c(%rbp), %eax
cmpl $0x2, %eax
setge %dl
movzwl -0x2a(%rbp), %ecx
cmpw $0x2, %cx
setge %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x1b03a
movzwl %cx, %ecx
cmpl %eax, %r14d
setg %dl
cmpl %ecx, %r14d
setg %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x1b03a
movq (%r12), %rdx
movl %ecx, %ecx
movq 0x8(%rdx), %rdx
imulq $0x18, %rcx, %rcx
movq (%rdx,%rcx), %rcx
movzwl %ax, %eax
movl $0x1c2e0005, (%rcx,%rax,4) # imm = 0x1C2E0005
leaq -0x40(%rbp), %rdi
callq 0x24d4c
movl -0x40(%rbp), %edx
testl %edx, %edx
jne 0x1afcd
movzwl 0x2(%rbx), %eax
cmpw $0x4, %ax
pushq $0x3
popq %r15
movl %eax, %ecx
cmovll %r15d, %ecx
addl $-0x2, %ecx
addl $-0x2, %r13d
leaq -0x2c(%rbp), %r14
movw %cx, -0x2a(%rbp)
movswl %cx, %ecx
cwtl
addl $0x2, %eax
cmpl %r13d, %eax
cmovgel %r13d, %eax
cmpl %ecx, %eax
jl 0x1b0c5
movzwl (%rbx), %eax
cmpw $0x4, %ax
movl %eax, %ecx
cmovll %r15d, %ecx
addl $-0x2, %ecx
movw %cx, -0x2c(%rbp)
movswl %cx, %ecx
cwtl
addl $0x2, %eax
cmpl %r13d, %eax
cmovgel %r13d, %eax
cmpl %ecx, %eax
jl 0x1b0b9
movq (%r12), %rdi
movq %r14, %rsi
callq 0x12448
movl -0x2c(%rbp), %ecx
incl %ecx
movzwl (%rbx), %eax
jmp 0x1b08d
movzwl -0x2a(%rbp), %ecx
incl %ecx
movzwl 0x2(%rbx), %eax
jmp 0x1b067
leaq -0x2c(%rbp), %rdi
callq 0x24d9e
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x1c9c8
jmp 0x1b0fb
jmp 0x1b0ef
jmp 0x1b0ef
movq %rax, %rbx
leaq -0x2c(%rbp), %rdi
callq 0x24d9e
movq %rbx, %rdi
callq 0x4710