// File: lotuskip[P]yuxtapa/server/chores.cpp
// Function: (anonymous namespace)::fireball_trigger(Coords const&, std::_List_iterator<Player>, bool)
void fireball_trigger(const Coords &pos, const list<Player>::iterator triggerer,
	const bool intentional)
{
	Coords c;
	list<PCEnt>::iterator pc_it;
	char ch;
	string msg;
	for(c.x = min(pos.x+2, Game::curmap->get_size()-2); c.x >= max(1, pos.x-2); --(c.x))
	{
		for(c.y = min(pos.y+2, Game::curmap->get_size()-2); c.y >= max(1, pos.y-2); --(c.y))
		{
			add_sound(c, S_BOOM);
			if((c == pos /* occupied-flag might not be set for the triggerer yet;
				we check this point unnecessarily when triggering with an arrow. */
				|| (Game::curmap->get_tile(c).flags & TF_OCCUPIED))
				&& (pc_it = any_pc_at(c)) != PCs.end())
			{
				// damage is (3-radius)d6:
				for(ch = 3 - pos.dist_walk(c); ch > 0; --ch)
					pc_it->get_owner()->cl_props.hp -= 1 + random()%6;
				if(pc_it->get_owner()->cl_props.hp <= 0) // died
				{
					if(pc_it->get_owner() == triggerer)
						player_death(triggerer, " fried to a trap.", false);
					else
					{
						msg = " was taken to the flames by ";
						if(pc_it->get_owner()->team == triggerer->team)
						{
							msg += teammate_str;
							if(intentional)
								triggerer->stats_i->tks++;
						}
						else
							record_kill(pc_it->get_owner(), WTK_FIREB);
						msg += triggerer->nick + '.';
						player_death(pc_it->get_owner(), msg, false);
					}
				}
				else // survived
				{
					pc_it->get_owner()->needs_state_upd = true;
					// light torch if any:
					if(!pc_it->torch_is_lit() && pc_it->get_owner()->torch_left)
						pc_it->toggle_torch();
				}
			}
		}
	}
	fball_centers.push_back(pos);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movb %dl, %al
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
leaq -0x16(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x60430
leaq -0x20(%rbp), %rdi
callq 0x4a640
leaq -0x48(%rbp), %rdi
callq 0x5770
movq -0x10(%rbp), %rax
movswl (%rax), %eax
addl $0x2, %eax
movl %eax, -0x4c(%rbp)
leaq 0x3a55b(%rip), %rax     # 0x91dd8
movq (%rax), %rdi
callq 0x3c930
cwtl
addl $-0x2, %eax
movl %eax, -0x50(%rbp)
leaq -0x4c(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2eb70
movq %rax, -0x120(%rbp)
jmp 0x578a2
movq -0x120(%rbp), %rax
movl (%rax), %eax
movw %ax, -0x16(%rbp)
movswl -0x16(%rbp), %eax
movl %eax, -0x124(%rbp)
movl $0x1, -0x60(%rbp)
movq -0x10(%rbp), %rax
movswl (%rax), %eax
subl $0x2, %eax
movl %eax, -0x64(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x64(%rbp), %rsi
callq 0x2eb30
movq %rax, %rcx
movl -0x124(%rbp), %eax
cmpl (%rcx), %eax
jl 0x57e01
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %eax
addl $0x2, %eax
movl %eax, -0x68(%rbp)
leaq 0x3a4d8(%rip), %rax     # 0x91dd8
movq (%rax), %rdi
callq 0x3c930
cwtl
addl $-0x2, %eax
movl %eax, -0x6c(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x6c(%rbp), %rsi
callq 0x2eb70
movq %rax, -0x130(%rbp)
jmp 0x57925
movq -0x130(%rbp), %rax
movl (%rax), %eax
movw %ax, -0x14(%rbp)
movswl -0x14(%rbp), %eax
movl %eax, -0x134(%rbp)
movl $0x1, -0x70(%rbp)
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %eax
subl $0x2, %eax
movl %eax, -0x74(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x74(%rbp), %rsi
callq 0x2eb30
movq %rax, %rcx
movl -0x134(%rbp), %eax
cmpl (%rcx), %eax
jl 0x57dee
leaq -0x16(%rbp), %rdi
movl $0x2, %esi
callq 0x48080
jmp 0x5797f
movq -0x10(%rbp), %rsi
leaq -0x16(%rbp), %rdi
callq 0x60860
movb %al, -0x135(%rbp)
jmp 0x57994
movb -0x135(%rbp), %al
testb $0x1, %al
jne 0x579ca
jmp 0x579a0
leaq 0x3a431(%rip), %rax     # 0x91dd8
movq (%rax), %rdi
leaq -0x16(%rbp), %rsi
callq 0x3dcd0
movl %eax, -0x78(%rbp)
movzwl -0x78(%rbp), %ecx
andl $0x40, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x136(%rbp)
je 0x57a18
leaq -0x16(%rbp), %rdi
callq 0x49290
movq %rax, -0x140(%rbp)
jmp 0x579dc
movq -0x140(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x3b65a(%rip), %rdi     # 0x93050
callq 0x3d010
movq %rax, -0x88(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x3cfe0
movb %al, -0x136(%rbp)
movb -0x136(%rbp), %al
testb $0x1, %al
jne 0x57a27
jmp 0x57ddb
movq -0x10(%rbp), %rdi
leaq -0x16(%rbp), %rsi
callq 0x604f0
movw %ax, -0x142(%rbp)
jmp 0x57a3d
movw -0x142(%rbp), %ax
movswl %ax, %ecx
movl $0x3, %eax
subl %ecx, %eax
movb %al, -0x21(%rbp)
movsbl -0x21(%rbp), %eax
cmpl $0x0, %eax
jle 0x57acb
callq 0x5270
movl $0x6, %ecx
cqto
idivq %rcx
addq $0x1, %rdx
movq %rdx, -0x150(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x3d040
movq %rax, %rdi
callq 0x3d0f0
movq %rax, -0x90(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x1b050
movq -0x150(%rbp), %rdx
movsbq 0x143(%rax), %rcx
subq %rdx, %rcx
movb %cl, 0x143(%rax)
movb -0x21(%rbp), %al
addb $-0x1, %al
movb %al, -0x21(%rbp)
jmp 0x57a51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x57e2e
leaq -0x20(%rbp), %rdi
callq 0x3d040
movq %rax, %rdi
callq 0x3d0f0
movq %rax, -0x98(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x1b050
movsbl 0x143(%rax), %eax
cmpl $0x0, %eax
jg 0x57d36
leaq -0x20(%rbp), %rdi
callq 0x3d040
movq %rax, %rdi
callq 0x3d0f0
movq %rax, -0xa0(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0x8(%rbp), %rsi
callq 0x3d990
testb $0x1, %al
jne 0x57b30
jmp 0x57bd5
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x5930
movq -0x158(%rbp), %rdx
leaq 0x14aa3(%rip), %rsi     # 0x6c5ff
leaq -0xc8(%rbp), %rdi
callq 0x18880
jmp 0x57b6a
movq -0xa8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
xorl %edx, %edx
callq 0x517d0
jmp 0x57b81
leaq -0xc8(%rbp), %rdi
callq 0x5a48
leaq -0xc9(%rbp), %rdi
callq 0x5590
jmp 0x57d31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x57bc4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x5a48
leaq -0xc9(%rbp), %rdi
callq 0x5590
jmp 0x57e2e
leaq 0x14a35(%rip), %rsi     # 0x6c611
leaq -0x48(%rbp), %rdi
callq 0x5760
jmp 0x57be7
leaq -0x20(%rbp), %rdi
callq 0x3d040
movq %rax, %rdi
callq 0x3d0f0
movq %rax, -0xd8(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x1b050
movl 0xac(%rax), %eax
movl %eax, -0x15c(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq %rax, %rcx
movl -0x15c(%rbp), %eax
cmpl 0xac(%rcx), %eax
jne 0x57c75
leaq 0x3c490(%rip), %rsi     # 0x940c8
leaq -0x48(%rbp), %rdi
callq 0x56e0
jmp 0x57c43
testb $0x1, -0x11(%rbp)
je 0x57c73
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq %rax, %rdi
addq $0x80, %rdi
callq 0x1b390
movq 0x90(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x90(%rax)
jmp 0x57ca2
leaq -0x20(%rbp), %rdi
callq 0x3d040
movq %rax, %rdi
callq 0x3d0f0
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rdi
movl $0x5, %esi
callq 0x51b40
jmp 0x57ca0
jmp 0x57ca2
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq %rax, %rsi
addq $0x88, %rsi
leaq -0x100(%rbp), %rdi
movl $0x2e, %edx
callq 0x1fc80
jmp 0x57cc8
leaq -0x48(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x56e0
jmp 0x57cda
leaq -0x100(%rbp), %rdi
callq 0x5a48
leaq -0x20(%rbp), %rdi
callq 0x3d040
movq %rax, %rdi
callq 0x3d0f0
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rdi
leaq -0x48(%rbp), %rsi
xorl %edx, %edx
callq 0x517d0
jmp 0x57d12
jmp 0x57d31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x5a48
jmp 0x57e2e
jmp 0x57dd9
leaq -0x20(%rbp), %rdi
callq 0x3d040
movq %rax, %rdi
callq 0x3d0f0
movq %rax, -0x110(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x1b050
movb $0x1, 0x14d(%rax)
leaq -0x20(%rbp), %rdi
callq 0x3d040
movq %rax, %rdi
callq 0x3d0d0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x15d(%rbp)
jne 0x57db6
leaq -0x20(%rbp), %rdi
callq 0x3d040
movq %rax, %rdi
callq 0x3d0f0
movq %rax, -0x118(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x1b050
cmpw $0x0, 0x160(%rax)
setne %al
movb %al, -0x15d(%rbp)
movb -0x15d(%rbp), %al
testb $0x1, %al
jne 0x57dc2
jmp 0x57dd7
leaq -0x20(%rbp), %rdi
callq 0x3d040
movq %rax, %rdi
callq 0x4da90
jmp 0x57dd5
jmp 0x57dd7
jmp 0x57dd9
jmp 0x57ddb
jmp 0x57ddd
movw -0x14(%rbp), %ax
addw $-0x1, %ax
movw %ax, -0x14(%rbp)
jmp 0x57932
jmp 0x57df0
movw -0x16(%rbp), %ax
addw $-0x1, %ax
movw %ax, -0x16(%rbp)
jmp 0x578af
movq -0x10(%rbp), %rsi
leaq 0x3b324(%rip), %rdi     # 0x93130
callq 0x588a0
jmp 0x57e13
leaq -0x48(%rbp), %rdi
callq 0x5a48
leaq -0x16(%rbp), %rdi
callq 0x60460
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x5a48
leaq -0x16(%rbp), %rdi
callq 0x60460
movq -0x58(%rbp), %rdi
callq 0x5920
nopl (%rax)