LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-fax.c
// Function: init_fax34_bitreader
static void init_fax34_bitreader(deark *c, struct fax_ctx *fc)
{
	de_zeromem(&fc->bitrd, sizeof(struct de_bitreader));
	fc->bitrd.f = fc->dcmpri->f;
	fc->bitrd.curpos = fc->dcmpri->pos;
	fc->bitrd.endpos = fc->dcmpri->pos + fc->dcmpri->len;
	fc->bitrd.bbll.is_lsb = fc->fax34params->is_lsb;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x19140
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
addq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movb 0x1c(%rax), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x68(%rax)
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-fax.c
// Function: fax34_full_sync
static int fax34_full_sync(deark *c, struct fax_ctx *fc, i64 max_bits_to_search)
{
	i64 nbits_searched = 0;
	UI zcount = 0;
	int retval = 0;

	while(1) {
		u64 n;

		if(nbits_searched >= max_bits_to_search) {
			goto done;
		}
		n = de_bitreader_getbits(&fc->bitrd, 1);
		if(fc->bitrd.eof_flag) goto done;
		nbits_searched++;

		if(n!=0) {
			zcount = 0;
			continue;
		}
		zcount++;
		if(zcount>=8) {
			break;
		}
	}

	retval = fax34_finish_sync(c, fc, max_bits_to_search-nbits_searched, NULL);

done:
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jl 0x17e6f6
jmp 0x17e763
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
movl $0x1, %esi
callq 0x16a390
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x60(%rax)
je 0x17e718
jmp 0x17e763
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x17e734
movl $0x0, -0x24(%rbp)
jmp 0x17e6ea
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
cmpl $0x8, -0x24(%rbp)
jb 0x17e745
jmp 0x17e747
jmp 0x17e6ea
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
subq -0x20(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x17ec20
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-fax.c
// Function: fax34_on_eol
static void fax34_on_eol(deark *c, struct fax_ctx *fc, int is_real)
{
	i64 i;

	de_dbg3(c, "%sEOL", is_real?"":"implicit ");

	if(fc->ypos >= fc->image_height) goto done;

	// [Pack curr_row into bits (tmp_row_packed)]
	de_zeromem(fc->tmp_row_packed, (size_t)fc->rowspan_final);
	for(i=0; i<fc->image_width; i++) {
		if(fc->curr_row[i]) {
			fc->tmp_row_packed[i/8] |= 1U<<(7-i%8);
		}
	}

	// [Write tmp_row_packed to fc->dcmpro]
	dbuf_write(fc->dcmpro->f, fc->tmp_row_packed, fc->rowspan_final);
	fc->nbytes_written += fc->rowspan_final;

	if(fc->is_2d) {
		de_memcpy(fc->prev_row, fc->curr_row, (size_t)fc->image_width);
	}

	// initialize curr_row
	de_zeromem(fc->curr_row, (size_t)fc->image_width);

	fc->ypos++;
done:
	fc->a0 = -1;
	fc->a0_color = 0;
	fc->pending_run_len = 0;
	fc->f2d_h_codes_remaining = 0;
	fc->have_read_tag_bit = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %ecx
leaq 0x58324(%rip), %rdx     # 0x1d6ab5
leaq 0x52438(%rip), %rax     # 0x1d0bd0
cmpl $0x0, %ecx
cmovneq %rax, %rdx
leaq 0x58309(%rip), %rsi     # 0x1d6aaf
movb $0x0, %al
callq 0x15b400
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jl 0x17e7c7
jmp 0x17e8fc
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rdx
xorl %esi, %esi
callq 0x19140
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jge 0x17e868
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movq -0x20(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x17e858
movq -0x20(%rbp), %rax
movl $0x8, %ecx
cqto
idivq %rcx
movl $0x7, %eax
subq %rdx, %rax
movl %eax, %ecx
movl $0x1, %esi
shll %cl, %esi
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl $0x8, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x28(%rbp), %rax
movzbl (%rax,%rcx), %edx
orl %esi, %edx
movb %dl, (%rax,%rcx)
jmp 0x17e85a
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x17e7ec
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rdx
callq 0x166170
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x40(%rax), %rcx
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x2a(%rax)
je 0x17e8cf
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdx
callq 0x191e0
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdx
xorl %esi, %esi
callq 0x19140
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0xa8(%rax)
movq -0x10(%rbp), %rax
movq $-0x1, 0xb0(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0xb8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x98(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0xa0(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0xb9(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-fax.c
// Function: find_b1
static void find_b1(struct fax_ctx *fc)
{
	i64 i;

	for(i=fc->a0+1; i<fc->image_width; i++) {
		if(i<0) continue;

		// first prev_row pixel to the right of a0, of opposite color to a0_color
		if(fc->prev_row[i]==fc->a0_color) continue;

		// Looking for a "changing element". I.e. if both it and the pixel to the left
		// exist, they must have different colors.
		if(i==0) {
			// Leftmost pixel is "changing" if it is black
			if(fc->prev_row[i]==0) continue;
		}
		else {
			if(fc->prev_row[i-1] == fc->prev_row[i]) continue;
		}

		fc->b1 = i;
		return;
	}
	fc->b1 = fc->image_width;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jge 0x17ea24
cmpq $0x0, -0x10(%rbp)
jge 0x17e989
jmp 0x17ea13
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movq -0x10(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x8(%rbp), %rcx
movzbl 0xb8(%rcx), %ecx
cmpl %ecx, %eax
jne 0x17e9ad
jmp 0x17ea13
cmpq $0x0, -0x10(%rbp)
jne 0x17e9d0
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movq -0x10(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x17e9ce
jmp 0x17ea13
jmp 0x17ea02
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movq -0x10(%rbp), %rcx
subq $0x1, %rcx
movzbl (%rax,%rcx), %eax
movq -0x8(%rbp), %rcx
movq 0x80(%rcx), %rcx
movq -0x10(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x17ea00
jmp 0x17ea13
jmp 0x17ea02
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xc0(%rax)
jmp 0x17ea37
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x17e96b
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xc0(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-fax.c
// Function: fax34_record_run
static void fax34_record_run(deark *c, struct fax_ctx *fc, i64 run_len,
	int respect_negative_a0)
{
	i64 i;
	u8 color = fc->a0_color;

	de_dbg3(c, "run c=%u len=%d", (UI)color, (int)run_len);

	if(fc->a0<0) {
		if(respect_negative_a0) {
			run_len += fc->a0;
		}
		fc->a0 = 0;
	}

	if(color==0) { // Pixels are initialized to 0, don't need to set them.
		fc->a0 += run_len;
	}
	else {
		for(i=0; (i<run_len) && (fc->a0 < fc->image_width); i++) {
			fc->curr_row[fc->a0++] = color;
		}
	}

	if(fc->a0 > fc->image_width) {
		fc->a0 = fc->image_width;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movb 0xb8(%rax), %al
movb %al, -0x29(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x29(%rbp), %edx
movq -0x18(%rbp), %rax
movl %eax, %ecx
leaq 0x58046(%rip), %rsi     # 0x1d6abf
movb $0x0, %al
callq 0x15b400
movq -0x10(%rbp), %rax
cmpq $0x0, 0xb0(%rax)
jge 0x17eab6
cmpl $0x0, -0x1c(%rbp)
je 0x17eaa7
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0xb0(%rax)
movzbl -0x29(%rbp), %eax
cmpl $0x0, %eax
jne 0x17ead7
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0xb0(%rax), %rcx
movq %rcx, 0xb0(%rax)
jmp 0x17eb47
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rcx
xorl %eax, %eax
cmpq -0x18(%rbp), %rcx
movb %al, -0x2a(%rbp)
jge 0x17eb07
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x30(%rcx), %rax
setl %al
movb %al, -0x2a(%rbp)
movb -0x2a(%rbp), %al
testb $0x1, %al
jne 0x17eb10
jmp 0x17eb45
movb -0x29(%rbp), %dl
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movq -0x10(%rbp), %rsi
movq 0xb0(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0xb0(%rsi)
movb %dl, (%rax,%rcx)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x17eadf
jmp 0x17eb47
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jle 0x17eb6f
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xb0(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-fax.c
// Function: find_b1_and_b2
static void find_b1_and_b2(struct fax_ctx *fc)
{
	i64 i;

	find_b1(fc);

	for(i=fc->b1+1; i<fc->image_width; i++) {
		// Looking for a "changing element", i.e. one having a different color from
		// the pixel to its left.
		if(fc->prev_row[i-1] == fc->prev_row[i]) continue;
		fc->b2 = i;
		return;
	}
	fc->b2 = fc->image_width;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x17e950
movq -0x8(%rbp), %rax
movq 0xc0(%rax), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jge 0x17ec05
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movq -0x10(%rbp), %rcx
subq $0x1, %rcx
movzbl (%rax,%rcx), %eax
movq -0x8(%rbp), %rcx
movq 0x80(%rcx), %rcx
movq -0x10(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x17ebe6
jmp 0x17ebf7
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xc8(%rax)
jmp 0x17ec18
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x17eba8
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xc8(%rax)
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-fax.c
// Function: fax34_finish_sync
static int fax34_finish_sync(deark *c, struct fax_ctx *fc, i64 max_bits_to_search,
	i64 *pnbits_read)
{
	i64 nbits_searched = 0;
	int retval = 0;

	while(1) {
		u64 n;

		if(nbits_searched >= max_bits_to_search) {
			goto done;
		}

		n = de_bitreader_getbits(&fc->bitrd, 1);
		if(fc->bitrd.eof_flag) goto done;
		nbits_searched++;
		if(n!=0) {
			retval = 1;
			goto done;
		}
	}
done:
	if(pnbits_read) *pnbits_read = nbits_searched;
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
jl 0x17ec53
jmp 0x17ec93
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
movl $0x1, %esi
callq 0x16a390
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x60(%rax)
je 0x17ec75
jmp 0x17ec93
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x17ec91
movl $0x1, -0x2c(%rbp)
jmp 0x17ec93
jmp 0x17ec47
cmpq $0x0, -0x20(%rbp)
je 0x17eca5
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl -0x2c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: fmtutil_decompress_lh5x
void fmtutil_decompress_lh5x(deark *c, struct de_dfilter_in_params *dcmpri,
	struct de_dfilter_out_params *dcmpro, struct de_dfilter_results *dres,
	struct de_lh5x_params *lzhp)
{
	struct lzh_ctx *cctx = NULL;

	cctx = de_malloc(c, sizeof(struct lzh_ctx));
	cctx->modname = "unlzh";
	cctx->c = c;
	cctx->dcmpri = dcmpri;
	cctx->dcmpro = dcmpro;
	cctx->dres = dres;

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

	decompress_lh5x_internal(cctx, lzhp);

	if(cctx->err_flag) {
		// A default error message
		de_dfilter_set_errorf(c, dres, cctx->modname, "LZH decoding error");
		goto done;
	}

	de_bitreader_skip_to_byte_boundary(&cctx->bitrd);
	cctx->dres->bytes_consumed = cctx->bitrd.curpos - cctx->dcmpri->pos;
	if(cctx->dres->bytes_consumed<0) {
		cctx->dres->bytes_consumed = 0;
	}
	cctx->dres->bytes_consumed_valid = 1;

done:
	destroy_lzh_ctx(cctx);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl $0xd0, %esi
callq 0x15b780
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
leaq 0x57ffb(%rip), %rcx     # 0x1d6cec
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x10(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x17ee00
movq -0x30(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x17ed92
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x2afb3(%rip), %rcx     # 0x1a9d3c
movb $0x0, %al
callq 0x177450
jmp 0x17edea
movq -0x30(%rbp), %rdi
addq $0x38, %rdi
callq 0x16a460
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
subq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0x0, 0x8(%rax)
jge 0x17edde
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq $0x0, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movb $0x1, 0x4(%rax)
movq -0x30(%rbp), %rdi
callq 0x17f000
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: destroy_lzh_ctx
static void destroy_lzh_ctx(struct lzh_ctx *cctx)
{
	deark *c;

	if(!cctx) return;
	c = cctx->c;
	lzh_destroy_trees(cctx);
	if(cctx->ringbuf && !cctx->ringbuf_owned_by_caller) {
		de_lz77buffer_destroy(c, cctx->ringbuf);
		cctx->ringbuf = NULL;
	}
	if(cctx->crco) de_crcobj_destroy(cctx->crco);
	de_free(c, cctx);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x17f015
jmp 0x17f086
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x181bd0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0x17f05b
movq -0x8(%rbp), %rax
cmpl $0x0, 0x78(%rax)
jne 0x17f05b
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rsi
callq 0x178950
movq -0x8(%rbp), %rax
movq $0x0, 0x70(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0xc0(%rax)
je 0x17f079
movq -0x8(%rbp), %rax
movq 0xc0(%rax), %rdi
callq 0x15f2e0
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x15b820
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: fmtutil_deflate_codectype1
void fmtutil_deflate_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 de_deflate_params *deflparams = (struct de_deflate_params*)codec_private_params;
	int must_use_miniz = 0;
	int must_use_native = 0;

	if(!deflparams) return;

	if(deflparams->ringbuf_to_use || (deflparams->flags & DE_DEFLATEFLAG_DEFLATE64)) {
		must_use_native = 1;
	}

	if(must_use_miniz && must_use_native) return;

	if(must_use_miniz) {
		fmtutil_deflate_codectype1_miniz(c, dcmpri, dcmpro, dres, codec_private_params);
		return;
	}
	if(must_use_native) {
		fmtutil_deflate_codectype1_native(c, dcmpri, dcmpro, dres, codec_private_params);
		return;
	}

	if(c->deflate_decoder_id==0) {
		const char *o;

		o = de_get_ext_option(c, "deflatecodec");
		if(o && !de_strcmp(o, "native")) {
			c->deflate_decoder_id = 2;
		}
		else {
			c->deflate_decoder_id = 1;
		}
	}

	if(c->deflate_decoder_id==2) {
		fmtutil_deflate_codectype1_native(c, dcmpri, dcmpro, dres, codec_private_params);
	}
	else {
		fmtutil_deflate_codectype1_miniz(c, dcmpri, dcmpro, dres, codec_private_params);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x17f10e
jmp 0x17f225
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x17f127
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x17f12e
movl $0x1, -0x38(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x17f13f
cmpl $0x0, -0x38(%rbp)
je 0x17f13f
jmp 0x17f225
cmpl $0x0, -0x34(%rbp)
je 0x17f163
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x198130
jmp 0x17f225
cmpl $0x0, -0x38(%rbp)
je 0x17f187
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x17f230
jmp 0x17f225
movq -0x8(%rbp), %rax
movzbl 0x128(%rax), %eax
cmpl $0x0, %eax
jne 0x17f1e1
movq -0x8(%rbp), %rdi
leaq 0x57b50(%rip), %rsi     # 0x1d6cf2
callq 0x15cb30
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x17f1d4
movq -0x40(%rbp), %rdi
leaq 0x57d45(%rip), %rsi     # 0x1d6f02
callq 0x191a0
cmpl $0x0, %eax
jne 0x17f1d4
movq -0x8(%rbp), %rax
movb $0x2, 0x128(%rax)
jmp 0x17f1df
movq -0x8(%rbp), %rax
movb $0x1, 0x128(%rax)
jmp 0x17f1e1
movq -0x8(%rbp), %rax
movzbl 0x128(%rax), %eax
cmpl $0x2, %eax
jne 0x17f20c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x17f230
jmp 0x17f225
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x198130
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: fmtutil_decompress_deflate
int fmtutil_decompress_deflate(dbuf *inf, i64 inputstart, i64 inputsize, dbuf *outf,
	i64 maxuncmprsize, i64 *bytes_consumed, unsigned int flags)
{
	deark *c = inf->c;
	struct de_dfilter_results dres;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_deflate_params deflparams;

	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	if(bytes_consumed) *bytes_consumed = 0;

	dcmpri.f = inf;
	dcmpri.pos = inputstart;
	dcmpri.len = inputsize;

	dcmpro.f = outf;
	if(flags & DE_DEFLATEFLAG_USEMAXUNCMPRSIZE) {
		dcmpro.len_known = 1;
		dcmpro.expected_len = maxuncmprsize;
		flags -= DE_DEFLATEFLAG_USEMAXUNCMPRSIZE;
	}

	de_zeromem(&deflparams, sizeof(struct de_deflate_params));
	deflparams.flags = flags;
	fmtutil_deflate_codectype1(c, &dcmpri, &dcmpro, &dres, (void*)&deflparams);

	if(bytes_consumed && dres.bytes_consumed_valid) {
		*bytes_consumed = dres.bytes_consumed;
	}

	if(dres.errcode != 0) {
		de_err(c, "%s", de_dfilter_get_errmsg(c, &dres));
		return 0;
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
leaq -0xa0(%rbp), %rcx
callq 0x1773f0
cmpq $0x0, -0x38(%rbp)
je 0x17f552
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xd8(%rbp)
movl 0x10(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x17f5a4
movb $0x1, -0xd0(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xc8(%rbp)
movl 0x10(%rbp), %eax
subl $0x2, %eax
movl %eax, 0x10(%rbp)
leaq -0xe8(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x19140
movl 0x10(%rbp), %eax
movl %eax, -0xe8(%rbp)
movq -0x40(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
leaq -0xa0(%rbp), %rcx
leaq -0xe8(%rbp), %r8
callq 0x17f0d0
cmpq $0x0, -0x38(%rbp)
je 0x17f606
movzbl -0x9c(%rbp), %eax
cmpl $0x0, %eax
je 0x17f606
movq -0x98(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
cmpl $0x0, -0xa0(%rbp)
je 0x17f64b
movq -0x40(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x40(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x177360
movq -0xf0(%rbp), %rdi
movq %rax, %rdx
leaq 0x214f4(%rip), %rsi     # 0x1a0b2f
movb $0x0, %al
callq 0x15bfb0
movl $0x0, -0x4(%rbp)
jmp 0x17f652
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xf0, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: fmtutil_dclimplode_codectype1
void fmtutil_dclimplode_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 lzh_ctx *cctx = NULL;

	cctx = de_malloc(c, sizeof(struct lzh_ctx));
	cctx->modname = "dclimplode";
	cctx->c = c;
	cctx->dcmpri = dcmpri;
	cctx->dcmpro = dcmpro;
	cctx->dres = dres;

	cctx->bitrd.bbll.is_lsb = 1;
	cctx->bitrd.f = dcmpri->f;
	cctx->bitrd.curpos = dcmpri->pos;
	cctx->bitrd.endpos = dcmpri->pos + dcmpri->len;

	dclimplode_internal(cctx);

	if(cctx->err_flag) {
		// A default error message
		de_dfilter_set_errorf(c, dres, cctx->modname, "Decoding error");
		goto done;
	}

	de_bitreader_skip_to_byte_boundary(&cctx->bitrd);
	cctx->dres->bytes_consumed = cctx->bitrd.curpos - cctx->dcmpri->pos;
	if(cctx->dres->bytes_consumed<0) {
		cctx->dres->bytes_consumed = 0;
	}
	cctx->dres->bytes_consumed_valid = 1;

done:
	destroy_lzh_ctx(cctx);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl $0xd0, %esi
callq 0x15b780
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
leaq 0x3027b(%rip), %rcx     # 0x1afd5c
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movb $0x1, 0x58(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x10(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x30(%rbp), %rdi
callq 0x17fbf0
movq -0x30(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x17fb86
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x57199(%rip), %rcx     # 0x1d6d16
movb $0x0, %al
callq 0x177450
jmp 0x17fbde
movq -0x30(%rbp), %rdi
addq $0x38, %rdi
callq 0x16a460
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
subq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0x0, 0x8(%rax)
jge 0x17fbd2
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq $0x0, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movb $0x1, 0x4(%rax)
movq -0x30(%rbp), %rdi
callq 0x17f000
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: lzh_lz77buf_writebytecb
static void lzh_lz77buf_writebytecb(struct de_lz77buffer *rb, u8 n)
{
	struct lzh_ctx *cctx = (struct lzh_ctx*)rb->userdata;

	if(lzh_have_enough_output(cctx)) {
		return;
	}
	dbuf_writebyte(cctx->dcmpro->f, n);
	if(cctx->crco) lzh_update_crc(cctx, n);
	cctx->nbytes_written++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x181570
cmpl $0x0, %eax
je 0x1801dd
jmp 0x18021c
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movzbl -0x9(%rbp), %esi
callq 0x168380
movq -0x18(%rbp), %rax
cmpq $0x0, 0xc0(%rax)
je 0x18020c
movq -0x18(%rbp), %rdi
movzbl -0x9(%rbp), %esi
callq 0x1839f0
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: distilled_make_offsets_tree
static void distilled_make_offsets_tree(deark *c, struct lzh_ctx *cctx)
{
	UI n;
	static const u8 distilled_offsetcodes[64] = {
		0x00,0x04,0x02,0x03,0x10,0x0c,0x0a,0x0e,0x11,0x0d,0x0b,0x0f,0x28,0x24,0x2c,0x2a,
		0x26,0x2e,0x29,0x25,0x2d,0x2b,0x27,0x2f,0x60,0x70,0x68,0x64,0x74,0x6c,0x62,0x72,
		0x6a,0x66,0x76,0x6e,0x61,0x71,0x69,0x65,0x75,0x6d,0x63,0x73,0x6b,0x67,0x77,0x6f,
		0xf0,0xf8,0xf4,0xfc,0xf2,0xfa,0xf6,0xfe,0xf1,0xf9,0xf5,0xfd,0xf3,0xfb,0xf7,0xff
	};
	char b2buf[72];

	cctx->offsets_tree.ht = fmtutil_huffman_create_decoder(c, 64, 64);
	de_dbg3(c, "[standard codebook for offsets]");
	de_dbg_indent(c, 1);
	for(n=0; n<64; n++) {
		UI nbits;
		u64 code;

		nbits = get_lzhuf_p_len(n);
		code = (u64)distilled_offsetcodes[n];

		if(c->debug_level>=3) {
			de_dbg3(c, "code: \"%s\" = %d",
				de_print_base2_fixed(b2buf, sizeof(b2buf), code, nbits), (int)n);
		}
		fmtutil_huffman_add_code(c, cctx->offsets_tree.ht->bk, code, nbits, (fmtutil_huffman_valtype)n);
	}
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl $0x40, %edx
movq %rdx, %rsi
callq 0x188560
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x8(%rbp), %rdi
leaq 0x56ea6(%rip), %rsi     # 0x1d7363
movb $0x0, %al
callq 0x15b400
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movl $0x0, -0x14(%rbp)
cmpl $0x40, -0x14(%rbp)
jae 0x180571
movl -0x14(%rbp), %edi
callq 0x183c30
movl %eax, -0x64(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x56ff6(%rip), %rax     # 0x1d74f0
movzbl (%rax,%rcx), %eax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x3, (%rax)
jl 0x180540
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x60(%rbp), %rdi
movq -0x70(%rbp), %rdx
movl -0x64(%rbp), %ecx
movl $0x48, %esi
callq 0x15cf60
movq -0x78(%rbp), %rdi
movq %rax, %rdx
movl -0x14(%rbp), %ecx
leaq 0x29adb(%rip), %rsi     # 0x1aa014
movb $0x0, %al
callq 0x15b400
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xa0(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x70(%rbp), %rdx
movl -0x64(%rbp), %ecx
movl -0x14(%rbp), %r8d
callq 0x187720
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1804d9
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: distilled_main
static void distilled_main(deark *c, struct lzh_ctx *cctx)
{
	int expecting_stop_code = 0;

	while(1) {
		UI code;

		if(cctx->bitrd.eof_flag) goto done;
		if(lzh_have_enough_output(cctx)) {
			// Try to make sure we read the STOP code, so we can report the
			// proper number of bytes consumed.
			if(expecting_stop_code) goto done;
			expecting_stop_code = 1;
		}

		code = read_next_code_using_tree(cctx, &cctx->literals_tree);

		if(code<256) { // literal
			de_lz77buffer_add_literal_byte(cctx->ringbuf, (u8)code);
		}
		else if(code==256) {
			goto done;
		}
		else { // match
			UI matchlen;
			UI matchdist;
			UI ocode1, ocode2;
			UI num_extra_bits;

			matchlen = code-254;
			ocode1 = read_next_code_using_tree(cctx, &cctx->offsets_tree);
			num_extra_bits = distilled_get_num_extra_bits(cctx);
			ocode2 = (UI)lzh_getbits(cctx, num_extra_bits);
			matchdist = (ocode1<<num_extra_bits)|ocode2;
			de_lz77buffer_copy_from_hist(cctx->ringbuf,
				(UI)(cctx->ringbuf->curpos-1-matchdist),  matchlen);
		}
	}

done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x50(%rax)
je 0x1805b6
jmp 0x180689
movq -0x10(%rbp), %rdi
callq 0x181570
cmpl $0x0, %eax
je 0x1805d6
cmpl $0x0, -0x14(%rbp)
je 0x1805cf
jmp 0x180689
movl $0x1, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x98, %rsi
callq 0x181ae0
movl %eax, -0x18(%rbp)
cmpl $0x100, -0x18(%rbp)     # imm = 0x100
jae 0x18060b
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdi
movl -0x18(%rbp), %eax
movzbl %al, %esi
callq 0x178880
jmp 0x180684
cmpl $0x100, -0x18(%rbp)     # imm = 0x100
jne 0x180616
jmp 0x180689
movl -0x18(%rbp), %eax
subl $0xfe, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0xa0, %rsi
callq 0x181ae0
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rdi
callq 0x183ca0
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x181a10
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %eax
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x28(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl 0x10(%rax), %esi
subl $0x1, %esi
subl -0x20(%rbp), %esi
movl -0x1c(%rbp), %edx
callq 0x1788e0
jmp 0x180684
jmp 0x1805a7
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: lzh_make_tree_from_bytearrays
static void lzh_make_tree_from_bytearrays(struct lzh_ctx *cctx,
	struct lzh_tree_wrapper *tree,
	const u8 *codes, const u8 *lengths, UI ncodes,
	const char *dbgtitle)
{
	deark *c = cctx->c;
	UI n;
	char b2buf[72];

	tree->ht = fmtutil_huffman_create_decoder(c, ncodes, ncodes);
	if(dbgtitle) {
		de_dbg3(c, "[%s]", dbgtitle);
	}
	de_dbg_indent(c, 1);
	for(n=0; n<ncodes; n++) {
		UI nbits;
		u64 code;

		nbits = (UI)lengths[n];
		code = (u64)codes[n];

		if(dbgtitle && c->debug_level>=3) {
			de_dbg3(c, "code: \"%s\" = %d",
				de_print_base2_fixed(b2buf, sizeof(b2buf), code, nbits), (int)n);
		}
		fmtutil_huffman_add_code(c, tree->ht->bk, code, nbits,
			(fmtutil_huffman_valtype)n);
	}
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
movl -0x24(%rbp), %eax
movl %eax, %edx
callq 0x188560
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x30(%rbp)
je 0x180968
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x3c647(%rip), %rsi     # 0x1bcfa8
movb $0x0, %al
callq 0x15b400
movq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jae 0x180a33
movq -0x20(%rbp), %rax
movl -0x3c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movl %eax, -0x94(%rbp)
movq -0x18(%rbp), %rax
movl -0x3c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x180a00
movq -0x38(%rbp), %rax
cmpl $0x3, (%rax)
jl 0x180a00
movq -0x38(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x90(%rbp), %rdi
movq -0xa0(%rbp), %rdx
movl -0x94(%rbp), %ecx
movl $0x48, %esi
callq 0x15cf60
movq -0xa8(%rbp), %rdi
movq %rax, %rdx
movl -0x3c(%rbp), %ecx
leaq 0x2961b(%rip), %rsi     # 0x1aa014
movb $0x0, %al
callq 0x15b400
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rsi
movq -0xa0(%rbp), %rdx
movl -0x94(%rbp), %ecx
movl -0x3c(%rbp), %r8d
callq 0x187720
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x18097d
movq -0x38(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0xb0, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: lzh_lz77buf_writebytecb_flagerrors
static void lzh_lz77buf_writebytecb_flagerrors(struct de_lz77buffer *rb, u8 n)
{
	struct lzh_ctx *cctx = (struct lzh_ctx*)rb->userdata;

	if(lzh_have_enough_output(cctx)) {
		cctx->err_flag = 1;
		return;
	}
	dbuf_writebyte(cctx->dcmpro->f, n);
	if(cctx->crco) lzh_update_crc(cctx, n);
	cctx->nbytes_written++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x181570
cmpl $0x0, %eax
je 0x180a88
movq -0x18(%rbp), %rax
movl $0x1, 0x30(%rax)
jmp 0x180ac7
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movzbl -0x9(%rbp), %esi
callq 0x168380
movq -0x18(%rbp), %rax
cmpq $0x0, 0xc0(%rax)
je 0x180ab7
movq -0x18(%rbp), %rdi
movzbl -0x9(%rbp), %esi
callq 0x1839f0
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: fmtutil_xpkMASH_codectype1
void fmtutil_xpkMASH_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 lzh_ctx *cctx = NULL;

	cctx = de_malloc(c, sizeof(struct lzh_ctx));
	cctx->modname = "mash";
	cctx->c = c;
	cctx->dcmpri = dcmpri;
	cctx->dcmpro = dcmpro;
	cctx->dres = dres;
	cctx->bitrd.bbll.is_lsb = 0;
	cctx->bitrd.f = dcmpri->f;
	cctx->bitrd.curpos = dcmpri->pos;
	cctx->bitrd.endpos = dcmpri->pos + dcmpri->len;

	cctx->ringbuf = de_lz77buffer_create(c, 32768);
	cctx->ringbuf->userdata = (void*)cctx;
	cctx->ringbuf->writebyte_cb = mash_lz77buf_writebytecb;

	mash_main(c, cctx);

	if(cctx->err_flag) {
		de_dfilter_set_generic_error(c, dres, cctx->modname);
	}
	destroy_lzh_ctx(cctx);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl $0xd0, %esi
callq 0x15b780
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
leaq 0x55ffc(%rip), %rcx     # 0x1d6d3d
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movb $0x0, 0x58(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x10(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rdi
movl $0x8000, %esi           # imm = 0x8000
callq 0x1785d0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x30(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x70(%rax), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movq 0x70(%rax), %rax
leaq 0x46(%rip), %rcx        # 0x180e30
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x180e90
movq -0x30(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x180e1a
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdx
callq 0x177560
movq -0x30(%rbp), %rdi
callq 0x17f000
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: mash_lz77buf_writebytecb
static void mash_lz77buf_writebytecb(struct de_lz77buffer *rb, u8 n)
{
	struct lzh_ctx *cctx = (struct lzh_ctx*)rb->userdata;

	if(lzh_have_enough_output(cctx)) {
		// This ought to be an error, but in practice there's often an extra
		// decompressed byte that we have to ignore.
		return;
	}
	dbuf_writebyte(cctx->dcmpro->f, n);
	cctx->nbytes_written++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x181570
cmpl $0x0, %eax
je 0x180e5d
jmp 0x180e81
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movzbl -0x9(%rbp), %esi
callq 0x168380
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: fmtutil_ic1_codectype1
void fmtutil_ic1_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 lzh_ctx *cctx = NULL;

	cctx = de_malloc(c, sizeof(struct lzh_ctx));
	cctx->modname = "instacomp1";
	cctx->c = c;
	cctx->dcmpri = dcmpri;
	cctx->dcmpro = dcmpro;
	cctx->dres = dres;

	cctx->bitrd.bbll.is_lsb = 0;
	cctx->bitrd.f = dcmpri->f;
	cctx->bitrd.curpos = dcmpri->pos;
	cctx->bitrd.endpos = dcmpri->pos + dcmpri->len;

	ic1_internal(cctx);

	if(cctx->err_flag) {
		// A default error message
		de_dfilter_set_errorf(c, dres, cctx->modname, "Decoding error");
		goto done;
	}

	de_bitreader_skip_to_byte_boundary(&cctx->bitrd);
	cctx->dres->bytes_consumed = cctx->bitrd.curpos - cctx->dcmpri->pos;
	if(cctx->dres->bytes_consumed<0) {
		cctx->dres->bytes_consumed = 0;
	}
	cctx->dres->bytes_consumed_valid = 1;

done:
	destroy_lzh_ctx(cctx);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl $0xd0, %esi
callq 0x15b780
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
leaq 0x55bb1(%rip), %rcx     # 0x1d6d42
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movb $0x0, 0x58(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x10(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x30(%rbp), %rdi
callq 0x1812a0
movq -0x30(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x181236
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x55ae9(%rip), %rcx     # 0x1d6d16
movb $0x0, %al
callq 0x177450
jmp 0x18128e
movq -0x30(%rbp), %rdi
addq $0x38, %rdi
callq 0x16a460
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
subq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0x0, 0x8(%rax)
jge 0x181282
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq $0x0, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movb $0x1, 0x4(%rax)
movq -0x30(%rbp), %rdi
callq 0x17f000
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: lh5x_do_read_trees
static int lh5x_do_read_trees(struct lzh_ctx *cctx)
{
	int retval = 0;

	lzh_destroy_trees(cctx);
	if(!lh5x_read_codelengths_tree(cctx, &cctx->meta_tree, "code-lengths")) goto done;
	if(!lh5x_read_literals_tree(cctx, &cctx->literals_tree, "codes")) goto done;
	if(!lh5x_read_offsets_tree(cctx, &cctx->offsets_tree, "offsets")) goto done;
	retval = 1;
done:
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rdi
callq 0x181bd0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x90, %rsi
leaq 0x553f5(%rip), %rdx     # 0x1d6e67
callq 0x181cc0
cmpl $0x0, %eax
jne 0x181a7e
jmp 0x181ac9
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x98, %rsi
leaq 0x3785a(%rip), %rdx     # 0x1b92ee
callq 0x181ee0
cmpl $0x0, %eax
jne 0x181aa0
jmp 0x181ac9
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0xa0, %rsi
leaq 0x32c7b(%rip), %rdx     # 0x1b4731
callq 0x182140
cmpl $0x0, %eax
jne 0x181ac2
jmp 0x181ac9
movl $0x1, -0xc(%rbp)
movl -0xc(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: read_next_code_using_tree
static UI read_next_code_using_tree(struct lzh_ctx *cctx, struct lzh_tree_wrapper *tree)
{
	fmtutil_huffman_valtype val = 0;
	UI bitcount = 0;
	int ret;

	if(!tree->ht) {
		return 0;
	}

	ret = fmtutil_huffman_read_next_value(tree->ht->bk, &cctx->bitrd, &val, &bitcount);
	if(cctx->bitrd.eof_flag) {
		de_dfilter_set_errorf(cctx->c, cctx->dres, cctx->modname,
			"Unexpected end of compressed data");
		lzh_set_err_flag(cctx);
		val = 0;
		goto done;
	}
	else if(!ret) {
		de_dfilter_set_errorf(cctx->c, cctx->dres, cctx->modname,
			"Huffman decoding error");
		lzh_set_err_flag(cctx);
		val = 0;
		goto done;
	}

done:
	return (UI)val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x181b14
movl $0x0, -0x4(%rbp)
jmp 0x181bbf
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0x38, %rsi
leaq -0x1c(%rbp), %rdx
leaq -0x20(%rbp), %rcx
callq 0x187bc0
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x50(%rax)
je 0x181b78
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x2828b(%rip), %rcx     # 0x1a9dea
movb $0x0, %al
callq 0x177450
movq -0x10(%rbp), %rdi
callq 0x1823c0
movl $0x0, -0x1c(%rbp)
jmp 0x181bb9
cmpl $0x0, -0x24(%rbp)
jne 0x181bb5
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x28270(%rip), %rcx     # 0x1a9e0c
movb $0x0, %al
callq 0x177450
movq -0x10(%rbp), %rdi
callq 0x1823c0
movl $0x0, -0x1c(%rbp)
jmp 0x181bb9
jmp 0x181bb7
jmp 0x181bb9
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: lzh_destroy_trees
static void lzh_destroy_trees(struct lzh_ctx *cctx)
{
	if(cctx->meta_tree.ht) {
		fmtutil_huffman_destroy_decoder(cctx->c, cctx->meta_tree.ht);
		cctx->meta_tree.ht = NULL;
	}
	if(cctx->literals_tree.ht) {
		fmtutil_huffman_destroy_decoder(cctx->c, cctx->literals_tree.ht);
		cctx->literals_tree.ht = NULL;
	}
	if(cctx->offsets_tree.ht) {
		fmtutil_huffman_destroy_decoder(cctx->c, cctx->offsets_tree.ht);
		cctx->offsets_tree.ht = NULL;
	}
	if(cctx->matchlengths_tree.ht) {
		fmtutil_huffman_destroy_decoder(cctx->c, cctx->matchlengths_tree.ht);
		cctx->matchlengths_tree.ht = NULL;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x90(%rax)
je 0x181c10
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rsi
callq 0x1886d0
movq -0x8(%rbp), %rax
movq $0x0, 0x90(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x98(%rax)
je 0x181c44
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x98(%rax), %rsi
callq 0x1886d0
movq -0x8(%rbp), %rax
movq $0x0, 0x98(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
je 0x181c78
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rsi
callq 0x1886d0
movq -0x8(%rbp), %rax
movq $0x0, 0xa0(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
je 0x181cac
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rsi
callq 0x1886d0
movq -0x8(%rbp), %rax
movq $0x0, 0xa8(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: lh5x_read_a_code_length
static UI lh5x_read_a_code_length(struct lzh_ctx *cctx)
{
	UI n;

	n = (UI)lzh_getbits(cctx, 3);
	if(n==7) {
		while(1) {
			UI b;

			b = (UI)lzh_getbits(cctx, 1);
			if(cctx->bitrd.eof_flag) break;
			if(b==0) break;
			n++;
			// TODO: What is the length limit?
			if(n>FMTUTIL_HUFFMAN_MAX_CODE_LENGTH) {
				lzh_set_err_flag(cctx);
				return FMTUTIL_HUFFMAN_MAX_CODE_LENGTH;
			}
		}
	}
	return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x181a10
movl %eax, -0x14(%rbp)
cmpl $0x7, -0x14(%rbp)
jne 0x1823af
jmp 0x182365
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x181a10
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x50(%rax)
je 0x182382
jmp 0x1823ad
cmpl $0x0, -0x18(%rbp)
jne 0x18238a
jmp 0x1823ad
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x30, -0x14(%rbp)
jbe 0x1823ab
movq -0x10(%rbp), %rdi
callq 0x1823c0
movl $0x30, -0x4(%rbp)
jmp 0x1823b5
jmp 0x182365
jmp 0x1823af
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-lzh.c
// Function: lh5x_read_a_skip_length
static UI lh5x_read_a_skip_length(struct lzh_ctx *cctx, UI rcode)
{
	if(rcode==0) {
		return 0;
	}
	else if(rcode==1) {
		return 2 + (UI)lzh_getbits(cctx, 4);
	}
	return 19 + (UI)lzh_getbits(cctx, 9);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x1823fe
movl $0x0, -0x4(%rbp)
jmp 0x182430
cmpl $0x1, -0x14(%rbp)
jne 0x18241a
movq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0x181a10
addl $0x2, %eax
movl %eax, -0x4(%rbp)
jmp 0x182430
jmp 0x18241c
movq -0x10(%rbp), %rdi
movl $0x9, %esi
callq 0x181a10
addl $0x13, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)