Chess - Find all legal moves (except castling and en passant)
C - 391 bytes
Takes input as command line arguments and prints to stdout with the squares labeled from 0 to 63.
OK, I had a few minutes so I tried to delete all the bits relating to the detection of check. I think it is now not very efficient though...
O(x,y){return((x&amp;7)-(y&amp;7))/5;}
B[64],*b=B,J=32,M,L,x,*X,N;
main(int c,char**V){
for(;x=*V[1]++;c=J&amp;2**V[2])
x&gt;56?*b++=x:x&gt;47?b+=x-48:0;
for(;b--&gt;B;)
for(M=-1,N=*b%J^16,*V=strchr(&quot;bGInFJOQrAHkAGHIqAGHIpGHIx&quot;,*b|J);*b&amp;&amp;*b&amp;J^c&amp;&amp;(M=M&lt;0?*++*V%J:-M,**V&lt;96);)
for(x=b-B,L=N?9^*b&amp;8:1+(x/8==1+c/6);L--*!(O(x,x+M)|O(x&gt;&gt;3,x+M&gt;&gt;3));L=!*X|~*X&amp;J^c&amp;&amp;N|(!*X^M&amp;1&amp;&amp;M&lt;0^!c)?printf(&quot;%d-%d &quot;,b-B,x),L*!*X:0)
X=B+(x+=M);}

478 byte check-detecting version
O(x,y){return((x&amp;7)-(y&amp;7))/5;}
B[64],*b=B,c,I,J=32;
main(int C,char**V){
int*D,M,L,t,x,*X,N;
for(;b-B&lt;64;C=c=J&amp;2**V[2])
(t=*V[1]++)&gt;56?*b++=t:t&gt;47?b+=t-48:0;
for(D=b;D--&gt;B;)
for(M=-1,N=*D%J^16,*V=strchr(&quot;bGInFJOQrAHkAGHIqAGHIpGHIx&quot;,*D|J);*D&amp;&amp;*D&amp;J^C&amp;&amp;(M=M&lt;0?*++*V%J:-M,**V&lt;96);)
for(x=D-B,L=N?9^*D&amp;8:1+(x/8==1+C/6);L--*!(O(x,x+M)|O(x&gt;&gt;3,x+M&gt;&gt;3));L=!*X|~*X&amp;J^C&amp;&amp;N|(!*X^M&amp;1&amp;&amp;M&lt;0^!C)?c^C?I|=*X%J==11:(*X=*D,*D=I=0,main(C^J,V+1),*D=*X,I||printf(&quot;%d-%d &quot;,D-B,x)),L*!(*X=t):0)
X=B+(x+=M),t=*X;}