// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/shg.c
// Function: do_uncompress_picture_data
static int do_uncompress_picture_data(deark *c, lctx *d,
	struct picture_ctx *pctx,
	i64 compressed_offset, i64 compressed_size,
	dbuf *pixels_final, i64 final_image_size)
{
	int retval = 0;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;

	if(pctx->packing_method>3) {
		de_err(c, "Unsupported compression type: %d", (int)pctx->packing_method);
		goto done;
	}

	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.f = c->infile;
	dcmpri.pos = compressed_offset;
	dcmpri.len = compressed_size;
	dcmpro.f = pixels_final;
	dcmpro.len_known = 1;
	dcmpro.expected_len = final_image_size;

	switch(pctx->packing_method) {
	case 1:
		do_decompress_type_1(c, d, &dcmpri, &dcmpro, &dres);
		break;
	case 2:
		do_decompress_type_2(c, d, &dcmpri, &dcmpro, &dres);
		break;
	case 3:
		do_decompress_type_3(c, d, &dcmpri, &dcmpro, &dres);
		break;
	default: // 0, uncompressed
		fmtutil_decompress_uncompressed(c, &dcmpri, &dcmpro, &dres, 0);
	}
	dbuf_flush(dcmpro.f);

	if(dres.errcode) {
		de_err(c, "%s", de_dfilter_get_errmsg(c, &dres));
		goto done;
	}

	if(pixels_final->len < final_image_size) {
		de_warn(c, "Expected %"I64_FMT" bytes after decompression, only got %"I64_FMT,
			final_image_size, pixels_final->len);
	}

	retval = 1;

done:
	return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdx, %r15
movzbl 0x1(%rsi), %edx
cmpl $0x4, %edx
jb 0xc717c
leaq 0x5514d(%rip), %rsi     # 0x11c2bb
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xe9df7
jmp 0xc732d
movq %r9, %r14
movq %r8, %r13
movq %rsi, %rbp
movq %rdi, %r12
leaq 0x20(%rsp), %rbx
leaq 0x8(%rsp), %rdx
movq %rcx, (%rsp)
leaq 0x40(%rsp), %rcx
movq %rbx, %rsi
callq 0xfa6e0
movq %r12, %rcx
movq 0x18(%r12), %rax
leaq 0x8(%rsp), %r12
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movq (%rsp), %rax
movq %rax, 0x10(%rbx)
movq %r13, (%r12)
movb $0x1, 0x8(%r12)
movq %r14, 0x10(%r12)
movzbl 0x1(%rbp), %eax
cmpl $0x3, %eax
je 0xc7251
cmpl $0x2, %eax
je 0xc721e
cmpl $0x1, %eax
movq %rcx, %r15
jne 0xc72bb
leaq 0x5af4f(%rip), %rsi     # 0x12213e
movq %r15, %rdi
xorl %eax, %eax
callq 0xe9226
leaq 0x141(%rip), %rsi       # 0xc7341
leaq 0x20(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0x40(%rsp), %r9
movq %r15, %rdi
xorl %edx, %edx
callq 0xfa967
jmp 0xc72d5
leaq 0x73f4b(%rip), %rsi     # 0x13b170
movq %rcx, %r15
movq %rcx, %rdi
xorl %eax, %eax
callq 0xe9226
leaq 0x20(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x40(%rsp), %rcx
movq %r15, %rdi
xorl %r8d, %r8d
callq 0xfb446
jmp 0xc72d5
leaq 0x73f31(%rip), %rsi     # 0x13b189
movq %rcx, %r15
movq %rcx, %rdi
xorl %eax, %eax
callq 0xe9226
xorps %xmm0, %xmm0
leaq 0xa0(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, 0x20(%rsi)
movaps %xmm0, 0x30(%rsi)
movaps %xmm0, 0x40(%rsi)
leaq 0x341bc(%rip), %rax     # 0xfb446
movq %rax, (%rsi)
movq $0x0, 0x10(%rsi)
leaq 0xa5(%rip), %rax        # 0xc7341
movq %rax, 0x18(%rsi)
movq %rbx, 0x28(%rsi)
movq %r12, 0x30(%rsi)
leaq 0x40(%rsp), %rax
movq %rax, 0x38(%rsi)
movq %r15, %rdi
callq 0xfb662
jmp 0xc72d5
leaq 0x20(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x40(%rsp), %rcx
movq %r15, %rdi
xorl %r8d, %r8d
callq 0xfaa08
movq 0x8(%rsp), %rdi
callq 0xf0ea4
cmpl $0x0, 0x40(%rsp)
je 0xc730b
leaq 0x40(%rsp), %rsi
movq %r15, %rdi
callq 0xfa6a8
leaq 0x4d9b5(%rip), %rsi     # 0x114caf
xorl %ebp, %ebp
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9df7
jmp 0xc732d
movq 0x18(%r13), %rcx
movl $0x1, %ebp
cmpq %r14, %rcx
jge 0xc732d
leaq 0x73e1b(%rip), %rsi     # 0x13b13b
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xe9b27
movl %ebp, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq