// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/zip.c
// Function: ef_os2
static void ef_os2(deark *c, lctx *d, struct extra_item_info_struct *eii)
{
	i64 pos = eii->dpos;
	i64 endpos;
	i64 ulen;
	i64 cmpr_attr_size;
	int cmpr_meth;
	u32 crc_reported;
	const struct cmpr_meth_info *cmi = NULL;
	const char *name = "OS/2 ext. attr. data";
	dbuf *attr_data = NULL;
	de_module_params *mparams = NULL;
	int ret;

	endpos = pos+eii->dlen;
	if(pos+4>endpos) goto done;
	ulen = de_getu32le_p(&pos);
	de_dbg(c, "uncmpr ext attr data size: %"I64_FMT, ulen);
	if(eii->is_central) goto done;

	if(pos+2>endpos) goto done;
	cmpr_meth = (int)de_getu16le_p(&pos);
	de_dbg(c, "ext attr cmpr method: %d", cmpr_meth);

	if(pos+4>endpos) goto done;
	crc_reported = (u32)de_getu32le_p(&pos);
	de_dbg(c, "ext attr crc (reported): 0x%08x", (UI)crc_reported);

	cmpr_attr_size = endpos-pos;
	de_dbg(c, "cmpr ext attr data at %"I64_FMT", len=%"I64_FMT, pos, cmpr_attr_size);
	if(pos + cmpr_attr_size > endpos) goto done;

	cmi = get_cmpr_meth_info(cmpr_meth);
	if(cmpr_meth==6 || !is_compression_method_supported(d, cmi)) {
		de_warn(c, "%s: Unsupported compression method: %d (%s)",
			name, cmpr_meth, (cmi ? cmi->name : "?"));
		goto done;
	}

	attr_data = dbuf_create_membuf(c, ulen, 0x1);
	ret = do_decompress_attrib_data(c, d, pos, cmpr_attr_size,
		attr_data, ulen, crc_reported, cmpr_meth, cmi, 0x1, name);
	if(!ret) {
		de_warn(c, "Failed to decompress %s", name);
		goto done;
	}

	// attr_data contains an OS/2 extended attribute structure (FEA2LIST)
	mparams = de_malloc(c, sizeof(de_module_params));
	mparams->in_params.codes = "L";
	if(ucstring_isnonempty(eii->dd->fname)) {
		mparams->in_params.str1 = eii->dd->fname;
		mparams->in_params.flags |= 0x8;
	}
	de_dbg(c, "decoding OS/2 ext. attribs., unc. len=%"I64_FMT, attr_data->len);
	de_dbg_indent(c, 1);
	de_run_module_by_id_on_slice(c, "ea_data", mparams, attr_data, 0, attr_data->len);
	de_dbg_indent(c, -1);

done:
	dbuf_close(attr_data);
	de_free(c, mparams);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x8(%rdx), %r12
movq %r12, (%rsp)
movq 0x10(%rdx), %r13
cmpq $0x4, %r13
jge 0xdf431
xorl %r14d, %r14d
jmp 0xdf466
movq %rdx, %r15
movq %rsi, 0x20(%rsp)
movq 0x18(%rbx), %rdi
movq %rsp, %rsi
callq 0xef3a0
movq %rax, %rbp
leaq 0x64729(%rip), %rsi     # 0x143b78
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
cmpl $0x0, 0x30(%r15)
je 0xdf48b
xorl %r12d, %r12d
movq %r14, %rdi
callq 0xf0b13
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe9752
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq %r12, %r13
movq (%rsp), %rax
addq $0x2, %rax
cmpq %r13, %rax
jg 0xdf42c
movq 0x18(%rbx), %rdi
movq %rsp, %rsi
callq 0xef1ed
movq %rax, %r12
leaq 0x646e6(%rip), %rsi     # 0x143b97
xorl %r14d, %r14d
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
movq %rsp, %rax
movq (%rax), %rax
addq $0x4, %rax
cmpq %r13, %rax
jg 0xdf466
movq %r12, 0x18(%rsp)
movq 0x18(%rbx), %rdi
movq %rsp, %rsi
movq %rsi, %r12
callq 0xef3a0
leaq 0x646c5(%rip), %rsi     # 0x143bb0
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rax, 0x10(%rsp)
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq (%r12), %rdx
movq %r13, %r12
subq %rdx, %r12
leaq 0x646c0(%rip), %rsi     # 0x143bd0
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0xe9226
movq %rsp, %rax
movq (%rax), %rax
movq %r12, 0x8(%rsp)
addq %r12, %rax
cmpq %r13, %rax
jg 0xdf466
xorl %r13d, %r13d
leaq 0xaea52(%rip), %rax     # 0x18df90
xorl %ecx, %ecx
movq 0x18(%rsp), %r12
cmpl %r12d, (%rcx,%rax)
je 0xdf55a
addq $0x18, %rcx
cmpq $0x210, %rcx            # imm = 0x210
jne 0xdf545
jmp 0xdf560
addq %rcx, %rax
movq %rax, %r13
cmpl $0x6, %r12d
jne 0xdf578
testq %r13, %r13
je 0xdf668
movq 0x8(%r13), %r8
jmp 0xdf66f
testq %r13, %r13
je 0xdf668
cmpq $0x0, 0x10(%r13)
je 0xdf566
movq %rbx, %rdi
movq %rbp, %rsi
movl $0x1, %edx
callq 0xf0faf
movq %rax, %r14
movq (%rsp), %rdx
subq $0x8, %rsp
leaq 0x645b9(%rip), %rax     # 0x143b63
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rcx
movq %r14, %r8
movq %rbp, %r9
pushq %rax
pushq $0x1
pushq %r13
pushq %r12
pushq 0x38(%rsp)
callq 0xe05ce
addq $0x30, %rsp
testl %eax, %eax
je 0xdf692
movl $0x70, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r12
leaq 0x5f5de(%rip), %rax     # 0x13ebce
movq %rax, (%r12)
movq 0x28(%r15), %rax
movq 0x48(%rax), %rdi
callq 0xf6c00
testl %eax, %eax
je 0xdf618
movq 0x28(%r15), %rax
movq 0x48(%rax), %rax
movq %rax, 0x30(%r12)
orb $0x8, 0x8(%r12)
movq 0x18(%r14), %rdx
leaq 0x64614(%rip), %rsi     # 0x143c37
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%r14), %r9
leaq 0x43158(%rip), %rsi     # 0x12279d
movq %rbx, %rdi
movq %r12, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0xea5fa
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
jmp 0xdf469
leaq 0x4c7fa(%rip), %r8      # 0x12be69
leaq 0x6457d(%rip), %rsi     # 0x143bf3
leaq 0x644e6(%rip), %rdx     # 0x143b63
xorl %r14d, %r14d
movq %rbx, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0xe9b27
jmp 0xdf466
leaq 0x64586(%rip), %rsi     # 0x143c1f
leaq 0x644c3(%rip), %rdx     # 0x143b63
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9b27
jmp 0xdf469