// File: 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:
subq $0x48, %rsp
movq %rdi, 0x8(%rsp)
movq %rdi, %rax
movq %rax, 0x10(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movl %ecx, 0x34(%rsp)
callq 0x139c0
leaq 0x4b26d(%rip), %rdi     # 0x51fa8
leaq 0x34(%rsp), %rsi
callq 0x13a50
movl (%rax), %eax
movl %eax, 0x18(%rsp)
leaq 0x4b1f6(%rip), %rdi     # 0x51f48
leaq 0x34(%rsp), %rsi
callq 0x13a50
movq %rax, %rcx
movl 0x18(%rsp), %eax
cmpl (%rcx), %eax
jl 0x6d6c
jmp 0x6eec
movq 0x40(%rsp), %rdi
addq $0x8, %rdi
movq 0x38(%rsp), %rsi
addq $0x8, %rsi
callq 0x12ac0
movsd %xmm0, 0x28(%rsp)
movsd 0x3431f(%rip), %xmm0    # 0x3b0b0
subsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x3429b(%rip), %xmm0    # 0x3b040
ucomisd 0x28(%rsp), %xmm0
ja 0x6dee
movsd 0x34353(%rip), %xmm0    # 0x3b108
ucomisd 0x28(%rsp), %xmm0
jbe 0x6e02
movq 0x38(%rsp), %rsi
addq $0x8, %rsi
leaq 0x4af5b(%rip), %rdi     # 0x51d28
movsd 0x3423b(%rip), %xmm0    # 0x3b010
callq 0x136b0
testb $0x1, %al
jne 0x6dee
movq 0x38(%rsp), %rdi
callq 0x12ca0
testb $0x1, %al
jne 0x6dee
jmp 0x6e02
movsd 0x342f2(%rip), %xmm0    # 0x3b0e8
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movl 0x34(%rsp), %eax
movl %eax, 0x1c(%rsp)
leaq 0x4b257(%rip), %rdi     # 0x52068
leaq 0x1c(%rsp), %rsi
callq 0x13c80
cmpq $0x0, %rax
je 0x6e35
movsd 0x342e7(%rip), %xmm0    # 0x3b110
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x38(%rsp), %rdi
callq 0x12ca0
testb $0x1, %al
jne 0x6e45
jmp 0x6e87
movsd 0x342cb(%rip), %xmm0    # 0x3b118
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x40(%rsp), %rsi
leaq 0x4b053(%rip), %rdi     # 0x51eb8
callq 0x13ce0
movq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x13b90
movsd (%rax), %xmm0
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x4b23a(%rip), %rdi     # 0x520c8
leaq 0x34(%rsp), %rsi
callq 0x13b90
movsd (%rax), %xmm0
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x38(%rsp), %rax
cmpl $0x0, 0x7c(%rax)
jne 0x6ec0
movq 0x8(%rsp), %rax
movl $0x3, (%rax)
jmp 0x6ecb
movq 0x8(%rsp), %rax
movl $0x4, (%rax)
movq 0x8(%rsp), %rax
movq 0x40(%rsp), %rcx
movl (%rcx), %ecx
movl %ecx, 0x60(%rax)
movl 0x34(%rsp), %ecx
movl %ecx, 0x68(%rax)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
movq 0x10(%rsp), %rax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)