// File: /workspace/github_cpp_makefile_star2_O2/ShootMe[P]Klondike-Solver/Solitaire.cpp
// Function: Solitaire::LoadPysol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool Solitaire::LoadPysol(string const& cardSet) {
	int used[52] = {};
	if (cardSet.size() < 211) { return false; }
	unsigned int j = 7;
	for (int i = 28; i < 52; i++) {
		int rank = cardSet[j] == 'A' ? ACE : (cardSet[j] == 'T' ? TEN : (cardSet[j] == 'J' ? JACK : (cardSet[j] == 'Q' ? QUEEN : (cardSet[j] == 'K' ? KING : cardSet[j] ^ 0x30))));
		if (rank < ACE || rank > KING) { return false; }
		j++;

		int suit = cardSet[j] == 'C' ? CLUBS : (cardSet[j] == 'D' ? DIAMONDS : (cardSet[j] == 'S' ? SPADES : HEARTS));
		if (suit < CLUBS || suit > HEARTS) { return false; }
		j += 2;

		int value = suit * 13 + rank - 1;
		if (used[value] == 1) { return false; }
		used[value] = 1;
		cards[i].Set(value);
	}

	const int order[28] = { 0, 1, 7, 2, 8, 13, 3, 9, 14, 18, 4, 10, 15, 19, 22, 5, 11, 16, 20, 23, 25, 6, 12, 17, 21, 24, 26, 27 };
	for (int i = 0; i < 28; i++) {
		while (j < cardSet.size() && (cardSet[j] == '\r' || cardSet[j] == '\n' || cardSet[j] == '\t' || cardSet[j] == ' ' || cardSet[j] == ':' || cardSet[j] == '<')) { j++; }
		if (j + 1 >= cardSet.size()) { return false; }

		int rank = cardSet[j] == 'A' ? ACE : (cardSet[j] == 'T' ? TEN : (cardSet[j] == 'J' ? JACK : (cardSet[j] == 'Q' ? QUEEN : (cardSet[j] == 'K' ? KING : cardSet[j] ^ 0x30))));
		if (rank < ACE || rank > KING) { return false; }
		j++;

		int suit = cardSet[j] == 'C' ? CLUBS : (cardSet[j] == 'D' ? DIAMONDS : (cardSet[j] == 'S' ? SPADES : HEARTS));
		if (suit < CLUBS || suit > HEARTS) { return false; }
		j += 3;

		int value = suit * 13 + rank - 1;
		if (used[value] == 1) { return false; }
		used[value] = 1;
		cards[order[i]].Set(value);
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %rdi
xorl %ebp, %ebp
movl $0xd0, %edx
xorl %esi, %esi
callq 0x20f0
cmpq $0xd3, 0x8(%rbx)
jb 0x6c78
leaq 0x173c(%r14), %r15
addq $0x17e4, %r14           # imm = 0x17E4
pushq $0x8
popq %r12
pushq $0x1
popq %rbp
pushq $0xd
popq %r13
cmpq $0x50, %r12
je 0x6b8a
movq (%rbx), %rax
movzbl -0x1(%rax,%r12), %edx
movl %ebp, %ecx
cmpl $0x41, %edx
je 0x6b37
cmpl $0x4a, %edx
je 0x6b1b
cmpl $0x4b, %edx
je 0x6b24
cmpl $0x51, %edx
je 0x6b1f
cmpl $0x54, %edx
jne 0x6b29
pushq $0xa
jmp 0x6b21
pushq $0xb
jmp 0x6b21
pushq $0xc
popq %rcx
jmp 0x6b37
movl %r13d, %ecx
jmp 0x6b37
movsbl %dl, %ecx
xorl $0x30, %ecx
leal -0xe(%rcx), %edx
cmpl $-0xd, %edx
jb 0x6b83
movzbl (%rax,%r12), %eax
cmpl $0x43, %eax
je 0x6b4b
cmpl $0x44, %eax
jne 0x6b4f
movl %r13d, %eax
jmp 0x6b5a
xorl %eax, %eax
jmp 0x6b5a
cmpb $0x53, %al
pushq $0x27
popq %rax
pushq $0x1a
popq %rdx
cmovel %edx, %eax
addl %ecx, %eax
decl %eax
cmpl $0x1, (%rsp,%rax,4)
je 0x6b83
movl $0x1, (%rsp,%rax,4)
movzbl %al, %esi
movq %r14, %rdi
callq 0x8e0a
addq $0x3, %r12
addq $0x6, %r14
jmp 0x6ae9
xorl %ebp, %ebp
jmp 0x6c78
pushq $0x4f
popq %r14
xorl %r12d, %r12d
movabsq $0x1400000100002600, %r13 # imm = 0x1400000100002600
cmpq $0x1c, %r12
sete %bpl
je 0x6c75
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
movl %r14d, %r14d
cmpq %r14, %rdx
jbe 0x6bce
movzbl (%rax,%r14), %ecx
cmpq $0x3c, %rcx
ja 0x6bce
btq %rcx, %r13
jae 0x6bce
incl %r14d
jmp 0x6bb0
leal 0x1(%r14), %ecx
cmpq %rcx, %rdx
jbe 0x6c78
movzbl (%rax,%r14), %esi
pushq $0x1
popq %rdx
cmpl $0x41, %esi
je 0x6c0b
cmpl $0x4a, %esi
je 0x6c00
cmpl $0x4b, %esi
je 0x6c08
cmpl $0x51, %esi
je 0x6c04
cmpl $0x54, %esi
jne 0x6c64
pushq $0xa
jmp 0x6c0a
pushq $0xb
jmp 0x6c0a
pushq $0xc
jmp 0x6c0a
pushq $0xd
popq %rdx
movzbl (%rax,%rcx), %eax
cmpl $0x43, %eax
je 0x6c1e
cmpl $0x44, %eax
jne 0x6c22
pushq $0xd
popq %rax
jmp 0x6c2d
xorl %eax, %eax
jmp 0x6c2d
cmpb $0x53, %al
pushq $0x27
popq %rax
pushq $0x1a
popq %rcx
cmovel %ecx, %eax
addl %edx, %eax
decl %eax
cmpl $0x1, (%rsp,%rax,4)
je 0x6c78
addl $0x4, %r14d
movl $0x1, (%rsp,%rax,4)
leaq 0x2d57(%rip), %rcx      # 0x99a0
movslq (%rcx,%r12,4), %rcx
imulq $0x6, %rcx, %rdi
addq %r15, %rdi
movzbl %al, %esi
callq 0x8e0a
incq %r12
jmp 0x6b9b
movsbl %sil, %edx
xorl $0x30, %edx
leal -0xe(%rdx), %esi
cmpl $-0xd, %esi
jae 0x6c0b
jmp 0x6c78
movb $0x1, %bpl
movl %ebp, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq