// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %edx, %ebp
movq %rdi, %r14
leaq 0x48(%rsp), %rbx
movq %rsi, (%rbx)
movq 0x18(%rdi), %r12
movl %edx, %edi
callq 0x37dc
movl %eax, %r13d
movq (%r14), %rdi
movq %rbx, %rsi
callq 0xf620
movq %rax, %r15
xorq %r12, %r15
movq (%r14), %rdi
movl %ebp, (%rsp)
movl %ebp, %esi
movq %rbx, %rdx
callq 0xf656
movq %rax, %r12
xorq %r15, %r12
movq 0x10(%r14), %rdi
movq %rbx, %rsi
callq 0x7274
movq (%rax), %r8
movq 0x8(%rax), %rsi
cmpq %rsi, %r8
je 0x1069e
movl %r13d, 0x4(%rsp)
leaq 0x5c8(%r14), %rdi
movdqa 0x4001(%rip), %xmm3     # 0x144e0
movdqa 0x4009(%rip), %xmm4     # 0x144f0
movdqa 0x4011(%rip), %xmm5     # 0x14500
pxor %xmm6, %xmm6
leaq 0x38(%rsp), %r13
leaq 0x28(%rsp), %r15
leaq 0x20(%rsp), %rbx
movl (%rsp), %edx
movq %rsi, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movq (%r8), %rax
movl 0xc(%r14), %ecx
imull %eax, %ecx
shrq $0x20, %rax
addl %eax, %ecx
movslq 0x20(%r14,%rcx,4), %rax
cmpq $-0x1, %rax
je 0x10691
imulq $0x78, %rax, %rax
cmpl %edx, (%rdi,%rax)
je 0x10691
addq %rdi, %rax
pxor %xmm0, %xmm0
xorl %ecx, %ecx
movdqu 0x40(%rax,%rcx,8), %xmm1
movdqa %xmm1, %xmm2
psrlw $0x1, %xmm2
pand %xmm3, %xmm2
psubb %xmm2, %xmm1
movdqa %xmm1, %xmm2
pand %xmm4, %xmm2
psrlw $0x2, %xmm1
pand %xmm4, %xmm1
paddb %xmm2, %xmm1
movdqa %xmm1, %xmm2
psrlw $0x4, %xmm2
paddb %xmm1, %xmm2
pand %xmm5, %xmm2
psadbw %xmm6, %xmm2
paddq %xmm2, %xmm0
addq $0x2, %rcx
cmpq $0x6, %rcx
jne 0x10544
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
paddq %xmm0, %xmm1
movq %xmm1, %rcx
cmpq $0x1, %rcx
jne 0x10691
movq %r8, 0x18(%rsp)
movq 0x38(%rax), %rcx
movq %rcx, 0x80(%rsp)
movdqu 0x8(%rax), %xmm0
movdqu 0x18(%rax), %xmm1
movdqu 0x28(%rax), %xmm2
movdqa %xmm2, 0x70(%rsp)
movdqa %xmm1, 0x60(%rsp)
movdqa %xmm0, 0x50(%rsp)
leaq 0x50(%rsp), %rbp
movq %rbp, %rdi
callq 0x4ee8
movq %rax, 0x38(%rsp)
movl %edx, 0x40(%rsp)
movq %rbp, %rdi
callq 0x4f2e
movq %rax, 0x28(%rsp)
movl %edx, 0x30(%rsp)
movq %r13, %rdi
movq %r15, %rsi
callq 0x4d06
testb %al, %al
movq %r15, %rbp
je 0x10660
movq %r13, %rdi
callq 0x4cda
movq %rax, 0x20(%rsp)
movq (%r14), %rdi
movl 0x4(%rsp), %esi
movq %rbx, %rdx
callq 0xf656
movq %rax, %r15
movq (%r14), %rdi
movq %rbx, %rsi
callq 0xf620
xorq %r12, %r15
xorq %rax, %r15
movq %r13, %rdi
callq 0x4c8a
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4d06
movq %r15, %r12
testb %al, %al
jne 0x10616
movl (%rsp), %edx
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdi
movdqa 0x3e6b(%rip), %xmm3     # 0x144e0
movdqa 0x3e73(%rip), %xmm4     # 0x144f0
movdqa 0x3e7b(%rip), %xmm5     # 0x14500
pxor %xmm6, %xmm6
movq %rbp, %r15
movq 0x18(%rsp), %r8
addq $0x8, %r8
cmpq %rsi, %r8
jne 0x1050f
movq %r12, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq