All pastes #822716 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-12-18 22:29 UTC
rendered paste body
int main()
{
        char foo[16] = "Hello, world!\n";
  2d:   89 45 e8                mov    %eax,-0x18(%ebp)
  30:   a1 08 00 00 00          mov    0x8,%eax
  35:   89 45 ec                mov    %eax,-0x14(%ebp)
  38:   0f b7 05 0c 00 00 00    movzwl 0xc,%eax
  3f:   66 89 45 f0             mov    %ax,-0x10(%ebp)
  43:   0f b6 05 0e 00 00 00    movzbl 0xe,%eax
  4a:   88 45 f2                mov    %al,-0xe(%ebp)
        char *bar = (char *)&foo;
        int i;

        for (i = 0; *bar; *bar++ = foo[i++]);
  4d:   74 0a                   je     59 <main+0x59>
  4f:   90                      nop    
  50:   83 c3 01                add    $0x1,%ebx
  53:   80 3c 33 00             cmpb   $0x0,(%ebx,%esi,1)
  57:   75 f7                   jne    50 <main+0x50>
        __asm__ __volatile__("" :::"memory");
        puts(foo);
  59:   89 34 24                mov    %esi,(%esp)
  5c:   e8 fc ff ff ff          call   5d <main+0x5d>
        printf("len = %d\n", i);
  61:   89 5c 24 04             mov    %ebx,0x4(%esp)
  65:   c7 04 24 00 00 00 00    movl   $0x0,(%esp)
  6c:   e8 fc ff ff ff          call   6d <main+0x6d>
  71:   89 f2                   mov    %esi,%edx

        bar = (char *)&foo;

        while (*bar++); i = bar - (char *)&foo;
  73:   0f b6 02                movzbl (%edx),%eax
  76:   83 c2 01                add    $0x1,%edx
  79:   84 c0                   test   %al,%al
  7b:   75 f6                   jne    73 <main+0x73>
        printf("len = %d\n", i);
  7d:   29 f2                   sub    %esi,%edx
  7f:   89 54 24 04             mov    %edx,0x4(%esp)
  83:   c7 04 24 00 00 00 00    movl   $0x0,(%esp)
  8a:   e8 fc ff ff ff          call   8b <main+0x8b>

        return 0;
}
  8f:   83 c4 1c                add    $0x1c,%esp
  92:   31 c0                   xor    %eax,%eax
  94:   59                      pop    %ecx
  95:   5b                      pop    %ebx
  96:   5e                      pop    %esi
  97:   5d                      pop    %ebp
  98:   8d 61 fc                lea    -0x4(%ecx),%esp
  9b:   c3                      ret