// File: tewalds[P]morat/pentago/agentmcts.cpp
// Function: Morat::Pentago::AgentMCTS::create_children_simple(Morat::Pentago::Board const&, Morat::Pentago::AgentMCTS::Node*)
void AgentMCTS::create_children_simple(const Board & board, Node * node){
	assert(node->children.empty());

	node->children.alloc(board.moves_avail(), ctmem);

	Node * child = node->children.begin(),
		 * end   = node->children.end();
	MoveIterator moveit(board, prunesymmetry);
	int num_moves = 0;
	for(; !moveit.done() && child != end; ++moveit, ++child){
		*child = Node(*moveit);
		num_moves++;
	}

	if(prunesymmetry)
		node->children.shrink(num_moves); //shrink the node to ignore the extra moves
	else //both end conditions should happen in parallel
		assert(moveit.done() && child == end);

	PLUS(nodes, node->children.num());
}

// Assembly:
subq $0xe8, %rsp
movq %rdi, 0xe0(%rsp)
movq %rsi, 0xd8(%rsp)
movq %rdx, 0xd0(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xd0(%rsp), %rdi
addq $0x18, %rdi
callq 0x1ca70
testb $0x1, %al
jne 0x1b6e3
jmp 0x1b6e5
jmp 0x1b704
leaq 0x2907d(%rip), %rdi     # 0x44769
leaq 0x28fb1(%rip), %rsi     # 0x446a4
movl $0x14b, %edx            # imm = 0x14B
leaq 0x29081(%rip), %rcx     # 0x44780
callq 0x52d0
movq 0xd0(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x20(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x168e0
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rdx
movl %eax, %esi
addq $0xe8, %rdx
callq 0x1e3e0
movq 0xd0(%rsp), %rdi
addq $0x18, %rdi
callq 0x1d7b0
movq %rax, 0xc8(%rsp)
movq 0xd0(%rsp), %rdi
addq $0x18, %rdi
callq 0x1d800
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0xc0(%rsp)
movq 0xd8(%rsp), %rsi
movb 0x6c(%rax), %al
andb $0x1, %al
movzbl %al, %edx
leaq 0x70(%rsp), %rdi
callq 0x15670
movl $0x0, 0x6c(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x157e0
movb %al, 0x1f(%rsp)
jmp 0x1b7a6
movb 0x1f(%rsp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x1e(%rsp)
jne 0x1b7ce
jmp 0x1b7b7
movq 0xc8(%rsp), %rax
cmpq 0xc0(%rsp), %rax
setne %al
movb %al, 0x1e(%rsp)
movb 0x1e(%rsp), %al
testb $0x1, %al
jne 0x1b7db
jmp 0x1b88d
leaq 0x70(%rsp), %rdi
callq 0x15960
movq %rax, 0x10(%rsp)
jmp 0x1b7ec
movq 0x10(%rsp), %rsi
leaq 0x40020(%rip), %rax     # 0x5b818
movb (%rax), %al
movb %al, 0x37(%rsp)
movzbl 0x37(%rsp), %edx
leaq 0x38(%rsp), %rdi
callq 0x1e450
jmp 0x1b80f
movq 0xc8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x1d6c0
jmp 0x1b823
leaq 0x38(%rsp), %rdi
callq 0x1cfa0
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6c(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x15820
jmp 0x1b844
movq 0xc8(%rsp), %rax
addq $0x20, %rax
movq %rax, 0xc8(%rsp)
jmp 0x1b796
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
jmp 0x1b966
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x1cfa0
jmp 0x1b966
movq 0x28(%rsp), %rax
testb $0x1, 0x6c(%rax)
je 0x1b8b1
movq 0xd0(%rsp), %rdi
addq $0x18, %rdi
movl 0x6c(%rsp), %esi
callq 0x1e4c0
jmp 0x1b8af
jmp 0x1b916
leaq 0x70(%rsp), %rdi
callq 0x157e0
movb %al, 0xf(%rsp)
jmp 0x1b8c1
movb 0xf(%rsp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xe(%rsp)
jne 0x1b8d2
jmp 0x1b8e9
movq 0xc8(%rsp), %rax
cmpq 0xc0(%rsp), %rax
sete %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
testb $0x1, %al
jne 0x1b8f3
jmp 0x1b8f5
jmp 0x1b914
leaq 0x28ed2(%rip), %rdi     # 0x447ce
leaq 0x28da1(%rip), %rsi     # 0x446a4
movl $0x15b, %edx            # imm = 0x15B
leaq 0x28e71(%rip), %rcx     # 0x44780
callq 0x52d0
jmp 0x1b916
movq 0x28(%rsp), %rax
addq $0xc8, %rax
movq %rax, (%rsp)
movq 0xd0(%rsp), %rdi
addq $0x18, %rdi
callq 0x1bc90
movl %eax, 0x8(%rsp)
jmp 0x1b93c
movq (%rsp), %rdi
movl 0x8(%rsp), %eax
movl %eax, 0x30(%rsp)
leaq 0x30(%rsp), %rsi
callq 0x1e4f0
jmp 0x1b954
leaq 0x70(%rsp), %rdi
callq 0x15940
addq $0xe8, %rsp
retq
leaq 0x70(%rsp), %rdi
callq 0x15940
movq 0x60(%rsp), %rdi
callq 0x57a0
nopw (%rax,%rax)