// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdi, -0x20(%rbp)
movl %esi, -0x24(%rbp)
movq %rdx, -0x30(%rbp)
movl %ecx, -0x34(%rbp)
movq %r8, -0x40(%rbp)
movl %r9d, -0x44(%rbp)
movl $0xffffffff, -0x48(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x4c(%rbp)
movq -0x30(%rbp), %rax
movl 0xd8(%rax), %edx
movq -0x30(%rbp), %rax
movl 0xdc(%rax), %ecx
movq -0x30(%rbp), %rax
movl 0xe0(%rax), %r8d
movq -0x30(%rbp), %rax
movl 0xe4(%rax), %r9d
movq -0x30(%rbp), %rax
movl 0xe8(%rax), %r15d
movq -0x30(%rbp), %rax
movl 0xec(%rax), %r14d
movq -0x30(%rbp), %rax
movl 0x100(%rax), %ebx
movl -0x34(%rbp), %r11d
movq -0x40(%rbp), %r10
movl -0x44(%rbp), %eax
movl $0x3, %edi
leaq 0x72862(%rip), %rsi     # 0x1a8154
movl %r15d, (%rsp)
movl %r14d, 0x8(%rsp)
movl %ebx, 0x10(%rsp)
movl %r11d, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movl %eax, 0x28(%rsp)
movb $0x0, %al
callq 0x135780
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x1359c7
movq -0x20(%rbp), %rdi
movslq -0x50(%rbp), %rax
imulq $0x78, %rax, %rax
addq %rax, %rdi
movq -0x30(%rbp), %rsi
movl -0x34(%rbp), %edx
movq -0x40(%rbp), %rcx
movl -0x44(%rbp), %r8d
callq 0x135a00
movl %eax, -0x54(%rbp)
movl -0x50(%rbp), %edx
movq -0x20(%rbp), %rcx
movslq -0x50(%rbp), %rax
imulq $0x78, %rax, %rax
addq %rax, %rcx
addq $0x34, %rcx
movl -0x54(%rbp), %r8d
movl $0x3, %edi
leaq 0x7283d(%rip), %rsi     # 0x1a81b0
movb $0x0, %al
callq 0x135780
movl -0x54(%rbp), %eax
cmpl -0x48(%rbp), %eax
jle 0x1359b7
movq -0x20(%rbp), %rdx
movslq -0x50(%rbp), %rax
imulq $0x78, %rax, %rax
addq %rax, %rdx
addq $0x34, %rdx
movl -0x54(%rbp), %ecx
movl $0x2, %edi
leaq 0x72826(%rip), %rsi     # 0x1a81ca
movb $0x0, %al
callq 0x135780
movl -0x54(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x1359b9
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x13591b
movq -0x30(%rbp), %rdi
addq $0x150, %rdi            # imm = 0x150
movq -0x20(%rbp), %rsi
movslq -0x4c(%rbp), %rax
imulq $0x78, %rax, %rax
addq %rax, %rsi
addq $0x34, %rsi
movl $0x40, %edx
callq 0x59810
movl -0x48(%rbp), %eax
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)