// File: 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
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x158(%rbp)
addq $0x5c8, %rdi            # imm = 0x5C8
movslq -0xc(%rbp), %rsi
callq 0x3e2b0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x58(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x9800
movq -0x150(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9d20
movl %edx, -0x70(%rbp)
movq %rax, -0x78(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x60(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9d60
movl %edx, -0x90(%rbp)
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x88(%rbp)
movl -0x90(%rbp), %eax
movl %eax, -0x80(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x9a90
testb $0x1, %al
jne 0x3cec4
jmp 0x3d241
leaq -0x68(%rbp), %rdi
callq 0x9a60
movq %rax, -0xa8(%rbp)
leaq -0xa8(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x3e290
movq -0x158(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0xa0(%rbp), %rsi
callq 0x12fb0
movq %rax, -0x160(%rbp)
jmp 0x3cf0e
movq -0x160(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x101b0
movq %rax, -0xe0(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x101e0
movq %rax, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x10210
testb $0x1, %al
jne 0x3cf5e
jmp 0x3d08f
leaq -0xe0(%rbp), %rdi
callq 0x10250
movq -0x158(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
movq %rdi, %rax
addq $0x20, %rax
movq %rax, -0x170(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rsi
callq 0x3c6a0
movl %eax, -0x164(%rbp)
jmp 0x3cfab
movq -0x170(%rbp), %rdi
movl -0x164(%rbp), %eax
movl %eax, %eax
movl %eax, %esi
callq 0x3e2e0
movl (%rax), %eax
movl %eax, -0xf4(%rbp)
cmpl $-0x1, -0xf4(%rbp)
jne 0x3cfee
jmp 0x3d07e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x3d233
leaq -0x118(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x3e380
jmp 0x3d003
movl -0xf4(%rbp), %esi
leaq -0x118(%rbp), %rdi
callq 0x3e320
movb %al, -0x171(%rbp)
jmp 0x3d01d
leaq -0x118(%rbp), %rdi
callq 0x3e470
movb -0x171(%rbp), %al
testb $0x1, %al
jne 0x3d035
jmp 0x3d05a
jmp 0x3d07e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x3e470
jmp 0x3d233
movl -0xf4(%rbp), %eax
cmpl -0xc(%rbp), %eax
je 0x3d07c
leaq -0xc0(%rbp), %rdi
leaq -0xf4(%rbp), %rsi
callq 0x3e4d0
jmp 0x3d07a
jmp 0x3d07c
jmp 0x3d07e
leaq -0xe0(%rbp), %rdi
callq 0x10270
jmp 0x3cf42
leaq -0xc0(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rdi
callq 0x3e540
movq %rax, -0x128(%rbp)
movq -0x120(%rbp), %rdi
callq 0x3e570
movq %rax, -0x130(%rbp)
leaq -0x128(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x3e5a0
testb $0x1, %al
jne 0x3d0dc
jmp 0x3d13c
leaq -0x128(%rbp), %rdi
callq 0x3e5e0
movq -0x158(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x134(%rbp)
addq $0x5c8, %rdi            # imm = 0x5C8
movslq -0x134(%rbp), %rsi
callq 0x3e2b0
movq %rax, %rdi
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rsi
callq 0x9580
jmp 0x3d12c
jmp 0x3d12e
leaq -0x128(%rbp), %rdi
callq 0x3e620
jmp 0x3d0c3
movq -0x158(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x180(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3e310
movl %eax, -0x178(%rbp)
jmp 0x3d15e
movl -0x178(%rbp), %esi
movq -0x180(%rbp), %rdi
movq -0xa0(%rbp), %rdx
callq 0x3c220
movq %rax, -0x188(%rbp)
jmp 0x3d180
movq -0x158(%rbp), %rax
movq -0x188(%rbp), %rdx
movq 0x18(%rax), %rcx
xorq %rdx, %rcx
movq %rcx, 0x18(%rax)
movq (%rax), %rdi
movq -0xa0(%rbp), %rsi
callq 0x3c1e0
movq %rax, -0x190(%rbp)
jmp 0x3d1b1
movq -0x158(%rbp), %rdi
movq -0x190(%rbp), %rcx
movq 0x18(%rdi), %rax
xorq %rcx, %rax
movq %rax, 0x18(%rdi)
movq %rdi, %rax
addq $0x20, %rax
movq %rax, -0x1a0(%rbp)
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rsi
callq 0x3c6a0
movl %eax, -0x194(%rbp)
jmp 0x3d1fd
movq -0x1a0(%rbp), %rdi
movl -0x194(%rbp), %eax
movl %eax, %eax
movl %eax, %esi
callq 0x3e2e0
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
leaq -0xc0(%rbp), %rdi
callq 0x3e470
leaq -0x68(%rbp), %rdi
callq 0x99e0
jmp 0x3ceab
leaq -0xc0(%rbp), %rdi
callq 0x3e470
jmp 0x3d259
movq -0x158(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x3d490
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq -0xd0(%rbp), %rdi
callq 0x3370
nopw %cs:(%rax,%rax)