// File: /workspace/github_c_makefile_star2_O1/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
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x4, (%rdi)
jb 0xcc29c
leaq 0x400(%rbx), %rdi
movl $0x8, %esi
movq %r14, %rdx
movq %r15, %rcx
callq 0xcb300
movq %r15, (%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xcb288
leaq 0x14(%r14), %r13
xorl %ebx, %ebx
leaq 0x9f918(%rip), %r15     # 0x16bbd0
movq 0x8(%rbx,%r15), %rsi
movq %r13, %rdi
callq 0xcafaa
testl %eax, %eax
jne 0xcc2da
addq $0x10, %rbx
cmpq $0x10, %rbx
je 0xcc2b8
movl $0x1, %ebp
jmp 0xcc2de
movl (%rbx,%r15), %ebp
cmpl $0xbb8, %ebp            # imm = 0xBB8
je 0xcc31e
cmpl $0xbb9, %ebp            # imm = 0xBB9
jne 0xcc34e
xorl %ebx, %ebx
leaq 0x9f979(%rip), %r12     # 0x16bc70
xorl %r15d, %r15d
movq 0x8(%rbx,%r12), %rsi
movq %r13, %rdi
callq 0xcafaa
testl %eax, %eax
je 0xcc30f
orq (%rbx,%r12), %r15
addq $0x10, %rbx
cmpq $0x80, %rbx
jne 0xcc2fa
jmp 0xcc351
xorl %ebx, %ebx
leaq 0x9f8c9(%rip), %r12     # 0x16bbf0
xorl %r15d, %r15d
movq 0x8(%rbx,%r12), %rsi
movq %r13, %rdi
callq 0xcafaa
testl %eax, %eax
je 0xcc33f
orq (%rbx,%r12), %r15
addq $0x10, %rbx
cmpq $0x80, %rbx
jne 0xcc32a
jmp 0xcc351
xorl %r15d, %r15d
movq %r13, %rdi
callq 0x56370
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpl $0xbb9, %ebp            # imm = 0xBB9
jne 0xcc3de
movq %rax, %rbx
leaq 0x515f0(%rip), %rsi     # 0x11d961
movq %r13, %rdi
callq 0xcafaa
testl %eax, %eax
je 0xcc39e
leal 0xf(%rax), %ecx
cmpl %ebx, %ecx
jge 0xcc3de
cltq
movb 0xb(%r13,%rax), %al
addb $-0x32, %al
cmpb $0x3, %al
jae 0xcc3de
movzbl %al, %r12d
orl $0x3e8, %r12d           # imm = 0x3E8
jmp 0xcc3de
leaq 0x515c9(%rip), %rsi     # 0x11d96e
movq %r13, %rdi
callq 0xcafaa
testl %eax, %eax
je 0xcc3de
movslq %eax, %rcx
leaq 0xa(%rcx), %rdx
addl $0xb, %eax
cmpb $0x55, 0xa(%r13,%rcx)
cmovnel %edx, %eax
leal 0x3(%rax), %ecx
cmpl %ebx, %ecx
jge 0xcc3de
cltq
movb (%r13,%rax), %al
addb $-0x34, %al
cmpb $0x4, %al
jae 0xcc3de
orb $0x64, %al
movzbl %al, %r12d
xorl %ecx, %ecx
leaq 0x9f7c9(%rip), %rax     # 0x16bbb0
xorl %edx, %edx
cmpl (%rdx,%rax), %ebp
je 0xcc3fa
addq $0x10, %rdx
cmpq $0x10, %rdx
je 0xcc3e9
jmp 0xcc3ff
movq 0x8(%rdx,%rax), %rcx
testq %rcx, %rcx
je 0xcc41b
leaq 0x51480(%rip), %rsi     # 0x11d88b
movl $0x2, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0xcaa16
jmp 0xcc430
leaq 0x5148f(%rip), %rsi     # 0x11d8b1
movl $0x2, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0xcaa16
testq %r15, %r15
je 0xcc455
leaq 0x51496(%rip), %rsi     # 0x11d8d2
movl $0x2, %edi
xorl %eax, %eax
callq 0xcaa16
movl $0x2, %edi
movq %r15, %rsi
callq 0xcb14c
leaq 0x5148e(%rip), %rsi     # 0x11d8ea
movl $0x2, %edi
movl %r12d, %edx
xorl %eax, %eax
callq 0xcaa16
movq (%rsp), %rbx
movl %ebp, (%rbx)
movq %r15, 0x8(%rbx)
leaq 0x51504(%rip), %rdi     # 0x11d980
movl $0x17, %esi
movq %r14, %rdx
movl %ebp, %ecx
movq %r15, %r8
movl %r12d, %r9d
callq 0xcaac7
movl %eax, 0x10(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq