c library x86/x64 assembler

There is a library that is seemingly a ghost; its existance is widely unknown:

XED (X86 Encoder Decoder)

Intel wrote it: https://software.intel.com/sites/landingpage/pintool/docs/71313/Xed/html/

It can be downloaded with Pin: https://software.intel.com/en-us/articles/pintool-downloads


Sure - you can use llvm. Strictly speaking, it's C++, but there are C interfaces. It will handle both the assembling and disassembling you're trying to do, too.