Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat signed.c
- #include <stdio.h>
- int main(void){
- int num;
- scanf("%d", &num);
- printf("%d\n", num/16);
- return 0;
- }
- $ gcc signed.c -Ofast -c
- $ objdump -d signed.o
- signed.o: file format elf64-x86-64
- Disassembly of section .text.startup:
- 0000000000000000 <main>:
- 0: 48 83 ec 18 sub $0x18,%rsp
- 4: bf 00 00 00 00 mov $0x0,%edi
- 9: 31 c0 xor %eax,%eax
- b: 48 8d 74 24 0c lea 0xc(%rsp),%rsi
- 10: e8 00 00 00 00 callq 15 <main+0x15>
- 15: 8b 44 24 0c mov 0xc(%rsp),%eax
- 19: bf 00 00 00 00 mov $0x0,%edi
- 1e: 8d 70 0f lea 0xf(%rax),%esi
- 21: 85 c0 test %eax,%eax
- 23: 0f 49 f0 cmovns %eax,%esi
- 26: 31 c0 xor %eax,%eax
- 28: c1 fe 04 sar $0x4,%esi
- 2b: e8 00 00 00 00 callq 30 <main+0x30>
- 30: 31 c0 xor %eax,%eax
- 32: 48 83 c4 18 add $0x18,%rsp
- 36: c3 retq
- $
- $
- $ cat unsigned.c
- #include <stdio.h>
- int main(void){
- unsigned int num;
- scanf("%d", &num);
- printf("%d\n", num/16);
- return 0;
- }
- $ gcc unsigned.c -Ofast -c
- $ objdump -d unsigned.o
- unsigned.o: file format elf64-x86-64
- Disassembly of section .text.startup:
- 0000000000000000 <main>:
- 0: 48 83 ec 18 sub $0x18,%rsp
- 4: bf 00 00 00 00 mov $0x0,%edi
- 9: 31 c0 xor %eax,%eax
- b: 48 8d 74 24 0c lea 0xc(%rsp),%rsi
- 10: e8 00 00 00 00 callq 15 <main+0x15>
- 15: 8b 74 24 0c mov 0xc(%rsp),%esi
- 19: bf 00 00 00 00 mov $0x0,%edi
- 1e: 31 c0 xor %eax,%eax
- 20: c1 ee 04 shr $0x4,%esi
- 23: e8 00 00 00 00 callq 28 <main+0x28>
- 28: 31 c0 xor %eax,%eax
- 2a: 48 83 c4 18 add $0x18,%rsp
- 2e: c3 retq
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement