// File: /workspace/github_cpp_makefile_star2_O3/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 0x2100
cmpq $0xd3, 0x8(%rbx)
jb 0x786d
leaq 0x173c(%r14), %r15
addq $0x17e4, %r14           # imm = 0x17E4
movl $0x8, %r12d
movl $0x1a, %ebp
movq (%rbx), %rax
movzbl -0x1(%rax,%r12), %edx
cmpl $0x4a, %edx
jle 0x76d5
cmpl $0x4b, %edx
je 0x76eb
cmpl $0x51, %edx
je 0x76f2
cmpl $0x54, %edx
jne 0x76f9
movl $0xa, %ecx
jmp 0x770b
movl $0x1, %ecx
cmpl $0x41, %edx
je 0x770b
cmpl $0x4a, %edx
jne 0x76f9
movl $0xb, %ecx
jmp 0x770b
movl $0xd, %ecx
jmp 0x770b
movl $0xc, %ecx
jmp 0x770b
movsbl %dl, %ecx
xorl $0x30, %ecx
leal -0xe(%rcx), %edx
cmpl $-0xd, %edx
jb 0x786b
movzbl (%rax,%r12), %eax
cmpl $0x43, %eax
je 0x7721
cmpl $0x44, %eax
jne 0x7725
movl $0xd, %eax
jmp 0x772f
xorl %eax, %eax
jmp 0x772f
cmpb $0x53, %al
movl $0x27, %eax
cmovel %ebp, %eax
addl %ecx, %eax
decl %eax
cmpl $0x1, (%rsp,%rax,4)
je 0x786b
movl $0x1, (%rsp,%rax,4)
movzbl %al, %esi
movq %r14, %rdi
callq 0x9c86
addq $0x6, %r14
addq $0x3, %r12
cmpq $0x50, %r12
jne 0x76b1
movl $0x4f, %r14d
xorl %r12d, %r12d
movabsq $0x1400000100002600, %r13 # imm = 0x1400000100002600
leaq 0x3245(%rip), %rbp      # 0xa9c0
movq 0x8(%rbx), %rcx
movl %r14d, %edx
cmpq %rdx, %rcx
jbe 0x77a5
movq (%rbx), %rax
movzbl (%rax,%rdx), %esi
cmpq $0x3c, %rsi
ja 0x77a5
btq %rsi, %r13
jae 0x77a5
incl %r14d
movq %r14, %rdx
cmpq %r14, %rcx
ja 0x778a
leal 0x1(%r14), %eax
cmpq %rax, %rcx
jbe 0x786b
movq (%rbx), %rcx
movzbl (%rcx,%rdx), %esi
cmpl $0x4a, %esi
jle 0x77d4
cmpl $0x4b, %esi
je 0x77ea
cmpl $0x51, %esi
je 0x77f1
cmpl $0x54, %esi
jne 0x77f8
movl $0xa, %edx
jmp 0x7807
movl $0x1, %edx
cmpl $0x41, %esi
je 0x7807
cmpl $0x4a, %esi
jne 0x77f8
movl $0xb, %edx
jmp 0x7807
movl $0xd, %edx
jmp 0x7807
movl $0xc, %edx
jmp 0x7807
movsbl %sil, %edx
xorl $0x30, %edx
leal -0xe(%rdx), %esi
cmpl $-0xd, %esi
jb 0x786b
movzbl (%rcx,%rax), %eax
cmpl $0x43, %eax
je 0x781c
cmpl $0x44, %eax
jne 0x7820
movl $0xd, %eax
jmp 0x782f
xorl %eax, %eax
jmp 0x782f
cmpb $0x53, %al
movl $0x27, %eax
movl $0x1a, %ecx
cmovel %ecx, %eax
addl %edx, %eax
decl %eax
cmpl $0x1, (%rsp,%rax,4)
je 0x786b
addl $0x4, %r14d
movl $0x1, (%rsp,%rax,4)
movslq (%rbp,%r12,4), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%r15,%rcx,2), %rdi
movzbl %al, %esi
callq 0x9c86
incq %r12
cmpq $0x1c, %r12
jne 0x777b
movb $0x1, %bpl
jmp 0x786d
xorl %ebp, %ebp
movl %ebp, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop