// File: /workspace/github_cpp_makefile_star2_O3/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 0x191fb(%rip), %rsi     # 0x3fd48
leaq 0x191ac(%rip), %rdx     # 0x3fd00
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x4450
testq %rax, %rax
je 0x26bc0
movl 0xbc(%r14), %eax
cmpl 0xbc(%r12), %eax
je 0x26b83
movq 0x90(%r12), %rax
incq 0x118(%rax)
movq %r14, %rdi
movl $0x7, %esi
movl $0x1, %edx
movl $0x7, %ecx
xorl %r8d, %r8d
callq 0x26530
testb %al, %al
je 0x26f48
cmpb $0x0, 0x153(%r14)
jle 0x26cc0
movb $0x1, 0x15d(%r14)
jmp 0x26f48
movl %r15d, -0x4c(%rbp)
leaq 0x1917d(%rip), %rsi     # 0x3fd48
leaq 0x1915e(%rip), %rdx     # 0x3fd30
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x4450
movq %rax, %r13
testq %rax, %rax
je 0x26c04
movl 0xbc(%r12), %eax
cmpl 0xbc(%r14), %eax
je 0x26c04
movq 0x90(%r12), %rax
incq 0x128(%rax)
leaq 0x10(%r14), %rdi
callq 0x125fe
testb %al, %al
je 0x26c98
movq 0x148(%r14), %rax
movl 0x8(%rax), %eax
leaq -0x48(%rbp), %rdi
movl %eax, (%rdi)
movl $0x4, %esi
callq 0x208ed
leaq -0x48(%rbp), %rdi
callq 0x2b7a6
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 0x26d1f
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 0x26d22
movq 0x148(%r14), %rax
movl 0x8(%rax), %eax
leaq -0x48(%rbp), %rdi
movl %eax, (%rdi)
movl $0x5, %esi
callq 0x208ed
leaq -0x48(%rbp), %rdi
callq 0x2b7a6
jmp 0x26f3b
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xe9a5(%rip), %rsi      # 0x35674
leaq 0xe9ab(%rip), %rdx      # 0x35681
leaq -0x48(%rbp), %rdi
callq 0xe01c
movl 0xbc(%r14), %eax
cmpl 0xbc(%r12), %eax
jne 0x26dc4
movq 0x2025d(%rip), %rsi     # 0x46f58
movq 0x2025e(%rip), %rdx     # 0x46f60
leaq -0x48(%rbp), %rdi
callq 0x4130
movq 0x90(%r12), %rax
incq 0xa0(%rax)
jmp 0x26dd1
incb %r15b
movb 0x153(%r14), %al
subb %r15b, %al
movb %al, 0x153(%r14)
testb %al, %al
jle 0x26d44
movb $0x1, 0x15d(%r14)
jmp 0x26f3b
xorl %eax, %eax
testq %r13, %r13
setne %al
leaq (%rax,%rax,2), %rax
shll $0x5, %eax
leaq 0x20226(%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 0xf988
cmpq %r14, %r12
je 0x26ea9
movl 0xbc(%r14), %eax
cmpl 0xbc(%r12), %eax
jne 0x26ebc
movq 0x201b8(%rip), %rsi     # 0x46f58
movq 0x201b9(%rip), %rdx     # 0x46f60
leaq -0x48(%rbp), %rdi
callq 0x4130
movq 0x90(%r12), %rax
incq 0xa0(%rax)
jmp 0x26ed2
movq %r12, %rdi
movl $0x1, %esi
callq 0x24c07
addq $0x98, %r12
leaq -0x90(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movq %r12, %rdx
callq 0x146ff
leaq -0x90(%rbp), %rdi
movq 0x8(%rdi), %rsi
movl $0x1, %ecx
xorl %edx, %edx
movl $0x2e, %r8d
callq 0x47a0
leaq -0x60(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x26e2d
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x26e35
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 0x249ec
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0x26e72
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x43f0
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26e8b
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x43f0
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x26f48
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x43f0
jmp 0x26f48
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
leaq -0x48(%rbp), %rdi
callq 0x4130
jmp 0x26f00
xorl %eax, %eax
testq %r13, %r13
sete %al
leal (%rax,%rax,2), %esi
addl $0x3, %esi
movq %r12, %rdi
callq 0x24c07
movq 0x98(%r12), %rsi
movq 0xa0(%r12), %rdx
leaq -0x48(%rbp), %rdi
callq 0x4130
testq %r13, %r13
jne 0x26f00
leaq 0xe78b(%rip), %rsi      # 0x35682
leaq -0x48(%rbp), %rdi
callq 0x47b0
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 0x249ec
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x26f3b
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x43f0
testq %r13, %r13
sete %al
orb -0x4c(%rbp), %al
cmpb $0x1, %al
jne 0x26f4c
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 0x26f78
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x43f0
jmp 0x26f78
movq %rax, %rbx
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26f98
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x43f0
jmp 0x26f98
jmp 0x26f95
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
jne 0x26fc8
jmp 0x26fd4
movq %rax, %rbx
jmp 0x26fd4
jmp 0x26faa
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x2b7a6
jmp 0x26fd4
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x26fd4
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x43f0
movq %rbx, %rdi
callq 0x4740