// File: /workspace/github_cpp_makefile_star2_O2/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 $0x10, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %r12
movl %ecx, (%r12)
callq 0x9c7c
leaq 0x188b5(%rip), %rdi     # 0x1cf68
movq %r12, %rsi
callq 0x9cd0
movl (%rax), %ebp
leaq 0x18844(%rip), %rdi     # 0x1cf08
movq %r12, %rsi
callq 0x9cd0
cmpl (%rax), %ebp
jge 0x4801
leaq 0x8(%r14), %rdi
leaq 0x8(%r15), %r12
movq %r12, %rsi
callq 0x9ab4
movsd 0xda44(%rip), %xmm2     # 0x12130
subsd %xmm0, %xmm2
movsd 0xd958(%rip), %xmm1     # 0x12050
ucomisd %xmm0, %xmm1
jbe 0x470d
addsd 0xda0a(%rip), %xmm2     # 0x12110
movsd %xmm2, (%rsp)
jmp 0x4751
movsd 0xda23(%rip), %xmm1     # 0x12138
ucomisd %xmm0, %xmm1
movsd %xmm2, (%rsp)
jbe 0x4751
leaq 0x185c1(%rip), %rdi     # 0x1cce8
movsd 0xd8f1(%rip), %xmm0     # 0x12020
movq %r12, %rsi
callq 0x9c1c
movsd (%rsp), %xmm2
testb %al, %al
jne 0x46fe
movq %r15, %rdi
callq 0x9b02
movsd (%rsp), %xmm2
testb %al, %al
jne 0x46fe
movl 0x8(%rsp), %eax
leaq 0xc(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x188c5(%rip), %rdi     # 0x1d028
callq 0x9d94
testq %rax, %rax
je 0x477f
movsd (%rsp), %xmm0
addsd 0xd9c6(%rip), %xmm0     # 0x12140
movsd %xmm0, (%rsp)
movq %r15, %rdi
callq 0x9b02
testb %al, %al
je 0x47c5
movsd (%rsp), %xmm0
addsd 0xd9b0(%rip), %xmm0     # 0x12148
movsd %xmm0, (%rsp)
leaq 0x186d4(%rip), %rdi     # 0x1ce78
movq %r14, %rsi
callq 0x9dae
movq %rax, %rdi
movq %r15, %rsi
callq 0x9d46
movsd (%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rsp)
leaq 0x188bc(%rip), %rdi     # 0x1d088
leaq 0x8(%rsp), %r12
movq %r12, %rsi
callq 0x9d46
movsd (%rsp), %xmm0
addsd (%rax), %xmm0
cmpl $0x1, 0x7c(%r15)
pushq $0x4
popq %rax
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 $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq