// File: /workspace/github_cpp_makefile_star2_O3/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 0x3b28
movq %r12, (%rbx)
movq %r12, %rdi
callq 0x3c4e
movq %rax, %r12
movq (%r15), %rdi
movq 0x8(%r15), %rsi
callq 0x3fae
cltq
movq (%r12,%rax,8), %rax
movq %rax, 0x8(%rbx)
movw $0x0, 0x28(%rbx)
movb $0x0, 0x2a(%rbx)
movq (%rbx), %rdi
callq 0x508e
cmpq $0x0, (%rax)
jne 0x5b5a
movb $0x1, 0x28(%rbx)
movq (%rbx), %rdi
callq 0x5098
testq %rax, %rax
jne 0x5b6b
movb $0x1, 0x29(%rbx)
movq (%rbx), %rdi
callq 0x50a2
testq %rax, %rax
jne 0x5b7c
movb $0x1, 0x2a(%rbx)
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x50ac
movl $0x0, -0x24(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x5ba9
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x5bb5
leaq -0x24(%rbp), %rdx
movq %r14, %rdi
callq 0x5f48
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x3f1c
movq %rax, %rdi
callq 0x2a0e
cmpl $0x64, %eax
jl 0x5c09
movq 0x8(%rbx), %rdi
callq 0x2a0e
cmpl $0x64, %eax
jl 0x5c09
movl $0x2, -0x24(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x5bfd
movl $0x2, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x5c09
leaq -0x24(%rbp), %rdx
movq %r14, %rdi
callq 0x5f48
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x3f4e
movq %rax, %rdi
callq 0x2f52
movq %rax, %r15
movq 0x8(%rbx), %rdi
callq 0x2f52
shrq $0x20, %r15
shrq $0x20, %rax
cmpl %eax, %r15d
jle 0x5c7e
movq 0x8(%rbx), %rdi
callq 0x2a0e
movl %eax, %r15d
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x3f4e
movq %rax, %rdi
callq 0x2f52
shrq $0x20, %rax
cmpl %eax, %r15d
jl 0x5cab
movl $0x1, -0x24(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
jne 0x5c8f
leaq -0x24(%rbp), %rdx
movq %r14, %rdi
callq 0x5f48
jmp 0x5cab
movl $0x1, -0x24(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x5c9f
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x5cab
leaq -0x24(%rbp), %rdx
movq %r14, %rdi
callq 0x5f48
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5cd8
jmp 0x5cd8
jmp 0x5cd8
jmp 0x5cd8
jmp 0x5cd8
jmp 0x5cd8
movq %rax, %r15
movl $0x1e0, %esi            # imm = 0x1E0
movq %r12, %rdi
callq 0x2140
jmp 0x5cdb
jmp 0x5cd8
movq %rax, %r15
movq (%r14), %rdi
testq %rdi, %rdi
je 0x5cef
movq 0x20(%rbx), %rsi
subq %rdi, %rsi
callq 0x2140
movq %r15, %rdi
callq 0x21c0
nop