// File: /workspace/github_cpp_makefile_star2_O3/FakePsyho[P]halite2/MyBot.cpp
// Function: move_to(hlt::Ship const&, hlt::Location const&, double, double, bool, bool, bool, int, bool)
Move move_to(const Ship& ship, const Location& target, double maxSpeed = MAX_SPEED, double radius = 0, bool avoidEnemies = false, bool cluster = false, bool avoidEdges = false, int baitTarget = -1, bool reversePlayers = false) {
	radius *= radius;
	VC<Entity> planets = findCloseEntities(ship.location, 10.0, MASK_PLANETS);
	VC<Entity> docked = findCloseEntities(ship.location, 10.0, MASK_ALLIES_DOCKED);
	VC<Entity> entities = findCloseEntities(ship.location, 16.0, MASK_PLANETS | MASK_ALLIES | MASK_ALLIES_DOCKED | MASK_ENEMIES_DOCKED, ship.entity_id);
	VC<Entity> enemies = avoidEnemies ? findCloseEntities(ship.location, 25.0, MASK_ENEMIES) : VC<Entity>();
	VC<Entity> miners = findCloseEntities(ship.location, 13.0, MASK_ENEMIES_DOCKED);
	// VC<Entity> allies = cluster || reversePlayers ? findCloseEntities(ship.location, 30.0, MASK_ALLIES | MASK_ALLIES_DOCKED, ship.entity_id) : VC<Entity>();
	VC<Entity> allies = cluster ? findCloseEntities(ship.location, 30.0, MASK_ALLIES | MASK_ALLIES_DOCKED) : VC<Entity>();
	VC<Location> spawnedEnemies;
	Entity baitEnemy;
	if (reversePlayers) {
		allies = VC<Entity>();
		docked = VC<Entity>();
		miners = findCloseEntities(ship.location, 13.0, MASK_ALLIES_DOCKED);
		enemies = findCloseEntities(ship.location, 25.0, MASK_ALLIES);
		for (auto& e : entities) e.move.move_thrust = 0;
	}
	if (avoidEnemies) {
		for (Entity& enemy : enemies) {
			enemy.move.move_thrust = MAX_SPEED;
			enemy.move.move_angle_deg = util::angle_rad_to_deg_clipped(enemy.location.orient_towards_in_rad(ship.location));
		}
		if (!reversePlayers) {
			for (auto& spawn : spawnedShips) {
				if (spawn.Y != player_id && ship.location.dist(spawn.X) < 25.0) spawnedEnemies.PB(spawn.X);
			}
		}
		
		if (baitTarget != -1) {
			for (auto& e : enemies) if (e.entity_id == baitTarget) baitEnemy = e;
			if (baitEnemy.entity_id != baitTarget) baitTarget = -1;
		}
	}
	
	double ang = ship.location.get_angle(target);
	
	int TOTAL_ANG_STEPS = 360;
	
	double bv = 1e9;
	double bang = 0;
	double bd2 = 0;
	double bthrust = -1;
	int battackers = 0;
	bool bbait = false;
	
	// if (radius == 0 && !avoidEnemies && !detectCollisions(ship.location, round_angle(ang), (int)maxSpeed, entities)) return Move::thrust_rad(ship.entity_id, (int)maxSpeed, round_angle(ang));
	
	const double DANGER_DIST = baitTarget == -1 ? 6.25 : 6.25;
	int angoff = angle_rad_to_deg_clipped(ang);
	
	for (int xang = 0; xang < 360; xang += 360 / TOTAL_ANG_STEPS) {
		int nang = (xang + angoff) % 360;
		REP(nthrust, maxSpeed + 1e-9) {
			if (nthrust == 0 && xang) continue;
			Location end = ship.location + velocity[nang][nthrust];
			double d2 = target.dist_sq(end);
			double av = d2;
			if (radius) av = av < radius ? radius - av : 10000 + av;
			
			if (enemies.S == 0 && allies.S == 0 && av >= bv) continue;
			
			if (detectCollisions(ship.location, end, entities)) continue;
			
			bool closeToPlanet = false;
			for (auto& p : planets) {
				if (end.dist_sq(p.location) < (p.radius + 1) * (p.radius + 1)) {
					closeToPlanet = true;
					break;
				}
			}
			if (closeToPlanet) continue;
			
			if (!avoidEnemies && !m.in_ex_bounds(end, 4)) continue;
			
			bool abait = false;
			int aattackers = 0;
			
			if (avoidEnemies) {
				double minDist = 1e9;
				int closeEnemies = 0;
				if (true || baitTarget == -1) {
					if (enemies.S) {
						for (Entity& e : enemies) {
							if (e.entity_id == baitTarget) continue;
							double d = segment_circle_dist(ship.location, end, e);
							minDist = min(minDist, d);
							closeEnemies += d < DANGER_DIST;
						}
						for (auto& loc : spawnedEnemies) {
							minDist = min(minDist, end.dist(loc));
							closeEnemies += end.dist(loc) < DANGER_DIST;
						}
					}
				} else {
					for (Entity& e : enemies) {
						if (e.entity_id == baitTarget) continue;
						double d = end.dist(e.location) - MAX_SPEED;
						minDist = min(minDist, d);
						closeEnemies += d < DANGER_DIST;
					}
					for (auto& loc : spawnedEnemies) {
						minDist = min(minDist, end.dist(loc));
						closeEnemies += end.dist(loc) < DANGER_DIST;
					}
				}
				aattackers = closeEnemies;
				
				if (minDist < 1e5) {
					av = 10000;
					if (d2 >= radius) {
						av += 10000;
						av += sqrt(d2);
					} else {
						// if (minDist < 6.25) av += 10000;
						av += sqrt(radius) - sqrt(d2);
					}
					if (minDist < DANGER_DIST) {
						double dockDist = 1e9;
						for (auto& e : docked) dockDist = min(dockDist, end.dist_sq(e.location));
						if (dockDist > 4 * 4)
							av += closeEnemies * 20000;
					}
					double maxDist = 9.0 + (4 - ship.health / 64.0) * 1.0;
					av -= min(maxDist, minDist) * 4;
				}
				
				if (true || avoidEdges) {
					double edgeXDist = min(end.pos_x, m.map_width - end.pos_x);
					double edgeYDist = min(end.pos_y, m.map_height - end.pos_y);
					av += max(0.0, 12 - edgeXDist);
					av += max(0.0, 12 - edgeYDist);
				}
				
				if (baitTarget != -1 && segment_circle_dist(ship.location, end, baitEnemy) < 5.5) {
					av -= 1000;
					abait = true;
				}
				
				if (allies.S) {
					av -= sqrt(d2);
					for (Entity& e : allies) {
						av += 17.5 * sqrt(max(1.0, end.dist(e.destination()) + 0.0));
					}
				}
			}
			
			if (radius || avoidEnemies) {
				for (Entity& e : miners)
					if (end.dist_sq(e.location) < 6 * 6) {
						av -= 2;
						// break;
					}
			}
			
			if (avoidEnemies && earlyPhase && players_no == 4) {
				av += (leftSide ? max(0.0, end.pos_x - 50) : max(0.0, m.map_width - end.pos_x - 50)) * 0.025;
			}
			
			if (av < bv) {
				bd2 = d2;
				bbait = abait;
				battackers = aattackers;
				
				bv = av;
				bang = nang;
				bthrust = nthrust;
			}
		}
	}
	
	// if (reversePlayers) {
		// log("Ang: " + i2s(bang) + " Thrust: " + i2s(bthrust));
		// Location end = ship.location + Move::get_velocity_deg(bang, bthrust);
		// log("Vel: " + Move::get_velocity_deg(bang, bthrust).tostring());
		// log("End: " + end.tostring());
		// log("BV: " + i2s(bv) + " BD2: " + i2s(bd2));
		// for (Entity& entity : entities) {
			// log("Rad: " + i2s(entity.radius) + " Pos: " + entity.location.tostring() + " DistS: " + i2s(entity.location.dist(ship.location)) + " DistE: " + i2s(entity.location.dist(end)) + " Close: " + i2s(segment_circle_dist(ship.location, end, entity.location)));
		// }
		// for (auto& e : enemies) {
			// log("Enemy: " + i2s((int)e.entity_id) + " Pos: " + e.location.tostring() + " DistSO: " + i2s(ship.location.dist(e.location)) + " Close: " + i2s(segment_circle_dist(ship.location, end, e)));
		// }
	// }
	
	Move mv = Move::thrust(ship.entity_id, bthrust, bang);
	mv.value = bv;
	mv.bait = bbait;
	mv.attackers = battackers;
	return mv;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movl %r8d, %ebx
movl %ecx, 0xc(%rsp)
movsd %xmm1, 0x68(%rsp)
movsd %xmm0, 0xa8(%rsp)
movq %rdx, 0x140(%rsp)
movq %rsi, %r12
movq %rdi, %r14
movsd 0x8(%rsi), %xmm0
movsd 0x10(%rsi), %xmm1
leaq 0x180(%rsp), %rdi
movsd 0x11412(%rip), %xmm2    # 0x16020
movl $0x1, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3ff2
movq 0x8(%r12), %xmm0
movq 0x10(%r12), %xmm1
leaq 0x100(%rsp), %rdi
movq 0x113e5(%rip), %xmm2    # 0x16020
movl $0x4, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3ff2
movq 0x8(%r12), %xmm0
movq 0x10(%r12), %xmm1
movl (%r12), %edx
leaq 0x158(%rsp), %rdi
movq 0x113dc(%rip), %xmm2    # 0x16048
movl $0x17, %esi
callq 0x3ff2
cmpb $0x0, 0xc(%rsp)
je 0x4ca9
movq 0x8(%r12), %xmm0
movq 0x10(%r12), %xmm1
leaq 0x50(%rsp), %rdi
movq 0x113b8(%rip), %xmm2    # 0x16050
movl $0x8, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3ff2
jmp 0x4cbc
pxor %xmm0, %xmm0
movdqa %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x8(%r12), %xmm0
movq 0x10(%r12), %xmm1
leaq 0xe0(%rsp), %rdi
movq 0x1137e(%rip), %xmm2    # 0x16058
movl $0x10, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3ff2
testb %bl, %bl
je 0x4d1c
movq 0x8(%r12), %xmm0
movq 0x10(%r12), %xmm1
leaq 0x80(%rsp), %rdi
movq 0x11355(%rip), %xmm2    # 0x16060
movl $0x6, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3ff2
jmp 0x4d35
pxor %xmm0, %xmm0
movdqa %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
pxor %xmm0, %xmm0
movdqa %xmm0, 0xb0(%rsp)
xorl %eax, %eax
movq %rax, 0xc0(%rsp)
movq %rax, 0x1f8(%rsp)
movb %al, 0x200(%rsp)
movb %al, 0x220(%rsp)
movq %rax, 0x204(%rsp)
movb %al, 0x20c(%rsp)
movdqu %xmm0, 0x1d8(%rsp)
movdqu %xmm0, 0x1e4(%rsp)
cmpb $0x0, 0x278(%rsp)
je 0x4fd6
movq 0x80(%rsp), %rdi
movq 0x90(%rsp), %rsi
movdqa %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
testq %rdi, %rdi
je 0x4dc3
subq %rdi, %rsi
callq 0x3240
movq 0x100(%rsp), %rdi
movq 0x110(%rsp), %rsi
pxor %xmm0, %xmm0
movdqa %xmm0, 0x100(%rsp)
movq $0x0, 0x110(%rsp)
testq %rdi, %rdi
je 0x4df9
subq %rdi, %rsi
callq 0x3240
movsd 0x8(%r12), %xmm0
movsd 0x10(%r12), %xmm1
leaq 0x30(%rsp), %rdi
movsd 0x11244(%rip), %xmm2    # 0x16058
movl $0x4, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3ff2
movq 0xe0(%rsp), %rdi
movq 0xf0(%rsp), %rsi
movaps 0x30(%rsp), %xmm0
movaps %xmm0, 0xe0(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0xf0(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
testq %rdi, %rdi
je 0x4e82
subq %rdi, %rsi
callq 0x3240
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x4e82
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movsd 0x8(%r12), %xmm0
movq 0x10(%r12), %xmm1
leaq 0x30(%rsp), %rdi
movq 0x111b3(%rip), %xmm2    # 0x16050
movl $0x2, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3ff2
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
movdqa 0x30(%rsp), %xmm0
movdqa %xmm0, 0x50(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x60(%rsp)
pxor %xmm0, %xmm0
movdqa %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
testq %rdi, %rdi
je 0x4f03
subq %rdi, %rsi
callq 0x3240
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x4f03
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x158(%rsp), %rcx
movq 0x160(%rsp), %rax
cmpq %rax, %rcx
je 0x4fd6
subq %rcx, %rax
addq $-0x78, %rax
movabsq $-0x7777777777777777, %rdx # imm = 0x8888888888888889
mulq %rdx
movq %rdx, %xmm0
shrq $0x6, %rdx
addq $0x2, %rdx
andq $-0x2, %rdx
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
psrlq $0x6, %xmm0
addq $0x98, %rcx
xorl %eax, %eax
movdqa 0x112f4(%rip), %xmm1    # 0x16250
movdqa 0x112fc(%rip), %xmm2    # 0x16260
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movq %rax, %xmm4
pshufd $0x44, %xmm4, %xmm4     # xmm4 = xmm4[0,1,0,1]
por %xmm1, %xmm4
pxor %xmm2, %xmm4
movdqa %xmm4, %xmm5
pcmpgtd %xmm0, %xmm5
pcmpeqd %xmm0, %xmm4
pshufd $0xf5, %xmm4, %xmm6     # xmm6 = xmm4[1,1,3,3]
pand %xmm5, %xmm6
pshufd $0xf5, %xmm5, %xmm4     # xmm4 = xmm5[1,1,3,3]
por %xmm6, %xmm4
movd %xmm4, %esi
notl %esi
testb $0x1, %sil
je 0x4fb0
movq $0x0, -0x78(%rcx)
pxor %xmm3, %xmm4
pextrw $0x4, %xmm4, %esi
testb $0x1, %sil
je 0x4fc6
movq $0x0, (%rcx)
addq $0x2, %rax
addq $0xf0, %rcx
cmpq %rax, %rdx
jne 0x4f6c
movq %r14, 0x198(%rsp)
movl 0x270(%rsp), %eax
movl %eax, 0x24(%rsp)
cmpb $0x0, 0xc(%rsp)
je 0x51b5
movq 0x50(%rsp), %r14
movq 0x58(%rsp), %r15
cmpq %r15, %r14
je 0x50a8
movabsq $0x401c000000000000, %rbx # imm = 0x401C000000000000
movabsq $0x2d82d82d82d82d83, %r13 # imm = 0x2D82D82D82D82D83
movl $0x168, %ebp            # imm = 0x168
movq %rbx, 0x20(%r14)
movsd 0x8(%r12), %xmm1
movsd 0x10(%r12), %xmm0
subsd 0x8(%r14), %xmm1
subsd 0x10(%r14), %xmm0
callq 0x3050
addsd 0x1101d(%rip), %xmm0    # 0x16068
mulsd 0x10fe5(%rip), %xmm0    # 0x16038
divsd 0x10fe5(%rip), %xmm0    # 0x16040
callq 0x3040
movq %rax, %rcx
imulq %r13
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x6, %rdx
addq %rax, %rdx
imulq $0x168, %rdx, %rax      # imm = 0x168
subq %rax, %rcx
leaq (%rcx,%rbp), %rax
cmpq $-0x168, %rcx           # imm = 0xFE98
cmovbq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x28(%r14)
addq $0x78, %r14
cmpq %r15, %r14
jne 0x5020
cmpb $0x0, 0x278(%rsp)
jne 0x514e
movq 0x19093(%rip), %rbx     # 0x1e150
movq 0x19094(%rip), %r15     # 0x1e158
cmpq %r15, %rbx
je 0x514e
leaq 0xb0(%rsp), %r14
movl 0x10(%rbx), %eax
cmpl 0x18bfe(%rip), %eax     # 0x1dcdc
je 0x5145
movsd 0x8(%r12), %xmm0
movsd 0x10(%r12), %xmm1
subsd (%rbx), %xmm0
subsd 0x8(%rbx), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd 0x10f41(%rip), %xmm1    # 0x16050
ucomisd %xmm0, %xmm1
jbe 0x5145
movq 0xb8(%rsp), %rsi
cmpq 0xc0(%rsp), %rsi
je 0x513a
movdqu (%rbx), %xmm0
movdqu %xmm0, (%rsi)
addq $0x10, 0xb8(%rsp)
jmp 0x5145
movq %r14, %rdi
movq %rbx, %rdx
callq 0x119da
addq $0x18, %rbx
cmpq %r15, %rbx
jne 0x50d5
cmpl $-0x1, 0x270(%rsp)
je 0x51ad
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %r8
cmpq %r8, %rax
je 0x5191
leaq 0x1c0(%rsp), %rdx
movl 0x270(%rsp), %ecx
cmpl %ecx, (%rax)
jne 0x5188
movl $0xf, %ecx
movq %rdx, %rdi
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x78, %rax
cmpq %r8, %rax
jne 0x516f
movl 0x270(%rsp), %ecx
cmpl %ecx, 0x1c0(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnel %eax, %ecx
movl %ecx, 0x24(%rsp)
jmp 0x51b5
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
movsd 0x68(%rsp), %xmm0
mulsd %xmm0, %xmm0
movsd %xmm0, 0x68(%rsp)
movq %r12, %rax
addq $0x8, %r12
movq 0x140(%rsp), %rcx
movsd (%rcx), %xmm1
movsd 0x8(%rcx), %xmm0
subsd 0x8(%rax), %xmm1
movq %rax, 0x118(%rsp)
subsd 0x10(%rax), %xmm0
callq 0x3050
addsd 0x10e6c(%rip), %xmm0    # 0x16068
mulsd 0x10e34(%rip), %xmm0    # 0x16038
divsd 0x10e34(%rip), %xmm0    # 0x16040
callq 0x3040
movq %rax, %rcx
movabsq $0x2d82d82d82d82d83, %rdx # imm = 0x2D82D82D82D82D83
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x6, %rdx
addq %rax, %rdx
imulq $0x168, %rdx, %rax      # imm = 0x168
subq %rax, %rcx
leal 0x168(%rcx), %eax
cmpq $-0x168, %rcx           # imm = 0xFE98
cmovbl %ecx, %eax
movq %rax, 0x1a8(%rsp)
movsd 0xa8(%rsp), %xmm0
addsd 0x10e0e(%rip), %xmm0    # 0x16070
movsd %xmm0, 0xa8(%rsp)
xorpd %xmm0, %xmm0
movsd 0x68(%rsp), %xmm1
ucomisd %xmm0, %xmm1
setp %al
setne %cl
orb %al, %cl
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
movsd %xmm0, 0x1a0(%rsp)
orb 0xc(%rsp), %cl
movb %cl, 0xb(%rsp)
movq $0x0, 0x138(%rsp)
movsd 0x10dcb(%rip), %xmm0    # 0x16078
movsd %xmm0, 0x130(%rsp)
movsd 0x10dc2(%rip), %xmm0    # 0x16080
movq $0x0, 0x128(%rsp)
xorl %ebx, %ebx
movsd %xmm0, 0xa0(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x120(%rsp)
movsd 0xa8(%rsp), %xmm0
ucomisd 0x10e0d(%rip), %xmm0    # 0x16100
jbe 0x5a7f
movq 0x1a8(%rsp), %rax
addl %ebx, %eax
cltq
imulq $-0x49f49f49, %rax, %rcx # imm = 0xB60B60B7
shrq $0x20, %rcx
addl %eax, %ecx
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x8, %ecx
addl %edx, %ecx
imull $0x168, %ecx, %ecx      # imm = 0x168
subl %ecx, %eax
movslq %eax, %rcx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x1b0(%rsp)
xorpd %xmm1, %xmm1
shlq $0x7, %rcx
leaq 0x18e2a(%rip), %rax     # 0x1e170
addq %rax, %rcx
movq %rcx, 0x1b8(%rsp)
xorl %r15d, %r15d
testl %ebx, %ebx
setne %al
testq %r15, %r15
sete %cl
testb %cl, %al
jne 0x5a61
movsd %xmm1, 0x150(%rsp)
movq %r15, %rax
shlq $0x4, %rax
movsd 0x68(%rsp), %xmm2
ucomisd 0x10d7b(%rip), %xmm2    # 0x16100
movupd (%r12), %xmm1
movq 0x1b8(%rsp), %rcx
addpd (%rax,%rcx), %xmm1
movapd %xmm1, 0x30(%rsp)
movq 0x140(%rsp), %rax
movsd (%rax), %xmm4
movsd 0x8(%rax), %xmm0
subsd %xmm1, %xmm4
movapd %xmm1, 0x70(%rsp)
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
movapd %xmm1, 0x170(%rsp)
subsd %xmm1, %xmm0
mulsd %xmm0, %xmm0
mulsd %xmm4, %xmm4
addsd %xmm0, %xmm4
movapd %xmm4, 0x10(%rsp)
jne 0x53e0
jnp 0x540f
movapd %xmm2, %xmm0
subsd %xmm4, %xmm0
movapd %xmm4, %xmm1
addsd 0x10c94(%rip), %xmm1    # 0x16088
movapd %xmm4, %xmm3
cmpltsd %xmm2, %xmm3
andpd %xmm3, %xmm0
andnpd %xmm1, %xmm3
orpd %xmm0, %xmm3
movapd %xmm3, 0x10(%rsp)
movsd %xmm4, 0x148(%rsp)
movq 0x58(%rsp), %rax
cmpq 0x50(%rsp), %rax
je 0x54ad
movq %r12, %rdi
leaq 0x30(%rsp), %rsi
leaq 0x158(%rsp), %rdx
movsd 0x10c50(%rip), %xmm0    # 0x16090
movl $0x1, %ecx
callq 0x43df
testl %eax, %eax
jne 0x5a61
movq 0x180(%rsp), %rax
movq 0x188(%rsp), %rcx
cmpq %rcx, %rax
je 0x54dd
movapd 0x70(%rsp), %xmm0
subsd 0x8(%rax), %xmm0
movapd 0x170(%rsp), %xmm1
subsd 0x10(%rax), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd 0x70(%rax), %xmm1
addsd 0x10b77(%rip), %xmm1    # 0x16010
mulsd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
ja 0x5a61
addq $0x78, %rax
jmp 0x5462
movq 0x88(%rsp), %rax
cmpq 0x80(%rsp), %rax
jne 0x5428
movapd 0x10(%rsp), %xmm0
ucomisd 0xa0(%rsp), %xmm0
jae 0x5a61
jmp 0x5428
cmpb $0x0, 0xc(%rsp)
je 0x57a7
movq 0x50(%rsp), %r14
movq 0x58(%rsp), %rbp
xorl %r13d, %r13d
cmpq %r14, %rbp
je 0x56f7
movsd 0x10b7a(%rip), %xmm0    # 0x16080
movsd %xmm0, 0x28(%rsp)
movl 0x24(%rsp), %eax
cmpl %eax, (%r14)
je 0x5545
movq %r12, %rdi
leaq 0x30(%rsp), %rsi
movq %r14, %rdx
callq 0x5cd0
xorl %eax, %eax
movsd 0x10b79(%rip), %xmm1    # 0x160a8
ucomisd %xmm0, %xmm1
minsd 0x28(%rsp), %xmm0
seta %al
addl %eax, %r13d
movsd %xmm0, 0x28(%rsp)
addq $0x78, %r14
cmpq %rbp, %r14
jne 0x550c
movq 0xb0(%rsp), %rax
movq 0xb8(%rsp), %rcx
cmpq %rcx, %rax
movsd 0x10b3f(%rip), %xmm2    # 0x160a8
movapd 0x70(%rsp), %xmm3
movapd 0x170(%rsp), %xmm4
movsd 0x28(%rsp), %xmm5
je 0x55be
movapd %xmm3, %xmm0
subsd (%rax), %xmm0
movapd %xmm4, %xmm1
subsd 0x8(%rax), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
xorl %edx, %edx
ucomisd %xmm0, %xmm2
minsd %xmm5, %xmm0
seta %dl
addl %edx, %r13d
addq $0x10, %rax
movapd %xmm0, %xmm5
cmpq %rcx, %rax
jne 0x5580
movsd 0x10aea(%rip), %xmm0    # 0x160b0
ucomisd %xmm5, %xmm0
jbe 0x56f7
movsd 0x148(%rsp), %xmm3
xorps %xmm0, %xmm0
sqrtsd %xmm3, %xmm0
movsd 0x1a0(%rsp), %xmm1
subsd %xmm0, %xmm1
addsd 0x10ac3(%rip), %xmm0    # 0x160b8
addsd 0x10a8b(%rip), %xmm1    # 0x16088
movsd 0x68(%rsp), %xmm2
cmpnlesd %xmm3, %xmm2
andpd %xmm2, %xmm1
andnpd %xmm0, %xmm2
orpd %xmm1, %xmm2
movapd %xmm2, 0x10(%rsp)
movsd 0x10a86(%rip), %xmm0    # 0x160a8
movapd %xmm5, %xmm6
ucomisd %xmm5, %xmm0
jbe 0x56b3
movq 0x100(%rsp), %rax
movq 0x108(%rsp), %rcx
cmpq %rcx, %rax
je 0x5695
movsd 0x10a33(%rip), %xmm0    # 0x16080
movapd 0x70(%rsp), %xmm3
movapd 0x170(%rsp), %xmm4
movapd %xmm0, %xmm1
movapd %xmm3, %xmm0
subsd 0x8(%rax), %xmm0
movapd %xmm4, %xmm2
subsd 0x10(%rax), %xmm2
mulsd %xmm2, %xmm2
mulsd %xmm0, %xmm0
addsd %xmm2, %xmm0
minsd %xmm1, %xmm0
addq $0x78, %rax
cmpq %rcx, %rax
jne 0x565c
ucomisd 0x109b5(%rip), %xmm0    # 0x16048
jbe 0x56b3
imull $0x4e20, %r13d, %eax    # imm = 0x4E20
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movapd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
movq 0x118(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0x68(%rax), %xmm0
mulsd 0x109f5(%rip), %xmm0    # 0x160c0
movsd 0x109c5(%rip), %xmm1    # 0x16098
addsd %xmm1, %xmm0
addsd 0x109e9(%rip), %xmm0    # 0x160c8
minsd %xmm0, %xmm6
mulsd %xmm1, %xmm6
movapd 0x10(%rsp), %xmm0
subsd %xmm6, %xmm0
movapd %xmm0, 0x10(%rsp)
cvtdq2pd 0x185e9(%rip), %xmm1    # 0x1dce8
movapd 0x70(%rsp), %xmm0
subpd %xmm0, %xmm1
minpd %xmm0, %xmm1
movapd 0x10b5b(%rip), %xmm0    # 0x16270
subpd %xmm1, %xmm0
xorpd %xmm1, %xmm1
cmpltpd %xmm0, %xmm1
movmskpd %xmm1, %eax
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm1
testb $0x1, %al
jne 0x5736
xorpd %xmm1, %xmm1
testb $0x2, %al
je 0x5742
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movapd %xmm0, %xmm2
movapd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
addsd %xmm2, %xmm0
movapd %xmm0, 0x10(%rsp)
cmpl $-0x1, 0x24(%rsp)
je 0x5823
movq %r12, %rdi
leaq 0x30(%rsp), %rsi
leaq 0x1c0(%rsp), %rdx
callq 0x5cd0
movsd 0x10952(%rip), %xmm1    # 0x160d0
ucomisd %xmm0, %xmm1
jbe 0x5823
movapd 0x10(%rsp), %xmm0
addsd 0x10942(%rip), %xmm0    # 0x160d8
movapd %xmm0, 0x10(%rsp)
movb $0x1, %al
movl %eax, 0x28(%rsp)
jmp 0x582b
movapd 0x70(%rsp), %xmm1
ucomisd 0x108e3(%rip), %xmm1    # 0x16098
jbe 0x5a61
xorps %xmm0, %xmm0
cvtsi2sdl 0x18522(%rip), %xmm0 # 0x1dce8
addsd 0x108d2(%rip), %xmm0    # 0x160a0
ucomisd %xmm1, %xmm0
jbe 0x5a61
movapd 0x170(%rsp), %xmm0
ucomisd 0x108af(%rip), %xmm0    # 0x16098
jbe 0x5a61
movapd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdl 0x184ee(%rip), %xmm0 # 0x1dcec
addsd 0x1089a(%rip), %xmm0    # 0x160a0
movl $0x0, 0x28(%rsp)
ucomisd %xmm1, %xmm0
movl $0x0, %r13d
ja 0x58df
jmp 0x5a61
movl $0x0, 0x28(%rsp)
movq 0x80(%rsp), %r14
movq 0x88(%rsp), %rbp
cmpq %r14, %rbp
je 0x58df
xorps %xmm0, %xmm0
sqrtsd 0x148(%rsp), %xmm0
movapd 0x10(%rsp), %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
addq $0x18, %r14
movq %r14, %rdi
callq 0xdb84
addsd -0x10(%r14), %xmm0
addsd -0x8(%r14), %xmm1
movapd 0x30(%rsp), %xmm3
movapd %xmm3, %xmm2
subsd %xmm0, %xmm2
movapd %xmm3, %xmm0
unpckhpd %xmm3, %xmm0            # xmm0 = xmm0[1],xmm3[1]
subsd %xmm1, %xmm0
mulsd %xmm0, %xmm0
mulsd %xmm2, %xmm2
addsd %xmm0, %xmm2
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
maxsd 0x10763(%rip), %xmm0    # 0x16010
sqrtsd %xmm0, %xmm0
mulsd 0x10827(%rip), %xmm0    # 0x160e0
movapd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
leaq 0x78(%r14), %rax
addq $0x60, %r14
cmpq %rbp, %r14
movq %rax, %r14
jne 0x5864
movapd %xmm3, 0x70(%rsp)
cmpb $0x0, 0xb(%rsp)
je 0x5965
movq 0xe0(%rsp), %rax
movq 0xe8(%rsp), %rcx
cmpq %rcx, %rax
je 0x5965
movapd 0x70(%rsp), %xmm5
movapd %xmm5, %xmm1
unpckhpd %xmm5, %xmm1            # xmm1 = xmm1[1],xmm5[1]
movsd 0x10717(%rip), %xmm3    # 0x16028
movsd 0x107cf(%rip), %xmm4    # 0x160e8
movapd 0x10(%rsp), %xmm6
movapd %xmm5, %xmm0
subsd 0x8(%rax), %xmm0
movapd %xmm1, %xmm2
subsd 0x10(%rax), %xmm2
mulsd %xmm2, %xmm2
mulsd %xmm0, %xmm0
addsd %xmm2, %xmm0
movapd %xmm6, %xmm2
addsd %xmm3, %xmm2
cmpltsd %xmm4, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm6, %xmm0
orpd %xmm2, %xmm0
addq $0x78, %rax
movapd %xmm0, %xmm6
cmpq %rcx, %rax
jne 0x591f
jmp 0x596b
movapd 0x10(%rsp), %xmm0
cmpb $0x0, 0xc(%rsp)
je 0x59b2
cmpb $0x1, 0x178b3(%rip)     # 0x1d22c
movq 0x150(%rsp), %xmm2
jne 0x5a17
cmpl $0x4, 0x17899(%rip)     # 0x1d228
jne 0x5a17
cmpb $0x1, 0x18348(%rip)     # 0x1dce4
jne 0x59bd
movq $0x0, 0xd8(%rsp)
movapd 0x70(%rsp), %xmm1
jmp 0x59da
movq 0x150(%rsp), %xmm2
jmp 0x5a17
movq $0x0, 0xd8(%rsp)
xorps %xmm1, %xmm1
cvtsi2sdl 0x18314(%rip), %xmm1 # 0x1dce8
subsd 0x70(%rsp), %xmm1
addsd 0x1070e(%rip), %xmm1    # 0x160f0
movsd %xmm1, 0xd0(%rsp)
ucomisd 0x1070d(%rip), %xmm1    # 0x16100
leaq 0xd8(%rsp), %rax
leaq 0xd0(%rsp), %rcx
cmovaq %rcx, %rax
movsd (%rax), %xmm1
mulsd 0x106e5(%rip), %xmm1    # 0x160f8
addsd %xmm1, %xmm0
movsd 0xa0(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x5a61
movl 0x28(%rsp), %eax
movq %rax, 0x128(%rsp)
movl %r13d, %eax
movq %rax, 0x138(%rsp)
movq %xmm2, 0x130(%rsp)
movsd 0x1b0(%rsp), %xmm1
movsd %xmm1, 0x120(%rsp)
movsd %xmm0, 0xa0(%rsp)
incq %r15
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
movsd 0xa8(%rsp), %xmm0
ucomisd %xmm1, %xmm0
ja 0x5354
incl %ebx
cmpl $0x168, %ebx            # imm = 0x168
jne 0x52e2
movq 0x118(%rsp), %rax
movl (%rax), %eax
xorl %ecx, %ecx
movq 0x198(%rsp), %rbx
movb %cl, 0x48(%rbx)
movl %ecx, 0x30(%rbx)
movb %cl, 0x34(%rbx)
movl $0x1, (%rbx)
movl %eax, 0x4(%rbx)
movsd 0x130(%rsp), %xmm0
movsd %xmm0, 0x8(%rbx)
movsd 0x120(%rsp), %xmm0
movsd %xmm0, 0x10(%rbx)
movl %ecx, 0x18(%rbx)
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x20(%rbx)
movq 0x128(%rsp), %rax
andb $0x1, %al
movb %al, 0x28(%rbx)
movq 0x138(%rsp), %rax
movl %eax, 0x2c(%rbx)
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x5b15
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x5b32
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x5b4f
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5b66
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0x5b83
movq 0x168(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x5ba0
movq 0x110(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x180(%rsp), %rdi
testq %rdi, %rdi
je 0x5bbd
movq 0x190(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq %rbx, %rax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5c00
jmp 0x5c00
jmp 0x5c00
movq %rax, %rbx
jmp 0x5c3d
movq %rax, %rbx
jmp 0x5c71
movq %rax, %rbx
jmp 0x5c5a
movq %rax, %rbx
jmp 0x5c8e
movq %rax, %rbx
jmp 0x5cab
jmp 0x5c00
jmp 0x5c00
jmp 0x5c00
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x5c20
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x5c3d
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x5c5a
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5c71
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0x5c8e
movq 0x168(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x5cab
movq 0x110(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x180(%rsp), %rdi
testq %rdi, %rdi
je 0x5cc8
movq 0x190(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq %rbx, %rdi
callq 0x33d0