// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xe0, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x3, %eax
jle 0x125cca
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %edx
leaq 0x822e9(%rip), %rsi     # 0x1a7fa7
movb $0x0, %al
callq 0x15bfb0
jmp 0x125e30
movq -0x8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x70(%rbp), %rdx
leaq -0xd0(%rbp), %rcx
callq 0x1773f0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movb $0x1, -0x68(%rbp)
movq 0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %eax
movl %eax, -0xd4(%rbp)
subl $0x1, %eax
je 0x125d41
jmp 0x125d27
movl -0xd4(%rbp), %eax
subl $0x2, %eax
je 0x125d5f
jmp 0x125d34
movl -0xd4(%rbp), %eax
subl $0x3, %eax
je 0x125d7d
jmp 0x125d9b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x58(%rbp), %rdx
leaq -0x70(%rbp), %rcx
leaq -0xd0(%rbp), %r8
callq 0x1261c0
jmp 0x125db6
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x58(%rbp), %rdx
leaq -0x70(%rbp), %rcx
leaq -0xd0(%rbp), %r8
callq 0x126220
jmp 0x125db6
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x58(%rbp), %rdx
leaq -0x70(%rbp), %rcx
leaq -0xd0(%rbp), %r8
callq 0x126270
jmp 0x125db6
movq -0x8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x70(%rbp), %rdx
leaq -0xd0(%rbp), %rcx
xorl %r8d, %r8d
callq 0x1778b0
movq -0x70(%rbp), %rdi
callq 0x167c30
cmpl $0x0, -0xd0(%rbp)
je 0x125dfd
movq -0x8(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x177360
movq -0xe0(%rbp), %rdi
movq %rax, %rdx
leaq 0x7ad3b(%rip), %rsi     # 0x1a0b2f
movb $0x0, %al
callq 0x15bfb0
jmp 0x125e30
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
cmpq 0x10(%rbp), %rax
jge 0x125e29
movq -0x8(%rbp), %rdi
movq 0x10(%rbp), %rdx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0xa0f21(%rip), %rsi     # 0x1c6d43
movb $0x0, %al
callq 0x15bc10
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax)