// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/src/../foreign/lzhuf.h
// Function: lzhuf_Decode_continue
static void lzhuf_Decode_continue(struct lzahuf_ctx *cctx, const u8 *buf, i64 buf_len, int flush)
{
	UI i, j, c;
	i64 bufpos = 0;
	char pos_descr[32];

	pos_descr[0] = '\0';
	if(cctx->dfctx->finished_flag) goto done;

	while(1) {
		if(cctx->errflag) goto done;
		if(lzah_have_enough_output(cctx)) {
			goto done;
		}

		// We're relying on the assumption that a compression instruction can
		// never be more than 57 bits in size.
		// The Huffman-encoded "character" maxes out, I think, at around 15 or
		// 16 bits -- this follows indirectly from MAX_FREQ, which reduces the
		// tree depth perdiodically.
		// For a "match" instruction, an 8-bit code is then read.
		// Then, some additional bits are read -- the most possible for the
		// supported formats is 8, for DMS-Deep.
		// So, about 16+8+8 = 32 bits should be sufficient.

		// Top off the bitbuf, if possible.
		while(bufpos<buf_len && cctx->bbll.nbits_in_bitbuf<=(64-8)) {
			de_bitbuf_lowlevel_add_byte(&cctx->bbll, buf[bufpos++]);
			cctx->total_nbytes_processed++;
		}

		if(!flush && cctx->bbll.nbits_in_bitbuf<=(64-8)) {
			// Wait for more data before trying to continue
			goto done;
		}

		if(cctx->c->debug_level>=4) {
			de_bitbuf_describe_curpos(&cctx->bbll,
				cctx->dfctx->input_file_offset+cctx->total_nbytes_processed,
				pos_descr, sizeof(pos_descr));
		}

		c = lzhuf_DecodeChar(cctx);
		if(cctx->errflag) goto done;

		if(c==256 && cctx->num_special_codes>=1) {
			if(cctx->c->debug_level>=4) {
				de_dbg(cctx->c, "special @%s =%u", pos_descr, c);
			}
			cctx->dfctx->finished_flag = 1;
			goto done;
		}
		if (c < 256) {
			if(cctx->c->debug_level>=4) {
				de_dbg(cctx->c, "lit @%s =%u", pos_descr, c);
			}
			de_lz77buffer_add_literal_byte(cctx->ringbuf, (u8)c);
		}
		else {
			// i is the distance back
			i = lzhuf_DecodePosition(cctx);
			if(cctx->errflag) goto done;

			// j is the match length
			j = c - cctx->match_length_bias;

			if(cctx->c->debug_level>=4) {
				de_dbg(cctx->c, "match @%s dist=%u len=%u", pos_descr, i+1, j);
			}

			de_lz77buffer_copy_from_hist(cctx->ringbuf,
				(UI)(cctx->ringbuf->curpos - (UI)i - 1), j);
		}
	}

done:
	if(!cctx->dfctx->finished_flag && !cctx->errflag) {
		if(bufpos<buf_len) {
			// It shouldn't be possible to get here. If we do, it means some input
			// bytes will be lost.
			de_dfilter_set_generic_error(cctx->dfctx->c, cctx->dres, cctx->modname);
			cctx->errflag = 1;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r15
movq %rdi, %rbx
movb $0x0, 0x80(%rsp)
movq 0x18(%rdi), %rax
cmpb $0x0, 0x20(%rax)
je 0xfa416
xorl %r14d, %r14d
jmp 0xfab4d
movl %ecx, %ebp
movq %rsi, %r12
leaq 0x70(%rbx), %r13
leaq 0xcd6(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0x80(%rbx), %rax
movq %rax, 0x20(%rsp)
xorl %r14d, %r14d
movq %rsi, 0x50(%rsp)
movq %r13, 0x48(%rsp)
movl %ecx, 0x2c(%rsp)
cmpl $0x0, 0x54(%rbx)
jne 0xfab4d
movq %rbx, %rdi
callq 0xfabbd
testl %eax, %eax
jne 0xfab4d
cmpq %r15, %r14
jge 0xfa483
cmpl $0x38, 0x74(%rbx)
ja 0xfa483
movzbl (%r12,%r14), %esi
incq %r14
movq %r13, %rdi
callq 0xe69c4
incq 0x58(%rbx)
jmp 0xfa462
testl %ebp, %ebp
jne 0xfa491
cmpl $0x39, 0x74(%rbx)
jb 0xfab4d
movq (%rbx), %rax
cmpl $0x4, (%rax)
jl 0xfa4b8
movq 0x18(%rbx), %rax
movq 0x58(%rbx), %rsi
addq 0x18(%rax), %rsi
movq %r13, %rdi
leaq 0x80(%rsp), %rdx
pushq $0x20
popq %rcx
callq 0xe6ad2
movl 0x40(%rbx), %eax
cmpq $0x276, %rax            # imm = 0x276
movq %r14, 0x8(%rsp)
ja 0xfa4d4
movq 0x18(%rsp), %r12
movzwl (%r12,%rax,2), %eax
jmp 0xfa4e2
movl $0x1, 0x54(%rbx)
xorl %eax, %eax
movq 0x18(%rsp), %r12
pushq $0x1
popq %r13
movzwl %ax, %r14d
movl 0x3c(%rbx), %eax
movl %r14d, %ebp
subl %eax, %ebp
jae 0xfa527
movq %rbx, %rdi
movl %r13d, %esi
callq 0xfabdf
cmpl $0x0, 0x54(%rbx)
jne 0xfab48
addl %r14d, %eax
cmpl $0x276, %eax            # imm = 0x276
ja 0xfa51c
movl %eax, %eax
movzwl (%r12,%rax,2), %eax
jmp 0xfa4e6
movl $0x1, 0x54(%rbx)
xorl %eax, %eax
jmp 0xfa4e6
movl 0x40(%rbx), %ecx
cmpq $0x278, %rcx            # imm = 0x278
movq %r15, 0x38(%rsp)
jae 0xfa602
movq 0x20(%rsp), %rdx
movzwl (%rdx,%rcx,2), %ecx
cmpw $0x8000, %cx            # imm = 0x8000
ja 0xfab3c
negw %cx
jno 0xfa609
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x18(%rsp), %r13
movq 0x20(%rsp), %r8
cmpq %rcx, %rax
je 0xfa820
cmpq $0x276, %rcx            # imm = 0x276
ja 0xfa581
movzwl (%r13,%rcx,2), %esi
jmp 0xfa58a
movl $0x1, 0x54(%rbx)
xorl %esi, %esi
cmpl %esi, %eax
ja 0xfa5fa
cmpq $0x277, %rcx            # imm = 0x277
ja 0xfa5a6
movzwl -0xc56(%r13,%rcx,2), %edi
incl %edi
shrl %edi
jmp 0xfa5af
movl $0x1, 0x54(%rbx)
xorl %edi, %edi
movl %edx, %esi
cmpl $0x277, %edx            # imm = 0x277
ja 0xfa5c0
movw %di, (%r8,%rsi,2)
jmp 0xfa5c7
movl $0x1, 0x54(%rbx)
cmpq $0x276, %rcx            # imm = 0x276
ja 0xfa5d8
movzwl (%r13,%rcx,2), %edi
jmp 0xfa5e1
movl $0x1, 0x54(%rbx)
xorl %edi, %edi
cmpl $0x276, %edx            # imm = 0x276
ja 0xfa5f1
movw %di, (%r13,%rsi,2)
jmp 0xfa5f8
movl $0x1, 0x54(%rbx)
incl %edx
incq %rcx
jmp 0xfa567
movl $0x1, 0x54(%rbx)
leal (%rax,%rbp), %ecx
cmpl $0x3b2, %ecx            # imm = 0x3B2
ja 0xfa620
movl %ecx, %ecx
movzwl 0x570(%rbx,%rcx,2), %edx
jmp 0xfa629
movl $0x1, 0x54(%rbx)
xorl %edx, %edx
xorl %ecx, %ecx
cmpl $0x3b4, %ecx            # imm = 0x3B4
je 0xfab3c
movzwl %dx, %esi
cmpw $0x278, %si             # imm = 0x278
jae 0xfa66e
movzwl %dx, %r8d
movq 0x20(%rsp), %r14
movzwl (%r14,%r8,2), %edi
incl %edi
movw %di, (%r14,%r8,2)
movl $0x278, %r8d            # imm = 0x278
cmpw $0x277, %dx             # imm = 0x277
je 0xfa679
leal 0x1(%rsi), %r8d
movzwl (%r14,%r8,2), %r9d
jmp 0xfa683
leal 0x1(%rsi), %r8d
xorl %edi, %edi
movq 0x20(%rsp), %r14
movl $0x1, 0x54(%rbx)
xorl %r9d, %r9d
movq 0x18(%rsp), %r11
cmpw %r9w, %di
jbe 0xfa7d5
decl %r8d
movl %r8d, %esi
leal 0x2(%rsi), %r8d
cmpl $0x277, %r8d            # imm = 0x277
ja 0xfa6af
movl %r8d, %r8d
movzwl (%r14,%r8,2), %r8d
jmp 0xfa6b9
movl $0x1, 0x54(%rbx)
xorl %r8d, %r8d
incl %esi
cmpw %r8w, %di
ja 0xfa698
movl %esi, %r8d
cmpl $0x277, %esi            # imm = 0x277
ja 0xfa6d3
movzwl (%r14,%r8,2), %r9d
jmp 0xfa6dd
movl $0x1, 0x54(%rbx)
xorl %r9d, %r9d
cmpw $0x277, %dx             # imm = 0x277
ja 0xfa6ef
movzwl %dx, %r10d
movw %r9w, (%r14,%r10,2)
jmp 0xfa6f6
movl $0x1, 0x54(%rbx)
cmpl $0x277, %esi            # imm = 0x277
ja 0xfa705
movw %di, (%r14,%r8,2)
jmp 0xfa70c
movl $0x1, 0x54(%rbx)
cmpw $0x277, %dx             # imm = 0x277
jae 0xfa72c
movzwl %dx, %edi
movzwl (%r11,%rdi,2), %edi
cmpl $0x3b2, %edi            # imm = 0x3B2
jbe 0xfa735
movl $0x1, 0x54(%rbx)
jmp 0xfa741
movl $0x1, 0x54(%rbx)
xorl %edi, %edi
movl %edi, %r9d
movw %si, 0x570(%rbx,%r9,2)
cmpl %edi, %eax
jbe 0xfa762
cmpl $0x3b1, %edi            # imm = 0x3B1
ja 0xfa75b
movl %edi, %r9d
movw %si, 0x572(%rbx,%r9,2)
jmp 0xfa762
movl $0x1, 0x54(%rbx)
cmpl $0x277, %esi            # imm = 0x277
jae 0xfa786
movzwl (%r11,%r8,2), %r9d
movw %di, (%r11,%r8,2)
cmpl $0x3b2, %r9d            # imm = 0x3B2
jbe 0xfa790
movl $0x1, 0x54(%rbx)
jmp 0xfa79b
movl $0x1, 0x54(%rbx)
xorl %r9d, %r9d
movl %r9d, %edi
movw %dx, 0x570(%rbx,%rdi,2)
cmpl %r9d, %eax
jbe 0xfa7bd
cmpl $0x3b1, %r9d            # imm = 0x3B1
ja 0xfa7b6
movl %r9d, %edi
movw %dx, 0x572(%rbx,%rdi,2)
jmp 0xfa7bd
movl $0x1, 0x54(%rbx)
cmpw $0x276, %dx             # imm = 0x276
ja 0xfa7ce
movzwl %dx, %edx
movw %r9w, (%r11,%rdx,2)
jmp 0xfa7d5
movl $0x1, 0x54(%rbx)
cmpl $0x3b2, %esi            # imm = 0x3B2
ja 0xfab3c
incl %ecx
movl %esi, %edx
movzwl 0x570(%rbx,%rdx,2), %edx
testw %dx, %dx
jne 0xfa62b
cmpl $0x0, 0x54(%rbx)
movq 0x38(%rsp), %r15
jne 0xfab48
cmpl $0x100, %ebp            # imm = 0x100
jne 0xfa9ca
cmpl $0x0, 0x44(%rbx)
je 0xfa9fe
jmp 0xfab8b
movl 0x38(%rbx), %edx
movl %edx, %ecx
notl %ecx
movl %ecx, 0x34(%rsp)
pushq $-0x2
popq %rcx
subl %edx, %ecx
movl %ecx, 0x30(%rsp)
leal -0x1(%rdx), %r15d
xorl %esi, %esi
movl %eax, %ecx
cmpq %rcx, %rdx
jae 0xfaabe
cmpq $0x278, %rsi            # imm = 0x278
jae 0xfa85b
movzwl (%r8,%rsi,2), %eax
movzwl 0x2(%r8,%rsi,2), %r13d
jmp 0xfa867
movl $0x1, 0x54(%rbx)
xorl %eax, %eax
xorl %r13d, %r13d
cmpq $0x277, %rdx            # imm = 0x277
ja 0xfa87a
addl %eax, %r13d
movw %r13w, (%r8,%rdx,2)
jmp 0xfa884
movl $0x1, 0x54(%rbx)
xorl %r13d, %r13d
xorl %r14d, %r14d
pushq $-0x2
popq %rax
leal (%r15,%r14), %ecx
cmpl $0x277, %ecx            # imm = 0x277
ja 0xfa89f
movl %ecx, %ecx
movzwl (%r8,%rcx,2), %ecx
jmp 0xfa8a8
movl $0x1, 0x54(%rbx)
xorl %ecx, %ecx
decl %r14d
addl $0x2, %eax
cmpw %cx, %r13w
jb 0xfa88a
movq %rsi, 0x58(%rsp)
cmpq $0x277, %rdx            # imm = 0x277
ja 0xfab3c
movl %r14d, %ecx
notl %ecx
cmpl $0x278, %ecx            # imm = 0x278
ja 0xfab3c
movq %rdx, 0x10(%rsp)
movl %r14d, %r12d
subl 0x34(%rsp), %r12d
movl %r14d, %edx
subl 0x30(%rsp), %edx
movq 0x20(%rsp), %rcx
movq %rdx, 0x78(%rsp)
leaq (%rcx,%rdx,2), %rdi
movl %r12d, %edx
movq %rdx, 0x68(%rsp)
leaq (%rcx,%rdx,2), %rsi
movl %eax, %edx
movq %rsi, 0x60(%rsp)
movq %rdx, 0x70(%rsp)
callq 0x18270
cmpl $0x277, %r12d           # imm = 0x277
ja 0xfa92a
movq 0x60(%rsp), %rax
movw %r13w, (%rax)
jmp 0xfa931
movl $0x1, 0x54(%rbx)
movq 0x10(%rsp), %rax
cmpq $0x276, %rax            # imm = 0x276
ja 0xfab3c
cmpl $0xfffffd87, %r14d      # imm = 0xFFFFFD87
je 0xfab3c
movq 0x18(%rsp), %r13
movq 0x78(%rsp), %rax
leaq (,%rax,2), %rdi
addq %r13, %rdi
movq 0x68(%rsp), %rax
leaq (,%rax,2), %r14
addq %r13, %r14
movq %r14, %rsi
movq 0x70(%rsp), %rdx
callq 0x18270
cmpl $0x276, %r12d           # imm = 0x276
ja 0xfa99a
movq 0x58(%rsp), %rsi
movw %si, (%r14)
movq 0x10(%rsp), %rdx
jmp 0xfa9ab
movl $0x1, 0x54(%rbx)
movq 0x10(%rsp), %rdx
movq 0x58(%rsp), %rsi
addq $0x2, %rsi
incq %rdx
movl 0x3c(%rbx), %eax
decl 0x34(%rsp)
decl 0x30(%rsp)
incl %r15d
movq 0x20(%rsp), %r8
jmp 0xfa83a
jae 0xfa9fe
movq (%rbx), %rdi
cmpl $0x4, (%rdi)
jl 0xfa9ec
leaq 0x443c5(%rip), %rsi     # 0x13eda0
leaq 0x80(%rsp), %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0xde896
movq 0x68(%rbx), %rdi
movzbl %bpl, %esi
callq 0xef336
jmp 0xfaaa6
movq %rbx, %rdi
pushq $0x8
popq %rsi
callq 0xfabdf
cmpl $0x0, 0x54(%rbx)
jne 0xfab48
movl %eax, %r12d
movl %eax, %edi
leaq 0x44(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0xf9ee0
movl 0x44(%rsp), %r14d
movl 0x48(%rbx), %eax
movl %eax, 0x10(%rsp)
movl 0x40(%rsp), %r13d
subl 0x4c(%rbx), %r13d
movq %rbx, %rdi
movl %r13d, %esi
callq 0xfabdf
cmpl $0x0, 0x54(%rbx)
jne 0xfab48
movl %r13d, %ecx
shll %cl, %r12d
orl %eax, %r12d
movl 0x10(%rsp), %ecx
shll %cl, %r14d
andl 0x50(%rbx), %r12d
orl %r14d, %r12d
movq (%rbx), %rdi
subl 0x34(%rbx), %ebp
cmpl $0x4, (%rdi)
jl 0xfaa91
leal 0x1(%r12), %ecx
leaq 0x4432d(%rip), %rsi     # 0x13edac
leaq 0x80(%rsp), %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0xde896
movq 0x68(%rbx), %rdi
notl %r12d
addl 0x10(%rdi), %r12d
movl %r12d, %esi
movl %ebp, %edx
callq 0xef363
movq 0x8(%rsp), %r14
movl 0x2c(%rsp), %ebp
movq 0x50(%rsp), %r12
movq 0x48(%rsp), %r13
jmp 0xfa448
xorl %edx, %edx
movq 0x38(%rsp), %r15
cmpq %rdx, %rcx
je 0xfab2f
cmpq $0x276, %rdx            # imm = 0x276
ja 0xfaaf6
movzwl (%r13,%rdx,2), %esi
cmpl %esi, %eax
jbe 0xfab12
cmpw $0x3b2, %si             # imm = 0x3B2
ja 0xfab23
movw %dx, 0x570(%rbx,%rsi,2)
cmpl $0x3b2, %esi            # imm = 0x3B2
jne 0xfab06
jmp 0xfab23
movl $0x1, 0x54(%rbx)
movw %dx, 0x570(%rbx)
xorl %esi, %esi
movl %esi, %esi
movw %dx, 0x572(%rbx,%rsi,2)
jmp 0xfab2a
cmpw $0x3b2, %si             # imm = 0x3B2
ja 0xfab23
movw %dx, 0x570(%rbx,%rsi,2)
jmp 0xfab2a
movl $0x1, 0x54(%rbx)
incq %rdx
jmp 0xfaac5
cmpl $0x0, 0x54(%rbx)
jne 0xfab48
movl %ecx, %eax
jmp 0xfa609
movl $0x1, 0x54(%rbx)
movq 0x38(%rsp), %r15
movq 0x8(%rsp), %r14
movq 0x18(%rbx), %rax
cmpb $0x0, 0x20(%rax)
jne 0xfab79
cmpq %r15, %r14
jge 0xfab79
cmpl $0x0, 0x54(%rbx)
jne 0xfab79
movq (%rax), %rdi
movq 0x8(%rbx), %rdx
movq 0x28(%rbx), %rsi
callq 0xee91c
movl $0x1, 0x54(%rbx)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rdi
cmpl $0x4, (%rdi)
movq 0x8(%rsp), %r14
jl 0xfabb3
leaq 0x441f1(%rip), %rsi     # 0x13ed90
leaq 0x80(%rsp), %rdx
movl $0x100, %ecx            # imm = 0x100
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rax
movb $0x1, 0x20(%rax)
jmp 0xfab4d