// File: /workspace/github_cpp_makefile_star2_O2/ShootMe[P]Klondike-Solver/Solitaire.cpp
// Function: Solitaire::MakeMove(Move)
void Solitaire::MakeMove(Move move) {
	movesMade[movesMadeCount++] = move;

	if (move.Count == 1) {
		if (move.From == WASTE && move.Extra > 0) {
			int stockSize = piles[STOCK].Size();
			if (move.Extra <= stockSize) {
				piles[STOCK].RemoveTalon(piles[WASTE], move.Extra);
			} else {
				roundCount++;
				stockSize += stockSize;
				int wasteSize = piles[WASTE].Size();
				stockSize += wasteSize;
				stockSize += wasteSize;
				stockSize -= move.Extra;
				if (stockSize > 0) {
					piles[WASTE].RemoveTalon(piles[STOCK], stockSize);
				} else {
					piles[STOCK].RemoveTalon(piles[WASTE], -stockSize);
				}
			}
		}
		piles[move.From].Remove(piles[move.To]);

		if (move.To >= FOUNDATION1C) {
			++foundationCount;
		} else if (move.From >= FOUNDATION1C) {
			--foundationCount;
		}
	} else {
		piles[move.From].Remove(piles[move.To], move.Count);
	}

	if (move.From != WASTE && move.Extra > 0) {
		piles[move.From].Flip();
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, %r12d
shrl $0x8, %r12d
movl %esi, %eax
shrl $0x10, %eax
movl %esi, %r14d
shrl $0x18, %r14d
movslq 0x1914(%rdi), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x1914(%rdi)
movb %bpl, (%rdi,%rcx,4)
movb %r12b, 0x1(%rdi,%rcx,4)
movb %al, 0x2(%rdi,%rcx,4)
movb %r14b, 0x3(%rdi,%rcx,4)
movzbl %al, %edx
cmpl $0x1, %edx
jne 0x3f3a
movl %ebp, %r15d
andl $0xff, %r15d
setne %al
cmpl $0x1000000, %ebp        # imm = 0x1000000
setb %cl
orb %al, %cl
jne 0x3f93
leaq 0x800(%rbx), %rax
movq %rax, 0x8(%rsp)
leaq 0x1160(%rbx), %r13
movq %r13, %rdi
callq 0x3874
cmpl %eax, %r14d
jle 0x3f73
movq %r13, 0x10(%rsp)
incl 0x1908(%rbx)
movq 0x8(%rsp), %rdi
movl %eax, %r13d
callq 0x3874
addl %r13d, %eax
addl %eax, %eax
subl %r14d, %eax
jle 0x3f80
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
jmp 0x3f8c
movl $0xff, %eax
movl %ebp, %r15d
andl %eax, %r15d
imulq $0x12c, %r15, %rcx      # imm = 0x12C
leaq (%rbx,%rcx), %rdi
addq $0x800, %rdi            # imm = 0x800
andl %eax, %r12d
imulq $0x12c, %r12, %rax      # imm = 0x12C
leaq (%rbx,%rax), %rsi
addq $0x800, %rsi            # imm = 0x800
callq 0x3738
jmp 0x3fe5
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movl %r14d, %edx
jmp 0x3f8e
negl %eax
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl %eax, %edx
callq 0x37b4
movl %r15d, %eax
imulq $0x12c, %rax, %rax      # imm = 0x12C
leaq (%rbx,%rax), %rdi
addq $0x800, %rdi            # imm = 0x800
movzbl %r12b, %eax
imulq $0x12c, %rax, %rax      # imm = 0x12C
leaq (%rbx,%rax), %rsi
addq $0x800, %rsi            # imm = 0x800
callq 0x36e2
movl %ebp, %eax
andl $0xff00, %eax           # imm = 0xFF00
cmpl $0x801, %eax            # imm = 0x801
jb 0x3fd9
incl 0x190c(%rbx)
jmp 0x3fe5
cmpl $0x9, %r15d
jb 0x3fe5
decl 0x190c(%rbx)
testl %r15d, %r15d
sete %al
cmpl $0x1000000, %ebp        # imm = 0x1000000
setb %cl
orb %al, %cl
jne 0x4020
movl %r15d, %eax
imulq $0x12c, %rax, %rax      # imm = 0x12C
leaq (%rbx,%rax), %rdi
addq $0x800, %rdi            # imm = 0x800
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3672
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop