// File: /workspace/github_cpp_makefile_star2_O2/FakePsyho[P]halite2/MyBot.cpp
// Function: findCloseEntities(hlt::Location, double, int, unsigned int)
VC<Entity> findCloseEntities(Location loc, double radius, int mask = MASK_ALL, EntityId ship_id = -1) {
	VC<Entity> rv;
	if (mask & MASK_PLANETS) for (Planet& p : m.planets) if (loc.dist(p.location) < radius + p.radius) rv.PB(p);
	if (mask & MASK_ALLIES) for (Ship& s : m.ships[player_id]) if (s.entity_id != ship_id && loc.dist(s.location) < radius && !s.docked()) rv.PB(s);
	if (mask & MASK_ALLIES_DOCKED) for (Ship& s : m.ships[player_id]) if (s.entity_id != ship_id && loc.dist(s.location) < radius && s.docked()) rv.PB(s);
	if (mask & MASK_ENEMIES) for (auto& ps : m.ships) if (ps.X != player_id) for (Ship& s : ps.Y) if (!s.docked() && loc.dist(s.location) < radius) rv.PB(s);
	if (mask & MASK_ENEMIES_DOCKED) for (auto& ps : m.ships) if (ps.X != player_id) for (Ship& s : ps.Y) if (s.docked() && loc.dist(s.location) < radius) rv.PB(s);
	return rv;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %edx, %r14d
movl %esi, %ebp
movsd %xmm2, 0x18(%rsp)
movsd %xmm1, 0x10(%rsp)
movsd %xmm0, 0x8(%rsp)
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
testb $0x1, %bpl
jne 0x2da4
testb $0x2, %bpl
jne 0x2e05
testb $0x4, %bpl
jne 0x2e81
testb $0x8, %bpl
jne 0x2efd
testb $0x10, %bpl
jne 0x2f7d
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x19fbd(%rip), %r15     # 0x1cd68
movq 0x19fbe(%rip), %r12     # 0x1cd70
cmpq %r12, %r15
je 0x2d6c
movsd 0x8(%rsp), %xmm0
subsd 0x8(%r15), %xmm0
movsd 0x10(%rsp), %xmm1
subsd 0x10(%r15), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd 0x70(%r15), %xmm1
addsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2dfc
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ad8
addq $0xa0, %r15
jmp 0x2db2
leaq 0x19eec(%rip), %rdi     # 0x1ccf8
leaq 0x19ec9(%rip), %rsi     # 0x1ccdc
callq 0xd19c
movq (%rax), %r15
movq 0x8(%rax), %r12
cmpq %r12, %r15
je 0x2d76
cmpl %r14d, (%r15)
je 0x2e78
movsd 0x8(%rsp), %xmm0
subsd 0x8(%r15), %xmm0
movsd 0x10(%rsp), %xmm1
subsd 0x10(%r15), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2e78
movq %r15, %rdi
callq 0x9b02
testb %al, %al
jne 0x2e78
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ad8
addq $0x88, %r15
jmp 0x2e1f
leaq 0x19e70(%rip), %rdi     # 0x1ccf8
leaq 0x19e4d(%rip), %rsi     # 0x1ccdc
callq 0xd19c
movq (%rax), %r15
movq 0x8(%rax), %r12
cmpq %r12, %r15
je 0x2d80
cmpl %r14d, (%r15)
je 0x2ef4
movsd 0x8(%rsp), %xmm0
subsd 0x8(%r15), %xmm0
movsd 0x10(%rsp), %xmm1
subsd 0x10(%r15), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2ef4
movq %r15, %rdi
callq 0x9b02
testb %al, %al
je 0x2ef4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ad8
addq $0x88, %r15
jmp 0x2e9b
leaq 0x19e04(%rip), %r15     # 0x1cd08
movq (%r15), %r15
testq %r15, %r15
je 0x2d8a
movl 0x8(%r15), %eax
cmpl 0x19dc2(%rip), %eax     # 0x1ccdc
je 0x2f04
movq 0x10(%r15), %r14
movq 0x18(%r15), %r12
cmpq %r12, %r14
je 0x2f04
movq %r14, %rdi
callq 0x9b02
testb %al, %al
jne 0x2f74
movsd 0x8(%rsp), %xmm0
subsd 0x8(%r14), %xmm0
movsd 0x10(%rsp), %xmm1
subsd 0x10(%r14), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2f74
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9ad8
addq $0x88, %r14
jmp 0x2f24
leaq 0x19d84(%rip), %r15     # 0x1cd08
movq (%r15), %r15
testq %r15, %r15
je 0x2d94
movl 0x8(%r15), %eax
cmpl 0x19d42(%rip), %eax     # 0x1ccdc
je 0x2f84
movq 0x10(%r15), %r14
movq 0x18(%r15), %r12
cmpq %r12, %r14
je 0x2f84
movq %r14, %rdi
callq 0x9b02
testb %al, %al
je 0x2ff4
movsd 0x8(%rsp), %xmm0
subsd 0x8(%r14), %xmm0
movsd 0x10(%rsp), %xmm1
subsd 0x10(%r14), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2ff4
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9ad8
addq $0x88, %r14
jmp 0x2fa4
jmp 0x3009
jmp 0x3009
jmp 0x3009
jmp 0x3009
jmp 0x3009
jmp 0x3009
movq %rax, %r14
movq %rbx, %rdi
callq 0xd7f8
movq %r14, %rdi
callq 0x23f0