// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/pack.c
// Function: de_run_pack
static void de_run_pack(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 pos = 0;
	dbuf *outf = NULL;

	d = de_malloc(c, sizeof(lctx));

	pos += 2;
	d->unc_size = de_getu32be_p(&pos);
	de_dbg(c, "uncompressed size: %"I64_FMT, d->unc_size);

	if(d->unc_size!=0) {
		d->ht = fmtutil_huffman_create_decoder(c, 257, 257);
		if(!read_tree(c, d, pos)) goto done;
		pos += d->tree_def_size;
	}

	outf = dbuf_create_output_file(c, "bin", NULL, 0);
	dbuf_enable_wbuffer(outf);

	if(d->unc_size!=0) {
		decode_file_data(c, d, pos, outf);
	}

done:
	dbuf_close(outf);
	if(d) {
		if(d->ht) {
			fmtutil_huffman_destroy_decoder(c, d->ht);
		}
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movl $0x110, %esi            # imm = 0x110
callq 0xe8b2b
movq %rax, %r13
movq %rax, %r15
leaq 0x18(%rsp), %rsi
movq $0x2, (%rsi)
movq 0x18(%rbx), %rdi
callq 0xeed31
movq %rax, (%r13)
leaq 0x7f447(%rip), %rsi     # 0x13826c
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
cmpq $0x0, (%r13)
movq %rbx, 0x8(%rsp)
je 0xb902f
movl $0x101, %esi            # imm = 0x101
movl $0x101, %edx            # imm = 0x101
movq %rbx, %rdi
callq 0x104d0e
movq %rax, 0x10(%r15)
movq 0x18(%rsp), %r14
leaq 0x10(%rsp), %rsi
movq %r14, (%rsi)
movq 0x18(%rbx), %rdi
callq 0xeeb4b
movzbl %al, %edx
movl %edx, 0x48(%r15)
leaq 0x6b320(%rip), %rsi     # 0x12419c
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movl 0x48(%r15), %eax
addl $-0x30, %eax
cmpl $-0x2f, %eax
jae 0xb8ea6
movq 0x10(%rsp), %rax
subq %r14, %rax
movq %rax, 0x8(%r15)
xorl %r12d, %r12d
jmp 0xb9157
movq %r14, 0x28(%rsp)
movq %r13, 0x30(%rsp)
leaq 0x10(%rsp), %r12
leaq 0x7f3c7(%rip), %r13     # 0x138283
xorl %ebp, %ebp
movq 0x8(%rsp), %rbx
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeeb4b
movzbl %al, %ecx
movl %ecx, 0x4c(%r15,%rbp,4)
movl 0x48(%r15), %eax
decl %eax
cmpq %rax, %rbp
jne 0xb8eea
addl $0x2, %ecx
movl %ecx, 0x4c(%r15,%rbp,4)
incq %rbp
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0xe87e4
movl 0x48(%r15), %eax
cmpq %rax, %rbp
jb 0xb8ec3
testl %eax, %eax
je 0xb8fe1
leaq 0x10(%rsp), %r14
xorl %ebp, %ebp
movq 0x8(%rsp), %r12
leal -0x1(%rax), %ecx
xorl %edx, %edx
cmpq %rcx, %rbp
sete %dl
movl 0x4c(%r15,%rbp,4), %r13d
subl %edx, %r13d
je 0xb8f96
movq %rbp, %rax
movq %r15, %rbp
movq %rax, 0x20(%rsp)
leal 0x1(%rax), %r15d
movq 0x18(%r12), %rdi
movq %r14, %rsi
callq 0xeeb4b
movq %r14, %rbx
movzbl %al, %r14d
movq %r12, %rdi
leaq 0x7f340(%rip), %rsi     # 0x13829b
movq 0x20(%rsp), %rdx
movl %r14d, %ecx
xorl %eax, %eax
callq 0xe889f
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq %r12, %rdi
movl %r14d, %edx
movq %rbx, %r14
movl %r15d, %ecx
callq 0x1049cc
decl %r13d
jne 0xb8f3d
movl 0x48(%rbp), %eax
leal -0x1(%rax), %ecx
movq %rbp, %r15
movq 0x20(%rsp), %rbp
cmpq %rcx, %rbp
jne 0xb8fd3
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x7f2fd(%rip), %rsi     # 0x1382a7
movl %ebp, %edx
xorl %eax, %eax
callq 0xe889f
movq 0x10(%r15), %rax
movq 0x10(%rax), %rsi
incq %rbp
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %ebp, %ecx
callq 0x1049cc
movl 0x48(%r15), %eax
jmp 0xb8fd6
incq %rbp
movl %eax, %ecx
cmpq %rcx, %rbp
jb 0xb8f19
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x104a46
testl %eax, %eax
movq 0x30(%rsp), %r13
jne 0xb901c
leaq 0x7f29f(%rip), %rsi     # 0x1382b1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq 0x10(%rsp), %rax
subq 0x28(%rsp), %rax
movq %rax, 0x8(%r15)
addq %rax, 0x18(%rsp)
leaq 0x7c787(%rip), %rsi     # 0x1357bd
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xefda1
movq %rax, %r12
movq %rax, %rdi
callq 0xf0855
cmpq $0x0, (%r15)
je 0xb915c
movq 0x18(%rsp), %r14
leaq 0x791c9(%rip), %rsi     # 0x13222c
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r15)
movq %r14, 0x20(%r15)
movq 0x18(%rax), %rax
movq %rax, 0x28(%r15)
leaq 0x38(%r13), %rdi
movb $0x0, 0x38(%r15)
callq 0xf1bdd
movq (%r15), %r14
testq %r14, %r14
js 0xb9157
addq $0x18, %r13
leaq 0x10(%rsp), %rdx
movl $0x0, (%rdx)
movq %r13, %rsi
movq %r15, %r13
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
xorl %r15d, %r15d
movq %rsi, %rbp
xorl %ecx, %ecx
callq 0x1046f3
testl %eax, %eax
je 0xb913a
leaq 0x71d3b(%rip), %rbx     # 0x12ae0e
xorl %r15d, %r15d
movq 0x8(%rsp), %rax
cmpl $0x3, (%rax)
jl 0xb90f3
movl 0x10(%rsp), %edx
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0xe889f
movl 0x10(%rsp), %eax
cmpq %r15, %r14
je 0xb918f
cmpl $-0x1, %eax
je 0xb91af
movzbl %al, %esi
movq %r12, %rdi
callq 0xf0bd6
incq %r15
movl $0x0, 0x10(%rsp)
movq 0x10(%r13), %rax
movq 0x8(%rax), %rdi
movq %rbp, %rsi
leaq 0x10(%rsp), %rdx
xorl %ecx, %ecx
callq 0x1046f3
testl %eax, %eax
jne 0xb90d6
cmpq %r14, %r15
movq %r13, %r15
movq 0x8(%rsp), %rbx
je 0xb919c
cmpb $0x0, 0x30(%r15)
je 0xb91ca
leaq 0x59bbf(%rip), %rsi     # 0x112d14
jmp 0xb91d1
movq 0x8(%rsp), %rbx
movq %r12, %rdi
callq 0xf052b
movq 0x10(%r15), %rsi
testq %rsi, %rsi
je 0xb9175
movq %rbx, %rdi
callq 0x104dc7
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe8be2
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $-0x1, %eax
movq %r13, %r15
movq 0x8(%rsp), %rbx
je 0xb915c
leaq 0x7f12c(%rip), %rsi     # 0x1382cf
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8faa
jmp 0xb915c
leaq 0x7f163(%rip), %rsi     # 0x138319
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq %r13, %r15
jmp 0xb915c
leaq 0x7f133(%rip), %rsi     # 0x138304
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0xb915c