// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %r8, %r14
movq %rcx, %r13
movq %rdx, 0xd0(%rsp)
movq %rsi, 0x90(%rsp)
movq %rdi, %rbx
movl (%rcx), %edx
leaq 0x9c2c5(%rip), %rsi     # 0x12f44e
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0x68(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
leaq 0xd8(%rsp), %rcx
movq %rbx, %rdi
callq 0xfa6e0
movq 0x28(%r13), %rcx
movq 0x30(%r13), %rax
leaq (%rcx,%rax), %rsi
movq 0x18(%rbx), %rdx
cmpq 0x18(%rdx), %rsi
jg 0x93c10
movq %rdx, 0x68(%rsp)
movq %rax, 0x70(%rsp)
movq %rcx, 0x78(%rsp)
movq %r14, 0xb8(%rsp)
movq 0x20(%r13), %r12
movq %r12, 0xc8(%rsp)
movb $0x1, 0xc0(%rsp)
movl 0x8(%r13), %ecx
testl %ecx, %ecx
sete %dl
testq %r12, %r12
sete %sil
orb %dl, %sil
cmpb $0x1, %sil
jne 0x9323f
leaq 0x68(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
leaq 0xd8(%rsp), %rcx
movq %rbx, %rdi
xorl %r8d, %r8d
callq 0xfaa08
jmp 0x93bbe
cmpl $0x3, %ecx
je 0x936f5
cmpl $0x2, %ecx
jne 0x93ba3
leaq 0x10(%rsp), %r14
movq %rax, (%r14)
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf0faf
movq %rax, 0x18(%rsp)
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf0faf
movq %rax, 0x20(%rsp)
movl $0x20, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x30(%rsp)
movl $0x18, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x60(%rsp)
movl $0x60, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x28(%rsp)
movl $0x20, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x40(%rsp)
movl $0x18, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x48(%rsp)
movl $0x60, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x50(%rsp)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef1ed
leaq 0x9c19e(%rip), %rsi     # 0x12f49e
movq %rbx, %rdi
movq %rax, 0x98(%rsp)
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %edx
leaq 0x9c193(%rip), %rsi     # 0x12f4be
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %edx
leaq 0x9c187(%rip), %rsi     # 0x12f4d3
movq %rbx, %rdi
movl %edx, 0x88(%rsp)
xorl %eax, %eax
callq 0xe9226
movq 0x90(%rsp), %rax
movq 0x58(%rax), %rdi
callq 0xebdc3
movq %r13, 0x58(%rsp)
movl $0x3, %r15d
testq %r12, %r12
jle 0x9363c
movq 0x10(%rsp), %r14
leaq 0x3(%r14), %rax
movq 0x78(%rsp), %rcx
addq 0x70(%rsp), %rcx
cmpq %rcx, %rax
jg 0x9363c
movq %r12, 0x38(%rsp)
movq 0x68(%rsp), %rdi
leaq 0x10(%rsp), %r13
movq %r13, %rsi
callq 0xef1ed
movq %rax, %r15
xorl %r12d, %r12d
cmpq $0x1000, %rax           # imm = 0x1000
setne %r12b
movq 0x68(%rsp), %rdi
movq %r13, %rsi
callq 0xef14d
movzbl %al, %ebp
movq %rbx, %rdi
leaq 0x9c10e(%rip), %rsi     # 0x12f4ed
movq %r14, %rdx
movq %r15, %rcx
movl %ebp, %r8d
movl %r12d, %r9d
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0xf1a5f
testb %bpl, %bpl
je 0x934d4
movq %rbx, %rdi
movq 0x30(%rsp), %r12
movq %r12, %rsi
movq 0x60(%rsp), %rbp
movq %rbp, %rdx
movq 0x28(%rsp), %r13
movq %r13, %rcx
callq 0xfa6e0
movq 0x68(%rsp), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r12)
movq 0x78(%rsp), %rcx
subq %rax, %rcx
addq 0x70(%rsp), %rcx
movq %rcx, 0x10(%r12)
movq %r14, (%rbp)
movb $0x1, 0x8(%rbp)
movq %r15, 0x10(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movl $0x0, 0xb0(%rsp)
movl $0x9, 0xa0(%rsp)
movl $0xc, 0xac(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r13, %rcx
leaq 0xa0(%rsp), %r8
callq 0x102cf0
movq %r13, %rsi
cmpl $0x0, (%r13)
movq 0x38(%rsp), %r12
je 0x934fd
movq %rbx, %rdi
leaq 0xd8(%rsp), %rdx
leaq 0x9bfd5(%rip), %rcx     # 0x12f494
callq 0xfb630
movl $0x4, %r15d
movq 0x58(%rsp), %r13
jmp 0x9363c
movq 0x68(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0xefabc
movq 0x10(%rsp), %rax
addq %r15, %rax
movq 0x38(%rsp), %r12
movq 0x58(%rsp), %r13
jmp 0x93515
cmpb $0x0, 0x4(%rsi)
movq 0x58(%rsp), %r13
je 0x9361f
movq 0x10(%rsp), %rax
addq 0x8(%rsi), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0xf1a5f
cmpq $0x1000, %r15           # imm = 0x1000
je 0x935c3
movq %rbx, %rdi
movq 0x40(%rsp), %r14
movq %r14, %rsi
movq 0x48(%rsp), %r15
movq %r15, %rdx
movq 0x50(%rsp), %rbp
movq %rbp, %rcx
callq 0xfa6e0
movq 0x18(%rsp), %rax
movq %rax, (%r14)
movq $0x0, 0x8(%r14)
movq 0x18(%rax), %rax
movq %rax, 0x10(%r14)
movq 0x20(%rsp), %rax
movq %rax, (%r15)
movb $0x1, 0x8(%r15)
movq $0x1000, 0x10(%r15)     # imm = 0x1000
movq %rbx, %rdi
movq %r14, %rsi
movq 0x20(%rsp), %r14
movq %r15, %rdx
movq %rbp, %rcx
movl 0x88(%rsp), %r8d
callq 0x93e61
cmpl $0x0, (%rbp)
je 0x935d7
movq %rbx, %rdi
movq 0x50(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
leaq 0x9bed8(%rip), %rcx     # 0x12f494
callq 0xfb630
jmp 0x93636
movl $0x1000, %edx           # imm = 0x1000
movq 0x18(%rsp), %rdi
xorl %esi, %esi
movq %r14, %rcx
callq 0xefabc
movq 0x90(%rsp), %rax
movq 0x58(%rax), %rdi
xorl %r15d, %r15d
movl $0x1000, %ecx           # imm = 0x1000
movq %r14, %rsi
xorl %edx, %edx
callq 0xebf09
movl $0x1000, %esi           # imm = 0x1000
movq %r12, %rdi
callq 0xea792
movq %r14, %rdi
movq %rax, %r14
movq 0xb8(%rsp), %rcx
xorl %esi, %esi
movq %rax, %rdx
callq 0xefabc
subq %r14, %r12
jmp 0x9363c
movq %rbx, %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x9be63(%rip), %rdx     # 0x12f494
callq 0xfa815
movl $0x4, %r15d
testl %r15d, %r15d
je 0x93373
cmpl $0x4, %r15d
movq 0x18(%rsp), %r14
je 0x9369f
movq 0x90(%rsp), %rax
movq 0x58(%rax), %rdi
callq 0xebe2a
movl %eax, %ebp
leaq 0x9beb2(%rip), %rsi     # 0x12f51c
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
cmpl 0x98(%rsp), %ebp
je 0x9369f
leaq 0x9be0e(%rip), %rdx     # 0x12f494
leaq 0x9beb1(%rip), %rcx     # 0x12f53e
leaq 0xd8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0xfa71e
movq %r14, %rdi
callq 0xf0b13
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0xe9752
movq %rbx, %rdi
movq 0x60(%rsp), %rsi
callq 0xe9752
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
callq 0xe9752
movq %rbx, %rdi
movq 0x40(%rsp), %rsi
callq 0xe9752
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
callq 0xe9752
movq %rbx, %rdi
movq 0x50(%rsp), %rsi
jmp 0x93b9c
leaq 0x10(%rsp), %r14
movq %rax, (%r14)
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf0faf
movq %rax, 0x60(%rsp)
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf0faf
movq %rax, %r15
movl $0x18, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %rbp
movl $0x60, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x28(%rsp)
movl $0x20, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x48(%rsp)
movl $0x18, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x88(%rsp)
movl $0x60, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x40(%rsp)
xorps %xmm0, %xmm0
leaq 0xa0(%rsp), %rax
movaps %xmm0, (%rax)
movl $0x0, 0x10(%rax)
movl $0xa, (%rax)
movl $0xc, 0xc(%rax)
movq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %edx
leaq 0x9bd07(%rip), %rsi     # 0x12f4be
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %edx
leaq 0x9bcfb(%rip), %rsi     # 0x12f4d3
movq %rbx, %rdi
movl %edx, 0x98(%rsp)
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rdx
movq 0x28(%rsp), %rcx
callq 0xfa6e0
movq $0x0, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movq %r13, 0x58(%rsp)
movq %rbp, 0x30(%rsp)
movq %r15, 0x50(%rsp)
testq %r12, %r12
jle 0x93834
movq 0x10(%rsp), %r14
movq 0x78(%rsp), %rax
addq 0x70(%rsp), %rax
cmpq %rax, %r14
jle 0x9383f
xorl %eax, %eax
testb %al, %al
jne 0x9381b
jmp 0x93b4b
movq %r12, 0x38(%rsp)
movq %r13, %rbp
movq 0x68(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xef1ed
movq %rax, %r12
movl %r12d, %r13d
shrl $0xf, %r13d
andl $0x1fff, %r12d          # imm = 0x1FFF
movq %r12, %r15
andb $0x1, %r13b
je 0x93893
movq 0x68(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xef1ed
movq %rax, %r15
cmpq $0x5, %rax
movl $0x4, %eax
cmovlq %rax, %r15
addq $-0x4, %r15
xorl %eax, %eax
cmpq $0x1000, %r12           # imm = 0x1000
setne %al
movzbl %r13b, %r13d
movl %eax, (%rsp)
movq %rbx, %rdi
leaq 0x9bcb8(%rip), %rsi     # 0x12f568
movq %r14, %rdx
movq %r12, %rcx
movq %r15, %r8
movl %r13d, %r9d
xorl %eax, %eax
callq 0xe9226
movq 0x60(%rsp), %r14
movq %r14, %rdi
callq 0xf1a5f
testb %r13b, %r13b
jne 0x939c7
movq 0x68(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0xefabc
cmpq $0x0, 0x18(%rsp)
movl 0x20(%rsp), %ecx
movzbl %cl, %ecx
movl $0x1, %eax
cmovnel %eax, %ecx
movl %ecx, 0x20(%rsp)
movq %rbp, %r13
movq 0x30(%rsp), %rbp
addq %r15, 0x10(%rsp)
movq 0x50(%rsp), %r15
movq %r15, %rdi
callq 0xf1a5f
cmpl $0x1000, %r12d          # imm = 0x1000
je 0x939fe
movq %rbx, %rdi
movq 0x48(%rsp), %r12
movq %r12, %rsi
movq 0x88(%rsp), %rbp
movq %rbp, %rdx
movq 0x40(%rsp), %r13
movq %r13, %rcx
callq 0xfa6e0
movq %r14, (%r12)
movq $0x0, 0x8(%r12)
movq 0x18(%r14), %rax
movq %rax, 0x10(%r12)
movq %r15, (%rbp)
movb $0x1, 0x8(%rbp)
movq $0x1000, 0x10(%rbp)     # imm = 0x1000
movq %rbx, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq 0x30(%rsp), %rbp
movq %r13, %rcx
movl 0x98(%rsp), %r8d
callq 0x93e61
cmpl $0x0, (%r13)
movq 0x58(%rsp), %r13
movq 0x38(%rsp), %r12
je 0x93a15
movq %rbx, %rdi
movq 0x40(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
leaq 0x9bba1(%rip), %rcx     # 0x12f55e
callq 0xfb630
jmp 0x93834
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
movq %rbp, %r13
je 0x93a5f
cmpb $0x0, 0x20(%rsp)
movq 0x30(%rsp), %rbp
je 0x93a8e
movl $0x1, %esi
xorl %edx, %edx
callq 0xfa8af
movq 0x18(%rsp), %rdi
jmp 0x93a8e
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rcx
callq 0xefabc
movq 0x38(%rsp), %r12
movq 0x90(%rsp), %rax
movq 0x58(%rax), %rdi
movl $0x1000, %ecx           # imm = 0x1000
movq %r15, %rsi
xorl %edx, %edx
callq 0xebf09
movl $0x1000, %esi           # imm = 0x1000
movq %r12, %rdi
callq 0xea792
movq %rax, %r14
movq 0xb8(%rsp), %rcx
movq %r15, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0xefabc
subq %r14, %r12
movb $0x1, %al
jmp 0x93836
movq 0x30(%rsp), %rbp
movq %r14, (%rbp)
movb $0x0, 0x8(%rbp)
movq %rbx, %rdi
leaq 0x6f295(%rip), %rsi     # 0x102d0b
leaq 0xa0(%rsp), %rdx
movq %rbp, %rcx
movq 0x28(%rsp), %r8
callq 0xfa829
movq %rax, %rdi
movq %rdi, 0x18(%rsp)
movq 0x68(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r15, %rcx
callq 0xfa908
movq 0x18(%rsp), %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0xfa8af
movq (%rbp), %rdi
callq 0xf0ea4
movq 0x18(%rsp), %rdi
cmpb $0x0, 0x20(%rdi)
je 0x93acf
callq 0xfa8cc
movq 0x28(%rsp), %rsi
cmpl $0x0, (%rsi)
je 0x93afa
movq %rbx, %rdi
leaq 0xd8(%rsp), %rdx
leaq 0x9ba73(%rip), %rcx     # 0x12f55e
callq 0xfb630
movl $0x0, 0x20(%rsp)
jmp 0x93b3f
movq (%rbp), %rax
movq 0x18(%rax), %r9
cmpq %r12, %r9
jne 0x93b14
movl $0x0, 0x20(%rsp)
jmp 0x9390f
movl $0x0, 0x20(%rsp)
movq %rbx, %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x9ba30(%rip), %rdx     # 0x12f55e
leaq 0x9ba70(%rip), %rcx     # 0x12f5a5
movq %r12, %r8
xorl %eax, %eax
callq 0xfa71e
xorl %eax, %eax
movq 0x38(%rsp), %r12
jmp 0x93836
movq 0x18(%rsp), %rdi
callq 0xfa8d8
movq 0x60(%rsp), %rdi
callq 0xf0b13
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xe9752
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
callq 0xe9752
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
callq 0xe9752
movq %rbx, %rdi
movq 0x88(%rsp), %rsi
callq 0xe9752
movq %rbx, %rdi
movq 0x40(%rsp), %rsi
callq 0xe9752
jmp 0x93bbe
leaq 0x8ce32(%rip), %rcx     # 0x1209dc
leaq 0xd8(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xfa71e
cmpl $0x0, 0xd8(%rsp)
je 0x93c06
movq 0xd0(%rsp), %rax
movl 0x8(%rax), %r14d
movl (%r13), %r15d
leaq 0xd8(%rsp), %rsi
movq %rbx, %rdi
callq 0xfa6a8
leaq 0x9b874(%rip), %rsi     # 0x12f463
xorl %ebp, %ebp
movq %rbx, %rdi
movl %r14d, %edx
movl %r15d, %ecx
movq %rax, %r8
xorl %eax, %eax
callq 0xe9df7
jmp 0x93c10
movb $0x1, 0x48(%r13)
movl $0x1, %ebp
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movl %ebp, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq