// File: /workspace/github_c_makefile_star2_O3/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 $0x18, %rsp
movq %rcx, %r12
movq %rdx, %r15
movq %rsi, %rbp
movq %rdi, %rbx
movl $0x670, %esi            # imm = 0x670
callq 0xe8b2b
movq %rax, %r13
movq %rax, %r14
movq %rbx, (%rax)
leaq 0x4f807(%rip), %rax     # 0x14ab4f
movq %rax, 0x20(%r13)
movq %rbp, 0x8(%r13)
movq %r15, 0x10(%r13)
movq %r12, 0x18(%r13)
movq (%rbp), %rax
movq %rax, 0x40(%r13)
movq 0x8(%rbp), %rax
movq %rax, 0x48(%r13)
movq %rbp, 0x10(%rsp)
addq 0x10(%rbp), %rax
movq %rax, 0x50(%r13)
movl $0x101, %esi            # imm = 0x101
movl $0x101, %edx            # imm = 0x101
movq %rbx, %rdi
callq 0x104d0e
movq %rax, 0x38(%r13)
movq 0x48(%r13), %rax
addq $0x2, %rax
cmpq 0x50(%r13), %rax
jg 0xfb582
leaq 0x48(%r13), %rbp
movq 0x8(%r14), %rax
movq (%rax), %rdi
movq %rbp, %rsi
callq 0xeebeb
movq %rax, 0x30(%r14)
leaq 0x4f902(%rip), %rsi     # 0x14acbd
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
cmpq $0x101, 0x30(%r14)      # imm = 0x101
jl 0xfb3ec
movq 0x18(%r14), %rsi
movq 0x20(%r14), %rdx
leaq 0x4f8ec(%rip), %rcx     # 0x14accc
xorl %eax, %eax
callq 0xfa21a
jmp 0xfb582
movq %r12, 0x8(%rsp)
movq 0x48(%r14), %rdx
leaq 0x2303f(%rip), %rsi     # 0x11e43b
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe87e4
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
cmpq $0x0, 0x30(%r14)
jle 0xfb476
leaq 0x72(%r13), %r15
xorl %r12d, %r12d
movq 0x8(%r14), %rax
movq (%rax), %rdi
movq %rbp, %rsi
callq 0xeecce
movw %ax, (%r15)
movq 0x8(%r14), %rax
movq (%rax), %rdi
movq %rbp, %rsi
callq 0xeecce
movw %ax, 0x2(%r15)
cmpl $0x2, (%rbx)
jl 0xfb469
movswl (%r15), %ecx
movswl %ax, %r8d
movq %rbx, %rdi
leaq 0x4f880(%rip), %rsi     # 0x14acdf
movl %r12d, %edx
xorl %eax, %eax
callq 0xe87e4
incq %r12
addq $0x6, %r15
cmpq 0x30(%r14), %r12
jl 0xfb421
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x48(%r14), %rax
cmpq 0x50(%r14), %rax
movq 0x8(%rsp), %r12
jg 0xfb582
leaq 0x4f6d9(%rip), %rsi     # 0x14ab76
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe889f
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xfc322
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpl $0x4, (%rbx)
jl 0xfb4e0
movq 0x38(%r14), %rsi
movq %rbx, %rdi
callq 0x1047f5
movq 0x48(%r14), %rdx
leaq 0x4f809(%rip), %rsi     # 0x14acf4
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
leaq 0x60(%r13), %rdi
movb $0x1, 0x60(%r14)
callq 0xf1bdd
movq 0x38(%r14), %rax
movq 0x8(%rax), %rdi
callq 0x1044a8
testl %eax, %eax
je 0xfb558
addq $0x40, %r13
leaq 0x4(%rsp), %r15
movl $0x0, (%r15)
movq 0x38(%r14), %rax
movq 0x8(%rax), %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x1046f3
testl %eax, %eax
sete %cl
movl (%r15), %eax
cmpl $0x101, %eax            # imm = 0x101
setae %dl
orb %cl, %dl
je 0xfb5bd
cmpb $0x0, 0x58(%r14)
je 0xfb62c
movq (%rbp), %rax
movq 0x10(%rsp), %rcx
subq 0x8(%rcx), %rax
movq 0x10(%rcx), %rcx
cmpq %rcx, %rax
cmovgeq %rcx, %rax
movq %rax, 0x8(%r12)
movb $0x1, 0x4(%r12)
cmpl $0x0, (%r12)
je 0xfb597
movq 0x20(%r14), %rdx
leaq 0x4f5cc(%rip), %rcx     # 0x14ab59
movq %r12, %rsi
xorl %eax, %eax
callq 0xfa21a
movq 0x38(%r14), %rsi
movq %rbx, %rdi
callq 0x104dc7
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4(%rsp), %r15
cmpl $0xff, %eax
ja 0xfb558
movq 0x10(%r14), %rcx
movq (%rcx), %rdi
movzbl %al, %esi
callq 0xf0bd6
movq 0x10(%r14), %rax
movq 0x28(%r14), %rcx
incq %rcx
movq %rcx, 0x28(%r14)
cmpb $0x0, 0x8(%rax)
je 0xfb5f7
cmpq 0x10(%rax), %rcx
jge 0xfb558
movl $0x0, 0x4(%rsp)
movq 0x38(%r14), %rax
movq 0x8(%rax), %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x1046f3
testl %eax, %eax
je 0xfb54d
movl 0x4(%rsp), %eax
cmpl $0x100, %eax            # imm = 0x100
jbe 0xfb5c2
jmp 0xfb54d
movq 0x18(%r14), %rsi
movq 0x20(%r14), %rdx
leaq 0x3ccc9(%rip), %rcx     # 0x138304
jmp 0xfb3e0