// File: 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:
subq $0x188, %rsp            # imm = 0x188
movq %rdi, 0x58(%rsp)
movq %rdi, %rax
movq %rax, 0x60(%rsp)
movq %rdi, 0x180(%rsp)
movsd %xmm0, 0x170(%rsp)
movsd %xmm1, 0x178(%rsp)
movsd %xmm2, 0x168(%rsp)
movl %esi, 0x164(%rsp)
movl %edx, 0x160(%rsp)
movb $0x0, 0x15f(%rsp)
callq 0x12a00
movl 0x164(%rsp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x40b5
leaq 0x4dd7c(%rip), %rax     # 0x51d28
addq $0x80, %rax
movq %rax, 0x150(%rsp)
leaq 0x4dd67(%rip), %rdi     # 0x51d28
addq $0x80, %rdi
callq 0x12a10
movq %rax, 0x148(%rsp)
leaq 0x4dd4c(%rip), %rdi     # 0x51d28
addq $0x80, %rdi
callq 0x12a40
movq %rax, 0x140(%rsp)
leaq 0x148(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x12a70
testb $0x1, %al
jne 0x400e
jmp 0x40b3
leaq 0x148(%rsp), %rdi
callq 0x12ab0
movq %rax, 0x138(%rsp)
movq 0x138(%rsp), %rsi
addq $0x8, %rsi
leaq 0x170(%rsp), %rdi
callq 0x12ac0
movsd %xmm0, 0x50(%rsp)
jmp 0x4044
movsd 0x50(%rsp), %xmm1
movsd 0x168(%rsp), %xmm0
movq 0x138(%rsp), %rax
addsd 0x70(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x409f
movq 0x58(%rsp), %rdi
movq 0x138(%rsp), %rsi
callq 0x12b30
jmp 0x407a
jmp 0x409f
movq 0x58(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x130(%rsp)
movl %eax, 0x12c(%rsp)
callq 0x12de0
jmp 0x465c
jmp 0x40a1
leaq 0x148(%rsp), %rdi
callq 0x12ba0
jmp 0x3ff0
jmp 0x40b5
movl 0x164(%rsp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x41de
leaq 0x4dc69(%rip), %rdi     # 0x51d38
leaq 0x4dc46(%rip), %rsi     # 0x51d1c
callq 0x12bc0
movq %rax, 0x48(%rsp)
jmp 0x40e2
movq 0x48(%rsp), %rax
movq %rax, 0x120(%rsp)
movq 0x120(%rsp), %rdi
callq 0x12bf0
movq %rax, 0x118(%rsp)
movq 0x120(%rsp), %rdi
callq 0x12c20
movq %rax, 0x110(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x12c50
testb $0x1, %al
jne 0x4137
jmp 0x41dc
leaq 0x118(%rsp), %rdi
callq 0x12c90
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rax
movl (%rax), %eax
cmpl 0x160(%rsp), %eax
je 0x41c8
movq 0x108(%rsp), %rsi
addq $0x8, %rsi
leaq 0x170(%rsp), %rdi
callq 0x12ac0
movsd %xmm0, 0x40(%rsp)
jmp 0x4180
movsd 0x40(%rsp), %xmm1
movsd 0x168(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x41c8
movq 0x108(%rsp), %rdi
callq 0x12ca0
movb %al, 0x3f(%rsp)
jmp 0x41a8
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x41c8
jmp 0x41b2
movq 0x58(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x12b30
jmp 0x41c6
jmp 0x41c8
jmp 0x41ca
leaq 0x118(%rsp), %rdi
callq 0x12cf0
jmp 0x4119
jmp 0x41de
movl 0x164(%rsp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x4307
leaq 0x4db40(%rip), %rdi     # 0x51d38
leaq 0x4db1d(%rip), %rsi     # 0x51d1c
callq 0x12bc0
movq %rax, 0x30(%rsp)
jmp 0x420b
movq 0x30(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rdi
callq 0x12bf0
movq %rax, 0xf8(%rsp)
movq 0x100(%rsp), %rdi
callq 0x12c20
movq %rax, 0xf0(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x12c50
testb $0x1, %al
jne 0x4260
jmp 0x4305
leaq 0xf8(%rsp), %rdi
callq 0x12c90
movq %rax, 0xe8(%rsp)
movq 0xe8(%rsp), %rax
movl (%rax), %eax
cmpl 0x160(%rsp), %eax
je 0x42f1
movq 0xe8(%rsp), %rsi
addq $0x8, %rsi
leaq 0x170(%rsp), %rdi
callq 0x12ac0
movsd %xmm0, 0x28(%rsp)
jmp 0x42a9
movsd 0x28(%rsp), %xmm1
movsd 0x168(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x42f1
movq 0xe8(%rsp), %rdi
callq 0x12ca0
movb %al, 0x27(%rsp)
jmp 0x42d1
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x42db
jmp 0x42f1
movq 0x58(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq 0x12b30
jmp 0x42ef
jmp 0x42f1
jmp 0x42f3
leaq 0xf8(%rsp), %rdi
callq 0x12cf0
jmp 0x4242
jmp 0x4307
movl 0x164(%rsp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x44ac
leaq 0x4da07(%rip), %rax     # 0x51d28
addq $0x10, %rax
movq %rax, 0xe0(%rsp)
leaq 0x4d9f4(%rip), %rdi     # 0x51d28
addq $0x10, %rdi
callq 0x12d10
movq %rax, 0xd8(%rsp)
leaq 0x4d9dc(%rip), %rdi     # 0x51d28
addq $0x10, %rdi
callq 0x12d40
movq %rax, 0xd0(%rsp)
leaq 0xd8(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x12d70
testb $0x1, %al
jne 0x437b
jmp 0x44aa
leaq 0xd8(%rsp), %rdi
callq 0x12d90
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rax
movl (%rax), %eax
cmpl 0x4d97c(%rip), %eax     # 0x51d1c
je 0x4496
movq 0xc8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x12bf0
movq %rax, 0xb8(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x12c20
movq %rax, 0xb0(%rsp)
leaq 0xb8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x12c50
testb $0x1, %al
jne 0x4402
jmp 0x4494
leaq 0xb8(%rsp), %rdi
callq 0x12c90
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x12ca0
movb %al, 0x26(%rsp)
jmp 0x442a
movb 0x26(%rsp), %al
testb $0x1, %al
jne 0x4480
jmp 0x4434
movq 0xa8(%rsp), %rsi
addq $0x8, %rsi
leaq 0x170(%rsp), %rdi
callq 0x12ac0
movsd %xmm0, 0x18(%rsp)
jmp 0x4455
movsd 0x18(%rsp), %xmm1
movsd 0x168(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x4480
movq 0x58(%rsp), %rdi
movq 0xa8(%rsp), %rsi
callq 0x12b30
jmp 0x447e
jmp 0x4480
jmp 0x4482
leaq 0xb8(%rsp), %rdi
callq 0x12cf0
jmp 0x43e4
jmp 0x4496
jmp 0x4498
leaq 0xd8(%rsp), %rdi
callq 0x12db0
jmp 0x435d
jmp 0x44ac
movl 0x164(%rsp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x4633
leaq 0x4d862(%rip), %rax     # 0x51d28
addq $0x10, %rax
movq %rax, 0xa0(%rsp)
leaq 0x4d84f(%rip), %rdi     # 0x51d28
addq $0x10, %rdi
callq 0x12d10
movq %rax, 0x98(%rsp)
leaq 0x4d837(%rip), %rdi     # 0x51d28
addq $0x10, %rdi
callq 0x12d40
movq %rax, 0x90(%rsp)
leaq 0x98(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x12d70
testb $0x1, %al
jne 0x4520
jmp 0x4631
leaq 0x98(%rsp), %rdi
callq 0x12d90
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rax
movl (%rax), %eax
cmpl 0x4d7d7(%rip), %eax     # 0x51d1c
je 0x461d
movq 0x88(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rdi
callq 0x12bf0
movq %rax, 0x78(%rsp)
movq 0x80(%rsp), %rdi
callq 0x12c20
movq %rax, 0x70(%rsp)
leaq 0x78(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x12c50
testb $0x1, %al
jne 0x459b
jmp 0x461b
leaq 0x78(%rsp), %rdi
callq 0x12c90
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rdi
callq 0x12ca0
movb %al, 0x17(%rsp)
jmp 0x45ba
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x45c4
jmp 0x460a
movq 0x68(%rsp), %rsi
addq $0x8, %rsi
leaq 0x170(%rsp), %rdi
callq 0x12ac0
movsd %xmm0, 0x8(%rsp)
jmp 0x45e2
movsd 0x8(%rsp), %xmm1
movsd 0x168(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x460a
movq 0x58(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x12b30
jmp 0x4608
jmp 0x460a
jmp 0x460c
leaq 0x78(%rsp), %rdi
callq 0x12cf0
jmp 0x4583
jmp 0x461d
jmp 0x461f
leaq 0x98(%rsp), %rdi
callq 0x12db0
jmp 0x4502
jmp 0x4633
movb $0x1, 0x15f(%rsp)
testb $0x1, 0x15f(%rsp)
jne 0x464f
movq 0x58(%rsp), %rdi
callq 0x12de0
movq 0x60(%rsp), %rax
addq $0x188, %rsp            # imm = 0x188
retq
movq 0x130(%rsp), %rdi
callq 0x3440
nopl (%rax)