// File: 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:
subq $0x678, %rsp            # imm = 0x678
movl %r8d, 0x138(%rsp)
movl %ecx, 0x13c(%rsp)
movq %rdx, %rax
movl 0x138(%rsp), %edx
movq %rax, 0x140(%rsp)
movq %rsi, %r8
movl 0x13c(%rsp), %esi
movq %rdi, %rax
movq 0x140(%rsp), %rdi
movq %rax, 0x148(%rsp)
movb %r9b, %cl
movq %rax, 0x150(%rsp)
movb 0x688(%rsp), %al
movl 0x680(%rsp), %r9d
movq %r8, 0x670(%rsp)
movq %rdi, 0x668(%rsp)
movsd %xmm0, 0x660(%rsp)
movsd %xmm1, 0x658(%rsp)
andb $0x1, %sil
movb %sil, 0x657(%rsp)
andb $0x1, %dl
movb %dl, 0x656(%rsp)
andb $0x1, %cl
movb %cl, 0x655(%rsp)
andb $0x1, %al
movb %al, 0x654(%rsp)
movsd 0x658(%rsp), %xmm0
mulsd %xmm0, %xmm0
movsd %xmm0, 0x658(%rsp)
movq 0x670(%rsp), %rax
movups 0x8(%rax), %xmm0
movaps %xmm0, 0x620(%rsp)
movsd 0x620(%rsp), %xmm0
movsd 0x628(%rsp), %xmm1
leaq 0x638(%rsp), %rdi
movsd 0x35e7a(%rip), %xmm2    # 0x3b010
movsd %xmm2, 0x158(%rsp)
movl $0x1, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %edx, 0x164(%rsp)
callq 0x3f40
movsd 0x158(%rsp), %xmm2
movl 0x164(%rsp), %edx
movq 0x670(%rsp), %rax
movups 0x8(%rax), %xmm0
movaps %xmm0, 0x5f0(%rsp)
movsd 0x5f0(%rsp), %xmm0
movsd 0x5f8(%rsp), %xmm1
leaq 0x608(%rsp), %rdi
movl $0x4, %esi
callq 0x3f40
jmp 0x51ff
movq 0x670(%rsp), %rax
movups 0x8(%rax), %xmm0
movaps %xmm0, 0x5b0(%rsp)
movq 0x670(%rsp), %rax
movl (%rax), %edx
movsd 0x5b0(%rsp), %xmm0
movsd 0x5b8(%rsp), %xmm1
leaq 0x5c8(%rsp), %rdi
movsd 0x35df9(%rip), %xmm2    # 0x3b038
movl $0x17, %esi
callq 0x3f40
jmp 0x524b
testb $0x1, 0x657(%rsp)
je 0x529e
movq 0x670(%rsp), %rax
movups 0x8(%rax), %xmm0
movaps %xmm0, 0x580(%rsp)
movsd 0x580(%rsp), %xmm0
movsd 0x588(%rsp), %xmm1
leaq 0x598(%rsp), %rdi
movsd 0x35db5(%rip), %xmm2    # 0x3b040
movl $0x8, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3f40
jmp 0x529c
jmp 0x52bf
leaq 0x598(%rsp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x3150
leaq 0x598(%rsp), %rdi
callq 0x12a00
movq 0x670(%rsp), %rax
movups 0x8(%rax), %xmm0
movaps %xmm0, 0x550(%rsp)
movsd 0x550(%rsp), %xmm0
movsd 0x558(%rsp), %xmm1
leaq 0x568(%rsp), %rdi
movsd 0x35d53(%rip), %xmm2    # 0x3b048
movl $0x10, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3f40
jmp 0x5306
testb $0x1, 0x656(%rsp)
je 0x5359
movq 0x670(%rsp), %rax
movups 0x8(%rax), %xmm0
movaps %xmm0, 0x520(%rsp)
movsd 0x520(%rsp), %xmm0
movsd 0x528(%rsp), %xmm1
leaq 0x538(%rsp), %rdi
movsd 0x35d0a(%rip), %xmm2    # 0x3b050
movl $0x6, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3f40
jmp 0x5357
jmp 0x537a
leaq 0x538(%rsp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x3150
leaq 0x538(%rsp), %rdi
callq 0x12a00
leaq 0x508(%rsp), %rdi
callq 0x13440
leaq 0x490(%rsp), %rdi
callq 0x13450
jmp 0x5396
testb $0x1, 0x654(%rsp)
je 0x5665
xorps %xmm0, %xmm0
movaps %xmm0, 0x120(%rsp)
movaps %xmm0, 0x470(%rsp)
movq $0x0, 0x480(%rsp)
leaq 0x470(%rsp), %rdi
movq %rdi, 0x118(%rsp)
callq 0x12a00
movq 0x118(%rsp), %rsi
leaq 0x538(%rsp), %rdi
callq 0x13480
movq 0x118(%rsp), %rdi
callq 0x12de0
movaps 0x120(%rsp), %xmm0
movaps %xmm0, 0x450(%rsp)
movq $0x0, 0x460(%rsp)
leaq 0x450(%rsp), %rdi
movq %rdi, 0x130(%rsp)
callq 0x12a00
movq 0x130(%rsp), %rsi
leaq 0x608(%rsp), %rdi
callq 0x13480
movq 0x130(%rsp), %rdi
callq 0x12de0
movq 0x670(%rsp), %rax
movups 0x8(%rax), %xmm0
movaps %xmm0, 0x420(%rsp)
movsd 0x420(%rsp), %xmm0
movsd 0x428(%rsp), %xmm1
leaq 0x438(%rsp), %rdi
movsd 0x35bc5(%rip), %xmm2    # 0x3b048
movl $0x4, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3f40
jmp 0x5494
leaq 0x568(%rsp), %rdi
leaq 0x438(%rsp), %rsi
movq %rsi, 0x110(%rsp)
callq 0x13480
movq 0x110(%rsp), %rdi
callq 0x12de0
movq 0x670(%rsp), %rax
movups 0x8(%rax), %xmm0
movaps %xmm0, 0x3f0(%rsp)
movsd 0x3f0(%rsp), %xmm0
movsd 0x3f8(%rsp), %xmm1
leaq 0x408(%rsp), %rdi
movsd 0x35b4c(%rip), %xmm2    # 0x3b040
movl $0x2, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3f40
jmp 0x5505
leaq 0x598(%rsp), %rdi
leaq 0x408(%rsp), %rsi
callq 0x13480
leaq 0x408(%rsp), %rdi
callq 0x12de0
leaq 0x5c8(%rsp), %rax
movq %rax, 0x3e8(%rsp)
movq 0x3e8(%rsp), %rdi
callq 0x12ed0
movq %rax, 0x3e0(%rsp)
movq 0x3e8(%rsp), %rdi
callq 0x12f00
movq %rax, 0x3d8(%rsp)
leaq 0x3e0(%rsp), %rdi
leaq 0x3d8(%rsp), %rsi
callq 0x12f30
testb $0x1, %al
jne 0x557f
jmp 0x5663
leaq 0x3e0(%rsp), %rdi
callq 0x12f70
movq %rax, 0x3d0(%rsp)
movq 0x3d0(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x20(%rax)
leaq 0x3e0(%rsp), %rdi
callq 0x12f80
jmp 0x5561
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x5e8(%rsp)
movl %eax, 0x5e4(%rsp)
jmp 0x69f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x5e8(%rsp)
movl %eax, 0x5e4(%rsp)
jmp 0x69e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x5e8(%rsp)
movl %eax, 0x5e4(%rsp)
jmp 0x69dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x5e8(%rsp)
movl %eax, 0x5e4(%rsp)
jmp 0x69cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x5e8(%rsp)
movl %eax, 0x5e4(%rsp)
jmp 0x69c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x5e8(%rsp)
movl %eax, 0x5e4(%rsp)
leaq 0x508(%rsp), %rdi
callq 0x13960
leaq 0x538(%rsp), %rdi
callq 0x12de0
jmp 0x69c2
jmp 0x5665
testb $0x1, 0x657(%rsp)
je 0x5929
leaq 0x598(%rsp), %rax
movq %rax, 0x3c8(%rsp)
movq 0x3c8(%rsp), %rdi
callq 0x12ed0
movq %rax, 0x3c0(%rsp)
movq 0x3c8(%rsp), %rdi
callq 0x12f00
movq %rax, 0x3b8(%rsp)
leaq 0x3c0(%rsp), %rdi
leaq 0x3b8(%rsp), %rsi
callq 0x12f30
testb $0x1, %al
jne 0x56cb
jmp 0x575f
leaq 0x3c0(%rsp), %rdi
callq 0x12f70
movq %rax, 0x3b0(%rsp)
movq 0x3b0(%rsp), %rax
movabsq $0x401c000000000000, %rcx # imm = 0x401C000000000000
movq %rcx, 0x20(%rax)
movq 0x3b0(%rsp), %rdi
addq $0x8, %rdi
movq 0x670(%rsp), %rsi
addq $0x8, %rsi
callq 0x134c0
movsd %xmm0, 0x108(%rsp)
jmp 0x571e
movsd 0x108(%rsp), %xmm0
callq 0x4f90
movsd %xmm0, 0x100(%rsp)
jmp 0x5737
movsd 0x100(%rsp), %xmm0
movq 0x3b0(%rsp), %rax
movsd %xmm0, 0x28(%rax)
leaq 0x3c0(%rsp), %rdi
callq 0x12f80
jmp 0x56ad
testb $0x1, 0x654(%rsp)
jne 0x5854
leaq 0x4ca1c(%rip), %rax     # 0x52190
movq %rax, 0x3a8(%rsp)
leaq 0x4ca0d(%rip), %rdi     # 0x52190
callq 0x13520
movq %rax, 0x3a0(%rsp)
leaq 0x4c9f9(%rip), %rdi     # 0x52190
callq 0x13550
movq %rax, 0x398(%rsp)
leaq 0x3a0(%rsp), %rdi
leaq 0x398(%rsp), %rsi
callq 0x13580
testb $0x1, %al
jne 0x57c2
jmp 0x5852
leaq 0x3a0(%rsp), %rdi
callq 0x135c0
movq %rax, 0x390(%rsp)
movq 0x390(%rsp), %rax
movl 0x10(%rax), %eax
cmpl 0x4c534(%rip), %eax     # 0x51d1c
je 0x583e
movq 0x670(%rsp), %rdi
addq $0x8, %rdi
movq 0x390(%rsp), %rsi
callq 0x12ac0
movsd %xmm0, 0xf8(%rsp)
jmp 0x580e
movsd 0xf8(%rsp), %xmm1
movsd 0x35821(%rip), %xmm0    # 0x3b040
ucomisd %xmm1, %xmm0
jbe 0x583e
movq 0x390(%rsp), %rsi
leaq 0x508(%rsp), %rdi
callq 0x135d0
jmp 0x583c
jmp 0x583e
jmp 0x5840
leaq 0x3a0(%rsp), %rdi
callq 0x13640
jmp 0x57a4
jmp 0x5854
cmpl $-0x1, 0x680(%rsp)
je 0x5927
leaq 0x598(%rsp), %rax
movq %rax, 0x388(%rsp)
movq 0x388(%rsp), %rdi
callq 0x12ed0
movq %rax, 0x380(%rsp)
movq 0x388(%rsp), %rdi
callq 0x12f00
movq %rax, 0x378(%rsp)
leaq 0x380(%rsp), %rdi
leaq 0x378(%rsp), %rsi
callq 0x12f30
testb $0x1, %al
jne 0x58b7
jmp 0x590a
leaq 0x380(%rsp), %rdi
callq 0x12f70
movq %rax, 0x370(%rsp)
movq 0x370(%rsp), %rax
movl (%rax), %eax
cmpl 0x680(%rsp), %eax
jne 0x58f9
movq 0x370(%rsp), %rsi
leaq 0x490(%rsp), %rdi
movl $0x78, %edx
callq 0x3220
jmp 0x58fb
leaq 0x380(%rsp), %rdi
callq 0x12f80
jmp 0x589c
movl 0x490(%rsp), %eax
cmpl 0x680(%rsp), %eax
je 0x5925
movl $0xffffffff, 0x680(%rsp) # imm = 0xFFFFFFFF
jmp 0x5927
jmp 0x5929
movq 0x670(%rsp), %rdi
addq $0x8, %rdi
movq 0x668(%rsp), %rsi
callq 0x13660
movsd %xmm0, 0xf0(%rsp)
jmp 0x594d
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x368(%rsp)
movl $0x168, 0x364(%rsp) # imm = 0x168
movabsq $0x41cdcd6500000000, %rax # imm = 0x41CDCD6500000000
movq %rax, 0x358(%rsp)
movq $0x0, 0x350(%rsp)
movq $0x0, 0x348(%rsp)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x340(%rsp)
movl $0x0, 0x33c(%rsp)
movb $0x0, 0x33b(%rsp)
movabsq $0x4019000000000000, %rax # imm = 0x4019000000000000
movq %rax, 0x330(%rsp)
movsd 0x368(%rsp), %xmm0
callq 0x4f90
movsd %xmm0, 0xe8(%rsp)
jmp 0x59e4
movsd 0xe8(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x32c(%rsp)
movl $0x0, 0x328(%rsp)
cmpl $0x168, 0x328(%rsp) # imm = 0x168
jge 0x68ff
movl 0x328(%rsp), %eax
addl 0x32c(%rsp), %eax
movl $0x168, %ecx            # imm = 0x168
cltd
idivl %ecx
movl %edx, 0x324(%rsp)
movl $0x0, 0x320(%rsp)
cvtsi2sdl 0x320(%rsp), %xmm1
movsd 0x3560b(%rip), %xmm0    # 0x3b058
addsd 0x660(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x68dd
cmpl $0x0, 0x320(%rsp)
jne 0x5a79
cmpl $0x0, 0x328(%rsp)
je 0x5a79
jmp 0x68c7
movq 0x670(%rsp), %rdi
addq $0x8, %rdi
movslq 0x324(%rsp), %rax
shlq $0x7, %rax
leaq 0x4c718(%rip), %rcx     # 0x521b0
addq %rax, %rcx
movslq 0x320(%rsp), %rax
shlq $0x4, %rax
movups (%rax,%rcx), %xmm0
movaps %xmm0, 0x300(%rsp)
movsd 0x300(%rsp), %xmm0
movsd 0x308(%rsp), %xmm1
callq 0x12fa0
movsd %xmm1, 0xd8(%rsp)
movsd %xmm0, 0xe0(%rsp)
jmp 0x5ade
movsd 0xd8(%rsp), %xmm0
movsd 0xe0(%rsp), %xmm1
movsd %xmm1, 0x310(%rsp)
movsd %xmm0, 0x318(%rsp)
movq 0x668(%rsp), %rdi
leaq 0x310(%rsp), %rsi
callq 0x133d0
movsd %xmm0, 0xd0(%rsp)
jmp 0x5b22
movsd 0xd0(%rsp), %xmm0
movsd %xmm0, 0x2f8(%rsp)
movsd 0x2f8(%rsp), %xmm0
movsd %xmm0, 0x2f0(%rsp)
movsd 0x658(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x5b5c
jp 0x5b5c
jmp 0x5bbd
movsd 0x2f0(%rsp), %xmm1
movsd 0x658(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x5b91
movsd 0x658(%rsp), %xmm0
subsd 0x2f0(%rsp), %xmm0
movsd %xmm0, 0xc8(%rsp)
jmp 0x5bab
movsd 0x354c7(%rip), %xmm0    # 0x3b060
addsd 0x2f0(%rsp), %xmm0
movsd %xmm0, 0xc8(%rsp)
movsd 0xc8(%rsp), %xmm0
movsd %xmm0, 0x2f0(%rsp)
leaq 0x598(%rsp), %rdi
callq 0x13690
cmpq $0x0, %rax
jne 0x5bfc
leaq 0x538(%rsp), %rdi
callq 0x13690
cmpq $0x0, %rax
jne 0x5bfc
movsd 0x2f0(%rsp), %xmm0
ucomisd 0x358(%rsp), %xmm0
jb 0x5bfc
jmp 0x68c7
movq 0x670(%rsp), %rdi
addq $0x8, %rdi
leaq 0x310(%rsp), %rsi
leaq 0x5c8(%rsp), %rdx
movsd 0x35448(%rip), %xmm0    # 0x3b068
movl $0x1, %ecx
callq 0x4670
movl %eax, 0xc4(%rsp)
jmp 0x5c33
movl 0xc4(%rsp), %eax
cmpl $0x0, %eax
je 0x5c44
jmp 0x68c7
movb $0x0, 0x2ef(%rsp)
leaq 0x638(%rsp), %rax
movq %rax, 0x2e0(%rsp)
movq 0x2e0(%rsp), %rdi
callq 0x12ed0
movq %rax, 0x2d8(%rsp)
movq 0x2e0(%rsp), %rdi
callq 0x12f00
movq %rax, 0x2d0(%rsp)
leaq 0x2d8(%rsp), %rdi
leaq 0x2d0(%rsp), %rsi
callq 0x12f30
testb $0x1, %al
jne 0x5ca4
jmp 0x5d38
leaq 0x2d8(%rsp), %rdi
callq 0x12f70
movq %rax, 0x2c8(%rsp)
movq 0x2c8(%rsp), %rsi
addq $0x8, %rsi
leaq 0x310(%rsp), %rdi
callq 0x133d0
movsd %xmm0, 0xb8(%rsp)
jmp 0x5cdd
movsd 0xb8(%rsp), %xmm1
movq 0x2c8(%rsp), %rax
movsd 0x3537a(%rip), %xmm0    # 0x3b070
addsd 0x70(%rax), %xmm0
movq 0x2c8(%rsp), %rax
movsd 0x35365(%rip), %xmm2    # 0x3b070
addsd 0x70(%rax), %xmm2
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x5d24
movb $0x1, 0x2ef(%rsp)
jmp 0x5d38
jmp 0x5d26
leaq 0x2d8(%rsp), %rdi
callq 0x12f80
jmp 0x5c86
testb $0x1, 0x2ef(%rsp)
je 0x5d47
jmp 0x68c7
testb $0x1, 0x657(%rsp)
jne 0x5d88
leaq 0x4bfd0(%rip), %rdi     # 0x51d28
leaq 0x310(%rsp), %rsi
movsd 0x35310(%rip), %xmm0    # 0x3b078
callq 0x136b0
movb %al, 0xb7(%rsp)
jmp 0x5d76
movb 0xb7(%rsp), %al
testb $0x1, %al
jne 0x5d88
jmp 0x5d83
jmp 0x68c7
movb $0x0, 0x2c7(%rsp)
movl $0x0, 0x2c0(%rsp)
testb $0x1, 0x657(%rsp)
je 0x6643
movsd 0x352cf(%rip), %xmm0    # 0x3b080
movsd %xmm0, 0x2b8(%rsp)
movl $0x0, 0x2b4(%rsp)
leaq 0x598(%rsp), %rdi
callq 0x13690
cmpq $0x0, %rax
je 0x6044
leaq 0x598(%rsp), %rax
movq %rax, 0x2a8(%rsp)
movq 0x2a8(%rsp), %rdi
callq 0x12ed0
movq %rax, 0x2a0(%rsp)
movq 0x2a8(%rsp), %rdi
callq 0x12f00
movq %rax, 0x298(%rsp)
leaq 0x2a0(%rsp), %rdi
leaq 0x298(%rsp), %rsi
callq 0x12f30
testb $0x1, %al
jne 0x5e34
jmp 0x5f11
leaq 0x2a0(%rsp), %rdi
callq 0x12f70
movq %rax, 0x290(%rsp)
movq 0x290(%rsp), %rax
movl (%rax), %eax
cmpl 0x680(%rsp), %eax
jne 0x5e61
jmp 0x5eff
movq 0x670(%rsp), %rdi
addq $0x8, %rdi
movq 0x290(%rsp), %rdx
leaq 0x310(%rsp), %rsi
callq 0x6a10
movsd %xmm0, 0xa8(%rsp)
jmp 0x5e8d
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x288(%rsp)
leaq 0x2b8(%rsp), %rdi
leaq 0x288(%rsp), %rsi
callq 0x13750
movq %rax, 0xa0(%rsp)
jmp 0x5ebe
movq 0xa0(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x2b8(%rsp)
movsd 0x288(%rsp), %xmm1
movsd 0x330(%rsp), %xmm0
ucomisd %xmm1, %xmm0
seta %al
andb $0x1, %al
movzbl %al, %eax
addl 0x2b4(%rsp), %eax
movl %eax, 0x2b4(%rsp)
leaq 0x2a0(%rsp), %rdi
callq 0x12f80
jmp 0x5e16
leaq 0x508(%rsp), %rax
movq %rax, 0x280(%rsp)
movq 0x280(%rsp), %rdi
callq 0x13790
movq %rax, 0x278(%rsp)
movq 0x280(%rsp), %rdi
callq 0x137c0
movq %rax, 0x270(%rsp)
leaq 0x278(%rsp), %rdi
leaq 0x270(%rsp), %rsi
callq 0x137f0
testb $0x1, %al
jne 0x5f69
jmp 0x6042
leaq 0x278(%rsp), %rdi
callq 0x13830
movq %rax, 0x268(%rsp)
movq 0x268(%rsp), %rsi
leaq 0x310(%rsp), %rdi
callq 0x12ac0
movsd %xmm0, 0x98(%rsp)
jmp 0x5f9e
movsd 0x98(%rsp), %xmm0
movsd %xmm0, 0x260(%rsp)
leaq 0x2b8(%rsp), %rdi
leaq 0x260(%rsp), %rsi
callq 0x13750
movq %rax, 0x90(%rsp)
jmp 0x5fcf
movq 0x90(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x2b8(%rsp)
movq 0x268(%rsp), %rsi
leaq 0x310(%rsp), %rdi
callq 0x12ac0
movsd %xmm0, 0x88(%rsp)
jmp 0x6004
movsd 0x88(%rsp), %xmm1
movsd 0x330(%rsp), %xmm0
ucomisd %xmm1, %xmm0
seta %al
andb $0x1, %al
movzbl %al, %eax
addl 0x2b4(%rsp), %eax
movl %eax, 0x2b4(%rsp)
leaq 0x278(%rsp), %rdi
callq 0x13840
jmp 0x5f4b
jmp 0x6044
movl 0x2b4(%rsp), %eax
movl %eax, 0x2c0(%rsp)
movsd 0x3502e(%rip), %xmm0    # 0x3b088
ucomisd 0x2b8(%rsp), %xmm0
jbe 0x62ed
movsd 0x34fef(%rip), %xmm0    # 0x3b060
movsd %xmm0, 0x2f0(%rsp)
movsd 0x2f8(%rsp), %xmm0
ucomisd 0x658(%rsp), %xmm0
jb 0x60ca
movsd 0x34fca(%rip), %xmm0    # 0x3b060
addsd 0x2f0(%rsp), %xmm0
movsd %xmm0, 0x2f0(%rsp)
movsd 0x2f8(%rsp), %xmm0
callq 0x3200
addsd 0x2f0(%rsp), %xmm0
movsd %xmm0, 0x2f0(%rsp)
jmp 0x6111
movsd 0x658(%rsp), %xmm0
callq 0x3200
movsd %xmm0, 0x80(%rsp)
movsd 0x2f8(%rsp), %xmm0
callq 0x3200
movaps %xmm0, %xmm1
movsd 0x80(%rsp), %xmm0
subsd %xmm1, %xmm0
addsd 0x2f0(%rsp), %xmm0
movsd %xmm0, 0x2f0(%rsp)
movsd 0x2b8(%rsp), %xmm1
movsd 0x330(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x6255
movsd 0x34f4b(%rip), %xmm0    # 0x3b080
movsd %xmm0, 0x258(%rsp)
leaq 0x608(%rsp), %rax
movq %rax, 0x250(%rsp)
movq 0x250(%rsp), %rdi
callq 0x12ed0
movq %rax, 0x248(%rsp)
movq 0x250(%rsp), %rdi
callq 0x12f00
movq %rax, 0x240(%rsp)
leaq 0x248(%rsp), %rdi
leaq 0x240(%rsp), %rsi
callq 0x12f30
testb $0x1, %al
jne 0x6196
jmp 0x621b
leaq 0x248(%rsp), %rdi
callq 0x12f70
movq %rax, 0x238(%rsp)
movq 0x238(%rsp), %rsi
addq $0x8, %rsi
leaq 0x310(%rsp), %rdi
callq 0x133d0
movsd %xmm0, 0x78(%rsp)
jmp 0x61cc
movsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x230(%rsp)
leaq 0x258(%rsp), %rdi
leaq 0x230(%rsp), %rsi
callq 0x13750
movq %rax, 0x70(%rsp)
jmp 0x61f7
movq 0x70(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x258(%rsp)
leaq 0x248(%rsp), %rdi
callq 0x12f80
jmp 0x6178
movsd 0x258(%rsp), %xmm0
movsd 0x34e0c(%rip), %xmm1    # 0x3b038
ucomisd %xmm1, %xmm0
jbe 0x6253
imull $0x4e20, 0x2b4(%rsp), %eax # imm = 0x4E20
cvtsi2sd %eax, %xmm0
addsd 0x2f0(%rsp), %xmm0
movsd %xmm0, 0x2f0(%rsp)
jmp 0x6255
movq 0x670(%rsp), %rax
cvtsi2sdl 0x68(%rax), %xmm0
movsd 0x34e26(%rip), %xmm1    # 0x3b090
mulsd %xmm1, %xmm0
movsd 0x34e02(%rip), %xmm1    # 0x3b078
addsd %xmm1, %xmm0
movsd 0x34e16(%rip), %xmm1    # 0x3b098
addsd %xmm1, %xmm0
movsd %xmm0, 0x228(%rsp)
leaq 0x228(%rsp), %rdi
leaq 0x2b8(%rsp), %rsi
callq 0x13750
movq %rax, 0x68(%rsp)
jmp 0x62ab
movq 0x68(%rsp), %rax
movsd (%rax), %xmm0
movsd 0x2f0(%rsp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x34d9c(%rip), %xmm2    # 0x3b078
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x2f0(%rsp)
cvtsi2sdl 0x4ba33(%rip), %xmm0 # 0x51d28
movsd 0x310(%rsp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x218(%rsp)
leaq 0x310(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x13750
movq %rax, 0x60(%rsp)
jmp 0x6327
movq 0x60(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x220(%rsp)
leaq 0x318(%rsp), %rdi
cvtsi2sdl 0x4b9e3(%rip), %xmm0 # 0x51d2c
movsd 0x318(%rsp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x208(%rsp)
leaq 0x208(%rsp), %rsi
callq 0x13750
movq %rax, 0x58(%rsp)
jmp 0x6373
movq 0x58(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x210(%rsp)
movq $0x0, 0x200(%rsp)
movsd 0x220(%rsp), %xmm1
movsd 0x34cfe(%rip), %xmm0    # 0x3b0a0
subsd %xmm1, %xmm0
movsd %xmm0, 0x1f8(%rsp)
leaq 0x200(%rsp), %rdi
leaq 0x1f8(%rsp), %rsi
callq 0x13860
movq %rax, 0x50(%rsp)
jmp 0x63cb
movq 0x50(%rsp), %rax
movsd (%rax), %xmm1
movsd 0x2f0(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x2f0(%rsp)
movq $0x0, 0x1f0(%rsp)
movsd 0x210(%rsp), %xmm1
movsd 0x34c99(%rip), %xmm0    # 0x3b0a0
subsd %xmm1, %xmm0
movsd %xmm0, 0x1e8(%rsp)
leaq 0x1f0(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0x13860
movq %rax, 0x48(%rsp)
jmp 0x6430
movq 0x48(%rsp), %rax
movsd (%rax), %xmm0
addsd 0x2f0(%rsp), %xmm0
movsd %xmm0, 0x2f0(%rsp)
cmpl $-0x1, 0x680(%rsp)
je 0x64b8
movq 0x670(%rsp), %rdi
addq $0x8, %rdi
leaq 0x310(%rsp), %rsi
leaq 0x490(%rsp), %rdx
callq 0x6a10
movsd %xmm0, 0x40(%rsp)
jmp 0x647e
movsd 0x40(%rsp), %xmm1
movsd 0x34c1c(%rip), %xmm0    # 0x3b0a8
ucomisd %xmm1, %xmm0
jbe 0x64b8
movsd 0x2f0(%rsp), %xmm0
movsd 0x34c0d(%rip), %xmm1    # 0x3b0b0
subsd %xmm1, %xmm0
movsd %xmm0, 0x2f0(%rsp)
movb $0x1, 0x2c7(%rsp)
leaq 0x538(%rsp), %rdi
callq 0x13690
cmpq $0x0, %rax
je 0x6641
movsd 0x2f8(%rsp), %xmm0
callq 0x3200
movaps %xmm0, %xmm1
movsd 0x2f0(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x2f0(%rsp)
leaq 0x538(%rsp), %rax
movq %rax, 0x1e0(%rsp)
movq 0x1e0(%rsp), %rdi
callq 0x12ed0
movq %rax, 0x1d8(%rsp)
movq 0x1e0(%rsp), %rdi
callq 0x12f00
movq %rax, 0x1d0(%rsp)
leaq 0x1d8(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
callq 0x12f30
testb $0x1, %al
jne 0x654e
jmp 0x663f
leaq 0x1d8(%rsp), %rdi
callq 0x12f70
movq %rax, 0x1c8(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x1c0(%rsp)
movq 0x1c8(%rsp), %rdi
callq 0x138a0
movsd %xmm1, 0x30(%rsp)
movsd %xmm0, 0x38(%rsp)
jmp 0x6590
movsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
movsd %xmm1, 0x1a8(%rsp)
movsd %xmm0, 0x1b0(%rsp)
leaq 0x310(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x12ac0
movsd %xmm0, 0x28(%rsp)
jmp 0x65cb
movsd 0x28(%rsp), %xmm0
xorps %xmm1, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x1b8(%rsp)
leaq 0x1c0(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x13860
movq %rax, 0x20(%rsp)
jmp 0x65fd
movq 0x20(%rsp), %rax
movsd (%rax), %xmm0
callq 0x3200
movsd 0x2f0(%rsp), %xmm1
movsd 0x34ab4(%rip), %xmm2    # 0x3b0d0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x2f0(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x12f80
jmp 0x6530
jmp 0x6641
jmp 0x6643
movsd 0x658(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x6665
jp 0x6665
testb $0x1, 0x657(%rsp)
je 0x6738
leaq 0x568(%rsp), %rax
movq %rax, 0x1a0(%rsp)
movq 0x1a0(%rsp), %rdi
callq 0x12ed0
movq %rax, 0x198(%rsp)
movq 0x1a0(%rsp), %rdi
callq 0x12f00
movq %rax, 0x190(%rsp)
leaq 0x198(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x12f30
testb $0x1, %al
jne 0x66ba
jmp 0x6736
leaq 0x198(%rsp), %rdi
callq 0x12f70
movq %rax, 0x188(%rsp)
movq 0x188(%rsp), %rsi
addq $0x8, %rsi
leaq 0x310(%rsp), %rdi
callq 0x133d0
movsd %xmm0, 0x18(%rsp)
jmp 0x66f0
movsd 0x18(%rsp), %xmm1
movsd 0x349ca(%rip), %xmm0    # 0x3b0c8
ucomisd %xmm1, %xmm0
jbe 0x6722
movsd 0x2f0(%rsp), %xmm0
movsd 0x34903(%rip), %xmm1    # 0x3b018
subsd %xmm1, %xmm0
movsd %xmm0, 0x2f0(%rsp)
jmp 0x6724
leaq 0x198(%rsp), %rdi
callq 0x12f80
jmp 0x669f
jmp 0x6738
testb $0x1, 0x657(%rsp)
je 0x6847
testb $0x1, 0x4ab27(%rip)     # 0x51274
je 0x6847
cmpl $0x4, 0x4ab16(%rip)     # 0x51270
jne 0x6847
testb $0x1, 0x4b5bd(%rip)     # 0x51d24
je 0x67c0
movq $0x0, 0x180(%rsp)
movsd 0x310(%rsp), %xmm0
movsd 0x34932(%rip), %xmm1    # 0x3b0b8
addsd %xmm1, %xmm0
movsd %xmm0, 0x178(%rsp)
leaq 0x180(%rsp), %rdi
leaq 0x178(%rsp), %rsi
callq 0x13860
movq %rax, 0x10(%rsp)
jmp 0x67af
movq 0x10(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
jmp 0x681f
movq $0x0, 0x170(%rsp)
cvtsi2sdl 0x4b554(%rip), %xmm0 # 0x51d28
movsd 0x310(%rsp), %xmm1
subsd %xmm1, %xmm0
movsd 0x348cf(%rip), %xmm1    # 0x3b0b8
addsd %xmm1, %xmm0
movsd %xmm0, 0x168(%rsp)
leaq 0x170(%rsp), %rdi
leaq 0x168(%rsp), %rsi
callq 0x13860
movq %rax, (%rsp)
jmp 0x6811
movq (%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
movsd 0x2f0(%rsp), %xmm1
movsd 0x3488a(%rip), %xmm2    # 0x3b0c0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x2f0(%rsp)
movsd 0x2f0(%rsp), %xmm1
movsd 0x358(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x68c5
movsd 0x2f8(%rsp), %xmm0
movsd %xmm0, 0x348(%rsp)
movb 0x2c7(%rsp), %al
andb $0x1, %al
movb %al, 0x33b(%rsp)
movl 0x2c0(%rsp), %eax
movl %eax, 0x33c(%rsp)
movsd 0x2f0(%rsp), %xmm0
movsd %xmm0, 0x358(%rsp)
cvtsi2sdl 0x324(%rsp), %xmm0
movsd %xmm0, 0x350(%rsp)
cvtsi2sdl 0x320(%rsp), %xmm0
movsd %xmm0, 0x340(%rsp)
jmp 0x68c7
movl 0x320(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x320(%rsp)
jmp 0x5a3c
jmp 0x68df
movl $0x168, %eax            # imm = 0x168
cltd
idivl 0x364(%rsp)
addl 0x328(%rsp), %eax
movl %eax, 0x328(%rsp)
jmp 0x5a03
movq 0x148(%rsp), %rdi
movq 0x670(%rsp), %rax
movl (%rax), %esi
movsd 0x340(%rsp), %xmm0
movsd 0x350(%rsp), %xmm1
callq 0x13910
jmp 0x692a
movq 0x148(%rsp), %rax
movsd 0x358(%rsp), %xmm0
movsd %xmm0, 0x20(%rax)
movb 0x33b(%rsp), %cl
andb $0x1, %cl
movb %cl, 0x28(%rax)
movl 0x33c(%rsp), %ecx
movl %ecx, 0x2c(%rax)
leaq 0x508(%rsp), %rdi
callq 0x13960
leaq 0x538(%rsp), %rdi
callq 0x12de0
leaq 0x568(%rsp), %rdi
callq 0x12de0
leaq 0x598(%rsp), %rdi
callq 0x12de0
leaq 0x5c8(%rsp), %rdi
callq 0x12de0
leaq 0x608(%rsp), %rdi
callq 0x12de0
leaq 0x638(%rsp), %rdi
callq 0x12de0
movq 0x150(%rsp), %rax
addq $0x678, %rsp            # imm = 0x678
retq
leaq 0x568(%rsp), %rdi
callq 0x12de0
leaq 0x598(%rsp), %rdi
callq 0x12de0
leaq 0x5c8(%rsp), %rdi
callq 0x12de0
leaq 0x608(%rsp), %rdi
callq 0x12de0
leaq 0x638(%rsp), %rdi
callq 0x12de0
movq 0x5e8(%rsp), %rdi
callq 0x3440