// File: kmyk[P]procon26/procon26.cpp
// Function: board::split() const
std::vector<board> board::split() const {
    std::vector<board> result;
    bool used[board_size][board_size] = {};
    repeat_from (y, offset().y, offset().y+size().y) {
        repeat_from (x, offset().x, offset().x+size().x) {
            if (m_cell[y][x] == 0 and not used[y][x]) {
                board brd;
                copy_cell_map(m_cell, brd.m_cell, [](int x) -> int { return std::max(1, x); });
                std::stack<point_t> stk;
                stk.push({ x, y });
                while (not stk.empty()) {
                    point_t p = stk.top(); stk.pop();
                    if (used[p.y][p.x]) continue;
                    used[p.y][p.x] = true;
                    brd.m_cell[p.y][p.x] = 0;
                    repeat (i,4) {
                        int ny = p.y + dy[i];
                        int nx = p.x + dx[i];
                        if (not is_on_board({ nx, ny })) continue;
                        if (m_cell[ny][nx] == 0 and not used[ny][nx]) {
                            stk.push({ nx, ny });
                        }
                    }
                }
                brd.shrink();
                brd.update();
                result.push_back(brd);
            }
            x += m_skips[y][x] - 1;
        }
    }
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x25e0, %rsp           # imm = 0x25E0
movq %rdi, -0x25b0(%rbp)
movq %rdi, %rax
movq %rax, -0x25a8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x25a0(%rbp)
movb $0x0, -0x11(%rbp)
callq 0x1b230
leaq -0x420(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x20b0
movq -0x25a0(%rbp), %rdi
callq 0x178a0
movq %rax, -0x42c(%rbp)
movl -0x428(%rbp), %eax
movl %eax, -0x424(%rbp)
movq -0x25a0(%rbp), %rdi
movl -0x424(%rbp), %eax
movl %eax, -0x25b4(%rbp)
callq 0x178a0
movq -0x25a0(%rbp), %rdi
movq %rax, -0x434(%rbp)
movl -0x430(%rbp), %eax
movl %eax, -0x25b8(%rbp)
callq 0x178c0
movl -0x25b8(%rbp), %ecx
movq %rax, %rdx
movl -0x25b4(%rbp), %eax
movq %rdx, -0x43c(%rbp)
addl -0x438(%rbp), %ecx
cmpl %ecx, %eax
jge 0x183cf
movq -0x25a0(%rbp), %rdi
callq 0x178a0
movq %rax, -0x448(%rbp)
movl -0x448(%rbp), %eax
movl %eax, -0x440(%rbp)
movq -0x25a0(%rbp), %rdi
movl -0x440(%rbp), %eax
movl %eax, -0x25bc(%rbp)
callq 0x178a0
movq -0x25a0(%rbp), %rdi
movq %rax, -0x450(%rbp)
movl -0x450(%rbp), %eax
movl %eax, -0x25c0(%rbp)
callq 0x178c0
movl -0x25c0(%rbp), %ecx
movq %rax, %rdx
movl -0x25bc(%rbp), %eax
movq %rdx, -0x458(%rbp)
addl -0x458(%rbp), %ecx
cmpl %ecx, %eax
jge 0x183b9
movq -0x25a0(%rbp), %rax
movslq -0x424(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movslq -0x440(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x18371
movslq -0x424(%rbp), %rcx
leaq -0x420(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x440(%rbp), %rcx
testb $0x1, (%rax,%rcx)
jne 0x18371
leaq -0x2508(%rbp), %rdi
callq 0x17250
jmp 0x180c9
movq -0x25a0(%rbp), %rdi
leaq -0x2508(%rbp), %rsi
callq 0x18410
jmp 0x180de
leaq -0x2568(%rbp), %rdi
callq 0x81a0
jmp 0x180ec
movl -0x440(%rbp), %eax
movl %eax, -0x2570(%rbp)
movl -0x424(%rbp), %eax
movl %eax, -0x256c(%rbp)
leaq -0x2568(%rbp), %rdi
leaq -0x2570(%rbp), %rsi
callq 0x1b250
jmp 0x18119
jmp 0x1811b
leaq -0x2568(%rbp), %rdi
callq 0x8200
movb %al, -0x25c1(%rbp)
jmp 0x1812f
movb -0x25c1(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x18140
jmp 0x18334
leaq -0x2568(%rbp), %rdi
callq 0x8220
movq %rax, -0x25d0(%rbp)
jmp 0x18155
movq -0x25d0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x2578(%rbp)
leaq -0x2568(%rbp), %rdi
callq 0x8240
jmp 0x18174
movslq -0x2574(%rbp), %rcx
leaq -0x420(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x2578(%rbp), %rcx
testb $0x1, (%rax,%rcx)
je 0x181d2
jmp 0x1811b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2510(%rbp)
movl %eax, -0x2514(%rbp)
jmp 0x183f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2510(%rbp)
movl %eax, -0x2514(%rbp)
leaq -0x2568(%rbp), %rdi
callq 0x8540
jmp 0x183f5
movslq -0x2574(%rbp), %rcx
leaq -0x420(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x2578(%rbp), %rcx
movb $0x1, (%rax,%rcx)
leaq -0x2508(%rbp), %rax
movslq -0x2574(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movslq -0x2578(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl $0x0, -0x257c(%rbp)
cmpl $0x4, -0x257c(%rbp)
jge 0x1832f
movl -0x2574(%rbp), %eax
movslq -0x257c(%rbp), %rdx
leaq 0x9020(%rip), %rcx      # 0x21260
movl (%rcx,%rdx,4), %ecx
addl %ecx, %eax
movl %eax, -0x2580(%rbp)
movl -0x2578(%rbp), %eax
movslq -0x257c(%rbp), %rdx
leaq 0x9021(%rip), %rcx      # 0x21280
movl (%rcx,%rdx,4), %ecx
addl %ecx, %eax
movl %eax, -0x2584(%rbp)
movl -0x2584(%rbp), %eax
movl %eax, -0x258c(%rbp)
movl -0x2580(%rbp), %eax
movl %eax, -0x2588(%rbp)
leaq -0x258c(%rbp), %rdi
callq 0x1ecd0
movb %al, -0x25d1(%rbp)
jmp 0x18296
movb -0x25d1(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x182a4
jmp 0x182a6
jmp 0x1831b
movq -0x25a0(%rbp), %rax
movslq -0x2580(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movslq -0x2584(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x18319
movslq -0x2580(%rbp), %rcx
leaq -0x420(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x2584(%rbp), %rcx
testb $0x1, (%rax,%rcx)
jne 0x18319
movl -0x2584(%rbp), %eax
movl %eax, -0x2594(%rbp)
movl -0x2580(%rbp), %eax
movl %eax, -0x2590(%rbp)
leaq -0x2568(%rbp), %rdi
leaq -0x2594(%rbp), %rsi
callq 0x1b250
jmp 0x18317
jmp 0x18319
jmp 0x1831b
movl -0x257c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x257c(%rbp)
jmp 0x1821f
jmp 0x1811b
leaq -0x2508(%rbp), %rdi
callq 0x173f0
jmp 0x18342
leaq -0x2508(%rbp), %rdi
callq 0x17570
jmp 0x18350
movq -0x25b0(%rbp), %rdi
leaq -0x2508(%rbp), %rsi
callq 0x1b280
jmp 0x18365
leaq -0x2568(%rbp), %rdi
callq 0x8540
movq -0x25a0(%rbp), %rax
addq $0x102c, %rax           # imm = 0x102C
movslq -0x424(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movslq -0x440(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
addl -0x440(%rbp), %eax
movl %eax, -0x440(%rbp)
movl -0x440(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x440(%rbp)
jmp 0x18014
jmp 0x183bb
movl -0x424(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x424(%rbp)
jmp 0x17f9a
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0x183e5
movq -0x25b0(%rbp), %rdi
callq 0x7990
movq -0x25a8(%rbp), %rax
addq $0x25e0, %rsp           # imm = 0x25E0
popq %rbp
retq
movq -0x25b0(%rbp), %rdi
callq 0x7990
movq -0x2510(%rbp), %rdi
callq 0x2260
nopl (%rax)