// File: /workspace/github_cpp_makefile_star2_O1/Leeingnyo[P]newPuyoC/./board.h
// Function: Board::Chaining(bool (&) [13][6], std::vector<Board::Pair, std::allocator<Board::Pair>>&, std::vector<Board::Pair, std::allocator<Board::Pair>>&, int, int)
void Chaining(bool (&check)[MAP_HEIGHT][MAP_WIDTH], std::vector<Pair> &chain, std::vector<Pair> &nearby_obstacles, int x, int y) {
        if (!check[y][x]) {
            check[y][x] = true;
            if (map[y][x].IsObstacle()) {
                nearby_obstacles.push_back(Pair(x, y));
                return;
            }
            chain.push_back(Pair(x, y));
            if (y > 0 && (map[y - 1][x].IsSameColor(map[y][x]) || map[y - 1][x].IsObstacle()))
                Chaining(check, chain, nearby_obstacles, x, y - 1);
            if (x > 0 && (map[y][x - 1].IsSameColor(map[y][x]) || map[y][x - 1].IsObstacle()))
                Chaining(check, chain, nearby_obstacles, x - 1, y);
            if (y + 1 < MAP_HEIGHT && (map[y + 1][x].IsSameColor(map[y][x]) || map[y + 1][x].IsObstacle()))
                Chaining(check, chain, nearby_obstacles, x, y + 1);
            if (x + 1 < MAP_WIDTH && (map[y][x + 1].IsSameColor(map[y][x]) || map[y][x + 1].IsObstacle()))
                Chaining(check, chain, nearby_obstacles, x + 1, y);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r10
movslq %r9d, %rax
movslq %r8d, %r12
leaq (%rax,%rax,2), %rax
leaq (%rsi,%rax,2), %rdx
cmpb $0x0, (%r12,%rdx)
jne 0x8c01
movl %r9d, %r14d
movl %r8d, %r15d
movq %rdi, %rbx
addq %r12, %rdx
movb $0x1, (%rdx)
leaq (%rdi,%rax,2), %rdx
cmpb $0x5, (%r12,%rdx)
jne 0x8ab6
movl %r15d, -0x30(%rbp)
movl %r14d, -0x2c(%rbp)
movq 0x8(%rcx), %rsi
cmpq 0x10(%rcx), %rsi
je 0x8ae5
movq -0x30(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rcx)
jmp 0x8c01
movq %rsi, %r13
movl %r15d, -0x30(%rbp)
movl %r14d, -0x2c(%rbp)
movq 0x8(%r10), %rsi
cmpq 0x10(%r10), %rsi
movq %rcx, -0x48(%rbp)
movq %r10, -0x50(%rbp)
movq %rdx, -0x40(%rbp)
je 0x8af6
movq -0x30(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r10)
jmp 0x8b0e
leaq -0x30(%rbp), %rdx
movq %rcx, %rdi
callq 0x8c4c
jmp 0x8c01
leaq -0x30(%rbp), %rdx
movq %r10, %rdi
callq 0x8c4c
movq -0x40(%rbp), %rdx
movq -0x50(%rbp), %r10
movq -0x48(%rbp), %rcx
leaq (%rdx,%r12), %rsi
testl %r14d, %r14d
jle 0x8b54
leal -0x1(%r14), %r9d
leaq (%r9,%r9,2), %rax
leaq (%rbx,%rax,2), %rax
movb (%r12,%rax), %al
cmpb $0x5, %al
je 0x8b2f
cmpb (%rsi), %al
jne 0x8b54
movq %rbx, %rdi
movq %rsi, -0x38(%rbp)
movq %r13, %rsi
movq %r10, %rdx
movl %r15d, %r8d
callq 0x8a4c
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x50(%rbp), %r10
movq -0x48(%rbp), %rcx
testl %r15d, %r15d
jle 0x8b8e
leal -0x1(%r15), %r8d
movb (%r8,%rdx), %al
cmpb $0x5, %al
je 0x8b69
cmpb (%rsi), %al
jne 0x8b8e
movq %rbx, %rdi
movq %rsi, -0x38(%rbp)
movq %r13, %rsi
movq %r10, %rdx
movl %r14d, %r9d
callq 0x8a4c
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x50(%rbp), %r10
movq -0x48(%rbp), %rcx
cmpl $0xb, %r14d
jg 0x8bd6
leal 0x1(%r14), %r9d
movslq %r9d, %rax
leaq (%rax,%rax,2), %rax
leaq (%rbx,%rax,2), %rax
movb (%r12,%rax), %al
cmpb $0x5, %al
je 0x8baf
cmpb (%rsi), %al
jne 0x8bd6
movq %rbx, %rdi
movq %rsi, -0x38(%rbp)
movq %r13, %rsi
movq %r10, %rdx
movl %r15d, %r8d
movq %r10, %r12
callq 0x8a4c
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %r12, %r10
movq -0x48(%rbp), %rcx
cmpl $0x4, %r15d
jg 0x8c01
incl %r15d
movslq %r15d, %rax
movb (%rax,%rdx), %al
cmpb $0x5, %al
je 0x8bed
cmpb (%rsi), %al
jne 0x8c01
movq %rbx, %rdi
movq %r13, %rsi
movq %r10, %rdx
movl %r15d, %r8d
movl %r14d, %r9d
callq 0x8a4c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq