// File: /workspace/github_c_makefile_star2_O2/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 $0x128, %rsp            # imm = 0x128
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, 0x88(%rsp)
movq %rdi, %rbx
movl (%rcx), %edx
leaq 0x950b9(%rip), %rsi     # 0x1224a9
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
leaq 0x48(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
movq %rbx, %rdi
callq 0xee7ee
movq 0x28(%r15), %rcx
movq 0x30(%r15), %rax
leaq (%rcx,%rax), %rsi
movq 0x18(%rbx), %rdx
cmpq 0x18(%rdx), %rsi
jg 0x8de1e
movq %r12, 0x78(%rsp)
movq %rdx, 0x48(%rsp)
movq %rax, 0x50(%rsp)
movq %rcx, 0x58(%rsp)
movq %r14, 0xb0(%rsp)
movq 0x20(%r15), %r13
movq %r13, 0xc0(%rsp)
movb $0x1, 0xb8(%rsp)
movq %r15, 0x80(%rsp)
movl 0x8(%r15), %ecx
testl %ecx, %ecx
sete %dl
testq %r13, %r13
sete %sil
orb %dl, %sil
cmpb $0x1, %sil
jne 0x8d4b1
leaq 0x48(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
movq %rbx, %rdi
xorl %r8d, %r8d
callq 0xeea8f
jmp 0x8ddcb
cmpl $0x3, %ecx
je 0x8d829
cmpl $0x2, %ecx
jne 0x8dbed
leaq 0x8(%rsp), %r12
movq %rax, (%r12)
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
xorl %edx, %edx
callq 0xe59cd
movq %rax, %r15
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
xorl %edx, %edx
callq 0xe59cd
movq %rax, 0x10(%rsp)
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0xdecaf
movq %rax, 0x18(%rsp)
pushq $0x18
popq %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xdecaf
movq %rax, 0x40(%rsp)
pushq $0x60
popq %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdecaf
movq %rax, 0x20(%rsp)
movq %rbx, %rdi
pushq $0x20
popq %rsi
callq 0xdecaf
movq %rax, 0x28(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xdecaf
movq %rax, 0x38(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdecaf
movq %rax, 0x30(%rsp)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xe3fc4
leaq 0x94f8d(%rip), %rsi     # 0x1224f9
movq %rbx, %rdi
movq %rax, 0x68(%rsp)
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x48(%rsp), %rdi
movq %r12, %rsi
callq 0xe3f2a
movzbl %al, %edx
leaq 0x94f85(%rip), %rsi     # 0x122519
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x48(%rsp), %rdi
movq %r12, %rsi
callq 0xe3f2a
movzbl %al, %edx
leaq 0x94f79(%rip), %rsi     # 0x12252e
movq %rbx, %rdi
movl %edx, 0x70(%rsp)
xorl %eax, %eax
callq 0xde896
movq 0x88(%rsp), %rax
movq 0x58(%rax), %rdi
callq 0xe0e44
testq %r13, %r13
jle 0x8dc0d
movq 0x8(%rsp), %rbp
leaq 0x3(%rbp), %rax
movq 0x58(%rsp), %rcx
addq 0x50(%rsp), %rcx
cmpq %rcx, %rax
jg 0x8dc0d
movq %r13, 0x90(%rsp)
movq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %r12
movq %r12, %rsi
callq 0xe3fc4
movq %rax, %r14
movq %r15, %r13
xorl %r15d, %r15d
cmpq $0x1000, %rax           # imm = 0x1000
setne %r15b
movq 0x48(%rsp), %rdi
movq %r12, %rsi
callq 0xe3f2a
movzbl %al, %r12d
movq %rbx, %rdi
leaq 0x94f07(%rip), %rsi     # 0x122548
movq %rbp, %rdx
movq %r14, %rcx
movl %r12d, %r8d
movl %r15d, %r9d
movq %r13, %r15
xorl %eax, %eax
callq 0xde896
movq %r13, %rdi
callq 0xe62cf
testb %r12b, %r12b
je 0x8d721
movq %rbx, %rdi
movq 0x18(%rsp), %r12
movq %r12, %rsi
movq 0x40(%rsp), %r13
movq %r13, %rdx
movq 0x20(%rsp), %rbp
movq %rbp, %rcx
callq 0xee7ee
movq 0x48(%rsp), %rax
movq %rax, (%r12)
movq 0x8(%rsp), %rax
movq %rax, 0x8(%r12)
movq 0x58(%rsp), %rcx
subq %rax, %rcx
addq 0x50(%rsp), %rcx
movq %rcx, 0x10(%r12)
movq %r15, (%r13)
movb $0x1, 0x8(%r13)
movq %r14, 0x10(%r13)
leaq 0xa0(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x9, 0x9c(%rsp)
movl $0xc, 0xa8(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %r12
movq %rbp, %rcx
leaq 0x9c(%rsp), %r8
callq 0xf644c
cmpl $0x0, (%rbp)
jne 0x8dc67
cmpb $0x0, 0x4(%r12)
movq 0x10(%rsp), %rbp
je 0x8dc86
movq 0x8(%rsp), %rax
addq 0x8(%r12), %rax
jmp 0x8d743
movq 0x48(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0xe45f4
movq 0x8(%rsp), %rax
addq %r14, %rax
movq 0x10(%rsp), %rbp
movq %rax, 0x8(%rsp)
movq %rbp, %rdi
callq 0xe62cf
cmpq $0x1000, %r14           # imm = 0x1000
movq 0x90(%rsp), %r13
je 0x8d7cf
movq %rbx, %rdi
movq 0x28(%rsp), %r14
movq %r14, %rsi
movq 0x38(%rsp), %r12
movq %r12, %rdx
movq 0x30(%rsp), %rbp
movq %rbp, %rcx
callq 0xee7ee
movq %r15, (%r14)
andq $0x0, 0x8(%r14)
movq 0x18(%r15), %rax
movq %rax, 0x10(%r14)
movq 0x10(%rsp), %rax
movq %rax, (%r12)
movb $0x1, 0x8(%r12)
movq $0x1000, 0x10(%r12)     # imm = 0x1000
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rbp, %rcx
movl 0x70(%rsp), %r8d
callq 0x8e096
cmpl $0x0, (%rbp)
movq 0x10(%rsp), %rbp
je 0x8d7e1
jmp 0x8dd56
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rdi
xorl %esi, %esi
movq %rbp, %rcx
callq 0xe45f4
movq 0x88(%rsp), %rax
movq 0x58(%rax), %rdi
movl $0x1000, %ecx           # imm = 0x1000
movq %rbp, %rsi
xorl %edx, %edx
callq 0xe0f33
movl $0x1000, %esi           # imm = 0x1000
movq %r13, %rdi
callq 0xdfb45
movq %rax, %r14
movq 0xb0(%rsp), %rcx
movq %rbp, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0xe45f4
subq %r14, %r13
jmp 0x8d5d4
leaq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq $0x0, 0x20(%rsp)
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
xorl %edx, %edx
callq 0xe59cd
movq %rax, 0x18(%rsp)
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
xorl %edx, %edx
callq 0xe59cd
movq %rax, 0x40(%rsp)
pushq $0x18
popq %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdecaf
movq %rax, %rbp
pushq $0x60
popq %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0xdecaf
movq %rax, %r15
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0xdecaf
movq %rax, 0x70(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdecaf
movq %rax, 0x68(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xdecaf
movq %rax, 0x38(%rsp)
xorps %xmm0, %xmm0
leaq 0x9c(%rsp), %rax
movups %xmm0, 0x4(%rax)
movl $0xa, (%rax)
movl $0xc, 0xc(%rax)
movq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0xe3f2a
movzbl %al, %edx
leaq 0x94c2b(%rip), %rsi     # 0x122519
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x48(%rsp), %rdi
movq %r14, %rsi
callq 0xe3f2a
movzbl %al, %edx
leaq 0x94c1f(%rip), %rsi     # 0x12252e
movq %rbx, %rdi
movl %edx, 0x98(%rsp)
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rdx
movq %r15, 0x28(%rsp)
movq %r15, %rcx
callq 0xee7ee
xorl %r14d, %r14d
movq %rbp, 0x30(%rsp)
testq %r13, %r13
jle 0x8dd06
movq %r13, 0x90(%rsp)
movq 0x18(%rsp), %r13
movq 0x8(%rsp), %r12
movq 0x58(%rsp), %rax
addq 0x50(%rsp), %rax
cmpq %rax, %r12
jg 0x8dd06
movq %r14, 0x10(%rsp)
movq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xe3fc4
movq %rax, %rbp
movl %ebp, %r14d
shrl $0xf, %r14d
andl $0x1fff, %ebp           # imm = 0x1FFF
movq %rbp, %r15
andb $0x1, %r14b
je 0x8d9b9
movq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xe3fc4
movq %rax, %r15
cmpq $0x5, %rax
pushq $0x4
popq %rax
cmovlq %rax, %r15
addq $-0x4, %r15
xorl %eax, %eax
cmpq $0x1000, %rbp           # imm = 0x1000
setne %al
movzbl %r14b, %r14d
movl %eax, (%rsp)
movq %rbx, %rdi
leaq 0x94bed(%rip), %rsi     # 0x1225c3
movq %r12, %rdx
movq %rbp, %rcx
movq %r15, %r8
movl %r14d, %r9d
xorl %eax, %eax
callq 0xde896
movq %r13, %rdi
callq 0xe62cf
testb %r14b, %r14b
jne 0x8da35
movq 0x48(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rbp, %rdx
movq 0x18(%rsp), %rcx
callq 0xe45f4
movq 0x10(%rsp), %r14
testq %r14, %r14
movq 0x20(%rsp), %rcx
movzbl %cl, %ecx
pushq $0x1
popq %rax
cmovnel %eax, %ecx
movq %rcx, 0x20(%rsp)
movq 0x90(%rsp), %r13
jmp 0x8daf9
movq 0x10(%rsp), %r14
testq %r14, %r14
movq 0x90(%rsp), %r13
movq 0x30(%rsp), %r12
je 0x8da62
cmpb $0x0, 0x20(%rsp)
je 0x8da93
movq %r14, %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0xee9b4
jmp 0x8da93
movq 0x18(%rsp), %rax
movq %rax, (%r12)
movb $0x0, 0x8(%r12)
movq %rbx, %rdi
leaq 0x689ec(%rip), %rsi     # 0xf6467
leaq 0x9c(%rsp), %rdx
movq %r12, %rcx
movq 0x28(%rsp), %r8
callq 0xee930
movq %rax, %r14
movq 0x48(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r14, %rdi
movq %r15, %rcx
callq 0xeea0d
movq %r14, %rdi
pushq $0x3
popq %rsi
xorl %edx, %edx
callq 0xee9b4
movq (%r12), %rdi
callq 0xe58e8
cmpb $0x0, 0x20(%r14)
je 0x8dacd
movq %r14, %rdi
callq 0xee9d1
movq 0x28(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x8dca2
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax), %r9
cmpq %rbp, %r9
jne 0x8dce3
movq $0x0, 0x20(%rsp)
movq %r14, 0x10(%rsp)
addq %r15, 0x8(%rsp)
movq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0xe62cf
cmpl $0x1000, %ebp           # imm = 0x1000
je 0x8db8c
movq %rbx, %rdi
movq 0x70(%rsp), %r15
movq %r15, %rsi
movq 0x68(%rsp), %rbp
movq %rbp, %rdx
movq 0x18(%rsp), %r14
movq 0x38(%rsp), %r12
movq %r12, %rcx
callq 0xee7ee
movq %r14, (%r15)
andq $0x0, 0x8(%r15)
movq 0x18(%r14), %rax
movq %rax, 0x10(%r15)
movq 0x40(%rsp), %rax
movq %rax, (%rbp)
movb $0x1, 0x8(%rbp)
movq $0x1000, 0x10(%rbp)     # imm = 0x1000
movq %rbx, %rdi
movq %r15, %rsi
movq 0x40(%rsp), %r15
movq %rbp, %rdx
movq %r12, %rcx
movl 0x98(%rsp), %r8d
callq 0x8e096
cmpl $0x0, (%r12)
je 0x8dba0
jmp 0x8dcc0
movl $0x1000, %edx           # imm = 0x1000
movq 0x18(%rsp), %rdi
xorl %esi, %esi
movq %r15, %rcx
callq 0xe45f4
movq 0x88(%rsp), %rax
movq 0x58(%rax), %rdi
movl $0x1000, %ecx           # imm = 0x1000
movq %r15, %rsi
xorl %edx, %edx
callq 0xe0f33
movl $0x1000, %esi           # imm = 0x1000
movq %r13, %rdi
callq 0xdfb45
movq %rax, %r14
movq 0xb0(%rsp), %rcx
movq %r15, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0xe45f4
subq %r14, %r13
movq 0x10(%rsp), %r14
jmp 0x8d93d
leaq 0x85e20(%rip), %rcx     # 0x113a14
leaq 0xc8(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xee823
jmp 0x8ddcb
movq 0x88(%rsp), %rax
movq 0x58(%rax), %rdi
callq 0xe0e95
movl %eax, %ebp
leaq 0x94950(%rip), %rsi     # 0x122577
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
cmpl 0x68(%rsp), %ebp
movq 0x20(%rsp), %r12
je 0x8dd77
leaq 0x948a6(%rip), %rdx     # 0x1224ef
leaq 0x94949(%rip), %rcx     # 0x122599
leaq 0xc8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0xee823
jmp 0x8dd77
leaq 0x94881(%rip), %rcx     # 0x1224ef
leaq 0xc8(%rsp), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xef547
jmp 0x8dd77
leaq 0x94862(%rip), %rdx     # 0x1224ef
leaq 0xc8(%rsp), %rsi
movq %rbx, %rdi
callq 0xee91c
jmp 0x8dd77
leaq 0x94910(%rip), %rcx     # 0x1225b9
leaq 0xc8(%rsp), %rdx
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
callq 0xef547
jmp 0x8dd06
leaq 0x948f2(%rip), %rcx     # 0x1225b9
leaq 0xc8(%rsp), %rdx
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
callq 0xef547
movq 0x10(%rsp), %r14
jmp 0x8dd06
leaq 0x948cf(%rip), %rdx     # 0x1225b9
leaq 0x9490f(%rip), %rcx     # 0x122600
leaq 0xc8(%rsp), %rsi
movq %rbx, %rdi
movq %rbp, %r8
xorl %eax, %eax
callq 0xee823
movq %r14, %rdi
callq 0xee9dd
movq 0x18(%rsp), %rdi
callq 0xe5591
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0xded32
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
callq 0xded32
movq %rbx, %rdi
movq 0x70(%rsp), %rsi
callq 0xded32
movq %rbx, %rdi
movq 0x68(%rsp), %rsi
callq 0xded32
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
jmp 0x8ddc6
leaq 0x94792(%rip), %rcx     # 0x1224ef
leaq 0xc8(%rsp), %rdx
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0xef547
movq 0x20(%rsp), %r12
movq %r15, %rdi
callq 0xe5591
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
callq 0xded32
movq %rbx, %rdi
movq 0x40(%rsp), %rsi
callq 0xded32
movq %rbx, %rdi
movq %r12, %rsi
callq 0xded32
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
callq 0xded32
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
callq 0xded32
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0xded32
movq 0x80(%rsp), %rax
movq 0x78(%rsp), %rcx
cmpl $0x0, 0xc8(%rsp)
je 0x8de17
movl 0x8(%rcx), %r14d
movl (%rax), %r15d
leaq 0xc8(%rsp), %rsi
movq %rbx, %rdi
callq 0xee7bc
leaq 0x946be(%rip), %rsi     # 0x1224be
xorl %ebp, %ebp
movq %rbx, %rdi
movl %r14d, %edx
movl %r15d, %ecx
movq %rax, %r8
xorl %eax, %eax
callq 0xdf2a5
jmp 0x8de1e
movb $0x1, 0x48(%rax)
pushq $0x1
popq %rbp
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movl %ebp, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq