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

	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(this->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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
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, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x3a88
movq %r13, (%rbx)
movq %r13, %rdi
callq 0x3bae
movq %rax, %r13
movq %r12, %rdi
movq %r15, %rsi
callq 0x3f1c
cltq
movq (%r13,%rax,8), %rax
movq %rax, 0x8(%rbx)
movw $0x0, 0x28(%rbx)
movb $0x0, 0x2a(%rbx)
movq (%rbx), %rdi
callq 0x505a
cmpq $0x0, (%rax)
jne 0x592e
movb $0x1, 0x28(%rbx)
movq (%rbx), %rdi
callq 0x5064
testq %rax, %rax
jne 0x593f
movb $0x1, 0x29(%rbx)
movq (%rbx), %rdi
callq 0x506e
testq %rax, %rax
jne 0x5950
movb $0x1, 0x2a(%rbx)
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x5078
movl $0x0, -0x2c(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x597d
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x5989
leaq -0x2c(%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 0x59dd
movq 0x8(%rbx), %rdi
callq 0x2a0a
cmpl $0x64, %eax
jl 0x59dd
movl $0x2, -0x2c(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x59d1
movl $0x2, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x59dd
leaq -0x2c(%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 0x5a52
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 0x5a7f
movl $0x1, -0x2c(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
jne 0x5a63
leaq -0x2c(%rbp), %rdx
movq %r14, %rdi
callq 0x5f36
jmp 0x5a7f
movl $0x1, -0x2c(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x5a73
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x5a7f
leaq -0x2c(%rbp), %rdx
movq %r14, %rdi
callq 0x5f36
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5aae
jmp 0x5aae
jmp 0x5aae
jmp 0x5aae
jmp 0x5aae
jmp 0x5aae
movq %rax, %r15
movl $0x1e0, %esi            # imm = 0x1E0
movq %r13, %rdi
callq 0x2140
jmp 0x5ab1
jmp 0x5aae
movq %rax, %r15
movq (%r14), %rdi
testq %rdi, %rdi
je 0x5ac5
movq 0x20(%rbx), %rsi
subq %rdi, %rsi
callq 0x2140
movq %r15, %rdi
callq 0x21c0
nop