// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/mscompress.c
// Function: do_decompress
static void do_decompress(deark *c, lctx *d, dbuf *outf)
{
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;

	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.f = d->inf;
	dcmpri.pos = d->cmpr_data_pos;
	dcmpri.len = d->cmpr_data_len;

	dcmpro.f = outf;
	dcmpro.len_known = d->uncmpr_len_known;
	dcmpro.expected_len =  d->uncmpr_len;

	switch(d->cmpr_meth) {
	case CMPR_NONE:
		fmtutil_decompress_uncompressed(c, &dcmpri, &dcmpro, &dres, 0);
		break;
	case CMPR_XOR:
		do_decompress_XOR(c, &dcmpri, &dcmpro, &dres);
		break;
	case CMPR_LZSS18:
		fmtutil_decompress_lzss1(c, &dcmpri, &dcmpro, &dres, 0x0);
		break;
	case CMPR_LZSS16:
		fmtutil_decompress_lzss1(c, &dcmpri, &dcmpro, &dres, 0x1);
		break;
	case CMPR_LZHUFF:
		do_decompress_LZHUFF(c, &dcmpri, &dcmpro, &dres);
		break;
	case CMPR_MSZIP:
		do_decompress_MSZIP(c, &dcmpri, &dcmpro, &dres);
		break;
	}
	dbuf_flush(dcmpro.f);

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

	if(dres.bytes_consumed_valid) {
		de_dbg(c, "decompressed %"I64_FMT" to %"I64_FMT" bytes",
			dres.bytes_consumed, outf->len);
	}

	if(d->uncmpr_len_known && (outf->len != d->uncmpr_len)) {
		de_warn(c, "Expected %"I64_FMT" output bytes, got %"I64_FMT,
			d->uncmpr_len, outf->len);
	}

done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
callq 0x1773f0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movb 0x20(%rax), %al
movb %al, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0xb4(%rbp)
testl %eax, %eax
je 0xe2662
jmp 0xe2614
movl -0xb4(%rbp), %eax
subl $0x1, %eax
je 0xe2682
jmp 0xe2621
movl -0xb4(%rbp), %eax
subl $0x2, %eax
je 0xe269c
jmp 0xe262e
movl -0xb4(%rbp), %eax
subl $0x3, %eax
je 0xe26d9
jmp 0xe263f
movl -0xb4(%rbp), %eax
subl $0x4, %eax
je 0xe26f3
jmp 0xe2650
movl -0xb4(%rbp), %eax
subl $0x10000, %eax          # imm = 0x10000
je 0xe26b9
jmp 0xe270b
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
xorl %r8d, %r8d
callq 0x1778b0
jmp 0xe270b
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
callq 0xe27d0
jmp 0xe270b
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
xorl %r8d, %r8d
callq 0x178990
jmp 0xe270b
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
movl $0x1, %r8d
callq 0x178990
jmp 0xe270b
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
callq 0xe2820
jmp 0xe270b
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
callq 0xe2b60
movq -0x50(%rbp), %rdi
callq 0x167c30
cmpl $0x0, -0xb0(%rbp)
je 0xe2752
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x177360
movq -0xc0(%rbp), %rdi
movq %rax, %rdx
leaq 0xbe3e6(%rip), %rsi     # 0x1a0b2f
movb $0x0, %al
callq 0x15bfb0
jmp 0xe27bf
cmpb $0x0, -0xac(%rbp)
je 0xe277c
movq -0x8(%rbp), %rdi
movq -0xa8(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0xca983(%rip), %rsi     # 0x1ad0f8
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movzbl 0x20(%rax), %eax
cmpl $0x0, %eax
je 0xe27bd
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x28(%rcx), %rax
je 0xe27bd
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0xda572(%rip), %rsi     # 0x1bcd28
movb $0x0, %al
callq 0x15bc10
jmp 0xe27bf
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax,%rax)