// File: /workspace/github_cpp_makefile_star2_O1/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)
xorl %eax, %eax
movq %rax, 0x30(%rdi)
movb %al, 0x38(%rdi)
movb %al, 0x58(%rdi)
movq %rax, 0x3c(%rdi)
movb %al, 0x44(%rdi)
movl $0x0, (%rdi)
movabsq $-0x3e32329b00000000, %rcx # imm = 0xC1CDCD6500000000
movq %rcx, 0x8(%rdi)
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 0x17bbd(%rip), %rdi     # 0x1df68
movq %r12, %rsi
callq 0xde8c
movl (%rax), %ebp
leaq 0x17b4c(%rip), %rdi     # 0x1df08
movq %r12, %rsi
callq 0xde8c
cmpl (%rax), %ebp
jge 0x6588
movsd 0x8(%r14), %xmm0
movsd 0x10(%r14), %xmm1
subsd 0x8(%r15), %xmm0
subsd 0x10(%r15), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x6400
sqrtsd %xmm0, %xmm0
jmp 0x6405
callq 0x31e0
movsd 0xfd23(%rip), %xmm2     # 0x16130
subsd %xmm0, %xmm2
movsd 0xfc3f(%rip), %xmm1     # 0x16058
ucomisd %xmm0, %xmm1
jbe 0x6429
addsd 0xfcf9(%rip), %xmm2     # 0x16120
jmp 0x64a4
movsd 0xfd07(%rip), %xmm1     # 0x16138
ucomisd %xmm0, %xmm1
jbe 0x64a4
movsd 0x8(%r15), %xmm0
ucomisd 0xfbe3(%rip), %xmm0     # 0x16028
jbe 0x6489
xorps %xmm1, %xmm1
cvtsi2sdl 0x17896(%rip), %xmm1 # 0x1dce8
addsd 0xfce6(%rip), %xmm1     # 0x16140
ucomisd %xmm0, %xmm1
jbe 0x6489
movsd 0x10(%r15), %xmm0
ucomisd 0xfbba(%rip), %xmm0     # 0x16028
jbe 0x6489
xorps %xmm1, %xmm1
cvtsi2sdl 0x17871(%rip), %xmm1 # 0x1dcec
addsd 0xfcbd(%rip), %xmm1     # 0x16140
ucomisd %xmm0, %xmm1
ja 0x641f
movl 0x7c(%r15), %eax
testl %eax, %eax
je 0x64a4
cmpl $0x3, %eax
jne 0x641f
cmpl $0x1, 0x80(%r15)
jne 0x641f
movl 0xc(%rsp), %eax
movq 0x17b89(%rip), %rsi     # 0x1e038
leaq 0x17b7a(%rip), %rcx     # 0x1e030
movq %rcx, %rdx
testq %rsi, %rsi
je 0x64dc
leaq 0x17b6b(%rip), %rdx     # 0x1e030
xorl %edi, %edi
cmpl %eax, 0x20(%rsi)
setl %dil
cmovgeq %rsi, %rdx
movq 0x10(%rsi,%rdi,8), %rsi
testq %rsi, %rsi
jne 0x64c5
cmpq %rcx, %rdx
je 0x64e9
cmpl 0x20(%rdx), %eax
setl %al
jmp 0x64eb
movb $0x1, %al
testb %al, %al
jne 0x64f7
addsd 0xfc51(%rip), %xmm2     # 0x16148
movl 0x7c(%r15), %eax
testl %eax, %eax
je 0x650e
cmpl $0x3, %eax
jne 0x6515
cmpl $0x1, 0x80(%r15)
jne 0x6515
movsd %xmm2, (%rsp)
jmp 0x654a
addsd 0xfc33(%rip), %xmm2     # 0x16150
movsd %xmm2, (%rsp)
leaq 0x1794f(%rip), %rdi     # 0x1de78
movq %r14, %rsi
callq 0xdf54
movq %rax, %rdi
movq %r15, %rsi
callq 0xdef0
movsd (%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rsp)
leaq 0x17b37(%rip), %rdi     # 0x1e088
leaq 0xc(%rsp), %r12
movq %r12, %rsi
callq 0xdef0
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