// File: 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
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rcx
testb $0x1, (%rax,%rcx)
jne 0xd0f6
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rcx
movb $0x1, (%rax,%rcx)
movslq -0x28(%rbp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
callq 0xcdf0
testb $0x1, %al
jne 0xce8d
jmp 0xceb6
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
leaq -0x30(%rbp), %rdi
callq 0xd8f0
movq -0x48(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xd8c0
jmp 0xd0f6
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
leaq -0x38(%rbp), %rdi
callq 0xd8f0
movq -0x50(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xd8c0
cmpl $0x0, -0x28(%rbp)
jle 0xcf5e
movq -0x40(%rbp), %rsi
movl -0x28(%rbp), %eax
subl $0x1, %eax
cltq
imulq $0x6, %rax, %rax
movq %rsi, %rdi
addq %rax, %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
movslq -0x28(%rbp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rsi
movslq -0x24(%rbp), %rax
addq %rax, %rsi
callq 0xd910
testb $0x1, %al
jne 0xcf3d
movq -0x40(%rbp), %rdi
movl -0x28(%rbp), %eax
subl $0x1, %eax
cltq
imulq $0x6, %rax, %rax
addq %rax, %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
callq 0xcdf0
testb $0x1, %al
jne 0xcf3d
jmp 0xcf5e
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
subl $0x1, %r9d
callq 0xce10
cmpl $0x0, -0x24(%rbp)
jle 0xcfe2
movq -0x40(%rbp), %rsi
movslq -0x28(%rbp), %rax
imulq $0x6, %rax, %rax
movq %rsi, %rdi
addq %rax, %rdi
movl -0x24(%rbp), %eax
subl $0x1, %eax
cltq
addq %rax, %rdi
movslq -0x28(%rbp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rsi
movslq -0x24(%rbp), %rax
addq %rax, %rsi
callq 0xd910
testb $0x1, %al
jne 0xcfc1
movq -0x40(%rbp), %rdi
movslq -0x28(%rbp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rdi
movl -0x24(%rbp), %eax
subl $0x1, %eax
cltq
addq %rax, %rdi
callq 0xcdf0
testb $0x1, %al
jne 0xcfc1
jmp 0xcfe2
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
subl $0x1, %r8d
movl -0x28(%rbp), %r9d
callq 0xce10
movl -0x28(%rbp), %eax
addl $0x1, %eax
cmpl $0xd, %eax
jge 0xd06b
movq -0x40(%rbp), %rsi
movl -0x28(%rbp), %eax
addl $0x1, %eax
cltq
imulq $0x6, %rax, %rax
movq %rsi, %rdi
addq %rax, %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
movslq -0x28(%rbp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rsi
movslq -0x24(%rbp), %rax
addq %rax, %rsi
callq 0xd910
testb $0x1, %al
jne 0xd04a
movq -0x40(%rbp), %rdi
movl -0x28(%rbp), %eax
addl $0x1, %eax
cltq
imulq $0x6, %rax, %rax
addq %rax, %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
callq 0xcdf0
testb $0x1, %al
jne 0xd04a
jmp 0xd06b
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
addl $0x1, %r9d
callq 0xce10
movl -0x24(%rbp), %eax
addl $0x1, %eax
cmpl $0x6, %eax
jge 0xd0f4
movq -0x40(%rbp), %rsi
movslq -0x28(%rbp), %rax
imulq $0x6, %rax, %rax
movq %rsi, %rdi
addq %rax, %rdi
movl -0x24(%rbp), %eax
addl $0x1, %eax
cltq
addq %rax, %rdi
movslq -0x28(%rbp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rsi
movslq -0x24(%rbp), %rax
addq %rax, %rsi
callq 0xd910
testb $0x1, %al
jne 0xd0d3
movq -0x40(%rbp), %rdi
movslq -0x28(%rbp), %rax
imulq $0x6, %rax, %rax
addq %rax, %rdi
movl -0x24(%rbp), %eax
addl $0x1, %eax
cltq
addq %rax, %rdi
callq 0xcdf0
testb $0x1, %al
jne 0xd0d3
jmp 0xd0f4
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
addl $0x1, %r8d
movl -0x28(%rbp), %r9d
callq 0xce10
jmp 0xd0f6
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)