// File: /workspace/github_c_makefile_star2_O1/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 0xe969b
movq %rax, %rbx
movq (%r15), %rdi
movq %rdi, (%rax)
leaq 0x1d63d(%rip), %rax     # 0x1242de
movq %rax, 0x8(%rbx)
movq %r15, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x28(%rbx)
movq %rbx, 0x28(%r15)
leaq 0x332(%rip), %rax       # 0x106ff6
movq %rax, 0x30(%r15)
leaq 0x35c(%rip), %rax       # 0x10702b
movq %rax, 0x40(%r15)
leaq 0x3b1(%rip), %rax       # 0x10708b
movq %rax, 0x38(%r15)
leaq 0x403(%rip), %rax       # 0x1070e8
movq %rax, 0x48(%r15)
testq %r14, %r14
je 0x106cfd
movb 0x4(%r14), %al
movb %al, 0x15(%rbx)
movl (%r14), %eax
movl %eax, 0x11(%rbx)
jmp 0x106d01
movb $0x20, 0x15(%rbx)
movaps 0x44f58(%rip), %xmm0    # 0x14bc60
movups %xmm0, 0x44(%rbx)
movabsq $0xfd0000003a, %rax     # imm = 0xFD0000003A
movq %rax, 0x30(%rbx)
cmpb $0x0, 0x11(%rbx)
jne 0x106d2a
cmpb $0x0, 0x12(%rbx)
je 0x106fb2
movl $0x1, 0x44(%rbx)
movabsq $0xfe0000003a, %rax     # imm = 0xFE0000003A
movq %rax, 0x30(%rbx)
movl $0x800, %esi            # imm = 0x800
cmpb $0x0, 0x12(%rbx)
je 0x106d5f
movabsq $0x300000005, %rax      # imm = 0x300000005
movq %rax, 0x48(%rbx)
movl $0x1f, 0x50(%rbx)
movl 0x30(%rbx), %eax
movl 0x44(%rbx), %ecx
addl %ecx, %eax
addl $0x100, %eax            # imm = 0x100
movl %eax, 0x38(%rbx)
cmpl $0x13d, %eax            # imm = 0x13D
jb 0x106d82
movl $0x1, 0x54(%rbx)
jmp 0x106fa8
leal -0x1(,%rax,2), %ecx
movl %ecx, 0x3c(%rbx)
leal -0x2(,%rax,2), %eax
movl %eax, 0x40(%rbx)
callq 0xfb2c3
movq %rax, 0x68(%rbx)
movq %rbx, (%rax)
leaq 0xc91(%rip), %rcx       # 0x107a3a
movq %rcx, 0x8(%rax)
movzbl 0x15(%rbx), %esi
testl %esi, %esi
je 0x106dbd
movq %rax, %rdi
callq 0xfb332
movq %rbx, %rdi
addq $0x70, %rdi
movb $0x0, 0x70(%rbx)
callq 0xf2261
movl 0x38(%rbx), %eax
testq %rax, %rax
je 0x106e3a
movl 0x3c(%rbx), %ecx
xorl %edx, %edx
cmpq $0x277, %rdx            # imm = 0x277
ja 0x106def
movw $0x1, 0x80(%rbx,%rdx,2)
jmp 0x106df6
movl $0x1, 0x54(%rbx)
cmpq $0x276, %rdx            # imm = 0x276
ja 0x106e0c
leal (%rcx,%rdx), %esi
movw %si, 0xcd6(%rbx,%rdx,2)
jmp 0x106e13
movl $0x1, 0x54(%rbx)
leaq (%rcx,%rdx), %rsi
cmpl $0x3b2, %esi            # imm = 0x3B2
ja 0x106e2b
movl %esi, %esi
movw %dx, 0x570(%rbx,%rsi,2)
jmp 0x106e32
movl $0x1, 0x54(%rbx)
incq %rdx
cmpq %rdx, %rax
jne 0x106dda
movl 0x40(%rbx), %edx
cmpl %edx, %eax
ja 0x106f03
xorl %ecx, %ecx
cmpl $0x277, %ecx            # imm = 0x277
ja 0x106e5b
movl %ecx, %esi
movzwl 0x80(%rbx,%rsi,2), %edi
jmp 0x106e64
movl $0x1, 0x54(%rbx)
xorl %edi, %edi
leal 0x1(%rcx), %esi
cmpl $0x277, %ecx            # imm = 0x277
ja 0x106e7d
movl %esi, %r8d
movzwl 0x80(%rbx,%r8,2), %r8d
jmp 0x106e87
movl $0x1, 0x54(%rbx)
xorl %r8d, %r8d
cmpl $0x277, %eax            # imm = 0x277
ja 0x106e9e
addl %edi, %r8d
movl %eax, %edi
movw %r8w, 0x80(%rbx,%rdi,2)
jmp 0x106ea5
movl $0x1, 0x54(%rbx)
cmpl $0x276, %eax            # imm = 0x276
ja 0x106eb8
movl %eax, %edi
movw %cx, 0xcd6(%rbx,%rdi,2)
jmp 0x106ebf
movl $0x1, 0x54(%rbx)
cmpl $0x3b2, %ecx            # imm = 0x3B2
ja 0x106ed3
movl %ecx, %ecx
movw %ax, 0x570(%rbx,%rcx,2)
jmp 0x106eda
movl $0x1, 0x54(%rbx)
cmpl $0x3b2, %esi            # imm = 0x3B2
ja 0x106eee
movl %esi, %ecx
movw %ax, 0x570(%rbx,%rcx,2)
jmp 0x106ef5
movl $0x1, 0x54(%rbx)
incl %eax
incl %esi
movl %esi, %ecx
cmpl %edx, %eax
jbe 0x106e47
movl 0x3c(%rbx), %eax
cmpq $0x277, %rax            # imm = 0x277
ja 0x106f1a
movw $0xffff, 0x80(%rbx,%rax,2) # imm = 0xFFFF
jmp 0x106f21
movl $0x1, 0x54(%rbx)
cmpl $0x3b2, %edx            # imm = 0x3B2
ja 0x106f35
movw $0x0, 0x570(%rbx,%rdx,2)
jmp 0x106f3c
movl $0x1, 0x54(%rbx)
cmpb $0x0, 0x10(%rbx)
je 0x106fa8
movq (%rbx), %rdi
leaq 0x44d59(%rip), %rsi     # 0x14bca5
xorl %eax, %eax
callq 0xe9226
movq (%rbx), %rdi
movl 0x3c(%rbx), %edx
leaq 0x43fe0(%rip), %rsi     # 0x14af40
xorl %eax, %eax
callq 0xe9226
movl 0x40(%rbx), %esi
movq %rsp, %r8
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x107a6e
leaq 0x44d2b(%rip), %r14     # 0x14bcab
xorl %r15d, %r15d
movq (%rbx), %rdi
movzwl 0xcd6(%rbx,%r15,2), %ecx
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe9226
incq %r15
cmpq $0x277, %r15            # imm = 0x277
jne 0x106f83
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
cmpb $0x0, 0x13(%rbx)
je 0x106fd7
movl $0x1, 0x44(%rbx)
movabsq $0xfe00000039, %rax     # imm = 0xFE00000039
movq %rax, 0x30(%rbx)
movl $0x1000, %esi           # imm = 0x1000
jmp 0x106d5f
cmpb $0x0, 0x14(%rbx)
je 0x106fcd
movq $0x8, 0x48(%rbx)
movl $0xff, 0x50(%rbx)
movl $0x4000, %esi           # imm = 0x4000
jmp 0x106d5f