2006-08-18

(GCC) Inline assembly

Just for fun, M'am.
int main( int argc, char **argv)
{
  const char s[ ] ="Tread lightly\n", *p;

  write( 1, s, sizeof( s));

  // p =s;
  asm( "movl %1, %%eax; movl %%eax, %0;"
       :"=r" ( p)
       :"r" ( s)
       :"%eax"
       );

  while( *p)
    write( 1, p++, 1);

  return 0;
}