// File: macfergus[P]baduk/cppsrc/baduk/board.cpp
// Function: baduk::Board::hashAfter(baduk::Point, baduk::Stone) const
zobrist::hashcode Board::hashAfter(Point point, Stone stone) const {
    auto hashcode = hash();
    const auto opponent = other(stone);

    // Place the new stone.
    hashcode ^= zobrist_.getEmpty(point);
    hashcode ^= zobrist_.getStone(stone, point);

    for (Point neighbor : neighbors_->get(point)) {
        const auto neighbor_string_idx = grid_[index(neighbor)];
        if (neighbor_string_idx == EMPTY) {
            continue;
        }
        const GoString& neighbor_string = strings_[neighbor_string_idx];
        if (neighbor_string.color() == stone) {
            continue;
        }
        if (neighbor_string.numLiberties() == 1) {
            for (const auto& p : neighbor_string.stones()) {
                hashcode ^= zobrist_.getStone(opponent, p);
                hashcode ^= zobrist_.getEmpty(p);
            }
        }
    }

    return hashcode;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x3da40
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %edi
callq 0x3910
movl %eax, %ecx
movq -0xf8(%rbp), %rax
movl %ecx, -0x24(%rbp)
movq (%rax), %rdi
leaq -0x8(%rbp), %rsi
callq 0x3c1e0
movq %rax, %rcx
movq -0xf8(%rbp), %rax
xorq -0x20(%rbp), %rcx
movq %rcx, -0x20(%rbp)
movq (%rax), %rdi
movl -0x14(%rbp), %esi
leaq -0x8(%rbp), %rdx
callq 0x3c220
movq %rax, %rcx
movq -0xf8(%rbp), %rax
xorq -0x20(%rbp), %rcx
movq %rcx, -0x20(%rbp)
movq 0x10(%rax), %rdi
leaq -0x8(%rbp), %rsi
callq 0x12fb0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x101b0
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x101e0
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x10210
testb $0x1, %al
jne 0x3db1e
jmp 0x3dcd9
leaq -0x38(%rbp), %rdi
callq 0x10250
movq -0xf8(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq %rdi, %rax
addq $0x20, %rax
movq %rax, -0x100(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x54(%rbp)
movq -0x54(%rbp), %rsi
callq 0x3c6a0
movq -0x100(%rbp), %rdi
movl %eax, %eax
movl %eax, %esi
callq 0x3e260
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
cmpl $-0x1, -0x4c(%rbp)
jne 0x3db74
jmp 0x3dccb
movq -0xf8(%rbp), %rdi
addq $0x5c8, %rdi            # imm = 0x5C8
movslq -0x4c(%rbp), %rsi
callq 0x3e640
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x3e310
cmpl -0x14(%rbp), %eax
jne 0x3dba2
jmp 0x3dccb
movq -0x60(%rbp), %rdi
callq 0x3e600
cmpq $0x1, %rax
jne 0x3dcc9
movq -0x60(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x9800
movq -0x108(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0x9d20
movl %edx, -0xb8(%rbp)
movq %rax, -0xc0(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0xa8(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x68(%rbp), %rdi
callq 0x9d60
movl %edx, -0xd8(%rbp)
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movl -0xd8(%rbp), %eax
movl %eax, -0xc8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x9a90
testb $0x1, %al
jne 0x3dc50
jmp 0x3dcc7
leaq -0xb0(%rbp), %rdi
callq 0x9a60
movq %rax, %rcx
movq -0xf8(%rbp), %rax
movq %rcx, -0xf0(%rbp)
leaq -0xf0(%rbp), %rcx
movq %rcx, -0xe8(%rbp)
movq (%rax), %rdi
movl -0x24(%rbp), %esi
movq -0xe8(%rbp), %rdx
callq 0x3c220
movq %rax, %rcx
movq -0xf8(%rbp), %rax
xorq -0x20(%rbp), %rcx
movq %rcx, -0x20(%rbp)
movq (%rax), %rdi
movq -0xe8(%rbp), %rsi
callq 0x3c1e0
xorq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x99e0
jmp 0x3dc37
jmp 0x3dcc9
jmp 0x3dccb
leaq -0x38(%rbp), %rdi
callq 0x10270
jmp 0x3db08
movq -0x20(%rbp), %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)