Created
December 5, 2013 22:01
-
-
Save simonwhitaker/7814762 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat test.c | |
#import <stdio.h> | |
#define NYBBLE 4 | |
int main(int argc, const char * argv[]) { | |
unsigned long t = (unsigned long)argc; | |
t = (t << NYBBLE) | (t >> (sizeof(t) * 8 - NYBBLE)); | |
printf("t is now 0x%lx\n", t); | |
return 0; | |
} | |
$ clang -S -O1 -o - test.c | |
.section __TEXT,__text,regular,pure_instructions | |
.globl _main | |
.align 4, 0x90 | |
_main: ## @main | |
.cfi_startproc | |
## BB#0: | |
pushq %rbp | |
Ltmp2: | |
.cfi_def_cfa_offset 16 | |
Ltmp3: | |
.cfi_offset %rbp, -16 | |
movq %rsp, %rbp | |
Ltmp4: | |
.cfi_def_cfa_register %rbp | |
movslq %edi, %rsi | |
rolq $4, %rsi | |
leaq L_.str(%rip), %rdi | |
xorb %al, %al | |
callq _printf | |
xorl %eax, %eax | |
popq %rbp | |
ret | |
.cfi_endproc | |
.section __TEXT,__cstring,cstring_literals | |
L_.str: ## @.str | |
.asciz "t is now 0x%lx\n" | |
.subsections_via_symbols |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment