// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libcpuid/recog_amd.c
// Function: load_amd_features
static void load_amd_features(struct cpu_raw_data_t* raw, struct cpu_id_t* data)
{
	const struct feature_map_t matchtable_edx81[] = {
		{ 20, CPU_FEATURE_NX },
		{ 22, CPU_FEATURE_MMXEXT },
		{ 25, CPU_FEATURE_FXSR_OPT },
		{ 30, CPU_FEATURE_3DNOWEXT },
		{ 31, CPU_FEATURE_3DNOW },
	};
	const struct feature_map_t matchtable_ecx81[] = {
		{  1, CPU_FEATURE_CMP_LEGACY },
		{  2, CPU_FEATURE_SVM },
		/* id 5 is handled in common */
		{  6, CPU_FEATURE_SSE4A },
		{  7, CPU_FEATURE_MISALIGNSSE },
		{  8, CPU_FEATURE_3DNOWPREFETCH },
		{  9, CPU_FEATURE_OSVW },
		{ 10, CPU_FEATURE_IBS },
		{ 11, CPU_FEATURE_XOP },
		{ 12, CPU_FEATURE_SKINIT },
		{ 13, CPU_FEATURE_WDT },
		{ 16, CPU_FEATURE_FMA4 },
		{ 21, CPU_FEATURE_TBM },
	};
	const struct feature_map_t matchtable_edx87[] = {
		{  0, CPU_FEATURE_TS },
		{  1, CPU_FEATURE_FID },
		{  2, CPU_FEATURE_VID },
		{  3, CPU_FEATURE_TTP },
		{  4, CPU_FEATURE_TM_AMD },
		{  5, CPU_FEATURE_STC },
		{  6, CPU_FEATURE_100MHZSTEPS },
		{  7, CPU_FEATURE_HWPSTATE },
		/* id 8 is handled in common */
		{  9, CPU_FEATURE_CPB },
		{ 10, CPU_FEATURE_APERFMPERF },
		{ 11, CPU_FEATURE_PFI },
		{ 12, CPU_FEATURE_PA },
	};
	if (raw->ext_cpuid[0][EAX] >= 0x80000001) {
		match_features(matchtable_edx81, COUNT_OF(matchtable_edx81), raw->ext_cpuid[1][EDX], data);
		match_features(matchtable_ecx81, COUNT_OF(matchtable_ecx81), raw->ext_cpuid[1][ECX], data);
	}
	if (raw->ext_cpuid[0][EAX] >= 0x80000007)
		match_features(matchtable_edx87, COUNT_OF(matchtable_edx87), raw->ext_cpuid[7][EDX], data);
	if (raw->ext_cpuid[0][EAX] >= 0x8000001a) {
		/* We have the extended info about SSE unit size
		Extracted from BKDG, about CPUID_Fn8000001A_EAX [Performance Optimization Identifiers] (Core::X86::Cpuid::PerfOptId):
		- bit 2: FP256
		- bit 1: MOVU
		- bit 0: FP128 */
		data->detection_hints[CPU_HINT_SSE_SIZE_AUTH] = 1;
		if ((raw->ext_cpuid[0x1a][EAX] >> 2) & 1)
			data->sse_size = 256;
		else if ((raw->ext_cpuid[0x1a][EAX]) & 1)
			data->sse_size = 128;
		else
			data->sse_size = 64;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x40(%rbp), %rdi
leaq 0x78c92(%rip), %rsi     # 0x1b00e0
movl $0x28, %edx
callq 0x593a0
leaq -0xa0(%rbp), %rdi
leaq 0x78caa(%rip), %rsi     # 0x1b0110
movl $0x60, %edx
callq 0x593a0
leaq -0x100(%rbp), %rdi
leaq 0x78cf2(%rip), %rsi     # 0x1b0170
movl $0x60, %edx
callq 0x593a0
movq -0x8(%rbp), %rax
cmpl $0x80000001, 0x200(%rax) # imm = 0x80000001
jb 0x1374d3
leaq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x21c(%rax), %edx
movq -0x10(%rbp), %rcx
movl $0x5, %esi
callq 0x135600
leaq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x218(%rax), %edx
movq -0x10(%rbp), %rcx
movl $0xc, %esi
callq 0x135600
movq -0x8(%rbp), %rax
cmpl $0x80000007, 0x200(%rax) # imm = 0x80000007
jb 0x137502
leaq -0x100(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x27c(%rax), %edx
movq -0x10(%rbp), %rcx
movl $0xc, %esi
callq 0x135600
movq -0x8(%rbp), %rax
cmpl $0x8000001a, 0x200(%rax) # imm = 0x8000001A
jb 0x137576
movq -0x10(%rbp), %rax
movb $0x1, 0x194(%rax)
movq -0x8(%rbp), %rax
movl 0x3a0(%rax), %eax
shrl $0x2, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x137542
movq -0x10(%rbp), %rax
movl $0x100, 0x190(%rax)     # imm = 0x100
jmp 0x137574
movq -0x8(%rbp), %rax
movl 0x3a0(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x137564
movq -0x10(%rbp), %rax
movl $0x80, 0x190(%rax)
jmp 0x137572
movq -0x10(%rbp), %rax
movl $0x40, 0x190(%rax)
jmp 0x137574
jmp 0x137576
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nop