// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbp
movl $0xd0, %esi
callq 0xdecaf
movq %rax, %r13
movq %rax, %rbx
leaq 0x227ad(%rip), %rax     # 0x117288
movq %rax, 0x20(%r13)
movq %rbp, (%r13)
movq %r15, 0x8(%r13)
movq %r14, 0x10(%r13)
movq %r12, 0x8(%rsp)
movq %r12, 0x18(%r13)
leaq 0x38(%r13), %r12
movb $0x1, 0x58(%r13)
movq (%r15), %rax
movq %rax, 0x38(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x40(%r13)
movq 0x10(%r15), %rcx
movq %rbp, %r15
addq %rcx, %rax
movq %rax, 0x48(%r13)
testq %rcx, %rcx
je 0xf4b92
pushq $0x8
popq %rsi
movq %r12, %rdi
callq 0xe6a4a
cmpb $0x1, %al
je 0xf4b3e
movzbl %al, %eax
testl %eax, %eax
jne 0xf4b8b
movzbl 0xb1(%rbx), %edx
jmp 0xf4b48
movb $0x1, 0xb1(%rbx)
pushq $0x1
popq %rdx
leaq 0x49851(%rip), %rsi     # 0x13e3a0
movq %r15, %rdi
xorl %eax, %eax
callq 0xde9f1
pushq $0x8
popq %rsi
movq %r12, %rdi
callq 0xe6a4a
movl %eax, 0xb8(%rbx)
leaq 0x49845(%rip), %rsi     # 0x13e3b6
movq %r15, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde9f1
movl 0xb8(%rbx), %eax
addl $-0x7, %eax
cmpl $-0x4, %eax
ja 0xf4bf3
movl $0x1, 0x30(%rbx)
cmpl $0x0, 0x30(%rbx)
je 0xf4bb4
movq 0x20(%rbx), %rdx
leaq 0x49287(%rip), %rcx     # 0x13de2a
movq %r15, %rdi
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0xee823
jmp 0xf4bdd
movq %r12, %rdi
callq 0xe6abe
movq 0x40(%rbx), %rax
movq 0x8(%rbx), %rcx
movq 0x18(%rbx), %rdx
subq 0x8(%rcx), %rax
xorl %ecx, %ecx
testq %rax, %rax
cmovgq %rax, %rcx
movq %rcx, 0x8(%rdx)
movb $0x1, 0x4(%rdx)
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf3885
cmpb $0x0, 0xb1(%rbx)
je 0xf4c17
leaq 0x98(%r13), %rsi
leaq 0x49936(%rip), %rcx     # 0x13e540
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
callq 0xf613f
leaq 0xa8(%r13), %rsi
leaq 0x4999b(%rip), %rcx     # 0x13e5c0
pushq $0x10
popq %rdx
movq %r15, %rdi
movq %rsi, 0x20(%rsp)
callq 0xf613f
leaq 0xa0(%r13), %rsi
leaq 0x4998d(%rip), %rcx     # 0x13e5d0
pushq $0x40
popq %rdx
movq %r15, %rdi
movq %rsi, 0x10(%rsp)
callq 0xf613f
movq (%rbx), %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0xef27c
movq %rax, 0x70(%rbx)
movq %rbx, (%rax)
leaq 0x9c5(%rip), %rcx       # 0xf5633
movq %rcx, 0x8(%rax)
addq $0x98, %r13
movq %r13, 0x18(%rsp)
cmpb $0x0, 0x50(%rbx)
movl 0x30(%rbx), %eax
jne 0xf4dd3
testl %eax, %eax
jne 0xf4b92
movq %r12, %rdi
pushq $0x1
popq %rsi
callq 0xe6a4a
testl %eax, %eax
je 0xf4cd4
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0xf5df8
cmpl $0xf, %eax
ja 0xf4b92
movl %eax, %r14d
pushq $0x3
popq %rbp
testl %eax, %eax
je 0xf4d5b
cmpl $0x1, %r14d
jne 0xf4ce8
pushq $0x2
popq %rbp
jmp 0xf4d5b
cmpq $0x0, (%r13)
je 0xf4cf7
movq %rbx, %rdi
movq %r13, %rsi
callq 0xf5df8
jmp 0xf4d02
cmpl $0x7, %r14d
ja 0xf4d30
addl $0x2, %r14d
movl %r14d, %ebp
jmp 0xf4d5b
movq %r12, %rdi
pushq $0x8
popq %rsi
callq 0xe6a4a
movq (%rbx), %rcx
cmpl $0x4, (%rcx)
movzbl %al, %ebp
jl 0xf4d20
movq %r15, %rdi
leaq 0x48915(%rip), %rsi     # 0x13d62c
movl %ebp, %edx
xorl %eax, %eax
callq 0xde896
movq 0x70(%rbx), %rdi
movl %ebp, %esi
callq 0xef336
jmp 0xf4c7e
addl $-0x7, %r14d
movq %r12, %rdi
movl %r14d, %esi
callq 0xe6a4a
pushq $0x1
popq %rcx
movl %ecx, %edx
movl %r14d, %ecx
shll %cl, %edx
leal (%rdx,%rax), %ebp
addl $0x8, %ebp
cmpl $0x207, %ebp            # imm = 0x207
je 0xf4b92
movq %r15, %r13
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0xf5df8
movl %eax, %r14d
pushq $0x2
popq %r15
cmpl $0x2, %ebp
je 0xf4d7e
movl 0xb8(%rbx), %r15d
movq %r12, %rdi
movl %r15d, %esi
callq 0xe6a4a
movl %r15d, %ecx
shll %cl, %r14d
addl %eax, %r14d
movq (%rbx), %rax
cmpl $0x4, (%rax)
movq %r13, %r15
jl 0xf4db4
leal 0x1(%r14), %edx
movq %r15, %rdi
leaq 0x49729(%rip), %rsi     # 0x13e4d4
movl %ebp, %ecx
xorl %eax, %eax
callq 0xde896
movq 0x70(%rbx), %rdi
notl %r14d
addl 0x10(%rdi), %r14d
movl %r14d, %esi
movl %ebp, %edx
callq 0xef363
movq 0x18(%rsp), %r13
jmp 0xf4c7e
testl %eax, %eax
jne 0xf4b92
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
leaq 0x495e5(%rip), %rcx     # 0x13e3cf
movq %r15, %rdi
xorl %eax, %eax
callq 0xee823
jmp 0xf4b8b