// File: /workspace/github_cpp_makefile_star2_O2/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
movslq %r9d, %rax
movslq %r8d, %r14
imulq $0x6, %rax, %r12
leaq (%rsi,%r12), %rax
cmpb $0x0, (%r14,%rax)
jne 0x7588
movl %r9d, %ebx
movl %r8d, %r15d
addq %r14, %rax
movb $0x1, (%rax)
addq %rdi, %r12
cmpb $0x5, (%r14,%r12)
jne 0x7475
leaq -0x50(%rbp), %rsi
movl %r15d, (%rsi)
movl %ebx, 0x4(%rsi)
movq %rcx, %rdi
callq 0x7672
jmp 0x7588
movq %rsi, %r13
movq %rcx, -0x40(%rbp)
leaq (%r12,%r14), %rax
movq %rax, -0x48(%rbp)
leaq -0x50(%rbp), %rsi
movl %r14d, (%rsi)
movl %ebx, 0x4(%rsi)
movq %rdx, -0x38(%rbp)
movq %rdi, -0x30(%rbp)
movq %rdx, %rdi
callq 0x7672
movq -0x30(%rbp), %rdi
testl %ebx, %ebx
jle 0x74dc
leal -0x1(%rbx), %r9d
imulq $0x6, %r9, %rax
addq %rdi, %rax
movb (%r14,%rax), %al
cmpb $0x5, %al
je 0x74c1
movq -0x48(%rbp), %rcx
cmpb (%rcx), %al
jne 0x74dc
movq -0x30(%rbp), %rdi
movq %r13, %rsi
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
movl %r15d, %r8d
callq 0x741e
movq -0x30(%rbp), %rdi
testl %r15d, %r15d
jle 0x7510
leal -0x1(%r15), %r8d
movb (%r8,%r12), %al
cmpb $0x5, %al
je 0x74f5
movq -0x48(%rbp), %rcx
cmpb (%rcx), %al
jne 0x7510
movq -0x30(%rbp), %rdi
movq %r13, %rsi
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
movl %ebx, %r9d
callq 0x741e
movq -0x30(%rbp), %rdi
cmpl $0xb, %ebx
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rdx
jg 0x755e
leal 0x1(%rbx), %r9d
movslq %r9d, %rax
imulq $0x6, %rax, %rax
addq %rdi, %rax
movb (%r14,%rax), %al
cmpb $0x5, %al
je 0x753b
movq -0x48(%rbp), %rsi
cmpb (%rsi), %al
jne 0x755e
movq -0x30(%rbp), %rdi
movq %r13, %rsi
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
movl %r15d, %r8d
callq 0x741e
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
cmpl $0x4, %r15d
jg 0x7588
incl %r15d
movslq %r15d, %rax
movb (%rax,%r12), %al
cmpb $0x5, %al
je 0x757a
movq -0x48(%rbp), %rsi
cmpb (%rsi), %al
jne 0x7588
movq %r13, %rsi
movl %r15d, %r8d
movl %ebx, %r9d
callq 0x741e
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop