// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libcpuid/recog_amd.c
// Function: decode_amd_codename
static void decode_amd_codename(struct cpu_id_t* data, struct internal_id_info_t* internal)
{
	struct amd_code_and_bits_t code_and_bits = decode_amd_codename_part1(data->brand_str);
	int i = 0;
	char* code_str = NULL;
	int model_code = 0;

	for (i = 0; i < COUNT_OF(amd_code_str); i++) {
		if (code_and_bits.code == amd_code_str[i].code) {
			code_str = amd_code_str[i].str;
			break;
		}
	}
	if (/*code == ATHLON_64_X2*/ match_all(code_and_bits.bits, ATHLON_|_64_|_X2) && data->l2_cache < 512) {
		code_and_bits.bits &= ~(ATHLON_ | _64_);
		code_and_bits.bits |= SEMPRON_;
	}
	if (code_str)
		debugf(2, "Detected AMD brand code: %d (%s)\n", code_and_bits.code, code_str);
	else
		debugf(2, "Detected AMD brand code: %d\n", code_and_bits.code);

	if (code_and_bits.bits) {
		debugf(2, "Detected AMD bits: ");
		debug_print_lbits(2, code_and_bits.bits);
	}

	internal->code.amd = code_and_bits.code;
	internal->bits = code_and_bits.bits;
	internal->score = match_cpu_codename(cpudb_amd, COUNT_OF(cpudb_amd), data, code_and_bits.code,
	                                     code_and_bits.bits, model_code);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
addq $0x14, %rdi
callq 0x137a50
movl %eax, -0x20(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
cmpq $0xa, %rax
jae 0x13791d
movl -0x20(%rbp), %eax
movslq -0x24(%rbp), %rdx
leaq 0xcffc7(%rip), %rcx     # 0x2078b0
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x137910
movslq -0x24(%rbp), %rcx
leaq 0xcffb1(%rip), %rax     # 0x2078b0
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x13791d
jmp 0x137912
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1378d1
movq -0x18(%rbp), %rdi
movl $0x300400, %esi         # imm = 0x300400
callq 0x136190
cmpl $0x0, %eax
je 0x13795c
movq -0x8(%rbp), %rax
cmpl $0x200, 0x100(%rax)     # imm = 0x200
jge 0x13795c
movq -0x18(%rbp), %rax
andq $-0x100401, %rax        # imm = 0xFFEFFBFF
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
orq $0x2000, %rax           # imm = 0x2000
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x13797f
movl -0x20(%rbp), %edx
movq -0x30(%rbp), %rcx
movl $0x2, %edi
leaq 0x788f7(%rip), %rsi     # 0x1b026d
movb $0x0, %al
callq 0x135780
jmp 0x137995
movl -0x20(%rbp), %edx
movl $0x2, %edi
leaq 0x78901(%rip), %rsi     # 0x1b028f
movb $0x0, %al
callq 0x135780
cmpq $0x0, -0x18(%rbp)
je 0x1379bd
movl $0x2, %edi
leaq 0x78904(%rip), %rsi     # 0x1b02ac
movb $0x0, %al
callq 0x135780
movq -0x18(%rbp), %rsi
movl $0x2, %edi
callq 0x1361c0
movl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdx
movl -0x20(%rbp), %ecx
movq -0x18(%rbp), %r8
movl -0x34(%rbp), %r9d
leaq 0x70b38(%rip), %rdi     # 0x1a8520
movl $0x108, %esi            # imm = 0x108
callq 0x135860
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)