// File: /workspace/github_c_makefile_star2_O2/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 0xc4b2a
leaq 0x400(%rbx), %rdi
pushq $0x8
popq %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0xc3d54
movq %r15, (%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc3ce8
leaq 0x14(%r14), %r12
pushq $-0x10
popq %rcx
pushq $0x1
popq %rbp
xorl %r15d, %r15d
leaq 0x9c0a3(%rip), %rbx     # 0x160bf0
leaq 0x10(%rcx), %r13
cmpq $0x20, %r13
je 0xc4bf5
movq 0x18(%rcx,%rbx), %rsi
movq %r12, %rdi
callq 0xc3a37
movq %r13, %rcx
testl %eax, %eax
je 0xc4b4d
movl (%r13,%rbx), %ebp
cmpl $0xbb8, %ebp            # imm = 0xBB8
je 0xc4bbb
cmpl $0xbb9, %ebp            # imm = 0xBB9
jne 0xc4bf2
xorl %ebx, %ebx
leaq 0x9c103(%rip), %r13     # 0x160c90
xorl %r15d, %r15d
cmpq $0x80, %rbx
je 0xc4bb4
movq 0x8(%rbx,%r13), %rsi
movq %r12, %rdi
callq 0xc3a37
testl %eax, %eax
je 0xc4bae
orq (%rbx,%r13), %r15
addq $0x10, %rbx
jmp 0xc4b90
movl $0xbb9, %ebp            # imm = 0xBB9
jmp 0xc4bf5
xorl %ebx, %ebx
leaq 0x9c04c(%rip), %r13     # 0x160c10
xorl %r15d, %r15d
cmpq $0x80, %rbx
je 0xc4beb
movq 0x8(%rbx,%r13), %rsi
movq %r12, %rdi
callq 0xc3a37
testl %eax, %eax
je 0xc4be5
orq (%rbx,%r13), %r15
addq $0x10, %rbx
jmp 0xc4bc7
movl $0xbb8, %ebp            # imm = 0xBB8
jmp 0xc4bf5
xorl %r15d, %r15d
movq %r12, %rdi
callq 0x57460
pushq $-0x1
popq %r13
cmpl $0xbb8, %ebp            # imm = 0xBB8
je 0xc4c53
cmpl $0xbb9, %ebp            # imm = 0xBB9
jne 0xc4c78
movq %rax, %rbx
leaq 0x47de6(%rip), %rsi     # 0x10ca01
movq %r12, %rdi
callq 0xc3a37
testl %eax, %eax
je 0xc4cf9
leal 0xf(%rax), %edx
leaq 0x9bfab(%rip), %rcx     # 0x160be0
cmpl %ebx, %edx
jge 0xc4c5a
cltq
movb 0xb(%r12,%rax), %al
addb $-0x32, %al
cmpb $0x3, %al
jae 0xc4c5a
movzbl %al, %r13d
orl $0x3e8, %r13d           # imm = 0x3E8
jmp 0xc4c5a
leaq 0x9bf76(%rip), %rcx     # 0x160bd0
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
je 0xc4c78
leaq 0x47cc1(%rip), %rsi     # 0x10c92b
pushq $0x2
popq %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xc34c6
jmp 0xc4c8b
leaq 0x47cd2(%rip), %rsi     # 0x10c951
pushq $0x2
popq %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xc34c6
testq %r15, %r15
je 0xc4cad
leaq 0x47cdb(%rip), %rsi     # 0x10c972
pushq $0x2
popq %rbx
movl %ebx, %edi
xorl %eax, %eax
callq 0xc34c6
movl %ebx, %edi
movq %r15, %rsi
callq 0xc3bae
leaq 0x47cd6(%rip), %rsi     # 0x10c98a
pushq $0x2
popq %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xc34c6
movq (%rsp), %rbx
movl %ebp, (%rbx)
movq %r15, 0x8(%rbx)
leaq 0x47d4e(%rip), %rdi     # 0x10ca20
pushq $0x17
popq %rsi
movq %r14, %rdx
movl %ebp, %ecx
movq %r15, %r8
movl %r13d, %r9d
callq 0xc3577
movl %eax, 0x10(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x47d0e(%rip), %rsi     # 0x10ca0e
movq %r12, %rdi
callq 0xc3a37
leaq 0x9bed1(%rip), %rcx     # 0x160be0
testl %eax, %eax
je 0xc4c5a
movslq %eax, %rdx
leaq 0xa(%rdx), %rsi
addl $0xb, %eax
cmpb $0x55, 0xa(%r12,%rdx)
cmovnel %esi, %eax
leal 0x3(%rax), %edx
cmpl %ebx, %edx
jge 0xc4c5a
cltq
movb (%r12,%rax), %al
addb $-0x34, %al
cmpb $0x4, %al
jae 0xc4c5a
orb $0x64, %al
movzbl %al, %r13d
jmp 0xc4c5a