// File: /workspace/github_cpp_makefile_star2_O1/fredericmarchand[P]TexasHoldem/NodeState.cpp
// Function: NodeState::NodeState(NodeState*)
NodeState::NodeState(NodeState *state)
{
	game = new Game(state->getData());
	player = game->getPlayers()[state->getData()->getPlayerIndex(state->getPlayer())];

	flopNull = false;
	turnNull = false;
	riverNull = false;
	if (game->getFlop()[0] == NULL)
		flopNull = true;
	if (game->getTurn() == NULL)
		turnNull = true;
	if (game->getRiver() == NULL)
		riverNull = true;
	
	game->setupAIGame(player);

	moves.push_back(FOLD);

	if (game->getNextPlayer(player)->getChipCount() >= 100 && player->getChipCount() >= 100)	//BET/RAISE
	{
		moves.push_back(BET);
	}

	if (game->getPreviousPlayer(player)->getState().bet > player->getState().bet)	
	{
		if (player->getChipCount() >= game->getPreviousPlayer(player)->getState().bet)
		{
			moves.push_back(CHECK);	//CALL
		}
	}
	else //CHECK
	{
		moves.push_back(CHECK);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movq $0x0, 0x20(%rdi)
movl $0x1e0, %edi            # imm = 0x1E0
callq 0x2130
movq %rax, %r12
movq (%r15), %rsi
movq %rax, %rdi
callq 0x3a88
movq %r12, (%rbx)
movq %r12, %rdi
callq 0x3bae
movq %rax, %r12
movq (%r15), %rdi
movq 0x8(%r15), %rsi
callq 0x3f1c
cltq
movq (%r12,%rax,8), %rax
movq %rax, 0x8(%rbx)
movw $0x0, 0x28(%rbx)
movb $0x0, 0x2a(%rbx)
movq (%rbx), %rdi
callq 0x505a
cmpq $0x0, (%rax)
jne 0x5b4e
movb $0x1, 0x28(%rbx)
movq (%rbx), %rdi
callq 0x5064
testq %rax, %rax
jne 0x5b5f
movb $0x1, 0x29(%rbx)
movq (%rbx), %rdi
callq 0x506e
testq %rax, %rax
jne 0x5b70
movb $0x1, 0x2a(%rbx)
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x5078
movl $0x0, -0x24(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x5b9d
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x5ba9
leaq -0x24(%rbp), %rdx
movq %r14, %rdi
callq 0x5f36
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x3e88
movq %rax, %rdi
callq 0x2a0a
cmpl $0x64, %eax
jl 0x5bfd
movq 0x8(%rbx), %rdi
callq 0x2a0a
cmpl $0x64, %eax
jl 0x5bfd
movl $0x2, -0x24(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x5bf1
movl $0x2, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x5bfd
leaq -0x24(%rbp), %rdx
movq %r14, %rdi
callq 0x5f36
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x3ebc
movq %rax, %rdi
callq 0x2e58
movq %rax, %r15
movq 0x8(%rbx), %rdi
callq 0x2e58
shrq $0x20, %r15
shrq $0x20, %rax
cmpl %eax, %r15d
jle 0x5c72
movq 0x8(%rbx), %rdi
callq 0x2a0a
movl %eax, %r15d
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x3ebc
movq %rax, %rdi
callq 0x2e58
shrq $0x20, %rax
cmpl %eax, %r15d
jl 0x5c9f
movl $0x1, -0x24(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
jne 0x5c83
leaq -0x24(%rbp), %rdx
movq %r14, %rdi
callq 0x5f36
jmp 0x5c9f
movl $0x1, -0x24(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x5c93
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x5c9f
leaq -0x24(%rbp), %rdx
movq %r14, %rdi
callq 0x5f36
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5ccc
jmp 0x5ccc
jmp 0x5ccc
jmp 0x5ccc
jmp 0x5ccc
jmp 0x5ccc
movq %rax, %r15
movl $0x1e0, %esi            # imm = 0x1E0
movq %r12, %rdi
callq 0x2140
jmp 0x5ccf
jmp 0x5ccc
movq %rax, %r15
movq (%r14), %rdi
testq %rdi, %rdi
je 0x5ce3
movq 0x20(%rbx), %rsi
subq %rdi, %rsi
callq 0x2140
movq %r15, %rdi
callq 0x21c0
nop