// File: /workspace/github_cpp_makefile_star2_O1/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)
movq $0x0, 0x10(%rdi)
testb $0x1, %bpl
jne 0x4066
testb $0x2, %bpl
jne 0x4100
testb $0x4, %bpl
jne 0x41c4
testb $0x8, %bpl
jne 0x4288
testb $0x10, %bpl
jne 0x434e
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x19cfb(%rip), %r15     # 0x1dd68
movq 0x19cfc(%rip), %r12     # 0x1dd70
cmpq %r12, %r15
je 0x402e
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
ucomisd 0x11f6b(%rip), %xmm0    # 0x16010
jb 0x40ad
sqrtsd %xmm0, %xmm0
jmp 0x40b2
callq 0x31e0
movsd 0x70(%r15), %xmm1
addsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x40f4
movq 0x8(%rbx), %rax
cmpq 0x10(%rbx), %rax
je 0x40e6
movl $0xf, %ecx
movq %rax, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x78, %rax
movq %rax, 0x8(%rbx)
jmp 0x40f4
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x11d54
addq $0xa0, %r15
jmp 0x4074
leaq 0x19bf1(%rip), %rdi     # 0x1dcf8
leaq 0x19bce(%rip), %rsi     # 0x1dcdc
callq 0x115fc
movq (%rax), %r15
movq 0x8(%rax), %r12
cmpq %r12, %r15
je 0x4038
cmpl %r14d, (%r15)
je 0x41b8
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
ucomisd 0x11eb8(%rip), %xmm0    # 0x16010
jb 0x4160
sqrtsd %xmm0, %xmm0
jmp 0x4165
callq 0x31e0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x41b8
movl 0x7c(%r15), %eax
testl %eax, %eax
je 0x4188
cmpl $0x3, %eax
jne 0x41b8
cmpl $0x1, 0x80(%r15)
jne 0x41b8
movq 0x8(%rbx), %rax
cmpq 0x10(%rbx), %rax
je 0x41aa
movl $0xf, %ecx
movq %rax, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x78, %rax
movq %rax, 0x8(%rbx)
jmp 0x41b8
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x11d54
addq $0x88, %r15
jmp 0x411a
leaq 0x19b2d(%rip), %rdi     # 0x1dcf8
leaq 0x19b0a(%rip), %rsi     # 0x1dcdc
callq 0x115fc
movq (%rax), %r15
movq 0x8(%rax), %r12
cmpq %r12, %r15
je 0x4042
cmpl %r14d, (%r15)
je 0x427c
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
ucomisd 0x11df4(%rip), %xmm0    # 0x16010
jb 0x4224
sqrtsd %xmm0, %xmm0
jmp 0x4229
callq 0x31e0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x427c
movl 0x7c(%r15), %eax
testl %eax, %eax
je 0x427c
cmpl $0x3, %eax
jne 0x424c
cmpl $0x1, 0x80(%r15)
je 0x427c
movq 0x8(%rbx), %rax
cmpq 0x10(%rbx), %rax
je 0x426e
movl $0xf, %ecx
movq %rax, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x78, %rax
movq %rax, 0x8(%rbx)
jmp 0x427c
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x11d54
addq $0x88, %r15
jmp 0x41de
movq 0x19a79(%rip), %r15     # 0x1dd08
testq %r15, %r15
je 0x404c
movl 0x8(%r15), %eax
cmpl 0x19a3a(%rip), %eax     # 0x1dcdc
jne 0x42a9
movq (%r15), %r15
jmp 0x428f
movq 0x10(%r15), %r14
movq 0x18(%r15), %r12
cmpq %r12, %r14
je 0x42a4
movl 0x7c(%r14), %eax
testl %eax, %eax
je 0x42cd
cmpl $0x3, %eax
jne 0x4342
cmpl $0x1, 0x80(%r14)
jne 0x4342
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
ucomisd 0x11d17(%rip), %xmm0    # 0x16010
jb 0x4301
sqrtsd %xmm0, %xmm0
jmp 0x4306
callq 0x31e0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x4342
movq 0x8(%rbx), %rax
cmpq 0x10(%rbx), %rax
je 0x4334
movl $0xf, %ecx
movq %rax, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x78, %rax
movq %rax, 0x8(%rbx)
jmp 0x4342
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x11d54
addq $0x88, %r14
jmp 0x42b1
movq 0x199b3(%rip), %r15     # 0x1dd08
testq %r15, %r15
je 0x4056
movl 0x8(%r15), %eax
cmpl 0x19974(%rip), %eax     # 0x1dcdc
jne 0x436f
movq (%r15), %r15
jmp 0x4355
movq 0x10(%r15), %r14
movq 0x18(%r15), %r12
cmpq %r12, %r14
je 0x436a
movl 0x7c(%r14), %eax
testl %eax, %eax
je 0x440c
cmpl $0x3, %eax
jne 0x4397
cmpl $0x1, 0x80(%r14)
je 0x440c
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
ucomisd 0x11c4d(%rip), %xmm0    # 0x16010
jb 0x43cb
sqrtsd %xmm0, %xmm0
jmp 0x43d0
callq 0x31e0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x440c
movq 0x8(%rbx), %rax
cmpq 0x10(%rbx), %rax
je 0x43fe
movl $0xf, %ecx
movq %rax, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x78, %rax
movq %rax, 0x8(%rbx)
jmp 0x440c
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x11d54
addq $0x88, %r14
jmp 0x4377
jmp 0x4424
jmp 0x4424
jmp 0x4424
jmp 0x4424
jmp 0x4424
jmp 0x4424
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x443b
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x3240
movq %r14, %rdi
callq 0x33d0