// File: /workspace/github_cpp_makefile_star2_O3/macfergus[P]baduk/cppsrc/baduk/board.cpp
// Function: baduk::Board::remove(int)
void Board::remove(StringIdx old_string_idx) {
    const GoString& old_string = strings_[old_string_idx];
    for (auto const& point : old_string.stones()) {
        std::vector<StringIdx> strings_to_update;
        for (Point neighbor : neighbors_->get(point)) {
            auto neighbor_string_idx = grid_[index(neighbor)];
            if (neighbor_string_idx == EMPTY) {
                continue;
            }
            if (contains(strings_to_update, neighbor_string_idx)) {
                continue;
            }
            if (neighbor_string_idx != old_string_idx) {
                strings_to_update.push_back(neighbor_string_idx);
            }
        }
        for (auto string_to_update : strings_to_update) {
            strings_[string_to_update].addLiberty(point);
        }

        hashcode_ ^= zobrist_.getStone(old_string.color(), point);
        hashcode_ ^= zobrist_.getEmpty(point);

        grid_[index(point)] = EMPTY;
    }
    recycle(old_string_idx);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %r14
movl %esi, 0x30(%rsp)
movslq %esi, %rax
movq %rax, 0x50(%rsp)
imulq $0x78, %rax, %r12
movq 0x600(%rdi,%r12), %rax
leaq 0x80(%rsp), %rbx
movq %rax, 0x30(%rbx)
movups 0x5d0(%rdi,%r12), %xmm0
movups 0x5e0(%rdi,%r12), %xmm1
movups 0x5f0(%rdi,%r12), %xmm2
movaps %xmm2, 0x20(%rbx)
movaps %xmm1, 0x10(%rbx)
movaps %xmm0, (%rbx)
movq %rbx, %rdi
callq 0x4ee8
leaq 0x60(%rsp), %r15
movq %rax, (%r15)
movl %edx, 0x8(%r15)
movq %rbx, %rdi
callq 0x4f2e
leaq 0x70(%rsp), %rsi
movq %rax, (%rsi)
movl %edx, 0x8(%rsi)
movq %r15, %rdi
callq 0x4d06
testb %al, %al
je 0xfefd
leaq 0x5c8(%r14), %rbx
leaq (%r14,%r12), %rax
addq $0x5c8, %rax            # imm = 0x5C8
movq %rax, 0x58(%rsp)
leaq 0x60(%rsp), %r15
leaq 0x8(%rsp), %r13
movq %r15, %rdi
callq 0x4cda
movq %rax, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x10(%r14), %rdi
movq %r13, %rsi
callq 0x7274
movq (%rax), %r15
movq 0x8(%rax), %r13
cmpq %r13, %r15
je 0xfe53
movq (%r15), %rax
movl 0xc(%r14), %ecx
imull %eax, %ecx
shrq $0x20, %rax
addl %eax, %ecx
movl 0x20(%r14,%rcx,4), %eax
movl %eax, 0x4(%rsp)
cmpl $-0x1, %eax
je 0xfe4a
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x10958
movl 0x4(%rsp), %eax
movl %eax, 0x34(%rsp)
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x34(%rsp), %rdx
callq 0x10a75
movq %rax, %r12
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rbp
testq %rdi, %rdi
je 0xfe0d
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x3180
cmpq %rbp, %r12
setne %cl
movl 0x4(%rsp), %eax
cmpl 0x30(%rsp), %eax
sete %dl
orb %cl, %dl
jne 0xfe4a
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xfe3b
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xfe4a
leaq 0x10(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x10b36
addq $0x8, %r15
jmp 0xfd98
movq 0x10(%rsp), %r15
movq 0x18(%rsp), %r12
cmpq %r12, %r15
leaq 0x8(%rsp), %r13
je 0xfe84
movslq (%r15), %rax
imulq $0x78, %rax, %rdi
addq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0x4b50
addq $0x4, %r15
cmpq %r12, %r15
jne 0xfe67
movq (%r14), %rdi
movq 0x58(%rsp), %rax
movl (%rax), %esi
movq %r13, %rdx
callq 0xf656
xorq %rax, 0x18(%r14)
movq (%r14), %rdi
movq %r13, %rsi
callq 0xf620
xorq %rax, 0x18(%r14)
movq 0x8(%rsp), %rax
movl 0xc(%r14), %ecx
imull %eax, %ecx
shrq $0x20, %rax
addl %eax, %ecx
movl $0xffffffff, 0x20(%r14,%rcx,4) # imm = 0xFFFFFFFF
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
leaq 0x60(%rsp), %r15
je 0xfee0
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3180
movq %r15, %rdi
callq 0x4c8a
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
callq 0x4d06
testb %al, %al
jne 0xfd67
addq $0x5b18, %r14           # imm = 0x5B18
movq %r14, %rdi
movq 0x50(%rsp), %rsi
callq 0x109d8
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xff45
jmp 0xff45
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0xff48
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x3180
jmp 0xff48
jmp 0xff45
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xff5f
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3180
movq %rbx, %rdi
callq 0x32b0
nop