// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/libraries/libcpuid/recog_centaur.c
// Function: cpuid_identify_centaur
int cpuid_identify_centaur(struct cpu_raw_data_t* raw, struct cpu_id_t* data, struct internal_id_info_t* internal)
{
	centaur_code_and_bits_t brand;
	centaur_model_t model_code;
	int i;
	char* brand_code_str = NULL;

	if (raw->basic_cpuid[0][EAX] >= 4)
		decode_deterministic_cache_info_x86(raw->intel_fn4, MAX_INTELFN4_LEVEL, data, internal);
	decode_number_of_cores_x86(raw, data);

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

	internal->code.centaur = brand.code;
	internal->bits = brand.bits;
	internal->score = match_cpu_codename(cpudb_centaur, COUNT_OF(cpudb_centaur), data,
		brand.code, brand.bits, model_code);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
cmpl $0x4, (%rdi)
jb 0xcb48f
leaq 0x400(%r15), %rdi
movl $0x8, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0xca50a
movq %rbx, 0x8(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0xca492
leaq 0x14(%r14), %r13
movb $0x1, %bpl
xorl %r12d, %r12d
leaq 0x9f720(%rip), %rbx     # 0x16abd0
shlq $0x4, %r12
movq 0x8(%r12,%rbx), %rsi
movq %r13, %rdi
callq 0xca1ca
testl %eax, %eax
jne 0xcb4e9
movl $0x1, %r12d
xorl %r15d, %r15d
testb $0x1, %bpl
movl $0x0, %ebp
jne 0xcb4b0
movl $0x1, %ebp
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0xcb601
addq %r12, %rbx
movl (%rbx), %ebp
cmpl $0xbb8, %ebp            # imm = 0xBB8
je 0xcb597
cmpl $0xbb9, %ebp            # imm = 0xBB9
jne 0xcb5f8
xorl %r12d, %r12d
leaq 0x9f760(%rip), %rbx     # 0x16ac70
xorl %r15d, %r15d
movq 0x8(%r12,%rbx), %rsi
movq %r13, %rdi
callq 0xca1ca
testl %eax, %eax
je 0xcb528
orq (%r12,%rbx), %r15
addq $0x10, %r12
cmpq $0x80, %r12
jne 0xcb513
movq %r13, %rdi
callq 0x56370
movq %rax, %rbx
leaq 0x52103(%rip), %rsi     # 0x11d64a
movq %r13, %rdi
callq 0xca1ca
testl %eax, %eax
je 0xcb68c
leal 0xf(%rax), %ecx
leaq 0x9f65f(%rip), %rsi     # 0x16abc0
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpl %ebx, %ecx
movq 0x8(%rsp), %rbx
jge 0xcb5d8
cltq
movzbl 0xb(%r13,%rax), %eax
cmpl $0x32, %eax
je 0xcb714
cmpl $0x34, %eax
je 0xcb709
cmpl $0x33, %eax
jne 0xcb5d8
movl $0x3e9, %r12d           # imm = 0x3E9
jmp 0xcb5d8
xorl %r12d, %r12d
leaq 0x9f64f(%rip), %rbx     # 0x16abf0
xorl %r15d, %r15d
movq 0x8(%r12,%rbx), %rsi
movq %r13, %rdi
callq 0xca1ca
testl %eax, %eax
je 0xcb5b9
orq (%r12,%rbx), %r15
addq $0x10, %r12
cmpq $0x80, %r12
jne 0xcb5a4
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rbx
leaq 0x9f5d8(%rip), %rsi     # 0x16abb0
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0xcb606
leaq 0x51f8c(%rip), %rsi     # 0x11d574
movl $0x2, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0xc9c3a
jmp 0xcb61b
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movq 0x8(%rsp), %rbx
leaq 0x51f8d(%rip), %rsi     # 0x11d59a
movl $0x2, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0xc9c3a
testq %r15, %r15
je 0xcb640
leaq 0x51f94(%rip), %rsi     # 0x11d5bb
movl $0x2, %edi
xorl %eax, %eax
callq 0xc9c3a
movl $0x2, %edi
movq %r15, %rsi
callq 0xca356
leaq 0x51f8c(%rip), %rsi     # 0x11d5d3
movl $0x2, %edi
movl %r12d, %edx
xorl %eax, %eax
callq 0xc9c3a
movl %ebp, (%rbx)
movq %r15, 0x8(%rbx)
leaq 0x5143d(%rip), %rdi     # 0x11caa0
movl $0x17, %esi
movq %r14, %rdx
movl %ebp, %ecx
movq %r15, %r8
movl %r12d, %r9d
callq 0xc9ceb
movl %eax, 0x10(%rbx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, 0x10(%rsp)
leaq 0x51fbf(%rip), %rsi     # 0x11d657
movq %r13, %rdi
callq 0xca1ca
leaq 0x9f519(%rip), %rsi     # 0x16abc0
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testl %eax, %eax
movq 0x8(%rsp), %rbx
je 0xcb5d8
movslq %eax, %rcx
leaq 0xa(%rcx), %rdx
addl $0xb, %eax
cmpb $0x55, 0xa(%r13,%rcx)
cmovnel %edx, %eax
leal 0x3(%rax), %ecx
cmpl 0x10(%rsp), %ecx
jge 0xcb5d8
cltq
movzbl (%r13,%rax), %eax
addl $-0x34, %eax
cmpl $0x3, %eax
ja 0xcb5d8
leaq 0x5139b(%rip), %rcx     # 0x11ca90
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x64, %r12d
jmp 0xcb5d8
movl $0x3ea, %r12d           # imm = 0x3EA
jmp 0xcb5d8
movl $0x3e8, %r12d           # imm = 0x3E8
jmp 0xcb5d8
movl $0x66, %r12d
jmp 0xcb5d8
movl $0x67, %r12d
jmp 0xcb5d8
movl $0x65, %r12d
jmp 0xcb5d8