Skip to content

Instantly share code, notes, and snippets.

@triffid
Created January 31, 2014 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save triffid/8743877 to your computer and use it in GitHub Desktop.
Save triffid/8743877 to your computer and use it in GitHub Desktop.
#include <cstdio>
void foo(const int * const ptr)
{
printf("%d\n", *ptr);
};
int bar(void)
{
int i = 123;
foo(&i);
return i;
}
int main(int argc, char** argv)
{
printf("%d\n", bar());
}
0000000000400680 <_Z3fooPKi>:
400680: 8b 17 mov (%rdi),%edx
400682: be 74 07 40 00 mov $0x400774,%esi
400687: bf 01 00 00 00 mov $0x1,%edi
40068c: 31 c0 xor %eax,%eax
40068e: e9 bd fe ff ff jmpq 400550 <__printf_chk@plt>
400693: 66 66 66 66 2e 0f 1f data32 data32 data32 nopw %cs:0x0(%rax,%rax,1)
40069a: 84 00 00 00 00 00
00000000004006a0 <_Z3barv>:
4006a0: 48 83 ec 08 sub $0x8,%rsp
4006a4: ba 7b 00 00 00 mov $0x7b,%edx
4006a9: be 74 07 40 00 mov $0x400774,%esi
4006ae: bf 01 00 00 00 mov $0x1,%edi
4006b3: 31 c0 xor %eax,%eax
4006b5: e8 96 fe ff ff callq 400550 <__printf_chk@plt>
4006ba: b8 7b 00 00 00 mov $0x7b,%eax
4006bf: 48 83 c4 08 add $0x8,%rsp
4006c3: c3 retq
4006c4: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
4006cb: 00 00 00
4006ce: 66 90 xchg %ax,%a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment