// File: macfergus[P]baduk/cppsrc/baduk/game.cpp
// Function: baduk::GameStateImpl::GameStateImpl(baduk::Stone, std::shared_ptr<baduk::GameStateImpl const>, std::variant<baduk::Play, baduk::Pass, baduk::Resign> const&)
GameStateImpl(
            Stone next_player,
            std::shared_ptr<const GameStateImpl> parent,
            Move const& last_move) :
        board_(parent->board_),
        next_player_(next_player),
        last_move_(last_move),
        prev_state_(parent),
        komi_(parent->komi()),
        num_moves_(parent->numMoves() + 1) {

        if (std::holds_alternative<Play>(last_move)) {
            board_.place(
                std::get<Play>(last_move).point(),
                other(next_player_));
        }

        previous_states_ = parent->previous_states_;
        previous_states_.insert(prev_state_->hash());
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdx, -0x48(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x50(%rbp)
callq 0x5d00
movq -0x50(%rbp), %rdi
addq $0x8, %rdi
callq 0x5d20
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rdi
leaq 0x4baa1(%rip), %rcx     # 0x52a88
movq %rcx, (%rax)
addq $0x18, %rax
movq %rax, -0x60(%rbp)
callq 0x7260
movq -0x60(%rbp), %rdi
movq %rax, %rsi
addq $0x18, %rsi
movl $0x5b30, %edx           # imm = 0x5B30
callq 0x31b0
movq -0x50(%rbp), %rdi
movl -0xc(%rbp), %eax
movl %eax, 0x5b48(%rdi)
addq $0x5b4c, %rdi           # imm = 0x5B4C
movq -0x20(%rbp), %rsi
callq 0x7280
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
addq $0x5b60, %rdi           # imm = 0x5B60
movq %rdi, -0x58(%rbp)
callq 0x72b0
movq -0x50(%rbp), %rdi
addq $0x5b70, %rdi           # imm = 0x5B70
callq 0x5d80
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rdi
addq $0x8ad8, %rax           # imm = 0x8AD8
movq %rax, -0x40(%rbp)
callq 0x7260
movq %rax, %rdi
movq (%rdi), %rax
movq 0x58(%rax), %rax
callq *%rax
movss %xmm0, -0x38(%rbp)
jmp 0x707b
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
movss -0x38(%rbp), %xmm0
movss %xmm0, (%rcx)
addq $0x8adc, %rax           # imm = 0x8ADC
movq %rax, -0x70(%rbp)
callq 0x7260
movq %rax, %rdi
movq (%rdi), %rax
movq 0x60(%rax), %rax
callq *%rax
movl %eax, -0x64(%rbp)
jmp 0x70b0
movq -0x70(%rbp), %rax
movl -0x64(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rdi
callq 0x72e0
testb $0x1, %al
jne 0x70ce
jmp 0x7154
movq -0x50(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x80(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4630
movq %rax, -0x78(%rbp)
jmp 0x70e9
movq -0x78(%rbp), %rdi
callq 0x4650
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, -0x34(%rbp)
movl 0x5b48(%rax), %edi
callq 0x3910
movl %eax, -0x84(%rbp)
jmp 0x7110
movl -0x84(%rbp), %edx
movq -0x80(%rbp), %rdi
movq -0x34(%rbp), %rsi
callq 0x3c6f0
jmp 0x7125
jmp 0x7154
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x4720
movq -0x50(%rbp), %rdi
addq $0x8, %rdi
callq 0x64b0
movq -0x50(%rbp), %rdi
callq 0x6300
jmp 0x71c6
movq -0x48(%rbp), %rdi
callq 0x7260
movq -0x50(%rbp), %rdi
movq %rax, %rsi
addq $0x5b70, %rsi           # imm = 0x5B70
addq $0x5b70, %rdi           # imm = 0x5B70
movq %rdi, -0x98(%rbp)
movl $0x2f68, %edx           # imm = 0x2F68
callq 0x31b0
movq -0x50(%rbp), %rdi
addq $0x5b60, %rdi           # imm = 0x5B60
callq 0x7260
movq %rax, %rdi
movq (%rdi), %rax
movq 0x70(%rax), %rax
callq *%rax
movq %rax, -0x90(%rbp)
jmp 0x71a8
movq -0x90(%rbp), %rsi
movq -0x98(%rbp), %rdi
callq 0x7310
jmp 0x71bd
addq $0xa0, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x3370
nop