// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb0d8, %rsp           # imm = 0xB0D8
movl %ecx, %r15d
movl %edx, %r14d
movl %esi, %r13d
movq %rdi, %rbx
callq 0x5658
cmpl $0x0, 0x1910(%rbx)
movl 0x190c(%rbx), %ebp
je 0x5d3a
xorl %ecx, %ecx
incl %ecx
movl $0x4, %eax
shll %cl, %eax
cmpl %r13d, %eax
jl 0x5c35
leaq 0xa0(%rsp), %rdi
movl %ecx, %esi
callq 0x9248
xorl %r12d, %r12d
leaq (%rsp,%r12), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x952c
addq $0x50, %r12
cmpq $0xa000, %r12           # imm = 0xA000
jne 0x5c55
xorl %r12d, %r12d
leaq (%rsp,%r12), %rdi
addq $0x8d0, %rdi            # imm = 0x8D0
callq 0x373c
addq $0x4, %r12
cmpq $0x800, %r12            # imm = 0x800
jne 0x5c8d
xorl %r12d, %r12d
leaq (%rsp,%r12), %rdi
addq $0xd0, %rdi
callq 0x373c
addq $0x4, %r12
cmpq $0x800, %r12            # imm = 0x800
jne 0x5cad
movb $-0x1, 0xd2(%rsp)
movq %rbx, %rdi
callq 0x4bfc
movl %eax, %r12d
movq %rbx, %rdi
callq 0x4cb4
movl %eax, 0x54(%rsp)
movl %r13d, %eax
movl %r15d, %ecx
sarl %cl, %eax
movl %eax, 0x98(%rsp)
movl %r13d, %eax
movl %r14d, %ecx
sarl %cl, %eax
movl %eax, 0x9c(%rsp)
movl 0x1914(%rbx), %eax
testl %eax, %eax
movl %r12d, 0x14(%rsp)
jle 0x5d47
decl %eax
leaq (%rbx,%rax,4), %rcx
leaq 0x68(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x60(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x9b54
jmp 0x5d4f
xorl %ebx, %ebx
cmpl $0x34, %ebp
sete %bl
jmp 0x662f
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq 0x60(%rsp), %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x30(%rsp)
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0x5d7d
movq 0x8261(%rip), %rcx      # 0xdfd0
cmpb $0x0, (%rcx)
je 0x5d79
incl 0x8(%rax)
jmp 0x5d7d
lock
incl 0x8(%rax)
movl %r13d, 0x94(%rsp)
movl 0x1914(%rbx), %r14d
cmpl $0x2, %r14d
jl 0x5e1d
addl $-0x2, %r14d
leaq (%rbx,%r14,4), %r15
incq %r14
leaq 0x70(%rsp), %r12
leaq 0x40(%rsp), %r13
movq $0x0, 0x70(%rsp)
leaq 0x78(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x9b54
movq 0x30(%rsp), %rax
movaps 0x70(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x70(%rsp)
movq 0x8(%rax), %rdi
movups %xmm0, (%rax)
testq %rdi, %rdi
je 0x5dea
callq 0x3794
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x5df9
callq 0x3794
movq 0x30(%rsp), %rsi
movq (%rsi), %rax
movq %rax, 0x30(%rsp)
addq $0x8, %rsi
leaq 0x38(%rsp), %rdi
callq 0x3804
addq $-0x4, %r15
decq %r14
jg 0x5dab
movl 0x54(%rsp), %eax
addl 0x14(%rsp), %eax
movl %eax, 0x54(%rsp)
movslq %eax, %r15
leaq (%r15,%r15,4), %r14
shlq $0x4, %r14
leaq (%rsp,%r14), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
leaq 0x60(%rsp), %rsi
callq 0x9808
leaq 0x10d0(%rsp), %rax
addq %r14, %rax
addq $0x48, %rax
movq %rax, 0xc0(%rsp)
incq %r15
movq %r15, 0xc8(%rsp)
movl $0x200, 0x58(%rsp)      # imm = 0x200
movl 0x94(%rsp), %r13d
cmpl %r13d, 0xa8(%rsp)
jge 0x659b
movl 0x54(%rsp), %eax
movl %eax, %r14d
cmpl $0x1ff, %eax            # imm = 0x1FF
jg 0x5f03
movq 0xc8(%rsp), %rax
movq 0xc0(%rsp), %rcx
movl 0x54(%rsp), %r14d
movq (%rcx), %rdx
movq %rdx, %rsi
subq -0x20(%rcx), %rsi
shrq $0x3, %rsi
cmpq $0x1, %rdx
adcq $-0x1, %rsi
shlq $0x5, %rsi
movq -0x28(%rcx), %rdx
movq -0x18(%rcx), %rdi
subq -0x10(%rcx), %rdi
sarq $0x4, %rdi
addq %rsi, %rdi
subq -0x38(%rcx), %rdx
sarq $0x4, %rdx
addq %rdi, %rdx
jne 0x5f03
incl %r14d
addq $0x50, %rcx
movq %rax, %rdx
incq %rdx
cmpl $0x200, %eax            # imm = 0x200
movq %rdx, %rax
jne 0x5eac
movl $0x200, %r14d           # imm = 0x200
cmpl $0x1ff, %r14d           # imm = 0x1FF
jle 0x5f15
movl %ebp, 0x14(%rsp)
jmp 0x6556
movslq %r14d, %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rsp,%rax), %r15
addq $0x10d0, %r15           # imm = 0x10D0
movq 0x30(%r15), %rsi
cmpq 0x38(%r15), %rsi
jne 0x5f45
movq 0x48(%r15), %rax
movq -0x8(%rax), %rsi
movl $0x200, %eax            # imm = 0x200
addq %rax, %rsi
movq -0x10(%rsi), %rax
movq %rax, 0x60(%rsp)
addq $-0x8, %rsi
leaq 0x68(%rsp), %r12
movq %r12, %rdi
callq 0x3804
movq %r15, %rdi
callq 0x96a4
movl 0x1904(%rbx), %esi
movq %rbx, %rdi
callq 0x5aae
movq 0x60(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x38(%rsp), %rdi
movq %r12, %rsi
callq 0x3804
movq 0x30(%rsp), %rsi
xorl %r15d, %r15d
testq %rsi, %rsi
je 0x5fcd
leaq 0x38(%rsp), %r12
movl 0x10(%rsi), %eax
movl %eax, 0x8d0(%rsp,%r15,4)
incq %r15
movq (%rsi), %rax
movq %rax, 0x30(%rsp)
addq $0x8, %rsi
movq %r12, %rdi
callq 0x3804
movq 0x30(%rsp), %rsi
testq %rsi, %rsi
jne 0x5f9e
movl %r15d, %r15d
testl %r15d, %r15d
jle 0x5fe7
movl 0x8cc(%rsp,%r15,4), %esi
decq %r15
movq %rbx, %rdi
callq 0x42a4
jmp 0x5fcd
movq %rbx, %rdi
callq 0x4456
cmpl $0x1, 0x1910(%rbx)
leaq 0x70(%rsp), %r15
jne 0x6075
movl 0x1874(%rbx), %esi
movl %esi, 0x40(%rsp)
movq %rbx, %rdi
callq 0x42a4
movq $0x0, 0x70(%rsp)
leaq 0x78(%rsp), %rdi
movq %r15, %rsi
leaq 0x2c(%rsp), %rdx
leaq 0x40(%rsp), %rcx
leaq 0x60(%rsp), %r8
callq 0x9718
movaps 0x70(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x70(%rsp)
movq 0x68(%rsp), %rdi
movaps %xmm0, 0x60(%rsp)
testq %rdi, %rdi
je 0x6055
callq 0x3794
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x6064
callq 0x3794
movq %rbx, %rdi
callq 0x4456
cmpl $0x1, 0x1910(%rbx)
je 0x5ffd
movq %rbx, %rdi
callq 0x4bfc
movl %eax, 0x5c(%rsp)
movl 0x190c(%rbx), %eax
movl %eax, 0x14(%rsp)
cmpl %ebp, %eax
jg 0x60a8
sete %al
movl 0x5c(%rsp), %ecx
cmpl %ecx, 0x58(%rsp)
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x656d
movslq 0x1914(%rbx), %r15
testq %r15, %r15
jle 0x60cc
leaq (,%r15,4), %rdx
leaq 0xd0(%rsp), %rdi
movq %rbx, %rsi
callq 0x2180
movb $-0x1, 0xd2(%rsp,%r15,4)
movl 0x5c(%rsp), %eax
movl %eax, 0x58(%rsp)
leaq 0x70(%rsp), %r15
leaq 0x2c(%rsp), %rdi
callq 0x373c
leaq 0x28(%rsp), %rdi
callq 0x373c
leaq 0x24(%rsp), %rdi
callq 0x373c
movl $0x200, %r12d           # imm = 0x200
movl %r12d, 0x20(%rsp)
movl %r12d, 0x1c(%rsp)
movl %r12d, 0x18(%rsp)
cmpl $0x0, 0x1910(%rbx)
movl $0x200, 0x10(%rsp)      # imm = 0x200
movl $0x200, 0xc(%rsp)       # imm = 0x200
jle 0x6285
movl $0x200, 0xc(%rsp)       # imm = 0x200
xorl %r13d, %r13d
movl $0x200, 0x10(%rsp)      # imm = 0x200
movl 0x1874(%rbx,%r13,4), %ebp
movl %ebp, 0x70(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4e52
movl %eax, %r15d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x42a4
movq %rbx, %rdi
callq 0x4cb4
cmpl $0x34, 0x14(%rsp)
setl %cl
addl 0x5c(%rsp), %r15d
addl %eax, %r15d
cmpl 0x58(%rsp), %r15d
setl %al
orb %cl, %al
cmpb $0x1, %al
jne 0x6265
movl 0x1908(%rbx), %eax
movl %r15d, %ecx
subl 0x190c(%rbx), %ecx
addl %ecx, %eax
addl $0x34, %eax
cmpl %r12d, %eax
jge 0x61ca
movl 0x10(%rsp), %esi
cmpl %esi, %r12d
jle 0x61fb
movl 0xc(%rsp), %ecx
cmpl %ecx, %r12d
jle 0x6244
movl %ecx, %r12d
jmp 0x6254
movl 0x10(%rsp), %edx
cmpl %edx, %eax
jge 0x622f
cmpl 0xc(%rsp), %edx
jg 0x61ec
movl 0x28(%rsp), %ecx
movl %ecx, 0x24(%rsp)
movl 0x1c(%rsp), %ecx
movl %ecx, 0x18(%rsp)
movl %edx, 0xc(%rsp)
movl %ebp, 0x28(%rsp)
movl %r15d, 0x1c(%rsp)
movl %eax, 0x10(%rsp)
jmp 0x6265
movl 0xc(%rsp), %edx
cmpl %edx, %esi
jg 0x6215
movl 0x28(%rsp), %ecx
movl %ecx, 0x24(%rsp)
movl 0x1c(%rsp), %ecx
movl %ecx, 0x18(%rsp)
movl %esi, %edx
movl 0x2c(%rsp), %ecx
movl %ecx, 0x28(%rsp)
movl 0x20(%rsp), %ecx
movl %ecx, 0x1c(%rsp)
movl %r12d, 0x10(%rsp)
movl %edx, %r12d
jmp 0x6254
cmpl 0xc(%rsp), %eax
jge 0x6265
movl %ebp, 0x24(%rsp)
movl %r15d, 0x18(%rsp)
movl %eax, 0xc(%rsp)
jmp 0x6265
movl 0x2c(%rsp), %ecx
movl %ecx, 0x24(%rsp)
movl 0x20(%rsp), %ecx
movl %ecx, 0x18(%rsp)
movl %r12d, 0xc(%rsp)
movl %ebp, 0x2c(%rsp)
movl %r15d, 0x20(%rsp)
movl %eax, %r12d
movq %rbx, %rdi
callq 0x50e4
incq %r13
movslq 0x1910(%rbx), %rax
cmpq %rax, %r13
leaq 0x70(%rsp), %r15
jl 0x6145
cmpl $0x200, %r12d           # imm = 0x200
movl 0x94(%rsp), %r13d
movl 0xc(%rsp), %ebp
jge 0x6371
movl 0x2c(%rsp), %esi
movq %rbx, %rdi
callq 0x42a4
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4ede
leaq 0xa0(%rsp), %rdi
movq %r15, %rsi
leaq 0x20(%rsp), %rdx
callq 0x911e
movq %rax, %r15
testq %rax, %rax
je 0x62e0
movl 0x20(%r15), %eax
cmpl 0x20(%rsp), %eax
jle 0x6364
movq $0x0, 0x40(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0xb(%rsp), %rdx
leaq 0x2c(%rsp), %rcx
leaq 0x60(%rsp), %r8
callq 0x9718
movaps 0x40(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x40(%rsp)
movq 0x38(%rsp), %rdi
movups %xmm0, 0x30(%rsp)
testq %rdi, %rdi
je 0x6328
callq 0x3794
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x6337
callq 0x3794
testq %r15, %r15
je 0x6344
movl 0x20(%rsp), %eax
movl %eax, 0x20(%r15)
movslq %r12d, %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rsp,%rax), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
leaq 0x30(%rsp), %rsi
callq 0x9808
movq %rbx, %rdi
callq 0x50e4
leaq 0x70(%rsp), %r15
movl 0x9c(%rsp), %eax
cmpl %eax, 0xa8(%rsp)
jge 0x6468
cmpl $0x1ff, 0x10(%rsp)      # imm = 0x1FF
jg 0x6468
movl 0x28(%rsp), %esi
movq %rbx, %rdi
callq 0x42a4
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4ede
leaq 0xa0(%rsp), %rdi
movq %r15, %rsi
leaq 0x1c(%rsp), %rdx
callq 0x911e
movq %rax, %r15
testq %rax, %rax
je 0x63d5
movl 0x20(%r15), %eax
cmpl 0x1c(%rsp), %eax
jle 0x645b
movq $0x0, 0x40(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0xb(%rsp), %rdx
leaq 0x28(%rsp), %rcx
leaq 0x60(%rsp), %r8
callq 0x9718
movaps 0x40(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x40(%rsp)
movq 0x38(%rsp), %rdi
movups %xmm0, 0x30(%rsp)
testq %rdi, %rdi
je 0x641d
callq 0x3794
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x642c
callq 0x3794
testq %r15, %r15
je 0x6439
movl 0x1c(%rsp), %eax
movl %eax, 0x20(%r15)
movslq 0x10(%rsp), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rsp,%rax), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
leaq 0x30(%rsp), %rsi
callq 0x9808
movq %rbx, %rdi
callq 0x50e4
leaq 0x70(%rsp), %r15
movl 0x98(%rsp), %eax
cmpl %eax, 0xa8(%rsp)
jge 0x6556
cmpl $0x1ff, %ebp            # imm = 0x1FF
jg 0x6556
movl 0x24(%rsp), %esi
movq %rbx, %rdi
callq 0x42a4
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4ede
leaq 0xa0(%rsp), %rdi
movq %r15, %rsi
leaq 0x18(%rsp), %rdx
callq 0x911e
movq %rax, %r15
testq %rax, %rax
je 0x64ca
movl 0x20(%r15), %eax
cmpl 0x18(%rsp), %eax
jle 0x654e
movq $0x0, 0x40(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0xb(%rsp), %rdx
leaq 0x24(%rsp), %rcx
leaq 0x60(%rsp), %r8
callq 0x9718
movaps 0x40(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x40(%rsp)
movq 0x38(%rsp), %rdi
movups %xmm0, 0x30(%rsp)
testq %rdi, %rdi
je 0x6512
callq 0x3794
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x6521
callq 0x3794
testq %r15, %r15
je 0x652e
movl 0x18(%rsp), %eax
movl %eax, 0x20(%r15)
movslq %ebp, %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rsp,%rax), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
leaq 0x30(%rsp), %rsi
callq 0x9808
movq %rbx, %rdi
callq 0x50e4
movl 0x14(%rsp), %r15d
movl %r15d, %ebp
cmpl $0x1ff, %r14d           # imm = 0x1FF
jle 0x5e7b
jmp 0x659e
cmpl $0x34, %ebp
jne 0x6592
movq %rbx, %rdi
callq 0x4cb4
addl 0x5c(%rsp), %eax
movl $0x34, 0x14(%rsp)
cmpl 0x58(%rsp), %eax
jl 0x60e2
jmp 0x6556
movl %ebp, 0x14(%rsp)
jmp 0x60e2
movl %ebp, %r15d
movl 0x1904(%rbx), %esi
movq %rbx, %rdi
callq 0x5aae
cmpb $-0x1, 0xd2(%rsp)
leaq 0xd0(%rsp), %r14
je 0x65d4
movl (%r14), %esi
movq %rbx, %rdi
callq 0x42a4
cmpb $-0x1, 0x6(%r14)
leaq 0x4(%r14), %r14
jne 0x65be
xorl %ebx, %ebx
cmpl $0x34, %r15d
sete %bpl
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x65ed
callq 0x3794
movb %bpl, %bl
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x65ff
callq 0x3794
orl $-0x2, %ebx
movl $0x9fb0, %r14d          # imm = 0x9FB0
leaq (%rsp,%r14), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
callq 0x93d0
addq $-0x50, %r14
cmpq $-0x50, %r14
jne 0x6608
leaq 0xa0(%rsp), %rdi
callq 0x9368
movl %ebx, %eax
addq $0xb0d8, %rsp           # imm = 0xB0D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x666f
jmp 0x669b
jmp 0x666f
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x669b
jmp 0x666f
movq %rax, %rbx
jmp 0x66bc
movq %rax, %rbx
testq %r12, %r12
je 0x66dc
leaq 0x1080(%rsp), %r14
leaq (%r14,%r12), %rdi
callq 0x93d0
addq $-0x50, %r12
jne 0x6684
jmp 0x66dc
jmp 0x669b
jmp 0x669b
jmp 0x669b
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x66ad
callq 0x3794
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x66bc
callq 0x3794
movl $0x9fb0, %r14d          # imm = 0x9FB0
leaq (%rsp,%r14), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
callq 0x93d0
addq $-0x50, %r14
cmpq $-0x50, %r14
jne 0x66c2
leaq 0xa0(%rsp), %rdi
callq 0x9368
movq %rbx, %rdi
callq 0x22e0
nop