// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/libraries/libcpuid/libcpuid_util.c
// Function: match_cpu_codename
int match_cpu_codename(const struct match_entry_t* matchtable, int count,
                       struct cpu_id_t* data, int brand_code, uint64_t bits,
                       int model_code)
{
	int bestscore = -1;
	int bestindex = 0;
	int i, t;

	debugf(3, "Matching cpu f:%d, m:%d, s:%d, xf:%d, xm:%d, ncore:%d, l2:%d, bcode:%d, bits:%llu, code:%d\n",
		data->family, data->model, data->stepping, data->ext_family,
		data->ext_model, data->num_cores, data->l2_cache, brand_code, (unsigned long long) bits, model_code);

	for (i = 0; i < count; i++) {
		t = score(&matchtable[i], data, brand_code, bits, model_code);
		debugf(3, "Entry %d, `%s', score %d\n", i, matchtable[i].name, t);
		if (t > bestscore) {
			debugf(2, "Entry `%s' selected - best score so far (%d)\n", matchtable[i].name, t);
			bestscore = t;
			bestindex = i;
		}
	}
	strncpy(data->cpu_codename, matchtable[bestindex].name, CODENAME_STR_MAX);
	return bestscore;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movl %r9d, %r12d
movq %r8, %r10
movl %ecx, %r15d
movq %rdx, %rax
movl %esi, %ebp
movq %rdi, %r14
movl 0xd8(%rdx), %edx
movl 0xdc(%rax), %ecx
movl 0xe0(%rax), %r8d
movl 0xe4(%rax), %r9d
movl 0xe8(%rax), %esi
movq %rsi, 0x10(%rsp)
movl 0xec(%rax), %r11d
movq %rax, 0x18(%rsp)
movl 0x100(%rax), %ebx
leaq 0x4ab65(%rip), %rsi     # 0x1148b0
movl $0x3, %edi
xorl %eax, %eax
movq %r12, 0x38(%rsp)
pushq %r12
movq %r10, 0x38(%rsp)
pushq %r10
movq %r15, 0x38(%rsp)
pushq %r15
pushq %rbx
pushq %r11
pushq 0x38(%rsp)
callq 0xc9c3a
addq $0x30, %rsp
testl %ebp, %ebp
jle 0xca03d
movl %ebp, %eax
movq %rax, 0x20(%rsp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
leaq 0x4ac92(%rip), %r15     # 0x114a24
xorl %r12d, %r12d
movl $0x0, 0xc(%rsp)
movl %ebx, 0x10(%rsp)
imulq $0x78, %r12, %rax
leaq (%r14,%rax), %r13
leaq 0x4ac36(%rip), %rcx     # 0x1149e6
movq %rcx, 0x40(%rsp)
movl (%r14,%rax), %ecx
movl %ecx, 0x48(%rsp)
movq 0x18(%rsp), %rdx
movl 0xd8(%rdx), %ecx
movl %ecx, 0x4c(%rsp)
movl $0x2, %esi
movl %esi, 0x50(%rsp)
leaq 0x4ac15(%rip), %rcx     # 0x1149f1
movq %rcx, 0x58(%rsp)
movl 0x4(%r14,%rax), %ecx
movl %ecx, 0x60(%rsp)
movl 0xdc(%rdx), %ecx
movl %ecx, 0x64(%rsp)
movl %esi, 0x68(%rsp)
leaq 0x4abda(%rip), %rcx     # 0x1149d9
movq %rcx, 0x70(%rsp)
movl 0x8(%r14,%rax), %ecx
movl %ecx, 0x78(%rsp)
movl 0xe0(%rdx), %ecx
movl %ecx, 0x7c(%rsp)
movl %esi, 0x80(%rsp)
leaq 0x4abbd(%rip), %rcx     # 0x1149e2
movq %rcx, 0x88(%rsp)
movl 0xc(%r14,%rax), %ecx
movl %ecx, 0x90(%rsp)
movl 0xe4(%rdx), %ecx
movl %ecx, 0x94(%rsp)
movl %esi, 0x98(%rsp)
leaq 0x4ab99(%rip), %rcx     # 0x1149ed
movq %rcx, 0xa0(%rsp)
movl 0x10(%r14,%rax), %ecx
movl %ecx, 0xa8(%rsp)
movl 0xe8(%rdx), %ecx
movl %ecx, 0xac(%rsp)
movl %esi, 0xb0(%rsp)
leaq 0x4ab74(%rip), %rcx     # 0x1149f7
movq %rcx, 0xb8(%rsp)
movl 0x14(%r14,%rax), %ecx
movl %ecx, 0xc0(%rsp)
movl 0xec(%rdx), %ecx
movl %ecx, 0xc4(%rsp)
movl %esi, 0xc8(%rsp)
leaq 0x4ab4c(%rip), %rcx     # 0x1149fe
movq %rcx, 0xd0(%rsp)
movl 0x18(%r14,%rax), %ecx
movl %ecx, 0xd8(%rsp)
movl 0x100(%rdx), %ecx
movl %ecx, 0xdc(%rsp)
movl $0x1, %edi
movl %edi, 0xe0(%rsp)
leaq 0x4ab20(%rip), %rcx     # 0x114a06
movq %rcx, 0xe8(%rsp)
movl 0x1c(%r14,%rax), %ecx
movl %ecx, 0xf0(%rsp)
movl 0x104(%rdx), %ecx
movl %ecx, 0xf4(%rsp)
movl %edi, 0xf8(%rsp)
leaq 0x4aaf9(%rip), %rcx     # 0x114a0e
movq %rcx, 0x100(%rsp)
movl 0x20(%r14,%rax), %ecx
movl %ecx, 0x108(%rsp)
movq 0x28(%rsp), %rcx
movl %ecx, 0x10c(%rsp)
movl %esi, 0x110(%rsp)
leaq 0x4aad6(%rip), %rcx     # 0x114a19
movq %rcx, 0x118(%rsp)
movl 0x30(%r14,%rax), %eax
movl %eax, 0x120(%rsp)
movq 0x38(%rsp), %rax
movl %eax, 0x124(%rsp)
movl %esi, 0x128(%rsp)
xorl %ebp, %ebp
movl $0x10, %ebx
movl 0x38(%rsp,%rbx), %eax
cmpl 0x3c(%rsp,%rbx), %eax
jne 0xc9f98
movl 0x40(%rsp,%rbx), %ecx
addl %ecx, %ebp
movq 0x30(%rsp,%rbx), %rdx
movl $0x4, %edi
movq %r15, %rsi
movl %ebp, %r8d
xorl %eax, %eax
callq 0xc9c3a
addq $0x18, %rbx
cmpq $0x100, %rbx            # imm = 0x100
jne 0xc9f71
movq 0x28(%r13), %rax
andq 0x30(%rsp), %rax
je 0xc9fc4
xorl %ecx, %ecx
movl 0x10(%rsp), %ebx
leaq -0x1(%rax), %rdx
addl $0x2, %ecx
andq %rdx, %rax
jne 0xc9fb6
jmp 0xc9fca
xorl %ecx, %ecx
movl 0x10(%rsp), %ebx
addl %ecx, %ebp
movl $0x4, %edi
movq %r15, %rsi
leaq 0x4aa8f(%rip), %rdx     # 0x114a6a
movl %ebp, %r8d
xorl %eax, %eax
callq 0xc9c3a
addq $0x34, %r13
movl $0x3, %edi
leaq 0x4a917(%rip), %rsi     # 0x11490c
movl %r12d, %edx
movq %r13, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0xc9c3a
cmpl %ebx, %ebp
jle 0xca028
movl $0x2, %edi
leaq 0x4a911(%rip), %rsi     # 0x114926
movq %r13, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc9c3a
movl %r12d, 0xc(%rsp)
movl %ebp, %ebx
incq %r12
cmpq 0x20(%rsp), %r12
jne 0xc9d9d
movslq 0xc(%rsp), %rax
jmp 0xca044
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %eax, %eax
movq 0x18(%rsp), %rdi
addq $0x150, %rdi            # imm = 0x150
imulq $0x78, %rax, %rax
leaq (%r14,%rax), %rsi
addq $0x34, %rsi
movl $0x40, %edx
callq 0x556a0
movl %ebx, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq