// File: 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
movq %rsp, %rbp
subq $0x20, %rsp
movl %esi, -0x4(%rbp)
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl 0x1914(%rax), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x1914(%rax)
movslq %ecx, %rcx
movl -0x4(%rbp), %edx
movl %edx, (%rax,%rcx,4)
movzbl -0x2(%rbp), %eax
cmpl $0x1, %eax
jne 0x7308
movzbl -0x4(%rbp), %eax
cmpl $0x0, %eax
jne 0x7294
movzbl -0x1(%rbp), %eax
cmpl $0x0, %eax
jle 0x7294
movq -0x20(%rbp), %rdi
addq $0x800, %rdi            # imm = 0x800
addq $0x960, %rdi            # imm = 0x960
callq 0x6400
movl %eax, -0x14(%rbp)
movzbl -0x1(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x71f5
movq -0x20(%rbp), %rsi
movq %rsi, %rdi
addq $0x800, %rdi            # imm = 0x800
addq $0x960, %rdi            # imm = 0x960
addq $0x800, %rsi            # imm = 0x800
movzbl -0x1(%rbp), %edx
callq 0x62a0
jmp 0x7292
movq -0x20(%rbp), %rdi
movl 0x1908(%rdi), %eax
addl $0x1, %eax
movl %eax, 0x1908(%rdi)
movl -0x14(%rbp), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
addq $0x800, %rdi            # imm = 0x800
callq 0x6400
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movzbl -0x1(%rbp), %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jle 0x726a
movq -0x20(%rbp), %rsi
movq %rsi, %rdi
addq $0x800, %rdi            # imm = 0x800
addq $0x800, %rsi            # imm = 0x800
addq $0x960, %rsi            # imm = 0x960
movl -0x14(%rbp), %edx
callq 0x62a0
jmp 0x7290
movq -0x20(%rbp), %rsi
movq %rsi, %rdi
addq $0x800, %rdi            # imm = 0x800
addq $0x960, %rdi            # imm = 0x960
addq $0x800, %rsi            # imm = 0x800
xorl %edx, %edx
subl -0x14(%rbp), %edx
callq 0x62a0
jmp 0x7292
jmp 0x7294
movq -0x20(%rbp), %rsi
movq %rsi, %rdi
addq $0x800, %rdi            # imm = 0x800
movzbl -0x4(%rbp), %eax
imulq $0x12c, %rax, %rax      # imm = 0x12C
addq %rax, %rdi
addq $0x800, %rsi            # imm = 0x800
movzbl -0x3(%rbp), %eax
imulq $0x12c, %rax, %rax      # imm = 0x12C
addq %rax, %rsi
callq 0x6150
movzbl -0x3(%rbp), %eax
cmpl $0x9, %eax
jl 0x72e8
movq -0x20(%rbp), %rax
movl 0x190c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x190c(%rax)
jmp 0x7306
movzbl -0x4(%rbp), %eax
cmpl $0x9, %eax
jl 0x7304
movq -0x20(%rbp), %rax
movl 0x190c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x190c(%rax)
jmp 0x7306
jmp 0x7342
movq -0x20(%rbp), %rsi
movq %rsi, %rdi
addq $0x800, %rdi            # imm = 0x800
movzbl -0x4(%rbp), %eax
imulq $0x12c, %rax, %rax      # imm = 0x12C
addq %rax, %rdi
addq $0x800, %rsi            # imm = 0x800
movzbl -0x3(%rbp), %eax
imulq $0x12c, %rax, %rax      # imm = 0x12C
addq %rax, %rsi
movzbl -0x2(%rbp), %edx
callq 0x61e0
movzbl -0x4(%rbp), %eax
cmpl $0x0, %eax
je 0x7372
movzbl -0x1(%rbp), %eax
cmpl $0x0, %eax
jle 0x7372
movq -0x20(%rbp), %rdi
addq $0x800, %rdi            # imm = 0x800
movzbl -0x4(%rbp), %eax
imulq $0x12c, %rax, %rax      # imm = 0x12C
addq %rax, %rdi
callq 0x6090
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)