// File: /workspace/github_cpp_makefile_star2_O3/FakePsyho[P]halite2/MyBot.cpp
// Function: attackOrder(hlt::Ship const&, hlt::Ship const&, unsigned int)
Order attackOrder(const Ship& ship, const Ship& eship, EntityId eid) {
	Order o;
	// if (enemyFollowers[eid] >= maxFollowers[enemyClusters[eid]]) return o;
	if (enemyFollowers[eid] >= maxFollowers[eid]) return o;
	
	double dist = ship.location.dist(eship.location);
	// double dist = ship.location.dist(shipTarget[eid]);
	double v = 1000 - dist;
	if (dist < 25 || dist < 45 && (m.in_ex_bounds(eship.location, 10.0) || eship.docked())) v += 2000;
	if (aggressiveShips.count(eid)) v += 15;
	// if (eship.owner_id == opp_player_id && turn < 60) v += 15;
	if (eship.docked()) {
		v += 40;
		v += pathBonus[ship.entity_id][eship.entity_id];
	}
	v += shipValue[eid];
	// if (m.ships[player_id].S >= 10 && totalHitAndRunners == 0 && eship.docking_status != ShipDockingStatus::Undocked) v += 10000;
	
	if (false && v > 10000) {
		o.type = OrderType::HitAndRun;
	} else if (false && aggressiveShips.count(eid) && minerDefenders[aggressiveShips[eid]] <= 1) {
		o.type = OrderType::DefendMiner;
	} else if (eship.docking_status == ShipDockingStatus::Undocked) {
		o.type = OrderType::AttackShip;
	} else {
		// o.type = totalHitAndRunners == 0 ? OrderType::HitAndRun : OrderType::AttackMiner;
		// o.type = OrderType::HitAndRun;
		o.type = OrderType::AttackMiner;
	}
	o.ship = ship.entity_id;
	o.target = eid;
	o.value = v;
	return o;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xc(%rsp), %r12
movl %ecx, (%r12)
movl $0x0, (%rdi)
movabsq $-0x3e32329b00000000, %rax # imm = 0xC1CDCD6500000000
movq %rax, 0x8(%rdi)
xorl %eax, %eax
movb %al, 0x1b(%rsp)
movq %rax, 0x13(%rsp)
pxor %xmm0, %xmm0
movdqu %xmm0, 0x1c(%rdi)
movdqu %xmm0, 0x10(%rdi)
movq %rax, 0x30(%rdi)
movb %al, 0x38(%rdi)
movq 0x10(%rsp), %rcx
movq %rcx, 0x39(%rdi)
movl 0x18(%rsp), %ecx
movl %ecx, 0x41(%rdi)
movb %al, 0x58(%rdi)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x60(%rdi)
movl $0xffffffff, 0x70(%rdi) # imm = 0xFFFFFFFF
leaq 0x17ecc(%rip), %rdi     # 0x1df68
movq %r12, %rsi
callq 0xd752
movl (%rax), %ebp
leaq 0x17e5b(%rip), %rdi     # 0x1df08
movq %r12, %rsi
callq 0xd752
cmpl (%rax), %ebp
jge 0x6254
movsd 0x8(%r15), %xmm1
movsd 0x10(%r15), %xmm0
movsd 0x8(%r14), %xmm2
movsd 0x10(%r14), %xmm3
subsd %xmm1, %xmm2
subsd %xmm0, %xmm3
mulsd %xmm3, %xmm3
mulsd %xmm2, %xmm2
addsd %xmm3, %xmm2
sqrtsd %xmm2, %xmm2
movsd 0x1003b(%rip), %xmm4    # 0x16130
subsd %xmm2, %xmm4
movsd 0xff4f(%rip), %xmm3     # 0x16050
ucomisd %xmm2, %xmm3
jbe 0x6111
addsd 0x10011(%rip), %xmm4    # 0x16120
jmp 0x617c
movsd 0x1001f(%rip), %xmm3    # 0x16138
ucomisd %xmm2, %xmm3
jbe 0x617c
ucomisd 0xfef9(%rip), %xmm1     # 0x16020
jbe 0x6165
xorps %xmm2, %xmm2
cvtsi2sdl 0x17bb4(%rip), %xmm2 # 0x1dce8
addsd 0x10004(%rip), %xmm2    # 0x16140
ucomisd %xmm1, %xmm2
jbe 0x6165
ucomisd 0xfed6(%rip), %xmm0     # 0x16020
jbe 0x6165
xorps %xmm1, %xmm1
cvtsi2sdl 0x17b95(%rip), %xmm1 # 0x1dcec
addsd 0xffe1(%rip), %xmm1     # 0x16140
ucomisd %xmm0, %xmm1
ja 0x6107
movl 0x7c(%r15), %eax
testl %eax, %eax
je 0x617c
cmpl $0x3, %eax
jne 0x6107
cmpl $0x1, 0x80(%r15)
jne 0x6107
movq 0x17eb5(%rip), %rdx     # 0x1e038
testq %rdx, %rdx
je 0x61c3
movl 0xc(%rsp), %eax
leaq 0x17e9d(%rip), %rcx     # 0x1e030
xorl %esi, %esi
cmpl %eax, 0x20(%rdx)
setl %sil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x6193
leaq 0x17e7f(%rip), %rdx     # 0x1e030
cmpq %rdx, %rcx
je 0x61c3
cmpl 0x20(%rcx), %eax
jl 0x61c3
addsd 0xff85(%rip), %xmm4     # 0x16148
movl 0x7c(%r15), %eax
testl %eax, %eax
je 0x61da
cmpl $0x3, %eax
jne 0x61e1
cmpl $0x1, 0x80(%r15)
jne 0x61e1
movsd %xmm4, (%rsp)
jmp 0x6216
addsd 0xff67(%rip), %xmm4     # 0x16150
movsd %xmm4, (%rsp)
leaq 0x17c83(%rip), %rdi     # 0x1de78
movq %r14, %rsi
callq 0xd81e
movq %rax, %rdi
movq %r15, %rsi
callq 0xd7b8
movsd (%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rsp)
leaq 0x17e6b(%rip), %rdi     # 0x1e088
leaq 0xc(%rsp), %r12
movq %r12, %rsi
callq 0xd7b8
movsd (%rsp), %xmm0
addsd (%rax), %xmm0
cmpl $0x1, 0x7c(%r15)
movl $0x4, %eax
sbbl $0x0, %eax
movl %eax, (%rbx)
movl (%r14), %eax
movl %eax, 0x60(%rbx)
movl (%r12), %eax
movl %eax, 0x68(%rbx)
movsd %xmm0, 0x8(%rbx)
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq