// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/src/fmtutil-lzah.c
// Function: dfilter_lh1_codec
void dfilter_lh1_codec(struct de_dfilter_ctx *dfctx, void *codec_private_params)
{
	struct lzahuf_ctx *cctx = NULL;

	cctx = de_malloc(dfctx->c, sizeof(struct lzahuf_ctx));
	cctx->c = dfctx->c;
	cctx->modname = "lzhuf";
	cctx->dfctx = dfctx;
	cctx->dcmpro = dfctx->dcmpro;
	cctx->dres = dfctx->dres;

	dfctx->codec_private = (void*)cctx;
	dfctx->codec_addbuf_fn = my_lh1_codec_addbuf;
	dfctx->codec_finish_fn = my_lh1_codec_finish;
	dfctx->codec_command_fn = my_lh1_codec_command;
	dfctx->codec_destroy_fn = my_lh1_codec_destroy;

	if(codec_private_params) {
		// Use params from caller, if present.
		de_memcpy(&cctx->lh1p, codec_private_params, sizeof(struct de_lh1_params));
	}
	else {
		// Set default params.
		cctx->lh1p.history_fill_val = 0x20;
	}

	lzhuf_Decode_init(cctx);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rdi
movl $0x11c8, %esi           # imm = 0x11C8
callq 0xdecaf
movq %rax, %rbx
movq (%r15), %rdi
movq %rdi, (%rax)
leaq 0x1d389(%rip), %rax     # 0x1172fe
movq %rax, 0x8(%rbx)
movq %r15, 0x18(%rbx)
movdqu 0x8(%r15), %xmm0
pshufd $0x4e, %xmm0, %xmm0     # xmm0 = xmm0[2,3,0,1]
movdqu %xmm0, 0x20(%rbx)
movq %rbx, 0x28(%r15)
leaq 0x30e(%rip), %rax       # 0xfa2a6
movq %rax, 0x30(%r15)
leaq 0x338(%rip), %rax       # 0xfa2db
movq %rax, 0x40(%r15)
leaq 0x38b(%rip), %rax       # 0xfa339
movq %rax, 0x38(%r15)
leaq 0x3d8(%rip), %rax       # 0xfa391
movq %rax, 0x48(%r15)
testq %r14, %r14
je 0xf9fd1
movb 0x4(%r14), %al
movb %al, 0x15(%rbx)
movl (%r14), %eax
movl %eax, 0x11(%rbx)
jmp 0xf9fd5
movb $0x20, 0x15(%rbx)
movabsq $0xfd0000003a, %rax     # imm = 0xFD0000003A
movq %rax, 0x30(%rbx)
movaps 0x44d96(%rip), %xmm0    # 0x13ed80
movups %xmm0, 0x44(%rbx)
cmpb $0x0, 0x11(%rbx)
movb 0x12(%rbx), %cl
pushq $0x3a
popq %rax
je 0xfa00e
movl $0x1, 0x44(%rbx)
movl $0xfe, 0x34(%rbx)
testb %cl, %cl
jne 0xfa024
jmp 0xfa039
testb %cl, %cl
je 0xfa24b
movl $0x1, 0x44(%rbx)
movl $0xfe, 0x34(%rbx)
movabsq $0x300000005, %rcx      # imm = 0x300000005
movq %rcx, 0x48(%rbx)
movl $0x1f, 0x50(%rbx)
movl $0x800, %esi            # imm = 0x800
movl $0x101, %ecx            # imm = 0x101
addl %ecx, %eax
movl %eax, 0x38(%rbx)
leal -0x1(,%rax,2), %ecx
movl %ecx, 0x3c(%rbx)
leal -0x2(,%rax,2), %eax
movl %eax, 0x40(%rbx)
callq 0xef27c
movq %rax, 0x68(%rbx)
movq %rbx, (%rax)
leaq 0xb8e(%rip), %rcx       # 0xfabfd
movq %rcx, 0x8(%rax)
movzbl 0x15(%rbx), %esi
testl %esi, %esi
je 0xfa083
movq %rax, %rdi
callq 0xef2e9
movq %rbx, %rdi
addq $0x70, %rdi
movb $0x0, 0x70(%rbx)
callq 0xe6a40
movl 0x38(%rbx), %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0xfa0f8
cmpq $0x278, %rcx            # imm = 0x278
jae 0xfa0cc
movw $0x1, 0x80(%rbx,%rcx,2)
movl 0x3c(%rbx), %esi
leaq (%rcx,%rsi), %rdx
cmpq $0x277, %rcx            # imm = 0x277
je 0xfa0d1
addl %ecx, %esi
movw %si, 0xcd6(%rbx,%rcx,2)
jmp 0xfa0d8
movl 0x3c(%rbx), %edx
addl %ecx, %edx
movl $0x1, 0x54(%rbx)
cmpl $0x3b2, %edx            # imm = 0x3B2
ja 0xfa0ec
movl %edx, %edx
movw %cx, 0x570(%rbx,%rdx,2)
jmp 0xfa0f3
movl $0x1, 0x54(%rbx)
incq %rcx
jmp 0xfa098
movl 0x40(%rbx), %edx
xorl %ecx, %ecx
cmpl %edx, %eax
ja 0xfa19c
movl %ecx, %esi
cmpl $0x277, %ecx            # imm = 0x277
ja 0xfa126
movzwl 0x80(%rbx,%rsi,2), %r8d
leal 0x1(%rcx), %edi
movzwl 0x80(%rbx,%rdi,2), %r9d
jmp 0xfa138
movl %ecx, %edi
orl $0x1, %edi
movl $0x1, 0x54(%rbx)
xorl %r8d, %r8d
xorl %r9d, %r9d
cmpl $0x277, %eax            # imm = 0x277
ja 0xfa155
addl %r8d, %r9d
movl %eax, %r8d
movw %r9w, 0x80(%rbx,%r8,2)
cmpl $0x277, %eax            # imm = 0x277
jne 0xfa15e
movl $0x1, 0x54(%rbx)
jmp 0xfa167
movw %cx, 0xcd6(%rbx,%r8,2)
cmpl $0x3b2, %ecx            # imm = 0x3B2
ja 0xfa18b
movw %ax, 0x570(%rbx,%rsi,2)
cmpl $0x3b2, %edi            # imm = 0x3B2
ja 0xfa18b
movl %edi, %esi
movw %ax, 0x570(%rbx,%rsi,2)
jmp 0xfa192
movl $0x1, 0x54(%rbx)
addl $0x2, %ecx
incl %eax
jmp 0xfa0fd
movl 0x3c(%rbx), %eax
cmpq $0x277, %rax            # imm = 0x277
ja 0xfa1b2
orw $-0x1, 0x80(%rbx,%rax,2)
jmp 0xfa1b9
movl $0x1, 0x54(%rbx)
cmpl $0x3b2, %edx            # imm = 0x3B2
ja 0xfa1cc
andw $0x0, 0x570(%rbx,%rdx,2)
jmp 0xfa1d3
movl $0x1, 0x54(%rbx)
cmpb $0x0, 0x10(%rbx)
je 0xfa241
movq (%rbx), %rdi
leaq 0x44be2(%rip), %rsi     # 0x13edc5
xorl %eax, %eax
callq 0xde896
movq (%rbx), %rdi
movl 0x3c(%rbx), %edx
leaq 0x43e70(%rip), %rsi     # 0x13e067
xorl %eax, %eax
callq 0xde896
movl 0x40(%rbx), %esi
movq %rsp, %r8
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xfac2c
leaq 0x44bb4(%rip), %r14     # 0x13edcb
xorl %r15d, %r15d
cmpq $0x277, %r15            # imm = 0x277
je 0xfa241
movq (%rbx), %rdi
movzwl 0xcd6(%rbx,%r15,2), %ecx
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0xde896
incq %r15
jmp 0xfa21a
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
cmpb $0x0, 0x13(%rbx)
je 0xfa278
movl $0x1, 0x44(%rbx)
movabsq $0xfe00000039, %rax     # imm = 0xFE00000039
movq %rax, 0x30(%rbx)
movl $0x1000, %esi           # imm = 0x1000
movl $0x101, %ecx            # imm = 0x101
pushq $0x39
popq %rax
jmp 0xfa043
movl $0x100, %ecx            # imm = 0x100
cmpb $0x0, 0x14(%rbx)
je 0xfa29c
movq $0x8, 0x48(%rbx)
movl $0xff, 0x50(%rbx)
movl $0x4000, %esi           # imm = 0x4000
jmp 0xfa043
movl $0x1000, %esi           # imm = 0x1000
jmp 0xfa043