// File: ShootMe[P]Klondike-Solver/Solitaire.cpp
// Function: Solitaire::SolveFast(int, int, int)
SolveResult Solitaire::SolveFast(int maxClosedCount, int twoShift, int threeShift) {
	MakeAutoMoves();
	if (movesAvailableCount == 0) { return foundationCount == 52 ? SolvedMinimal : Impossible; }

	int openCount = 1;
	int maxFoundationCount = foundationCount;
	int bestSolutionMoveCount = 512;
	int totalOpenCount = 1;

	int powerOf2 = 1;
	while (maxClosedCount > (1 << (powerOf2 + 2))) {
		powerOf2++;
	}
	HashMap<int> closed(powerOf2);
	stack<shared_ptr<MoveNode>> open[512];
	Move movesToMake[512];
	Move bestSolution[512];
	bestSolution[0].Count = 255;
	int startMoves = MovesMadeNormalizedCount() + MinimumMovesLeft();
	int threeClosed = maxClosedCount >> threeShift;
	int twoClosed = maxClosedCount >> twoShift;
	shared_ptr<MoveNode> firstNode = movesMadeCount > 0 ? make_shared<MoveNode>(movesMade[movesMadeCount - 1]) : NULL;
	shared_ptr<MoveNode> node = firstNode;
	for (int i = movesMadeCount - 2; i >= 0; i--) {
		node->Parent = make_shared<MoveNode>(movesMade[i]);
		node = node->Parent;
	}
	open[startMoves].push(firstNode);
	while (closed.Size() < maxClosedCount) {
		//Check for lowest score length
		int index = startMoves;
		while (index < 512 && open[index].size() == 0) { index++; }

		//End solver if no more states
		if (index >= 512) { break; }

		//Get next state to evaluate
		openCount--;
		firstNode = open[index].top();
		open[index].pop();

		//Initialize game to the found state
		ResetGame(drawCount);
		int movesTotal = 0;
		node = firstNode;
		while (node != NULL) {
			movesToMake[movesTotal++] = node->Value;
			node = node->Parent;
		}
		while (movesTotal > 0) {
			MakeMove(movesToMake[--movesTotal]);
		}

		//Make any auto moves
		UpdateAvailableMoves();
		while (movesAvailableCount == 1) {
			Move move = movesAvailable[0];
			MakeMove(move);
			firstNode = make_shared<MoveNode>(move, firstNode);
			UpdateAvailableMoves();
		}
		movesTotal = MovesMadeNormalizedCount();

		//Check for best solution to foundations
		if (foundationCount > maxFoundationCount || (foundationCount == maxFoundationCount && bestSolutionMoveCount > movesTotal)) {
			bestSolutionMoveCount = movesTotal;
			maxFoundationCount = foundationCount;

			//Save solution
			for (int i = 0; i < movesMadeCount; i++) {
				bestSolution[i] = movesMade[i];
			}
			bestSolution[movesMadeCount].Count = 255;
		} else if (maxFoundationCount == 52) {
			//Dont check state if above or equal to current best solution
			int helper = MinimumMovesLeft();
			helper += movesTotal;
			if (helper >= bestSolutionMoveCount) { continue; }
		}

		//Make available moves and add them to be evaulated
		Move bestMove1, bestMove2, bestMove3;
		int bestMoveAdded1 = 512, bestMoveHelper1 = 512, bestMoveAdded2 = 512, bestMoveHelper2 = 512, bestMoveAdded3 = 512, bestMoveHelper3 = 512;
		for (int i = 0; i < movesAvailableCount; i++) {
			Move move = movesAvailable[i];
			int movesAdded = MovesAdded(move);

			MakeMove(move);

			movesAdded += movesTotal;
			movesAdded += MinimumMovesLeft();
			if (maxFoundationCount < 52 || movesAdded < bestSolutionMoveCount) {
				int helper = movesAdded;
				helper += 52 - foundationCount + roundCount;

				if (helper < bestMoveHelper1) {
					if (bestMoveHelper1 <= bestMoveHelper2) {
						if (bestMoveHelper2 <= bestMoveHelper3) {
							bestMove3 = bestMove2;
							bestMoveAdded3 = bestMoveAdded2;
							bestMoveHelper3 = bestMoveHelper2;
						}
						bestMove2 = bestMove1;
						bestMoveAdded2 = bestMoveAdded1;
						bestMoveHelper2 = bestMoveHelper1;
					} else if (bestMoveHelper1 <= bestMoveHelper3) {
						bestMove3 = bestMove1;
						bestMoveAdded3 = bestMoveAdded1;
						bestMoveHelper3 = bestMoveHelper1;
					}
					bestMove1 = move;
					bestMoveAdded1 = movesAdded;
					bestMoveHelper1 = helper;
				} else if (helper < bestMoveHelper2) {
					if (bestMoveHelper2 <= bestMoveHelper3) {
						bestMove3 = bestMove2;
						bestMoveAdded3 = bestMoveAdded2;
						bestMoveHelper3 = bestMoveHelper2;
					}
					bestMove2 = move;
					bestMoveAdded2 = movesAdded;
					bestMoveHelper2 = helper;
				} else if (helper < bestMoveHelper3) {
					bestMove3 = move;
					bestMoveAdded3 = movesAdded;
					bestMoveHelper3 = helper;
				}
			}

			UndoMove();
		}

		if (bestMoveHelper1 < 512) {
			MakeMove(bestMove1);

			HashKey key = GameState();
			KeyValue<int> * result = closed.Add(key, bestMoveAdded1);
			if (result == NULL || result->Value > bestMoveAdded1) {
				node = make_shared<MoveNode>(bestMove1, firstNode);
				if (result != NULL) { result->Value = bestMoveAdded1; }

				totalOpenCount++;
				openCount++;
				open[bestMoveHelper1].push(node);
			}

			UndoMove();
		}
		if (closed.Size() < twoClosed && bestMoveHelper2 < 512) {
			MakeMove(bestMove2);

			HashKey key = GameState();
			KeyValue<int> * result = closed.Add(key, bestMoveAdded2);
			if (result == NULL || result->Value > bestMoveAdded2) {
				node = make_shared<MoveNode>(bestMove2, firstNode);
				if (result != NULL) { result->Value = bestMoveAdded2; }

				totalOpenCount++;
				openCount++;
				open[bestMoveHelper2].push(node);
			}

			UndoMove();
		}
		if (closed.Size() < threeClosed && bestMoveHelper3 < 512) {
			MakeMove(bestMove3);

			HashKey key = GameState();
			KeyValue<int> * result = closed.Add(key, bestMoveAdded3);
			if (result == NULL || result->Value > bestMoveAdded3) {
				node = make_shared<MoveNode>(bestMove3, firstNode);
				if (result != NULL) { result->Value = bestMoveAdded3; }

				totalOpenCount++;
				openCount++;
				open[bestMoveHelper3].push(node);
			}

			UndoMove();
		}
	}

	//Reset game to best solution found
	ResetGame(drawCount);
	for (int i = 0; bestSolution[i].Count < 255; i++) {
		MakeMove(bestSolution[i]);
	}
	return maxFoundationCount == 52 ? SolvedMayNotBeMinimal : CouldNotComplete;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb2c0, %rsp           # imm = 0xB2C0
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xb1c8(%rbp)
callq 0x9260
movq -0xb1c8(%rbp), %rax
cmpl $0x0, 0x1910(%rax)
jne 0x9c2a
movq -0xb1c8(%rbp), %rax
movl 0x190c(%rax), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x34, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0xab5a
movq -0xb1c8(%rbp), %rax
movl $0x1, -0x20(%rbp)
movl 0x190c(%rax), %eax
movl %eax, -0x24(%rbp)
movl $0x200, -0x28(%rbp)     # imm = 0x200
movl $0x1, -0x2c(%rbp)
movl $0x1, -0x30(%rbp)
movl -0x14(%rbp), %eax
movl -0x30(%rbp), %ecx
addl $0x2, %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jle 0x9c77
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x9c56
movl -0x30(%rbp), %esi
leaq -0x50(%rbp), %rdi
callq 0xf2e0
leaq -0xa050(%rbp), %rax
movq %rax, -0xb1e0(%rbp)
movq %rax, %rcx
addq $0xa000, %rcx           # imm = 0xA000
movq %rcx, -0xb1d8(%rbp)
movq %rax, -0xb1d0(%rbp)
movq -0xb1d0(%rbp), %rdi
movq %rdi, -0xb1e8(%rbp)
callq 0xede0
jmp 0x9cbe
movq -0xb1d8(%rbp), %rcx
movq -0xb1e8(%rbp), %rax
addq $0x50, %rax
cmpq %rcx, %rax
movq %rax, -0xb1d0(%rbp)
jne 0x9ca9
leaq -0xa860(%rbp), %rax
movq %rax, %rcx
addq $0x800, %rcx            # imm = 0x800
movq %rcx, -0xb1f8(%rbp)
movq %rax, -0xb1f0(%rbp)
movq -0xb1f0(%rbp), %rdi
movq %rdi, -0xb200(%rbp)
callq 0x5900
jmp 0x9d10
movq -0xb1f8(%rbp), %rcx
movq -0xb200(%rbp), %rax
addq $0x4, %rax
cmpq %rcx, %rax
movq %rax, -0xb1f0(%rbp)
jne 0x9cfb
leaq -0xb060(%rbp), %rax
movq %rax, %rcx
addq $0x800, %rcx            # imm = 0x800
movq %rcx, -0xb210(%rbp)
movq %rax, -0xb208(%rbp)
movq -0xb208(%rbp), %rdi
movq %rdi, -0xb218(%rbp)
callq 0x5900
jmp 0x9d62
movq -0xb210(%rbp), %rcx
movq -0xb218(%rbp), %rax
addq $0x4, %rax
cmpq %rcx, %rax
movq %rax, -0xb208(%rbp)
jne 0x9d4d
movq -0xb1c8(%rbp), %rdi
movb $-0x1, -0xb05e(%rbp)
callq 0x7f50
movl %eax, -0xb21c(%rbp)
jmp 0x9d9b
movq -0xb1c8(%rbp), %rdi
callq 0x8130
movl %eax, -0xb220(%rbp)
jmp 0x9daf
movq -0xb1c8(%rbp), %rax
movl -0xb220(%rbp), %edx
movl -0xb21c(%rbp), %ecx
addl %edx, %ecx
movl %ecx, -0xb064(%rbp)
movl -0x14(%rbp), %edx
movl -0x1c(%rbp), %ecx
sarl %cl, %edx
movl %edx, %ecx
movl %ecx, -0xb068(%rbp)
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
sarl %cl, %edx
movl %edx, %ecx
movl %ecx, -0xb06c(%rbp)
cmpl $0x0, 0x1914(%rax)
jle 0x9e19
movq -0xb1c8(%rbp), %rax
movl 0x1914(%rax), %ecx
decl %ecx
movslq %ecx, %rcx
leaq (%rax,%rcx,4), %rsi
leaq -0xb080(%rbp), %rdi
callq 0xf6b0
jmp 0x9e17
jmp 0x9e29
leaq -0xb080(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5ab0
leaq -0xb090(%rbp), %rdi
leaq -0xb080(%rbp), %rsi
callq 0xf490
movq -0xb1c8(%rbp), %rax
movl 0x1914(%rax), %eax
subl $0x2, %eax
movl %eax, -0xb094(%rbp)
cmpl $0x0, -0xb094(%rbp)
jl 0x9f78
movq -0xb1c8(%rbp), %rax
movslq -0xb094(%rbp), %rcx
leaq (%rax,%rcx,4), %rsi
leaq -0xb0a8(%rbp), %rdi
callq 0xf6b0
jmp 0x9e7f
leaq -0xb090(%rbp), %rdi
callq 0xf020
movq %rax, %rdi
leaq -0xb0a8(%rbp), %rsi
callq 0x5ad0
leaq -0xb0a8(%rbp), %rdi
callq 0x5b00
leaq -0xb090(%rbp), %rdi
callq 0xf020
movq %rax, %rsi
leaq -0xb090(%rbp), %rdi
callq 0x5b20
movl -0xb094(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xb094(%rbp)
jmp 0x9e52
movq -0xb1e0(%rbp), %rcx
movq %rax, %rsi
movq -0xb1e8(%rbp), %rax
movq %rsi, -0xa058(%rbp)
movl %edx, -0xa05c(%rbp)
cmpq %rax, %rcx
movq %rax, -0xb228(%rbp)
je 0x9f2d
movq -0xb228(%rbp), %rdi
addq $-0x50, %rdi
movq %rdi, -0xb230(%rbp)
callq 0xee10
movq -0xb1e0(%rbp), %rcx
movq -0xb230(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0xb228(%rbp)
jne 0x9efc
jmp 0xab4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa058(%rbp)
movl %eax, -0xa05c(%rbp)
jmp 0xab01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa058(%rbp)
movl %eax, -0xa05c(%rbp)
leaq -0xb090(%rbp), %rdi
callq 0x5b00
leaq -0xb080(%rbp), %rdi
callq 0x5b00
jmp 0xab01
movslq -0xb064(%rbp), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq -0xa050(%rbp,%rax), %rdi
leaq -0xb080(%rbp), %rsi
callq 0xf2b0
jmp 0x9f9d
jmp 0x9f9f
leaq -0x50(%rbp), %rdi
callq 0xee50
movl %eax, -0xb234(%rbp)
jmp 0x9fb0
movl -0xb234(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xaa0d
movl -0xb064(%rbp), %eax
movl %eax, -0xb0ac(%rbp)
xorl %eax, %eax
cmpl $0x200, -0xb0ac(%rbp)   # imm = 0x200
movb %al, -0xb235(%rbp)
jge 0xa018
movslq -0xb0ac(%rbp), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq -0xa050(%rbp,%rax), %rdi
callq 0xeea0
movq %rax, -0xb240(%rbp)
jmp 0xa004
movq -0xb240(%rbp), %rax
cmpq $0x0, %rax
sete %al
movb %al, -0xb235(%rbp)
movb -0xb235(%rbp), %al
testb $0x1, %al
jne 0xa024
jmp 0xa035
movl -0xb0ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb0ac(%rbp)
jmp 0x9fcb
cmpl $0x200, -0xb0ac(%rbp)   # imm = 0x200
jl 0xa046
jmp 0xaa0d
movl -0x20(%rbp), %eax
decl %eax
movl %eax, -0x20(%rbp)
movslq -0xb0ac(%rbp), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq -0xa050(%rbp,%rax), %rdi
callq 0xefb0
movq %rax, -0xb248(%rbp)
jmp 0xa073
movq -0xb248(%rbp), %rsi
leaq -0xb080(%rbp), %rdi
callq 0x5b20
movslq -0xb0ac(%rbp), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq -0xa050(%rbp,%rax), %rdi
callq 0xefd0
jmp 0xa0a4
movq -0xb1c8(%rbp), %rdi
movl 0x1904(%rdi), %esi
callq 0x99e0
jmp 0xa0b8
movl $0x0, -0xb0b0(%rbp)
leaq -0xb090(%rbp), %rdi
leaq -0xb080(%rbp), %rsi
callq 0x5b20
leaq -0xb090(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xeff0
testb $0x1, %al
jne 0xa0eb
jmp 0xa134
leaq -0xb090(%rbp), %rdi
callq 0xf020
movq %rax, %rcx
movl -0xb0b0(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0xb0b0(%rbp)
cltq
movl 0x10(%rcx), %ecx
movl %ecx, -0xa860(%rbp,%rax,4)
leaq -0xb090(%rbp), %rdi
callq 0xf020
movq %rax, %rsi
leaq -0xb090(%rbp), %rdi
callq 0x5b20
jmp 0xa0d5
jmp 0xa136
cmpl $0x0, -0xb0b0(%rbp)
jle 0xa173
movq -0xb1c8(%rbp), %rdi
movslq -0xb0b0(%rbp), %rax
movl %eax, %ecx
decl %ecx
movl %ecx, -0xb0b0(%rbp)
movl -0xa864(%rbp,%rax,4), %eax
movl %eax, -0xb0b4(%rbp)
movl -0xb0b4(%rbp), %esi
callq 0x7150
jmp 0xa171
jmp 0xa136
movq -0xb1c8(%rbp), %rdi
callq 0x7380
jmp 0xa181
jmp 0xa183
movq -0xb1c8(%rbp), %rax
cmpl $0x1, 0x1910(%rax)
jne 0xa218
movq -0xb1c8(%rbp), %rdi
movl 0x1874(%rdi), %eax
movl %eax, -0xb0b8(%rbp)
movl -0xb0b8(%rbp), %eax
movl %eax, -0xb0bc(%rbp)
movl -0xb0bc(%rbp), %esi
callq 0x7150
jmp 0xa1c3
leaq -0xb0d0(%rbp), %rdi
leaq -0xb0b8(%rbp), %rsi
leaq -0xb080(%rbp), %rdx
callq 0xf040
jmp 0xa1df
leaq -0xb080(%rbp), %rdi
leaq -0xb0d0(%rbp), %rsi
movq %rsi, -0xb250(%rbp)
callq 0x5ad0
movq -0xb250(%rbp), %rdi
callq 0x5b00
movq -0xb1c8(%rbp), %rdi
callq 0x7380
jmp 0xa213
jmp 0xa183
movq -0xb1c8(%rbp), %rdi
callq 0x7f50
movl %eax, -0xb254(%rbp)
jmp 0xa22c
movq -0xb1c8(%rbp), %rax
movl -0xb254(%rbp), %ecx
movl %ecx, -0xb0b0(%rbp)
movl 0x190c(%rax), %eax
cmpl -0x24(%rbp), %eax
jg 0xa26f
movq -0xb1c8(%rbp), %rax
movl 0x190c(%rax), %eax
cmpl -0x24(%rbp), %eax
jne 0xa2ef
movl -0x28(%rbp), %eax
cmpl -0xb0b0(%rbp), %eax
jle 0xa2ef
movq -0xb1c8(%rbp), %rax
movl -0xb0b0(%rbp), %ecx
movl %ecx, -0x28(%rbp)
movl 0x190c(%rax), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0xb0d4(%rbp)
movq -0xb1c8(%rbp), %rcx
movl -0xb0d4(%rbp), %eax
cmpl 0x1914(%rcx), %eax
jge 0xa2d7
movq -0xb1c8(%rbp), %rcx
movslq -0xb0d4(%rbp), %rdx
movslq -0xb0d4(%rbp), %rax
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0xb060(%rbp,%rax,4)
movl -0xb0d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb0d4(%rbp)
jmp 0xa292
movq -0xb1c8(%rbp), %rax
movslq 0x1914(%rax), %rax
movb $-0x1, -0xb05e(%rbp,%rax,4)
jmp 0xa33b
cmpl $0x34, -0x24(%rbp)
jne 0xa339
movq -0xb1c8(%rbp), %rdi
callq 0x8130
movl %eax, -0xb258(%rbp)
jmp 0xa309
movl -0xb258(%rbp), %eax
movl %eax, -0xb0d8(%rbp)
movl -0xb0b0(%rbp), %eax
addl -0xb0d8(%rbp), %eax
movl %eax, -0xb0d8(%rbp)
movl -0xb0d8(%rbp), %eax
cmpl -0x28(%rbp), %eax
jl 0xa337
jmp 0x9f9f
jmp 0xa339
jmp 0xa33b
leaq -0xb0dc(%rbp), %rdi
callq 0x5900
jmp 0xa349
leaq -0xb0e0(%rbp), %rdi
callq 0x5900
jmp 0xa357
leaq -0xb0e4(%rbp), %rdi
callq 0x5900
jmp 0xa365
movl $0x200, -0xb0e8(%rbp)   # imm = 0x200
movl $0x200, -0xb0ec(%rbp)   # imm = 0x200
movl $0x200, -0xb0f0(%rbp)   # imm = 0x200
movl $0x200, -0xb0f4(%rbp)   # imm = 0x200
movl $0x200, -0xb0f8(%rbp)   # imm = 0x200
movl $0x200, -0xb0fc(%rbp)   # imm = 0x200
movl $0x0, -0xb100(%rbp)
movq -0xb1c8(%rbp), %rcx
movl -0xb100(%rbp), %eax
cmpl 0x1910(%rcx), %eax
jge 0xa635
movq -0xb1c8(%rbp), %rdi
movslq -0xb100(%rbp), %rax
movl 0x1874(%rdi,%rax,4), %eax
movl %eax, -0xb104(%rbp)
leaq -0xb104(%rbp), %rsi
callq 0x8480
movl %eax, -0xb25c(%rbp)
jmp 0xa3f3
movq -0xb1c8(%rbp), %rdi
movl -0xb25c(%rbp), %eax
movl %eax, -0xb108(%rbp)
movl -0xb104(%rbp), %eax
movl %eax, -0xb10c(%rbp)
movl -0xb10c(%rbp), %esi
callq 0x7150
jmp 0xa41f
movq -0xb1c8(%rbp), %rdi
movl -0xb0b0(%rbp), %ecx
movl -0xb108(%rbp), %eax
addl %ecx, %eax
movl %eax, -0xb108(%rbp)
callq 0x8130
movl %eax, -0xb260(%rbp)
jmp 0xa447
movl -0xb260(%rbp), %eax
addl -0xb108(%rbp), %eax
movl %eax, -0xb108(%rbp)
cmpl $0x34, -0x24(%rbp)
jl 0xa46e
movl -0xb108(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0xa611
movq -0xb1c8(%rbp), %rcx
movl -0xb108(%rbp), %eax
movl %eax, -0xb110(%rbp)
movl $0x34, %eax
subl 0x190c(%rcx), %eax
addl 0x1908(%rcx), %eax
addl -0xb110(%rbp), %eax
movl %eax, -0xb110(%rbp)
movl -0xb110(%rbp), %eax
cmpl -0xb0ec(%rbp), %eax
jge 0xa573
movl -0xb0ec(%rbp), %eax
cmpl -0xb0f4(%rbp), %eax
jg 0xa516
movl -0xb0f4(%rbp), %eax
cmpl -0xb0fc(%rbp), %eax
jg 0xa4f0
movl -0xb0e0(%rbp), %eax
movl %eax, -0xb0e4(%rbp)
movl -0xb0f0(%rbp), %eax
movl %eax, -0xb0f8(%rbp)
movl -0xb0f4(%rbp), %eax
movl %eax, -0xb0fc(%rbp)
movl -0xb0dc(%rbp), %eax
movl %eax, -0xb0e0(%rbp)
movl -0xb0e8(%rbp), %eax
movl %eax, -0xb0f0(%rbp)
movl -0xb0ec(%rbp), %eax
movl %eax, -0xb0f4(%rbp)
jmp 0xa54a
movl -0xb0ec(%rbp), %eax
cmpl -0xb0fc(%rbp), %eax
jg 0xa548
movl -0xb0dc(%rbp), %eax
movl %eax, -0xb0e4(%rbp)
movl -0xb0e8(%rbp), %eax
movl %eax, -0xb0f8(%rbp)
movl -0xb0ec(%rbp), %eax
movl %eax, -0xb0fc(%rbp)
jmp 0xa54a
movl -0xb104(%rbp), %eax
movl %eax, -0xb0dc(%rbp)
movl -0xb108(%rbp), %eax
movl %eax, -0xb0e8(%rbp)
movl -0xb110(%rbp), %eax
movl %eax, -0xb0ec(%rbp)
jmp 0xa60f
movl -0xb110(%rbp), %eax
cmpl -0xb0f4(%rbp), %eax
jge 0xa5d9
movl -0xb0f4(%rbp), %eax
cmpl -0xb0fc(%rbp), %eax
jg 0xa5b3
movl -0xb0e0(%rbp), %eax
movl %eax, -0xb0e4(%rbp)
movl -0xb0f0(%rbp), %eax
movl %eax, -0xb0f8(%rbp)
movl -0xb0f4(%rbp), %eax
movl %eax, -0xb0fc(%rbp)
movl -0xb104(%rbp), %eax
movl %eax, -0xb0e0(%rbp)
movl -0xb108(%rbp), %eax
movl %eax, -0xb0f0(%rbp)
movl -0xb110(%rbp), %eax
movl %eax, -0xb0f4(%rbp)
jmp 0xa60d
movl -0xb110(%rbp), %eax
cmpl -0xb0fc(%rbp), %eax
jge 0xa60b
movl -0xb104(%rbp), %eax
movl %eax, -0xb0e4(%rbp)
movl -0xb108(%rbp), %eax
movl %eax, -0xb0f8(%rbp)
movl -0xb110(%rbp), %eax
movl %eax, -0xb0fc(%rbp)
jmp 0xa60d
jmp 0xa60f
jmp 0xa611
movq -0xb1c8(%rbp), %rdi
callq 0x89a0
jmp 0xa61f
jmp 0xa621
movl -0xb100(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb100(%rbp)
jmp 0xa3ab
cmpl $0x200, -0xb0ec(%rbp)   # imm = 0x200
jge 0xa764
movq -0xb1c8(%rbp), %rdi
movl -0xb0dc(%rbp), %eax
movl %eax, -0xb114(%rbp)
movl -0xb114(%rbp), %esi
callq 0x7150
jmp 0xa665
movq -0xb1c8(%rbp), %rsi
leaq -0xb129(%rbp), %rdi
callq 0x8600
jmp 0xa67a
leaq -0x50(%rbp), %rdi
leaq -0xb129(%rbp), %rsi
leaq -0xb0e8(%rbp), %rdx
callq 0xf0c0
movq %rax, -0xb268(%rbp)
jmp 0xa69a
movq -0xb268(%rbp), %rax
movq %rax, -0xb138(%rbp)
cmpq $0x0, -0xb138(%rbp)
je 0xa6c8
movq -0xb138(%rbp), %rax
movl 0x20(%rax), %eax
cmpl -0xb0e8(%rbp), %eax
jle 0xa754
leaq -0xb148(%rbp), %rdi
leaq -0xb0dc(%rbp), %rsi
leaq -0xb080(%rbp), %rdx
callq 0xf040
jmp 0xa6e4
leaq -0xb090(%rbp), %rdi
leaq -0xb148(%rbp), %rsi
callq 0x5ad0
leaq -0xb148(%rbp), %rdi
callq 0x5b00
cmpq $0x0, -0xb138(%rbp)
je 0xa71d
movl -0xb0e8(%rbp), %ecx
movq -0xb138(%rbp), %rax
movl %ecx, 0x20(%rax)
movl -0x2c(%rbp), %eax
incl %eax
movl %eax, -0x2c(%rbp)
movl -0x20(%rbp), %eax
incl %eax
movl %eax, -0x20(%rbp)
movslq -0xb0ec(%rbp), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq -0xa050(%rbp,%rax), %rdi
leaq -0xb090(%rbp), %rsi
callq 0xf2b0
jmp 0xa752
jmp 0xa754
movq -0xb1c8(%rbp), %rdi
callq 0x89a0
jmp 0xa762
jmp 0xa764
leaq -0x50(%rbp), %rdi
callq 0xee50
movl %eax, -0xb26c(%rbp)
jmp 0xa775
movl -0xb26c(%rbp), %eax
cmpl -0xb06c(%rbp), %eax
jge 0xa8b6
cmpl $0x200, -0xb0f4(%rbp)   # imm = 0x200
jge 0xa8b6
movq -0xb1c8(%rbp), %rdi
movl -0xb0e0(%rbp), %eax
movl %eax, -0xb14c(%rbp)
movl -0xb14c(%rbp), %esi
callq 0x7150
jmp 0xa7b7
movq -0xb1c8(%rbp), %rsi
leaq -0xb161(%rbp), %rdi
callq 0x8600
jmp 0xa7cc
leaq -0x50(%rbp), %rdi
leaq -0xb161(%rbp), %rsi
leaq -0xb0f0(%rbp), %rdx
callq 0xf0c0
movq %rax, -0xb278(%rbp)
jmp 0xa7ec
movq -0xb278(%rbp), %rax
movq %rax, -0xb170(%rbp)
cmpq $0x0, -0xb170(%rbp)
je 0xa81a
movq -0xb170(%rbp), %rax
movl 0x20(%rax), %eax
cmpl -0xb0f0(%rbp), %eax
jle 0xa8a6
leaq -0xb180(%rbp), %rdi
leaq -0xb0e0(%rbp), %rsi
leaq -0xb080(%rbp), %rdx
callq 0xf040
jmp 0xa836
leaq -0xb090(%rbp), %rdi
leaq -0xb180(%rbp), %rsi
callq 0x5ad0
leaq -0xb180(%rbp), %rdi
callq 0x5b00
cmpq $0x0, -0xb170(%rbp)
je 0xa86f
movl -0xb0f0(%rbp), %ecx
movq -0xb170(%rbp), %rax
movl %ecx, 0x20(%rax)
movl -0x2c(%rbp), %eax
incl %eax
movl %eax, -0x2c(%rbp)
movl -0x20(%rbp), %eax
incl %eax
movl %eax, -0x20(%rbp)
movslq -0xb0f4(%rbp), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq -0xa050(%rbp,%rax), %rdi
leaq -0xb090(%rbp), %rsi
callq 0xf2b0
jmp 0xa8a4
jmp 0xa8a6
movq -0xb1c8(%rbp), %rdi
callq 0x89a0
jmp 0xa8b4
jmp 0xa8b6
leaq -0x50(%rbp), %rdi
callq 0xee50
movl %eax, -0xb27c(%rbp)
jmp 0xa8c7
movl -0xb27c(%rbp), %eax
cmpl -0xb068(%rbp), %eax
jge 0xaa08
cmpl $0x200, -0xb0fc(%rbp)   # imm = 0x200
jge 0xaa08
movq -0xb1c8(%rbp), %rdi
movl -0xb0e4(%rbp), %eax
movl %eax, -0xb184(%rbp)
movl -0xb184(%rbp), %esi
callq 0x7150
jmp 0xa909
movq -0xb1c8(%rbp), %rsi
leaq -0xb199(%rbp), %rdi
callq 0x8600
jmp 0xa91e
leaq -0x50(%rbp), %rdi
leaq -0xb199(%rbp), %rsi
leaq -0xb0f8(%rbp), %rdx
callq 0xf0c0
movq %rax, -0xb288(%rbp)
jmp 0xa93e
movq -0xb288(%rbp), %rax
movq %rax, -0xb1a8(%rbp)
cmpq $0x0, -0xb1a8(%rbp)
je 0xa96c
movq -0xb1a8(%rbp), %rax
movl 0x20(%rax), %eax
cmpl -0xb0f8(%rbp), %eax
jle 0xa9f8
leaq -0xb1b8(%rbp), %rdi
leaq -0xb0e4(%rbp), %rsi
leaq -0xb080(%rbp), %rdx
callq 0xf040
jmp 0xa988
leaq -0xb090(%rbp), %rdi
leaq -0xb1b8(%rbp), %rsi
callq 0x5ad0
leaq -0xb1b8(%rbp), %rdi
callq 0x5b00
cmpq $0x0, -0xb1a8(%rbp)
je 0xa9c1
movl -0xb0f8(%rbp), %ecx
movq -0xb1a8(%rbp), %rax
movl %ecx, 0x20(%rax)
movl -0x2c(%rbp), %eax
incl %eax
movl %eax, -0x2c(%rbp)
movl -0x20(%rbp), %eax
incl %eax
movl %eax, -0x20(%rbp)
movslq -0xb0fc(%rbp), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq -0xa050(%rbp,%rax), %rdi
leaq -0xb090(%rbp), %rsi
callq 0xf2b0
jmp 0xa9f6
jmp 0xa9f8
movq -0xb1c8(%rbp), %rdi
callq 0x89a0
jmp 0xaa06
jmp 0xaa08
jmp 0x9f9f
movq -0xb1c8(%rbp), %rdi
movl 0x1904(%rdi), %esi
callq 0x99e0
jmp 0xaa21
movl $0x0, -0xb1bc(%rbp)
movslq -0xb1bc(%rbp), %rax
movzbl -0xb05e(%rbp,%rax,4), %eax
cmpl $0xff, %eax
jge 0xaa7c
movq -0xb1c8(%rbp), %rdi
movslq -0xb1bc(%rbp), %rax
movl -0xb060(%rbp,%rax,4), %eax
movl %eax, -0xb1c0(%rbp)
movl -0xb1c0(%rbp), %esi
callq 0x7150
jmp 0xaa69
jmp 0xaa6b
movl -0xb1bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb1bc(%rbp)
jmp 0xaa2b
movl -0x24(%rbp), %edx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x34, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
leaq -0xb090(%rbp), %rdi
callq 0x5b00
leaq -0xb080(%rbp), %rdi
callq 0x5b00
leaq -0xa050(%rbp), %rax
movq %rax, -0xb298(%rbp)
addq $0xa000, %rax           # imm = 0xA000
movq %rax, -0xb290(%rbp)
movq -0xb290(%rbp), %rdi
addq $-0x50, %rdi
movq %rdi, -0xb2a0(%rbp)
callq 0xee10
movq -0xb298(%rbp), %rcx
movq -0xb2a0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0xb290(%rbp)
jne 0xaac5
leaq -0x50(%rbp), %rdi
callq 0xf620
jmp 0xab5a
leaq -0xa050(%rbp), %rax
movq %rax, -0xb2b0(%rbp)
addq $0xa000, %rax           # imm = 0xA000
movq %rax, -0xb2a8(%rbp)
movq -0xb2a8(%rbp), %rdi
addq $-0x50, %rdi
movq %rdi, -0xb2b8(%rbp)
callq 0xee10
movq -0xb2b0(%rbp), %rcx
movq -0xb2b8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0xb2a8(%rbp)
jne 0xab1c
jmp 0xab4f
leaq -0x50(%rbp), %rdi
callq 0xf620
jmp 0xab66
movl -0x4(%rbp), %eax
addq $0xb2c0, %rsp           # imm = 0xB2C0
popq %rbp
retq
movq -0xa058(%rbp), %rdi
callq 0x33d0
nopw %cs:(%rax,%rax)