char* MACH0_(get_cpusubtype_from_hdr)(struct MACH0_(mach_header) *hdr) {
	if (hdr) {
		switch (hdr->cputype) {
		case CPU_TYPE_VAX:
			switch (hdr->cpusubtype) {
			case CPU_SUBTYPE_VAX_ALL:	return strdup ("all");
			case CPU_SUBTYPE_VAX780:	return strdup ("vax780");
			case CPU_SUBTYPE_VAX785:	return strdup ("vax785");
			case CPU_SUBTYPE_VAX750:	return strdup ("vax750");
			case CPU_SUBTYPE_VAX730:	return strdup ("vax730");
			case CPU_SUBTYPE_UVAXI:		return strdup ("uvaxI");
			case CPU_SUBTYPE_UVAXII:	return strdup ("uvaxII");
			case CPU_SUBTYPE_VAX8200:	return strdup ("vax8200");
			case CPU_SUBTYPE_VAX8500:	return strdup ("vax8500");
			case CPU_SUBTYPE_VAX8600:	return strdup ("vax8600");
			case CPU_SUBTYPE_VAX8650:	return strdup ("vax8650");
			case CPU_SUBTYPE_VAX8800:	return strdup ("vax8800");
			case CPU_SUBTYPE_UVAXIII:	return strdup ("uvaxIII");
			default:			return strdup ("Unknown vax subtype");
			}
		case CPU_TYPE_MC680x0:
			switch (hdr->cpusubtype) {
			case CPU_SUBTYPE_MC68030:	return strdup ("mc68030");
			case CPU_SUBTYPE_MC68040:	return strdup ("mc68040");
			case CPU_SUBTYPE_MC68030_ONLY:	return strdup ("mc68030 only");
			default:			return strdup ("Unknown mc680x0 subtype");
			}
		case CPU_TYPE_I386:
			switch (hdr->cpusubtype) {
			case CPU_SUBTYPE_386: 			return strdup ("386");
			case CPU_SUBTYPE_486: 			return strdup ("486");
			case CPU_SUBTYPE_486SX: 		return strdup ("486sx");
			case CPU_SUBTYPE_PENT: 			return strdup ("Pentium");
			case CPU_SUBTYPE_PENTPRO: 		return strdup ("Pentium Pro");
			case CPU_SUBTYPE_PENTII_M3: 		return strdup ("Pentium 3 M3");
			case CPU_SUBTYPE_PENTII_M5: 		return strdup ("Pentium 3 M5");
			case CPU_SUBTYPE_CELERON: 		return strdup ("Celeron");
			case CPU_SUBTYPE_CELERON_MOBILE:	return strdup ("Celeron Mobile");
			case CPU_SUBTYPE_PENTIUM_3:		return strdup ("Pentium 3");
			case CPU_SUBTYPE_PENTIUM_3_M:		return strdup ("Pentium 3 M");
			case CPU_SUBTYPE_PENTIUM_3_XEON:	return strdup ("Pentium 3 Xeon");
			case CPU_SUBTYPE_PENTIUM_M:		return strdup ("Pentium Mobile");
			case CPU_SUBTYPE_PENTIUM_4:		return strdup ("Pentium 4");
			case CPU_SUBTYPE_PENTIUM_4_M:		return strdup ("Pentium 4 M");
			case CPU_SUBTYPE_ITANIUM:		return strdup ("Itanium");
			case CPU_SUBTYPE_ITANIUM_2:		return strdup ("Itanium 2");
			case CPU_SUBTYPE_XEON:			return strdup ("Xeon");
			case CPU_SUBTYPE_XEON_MP:		return strdup ("Xeon MP");
			default:				return strdup ("Unknown i386 subtype");
			}
		case CPU_TYPE_X86_64:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_X86_64_ALL:	return strdup ("x86 64 all");
			case CPU_SUBTYPE_X86_ARCH1:	return strdup ("x86 arch 1");
			default:			return strdup ("Unknown x86 subtype");
			}
		case CPU_TYPE_MC88000:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_MC88000_ALL:	return strdup ("all");
			case CPU_SUBTYPE_MC88100:	return strdup ("mc88100");
			case CPU_SUBTYPE_MC88110:	return strdup ("mc88110");
			default:			return strdup ("Unknown mc88000 subtype");
			}
		case CPU_TYPE_MC98000:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_MC98000_ALL:	return strdup ("all");
			case CPU_SUBTYPE_MC98601:	return strdup ("mc98601");
			default:			return strdup ("Unknown mc98000 subtype");
			}
		case CPU_TYPE_HPPA:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_HPPA_7100:	return strdup ("hppa7100");
			case CPU_SUBTYPE_HPPA_7100LC:	return strdup ("hppa7100LC");
			default:			return strdup ("Unknown hppa subtype");
			}
		case CPU_TYPE_ARM64:
			return strdup ("v8");
		case CPU_TYPE_ARM:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_ARM_ALL:
				return strdup ("all");
			case CPU_SUBTYPE_ARM_V4T:
				return strdup ("v4t");
			case CPU_SUBTYPE_ARM_V5:
				return strdup ("v5");
			case CPU_SUBTYPE_ARM_V6:
				return strdup ("v6");
			case CPU_SUBTYPE_ARM_XSCALE:
				return strdup ("xscale");
			case CPU_SUBTYPE_ARM_V7:
				return strdup ("v7");
			case CPU_SUBTYPE_ARM_V7F:
				return strdup ("v7f");
			case CPU_SUBTYPE_ARM_V7S:
				return strdup ("v7s");
			case CPU_SUBTYPE_ARM_V7K:
				return strdup ("v7k");
			case CPU_SUBTYPE_ARM_V7M:
				return strdup ("v7m");
			case CPU_SUBTYPE_ARM_V7EM:
				return strdup ("v7em");
			default:
				return r_str_newf ("unknown ARM subtype %d", hdr->cpusubtype & 0xff);
			}
		case CPU_TYPE_SPARC:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_SPARC_ALL:	return strdup ("all");
			default:			return strdup ("Unknown sparc subtype");
			}
		case CPU_TYPE_MIPS:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_MIPS_ALL:	return strdup ("all");
			case CPU_SUBTYPE_MIPS_R2300:	return strdup ("r2300");
			case CPU_SUBTYPE_MIPS_R2600:	return strdup ("r2600");
			case CPU_SUBTYPE_MIPS_R2800:	return strdup ("r2800");
			case CPU_SUBTYPE_MIPS_R2000a:	return strdup ("r2000a");
			case CPU_SUBTYPE_MIPS_R2000:	return strdup ("r2000");
			case CPU_SUBTYPE_MIPS_R3000a:	return strdup ("r3000a");
			case CPU_SUBTYPE_MIPS_R3000:	return strdup ("r3000");
			default:			return strdup ("Unknown mips subtype");
			}
		case CPU_TYPE_I860:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_I860_ALL:	return strdup ("all");
			case CPU_SUBTYPE_I860_860:	return strdup ("860");
			default:			return strdup ("Unknown i860 subtype");
			}
		case CPU_TYPE_POWERPC:
		case CPU_TYPE_POWERPC64:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_POWERPC_ALL:	return strdup ("all");
			case CPU_SUBTYPE_POWERPC_601:	return strdup ("601");
			case CPU_SUBTYPE_POWERPC_602:	return strdup ("602");
			case CPU_SUBTYPE_POWERPC_603:	return strdup ("603");
			case CPU_SUBTYPE_POWERPC_603e:	return strdup ("603e");
			case CPU_SUBTYPE_POWERPC_603ev:	return strdup ("603ev");
			case CPU_SUBTYPE_POWERPC_604:	return strdup ("604");
			case CPU_SUBTYPE_POWERPC_604e:	return strdup ("604e");
			case CPU_SUBTYPE_POWERPC_620:	return strdup ("620");
			case CPU_SUBTYPE_POWERPC_750:	return strdup ("750");
			case CPU_SUBTYPE_POWERPC_7400:	return strdup ("7400");
			case CPU_SUBTYPE_POWERPC_7450:	return strdup ("7450");
			case CPU_SUBTYPE_POWERPC_970:	return strdup ("970");
			default:			return strdup ("Unknown ppc subtype");
			}
		}
	}
	return strdup ("Unknown cputype");
}
char* MACH0_(get_cpusubtype_from_hdr)(struct MACH0_(mach_header) *hdr) {
	if (hdr) {
		switch (hdr->cputype) {
		case CPU_TYPE_VAX:
			switch (hdr->cpusubtype) {
			case CPU_SUBTYPE_VAX_ALL:	return strdup ("all");
			case CPU_SUBTYPE_VAX780:	return strdup ("vax780");
			case CPU_SUBTYPE_VAX785:	return strdup ("vax785");
			case CPU_SUBTYPE_VAX750:	return strdup ("vax750");
			case CPU_SUBTYPE_VAX730:	return strdup ("vax730");
			case CPU_SUBTYPE_UVAXI:		return strdup ("uvaxI");
			case CPU_SUBTYPE_UVAXII:	return strdup ("uvaxII");
			case CPU_SUBTYPE_VAX8200:	return strdup ("vax8200");
			case CPU_SUBTYPE_VAX8500:	return strdup ("vax8500");
			case CPU_SUBTYPE_VAX8600:	return strdup ("vax8600");
			case CPU_SUBTYPE_VAX8650:	return strdup ("vax8650");
			case CPU_SUBTYPE_VAX8800:	return strdup ("vax8800");
			case CPU_SUBTYPE_UVAXIII:	return strdup ("uvaxIII");
			default:			return strdup ("Unknown vax subtype");
			}
		case CPU_TYPE_MC680x0:
			switch (hdr->cpusubtype) {
			case CPU_SUBTYPE_MC68030:	return strdup ("mc68030");
			case CPU_SUBTYPE_MC68040:	return strdup ("mc68040");
			case CPU_SUBTYPE_MC68030_ONLY:	return strdup ("mc68030 only");
			default:			return strdup ("Unknown mc680x0 subtype");
			}
		case CPU_TYPE_I386:
			switch (hdr->cpusubtype) {
			case CPU_SUBTYPE_386: 			return strdup ("386");
			case CPU_SUBTYPE_486: 			return strdup ("486");
			case CPU_SUBTYPE_486SX: 		return strdup ("486sx");
			case CPU_SUBTYPE_PENT: 			return strdup ("Pentium");
			case CPU_SUBTYPE_PENTPRO: 		return strdup ("Pentium Pro");
			case CPU_SUBTYPE_PENTII_M3: 		return strdup ("Pentium 3 M3");
			case CPU_SUBTYPE_PENTII_M5: 		return strdup ("Pentium 3 M5");
			case CPU_SUBTYPE_CELERON: 		return strdup ("Celeron");
			case CPU_SUBTYPE_CELERON_MOBILE:	return strdup ("Celeron Mobile");
			case CPU_SUBTYPE_PENTIUM_3:		return strdup ("Pentium 3");
			case CPU_SUBTYPE_PENTIUM_3_M:		return strdup ("Pentium 3 M");
			case CPU_SUBTYPE_PENTIUM_3_XEON:	return strdup ("Pentium 3 Xeon");
			case CPU_SUBTYPE_PENTIUM_M:		return strdup ("Pentium Mobile");
			case CPU_SUBTYPE_PENTIUM_4:		return strdup ("Pentium 4");
			case CPU_SUBTYPE_PENTIUM_4_M:		return strdup ("Pentium 4 M");
			case CPU_SUBTYPE_ITANIUM:		return strdup ("Itanium");
			case CPU_SUBTYPE_ITANIUM_2:		return strdup ("Itanium 2");
			case CPU_SUBTYPE_XEON:			return strdup ("Xeon");
			case CPU_SUBTYPE_XEON_MP:		return strdup ("Xeon MP");
			default:				return strdup ("Unknown i386 subtype");
			}
		case CPU_TYPE_X86_64:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_X86_64_ALL:	return strdup ("x86 64 all");
			case CPU_SUBTYPE_X86_ARCH1:	return strdup ("x86 arch 1");
			default:			return strdup ("Unknown x86 subtype");
			}
		case CPU_TYPE_MC88000:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_MC88000_ALL:	return strdup ("all");
			case CPU_SUBTYPE_MC88100:	return strdup ("mc88100");
			case CPU_SUBTYPE_MC88110:	return strdup ("mc88110");
			default:			return strdup ("Unknown mc88000 subtype");
			}
		case CPU_TYPE_MC98000:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_MC98000_ALL:	return strdup ("all");
			case CPU_SUBTYPE_MC98601:	return strdup ("mc98601");
			default:			return strdup ("Unknown mc98000 subtype");
			}
		case CPU_TYPE_HPPA:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_HPPA_7100:	return strdup ("hppa7100");
			case CPU_SUBTYPE_HPPA_7100LC:	return strdup ("hppa7100LC");
			default:			return strdup ("Unknown hppa subtype");
			}
		case CPU_TYPE_ARM64:
			return strdup ("v8");
		case CPU_TYPE_ARM:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_ARM_ALL:
				return strdup ("all");
			case CPU_SUBTYPE_ARM_V4T:
				return strdup ("v4t");
			case CPU_SUBTYPE_ARM_V5:
				return strdup ("v5");
			case CPU_SUBTYPE_ARM_V6:
				return strdup ("v6");
			case CPU_SUBTYPE_ARM_XSCALE:
				return strdup ("xscale");
			case CPU_SUBTYPE_ARM_V7:
				return strdup ("v7");
			case CPU_SUBTYPE_ARM_V7F:
				return strdup ("v7f");
			case CPU_SUBTYPE_ARM_V7S:
				return strdup ("v7s");
			case CPU_SUBTYPE_ARM_V7K:
				return strdup ("v7k");
			case CPU_SUBTYPE_ARM_V7M:
				return strdup ("v7m");
			case CPU_SUBTYPE_ARM_V7EM:
				return strdup ("v7em");
			default:
				return r_str_newf ("unknown ARM subtype %d", hdr->cpusubtype & 0xff);
			}
		case CPU_TYPE_SPARC:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_SPARC_ALL:	return strdup ("all");
			default:			return strdup ("Unknown sparc subtype");
			}
		case CPU_TYPE_MIPS:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_MIPS_ALL:	return strdup ("all");
			case CPU_SUBTYPE_MIPS_R2300:	return strdup ("r2300");
			case CPU_SUBTYPE_MIPS_R2600:	return strdup ("r2600");
			case CPU_SUBTYPE_MIPS_R2800:	return strdup ("r2800");
			case CPU_SUBTYPE_MIPS_R2000a:	return strdup ("r2000a");
			case CPU_SUBTYPE_MIPS_R2000:	return strdup ("r2000");
			case CPU_SUBTYPE_MIPS_R3000a:	return strdup ("r3000a");
			case CPU_SUBTYPE_MIPS_R3000:	return strdup ("r3000");
			default:			return strdup ("Unknown mips subtype");
			}
		case CPU_TYPE_I860:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_I860_ALL:	return strdup ("all");
			case CPU_SUBTYPE_I860_860:	return strdup ("860");
			default:			return strdup ("Unknown i860 subtype");
			}
		case CPU_TYPE_POWERPC:
		case CPU_TYPE_POWERPC64:
			switch (hdr->cpusubtype & 0xff) {
			case CPU_SUBTYPE_POWERPC_ALL:	return strdup ("all");
			case CPU_SUBTYPE_POWERPC_601:	return strdup ("601");
			case CPU_SUBTYPE_POWERPC_602:	return strdup ("602");
			case CPU_SUBTYPE_POWERPC_603:	return strdup ("603");
			case CPU_SUBTYPE_POWERPC_603e:	return strdup ("603e");
			case CPU_SUBTYPE_POWERPC_603ev:	return strdup ("603ev");
			case CPU_SUBTYPE_POWERPC_604:	return strdup ("604");
			case CPU_SUBTYPE_POWERPC_604e:	return strdup ("604e");
			case CPU_SUBTYPE_POWERPC_620:	return strdup ("620");
			case CPU_SUBTYPE_POWERPC_750:	return strdup ("750");
			case CPU_SUBTYPE_POWERPC_7400:	return strdup ("7400");
			case CPU_SUBTYPE_POWERPC_7450:	return strdup ("7450");
			case CPU_SUBTYPE_POWERPC_970:	return strdup ("970");
			default:			return strdup ("Unknown ppc subtype");
			}
		}
	}
	return strdup ("Unknown cputype");
}