+#if defined(LLVM_35)
+ Binary * op = retval.get();
+#elif defined(LLVM_36)
+ OwningBinary<Binary> ob;
+ ob = std::move(retval.get());
+ Binary* op = ob.getBinary();
+ auto foo = ob.takeBinary();
+ foo.first.release();
+ foo.second.release();
+#endif
+
+ try {
+ // ELFType<endian, maxalign, 64bit>
+ if (ELF32LEObjectFile * object = dyn_cast<ELF32LEObjectFile>(op)) {
+ return new LLVMDisassembler<ELFType<support::little, 2, false>>(filename, manager, object);
+ }
+ if (ELF64LEObjectFile * object = dyn_cast<ELF64LEObjectFile>(op)) {
+ return new LLVMDisassembler<ELFType<support::little, 2, true>>(filename, manager, object);
+ }
+ if (ELF32BEObjectFile * object = dyn_cast<ELF32BEObjectFile>(op)) {
+ return new LLVMDisassembler<ELFType<support::big, 2, false>>(filename, manager, object);
+ }
+ if (ELF64BEObjectFile * object = dyn_cast<ELF64BEObjectFile>(op)) {
+ return new LLVMDisassembler<ELFType<support::big, 2, true>>(filename, manager, object);
+ }
+ if (COFFObjectFile * object = dyn_cast<COFFObjectFile>(op)) {
+ return new LLVMDisassembler<COFFT>(filename, manager, object);
+ }
+ if (MachOObjectFile * object = dyn_cast<MachOObjectFile>(op)) {
+ return new LLVMDisassembler<MACHOT>(filename, manager, object);
+ }
+ } catch (BinaryNotSupported& e) {
+ return NULL;