Listing 1

/* filename: example1.c */
void some_assembly_language()
{
  asm("
   bp0:
     # housekeeping - stash flags
     # and eax for later restoration
     pushf
     pushl %eax

     pushf
     # put copy of original flags in eax
     popl  %eax
   bp1:
     # flip all bits in that copy
     xorl  $0xffffffff, %eax
   bp2:
     pushl %eax
     # try to write flipped bit version into
     # flags
     popf
     pushf
          # puts copy of new flag attempt into eax
     popl  %eax
        bp3:

          # housekeeping - restore
          # original flags and eax */
          popl  %eax
          popf

   bp4:
      ");
}

void main()
{
  some_assembly_language();
  exit(0);