// File: 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
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x60(%rbp)
addq $0x10, %rdi
movq %rdi, -0x58(%rbp)
callq 0x7170
movl $0x1e0, %edi            # imm = 0x1E0
callq 0x2190
movq %rax, -0x50(%rbp)
jmp 0x91a8
movq -0x10(%rbp), %rdi
callq 0x94a0
movq %rax, -0x68(%rbp)
jmp 0x91b7
movq -0x68(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0x4800
jmp 0x91c6
movq -0x60(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, (%rax)
movq (%rax), %rdi
callq 0x4a00
movq %rax, -0x70(%rbp)
jmp 0x91df
movq -0x10(%rbp), %rdi
callq 0x94a0
movq %rax, -0x78(%rbp)
jmp 0x91ee
movq -0x10(%rbp), %rdi
callq 0x94c0
movq %rax, -0x80(%rbp)
jmp 0x91fd
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdi
callq 0x5000
movl %eax, -0x84(%rbp)
jmp 0x9212
movq -0x60(%rbp), %rax
movq -0x70(%rbp), %rcx
movl -0x84(%rbp), %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movq %rcx, 0x8(%rax)
movb $0x0, 0x28(%rax)
movb $0x0, 0x29(%rax)
movb $0x0, 0x2a(%rax)
movq (%rax), %rdi
callq 0x63f0
movq %rax, -0x90(%rbp)
jmp 0x9248
movq -0x90(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x928f
movq -0x60(%rbp), %rax
movb $0x1, 0x28(%rax)
jmp 0x928f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x948d
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x1e0, %esi            # imm = 0x1E0
callq 0x21a0
jmp 0x948d
movq -0x60(%rbp), %rax
movq (%rax), %rdi
callq 0x6410
movq %rax, -0x98(%rbp)
jmp 0x92a4
movq -0x98(%rbp), %rax
cmpq $0x0, %rax
jne 0x92b9
movq -0x60(%rbp), %rax
movb $0x1, 0x29(%rax)
movq -0x60(%rbp), %rax
movq (%rax), %rdi
callq 0x6430
movq %rax, -0xa0(%rbp)
jmp 0x92ce
movq -0xa0(%rbp), %rax
cmpq $0x0, %rax
jne 0x92e3
movq -0x60(%rbp), %rax
movb $0x1, 0x2a(%rax)
movq -0x60(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x6450
jmp 0x92f5
movq -0x60(%rbp), %rdi
addq $0x10, %rdi
movl $0x0, -0x20(%rbp)
leaq -0x20(%rbp), %rsi
callq 0x9800
jmp 0x930f
movq -0x60(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x4eb0
movq %rax, -0xa8(%rbp)
jmp 0x9328
movq -0xa8(%rbp), %rdi
callq 0x3250
movl %eax, -0xac(%rbp)
jmp 0x933c
movl -0xac(%rbp), %eax
cmpl $0x64, %eax
jl 0x9383
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3250
movl %eax, -0xb0(%rbp)
jmp 0x935c
movl -0xb0(%rbp), %eax
cmpl $0x64, %eax
jl 0x9383
movq -0x60(%rbp), %rdi
addq $0x10, %rdi
movl $0x2, -0x24(%rbp)
leaq -0x24(%rbp), %rsi
callq 0x9800
jmp 0x9381
jmp 0x9383
movq -0x60(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x4f50
movq %rax, -0xb8(%rbp)
jmp 0x939c
movq -0xb8(%rbp), %rdi
callq 0x3690
movq %rax, -0xc0(%rbp)
jmp 0x93b1
movq -0x60(%rbp), %rax
movq -0xc0(%rbp), %rcx
movq %rcx, -0x2c(%rbp)
movl -0x28(%rbp), %ecx
movl %ecx, -0xcc(%rbp)
movq 0x8(%rax), %rdi
callq 0x3690
movq %rax, -0xc8(%rbp)
jmp 0x93db
movl -0xcc(%rbp), %eax
movq -0xc8(%rbp), %rcx
movq %rcx, -0x34(%rbp)
cmpl -0x30(%rbp), %eax
jle 0x9468
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3250
movl %eax, -0xd0(%rbp)
jmp 0x9406
movq -0x60(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x4f50
movq %rax, -0xd8(%rbp)
jmp 0x941f
movq -0xd8(%rbp), %rdi
callq 0x3690
movq %rax, -0xe0(%rbp)
jmp 0x9434
movl -0xd0(%rbp), %eax
movq -0xe0(%rbp), %rcx
movq %rcx, -0x3c(%rbp)
cmpl -0x38(%rbp), %eax
jl 0x9466
movq -0x60(%rbp), %rdi
addq $0x10, %rdi
movl $0x1, -0x40(%rbp)
leaq -0x40(%rbp), %rsi
callq 0x9800
jmp 0x9464
jmp 0x9466
jmp 0x9484
movq -0x60(%rbp), %rdi
addq $0x10, %rdi
movl $0x1, -0x44(%rbp)
leaq -0x44(%rbp), %rsi
callq 0x9800
jmp 0x9482
jmp 0x9484
addq $0xe0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x73e0
movq -0x18(%rbp), %rdi
callq 0x22a0
nop