// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/lha.c
// Function: get_cmpr_meth_info
static void get_cmpr_meth_info(const u8 idbuf[5], enum lha_basefmt_enum basefmt,
	struct cmpr_meth_info *cmi)
{
	size_t k;
	const struct cmpr_meth_array_item *cmai = NULL;

	// The first 4 bytes are unique for all known methods.
	cmi->uniq_id = (u32)de_getu32be_direct(idbuf);

	de_memcpy(cmi->id_raw, idbuf, 5);

	// All "possible" methods only use printable characters.
	de_memcpy(cmi->id_printable_sz, idbuf, 5);
	cmi->id_printable_sz[5] = '\0';

	for(k=0; k<DE_ARRAYCOUNT(cmpr_meth_arr); k++) {
		if(cmpr_meth_arr[k].basefmt != basefmt) continue;
		if(cmpr_meth_arr[k].uniq_id == cmi->uniq_id) {
			cmai = &cmpr_meth_arr[k];
			break;
		}
	}

	if(cmai) {
		cmi->is_recognized = 1;
		cmi->decompressor = cmai->decompressor;
	}
	else if(basefmt==BASEFMT_LHA) {
		for(k=0; k<DE_ARRAYCOUNT(other_known_cmpr_methods); k++) {
			if(other_known_cmpr_methods[k] == cmi->uniq_id) {
				cmi->is_recognized = 1;
				break;
			}
		}
	}

	if(cmai && cmai->descr) {
		de_strlcpy(cmi->descr, cmai->descr, sizeof(cmi->descr));
	}
	else if(cmi->is_recognized) {
		de_strlcpy(cmi->descr, "recognized, but no info avail.", sizeof(cmi->descr));
	}
	else {
		de_strlcpy(cmi->descr, "?", sizeof(cmi->descr));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x165430
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movl (%rcx), %edx
movl %edx, 0x10(%rax)
movb 0x4(%rcx), %cl
movb %cl, 0x14(%rax)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movl (%rcx), %edx
movl %edx, 0x15(%rax)
movb 0x4(%rcx), %cl
movb %cl, 0x19(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x1a(%rax)
movq $0x0, -0x20(%rbp)
cmpq $0x16, -0x20(%rbp)
jae 0xc3a9b
movq -0x20(%rbp), %rcx
leaq 0x15640b(%rip), %rax    # 0x219e50
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0xc(%rbp), %eax
je 0xc3a55
jmp 0xc3a8d
movq -0x20(%rbp), %rcx
leaq 0x1563f0(%rip), %rax    # 0x219e50
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0xc3a8b
movq -0x20(%rbp), %rcx
leaq 0x1563d2(%rip), %rax    # 0x219e50
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0xc3a9b
jmp 0xc3a8d
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xc3a33
cmpq $0x0, -0x28(%rbp)
je 0xc3abb
movq -0x18(%rbp), %rax
movb $0x1, (%rax)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0xc3b04
cmpl $0x0, -0xc(%rbp)
jne 0xc3b02
movq $0x0, -0x20(%rbp)
cmpq $0x13, -0x20(%rbp)
jae 0xc3b00
movq -0x20(%rbp), %rcx
leaq 0xf3bd5(%rip), %rax     # 0x1b76b0
movl (%rax,%rcx,4), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0xc3af0
movq -0x18(%rbp), %rax
movb $0x1, (%rax)
jmp 0xc3b00
jmp 0xc3af2
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xc3ac9
jmp 0xc3b02
jmp 0xc3b04
cmpq $0x0, -0x28(%rbp)
je 0xc3b32
movq -0x28(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0xc3b32
movq -0x18(%rbp), %rdi
addq $0x1b, %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
movl $0x50, %edx
callq 0x15aa30
jmp 0xc3b71
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0xc3b56
movq -0x18(%rbp), %rdi
addq $0x1b, %rdi
leaq 0xf3ee4(%rip), %rsi     # 0x1b7a2e
movl $0x50, %edx
callq 0x15aa30
jmp 0xc3b6f
movq -0x18(%rbp), %rdi
addq $0x1b, %rdi
leaq 0xf40c8(%rip), %rsi     # 0x1b7c2d
movl $0x50, %edx
callq 0x15aa30
jmp 0xc3b71
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)