// File: tewalds[P]morat/pentago/moveiterator.cpp
// Function: Morat::Pentago::RandomMoveIteratorTest()
void RandomMoveIteratorTest() {
	XORShift_uint32 rand32;
	XORShift_uint64 rand64;

	Board board;
	int i;

	i = 0;
	for (RandomMoveIterator<XORShift_uint32> move(board, rand32, 0); !move.done(); ++move)
		i++;
	assert(i == 288);

	i = 0;
	for (RandomMoveIterator<XORShift_uint64> move(board, rand64, 0); !move.done(); ++move)
		i++;
	assert(i == 288);

	i = 0;
	for (RandomMoveIterator<XORShift_uint32> move(board, rand32, 36); !move.done(); ++move)
		i++;
	assert(i == 6);

	i = 0;
	for (RandomMoveIterator<XORShift_uint32> move(board, rand32); !move.done(); ++move)
		i++;
	assert(i == 6);

	std::set<std::string> moves;
	for(MoveIterator move(board, 0); !move.done(); ++move)
		moves.insert(move->to_s());

	assert(moves.size() == 288);

	for (RandomMoveIterator<XORShift_uint32> move(board, rand32, 0); !move.done(); ++move)
		moves.insert(move->to_s());

	assert(moves.size() == 288);

	for (RandomMoveIterator<XORShift_uint32> move(board, rand32, 0); !move.done(); ++move)
		moves.erase(move->to_s());

	assert(moves.size() == 0);


	std::set<std::string> boards;
	for(MoveIterator move(board, 0); !move.done(); ++move)
		boards.insert(move.board().to_s());

	unsigned int size = boards.size();

	for (RandomMoveIterator<XORShift_uint32> move(board, rand32, 0); !move.done(); ++move)
		boards.insert(move.board().to_s());

	assert(boards.size() == size);

	for (RandomMoveIterator<XORShift_uint32> move(board, rand32, 0); !move.done(); ++move)
		boards.erase(move.board().to_s());

	assert(boards.size() == 0);
}

// Assembly:
subq $0x518, %rsp            # imm = 0x518
leaq 0x514(%rsp), %rdi
xorl %esi, %esi
callq 0x24450
leaq 0x508(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x22d40
leaq 0x4e0(%rsp), %rdi
movl $0x6, %esi
callq 0x16790
movl $0x0, 0x4dc(%rsp)
leaq 0x490(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
leaq 0x514(%rsp), %rdx
xorl %ecx, %ecx
callq 0x15340
leaq 0x490(%rsp), %rdi
callq 0x15520
movb %al, 0x7f(%rsp)
jmp 0x3b5e6
movb 0x7f(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3b625
leaq 0x490(%rsp), %rdi
callq 0x15610
jmp 0x3b647
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
leaq 0x490(%rsp), %rdi
callq 0x15610
jmp 0x3c0f5
movl 0x4dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4dc(%rsp)
leaq 0x490(%rsp), %rdi
callq 0x15570
jmp 0x3b645
jmp 0x3b5d3
cmpl $0x120, 0x4dc(%rsp) # imm = 0x120
jne 0x3b656
jmp 0x3b675
leaq 0xd0b1(%rip), %rdi      # 0x4870e
leaq 0xd0b3(%rip), %rsi      # 0x48717
movl $0x2e, %edx
leaq 0xd0f8(%rip), %rcx      # 0x48768
callq 0x52d0
movl $0x0, 0x4dc(%rsp)
leaq 0x438(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
leaq 0x508(%rsp), %rdx
xorl %ecx, %ecx
callq 0x3c110
leaq 0x438(%rsp), %rdi
callq 0x3c2f0
movb %al, 0x7e(%rsp)
jmp 0x3b6b2
movb 0x7e(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3b6f1
leaq 0x438(%rsp), %rdi
callq 0x3c3b0
jmp 0x3b713
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
leaq 0x438(%rsp), %rdi
callq 0x3c3b0
jmp 0x3c0f5
movl 0x4dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4dc(%rsp)
leaq 0x438(%rsp), %rdi
callq 0x3c310
jmp 0x3b711
jmp 0x3b69f
cmpl $0x120, 0x4dc(%rsp) # imm = 0x120
jne 0x3b722
jmp 0x3b741
leaq 0xcfe5(%rip), %rdi      # 0x4870e
leaq 0xcfe7(%rip), %rsi      # 0x48717
movl $0x33, %edx
leaq 0xd02c(%rip), %rcx      # 0x48768
callq 0x52d0
movl $0x0, 0x4dc(%rsp)
leaq 0x3f0(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
leaq 0x514(%rsp), %rdx
movl $0x24, %ecx
callq 0x15340
leaq 0x3f0(%rsp), %rdi
callq 0x15520
movb %al, 0x7d(%rsp)
jmp 0x3b781
movb 0x7d(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3b7c0
leaq 0x3f0(%rsp), %rdi
callq 0x15610
jmp 0x3b7e2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
leaq 0x3f0(%rsp), %rdi
callq 0x15610
jmp 0x3c0f5
movl 0x4dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4dc(%rsp)
leaq 0x3f0(%rsp), %rdi
callq 0x15570
jmp 0x3b7e0
jmp 0x3b76e
cmpl $0x6, 0x4dc(%rsp)
jne 0x3b7ee
jmp 0x3b80d
leaq 0xcf6c(%rip), %rdi      # 0x48761
leaq 0xcf1b(%rip), %rsi      # 0x48717
movl $0x38, %edx
leaq 0xcf60(%rip), %rcx      # 0x48768
callq 0x52d0
movl $0x0, 0x4dc(%rsp)
leaq 0x3a8(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
leaq 0x514(%rsp), %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x15340
leaq 0x3a8(%rsp), %rdi
callq 0x15520
movb %al, 0x7c(%rsp)
jmp 0x3b84d
movb 0x7c(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3b88c
leaq 0x3a8(%rsp), %rdi
callq 0x15610
jmp 0x3b8ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
leaq 0x3a8(%rsp), %rdi
callq 0x15610
jmp 0x3c0f5
movl 0x4dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4dc(%rsp)
leaq 0x3a8(%rsp), %rdi
callq 0x15570
jmp 0x3b8ac
jmp 0x3b83a
cmpl $0x6, 0x4dc(%rsp)
jne 0x3b8ba
jmp 0x3b8d9
leaq 0xcea0(%rip), %rdi      # 0x48761
leaq 0xce4f(%rip), %rsi      # 0x48717
movl $0x3d, %edx
leaq 0xce94(%rip), %rcx      # 0x48768
callq 0x52d0
leaq 0x378(%rsp), %rdi
callq 0x3c400
leaq 0x328(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
xorl %edx, %edx
callq 0x15670
jmp 0x3b8ff
jmp 0x3b901
leaq 0x328(%rsp), %rdi
callq 0x157e0
movb %al, 0x7b(%rsp)
jmp 0x3b914
movb 0x7b(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3b962
leaq 0x328(%rsp), %rdi
callq 0x15940
jmp 0x3ba16
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
jmp 0x3c0e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
jmp 0x3ba04
leaq 0x328(%rsp), %rdi
callq 0x15800
movq %rax, 0x70(%rsp)
jmp 0x3b976
movq 0x70(%rsp), %rsi
leaq 0x308(%rsp), %rdi
callq 0x14740
jmp 0x3b98a
leaq 0x378(%rsp), %rdi
leaq 0x308(%rsp), %rsi
callq 0x3c410
movb %dl, 0x67(%rsp)
movq %rax, 0x68(%rsp)
jmp 0x3b9aa
movb 0x67(%rsp), %al
movq 0x68(%rsp), %rcx
movq %rcx, 0x2f8(%rsp)
movb %al, 0x300(%rsp)
leaq 0x308(%rsp), %rdi
callq 0x5290
leaq 0x328(%rsp), %rdi
callq 0x15820
jmp 0x3b9de
jmp 0x3b901
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
leaq 0x308(%rsp), %rdi
callq 0x5290
leaq 0x328(%rsp), %rdi
callq 0x15940
jmp 0x3c0e8
leaq 0x378(%rsp), %rdi
callq 0x3c470
cmpq $0x120, %rax            # imm = 0x120
jne 0x3ba2d
jmp 0x3ba4c
leaq 0xcd62(%rip), %rdi      # 0x48796
leaq 0xccdc(%rip), %rsi      # 0x48717
movl $0x43, %edx
leaq 0xcd21(%rip), %rcx      # 0x48768
callq 0x52d0
leaq 0x2b0(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
leaq 0x514(%rsp), %rdx
xorl %ecx, %ecx
callq 0x15340
jmp 0x3ba6d
jmp 0x3ba6f
leaq 0x2b0(%rsp), %rdi
callq 0x15520
movb %al, 0x66(%rsp)
jmp 0x3ba82
movb 0x66(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3bab7
leaq 0x2b0(%rsp), %rdi
callq 0x15610
jmp 0x3bb6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
jmp 0x3bb59
leaq 0x2b0(%rsp), %rdi
callq 0x3c480
movq %rax, 0x58(%rsp)
jmp 0x3bacb
movq 0x58(%rsp), %rsi
leaq 0x290(%rsp), %rdi
callq 0x14740
jmp 0x3badf
leaq 0x378(%rsp), %rdi
leaq 0x290(%rsp), %rsi
callq 0x3c410
movb %dl, 0x4f(%rsp)
movq %rax, 0x50(%rsp)
jmp 0x3baff
movb 0x4f(%rsp), %al
movq 0x50(%rsp), %rcx
movq %rcx, 0x280(%rsp)
movb %al, 0x288(%rsp)
leaq 0x290(%rsp), %rdi
callq 0x5290
leaq 0x2b0(%rsp), %rdi
callq 0x15570
jmp 0x3bb33
jmp 0x3ba6f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
leaq 0x290(%rsp), %rdi
callq 0x5290
leaq 0x2b0(%rsp), %rdi
callq 0x15610
jmp 0x3c0e8
leaq 0x378(%rsp), %rdi
callq 0x3c470
cmpq $0x120, %rax            # imm = 0x120
jne 0x3bb82
jmp 0x3bba1
leaq 0xcc0d(%rip), %rdi      # 0x48796
leaq 0xcb87(%rip), %rsi      # 0x48717
movl $0x48, %edx
leaq 0xcbcc(%rip), %rcx      # 0x48768
callq 0x52d0
leaq 0x238(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
leaq 0x514(%rsp), %rdx
xorl %ecx, %ecx
callq 0x15340
jmp 0x3bbc2
jmp 0x3bbc4
leaq 0x238(%rsp), %rdi
callq 0x15520
movb %al, 0x4e(%rsp)
jmp 0x3bbd7
movb 0x4e(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3bc0c
leaq 0x238(%rsp), %rdi
callq 0x15610
jmp 0x3bc9f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
jmp 0x3bc8d
leaq 0x238(%rsp), %rdi
callq 0x3c480
movq %rax, 0x40(%rsp)
jmp 0x3bc20
movq 0x40(%rsp), %rsi
leaq 0x218(%rsp), %rdi
callq 0x14740
jmp 0x3bc34
leaq 0x378(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x3c4a0
jmp 0x3bc4b
leaq 0x218(%rsp), %rdi
callq 0x5290
leaq 0x238(%rsp), %rdi
callq 0x15570
jmp 0x3bc67
jmp 0x3bbc4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
leaq 0x218(%rsp), %rdi
callq 0x5290
leaq 0x238(%rsp), %rdi
callq 0x15610
jmp 0x3c0e8
leaq 0x378(%rsp), %rdi
callq 0x3c470
cmpq $0x0, %rax
jne 0x3bcb4
jmp 0x3bcd3
leaq 0xcaef(%rip), %rdi      # 0x487aa
leaq 0xca55(%rip), %rsi      # 0x48717
movl $0x4d, %edx
leaq 0xca9a(%rip), %rcx      # 0x48768
callq 0x52d0
leaq 0x1e8(%rsp), %rdi
callq 0x3c400
leaq 0x198(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
xorl %edx, %edx
callq 0x15670
jmp 0x3bcf9
jmp 0x3bcfb
leaq 0x198(%rsp), %rdi
callq 0x157e0
movb %al, 0x3f(%rsp)
jmp 0x3bd0e
movb 0x3f(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3bd5c
leaq 0x198(%rsp), %rdi
callq 0x15940
jmp 0x3be15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
jmp 0x3c0db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
jmp 0x3be03
leaq 0x198(%rsp), %rdi
callq 0x15810
movq %rax, 0x30(%rsp)
jmp 0x3bd70
movq 0x30(%rsp), %rsi
leaq 0x178(%rsp), %rdi
movl $0x1, %edx
callq 0x2f570
jmp 0x3bd89
leaq 0x1e8(%rsp), %rdi
leaq 0x178(%rsp), %rsi
callq 0x3c410
movb %dl, 0x27(%rsp)
movq %rax, 0x28(%rsp)
jmp 0x3bda9
movb 0x27(%rsp), %al
movq 0x28(%rsp), %rcx
movq %rcx, 0x168(%rsp)
movb %al, 0x170(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x5290
leaq 0x198(%rsp), %rdi
callq 0x15820
jmp 0x3bddd
jmp 0x3bcfb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x5290
leaq 0x198(%rsp), %rdi
callq 0x15940
jmp 0x3c0db
leaq 0x1e8(%rsp), %rdi
callq 0x3c470
movl %eax, 0x164(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
leaq 0x514(%rsp), %rdx
xorl %ecx, %ecx
callq 0x15340
jmp 0x3be4a
jmp 0x3be4c
leaq 0x118(%rsp), %rdi
callq 0x15520
movb %al, 0x26(%rsp)
jmp 0x3be5f
movb 0x26(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3be94
leaq 0x118(%rsp), %rdi
callq 0x15610
jmp 0x3bf4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
jmp 0x3bf3b
leaq 0x118(%rsp), %rdi
callq 0x15540
movq %rax, 0x18(%rsp)
jmp 0x3bea8
movq 0x18(%rsp), %rsi
leaq 0xf8(%rsp), %rdi
movl $0x1, %edx
callq 0x2f570
jmp 0x3bec1
leaq 0x1e8(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x3c410
movb %dl, 0xf(%rsp)
movq %rax, 0x10(%rsp)
jmp 0x3bee1
movb 0xf(%rsp), %al
movq 0x10(%rsp), %rcx
movq %rcx, 0xe8(%rsp)
movb %al, 0xf0(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x5290
leaq 0x118(%rsp), %rdi
callq 0x15570
jmp 0x3bf15
jmp 0x3be4c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x5290
leaq 0x118(%rsp), %rdi
callq 0x15610
jmp 0x3c0db
leaq 0x1e8(%rsp), %rdi
callq 0x3c470
movl 0x164(%rsp), %ecx
cmpq %rcx, %rax
jne 0x3bf68
jmp 0x3bf87
leaq 0xc84d(%rip), %rdi      # 0x487bc
leaq 0xc7a1(%rip), %rsi      # 0x48717
movl $0x59, %edx
leaq 0xc7e6(%rip), %rcx      # 0x48768
callq 0x52d0
leaq 0xa0(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
leaq 0x514(%rsp), %rdx
xorl %ecx, %ecx
callq 0x15340
jmp 0x3bfa8
jmp 0x3bfaa
leaq 0xa0(%rsp), %rdi
callq 0x15520
movb %al, 0xe(%rsp)
jmp 0x3bfbd
movb 0xe(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3bff2
leaq 0xa0(%rsp), %rdi
callq 0x15610
jmp 0x3c085
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
jmp 0x3c076
leaq 0xa0(%rsp), %rdi
callq 0x15540
movq %rax, (%rsp)
jmp 0x3c005
movq (%rsp), %rsi
leaq 0x80(%rsp), %rdi
movl $0x1, %edx
callq 0x2f570
jmp 0x3c01d
leaq 0x1e8(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x3c4a0
jmp 0x3c034
leaq 0x80(%rsp), %rdi
callq 0x5290
leaq 0xa0(%rsp), %rdi
callq 0x15570
jmp 0x3c050
jmp 0x3bfaa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x488(%rsp)
movl %eax, 0x484(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x5290
leaq 0xa0(%rsp), %rdi
callq 0x15610
jmp 0x3c0db
leaq 0x1e8(%rsp), %rdi
callq 0x3c470
cmpq $0x0, %rax
jne 0x3c09a
jmp 0x3c0b9
leaq 0xc731(%rip), %rdi      # 0x487d2
leaq 0xc66f(%rip), %rsi      # 0x48717
movl $0x5e, %edx
leaq 0xc6b4(%rip), %rcx      # 0x48768
callq 0x52d0
leaq 0x1e8(%rsp), %rdi
callq 0x3c4d0
leaq 0x378(%rsp), %rdi
callq 0x3c4d0
addq $0x518, %rsp            # imm = 0x518
retq
leaq 0x1e8(%rsp), %rdi
callq 0x3c4d0
leaq 0x378(%rsp), %rdi
callq 0x3c4d0
movq 0x488(%rsp), %rdi
callq 0x57a0
nopw %cs:(%rax,%rax)
nopl (%rax)