Skip to content

Instantly share code, notes, and snippets.

@afeinberg
Created December 31, 2013 21:28
Show Gist options
  • Save afeinberg/8202401 to your computer and use it in GitHub Desktop.
Save afeinberg/8202401 to your computer and use it in GitHub Desktop.
alexs-mac-pro:~ alex% cat hi.c
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
return strlen(argv[1]);
}
alexs-mac-pro:~ alex% !clang
clang -S hi.c
alexs-mac-pro:~ alex% cat hi.s
.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
subq $16, %rsp
movl $0, -4(%rbp)
movl %edi, -8(%rbp)
movq %rsi, -16(%rbp)
movq -16(%rbp), %rsi
movq 8(%rsi), %rdi
callq _strlen
movl %eax, %ecx
movl %ecx, %eax
addq $16, %rsp
popq %rbp
ret
.cfi_endproc
.subsections_via_symbols
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment