// File: /workspace/github_cpp_makefile_star2_O3/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 0x3b28
movq %r13, (%rbx)
movq %r13, %rdi
callq 0x3c4e
movq %rax, %r13
movq %r12, %rdi
movq %r15, %rsi
callq 0x3fae
cltq
movq (%r13,%rax,8), %rax
movq %rax, 0x8(%rbx)
movw $0x0, 0x28(%rbx)
movb $0x0, 0x2a(%rbx)
movq (%rbx), %rdi
callq 0x508e
cmpq $0x0, (%rax)
jne 0x593a
movb $0x1, 0x28(%rbx)
movq (%rbx), %rdi
callq 0x5098
testq %rax, %rax
jne 0x594b
movb $0x1, 0x29(%rbx)
movq (%rbx), %rdi
callq 0x50a2
testq %rax, %rax
jne 0x595c
movb $0x1, 0x2a(%rbx)
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x50ac
movl $0x0, -0x2c(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x5989
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x5995
leaq -0x2c(%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 0x59e9
movq 0x8(%rbx), %rdi
callq 0x2a0e
cmpl $0x64, %eax
jl 0x59e9
movl $0x2, -0x2c(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x59dd
movl $0x2, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x59e9
leaq -0x2c(%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 0x5a5e
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 0x5a8b
movl $0x1, -0x2c(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
jne 0x5a6f
leaq -0x2c(%rbp), %rdx
movq %r14, %rdi
callq 0x5f48
jmp 0x5a8b
movl $0x1, -0x2c(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x5a7f
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x5a8b
leaq -0x2c(%rbp), %rdx
movq %r14, %rdi
callq 0x5f48
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5aba
jmp 0x5aba
jmp 0x5aba
jmp 0x5aba
jmp 0x5aba
jmp 0x5aba
movq %rax, %r15
movl $0x1e0, %esi            # imm = 0x1E0
movq %r13, %rdi
callq 0x2140
jmp 0x5abd
jmp 0x5aba
movq %rax, %r15
movq (%r14), %rdi
testq %rdi, %rdi
je 0x5ad1
movq 0x20(%rbx), %rsi
subq %rdi, %rsi
callq 0x2140
movq %r15, %rdi
callq 0x21c0
nop