if( *(s1+3) != '\0' )
  expand( s1+3, s2+i );
 else
  return s2;

このブロックは

 if( *(s1+3) != '\0' )
  expand( s1+3, s2+i );

 return s2;

が正しそうですな。