// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/src/fmtutil-cmpr.c
// Function: fmtutil_huff_squeeze_codectype1
void fmtutil_huff_squeeze_codectype1(deark *c, struct de_dfilter_in_params *dcmpri,
	struct de_dfilter_out_params *dcmpro, struct de_dfilter_results *dres,
	void *codec_private_params)
{
	struct squeeze_ctx *sqctx = NULL;
	int ok = 0;

	sqctx = de_malloc(c, sizeof(struct squeeze_ctx));
	sqctx->c = c;
	sqctx->modname = "unsqueeze";
	sqctx->dcmpri = dcmpri;
	sqctx->dcmpro = dcmpro;
	sqctx->dres = dres;

	sqctx->bitrd.f = dcmpri->f;
	sqctx->bitrd.curpos = dcmpri->pos;
	sqctx->bitrd.endpos = dcmpri->pos + dcmpri->len;

	sqctx->ht = fmtutil_huffman_create_decoder(c, 257, 257);

	if(!squeeze_read_nodetable(c, sqctx)) goto done;
	if(!squeeze_read_codes(c, sqctx)) goto done;

	dres->bytes_consumed = sqctx->bitrd.curpos - dcmpri->pos;
	if(dres->bytes_consumed > dcmpri->len) {
		dres->bytes_consumed = dcmpri->len;
	}
	dres->bytes_consumed_valid = 1;
	ok = 1;

done:
	if(!ok || dres->errcode) {
		de_dfilter_set_errorf(c, dres, sqctx->modname, "Squeeze decompression failed");
	}

	if(sqctx) {
		fmtutil_huffman_destroy_decoder(c, sqctx->ht);
		de_free(c, sqctx);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movq %rdx, %r15
movq %rsi, %rbp
movq %rdi, %rbx
movl $0x670, %esi            # imm = 0x670
callq 0xdecaf
movq %rax, %r14
movq %rbx, (%rax)
leaq 0x4df57(%rip), %rax     # 0x13d67f
movq %rax, 0x20(%r14)
movq %rbp, 0x8(%r14)
movq %r15, 0x10(%r14)
movq %r12, 0x18(%r14)
movq (%rbp), %rax
movq %rax, 0x40(%r14)
movq 0x8(%rbp), %rax
movq %rax, 0x48(%r14)
addq 0x10(%rbp), %rax
movq %rax, 0x50(%r14)
movl $0x101, %esi            # imm = 0x101
movl $0x101, %edx            # imm = 0x101
movq %rbx, %rdi
callq 0xf8601
movq %rax, 0x38(%r14)
movq 0x48(%r14), %rax
addq $0x2, %rax
cmpq 0x50(%r14), %rax
jg 0xef98d
leaq 0x48(%r14), %r13
movq 0x8(%r14), %rax
movq (%rax), %rdi
movq %r13, %rsi
callq 0xe3fc4
movq %rax, 0x30(%r14)
leaq 0x4e057(%rip), %rsi     # 0x13d7ed
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
cmpq $0x101, 0x30(%r14)      # imm = 0x101
jl 0xef7c7
movq 0x18(%r14), %rsi
movq 0x20(%r14), %rdx
leaq 0x4e041(%rip), %rcx     # 0x13d7fc
xorl %eax, %eax
callq 0xee823
jmp 0xef98d
movq %rbp, 0x10(%rsp)
movq %r12, 0x18(%rsp)
leaq 0x40(%r14), %rax
movq %rax, 0x20(%rsp)
movq 0x48(%r14), %rdx
leaq 0x21b82(%rip), %rsi     # 0x111367
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde9f1
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
leaq 0x72(%r14), %r12
leaq 0x4e00a(%rip), %rbp     # 0x13d80f
xorl %r15d, %r15d
cmpq 0x30(%r14), %r15
jge 0xef85e
movq 0x8(%r14), %rax
movq (%rax), %rdi
movq %r13, %rsi
callq 0xe4038
movw %ax, (%r12)
movq 0x8(%r14), %rax
movq (%rax), %rdi
movq %r13, %rsi
callq 0xe4038
movw %ax, 0x2(%r12)
cmpl $0x2, (%rbx)
jl 0xef855
movswl (%r12), %ecx
movswl %ax, %r8d
movq %rbx, %rdi
movq %rbp, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0xde9f1
incq %r15
addq $0x6, %r12
jmp 0xef808
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x48(%r14), %rax
cmpq 0x50(%r14), %rax
movq 0x18(%rsp), %r12
movq 0x10(%rsp), %rbp
jg 0xef98d
leaq 0x4de1e(%rip), %rsi     # 0x13d6a6
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdea83
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf065f
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
cmpl $0x4, (%rbx)
jl 0xef8c7
movq 0x38(%r14), %rsi
movq %rbx, %rdi
callq 0xf811c
movq 0x48(%r14), %rdx
leaq 0x4df52(%rip), %rsi     # 0x13d824
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq %r14, %rdi
addq $0x60, %rdi
movb $0x1, 0x60(%r14)
callq 0xe6a40
movq 0x38(%r14), %rax
movq 0x8(%rax), %rdi
callq 0xf7e40
testl %eax, %eax
je 0xef968
leaq 0xc(%rsp), %r15
andl $0x0, 0xc(%rsp)
movq 0x38(%r14), %rax
movq 0x8(%rax), %rdi
movq 0x20(%rsp), %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0xf8071
testl %eax, %eax
je 0xef961
movl 0xc(%rsp), %eax
cmpl $0x101, %eax            # imm = 0x101
jae 0xef961
cmpl $0xff, %eax
ja 0xef968
movq 0x10(%r14), %rcx
movq (%rcx), %rdi
movzbl %al, %esi
callq 0xe5bc5
movq 0x10(%r14), %rax
movq 0x28(%r14), %rcx
incq %rcx
movq %rcx, 0x28(%r14)
cmpb $0x0, 0x8(%rax)
je 0xef903
cmpq 0x10(%rax), %rcx
jl 0xef903
jmp 0xef968
cmpb $0x0, 0x58(%r14)
je 0xef9c8
movq (%r13), %rax
subq 0x8(%rbp), %rax
movq 0x10(%rbp), %rcx
cmpq %rcx, %rax
cmovgeq %rcx, %rax
movq %rax, 0x8(%r12)
movb $0x1, 0x4(%r12)
cmpl $0x0, (%r12)
je 0xef9a2
movq 0x20(%r14), %rdx
leaq 0x4dcf1(%rip), %rcx     # 0x13d689
movq %r12, %rsi
xorl %eax, %eax
callq 0xee823
movq 0x38(%r14), %rsi
movq %rbx, %rdi
callq 0xf86b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0xded32
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%r14), %rsi
movq 0x20(%r14), %rdx
leaq 0x3b62d(%rip), %rcx     # 0x12b004
jmp 0xef7bb