// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nufx.c
// Function: decompress_thread
static int decompress_thread(deark *c,
	struct nufx_ctx *d, struct nufx_record *rec,
	struct nufx_thread *t, dbuf *outf)
{
	int retval = 0;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;

	de_dbg(c, "[reading thread #%u]", t->idx);
	de_dbg_indent(c, 1);

	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	if(!t) goto done;
	if(t->cmpr_pos + t->cmpr_len > c->infile->len) goto done;

	dcmpri.f = c->infile;
	dcmpri.pos = t->cmpr_pos;
	dcmpri.len = t->cmpr_len;
	dcmpro.f = outf;
	dcmpro.expected_len = t->orig_len;
	dcmpro.len_known = 1;

	if(t->cmpr_meth==0 || t->orig_len==0) {
		fmtutil_decompress_uncompressed(c, &dcmpri, &dcmpro, &dres, 0);
	}
	else if(t->cmpr_meth==2) {
		decompress_lzw_1(c, d, &dcmpri, &dcmpro, &dres);
	}
	else if(t->cmpr_meth==3) {
		decompress_lzw_2(c, d, &dcmpri, &dcmpro, &dres);
	}
	else {
		de_dfilter_set_errorf(c, &dres, NULL, "Unsupported compression method");
	}

	if(dres.errcode) {
		de_err(c, "Decompression failed for record#%u thread#%u: %s",
			rec->idx, t->idx, de_dfilter_get_errmsg(c, &dres));
		goto done;
	}

	retval = 1;
	t->dcmpr_ok_flag = 1;
	goto done;

done:
	de_dbg_indent(c, -1);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %edx
leaq 0xe3c56(%rip), %rsi     # 0x1bb22d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x68(%rbp), %rdx
leaq -0xc8(%rbp), %rcx
callq 0x1773f0
cmpq $0x0, -0x20(%rbp)
jne 0xd7610
jmp 0xd7784
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x20(%rbp), %rcx
addq 0x28(%rcx), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jle 0xd7633
jmp 0xd7784
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x58(%rbp)
movb $0x1, -0x60(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0xd7684
movq -0x20(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xd76a1
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x68(%rbp), %rdx
leaq -0xc8(%rbp), %rcx
xorl %r8d, %r8d
callq 0x1778b0
jmp 0xd7712
movq -0x20(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0xd76c9
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0x68(%rbp), %rcx
leaq -0xc8(%rbp), %r8
callq 0xd7d30
jmp 0xd7710
movq -0x20(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jne 0xd76f1
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0x68(%rbp), %rcx
leaq -0xc8(%rbp), %r8
callq 0xd82a0
jmp 0xd770e
movq -0x8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq 0xd4ee6(%rip), %rcx     # 0x1ac5ed
movb $0x0, %al
callq 0x177450
jmp 0xd7710
jmp 0xd7712
cmpl $0x0, -0xc8(%rbp)
je 0xd7775
movq -0x8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xd0(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xcc(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x177360
movq -0xd8(%rbp), %rdi
movl -0xd0(%rbp), %edx
movl -0xcc(%rbp), %ecx
movq %rax, %r8
leaq 0xe3ad6(%rip), %rsi     # 0x1bb242
movb $0x0, %al
callq 0x15bfb0
jmp 0xd7784
movl $0x1, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movb $0x1, 0x48(%rax)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movl -0x2c(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nop