// File: /workspace/github_cpp_makefile_star2_O1/lotuskip[P]yuxtapa/server/chores.cpp
// Function: (anonymous namespace)::missile_hit_PC(std::_List_iterator<Player>, OwnedEnt*, bool)
void missile_hit_PC(const list<Player>::iterator pit, OwnedEnt* mis,
	const bool should_void_zap)
{
	list<Player>::iterator shooter = mis->get_owner();
	if(dynamic_cast<Arrow*>(mis)) // it's an arrow
	{
		if(pit->team != shooter->team) // shooting teammates don't count as hit
			shooter->stats_i->arch_hits++;

		if(test_hit(pit, 7, 1, 7, 0)) // arrows: 1d7+0 damage, +7 to hit
		{
			if(pit->cl_props.hp <= 0) // (check if died)
			{
				string msg = " was shot by ";
				if(pit->team == shooter->team)
				{
					msg += teammate_str;
					shooter->stats_i->tks++;
				}
				else // shot enemy, count kill
					record_kill(shooter, WTK_ARROW);
				player_death(pit, msg + shooter->nick + '.', true);
			}
			else
				pit->needs_state_upd = true;
		}
		mis->makevoid(); // occupied flag is unset in kill_player if necessary
	}
	else // a mm or a zap
	{
		bool is_zap = dynamic_cast<Zap*>(mis);
		if(is_zap && shooter->team != pit->team)
			shooter->stats_i->cm_hits++;
		if(pit->nomagicres())
		{
			add_action_ind(pit->own_pc->getpos(), A_HIT);

			char dam = 1 + random()%5; // 1d5
			if(is_zap)
				dam += 1 + random()%5; // 2d5 for zaps
			pit->cl_props.hp -= dam;
			if(pit->cl_props.hp <= 0) // died
			{
				string msg = spell_kill_msg[is_zap][0];
				if(pit == shooter)
					msg += spell_kill_msg[is_zap][1];
				else
				{
					if(pit->team == shooter->team)
					{
						msg += teammate_str;
						shooter->stats_i->tks++;
					}
					else
						record_kill(shooter, is_zap ? WTK_ZAP : WTK_MM);
					msg += shooter->nick;
					if(!is_zap)
						msg += "\'s ";
				}
				msg += spell_kill_msg[is_zap][2];
				player_death(pit, msg, true);
			}
			else
				pit->needs_state_upd = true;
		} // no magic resistance
		else
			add_action_ind(pit->own_pc->getpos(), A_MISS);
		// mms voided always, zaps only if we are allowed to do so here:
		if(should_void_zap || !is_zap)
			mis->makevoid(); // occupied flag is unset in kill_player if necessary
	} // mm or zap
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movq 0x10(%rsi), %r12
leaq 0x18d55(%rip), %rsi     # 0x3faa8
leaq 0x18fc6(%rip), %rdx     # 0x3fd20
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x4450
testq %rax, %rax
je 0x26dc6
movl 0xbc(%r14), %eax
cmpl 0xbc(%r12), %eax
je 0x26d89
movq 0x90(%r12), %rax
incq 0x118(%rax)
movq %r14, %rdi
movl $0x7, %esi
movl $0x1, %edx
movl $0x7, %ecx
xorl %r8d, %r8d
callq 0x26743
testb %al, %al
je 0x2714e
cmpb $0x0, 0x153(%r14)
jle 0x26ec6
movb $0x1, 0x15d(%r14)
jmp 0x2714e
movl %r15d, -0x4c(%rbp)
leaq 0x18cd7(%rip), %rsi     # 0x3faa8
leaq 0x18f78(%rip), %rdx     # 0x3fd50
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x4450
movq %rax, %r13
testq %rax, %rax
je 0x26e0a
movl 0xbc(%r12), %eax
cmpl 0xbc(%r14), %eax
je 0x26e0a
movq 0x90(%r12), %rax
incq 0x128(%rax)
leaq 0x10(%r14), %rdi
callq 0x1274e
testb %al, %al
je 0x26e9e
movq 0x148(%r14), %rax
movl 0x8(%rax), %eax
leaq -0x48(%rbp), %rdi
movl %eax, (%rdi)
movl $0x4, %esi
callq 0x20a4f
leaq -0x48(%rbp), %rdi
callq 0x2bbf6
callq 0x41d0
movq %rax, %r15
movabsq $0x6666666666666667, %rcx # imm = 0x6666666666666667
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
shrl %edx
addl %eax, %edx
leal (%rdx,%rdx,4), %eax
subl %eax, %r15d
testq %r13, %r13
je 0x26f25
callq 0x41d0
movq %rax, %rcx
movabsq $0x6666666666666667, %rdx # imm = 0x6666666666666667
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
shrl %edx
addl %eax, %edx
leal (%rdx,%rdx,4), %eax
subl %eax, %ecx
addb %cl, %r15b
addb $0x2, %r15b
jmp 0x26f28
movq 0x148(%r14), %rax
movl 0x8(%rax), %eax
leaq -0x48(%rbp), %rdi
movl %eax, (%rdi)
movl $0x5, %esi
callq 0x20a4f
leaq -0x48(%rbp), %rdi
callq 0x2bbf6
jmp 0x27141
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xe7af(%rip), %rsi      # 0x35684
leaq 0xe7b5(%rip), %rdx      # 0x35691
leaq -0x48(%rbp), %rdi
callq 0xdfec
movl 0xbc(%r14), %eax
cmpl 0xbc(%r12), %eax
jne 0x26fca
movq 0x20057(%rip), %rsi     # 0x46f58
movq 0x20058(%rip), %rdx     # 0x46f60
leaq -0x48(%rbp), %rdi
callq 0x4130
movq 0x90(%r12), %rax
incq 0xa0(%rax)
jmp 0x26fd7
incb %r15b
movb 0x153(%r14), %al
subb %r15b, %al
movb %al, 0x153(%r14)
testb %al, %al
jle 0x26f4a
movb $0x1, 0x15d(%r14)
jmp 0x27141
xorl %eax, %eax
testq %r13, %r13
setne %al
leaq (%rax,%rax,2), %rax
shll $0x5, %eax
leaq 0x20020(%rip), %rcx     # 0x46f80
leaq (%rcx,%rax), %r15
leaq -0x38(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0xfa82
cmpq %r14, %r12
je 0x270af
movl 0xbc(%r14), %eax
cmpl 0xbc(%r12), %eax
jne 0x270c2
movq 0x1ffb2(%rip), %rsi     # 0x46f58
movq 0x1ffb3(%rip), %rdx     # 0x46f60
leaq -0x48(%rbp), %rdi
callq 0x4130
movq 0x90(%r12), %rax
incq 0xa0(%rax)
jmp 0x270d8
movq %r12, %rdi
movl $0x1, %esi
callq 0x24e7d
addq $0x98, %r12
leaq -0x90(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movq %r12, %rdx
callq 0x1483d
leaq -0x90(%rbp), %rdi
movq 0x8(%rdi), %rsi
movl $0x1, %ecx
xorl %edx, %edx
movl $0x2e, %r8d
callq 0x47b0
leaq -0x60(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x27033
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x2703b
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq -0x70(%rbp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
movl $0x1, %edx
callq 0x24c43
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0x27078
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x43f0
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x27091
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x43f0
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x2714e
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x43f0
jmp 0x2714e
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
leaq -0x48(%rbp), %rdi
callq 0x4130
jmp 0x27106
xorl %eax, %eax
testq %r13, %r13
sete %al
leal (%rax,%rax,2), %esi
addl $0x3, %esi
movq %r12, %rdi
callq 0x24e7d
movq 0x98(%r12), %rsi
movq 0xa0(%r12), %rdx
leaq -0x48(%rbp), %rdi
callq 0x4130
testq %r13, %r13
jne 0x27106
leaq 0xe595(%rip), %rsi      # 0x35692
leaq -0x48(%rbp), %rdi
callq 0x47c0
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
leaq -0x48(%rbp), %rdi
callq 0x4130
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x24c43
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x27141
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x43f0
testq %r13, %r13
sete %al
orb -0x4c(%rbp), %al
cmpb $0x1, %al
jne 0x27152
movb $0x1, 0xe(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0x2717e
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x43f0
jmp 0x2717e
movq %rax, %rbx
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2719e
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x43f0
jmp 0x2719e
jmp 0x2719b
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
jne 0x271ce
jmp 0x271da
movq %rax, %rbx
jmp 0x271da
jmp 0x271b0
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x2bbf6
jmp 0x271da
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x271da
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x43f0
movq %rbx, %rdi
callq 0x4750