A counting problem involving some cyclic structure Let $a_i\in \{0,1\}$, and $a_i'=1-a_i$, $i=1,2,\ldots,m$. 
We want to obtain an explicit formula of counting from $2^m$ possible $(a_1,a_2,\ldots,a_m)$'s, how many satisfy
$$
\# \{i: a_i=a_{i-1}'=1\}=r,
$$
where $a_0'$ is understood as $a_m'$, $0\le r\le m/2$. It is easy to see that $r=\#\{i: a_i=a_{i-1}'=0\}$.
For example in the following table
$$
a_i \quad 1 \quad 0 \quad 1\quad 1 \quad 0\\
a_i'\quad 0 \quad 1\quad 0 \quad 0 \quad 1
$$
$r=2$.
If $r=0$, there are also only 2.
I have tried to think about placing the $r$ of $a_i=a_{i-1}'=1$'s first, which has$\frac{m(m-2)\ldots(m-2r+2)}{r!}$ ways. But then I found that the placing of $a_i=a_{i-1}'=0$'s depends on your placing of $a_i=a_{i-1}'=1$'s. 
For example, when $m=6$ and $r=2$, 
if I place  $a_i=a_{i-1}'=1$'s in the following way:
$$
a_i \quad X \quad X \quad 1\quad X \quad 1 \quad X\\
a_i'\quad X \quad 1\quad X \quad 1 \quad X \quad X
$$
then in the middle diagonal $X$'s there has to be an  $a_4=a_{3}'=0$.
But if I place $a_i=a_{i-1}'=1$'s in the following way:
$$
a_i \quad X \quad 1 \quad X\quad X \quad 1 \quad X\\
a_i'\quad 1\quad X\quad X \quad 1 \quad X \quad X
$$
one $a_i=a_{i-1}'=0$ can be $a_3=a_{2}'=0$ or  $a_4=a_{3}'=0$, which has more choices.

This seems to be the number of changes from $1$ to $0$ in the sequence with looping at the end of the sequence.
Consider the sequence to be made of alternating blocks of $0$s and $1$s of length $b_1,\dots,b_k$, $b_1 + \dots + b_k = m$. If $k$ is even, there will be $\frac{k}{2}$ changes and if $k$ is odd there will be $\frac{k-1}{2}$ changes.
Let now $r$ be given. When $k=2r$ there are ${m - 1 \choose k - 1} = {m - 1 \choose 2r - 1}$ ways to choose the lengths of the $b_i$ and $2$ ways to choose whether $b_1$ consists of $0$s or $1$s. Similarly when $k=2r+1$, we get ${m - 1 \choose 2r}$ ways to choose the lengths of the $b_i$.
In total there will then be
$$2{m-1 \choose 2r - 1} + 2{m-1 \choose 2r} = 2 {m \choose 2r} $$
sequences with exactly $r$ changes.
