// File: lotuskip[P]yuxtapa/server/chores.cpp
// Function: kill_player(std::_List_iterator<Player>)
void kill_player(const list<Player>::iterator pit)
{
	if(pit->cl_props.hp > 0)
		pit->cl_props.hp = 0; // if they're negative, we don't overwrite that
	pit->doing_a_chore = pit->warned_of_chasm = 0;
	event_set.insert(pit->own_pc->getpos());
	Tile* tp = Game::curmap->mod_tile(pit->own_pc->getpos());
	// if was carrying item, drop it
	if(pit == pl_with_item)
	{
		pl_with_item = cur_players.end();
		the_item.setpos(pit->own_pc->getpos());
		// Change item colour for certain tile types:
		if(tp->flags & TF_DROWNS) // water
			the_item.set_col(C_WATER_TRAP);
		else if(tp->flags & TF_KILLS) // chasm
			the_item.set_col(C_BROWN_PC);
		else
			the_item.set_col(C_LIGHT_TRAP);
		obj_sector = Game::curmap->coords_in_sector(pit->own_pc->getpos());
		Game::send_team_upds(cur_players.end());
		string msg = "Treasure dropped!";
		Network::construct_msg(msg, C_PORTAL_IN_LIT);
		Network::broadcast();
	}
	
	// If was a planewalker on a trip, return to view own corpse:
	if(pit->cl == C_PLANEWALKER && pit->limiter)
		pit->own_vp->set_pos(pit->own_pc->getpos());
	// (limiter and pv are reset upon next spawn)

	tp->flags &= ~(TF_OCCUPIED);
	pit->own_pc->makevoid();
	
	pit->action_queue.clear();
	pit->poisoner = cur_players.end();

	// If requested to change class:
	if(pit->next_cl != pit->cl)
		Game::send_state_change(pit);

	pit->stats_i->time_played[pit->cl] += time(NULL) - pit->last_switched_cl;
	time(&(pit->last_switched_cl));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movsbl 0x143(%rax), %eax
cmpl $0x0, %eax
jle 0x546d4
leaq -0x8(%rbp), %rdi
callq 0x1b050
movb $0x0, 0x143(%rax)
leaq -0x8(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x1b050
movq -0xc8(%rbp), %rdi
movb $0x0, 0x162(%rax)
callq 0x1b050
movq -0xc8(%rbp), %rdi
movb $0x0, 0x132(%rax)
callq 0x1b050
movq 0x138(%rax), %rsi
leaq -0xc(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x1b190
movq -0xc0(%rbp), %rsi
leaq 0x3ea19(%rip), %rdi     # 0x93148
callq 0x1b1e0
movb %dl, -0xb1(%rbp)
movq %rax, -0xb0(%rbp)
jmp 0x54743
movb -0xb1(%rbp), %al
movq -0xb0(%rbp), %rcx
movq %rcx, -0x30(%rbp)
movb %al, -0x28(%rbp)
leaq -0xc(%rbp), %rdi
callq 0x60460
leaq 0x3d671(%rip), %rax     # 0x91dd8
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq 0x138(%rax), %rsi
leaq -0x3c(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x1b190
movq -0xe0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0x3d2d0
movq %rax, -0xd0(%rbp)
jmp 0x547ad
leaq -0x3c(%rbp), %rdi
callq 0x60460
movq -0xd0(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x8(%rbp), %rsi
callq 0x18a20
leaq -0x48(%rbp), %rdi
leaq 0x3e99f(%rip), %rsi     # 0x93178
callq 0x3d5a0
testb $0x1, %al
jne 0x547e7
jmp 0x54a49
leaq 0x3ba42(%rip), %rdi     # 0x90230
callq 0x189f0
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x18a20
leaq 0x3e96d(%rip), %rax     # 0x93178
movq -0x50(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq 0x138(%rax), %rsi
leaq -0x5c(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x1b190
movq -0xe8(%rbp), %rsi
leaq 0x3e948(%rip), %rdi     # 0x93188
callq 0x49fd0
jmp 0x54847
leaq -0x5c(%rbp), %rdi
callq 0x60460
movq -0x38(%rbp), %rax
movzwl (%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x548c5
leaq 0x3e920(%rip), %rdi     # 0x93188
movl $0x21, %esi
callq 0x49ff0
jmp 0x548fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xc(%rbp), %rdi
callq 0x60460
jmp 0x54c49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x3c(%rbp), %rdi
callq 0x60460
jmp 0x54c49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x5c(%rbp), %rdi
callq 0x60460
jmp 0x54c49
movq -0x38(%rbp), %rax
movzwl (%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x548e9
leaq 0x3e8ab(%rip), %rdi     # 0x93188
movl $0x20, %esi
callq 0x49ff0
jmp 0x548fa
leaq 0x3e898(%rip), %rdi     # 0x93188
movl $0x22, %esi
callq 0x49ff0
jmp 0x548fc
leaq 0x3d4d5(%rip), %rax     # 0x91dd8
movq (%rax), %rax
movq %rax, -0x100(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq 0x138(%rax), %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x1b190
movq -0x100(%rbp), %rdi
movq -0xf8(%rbp), %rsi
callq 0x2c120
movl %eax, -0xec(%rbp)
jmp 0x54948
movl -0xec(%rbp), %ecx
leaq 0x38c3b(%rip), %rax     # 0x8d590
movl %ecx, (%rax)
leaq -0x60(%rbp), %rdi
callq 0x60460
leaq 0x3b8c9(%rip), %rdi     # 0x90230
callq 0x189f0
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x18a20
movq -0x68(%rbp), %rdi
callq 0x36ce0
leaq -0x91(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x5930
movq -0x108(%rbp), %rdx
leaq 0x17a10(%rip), %rsi     # 0x6c3b7
leaq -0x90(%rbp), %rdi
callq 0x18880
jmp 0x549b5
leaq -0x91(%rbp), %rdi
callq 0x5590
leaq -0x90(%rbp), %rdi
movl $0x3c, %esi
callq 0x1ab10
jmp 0x549d4
leaq 0x398bd(%rip), %rsi     # 0x8e298
movl $0xffff, %edi           # imm = 0xFFFF
callq 0x19160
jmp 0x549e7
leaq -0x90(%rbp), %rdi
callq 0x5a48
jmp 0x54a49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x60460
jmp 0x54c49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x91(%rbp), %rdi
callq 0x5590
jmp 0x54c49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x5a48
jmp 0x54c49
leaq -0x8(%rbp), %rdi
callq 0x1b050
cmpl $0xa, 0xb0(%rax)
jne 0x54af9
leaq -0x8(%rbp), %rdi
callq 0x1b050
cmpb $0x0, 0x130(%rax)
je 0x54af9
leaq -0x8(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x1b050
movq -0x120(%rbp), %rdi
movq 0xc0(%rax), %rax
movq %rax, -0x118(%rbp)
callq 0x1b050
movq 0x138(%rax), %rsi
leaq -0x96(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x1b190
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rsi
callq 0x426b0
jmp 0x54ace
leaq -0x96(%rbp), %rdi
callq 0x60460
jmp 0x54af9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x96(%rbp), %rdi
callq 0x60460
jmp 0x54c49
movq -0x38(%rbp), %rax
movzwl (%rax), %ecx
andl $-0x41, %ecx
movw %cx, (%rax)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq 0x138(%rax), %rdi
callq 0x4d8d0
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq %rax, %rdi
addq $0xd8, %rdi
callq 0x3d5f0
leaq 0x3b6f6(%rip), %rdi     # 0x90230
callq 0x189f0
movq %rax, -0xa0(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq -0xa0(%rbp), %rcx
movq %rcx, 0x150(%rax)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movl 0xb4(%rax), %eax
movl %eax, -0x124(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq %rax, %rcx
movl -0x124(%rbp), %eax
cmpl 0xb0(%rcx), %eax
je 0x54ba8
leaq -0xa8(%rbp), %rdi
leaq -0x8(%rbp), %rsi
callq 0x18a20
movq -0xa8(%rbp), %rdi
callq 0x3b290
xorl %eax, %eax
movl %eax, %edi
callq 0x54c0
movq %rax, -0x140(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq %rax, %rcx
movq -0x140(%rbp), %rax
subq 0xb8(%rcx), %rax
movq %rax, -0x138(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq %rax, %rdi
addq $0x80, %rdi
callq 0x1b390
movq %rax, -0x130(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq -0x138(%rbp), %rdx
movq %rax, %rcx
movq -0x130(%rbp), %rax
movl 0xb0(%rcx), %ecx
addq 0xb0(%rax,%rcx,8), %rdx
movq %rdx, 0xb0(%rax,%rcx,8)
leaq -0x8(%rbp), %rdi
callq 0x1b050
movq %rax, %rdi
addq $0xb8, %rdi
callq 0x54c0
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x5920
nopw %cs:(%rax,%rax)