Skip to content

Instantly share code, notes, and snippets.

@osak
Last active August 29, 2015 14:06
Show Gist options
  • Save osak/0a7d793cf7607c82d6e4 to your computer and use it in GitHub Desktop.
Save osak/0a7d793cf7607c82d6e4 to your computer and use it in GitHub Desktop.
int n;
int main() {
n = 56;
printf("%d\n", (int)(n/0.32));
printf("%d\n", (int)(n/0.32));
return 0;
}
; gcc -v
; Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
; Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
; Target: x86_64-apple-darwin13.3.0
; Thread model: posix
;
; gcc -O -m32 a.c
00001f30 <_main>:
1f30: 55 push %ebp
1f31: 89 e5 mov %esp,%ebp
1f33: 53 push %ebx
1f34: 57 push %edi
1f35: 56 push %esi
1f36: 83 ec 0c sub $0xc,%esp
1f39: e8 00 00 00 00 call 1f3e <_main+0xe>
1f3e: 5e pop %esi
1f3f: 8b be ca 00 00 00 mov 0xca(%esi),%edi
1f45: c7 07 38 00 00 00 movl $0x38,(%edi)
1f4b: 8d 9e 72 00 00 00 lea 0x72(%esi),%ebx
1f51: 89 1c 24 mov %ebx,(%esp)
1f54: c7 44 24 04 af 00 00 movl $0xaf,0x4(%esp)
1f5b: 00
1f5c: e8 29 00 00 00 call 1f8a <_printf$stub>
1f61: 8b 07 mov (%edi),%eax
1f63: f2 0f 2a c0 cvtsi2sd %eax,%xmm0
1f67: f2 0f 5e 86 6a 00 00 divsd 0x6a(%esi),%xmm0
1f6e: 00
1f6f: f2 0f 2c c0 cvttsd2si %xmm0,%eax
1f73: 89 1c 24 mov %ebx,(%esp)
1f76: 89 44 24 04 mov %eax,0x4(%esp)
1f7a: e8 0b 00 00 00 call 1f8a <_printf$stub>
1f7f: 31 c0 xor %eax,%eax
1f81: 83 c4 0c add $0xc,%esp
1f84: 5e pop %esi
1f85: 5f pop %edi
1f86: 5b pop %ebx
1f87: 5d pop %ebp
1f88: c3 ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment