Nasm is a bad idea. There are a few options. IDA pro has given me some success, but if you really know your assembly, you can nm for symbols, then hexdump the code from there and manually make assembly out of it. There really isn't just a way to use nasm to produce recompilable code though.
otool (or objdump) will produce assembly.
If you need some examples: here:
#include <stdio.h>
main(argc, argv)
int argc; char * * argv;
{
printf("Hello, World\n");
}
nm output:
hydrogen:tmp phyrrus9$ nm a.out
0000000100000000 T __mh_execute_header
0000000100000f40 T _main
U _printf
U dyld_stub_binder
otool output:
hydrogen:tmp phyrrus9$ otool -tv a.out
a.out:
(__TEXT,__text) section
_main:
0000000100000f40 pushq %rbp
0000000100000f41 movq %rsp, %rbp
0000000100000f44 subq $0x10, %rsp
0000000100000f48 leaq 0x37(%rip), %rdi ; this is our string
0000000100000f4f movb $0x0, %al
0000000100000f51 callq 0x100000f66 ; call printf
0000000100000f56 movl $0x0, %ecx
0000000100000f5b movl %eax, 0xfffffffffffffffc(%rbp)
0000000100000f5e movl %ecx, %eax
0000000100000f60 addq $0x10, %rsp
0000000100000f64 popq %rbp
0000000100000f65 ret
hexdump output not shown.
Actual assembly:
hydrogen:tmp phyrrus9$ cat tmp.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
leaq L_.str(%rip), %rdi
movb $0, %al
callq _printf
movl $0, %ecx
movl %eax, -4(%rbp) ## 4-byte Spill
movl %ecx, %eax
addq $16, %rsp
popq %rbp
ret
.cfi_endproc
.section __TEXT,__cstring,cstring_literals
L_.str: ## @.str
.asciz "Hello, world!\n"
.subsections_via_symbols
Hope this helps you get a grasp.