// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
pushq %rbx
subq $0xa8, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x50(%rbp)
leaq 0x84da3(%rip), %rax     # 0x1cfb76
movq %rax, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
addq 0x10(%rcx), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
addq $0x4, %rax
cmpq -0x30(%rbp), %rax
jle 0x14ae0a
jmp 0x14b0ae
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165580
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rdx
leaq 0x84d5d(%rip), %rsi     # 0x1cfb8b
movb $0x0, %al
callq 0x15b0d0
movq -0x20(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x14ae44
jmp 0x14b0ae
movq -0x28(%rbp), %rax
addq $0x2, %rax
cmpq -0x30(%rbp), %rax
jle 0x14ae57
jmp 0x14b0ae
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1652c0
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %edx
leaq 0x84d31(%rip), %rsi     # 0x1cfbaa
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
addq $0x4, %rax
cmpq -0x30(%rbp), %rax
jle 0x14ae93
jmp 0x14b0ae
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165580
movl %eax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movl -0x48(%rbp), %edx
leaq 0x84d0e(%rip), %rsi     # 0x1cfbc3
movb $0x0, %al
callq 0x15b0d0
movq -0x30(%rbp), %rax
subq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x40(%rbp), %rcx
leaq 0x84d08(%rip), %rsi     # 0x1cfbe3
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
addq -0x40(%rbp), %rax
cmpq -0x30(%rbp), %rax
jle 0x14aef5
jmp 0x14b0ae
movl -0x44(%rbp), %edi
callq 0x14a230
movq %rax, -0x50(%rbp)
cmpl $0x6, -0x44(%rbp)
je 0x14af19
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x14c480
cmpl $0x0, %eax
jne 0x14af7c
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x70(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x14af47
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x88(%rbp)
jmp 0x14af57
leaq 0x6ccdf(%rip), %rax     # 0x1b7c2d
movq %rax, -0x88(%rbp)
jmp 0x14af57
movl -0x70(%rbp), %ecx
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %r8
leaq 0x84c96(%rip), %rsi     # 0x1cfc06
movb $0x0, %al
callq 0x15bc10
jmp 0x14b0ae
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl $0x1, %edx
callq 0x168020
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq -0x60(%rbp), %r8
movq -0x38(%rbp), %r9
movl -0x48(%rbp), %ebx
movl -0x44(%rbp), %r11d
movq -0x50(%rbp), %r10
movq -0x58(%rbp), %rax
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movl $0x1, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x14c4c0
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x6c(%rbp)
jne 0x14affc
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rdx
leaq 0x84c42(%rip), %rsi     # 0x1cfc32
movb $0x0, %al
callq 0x15bc10
jmp 0x14b0ae
movq -0x10(%rbp), %rdi
movl $0x70, %esi
callq 0x15b780
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
leaq 0x7fc21(%rip), %rcx     # 0x1cac3a
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x48(%rax), %rdi
callq 0x1717f0
cmpl $0x0, %eax
je 0x14b053
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x48(%rax), %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x68(%rbp), %rax
movl 0x8(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x84be4(%rip), %rsi     # 0x1cfc4a
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rdx
movq -0x60(%rbp), %rcx
movq -0x60(%rbp), %rax
movq 0x18(%rax), %r9
leaq 0x63364(%rip), %rsi     # 0x1ae3fa
xorl %eax, %eax
movl %eax, %r8d
callq 0x15c9f0
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x60(%rbp), %rdi
callq 0x1676a0
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x15b820
addq $0xa8, %rsp
popq %rbx
popq %rbp
retq
nop