// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libcpuid/recog_intel.c
// Function: cpuid_identify_intel
int cpuid_identify_intel(struct cpu_raw_data_t* raw, struct cpu_id_t* data, struct internal_id_info_t* internal)
{
	intel_code_and_bits_t brand;
	intel_model_t model_code;
	int i;
	char* brand_code_str = NULL;

	load_intel_features(raw, data);
	if (raw->basic_cpuid[0][EAX] >= 4) {
		/* Deterministic way is preferred, being more generic */
		decode_deterministic_cache_info_x86(raw->intel_fn4, MAX_INTELFN4_LEVEL, data, internal);
	} else if (raw->basic_cpuid[0][EAX] >= 2) {
		decode_intel_oldstyle_cache_info(raw, data);
	}
	if ((raw->basic_cpuid[0][EAX] < 11) || (decode_intel_extended_topology(raw, data) == 0))
		decode_number_of_cores_x86(raw, data);
	data->purpose = cpuid_identify_purpose_intel(raw);

	brand = get_brand_code_and_bits(data);
	model_code = get_model_code(data);
	for (i = 0; i < COUNT_OF(intel_bcode_str); i++) {
		if (brand.code == intel_bcode_str[i].code) {
			brand_code_str = intel_bcode_str[i].str;
			break;
		}
	}
	if (brand_code_str)
		debugf(2, "Detected Intel brand code: %d (%s)\n", brand.code, brand_code_str);
	else
		debugf(2, "Detected Intel brand code: %d\n", brand.code);
	if (brand.bits) {
		debugf(2, "Detected Intel bits: ");
		debug_print_lbits(2, brand.bits);
	}
	debugf(2, "Detected Intel model code: %d\n", model_code);

	internal->code.intel = brand.code;
	internal->bits = brand.bits;

	if (data->flags[CPU_FEATURE_SGX]) {
		debugf(2, "SGX seems to be present, decoding...\n");
		// if SGX is indicated by the CPU, verify its presence:
		decode_intel_sgx_features(raw, data);
	}

	internal->score = match_cpu_codename(cpudb_intel, COUNT_OF(cpudb_intel), data,
		brand.code, brand.bits, model_code);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1387d0
movq -0x8(%rbp), %rax
cmpl $0x4, (%rax)
jb 0x138611
movq -0x8(%rbp), %rdi
addq $0x400, %rdi            # imm = 0x400
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl $0x8, %esi
callq 0x1365e0
jmp 0x138629
movq -0x8(%rbp), %rax
cmpl $0x2, (%rax)
jb 0x138627
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x138920
jmp 0x138629
movq -0x8(%rbp), %rax
cmpl $0xb, (%rax)
jb 0x138644
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x139200
cmpl $0x0, %eax
jne 0x138651
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1364e0
movq -0x8(%rbp), %rdi
callq 0x139370
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x21d8(%rax)
movq -0x10(%rbp), %rdi
callq 0x139400
movl %eax, -0x48(%rbp)
movq %rdx, -0x40(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x139a70
movl %eax, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movslq -0x30(%rbp), %rax
cmpq $0x17, %rax
jae 0x1386e5
movl -0x28(%rbp), %eax
movslq -0x30(%rbp), %rdx
leaq 0xcf60f(%rip), %rcx     # 0x207cc0
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x1386d8
movslq -0x30(%rbp), %rcx
leaq 0xcf5f9(%rip), %rax     # 0x207cc0
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x1386e5
jmp 0x1386da
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x138699
cmpq $0x0, -0x38(%rbp)
je 0x138708
movl -0x28(%rbp), %edx
movq -0x38(%rbp), %rcx
movl $0x2, %edi
leaq 0x8371e(%rip), %rsi     # 0x1bbe1d
movb $0x0, %al
callq 0x135780
jmp 0x13871e
movl -0x28(%rbp), %edx
movl $0x2, %edi
leaq 0x8372a(%rip), %rsi     # 0x1bbe41
movb $0x0, %al
callq 0x135780
cmpq $0x0, -0x20(%rbp)
je 0x138746
movl $0x2, %edi
leaq 0x8372f(%rip), %rsi     # 0x1bbe60
movb $0x0, %al
callq 0x135780
movq -0x20(%rbp), %rsi
movl $0x2, %edi
callq 0x1361c0
movl -0x2c(%rbp), %edx
movl $0x2, %edi
leaq 0x83721(%rip), %rsi     # 0x1bbe76
movb $0x0, %al
callq 0x135780
movl -0x28(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpb $0x0, 0xc3(%rax)
je 0x13879e
movl $0x2, %edi
leaq 0x8370b(%rip), %rsi     # 0x1bbe95
movb $0x0, %al
callq 0x135780
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x13a110
movq -0x10(%rbp), %rdx
movl -0x28(%rbp), %ecx
movq -0x20(%rbp), %r8
movl -0x2c(%rbp), %r9d
leaq 0x788ec(%rip), %rdi     # 0x1b10a0
movl $0x16e, %esi            # imm = 0x16E
callq 0x135860
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
xorl %eax, %eax
addq $0x50, %rsp
popq %rbp
retq
nop