// File: /workspace/github_cpp_makefile_star2_O2/lotuskip[P]yuxtapa/server/chores.cpp
// Function: progress_chore(std::_List_iterator<Player>)
void progress_chore(const list<Player>::iterator pit)
{
	Coords c;
	--(pit->doing_a_chore);
	switch(pit->cl)
	{
	case C_SCOUT: // disguise
		if(!pit->doing_a_chore) // done
		{
			c = pit->own_pc->getpos();
			list<NOccEnt>::iterator c_it = any_noccent_at(c, NOE_CORPSE);
			if(c_it != noccents[NOE_CORPSE].end()) // corpse might've been removed already
			{
				noccents[NOE_CORPSE].erase(c_it);
				Game::curmap->mod_tile(c)->flags &= ~(TF_NOCCENT);
			}
			pit->own_pc->set_disguised(true);
			string msg = "You are now disguised as the enemy.";
			Network::construct_msg(msg, C_BROWN_PC);
			Network::send_to_player(*pit);
			event_set.insert(c);
		}
		break;
	case C_FIGHTER: // circle strike 
	{
		list<Player>::iterator them;
		list<PCEnt>::const_iterator pc_it;
		c = pit->own_pc->getpos();
		Coords d;
		char die = 8, add = 0;
		// see if weapon has rusted:
		if(pit->cl_props.tohit != classes[pit->cl].tohit)
		{
			die -= RUST_MOD;
			add -= RUST_MOD;
		}
		for(char ch = 0; ch < 4; ++ch)
		{
			d = c.in(pit->facing);
			if((pc_it = any_pc_at(d)) != PCs.end())
			{
				them = pc_it->get_owner();
				if(test_hit(them, 5, 1, die, add) // was hit...
				&& them->cl_props.hp <= 0) // ...and died
				{
					string msg = " was sliced in half by ";
					if(pit->team == them->team)
					{
						msg += teammate_str;
						pit->stats_i->tks++;
					}
					else
						record_kill(pit, WTK_CIRCLE);
					player_death(them, msg + pit->nick + '.', true);
				}
			}
			else
				add_action_ind(d, A_MISS);
			++(pit->facing);
		}
		break;
	}
	case C_MINER: // mine
	{
		c = pit->own_pc->getpos().in(pit->facing);
		if(!pit->doing_a_chore) // done
		{
			// Digging is done; outcome depends on what exactly is there:
			Tile* tp = Game::curmap->mod_tile(c);
			list<OccEnt>::iterator b_it;
			if(tp->symbol == '#') // wall; dig a passage unless NODIG
			{
				if(tp->flags & TF_NODIG)
				{
					string msg = "The wall resists.";
					Network::construct_msg(msg, C_WALL_LIT);
					Network::send_to_player(*pit);
					break;
				}
				dig_open(tp);
				finish_wall_dig(c);
			}
			// windows&doors -- same thing but no NODIG check:
			else if(tp->symbol == '|' || tp->symbol == '-' || tp->symbol == '+')
			{
				dig_open(tp);
				if(tp->symbol == '+') // since doors are not seethru
					update_lights_around(c);
				event_set.insert(c);
			}
			// Destroying a boulder:
			else if(tp->flags & TF_OCCUPIED && (b_it = any_boulder_at(c)) != boulders.end())
			{
				// boulder; made this far so just destroy it:
				boulders.erase(b_it);
				tp->flags &= ~(TF_OCCUPIED);
				event_set.insert(c);
			}
			// Carving a new boulder:
			else if(tp->flags & TF_NOCCENT
				&& any_noccent_at(c, NOE_BLOCK_SOURCE) != noccents[NOE_BLOCK_SOURCE].end())
			{
				boulders.push_back(OccEnt(c, 'O', C_WALL));
				if(tp->flags & TF_OCCUPIED) // we know it's not a boulder!
				{
					list<PCEnt>::iterator pc_it = any_pc_at(c);
					if(pc_it != PCs.end())
					{
						list<Player>::iterator pit2 = pc_it->get_owner();
						string msg = " was squashed by ";
						if(pit->team == pit2->team) // note: no team kill recorded
							msg += teammate_str;
						else
							record_kill(pit, WTK_SQUASH);
						msg += pit->nick + "\'s carving frenzy.";
						player_death(pit2, msg, false);
					}
					else // may assume it's a missile
						any_missile_at(c)->makevoid(); // tile remains occupied by the boulder
				}
				tp->flags |= TF_OCCUPIED; /* Note: set in any case; if a player
					was killed, that cleared the occupied-flag! */
				event_set.insert(c);
			}
			// else it is not possible to finish for some reason
		}
		else if(cant_dig_in(c, pit->facing))
			pit->doing_a_chore = 0; // must abort
		else
			add_sound(c, S_RUMBLE);
		break;
	}
	case C_TRAPPER: // plant trap
		if(!pit->doing_a_chore) // done
		{
			c = pit->own_pc->getpos();
			string msg;
			// If there is a trap, disarm it, else plant one:
			if(Game::curmap->mod_tile(c)->flags & TF_TRAP)
			{
				traps.erase(any_trap_at(c));
				Game::curmap->mod_tile(c)->flags &= ~TF_TRAP;
				msg = "You disarm the trap.";
			}
			else
			{
				traps.push_back(Trap(c, TRAP_BOOBY, pit));
				traps.back().set_seen_by(pit->team);
				Game::curmap->mod_tile(c)->flags |= TF_TRAP;
				msg = "You set a boobytrap.";
			}
			Network::construct_msg(msg, C_BOOBY_TRAP_LIT);
			Network::send_to_player(*pit);
		}
		break;
#ifdef DEBUG
	default: // Reaching this is an error!
		to_log("Error: progress_chore called with class "
			+ lex_cast(pit->cl));
		break;
#endif
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
leaq -0x2c(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x24d90
movb 0x142(%rbx), %al
decb %al
movb %al, 0x142(%rbx)
movl 0xc0(%rbx), %esi
leal -0x4(%rsi), %ecx
cmpl $0x5, %ecx
ja 0x206d3
leaq 0x10(%rbx), %r14
leaq 0xee7e(%rip), %rdx      # 0x2f1a8
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
movq %rbx, -0x58(%rbp)
jmpq *%rcx
testb %al, %al
jne 0x208a0
movq -0x58(%rbp), %rax
movq 0x148(%rax), %rax
movl 0x8(%rax), %eax
leaq -0x50(%rbp), %rdi
movl %eax, (%rdi)
leaq -0x2c(%rbp), %rbx
movl %eax, (%rbx)
callq 0x24d9e
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1ba5b
cmpq 0x1cc59(%rip), %rax     # 0x3cfc8
je 0x203a5
leaq 0x22a38(%rip), %rdi     # 0x42db0
movq %rax, %rsi
callq 0x17e30
leaq 0x218d1(%rip), %rax     # 0x41c58
movq (%rax), %rax
movswq -0x2a(%rbp), %rcx
movq 0x8(%rax), %rax
imulq $0x18, %rcx, %rcx
movswq -0x2c(%rbp), %rdx
movq (%rax,%rcx), %rax
andw $-0x21, (%rax,%rdx,4)
movq -0x58(%rbp), %rax
movq 0x148(%rax), %rax
movb $0x1, 0x21(%rax)
leaq 0xf100(%rip), %rsi      # 0x2f4bb
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xb292
leaq -0x50(%rbp), %rdi
pushq $0x20
popq %rsi
callq 0xc0f2
leaq 0x1dd3d(%rip), %rsi     # 0x3e118
movq %r14, %rdi
callq 0xc3a6
leaq 0x22bde(%rip), %rdi     # 0x42fc8
leaq -0x2c(%rbp), %rsi
callq 0x1c558
jmp 0x20897
movq 0x148(%rbx), %rax
movl 0x8(%rax), %eax
leaq -0x78(%rbp), %rsi
movl %eax, (%rsi)
movl 0x168(%rbx), %edx
leaq -0x50(%rbp), %rdi
callq 0x24e0c
leaq -0x50(%rbp), %rdi
movl (%rdi), %eax
movl %eax, -0x2c(%rbp)
callq 0x24d9e
leaq -0x78(%rbp), %rdi
callq 0x24d9e
cmpb $0x0, 0x142(%rbx)
je 0x20719
movl 0x168(%rbx), %esi
leaq -0x2c(%rbp), %rdi
callq 0x1fd05
testb %al, %al
je 0x207ff
movq -0x58(%rbp), %rax
movb $0x0, 0x142(%rax)
jmp 0x208a0
movq 0x148(%rbx), %rax
movl 0x8(%rax), %eax
leaq -0x50(%rbp), %rdi
movl %eax, (%rdi)
movl %eax, -0x2c(%rbp)
callq 0x24d9e
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x24d90
movb 0x154(%rbx), %al
movl 0xc0(%rbx), %ecx
imulq $0xd, %rcx, %rcx
leaq 0xed42(%rip), %rdx      # 0x2f1e0
cmpb 0x4(%rcx,%rdx), %al
sete %al
addb %al, %al
leal -0x2(%rax), %ecx
addb $0x6, %al
leaq 0x168(%rbx), %r14
leaq 0x98(%rbx), %rdx
movq %rdx, -0x88(%rbp)
movb $0x4, %bl
movzbl %al, %eax
movl %eax, -0x80(%rbp)
movsbl %cl, %eax
movl %eax, -0x7c(%rbp)
leaq -0x78(%rbp), %r12
subb $0x1, %bl
jb 0x2070b
movl (%r14), %edx
leaq -0x50(%rbp), %r15
movq %r15, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x24e0c
movl -0x50(%rbp), %eax
movl %eax, -0x30(%rbp)
movq %r15, %rdi
callq 0x24d9e
leaq -0x30(%rbp), %rdi
callq 0x1b9db
cmpq 0x1ca9b(%rip), %rax     # 0x3cfa8
je 0x20588
movq 0x20(%rax), %r13
movq %r13, %rdi
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
movl -0x80(%rbp), %ecx
movl -0x7c(%rbp), %r8d
callq 0x20b21
testb %al, %al
je 0x205f5
cmpb $0x0, 0x153(%r13)
jg 0x205f5
leaq -0x50(%rbp), %rdi
leaq 0xef96(%rip), %rsi      # 0x2f4df
movq %r12, %rdx
callq 0xb292
movq -0x58(%rbp), %rdi
movl 0xbc(%rdi), %eax
cmpl 0xbc(%r13), %eax
jne 0x20596
leaq -0x50(%rbp), %rdi
leaq 0x239d9(%rip), %rsi     # 0x43f48
callq 0x4790
movq -0x58(%rbp), %rax
movq 0x90(%rax), %rax
incq 0xa0(%rax)
jmp 0x2059e
leaq -0x30(%rbp), %rdi
pushq $0x5
popq %rsi
callq 0x1b103
jmp 0x205f5
pushq $0x2
popq %rsi
callq 0x1f544
leaq -0xa8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movq -0x88(%rbp), %rdx
callq 0xfe1f
movq %r12, %r15
movq %r12, %rdi
leaq -0xa8(%rbp), %rsi
pushq $0x2e
popq %rdx
callq 0x17d8b
movq %r13, %rdi
movq %r15, %rsi
pushq $0x1
popq %rdx
callq 0x1f393
movq %r15, %rdi
callq 0x47e8
leaq -0xa8(%rbp), %rdi
callq 0x47e8
leaq -0x50(%rbp), %rdi
callq 0x47e8
movq %r14, %rdi
callq 0x24d4c
jmp 0x204d3
testb %al, %al
jne 0x208a0
movq -0x58(%rbp), %rbx
movq 0x148(%rbx), %rax
movl 0x8(%rax), %eax
leaq -0x50(%rbp), %rdi
movl %eax, (%rdi)
movl %eax, -0x2c(%rbp)
callq 0x24d9e
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x2161b(%rip), %r15     # 0x41c58
movq (%r15), %rax
movswq -0x2a(%rbp), %rcx
movq 0x8(%rax), %rax
imulq $0x18, %rcx, %rcx
movswq -0x2c(%rbp), %rdx
movq (%rax,%rcx), %rax
testb $0x8, 0x1(%rax,%rdx,4)
jne 0x20835
leaq -0x78(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
pushq $0x3
popq %rdx
movq %rbx, %rcx
callq 0x1ca60
leaq 0x227dd(%rip), %rbx     # 0x42e58
leaq -0x78(%rbp), %rsi
movq %rbx, %rdi
callq 0x1be5c
leaq -0x78(%rbp), %rdi
callq 0x1c9c8
movq 0x8(%rbx), %rdi
addq $0x10, %rdi
movq -0x58(%rbp), %rax
movzbl 0xbc(%rax), %esi
callq 0x1caa6
movq (%r15), %rax
movswq -0x2a(%rbp), %rcx
movq 0x8(%rax), %rax
imulq $0x18, %rcx, %rcx
movswq -0x2c(%rbp), %rdx
movq (%rax,%rcx), %rax
orw $0x800, (%rax,%rdx,4)   # imm = 0x800
leaq 0xee75(%rip), %rsi      # 0x2f543
jmp 0x20873
leaq -0x78(%rbp), %rdi
callq 0x24fde
leaq 0xee75(%rip), %rsi      # 0x2f558
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xb332
leaq -0x50(%rbp), %rdi
callq 0x10b68
leaq -0x50(%rbp), %rdi
callq 0x47e8
leaq -0x78(%rbp), %rdi
jmp 0x2089b
leaq -0x30(%rbp), %rdi
callq 0x24d9e
jmp 0x208a0
leaq 0x21538(%rip), %r13     # 0x41c58
movq (%r13), %rax
movswq -0x2a(%rbp), %rcx
movq 0x8(%rax), %rax
imulq $0x18, %rcx, %rcx
movswq -0x2c(%rbp), %r15
movq (%rax,%rcx), %r12
movzbl 0x2(%r12,%r15,4), %eax
cmpl $0x7c, %eax
je 0x20810
cmpl $0x2b, %eax
je 0x20810
cmpl $0x2d, %eax
je 0x20810
cmpl $0x23, %eax
jne 0x208bb
movzwl (%r12,%r15,4), %eax
btl $0xc, %eax
jb 0x208f2
movb $0x2e, 0x2(%r12,%r15,4)
orl $0x5, %eax
movw %ax, (%r12,%r15,4)
leaq -0x2c(%rbp), %rdi
callq 0x1ee7b
andl $0x0, -0x50(%rbp)
leaq -0x78(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x24d90
leaq -0xa8(%rbp), %rbx
leaq -0x2c(%rbp), %r14
leaq -0x78(%rbp), %r15
leaq -0x50(%rbp), %r12
movl -0x50(%rbp), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x24e0c
movl -0xa8(%rbp), %eax
movl %eax, -0x78(%rbp)
movq %rbx, %rdi
callq 0x24d9e
movq (%r13), %rdi
movq %r15, %rsi
callq 0x12448
movq %r12, %rdi
callq 0x24d4c
cmpl $0x0, (%rax)
jne 0x207ae
leaq 0x227db(%rip), %rdi     # 0x42fc8
leaq -0x2c(%rbp), %rsi
callq 0x1c558
leaq -0x78(%rbp), %rdi
jmp 0x2070f
leaq -0x2c(%rbp), %rdi
pushq $0x5
popq %rsi
callq 0x1b202
jmp 0x208a0
movb $0x2e, 0x2(%r12,%r15,4)
movzwl (%r12,%r15,4), %eax
orl $0x5, %eax
movw %ax, (%r12,%r15,4)
leaq 0x2279e(%rip), %rdi     # 0x42fc8
leaq -0x2c(%rbp), %rsi
callq 0x1c558
jmp 0x208a0
leaq -0x2c(%rbp), %rdi
callq 0x1bae4
leaq 0x22613(%rip), %rdi     # 0x42e58
movq %rax, %rsi
callq 0x17f5c
movq (%r15), %rax
movswq -0x2a(%rbp), %rcx
movq 0x8(%rax), %rax
imulq $0x18, %rcx, %rcx
movswq -0x2c(%rbp), %rdx
movq (%rax,%rcx), %rax
andw $0xf7ff, (%rax,%rdx,4)  # imm = 0xF7FF
leaq 0xecbb(%rip), %rsi      # 0x2f52e
leaq -0x50(%rbp), %rdi
callq 0x4780
leaq -0x50(%rbp), %rdi
pushq $0x38
popq %rsi
callq 0xc0f2
leaq 0x1d889(%rip), %rsi     # 0x3e118
movq %r14, %rdi
callq 0xc3a6
leaq -0x50(%rbp), %rdi
callq 0x47e8
leaq -0x2c(%rbp), %rdi
callq 0x24d9e
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzwl (%r12,%r15,4), %eax
testb $0x40, %al
je 0x2092b
leaq -0x2c(%rbp), %rdi
callq 0x1bb64
cmpq 0x1c704(%rip), %rax     # 0x3cfd8
je 0x20926
leaq 0x22593(%rip), %rdi     # 0x42e70
movq %rax, %rsi
callq 0x17e18
movzwl (%r12,%r15,4), %eax
andl $-0x41, %eax
jmp 0x2081e
leaq 0xebfe(%rip), %rsi      # 0x2f4f7
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xb292
leaq -0x50(%rbp), %rdi
pushq $0x2e
popq %rsi
callq 0xc0f2
leaq 0x1d7ff(%rip), %rsi     # 0x3e118
movq %r14, %rdi
callq 0xc3a6
jmp 0x20897
movzwl (%r12,%r15,4), %eax
testb $0x20, %al
je 0x208a0
leaq -0x2c(%rbp), %rdi
pushq $0x1
popq %rsi
callq 0x1ba5b
leaq 0x2246a(%rip), %rcx     # 0x42db0
addq $0x18, %rcx
cmpq %rcx, %rax
je 0x208a0
leaq -0x50(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
pushq $0x4f
popq %rdx
pushq $0x1a
popq %rcx
callq 0x1caf4
leaq 0x22503(%rip), %rdi     # 0x42e70
leaq -0x50(%rbp), %rsi
callq 0x1c0f6
movq -0x58(%rbp), %r14
leaq -0x50(%rbp), %rdi
callq 0x1c9c8
testb $0x40, (%r12,%r15,4)
je 0x20a3a
leaq -0x2c(%rbp), %rdi
callq 0x1b9db
cmpq 0x1c60a(%rip), %rax     # 0x3cfa8
je 0x209d9
movq 0x20(%rax), %rbx
leaq 0xeb5e(%rip), %rsi      # 0x2f509
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xb292
movl 0xbc(%r14), %eax
cmpl 0xbc(%rbx), %eax
jne 0x209e8
leaq 0x2357a(%rip), %rsi     # 0x43f48
leaq -0x50(%rbp), %rdi
callq 0x4790
jmp 0x209f3
leaq -0x2c(%rbp), %rdi
callq 0x1bbe4
movb $0x1, 0xe(%rax)
jmp 0x20a3a
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x1f544
addq $0x98, %r14
leaq 0xeb1a(%rip), %rdx      # 0x2f51b
leaq -0x78(%rbp), %rdi
movq %r14, %rsi
callq 0xc40d
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4790
leaq -0x78(%rbp), %rdi
callq 0x47e8
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1f393
leaq -0x50(%rbp), %rdi
callq 0x47e8
movzwl (%r12,%r15,4), %eax
orl $0x40, %eax
jmp 0x2081e
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x47e8
jmp 0x20abb
jmp 0x20ab8
jmp 0x20aad
jmp 0x20ab8
jmp 0x20aad
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1c9c8
jmp 0x20b10
jmp 0x20aad
jmp 0x20aad
jmp 0x20ac6
jmp 0x20aad
jmp 0x20aad
jmp 0x20ab8
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x1c9c8
jmp 0x20abb
jmp 0x20ab8
jmp 0x20ab8
jmp 0x20aad
jmp 0x20aad
jmp 0x20aad
jmp 0x20aad
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x47e8
jmp 0x20aa5
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
jmp 0x20abf
jmp 0x20aad
movq %rax, %rbx
jmp 0x20b10
jmp 0x20ac6
jmp 0x20ab8
jmp 0x20ac6
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x47e8
jmp 0x20b10
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
jmp 0x20b0b
jmp 0x20ad1
movq %rax, %rbx
jmp 0x20af5
jmp 0x20b04
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x47e8
jmp 0x20ae9
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x47e8
leaq -0x50(%rbp), %rdi
callq 0x47e8
jmp 0x20b07
jmp 0x20b04
jmp 0x20b04
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x24d9e
leaq -0x2c(%rbp), %rdi
callq 0x24d9e
movq %rbx, %rdi
callq 0x4710